update:完善国内整车型号流程和国内整车型号管控库
This commit is contained in:
+43
-8
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.activiti.process.vehicledomestic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
@@ -11,7 +12,6 @@ import com.jero.modules.activiti.common.ActivitiCommon;
|
||||
import com.jero.modules.activiti.entity.ProcessAll;
|
||||
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
import com.jero.modules.activiti.process.abolish.entity.ProcessAbolishRelease;
|
||||
import com.jero.modules.activiti.process.common.enums.ProcessType;
|
||||
import com.jero.modules.activiti.process.common.service.ActFlowCommonService;
|
||||
import com.jero.modules.activiti.process.fb.dto.BasicProcessInfoDTO;
|
||||
@@ -147,6 +147,9 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
if (CollectionUtils.isEmpty(excelList)) {
|
||||
throw new JeroBootException("没有数据可导入");
|
||||
}
|
||||
if (excelList.size() > 1) {
|
||||
throw new JeroBootException("一次只能导入一条数据");
|
||||
}
|
||||
// 校验数据
|
||||
StringBuilder msg = validatorExcel(energyType, excelList);
|
||||
if (StringUtils.isNotEmpty(msg.toString())) {
|
||||
@@ -163,7 +166,7 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK(excelList);
|
||||
return Result.OK(excelList.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,7 +285,7 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
runtimeService.setVariables(processInstanceId,actVariables);
|
||||
String userId = actFlowCommonService.getOriginTaskAssignee(taskId);
|
||||
// 发起节点 更新业务数据
|
||||
startNodeBusProcess(processInfoVO);
|
||||
updateNodeBusProcess(processInfoVO, processInstanceId);
|
||||
// 更新审批表为完成,填充数据
|
||||
actFlowCommonService.updateApprovalInfo(processTask, taskId);
|
||||
// 审批节点
|
||||
@@ -330,11 +333,10 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
LambdaQueryWrapper<ProcessVehicleDomesticRelease> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ProcessVehicleDomesticRelease::getProcessInstanceId, processInstanceId);
|
||||
ProcessVehicleDomesticRelease processVehicleDomesticRelease = getOne(lambdaQueryWrapper,false);
|
||||
processVehicleDomesticReleaseVo.setCopyUser(processVehicleDomesticRelease.getCopyUser());
|
||||
BeanUtils.copyProperties(processVehicleDomesticRelease, processVehicleDomesticReleaseVo);
|
||||
// 业务主表
|
||||
LawsVehicleDomesticLibrary lawsVehicleDomesticLibrary = lawsVehicleDomesticLibraryService.getById(processVehicleDomesticRelease.getVehicleId());
|
||||
processVehicleDomesticReleaseVo.setRemark(lawsVehicleDomesticLibrary.getRemark());
|
||||
processVehicleDomesticReleaseVo.setEnergyType(lawsVehicleDomesticLibrary.getEnergyType());
|
||||
BeanUtils.copyProperties(lawsVehicleDomesticLibrary, processVehicleDomesticReleaseVo);
|
||||
// 业务子表
|
||||
LambdaQueryWrapper<LawsVehicleDomesticLibrarySublist> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(LawsVehicleDomesticLibrarySublist::getVehicleId, processVehicleDomesticRelease.getVehicleId());
|
||||
@@ -371,6 +373,7 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
|
||||
private void startNodeBusProcess(ProcessInfoVO<ProcessVehicleDomesticReleaseVo> processInfoVO) {
|
||||
ProcessVehicleDomesticReleaseVo businessInfoDTO = processInfoVO.getBusinessInfoDTO();
|
||||
// 根据id是否存在来决定是更新还是保存操作,考虑使用saveOrUpdate方法
|
||||
// 保存数据到 国内整车型号及VIN前八位管控库表
|
||||
LawsVehicleDomesticLibrary lawsVehicleDomesticLibrary = new LawsVehicleDomesticLibrary();
|
||||
BeanUtils.copyProperties(businessInfoDTO, lawsVehicleDomesticLibrary);
|
||||
@@ -391,6 +394,38 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
this.save(processVehicleDomesticRelease);
|
||||
}
|
||||
|
||||
private void updateNodeBusProcess(ProcessInfoVO<ProcessVehicleDomesticReleaseVo> processInfoVO, String processInstanceId) {
|
||||
ProcessVehicleDomesticReleaseVo businessInfoDTO = processInfoVO.getBusinessInfoDTO();
|
||||
ProcessVehicleDomesticRelease processVehicleDomesticRelease = getOne(new LambdaQueryWrapper<ProcessVehicleDomesticRelease>().eq(ProcessVehicleDomesticRelease::getProcessInstanceId, processInstanceId), false);
|
||||
String vehicleId = processVehicleDomesticRelease.getVehicleId();
|
||||
// 更新数据到 流程表
|
||||
ProcessVehicleDomesticRelease newProcessVehicleDomesticRelease = new ProcessVehicleDomesticRelease();
|
||||
BeanUtils.copyProperties(businessInfoDTO, newProcessVehicleDomesticRelease);
|
||||
newProcessVehicleDomesticRelease.setId(processVehicleDomesticRelease.getId());
|
||||
this.updateById(newProcessVehicleDomesticRelease);
|
||||
// 更新数据到 业务主表
|
||||
LambdaUpdateWrapper<LawsVehicleDomesticLibrary> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(LawsVehicleDomesticLibrary::getId, vehicleId);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getIsFinish, Constant.NOT_FINISH);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getApplicant, UserUtils.getUserId());
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getEnergyType, businessInfoDTO.getEnergyType());
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getRemark, businessInfoDTO.getRemark());
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getVehicleModel, null);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getVinTopEight, null);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getVehicleBasis, null);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getVinBasis, null);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getRegulatoryEngineer, null);
|
||||
lawsVehicleDomesticLibraryService.update(lambdaUpdateWrapper);
|
||||
// 更新数据到 业务子表
|
||||
LawsVehicleDomesticLibrarySublist lawsVehicleDomesticLibrarySublist = new LawsVehicleDomesticLibrarySublist();
|
||||
BeanUtils.copyProperties(businessInfoDTO, lawsVehicleDomesticLibrarySublist);
|
||||
lawsVehicleDomesticLibrarySublist.setVehicleId(vehicleId);
|
||||
LawsVehicleDomesticLibrarySublist lawsVehicleDomesticLibrarySublist1 = lawsVehicleDomesticLibrarySublistService.getOne(new LambdaQueryWrapper<LawsVehicleDomesticLibrarySublist>()
|
||||
.eq(LawsVehicleDomesticLibrarySublist::getVehicleId, vehicleId), false);
|
||||
lawsVehicleDomesticLibrarySublist.setId(lawsVehicleDomesticLibrarySublist1.getId());
|
||||
lawsVehicleDomesticLibrarySublistService.updateById(lawsVehicleDomesticLibrarySublist);
|
||||
}
|
||||
|
||||
private Map<String, Object> setVariables(Map<String, Object> userInfoMap) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 人员信息
|
||||
@@ -435,11 +470,11 @@ public class ProcessVehicleDomesticReleaseServiceImpl extends ServiceImpl<Proces
|
||||
// 校验通用字段
|
||||
BaseExcel baseExcel = new BaseExcel();
|
||||
BeanUtils.copyProperties(fuelOilExcel, baseExcel);
|
||||
validateCommonFields(baseExcel, i, msgSub); // 不再赋值 msgSub
|
||||
validateCommonFields(baseExcel, i, msgSub);
|
||||
// 校验燃油类型的特有字段
|
||||
OilAndHybridExcel oilAndHybridExcel = new OilAndHybridExcel();
|
||||
BeanUtils.copyProperties(fuelOilExcel, oilAndHybridExcel);
|
||||
validateOilAndHybridFields(oilAndHybridExcel, i , msgSub); // 不再赋值 msgSub
|
||||
validateOilAndHybridFields(oilAndHybridExcel, i , msgSub);
|
||||
if (msgSub.length() > 0) {
|
||||
msg.append(msgSub).append(NEWLINE_CHARACTER);
|
||||
}
|
||||
|
||||
+15
-8
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.activiti.process.vehicledomestic.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -20,6 +21,7 @@ public class ProcessVehicleDomesticReleaseVo {
|
||||
private String copyUser;
|
||||
|
||||
@ApiModelProperty(value = "能源类型")
|
||||
@Dict(dicCode = "dvm_energy_type")
|
||||
private String energyType;
|
||||
|
||||
@ApiModelProperty(value = "整车型号")
|
||||
@@ -38,22 +40,25 @@ public class ProcessVehicleDomesticReleaseVo {
|
||||
private String insteadVehicleModel;
|
||||
|
||||
@ApiModelProperty(value = "申请人")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String applicant;
|
||||
|
||||
@ApiModelProperty(value = "法规工程师")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String regulatoryEngineer;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
@Dict(dicCode = "dvm_status")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "完成日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date finishDate;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "法规工程师")
|
||||
private String regulatoryEngineer;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "车型代码")
|
||||
private String vehicleTypeCode;
|
||||
|
||||
@@ -109,6 +114,7 @@ public class ProcessVehicleDomesticReleaseVo {
|
||||
private String batteryType;
|
||||
|
||||
@ApiModelProperty(value = "混合方式")
|
||||
@Dict(dicCode = "dvm_mixed_model")
|
||||
private String mixedModel;
|
||||
|
||||
@ApiModelProperty(value = "动力电池组标称电压")
|
||||
@@ -118,6 +124,7 @@ public class ProcessVehicleDomesticReleaseVo {
|
||||
private String powerBatteryVolume;
|
||||
|
||||
@ApiModelProperty(value = "驱动电机的布置位置")
|
||||
@Dict(dicCode = "dvm_drive_motor_place")
|
||||
private String driveMotorPlace;
|
||||
|
||||
@ApiModelProperty(value = "排放水平")
|
||||
|
||||
+15
-1
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.aspect.annotation.Translation;
|
||||
import com.jero.modules.activiti.process.vehicledomestic.vo.ProcessVehicleDomesticReleaseVo;
|
||||
import com.jero.modules.laws.businessSupport.entity.LawsVehicleDomesticLibrary;
|
||||
import com.jero.modules.laws.businessSupport.service.ILawsVehicleDomesticLibraryService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -23,7 +25,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
@Api(tags="国内整车型号及VIN前八位管控库")
|
||||
@RestController
|
||||
@RequestMapping("/vehicle/domestic")
|
||||
@RequestMapping("/domesticVehicle/library")
|
||||
@Slf4j
|
||||
public class LawsVehicleDomesticLibraryController {
|
||||
|
||||
@@ -56,6 +58,7 @@ public class LawsVehicleDomesticLibraryController {
|
||||
@AutoLog(value = "国内整车型号及VIN前八位管控库-查看")
|
||||
@ApiOperation(value="国内整车型号及VIN前八位管控库-查看", notes="国内整车型号及VIN前八位管控库-查看")
|
||||
@PostMapping(value = "/queryOne")
|
||||
@Translation
|
||||
// @RequiresPermissions("companyStandardStatistics:edit")
|
||||
public Result<?> queryOne(@RequestBody JSONObject jsonObject) {
|
||||
String id = jsonObject.getString("id");
|
||||
@@ -83,4 +86,15 @@ public class LawsVehicleDomesticLibraryController {
|
||||
public Result<?> abolish(@RequestBody JSONObject jsonObject) {
|
||||
return lawsVehicleDomesticControlLibraryService.abolish(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换
|
||||
*/
|
||||
@AutoLog(value = "国内整车型号及VIN前八位管控库-替换")
|
||||
@ApiOperation(value="国内整车型号及VIN前八位管控库-替换", notes="国内整车型号及VIN前八位管控库-替换")
|
||||
@PostMapping(value = "/replace")
|
||||
// @RequiresPermissions("companyStandardStatistics:delete")
|
||||
public Result<?> replace(@RequestBody ProcessVehicleDomesticReleaseVo processVehicleDomesticReleaseVo) {
|
||||
return lawsVehicleDomesticControlLibraryService.replace(processVehicleDomesticReleaseVo);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-7
@@ -1,12 +1,11 @@
|
||||
package com.jero.modules.laws.businessSupport.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -35,7 +34,8 @@ public class LawsVehicleDomesticLibrary implements Serializable {
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "能源类型")
|
||||
@ApiModelProperty(value = "能源类型 1-传统燃油 2-混合动力 3-纯电动")
|
||||
@Dict(dicCode = "dvm_energy_type")
|
||||
private String energyType;
|
||||
|
||||
@ApiModelProperty(value = "整车型号")
|
||||
@@ -54,23 +54,27 @@ public class LawsVehicleDomesticLibrary implements Serializable {
|
||||
private String insteadVehicleModel;
|
||||
|
||||
@ApiModelProperty(value = "申请人")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String applicant;
|
||||
|
||||
@ApiModelProperty(value = "完成日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private Date finishDate;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "法规工程师")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String regulatoryEngineer;
|
||||
|
||||
@ApiModelProperty(value = "状态 1-生效 2-作废")
|
||||
@Dict(dicCode = "dvm_status")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "逻辑删除")
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty(value = "流程是否完成 0-未完成 1-已完成")
|
||||
|
||||
+7
-4
@@ -1,13 +1,13 @@
|
||||
package com.jero.modules.laws.businessSupport.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -93,7 +93,8 @@ public class LawsVehicleDomesticLibrarySublist implements Serializable {
|
||||
@ApiModelProperty(value = "电池类型")
|
||||
private String batteryType;
|
||||
|
||||
@ApiModelProperty(value = "混合方式")
|
||||
@ApiModelProperty(value = "混合方式 1-串联式 2-并联式 3-混联式")
|
||||
@Dict(dicCode = "dvm_mixed_model")
|
||||
private String mixedModel;
|
||||
|
||||
@ApiModelProperty(value = "动力电池组标称电压")
|
||||
@@ -102,7 +103,8 @@ public class LawsVehicleDomesticLibrarySublist implements Serializable {
|
||||
@ApiModelProperty(value = "动力电池组总成标称容量")
|
||||
private String powerBatteryVolume;
|
||||
|
||||
@ApiModelProperty(value = "驱动电机的布置位置")
|
||||
@ApiModelProperty(value = "驱动电机的布置位置 1-前置 2-中置 3-后置 4-轮边 5-轮毂")
|
||||
@Dict(dicCode = "dvm_drive_motor_place")
|
||||
private String driveMotorPlace;
|
||||
|
||||
@ApiModelProperty(value = "排放水平")
|
||||
@@ -118,6 +120,7 @@ public class LawsVehicleDomesticLibrarySublist implements Serializable {
|
||||
private String frontSeatSideAirbags;
|
||||
|
||||
@ApiModelProperty(value = "逻辑删除")
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
|
||||
+4
-1
@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.activiti.process.vehicledomestic.vo.ProcessVehicleDomesticReleaseVo;
|
||||
import com.jero.modules.laws.businessSupport.entity.LawsVehicleDomesticLibrary;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
@@ -25,4 +25,7 @@ public interface ILawsVehicleDomesticLibraryService extends IService<LawsVehicle
|
||||
Result<?> delete(JSONObject jsonObject);
|
||||
|
||||
Result<?> abolish(JSONObject jsonObject);
|
||||
|
||||
Result<?> replace(ProcessVehicleDomesticReleaseVo processVehicleDomesticReleaseVo);
|
||||
|
||||
}
|
||||
|
||||
+50
-14
@@ -2,14 +2,14 @@ package com.jero.modules.laws.businessSupport.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.activiti.process.vehicledomestic.vo.ProcessVehicleDomesticReleaseVo;
|
||||
import com.jero.modules.laws.businessSupport.common.Constant;
|
||||
import com.jero.modules.laws.businessSupport.entity.LawsVehicleDomesticLibrary;
|
||||
import com.jero.modules.laws.businessSupport.entity.LawsVehicleDomesticLibrarySublist;
|
||||
@@ -17,10 +17,14 @@ import com.jero.modules.laws.businessSupport.mapper.LawsVehicleDomesticLibraryMa
|
||||
import com.jero.modules.laws.businessSupport.service.ILawsVehicleDomesticLibraryService;
|
||||
import com.jero.modules.laws.businessSupport.service.ILawsVehicleDomesticLibrarySublistService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -57,11 +61,16 @@ public class LawsVehicleDomesticLibraryServiceImpl extends ServiceImpl<LawsVehic
|
||||
if (StringUtils.isNotBlank(vehicleTypeCode)) {
|
||||
LambdaQueryWrapper<LawsVehicleDomesticLibrarySublist> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(LawsVehicleDomesticLibrarySublist::getVehicleId);
|
||||
queryWrapper.eq(LawsVehicleDomesticLibrarySublist::getVehicleTypeCode, vehicleTypeCode);
|
||||
queryWrapper.like(LawsVehicleDomesticLibrarySublist::getVehicleTypeCode, vehicleTypeCode);
|
||||
List<LawsVehicleDomesticLibrarySublist> list = lawsVehicleDomesticLibrarySublistService.list(queryWrapper);
|
||||
List<String> ids = list.stream().map(LawsVehicleDomesticLibrarySublist::getId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(LawsVehicleDomesticLibrary::getId, ids);
|
||||
List<String> ids = list.stream().map(LawsVehicleDomesticLibrarySublist::getVehicleId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(ids)) {
|
||||
lambdaQueryWrapper.in(LawsVehicleDomesticLibrary::getId, ids);
|
||||
}else {
|
||||
lambdaQueryWrapper.in(LawsVehicleDomesticLibrary::getId, "");
|
||||
}
|
||||
}
|
||||
lambdaQueryWrapper.eq(LawsVehicleDomesticLibrary::getIsFinish, Constant.IS_FINISH); // 只展示走完流程的数据
|
||||
Page<LawsVehicleDomesticLibrary> page = new Page<>(pageNo, pageSize);
|
||||
Page<LawsVehicleDomesticLibrary> result = page(page, lambdaQueryWrapper);
|
||||
return result;
|
||||
@@ -79,8 +88,11 @@ public class LawsVehicleDomesticLibraryServiceImpl extends ServiceImpl<LawsVehic
|
||||
LambdaQueryWrapper<LawsVehicleDomesticLibrarySublist> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(LawsVehicleDomesticLibrarySublist::getVehicleId, id);
|
||||
LawsVehicleDomesticLibrarySublist lawsVehicleDomesticLibrarySublist = lawsVehicleDomesticLibrarySublistService.getOne(queryWrapper, false);
|
||||
lawsVehicleDomesticLibrary.setLawsVehicleDomesticLibrarySublist(lawsVehicleDomesticLibrarySublist);
|
||||
return Result.OK(lawsVehicleDomesticLibrary);
|
||||
ProcessVehicleDomesticReleaseVo processVehicleDomesticReleaseVo = new ProcessVehicleDomesticReleaseVo();
|
||||
BeanUtils.copyProperties(lawsVehicleDomesticLibrary, processVehicleDomesticReleaseVo);
|
||||
BeanUtils.copyProperties(lawsVehicleDomesticLibrarySublist, processVehicleDomesticReleaseVo);
|
||||
processVehicleDomesticReleaseVo.setId(lawsVehicleDomesticLibrary.getId());
|
||||
return Result.OK(processVehicleDomesticReleaseVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,16 +116,40 @@ public class LawsVehicleDomesticLibraryServiceImpl extends ServiceImpl<LawsVehic
|
||||
}
|
||||
LawsVehicleDomesticLibrary lawsVehicleDomesticLibrary = getById(id);
|
||||
if (Constant.ABOLISH.equals(lawsVehicleDomesticLibrary.getState())) {
|
||||
String errMessage = "";
|
||||
if(MessageUtils.getLanguage().getValue().equals(LanguageEnum.CN.getValue())){
|
||||
errMessage = "状态已经是废止了";
|
||||
}else{
|
||||
errMessage = "The status is already abolished";
|
||||
}
|
||||
throw new JeroBootException(errMessage);
|
||||
throw new JeroBootException((Objects.equals(LocaleContextHolder.getLocale(), Locale.ENGLISH) ?
|
||||
"The status is already abolished" : "状态已经是废止了"));
|
||||
}
|
||||
lawsVehicleDomesticLibrary.setState(Constant.ABOLISH);
|
||||
updateById(lawsVehicleDomesticLibrary);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> replace(ProcessVehicleDomesticReleaseVo processVehicleDomesticReleaseVo) {
|
||||
// 原数据
|
||||
String oldId = processVehicleDomesticReleaseVo.getId();
|
||||
LawsVehicleDomesticLibrary oldMainData = getById(oldId);
|
||||
if (Objects.isNull(oldMainData)) {
|
||||
throw new JeroBootException(ResultCommon.PARAMETERS_CANNOT_BE_NULL);
|
||||
}
|
||||
// 新数据
|
||||
LawsVehicleDomesticLibrary newMainData = new LawsVehicleDomesticLibrary();
|
||||
BeanUtils.copyProperties(processVehicleDomesticReleaseVo, newMainData);
|
||||
newMainData.setState(Constant.TAKE_EFFECT);
|
||||
newMainData.setIsFinish(Constant.IS_FINISH);
|
||||
newMainData.setId(null);
|
||||
LawsVehicleDomesticLibrarySublist lawsVehicleDomesticLibrarySublist = new LawsVehicleDomesticLibrarySublist();
|
||||
BeanUtils.copyProperties(processVehicleDomesticReleaseVo, lawsVehicleDomesticLibrarySublist);
|
||||
// 保存新数据
|
||||
save(newMainData);
|
||||
String vehicleId = newMainData.getId();
|
||||
lawsVehicleDomesticLibrarySublist.setVehicleId(vehicleId);
|
||||
lawsVehicleDomesticLibrarySublistService.save(lawsVehicleDomesticLibrarySublist);
|
||||
// 修改旧数据的状态为作废
|
||||
LambdaUpdateWrapper<LawsVehicleDomesticLibrary> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(LawsVehicleDomesticLibrary::getId, oldId);
|
||||
lambdaUpdateWrapper.set(LawsVehicleDomesticLibrary::getState, Constant.ABOLISH);
|
||||
updateById(newMainData);
|
||||
return Result.OK();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user