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

master
jiyufei 3 months ago
parent 80294f95f5
commit 412651bfed

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

@ -45,8 +45,8 @@
<el-col :span="12">
<jnpf-form-tip-item label="开始时间" prop="effectiveStartTime">
<JnpfDatePicker v-model="dataForm.effectiveStartTime" @change="changeData('effectiveStartTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable
:style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
@ -54,15 +54,15 @@
<el-col :span="12">
<jnpf-form-tip-item label="结束时间" prop="effectiveEndTime">
<JnpfDatePicker v-model="dataForm.effectiveEndTime" @change="changeData('effectiveEndTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable
:style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="出入码" prop="entryCodes">
<JnpfInput v-model="dataForm.entryCodes" @change="changeData('entryCodes', -1)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
<JnpfInput v-model="dataForm.entryCodes" @change="changeData('entryCodes', -1)" placeholder="请输入"
clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
@ -81,7 +81,6 @@
:style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<el-form label-width="100px">
@ -286,7 +285,7 @@ export default {
getQRimg() {
if (this.dataForm.userCode == null || this.dataForm.userName == 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('请完善必填信息');
return
}

@ -92,9 +92,6 @@
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
</el-col>
<!-- 表单结束 -->
</template>
@ -316,8 +313,8 @@ export default {
mounted() { },
methods: {
selectChangeData(var1, var2) {
this.dataForm.ascriptionId = var1.id;
this.dataForm.ascriptionName = var1.cmp_nm;
this.dataForm.ascriptionId = var2.id;
this.dataForm.ascriptionName = var2.cmp_nm;
},
depSelectChangeData(var1, var2) {
this.dataForm.ascriptionId = var2.id;

Loading…
Cancel
Save