feat(front):车辆管理问题修复;

master
jiyufei 3 months ago
parent 80294f95f5
commit 412651bfed

@ -13,24 +13,31 @@ import jnpf.entity.*;
import jnpf.util.*; import jnpf.util.*;
import jnpf.model.vehicle.*; import jnpf.model.vehicle.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO; import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO; import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Vehicle * Vehicle
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -38,7 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@Tag(name = "Vehicle" , description = "example") @Tag(name = "Vehicle", description = "example")
@RequestMapping("/api/example/Vehicle") @RequestMapping("/api/example/Vehicle")
public class VehicleController { public class VehicleController {
@ -51,24 +58,26 @@ public class VehicleController {
@Autowired @Autowired
private VehicleService vehicleService; private VehicleService vehicleService;
@Resource
private EnterpriseMerchantsService enterpriseMerchantsService;
/** /**
* *
* *
* @param vehiclePagination * @param vehiclePagination
* @return * @return
*/ */
@Operation(summary = "获取列表") @Operation(summary = "获取列表")
@PostMapping("/getList") @PostMapping("/getList")
public ActionResult list(@RequestBody VehiclePagination vehiclePagination)throws IOException{ public ActionResult list(@RequestBody VehiclePagination vehiclePagination) throws IOException {
List<VehicleEntity> list= vehicleService.getList(vehiclePagination); List<VehicleEntity> list = vehicleService.getList(vehiclePagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList = new ArrayList<>();
for (VehicleEntity entity : list) { for (VehicleEntity entity : list) {
Map<String, Object> vehicleMap=JsonUtil.entityToMap(entity); Map<String, Object> vehicleMap = JsonUtil.entityToMap(entity);
vehicleMap.put("id", vehicleMap.get("id")); vehicleMap.put("id", vehicleMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(vehicleMap); realList.add(vehicleMap);
} }
//数据转换 //数据转换
@ -81,110 +90,123 @@ public class VehicleController {
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
* @param vehicleForm * @param vehicleForm
* @return * @return
*/ */
@PostMapping() @PostMapping()
@Operation(summary = "创建") @Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid VehicleForm vehicleForm) { public ActionResult create(@RequestBody @Valid VehicleForm vehicleForm) {
String b = vehicleService.checkForm(vehicleForm,0); String b = vehicleService.checkForm(vehicleForm, 0);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
} }
try{ try {
vehicleService.saveOrUpdate(vehicleForm, null ,true); vehicleService.saveOrUpdate(vehicleForm, null, true);
}catch(Exception e){ } catch (Exception e) {
return ActionResult.fail("新增数据失败"); return ActionResult.fail("新增数据失败");
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }
/** /**
* *
* @param id *
* @param vehicleForm * @param id
* @return * @param vehicleForm
*/ * @return
*/
@PutMapping("/{id}") @PutMapping("/{id}")
@Operation(summary = "更新") @Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid VehicleForm vehicleForm, public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid VehicleForm vehicleForm,
@RequestParam(value = "isImport", required = false) boolean isImport){ @RequestParam(value = "isImport", required = false) boolean isImport) {
vehicleForm.setId(id); vehicleForm.setId(id);
if (!isImport) { if (!isImport) {
String b = vehicleService.checkForm(vehicleForm,1); String b = vehicleService.checkForm(vehicleForm, 1);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
} }
} }
VehicleEntity entity= vehicleService.getInfo(id); VehicleEntity entity = vehicleService.getInfo(id);
if(entity!=null){ if (entity != null) {
try{ try {
vehicleService.saveOrUpdate(vehicleForm,id,false); vehicleService.saveOrUpdate(vehicleForm, id, false);
}catch(Exception e){ } catch (Exception e) {
return ActionResult.fail("修改数据失败"); return ActionResult.fail("修改数据失败");
} }
return ActionResult.success("更新成功"); return ActionResult.success("更新成功");
}else{ } else {
return ActionResult.fail("更新失败,数据不存在"); return ActionResult.fail("更新失败,数据不存在");
} }
} }
/** /**
* *
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "删除") @Operation(summary = "删除")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id) {
VehicleEntity entity= vehicleService.getInfo(id); VehicleEntity entity = vehicleService.getInfo(id);
if(entity!=null){ if (entity != null) {
//假删除 //假删除
entity.setDeleteMark(1); entity.setDeleteMark(1);
vehicleService.update(id,entity); vehicleService.update(id, entity);
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "表单信息(详情页)") @Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){ public ActionResult detailInfo(@PathVariable("id") String id) {
VehicleEntity entity= vehicleService.getInfo(id); VehicleEntity entity = vehicleService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> vehicleMap=JsonUtil.entityToMap(entity); Map<String, Object> vehicleMap = JsonUtil.entityToMap(entity);
vehicleMap.put("id", vehicleMap.get("id")); vehicleMap.put("id", vehicleMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
vehicleMap = generaterSwapUtil.swapDataDetail(vehicleMap,VehicleConstant.getFormData(),"582912646513169797",false); vehicleMap = generaterSwapUtil.swapDataDetail(vehicleMap, VehicleConstant.getFormData(), "582912646513169797", false);
if ("null".equals(vehicleMap.get("ascriptionId")) && "商户".equals(vehicleMap.get("vehicleAscription"))) {
//手动查询商户赋值
vehicleMap.put("ascriptionId", enterpriseMerchantsService.findNameById(entity.getAscriptionId()));
}
return ActionResult.success(vehicleMap); return ActionResult.success(vehicleMap);
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "信息") @Operation(summary = "信息")
@GetMapping("/{id}") @GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){ public ActionResult info(@PathVariable("id") String id) {
VehicleEntity entity= vehicleService.getInfo(id); VehicleEntity entity = vehicleService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> vehicleMap=JsonUtil.entityToMap(entity); Map<String, Object> vehicleMap = JsonUtil.entityToMap(entity);
vehicleMap.put("id", vehicleMap.get("id")); vehicleMap.put("id", vehicleMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
vehicleMap = generaterSwapUtil.swapDataForm(vehicleMap,VehicleConstant.getFormData(),VehicleConstant.TABLEFIELDKEY,VehicleConstant.TABLERENAMES); vehicleMap = generaterSwapUtil.swapDataForm(vehicleMap, VehicleConstant.getFormData(), VehicleConstant.TABLEFIELDKEY, VehicleConstant.TABLERENAMES);
return ActionResult.success(vehicleMap); return ActionResult.success(vehicleMap);
} }

@ -45,8 +45,8 @@
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="开始时间" prop="effectiveStartTime"> <jnpf-form-tip-item label="开始时间" prop="effectiveStartTime">
<JnpfDatePicker v-model="dataForm.effectiveStartTime" @change="changeData('effectiveStartTime', -1)" <JnpfDatePicker v-model="dataForm.effectiveStartTime" @change="changeData('effectiveStartTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
:style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd"> clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -54,15 +54,15 @@
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="结束时间" prop="effectiveEndTime"> <jnpf-form-tip-item label="结束时间" prop="effectiveEndTime">
<JnpfDatePicker v-model="dataForm.effectiveEndTime" @change="changeData('effectiveEndTime', -1)" <JnpfDatePicker v-model="dataForm.effectiveEndTime" @change="changeData('effectiveEndTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
:style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd"> clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="出入码" prop="entryCodes"> <jnpf-form-tip-item label="出入码" prop="entryCodes">
<JnpfInput v-model="dataForm.entryCodes" @change="changeData('entryCodes', -1)" placeholder="请输入" clearable <JnpfInput v-model="dataForm.entryCodes" @change="changeData('entryCodes', -1)" placeholder="请输入"
:style='{ "width": "100%" }'> clearable :style='{ "width": "100%" }'>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -81,18 +81,17 @@
:style='{ "width": "100%" }'> :style='{ "width": "100%" }'>
</JnpfPopupSelect> </JnpfPopupSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form label-width="100px"> <el-form label-width="100px">
<jnpf-form-tip-item label="生成二维码"> <jnpf-form-tip-item label="生成二维码">
<el-button type="primary" @click="getQRimg"> </el-button> <el-button type="primary" @click="getQRimg"> </el-button>
</jnpf-form-tip-item> </jnpf-form-tip-item>
<el-form-item label="二维码图像"> <el-form-item label="二维码图像">
<div id="qrcode" ref="qrCode"></div> <div id="qrcode" ref="qrCode"></div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
@ -284,46 +283,46 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
getQRimg() { getQRimg() {
if (this.dataForm.userCode == null || this.dataForm.userName == null || if (this.dataForm.userCode == null || this.dataForm.userName == null ||
this.dataForm.phone == null || this.dataForm.userAscription == null || this.dataForm.idCard == null this.dataForm.phone == null || this.dataForm.userAscription == null || this.dataForm.idCard == null
|| this.dataForm.effectiveStartTime == null || this.dataForm.effectiveEndTime == null|| this.dataForm.entryCodes == null) { || this.dataForm.effectiveStartTime == null || this.dataForm.effectiveEndTime == null || this.dataForm.entryCodes == null) {
this.$message.error('请完善必填信息'); this.$message.error('请完善必填信息');
return return
} }
let qrCodeJsonString = JSON.stringify(this.dataForm); let qrCodeJsonString = JSON.stringify(this.dataForm);
this.qrcode = qrCodeJsonString; this.qrcode = qrCodeJsonString;
if (!this.qrcode) { if (!this.qrcode) {
return return
} }
this.$refs.qrCode.innerHTML = ""; this.$refs.qrCode.innerHTML = "";
let qrcode = new QRCode(this.$refs.qrCode, { let qrcode = new QRCode(this.$refs.qrCode, {
width: 265, width: 265,
height: 265, // height: 265, //
text: this.qrcode, // text: this.qrcode, //
// render: 'canvas' // tablecanvascanvas // render: 'canvas' // tablecanvascanvas
// background: '#f0f' // background: '#f0f'
// foreground: '#ff0' // foreground: '#ff0'
correctLevel: QRCode.CorrectLevel.H // 1QRCode.CorrectLevel.L 2QRCode.CorrectLevel.M 3QRCode.CorrectLevel.Q 4QRCode.CorrectLevel.H correctLevel: QRCode.CorrectLevel.H // 1QRCode.CorrectLevel.L 2QRCode.CorrectLevel.M 3QRCode.CorrectLevel.Q 4QRCode.CorrectLevel.H
}) })
}, },
getBarcode() { getBarcode() {
let reg = /^[A-Za-z0-9]+$/ let reg = /^[A-Za-z0-9]+$/
if (!reg.test(this.barcode)) { if (!reg.test(this.barcode)) {
this.$message({ this.$message({
message: '请输入数字或者英文字母', message: '请输入数字或者英文字母',
type: 'error', type: 'error',
duration: 1500, duration: 1500,
}) })
return return
} }
JsBarcode("#barcode", this.barcode, { JsBarcode("#barcode", this.barcode, {
// format: "pharmacode", // format: "pharmacode",
// lineColor: "#0aa", // lineColor: "#0aa",
width: 4, width: 4,
height: 80, height: 80,
displayValue: false displayValue: false
}); });
}, },
selectChangeData(var1, var2) { selectChangeData(var1, var2) {
this.dataForm.merchantId = var2.id; this.dataForm.merchantId = var2.id;
this.dataForm.merchantName = var2.cmp_nm; this.dataForm.merchantName = var2.cmp_nm;

@ -41,7 +41,7 @@
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="联系电话" prop="contactsPhone"> <jnpf-form-tip-item label="联系电话" prop="contactsPhone">
<JnpfInput v-model="dataForm.contactsPhone" @change="changeData('contactsPhone',-1)" placeholder="请输入" <JnpfInput v-model="dataForm.contactsPhone" @change="changeData('contactsPhone',-1)" placeholder="请输入"
@ -92,9 +92,6 @@
:style='{"width":"100%"}'> :style='{"width":"100%"}'>
</JnpfPopupSelect> </JnpfPopupSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col>
<el-col :span="8">
</el-col> </el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
@ -316,8 +313,8 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
selectChangeData(var1, var2) { selectChangeData(var1, var2) {
this.dataForm.ascriptionId = var1.id; this.dataForm.ascriptionId = var2.id;
this.dataForm.ascriptionName = var1.cmp_nm; this.dataForm.ascriptionName = var2.cmp_nm;
}, },
depSelectChangeData(var1, var2) { depSelectChangeData(var1, var2) {
this.dataForm.ascriptionId = var2.id; this.dataForm.ascriptionId = var2.id;

Loading…
Cancel
Save