bug 修改

This commit is contained in:
jiang 2025-07-07 11:35:09 +08:00
parent 090269450c
commit bd5fd02da7
3 changed files with 415 additions and 420 deletions

View File

@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -79,80 +80,95 @@ public class CarPlanAuditServiceImpl implements CarPlanAuditService{
*/ */
@Override @Override
public ServerResponse auditInfo(AuditInfoDataVo data) { public ServerResponse auditInfo(AuditInfoDataVo data) {
try{ try {
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString(); String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
CarNeedPlanVo carNeedPlanVo=new CarNeedPlanVo(); String userName = Objects.requireNonNull(UserUtil.getLoginUser()).getRoleName();
// 查询当前计划详情
CarNeedPlanVo carNeedPlanVo = new CarNeedPlanVo();
carNeedPlanVo.setId(data.getId()); carNeedPlanVo.setId(data.getId());
CarNeedPlanVo vo=mapper.getCarAuditDetails(carNeedPlanVo); CarNeedPlanVo vo = mapper.getCarAuditDetails(carNeedPlanVo);
int status=vo.getStatus(); int status = vo.getStatus();
int statusType=vo.getStatusType(); int statusType = vo.getStatusType();
vo.setCreator(userId); vo.setCreator(userId);
int nums =mapper.getAuditNumByUser(vo);
if(nums>0){ // 判断是否已审核过
return ServerResponse.createErroe("您已审核通过,请等待其他用户审核"); int nums = mapper.getAuditNumByUser(vo);
if (nums > 0) {
return ServerResponse.createErroe("您已审核,请勿重复提交,请等待其他用户审核");
} }
if(1==statusType){ if (statusType == 1 || status == 2) {
return ServerResponse.createErroe("该数据已被审核请刷新后重试"); return ServerResponse.createErroe("该数据已被审核请刷新后重试");
} }
if(2==status){
return ServerResponse.createErroe("该数据已被审核请刷新后重试"); // 权限校验
if (!hasAuditPermission(statusType, userName)) {
return ServerResponse.createErroe("该账号无权限审核当前节点");
} }
//查询用户是否有审核权限
boolean isPermission=sysAuditService.getUserPermission("car_plan",statusType); String upTimes = recordService.getUpTimes(data.getId(), vo.getStatusType(), data.getStatus());
//查询 审核 类型 /* int auditType = sysAuditService.getAuditType("car_plan", statusType);*/
if(!isPermission){
return ServerResponse.createErroe("该账号无权限审核"); // 审核通过
} if (data.getStatus() == 2) {
//1 会签 2 或签 recordService.addRecord(data.getId(), String.valueOf(data.getStatus()),
int auditType=sysAuditService.getAuditType("car_plan",statusType); String.valueOf(vo.getStatusType()), "3", data.getRemark(), upTimes);
//审核 通过
String upTimes=recordService.getUpTimes(data.getId(),vo.getStatusType(),data.getStatus()); data.setStatus(1);
if(2==data.getStatus()){ data.setNextStatus(getNextStatusType(statusType));
//添加审核记录
recordService.addRecord(data.getId(),data.getStatus()+"",vo.getStatusType()+"","3",data.getRemark(),upTimes); if (mapper.updatePlanAudit(data) > 0) {
//或签 return ServerResponse.createBySuccessMsg("审核通过成功");
if(2==auditType){
//更新状态
if(vo.getStatusType()==3){
data.setNextStatus(1);
}else {
data.setStatus(1);
data.setNextStatus(vo.getStatusType()+1);
}
int num= mapper.updatePlanAudit(data);
if(num>0){
return ServerResponse.createBySuccessMsg("审核通过成功");
}
}else{
// 会签 ->查询是否 所设置的人已全部审核
boolean isNext=sysAuditService.getNextAuditStatus(data.getId(),"car_plan",statusType);
//进入下一个节点则更新
if(isNext){
if(vo.getStatusType()==3){
data.setNextStatus(1);
}else {
data.setStatus(1);
data.setNextStatus(vo.getStatusType()+1);
}
int num= mapper.updatePlanAudit(data);
if(num>0){
return ServerResponse.createBySuccessMsg("审核通过成功");
}
}else{
return ServerResponse.createBySuccessMsg("审核成功,等待其他人继续审核");
}
} }
} else{ } else { // 驳回
recordService.addRecord(data.getId(),data.getStatus()+"",vo.getStatusType()+"","3",data.getRemark(),upTimes); recordService.addRecord(data.getId(), String.valueOf(data.getStatus()),
int num= mapper.updatePlanAudit(data); String.valueOf(vo.getStatusType()), "3", data.getRemark(), upTimes);
if(num>0){ if (mapper.updatePlanAudit(data) > 0) {
return ServerResponse.createBySuccessMsg("审核驳回成功"); return ServerResponse.createBySuccessMsg("审核驳回成功");
} }
} }
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error("审核异常", e);
} }
return ServerResponse.createErroe("审核失败"); return ServerResponse.createErroe("审核失败");
} }
/**
* 审核节点定义
*/
public static class AuditNode {
public static final int PLAN_DEPT = 1; // 计划项目部
public static final int MGMT_CENTER = 2; // 项目管理中心
public static final int EQUIP_DEPT = 3; // 智联装备云控公司机具部王伟
public static final int LIFT_TEAM = 4; // 放线吊车班或签
}
/**
* 获取下一个状态类型
*/
private int getNextStatusType(int currentStatusType) {
switch (currentStatusType) {
case AuditNode.PLAN_DEPT: return AuditNode.MGMT_CENTER;
case AuditNode.MGMT_CENTER: return AuditNode.EQUIP_DEPT;
case AuditNode.EQUIP_DEPT: return AuditNode.LIFT_TEAM;
case AuditNode.LIFT_TEAM: return 1; // 审核结束或流程回到初始
default: return 1;
}
}
/**
* 判断用户是否有当前节点的权限
*/
private boolean hasAuditPermission(int statusType, String userName) {
if (statusType == AuditNode.PLAN_DEPT || statusType == AuditNode.MGMT_CENTER) {
return sysAuditService.getUserPermission("car_plan", statusType);
} else if (statusType == AuditNode.EQUIP_DEPT) {
return "王炜".equals(userName);
} else if (statusType == AuditNode.LIFT_TEAM) {
List<String> liftTeamUsers = Arrays.asList("雷治明", "黄廉飞", "刘晓", "张杰");
return liftTeamUsers.contains(userName);
}
return false;
}
} }

View File

@ -233,95 +233,71 @@ public class DispatchCarServiceImpl implements DispatchCarService{
} }
public void deleteData(CarNeedPlanVo data){ public void deleteData(CarNeedPlanVo data){
mapper.deleteOutData(data); mapper.deleteOutData(data);
mapper.deleteOutDetails(data); mapper.deleteOutDetails(data);
mapper.deleteOutDataRecord(data); mapper.deleteOutDataRecord(data);
mapper.deleteOutDetailsRecord(data); mapper.deleteOutDetailsRecord(data);
} }
/**
* 车辆配送=-审核
* @param data
* @return
* 2025-05-16增加分管领导审核
*/
@Override @Override
public ServerResponse dispatchAudit(CarPlanOutVo data) { public ServerResponse dispatchAudit(CarPlanOutVo data) {
try { try {
//获取用户信息
SelfUserEntity loginUser = UserUtil.getLoginUser(); SelfUserEntity loginUser = UserUtil.getLoginUser();
String status = data.getStatus(); String roleName = loginUser.getRoleName();
String status = data.getStatus(); // 前端传入2=驳回其它=通过
String remark = data.getRemark(); String remark = data.getRemark();
CarPlanOutVo vo = mapper.getCarPlanOut(data);
CarNeedPlanVo carNeedPlanVo = mapper.getPlanInfo(data); CarPlanOutVo vo = mapper.getCarPlanOut(data); // 当前记录
if ("娄强".equals(loginUser.getRoleName())) { String currentStatus = vo.getStatus();
if (!"3".equals(vo.getStatus())) {
return ServerResponse.createErroe("还未到您审核,请刷新后重试"); // 计算审核后的目标状态
} else { String targetStatus = determineNextStatus(roleName, currentStatus, status);
if ("2".equals(status)) { if (targetStatus == null) {
//驳回 return ServerResponse.createErroe("无权审核或状态不匹配,请刷新后重试");
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(2);
} else {
carNeedPlanVo.setStatus(0);
}
//更新计划状态
mapper.updatePlanInfo(carNeedPlanVo);
}
} else {
//通过
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
int dispatchNum = carNeedPlanVo.getDispatchNum();
carNeedPlanVo.setDispatchDay(DateTimeHelper.getNowDay());
carNeedPlanVo.setDispatchNum(dispatchNum + vo.getDispatchNum());
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(1);
} else {
carNeedPlanVo.setStatus(2);
}
//更新计划信息
mapper.updateCarPlanInfo(carNeedPlanVo);
}
}
}
} else {
if (!"0".equals(vo.getStatus())) {
return ServerResponse.createErroe("待分管领导审核,请刷新后重试");
} else {
if ("2".equals(status)) {
//驳回
int num = mapper.updateDispatchData(data);
if (num > 0) {
List<CarPlanOutVo> list = mapper.getAuditList(data);
if (ListHelpUtil.isEmpty(list)) {
carNeedPlanVo.setStatus(2);
} else {
carNeedPlanVo.setStatus(0);
}
//更新计划状态
mapper.updatePlanInfo(carNeedPlanVo);
}
} else {
//通过,只修改状态
data.setStatus("3");
int num = mapper.updateDispatchData(data);
}
}
} }
String uptime = recordService.getUpTimes("out-" + data.getId(), Integer.parseInt(status));
recordService.addRecord("out-" + data.getId(), status, "2", "3", remark, uptime); // 更新数据
data.setStatus(targetStatus);
int updated = mapper.updateDispatchData(data);
if (updated <= 0) {
return ServerResponse.createErroe("审核操作失败,请稍后重试");
}
// 写操作记录
String uptime = recordService.getUpTimes("out-" + data.getId(), Integer.parseInt(targetStatus));
recordService.addRecord("out-" + data.getId(), targetStatus, "2", "3", remark, uptime);
return ServerResponse.createBySuccessMsg("审核成功"); return ServerResponse.createBySuccessMsg("审核成功");
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString(), e); log.error("dispatchAudit 异常: {}", e.toString(), e);
return ServerResponse.createErroe("审核失败,请稍后重试");
} }
return ServerResponse.createErroe("审核失败,请稍后重试");
} }
private String determineNextStatus(String roleName, String currentStatus, String actionStatus) {
if ("2".equals(actionStatus)) {
// 驳回统一到状态9
if (isSecondLevelApprover(roleName) && "1".equals(currentStatus)) return "9";
if (isThirdLevelApprover(roleName) && "2".equals(currentStatus)) return "9";
} else {
// 通过流转到下一状态
if (isSecondLevelApprover(roleName) && "0".equals(currentStatus)) return "1";
if (isThirdLevelApprover(roleName) && "1".equals(currentStatus)) return "2";
}
return null; // 不符合条件
}
private boolean isSecondLevelApprover(String roleName) {
return "雷治明".equals(roleName) || "黄廉飞".equals(roleName)
|| "刘晓".equals(roleName) || "张杰".equals(roleName);
}
private boolean isThirdLevelApprover(String roleName) {
return "娄强".equals(roleName);
}
/** /**
* @param data * @param data

View File

@ -32,11 +32,12 @@ import java.util.Objects;
/** /**
* 供应商 派车录入业务层 * 供应商 派车录入业务层
*
* @author 黑子 * @author 黑子
*/ */
@Slf4j @Slf4j
@Service @Service
public class SupDispatchCarServiceImpl implements SupDispatchCarService{ public class SupDispatchCarServiceImpl implements SupDispatchCarService {
@Autowired @Autowired
private SupDispatchCarMapper mapper; private SupDispatchCarMapper mapper;
@ -49,21 +50,21 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
@Override @Override
public List<CarNeedPlanVo> getPlanListBySup(CarNeedPlanVo data) { public List<CarNeedPlanVo> getPlanListBySup(CarNeedPlanVo data) {
try{ try {
return mapper.getPlanListBySup(data); return mapper.getPlanListBySup(data);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@Override @Override
public ServerResponse getDetailsList(CarNeedPlanVo data) { public ServerResponse getDetailsList(CarNeedPlanVo data) {
List<CarNeedPlanDetailVo> list=new ArrayList<>(); List<CarNeedPlanDetailVo> list = new ArrayList<>();
try { try {
list=mapper.getDetailsList(data); list = mapper.getDetailsList(data);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return ServerResponse.createSuccess(list); return ServerResponse.createSuccess(list);
@ -71,85 +72,86 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
/** /**
* 新增派车信息 * 新增派车信息
*
* @param request * @param request
* @param files * @param files
* @return * @return
*/ */
@Override @Override
public ServerResponse addDispatchCarData(HttpServletRequest request, MultipartFile[] files,String[] types) { public ServerResponse addDispatchCarData(HttpServletRequest request, MultipartFile[] files, String[] types) {
try{ try {
String params=request.getParameter("params"); String params = request.getParameter("params");
if(StringHelper.isEmpty(params)){ if (StringHelper.isEmpty(params)) {
return ServerResponse.createErroe("请求参数缺失"); return ServerResponse.createErroe("请求参数缺失");
} }
if(files==null || files.length<1 || types==null || files.length!=types.length){ if (files == null || files.length < 1 || types == null || files.length != types.length) {
return ServerResponse.createErroe("请先上传文件"); return ServerResponse.createErroe("请先上传文件");
} }
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString(); String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
CarPlanOutVo outVo = JSON.parseObject(params, CarPlanOutVo.class); CarPlanOutVo outVo = JSON.parseObject(params, CarPlanOutVo.class);
Integer jsNum=mapper.validateSltNum(outVo); Integer jsNum = mapper.validateSltNum(outVo);
if(jsNum!=null && jsNum>0){ if (jsNum != null && jsNum > 0) {
return ServerResponse.createErroe("该计划已被结算,不允许修改"); return ServerResponse.createErroe("该计划已被结算,不允许修改");
} }
//文件进行分类存储 //文件进行分类存储
Map<String, List<MultipartFile>> fileMaps= Maps.newHashMap(); Map<String, List<MultipartFile>> fileMaps = Maps.newHashMap();
for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) {
String key=types[i]; String key = types[i];
MultipartFile file=files[i]; MultipartFile file = files[i];
if(fileMaps.containsKey(key)){ if (fileMaps.containsKey(key)) {
List<MultipartFile> multipartFiles=fileMaps.get(key); List<MultipartFile> multipartFiles = fileMaps.get(key);
multipartFiles.add(file); multipartFiles.add(file);
fileMaps.put(key,multipartFiles); fileMaps.put(key, multipartFiles);
}else{ } else {
List<MultipartFile> fileList=new ArrayList<>(); List<MultipartFile> fileList = new ArrayList<>();
fileList.add(file); fileList.add(file);
fileMaps.put(key,fileList); fileMaps.put(key, fileList);
} }
} }
outVo.setCreator(userId); outVo.setCreator(userId);
outVo.setUpdater(userId); outVo.setUpdater(userId);
int planType=outVo.getPlanType(); int planType = outVo.getPlanType();
List<CarPlanOutVoDetailsVo> detailsVoList=outVo.getDetailsVoList(); List<CarPlanOutVoDetailsVo> detailsVoList = outVo.getDetailsVoList();
String msg=getContractMoney(detailsVoList,planType,outVo); String msg = getContractMoney(detailsVoList, planType, outVo);
//校验及计算 //校验及计算
if(StringHelper.isNotEmpty(msg)){ if (StringHelper.isNotEmpty(msg)) {
return ServerResponse.createErroe(msg); return ServerResponse.createErroe(msg);
} }
outVo.setDispatchNum(detailsVoList.size()); outVo.setDispatchNum(detailsVoList.size());
int num=mapper.addDispatchCarData(outVo); int num = mapper.addDispatchCarData(outVo);
mapper.addDispatchCarDataRecord(outVo); mapper.addDispatchCarDataRecord(outVo);
if(num>0){ if (num > 0) {
List<MultipartFile> basic=fileMaps.get("basic"); List<MultipartFile> basic = fileMaps.get("basic");
if(basic==null || basic.isEmpty()){ if (basic == null || basic.isEmpty()) {
return ServerResponse.createErroe("请上传基础文件"); return ServerResponse.createErroe("请上传基础文件");
}else{ } else {
MultipartFile[] basicfile = basic.toArray(new MultipartFile[0]); MultipartFile[] basicfile = basic.toArray(new MultipartFile[0]);
uploadService.uploadImage(basicfile,outVo.getId(),"car_plan_out","派车附件"); uploadService.uploadImage(basicfile, outVo.getId(), "car_plan_out", "派车附件");
} }
for (CarPlanOutVoDetailsVo detailsVo:detailsVoList){ for (CarPlanOutVoDetailsVo detailsVo : detailsVoList) {
detailsVo.setPlanId(outVo.getPlanId()); detailsVo.setPlanId(outVo.getPlanId());
detailsVo.setOutId(outVo.getId()); detailsVo.setOutId(outVo.getId());
detailsVo.setSupId(outVo.getSupId()); detailsVo.setSupId(outVo.getSupId());
int success= mapper.addDispatchCarDetailsData(detailsVo); int success = mapper.addDispatchCarDetailsData(detailsVo);
detailsVo.setRelId(outVo.getOutId()); detailsVo.setRelId(outVo.getOutId());
mapper.addDispatchCarDetailsDataRecord(detailsVo); mapper.addDispatchCarDetailsDataRecord(detailsVo);
if(success>0){ if (success > 0) {
List<MultipartFile> modelFile=fileMaps.get(detailsVo.getFileType()); List<MultipartFile> modelFile = fileMaps.get(detailsVo.getFileType());
if(modelFile!=null && !modelFile.isEmpty()){ if (modelFile != null && !modelFile.isEmpty()) {
MultipartFile[] modelFiles = modelFile.toArray(new MultipartFile[0]); MultipartFile[] modelFiles = modelFile.toArray(new MultipartFile[0]);
uploadService.uploadImage(modelFiles,detailsVo.getId(),"car_plan_out_details","导航截图"); uploadService.uploadImage(modelFiles, detailsVo.getId(), "car_plan_out_details", "导航截图");
} }
}else{ } else {
return ServerResponse.createErroe("新增派车失败"); return ServerResponse.createErroe("新增派车失败");
} }
} }
} }
mapper.updatePlanInfo(outVo); mapper.updatePlanInfo(outVo);
recordService.addRecord("out-"+outVo.getId(),"0","1","2","派车提交","0"); recordService.addRecord("out-" + outVo.getId(), "0", "1", "2", "派车提交", "0");
return ServerResponse.createBySuccessMsg("派车成功"); return ServerResponse.createBySuccessMsg("派车成功");
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return ServerResponse.createErroe("新增派车失败"); return ServerResponse.createErroe("新增派车失败");
@ -157,197 +159,197 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
/** /**
* 车辆修改前回显 * 车辆修改前回显
*
* @param data * @param data
* @return * @return
*/ */
@Override @Override
public ServerResponse getDispatchCarData(CarPlanOutVo data) { public ServerResponse getDispatchCarData(CarPlanOutVo data) {
try{ try {
CarPlanOutVo vo=mapper.getDispatchCarData(data); CarPlanOutVo vo = mapper.getDispatchCarData(data);
if(vo!=null){ if (vo != null) {
List<FileUploadVo> fileList=uploadService.getFileList(data.getId(),"car_plan_out",""); List<FileUploadVo> fileList = uploadService.getFileList(data.getId(), "car_plan_out", "");
vo.setFileList(fileList); vo.setFileList(fileList);
List<CarPlanOutVoDetailsVo> list=mapper.getDispatchCarDetailsList(data); List<CarPlanOutVoDetailsVo> list = mapper.getDispatchCarDetailsList(data);
for (CarPlanOutVoDetailsVo detailsVo:list){ for (CarPlanOutVoDetailsVo detailsVo : list) {
List<FileUploadVo> fileList2=uploadService.getFileList(detailsVo.getId(),"car_plan_out_details",""); List<FileUploadVo> fileList2 = uploadService.getFileList(detailsVo.getId(), "car_plan_out_details", "");
detailsVo.setFileList(fileList2); detailsVo.setFileList(fileList2);
List<FileUploadVo> carImage=uploadService.getFileList(detailsVo.getCarId(),"car_supplier_info",""); List<FileUploadVo> carImage = uploadService.getFileList(detailsVo.getCarId(), "car_supplier_info", "");
detailsVo.setCarImage(carImage); detailsVo.setCarImage(carImage);
List<FileUploadVo> driverUserImage=uploadService.getFileList(detailsVo.getDriverUserId(),"car_driver_info",""); List<FileUploadVo> driverUserImage = uploadService.getFileList(detailsVo.getDriverUserId(), "car_driver_info", "");
detailsVo.setDriverUserImage(driverUserImage); detailsVo.setDriverUserImage(driverUserImage);
List<FileUploadVo> operaImage=uploadService.getFileList(detailsVo.getOperaUserId(),"car_driver_info",""); List<FileUploadVo> operaImage = uploadService.getFileList(detailsVo.getOperaUserId(), "car_driver_info", "");
detailsVo.setOperaImage(operaImage); detailsVo.setOperaImage(operaImage);
} }
List<AuditRecordVo> record= recordService.getRecordList("out-"+data.getId()); List<AuditRecordVo> record = recordService.getRecordList("out-" + data.getId());
vo.setRecordList(record); vo.setRecordList(record);
vo.setDetailsVoList(list); vo.setDetailsVoList(list);
} }
return ServerResponse.createSuccess("查询成功",vo); return ServerResponse.createSuccess("查询成功", vo);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return ServerResponse.createSuccess("查询失败",new CarPlanOutVo()); return ServerResponse.createSuccess("查询失败", new CarPlanOutVo());
} }
/** /**
* 修改计划 * 修改计划
*
* @param request * @param request
* @param files * @param files
* @return * @return
*/ */
@Override @Override
public ServerResponse updateDispatchCarData(HttpServletRequest request, MultipartFile[] files,String[] types) { public ServerResponse updateDispatchCarData(HttpServletRequest request, MultipartFile[] files, String[] types) {
try{ try {
String params=request.getParameter("params"); String params = request.getParameter("params");
if(StringHelper.isEmpty(params)){ if (StringHelper.isEmpty(params)) {
return ServerResponse.createErroe("请求参数缺失"); return ServerResponse.createErroe("请求参数缺失");
} }
//文件进行分类存储 //文件进行分类存储
Map<String, List<MultipartFile>> fileMaps= Maps.newHashMap(); Map<String, List<MultipartFile>> fileMaps = Maps.newHashMap();
if(files!=null && files.length>0 && types!=null && types.length>0 ){ if (files != null && files.length > 0 && types != null && types.length > 0) {
for (int i = 0; i < types.length; i++) { for (int i = 0; i < types.length; i++) {
String key=types[i]; String key = types[i];
MultipartFile file=files[i]; MultipartFile file = files[i];
if(fileMaps.containsKey(key)){ if (fileMaps.containsKey(key)) {
List<MultipartFile> multipartFiles=fileMaps.get(key); List<MultipartFile> multipartFiles = fileMaps.get(key);
multipartFiles.add(file); multipartFiles.add(file);
fileMaps.put(key,multipartFiles); fileMaps.put(key, multipartFiles);
}else{ } else {
List<MultipartFile> fileList=new ArrayList<>(); List<MultipartFile> fileList = new ArrayList<>();
fileList.add(file); fileList.add(file);
fileMaps.put(key,fileList); fileMaps.put(key, fileList);
} }
} }
} }
String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
CarPlanOutVo outVo = JSON.parseObject(params, CarPlanOutVo.class); CarPlanOutVo outVo = JSON.parseObject(params, CarPlanOutVo.class);
int sltNum=mapper.getSltNumByPlan(outVo); int sltNum = mapper.getSltNumByPlan(outVo);
if(sltNum>0){ if (sltNum > 0) {
return ServerResponse.createErroe("当前计划已结算,不允许修改"); return ServerResponse.createErroe("当前计划已结算,不允许修改");
} }
int planType=outVo.getPlanType(); int planType = outVo.getPlanType();
outVo.setUpdater(userId); outVo.setUpdater(userId);
List<CarPlanOutVoDetailsVo> detailsVoList=outVo.getDetailsVoList(); List<CarPlanOutVoDetailsVo> detailsVoList = outVo.getDetailsVoList();
String msg=getContractMoney(detailsVoList,planType,outVo); String msg = getContractMoney(detailsVoList, planType, outVo);
//校验及计算 //校验及计算
if(StringHelper.isNotEmpty(msg)){ if (StringHelper.isNotEmpty(msg)) {
return ServerResponse.createErroe(msg); return ServerResponse.createErroe(msg);
} }
outVo.setDispatchNum(detailsVoList.size()); outVo.setDispatchNum(detailsVoList.size());
int num=mapper.updateDispatchCarData(outVo); int num = mapper.updateDispatchCarData(outVo);
if(StringHelper.isNotEmpty(outVo.getStatus())){ if (StringHelper.isNotEmpty(outVo.getStatus())) {
mapper.updatePlanInfo(outVo); mapper.updatePlanInfo(outVo);
} }
if(num>0){ if (num > 0) {
if(StringHelper.isNotEmpty(outVo.getDelFileId())){ if (StringHelper.isNotEmpty(outVo.getDelFileId())) {
uploadService.deleteFile(outVo.getDelFileId()); uploadService.deleteFile(outVo.getDelFileId());
} }
List<MultipartFile> basic=fileMaps.get("basic"); List<MultipartFile> basic = fileMaps.get("basic");
if(ListHelpUtil.isNotEmpty(basic)){ if (ListHelpUtil.isNotEmpty(basic)) {
MultipartFile[] basicfile = basic.toArray(new MultipartFile[0]); MultipartFile[] basicfile = basic.toArray(new MultipartFile[0]);
uploadService.uploadImage(basicfile,outVo.getId(),"car_plan_out","派车附件"); uploadService.uploadImage(basicfile, outVo.getId(), "car_plan_out", "派车附件");
} }
if("0".equals(outVo.getStatus())){ if ("0".equals(outVo.getStatus())) {
outVo.setResource("1"); outVo.setResource("1");
}else{ } else {
outVo.setResource("0"); outVo.setResource("0");
}
mapper.addDispatchCarDataRecord(outVo);
for (CarPlanOutVoDetailsVo detailsVo : detailsVoList) {
CarPlanOutVoDetailsVo hisDetails = mapper.getCarPlanOutVoDetailsVo(detailsVo);
//修改车辆详情
mapper.updateDispatchCarDetailsData(detailsVo);
List<MultipartFile> modelFile = fileMaps.get(detailsVo.getFileType());
if (ListHelpUtil.isNotEmpty(modelFile)) {
MultipartFile[] modelFiles = modelFile.toArray(new MultipartFile[0]);
uploadService.uploadImage(modelFiles, detailsVo.getId(), "car_plan_out_details", "导航截图");
}
if (planType == 1) {
if (!detailsVo.getCarId().equals(hisDetails.getCarId())) {
detailsVo.setUpdateCar("1");
}
} else {
if (!detailsVo.getCarNum().equals(hisDetails.getCarNum())) {
detailsVo.setUpdateCar("1");
}
}
if (planType == 1) {
if (!detailsVo.getGls().equals(hisDetails.getGls())) {
detailsVo.setUpdateGls("1");
}
if (!detailsVo.getStartAddress().equals(hisDetails.getStartAddress())) {
detailsVo.setUpdateStartAddress("1");
}
if (!detailsVo.getEndAddress().equals(hisDetails.getEndAddress())) {
detailsVo.setUpdateEndAddress("1");
}
} else {
if (detailsVo.getPlanDay() != hisDetails.getPlanDay()) {
detailsVo.setUpdateDay("1");
}
if (StringHelper.isNotEmpty(detailsVo.getJcMoney())) {
if (!detailsVo.getJcMoney().equals(hisDetails.getJcMoney())) {
detailsVo.setUpdateCcGls("1");
}
} }
mapper.addDispatchCarDataRecord(outVo);
for (CarPlanOutVoDetailsVo detailsVo:detailsVoList){
CarPlanOutVoDetailsVo hisDetails=mapper.getCarPlanOutVoDetailsVo(detailsVo);
//修改车辆详情
mapper.updateDispatchCarDetailsData(detailsVo);
List<MultipartFile> modelFile=fileMaps.get(detailsVo.getFileType());
if(ListHelpUtil.isNotEmpty(modelFile)){
MultipartFile[] modelFiles = modelFile.toArray(new MultipartFile[0]);
uploadService.uploadImage(modelFiles,detailsVo.getId(),"car_plan_out_details","导航截图");
}
if(planType==1) {
if (!detailsVo.getCarId().equals(hisDetails.getCarId())) {
detailsVo.setUpdateCar("1");
}
}else{
if (!detailsVo.getCarNum().equals(hisDetails.getCarNum())) {
detailsVo.setUpdateCar("1");
}
}
if(planType==1){
if(!detailsVo.getGls().equals(hisDetails.getGls())){
detailsVo.setUpdateGls("1");
}
if(!detailsVo.getStartAddress().equals(hisDetails.getStartAddress())){
detailsVo.setUpdateStartAddress("1");
}
if(!detailsVo.getEndAddress().equals(hisDetails.getEndAddress())){
detailsVo.setUpdateEndAddress("1");
}
}else{
if(detailsVo.getPlanDay()!=hisDetails.getPlanDay()){
detailsVo.setUpdateDay("1");
}
if(StringHelper.isNotEmpty(detailsVo.getJcMoney())){
if(!detailsVo.getJcMoney().equals(hisDetails.getJcMoney())){
detailsVo.setUpdateCcGls("1");
}
}
} }
detailsVo.setPlanId(outVo.getPlanId()); detailsVo.setPlanId(outVo.getPlanId());
detailsVo.setOutId(outVo.getId()); detailsVo.setOutId(outVo.getId());
detailsVo.setRelId(outVo.getOutId()); detailsVo.setRelId(outVo.getOutId());
mapper.addDispatchCarDetailsDataRecord(detailsVo); mapper.addDispatchCarDetailsDataRecord(detailsVo);
} }
} }
return ServerResponse.createBySuccessMsg("修改成功"); return ServerResponse.createBySuccessMsg("修改成功");
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return ServerResponse.createErroe("修改派车失败"); return ServerResponse.createErroe("修改派车失败");
} }
@Override @Override
public ServerResponse getAllOutList(CarPlanOutVo data) { public ServerResponse getAllOutList(CarPlanOutVo data) {
List<CarNeedPlanDetailVo> list=new ArrayList<>(); List<CarNeedPlanDetailVo> list = new ArrayList<>();
try { try {
list=mapper.getAllOutList(data); list = mapper.getAllOutList(data);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return ServerResponse.createSuccess(list); return ServerResponse.createSuccess(list);
} }
/** /**
* 到货确认单查询 * 到货确认单查询
*
* @param data * @param data
* @return * @return
*/ */
@Override @Override
public List<CarNeedPlanVo> getOutPageList(CarNeedPlanVo data) { public List<CarNeedPlanVo> getOutPageList(CarNeedPlanVo data) {
List<CarNeedPlanVo> list=new ArrayList<>(); List<CarNeedPlanVo> list = new ArrayList<>();
try { try {
String userId= Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString(); String userId = Objects.requireNonNull(UserUtil.getLoginUser()).getUserId().toString();
data.setCreator(userId); data.setCreator(userId);
data.setUserId(userId); data.setUserId(userId);
list=mapper.getOutPageList(data); list = mapper.getOutPageList(data);
for (CarNeedPlanVo carNeedPlanVo:list){ for (CarNeedPlanVo carNeedPlanVo : list) {
if(carNeedPlanVo.getFileNum()>0){ if (carNeedPlanVo.getFileNum() > 0) {
List<FileUploadVo> fileList= uploadService.getFileList(carNeedPlanVo.getId()+"-dh","car_plan_out","到货确认单"); List<FileUploadVo> fileList = uploadService.getFileList(carNeedPlanVo.getId() + "-dh", "car_plan_out", "到货确认单");
carNeedPlanVo.setFileList(fileList); carNeedPlanVo.setFileList(fileList);
} }
} }
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return list; return list;
@ -355,6 +357,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
/** /**
* 到货确认单 * 到货确认单
*
* @param request * @param request
* @param files * @param files
* @return * @return
@ -362,60 +365,60 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
@Override @Override
public ServerResponse uploadFile(HttpServletRequest request, MultipartFile[] files) { public ServerResponse uploadFile(HttpServletRequest request, MultipartFile[] files) {
try { try {
String params=request.getParameter("params"); String params = request.getParameter("params");
if(StringHelper.isEmpty(params)){ if (StringHelper.isEmpty(params)) {
return ServerResponse.createErroe("请求参数缺失"); return ServerResponse.createErroe("请求参数缺失");
}
JSONObject json=JSON.parseObject(params);
params=json.get("id").toString();
uploadService.uploadImage(files,params+"-dh","car_plan_out","到货确认单");
return ServerResponse.createBySuccessMsg("上传成功");
}catch (Exception e){
log.error(e.toString());
} }
return ServerResponse.createErroe("上传失败"); JSONObject json = JSON.parseObject(params);
params = json.get("id").toString();
uploadService.uploadImage(files, params + "-dh", "car_plan_out", "到货确认单");
return ServerResponse.createBySuccessMsg("上传成功");
} catch (Exception e) {
log.error(e.toString());
}
return ServerResponse.createErroe("上传失败");
} }
@Override @Override
public ServerResponse getDispatchCarData2(CarPlanOutVo data) { public ServerResponse getDispatchCarData2(CarPlanOutVo data) {
try{ try {
CarPlanOutVo vo=mapper.getDispatchCarData(data); CarPlanOutVo vo = mapper.getDispatchCarData(data);
if(vo!=null){ if (vo != null) {
List<FileUploadVo> fileList=uploadService.getFileList(data.getId(),"car_plan_out",""); List<FileUploadVo> fileList = uploadService.getFileList(data.getId(), "car_plan_out", "");
List<FileUploadVo> fileList0=uploadService.getFileList(data.getId()+"-dh","car_plan_out",""); List<FileUploadVo> fileList0 = uploadService.getFileList(data.getId() + "-dh", "car_plan_out", "");
if(ListHelpUtil.isNotEmpty(fileList0) && ListHelpUtil.isNotEmpty(fileList)){ if (ListHelpUtil.isNotEmpty(fileList0) && ListHelpUtil.isNotEmpty(fileList)) {
fileList.addAll(fileList0); fileList.addAll(fileList0);
} }
vo.setFileList(fileList); vo.setFileList(fileList);
List<CarPlanOutVoDetailsVo> list=mapper.getDispatchCarDetailsList(data); List<CarPlanOutVoDetailsVo> list = mapper.getDispatchCarDetailsList(data);
for (CarPlanOutVoDetailsVo detailsVo:list){ for (CarPlanOutVoDetailsVo detailsVo : list) {
List<FileUploadVo> fileList2=uploadService.getFileList(detailsVo.getId(),"car_plan_out_details",""); List<FileUploadVo> fileList2 = uploadService.getFileList(detailsVo.getId(), "car_plan_out_details", "");
detailsVo.setFileList(fileList2); detailsVo.setFileList(fileList2);
List<FileUploadVo> carImage=uploadService.getFileList(detailsVo.getCarId(),"car_supplier_info",""); List<FileUploadVo> carImage = uploadService.getFileList(detailsVo.getCarId(), "car_supplier_info", "");
detailsVo.setCarImage(carImage); detailsVo.setCarImage(carImage);
List<FileUploadVo> driverUserImage=uploadService.getFileList(detailsVo.getDriverUserId(),"car_driver_info",""); List<FileUploadVo> driverUserImage = uploadService.getFileList(detailsVo.getDriverUserId(), "car_driver_info", "");
detailsVo.setDriverUserImage(driverUserImage); detailsVo.setDriverUserImage(driverUserImage);
List<FileUploadVo> operaImage=uploadService.getFileList(detailsVo.getOperaUserId(),"car_driver_info",""); List<FileUploadVo> operaImage = uploadService.getFileList(detailsVo.getOperaUserId(), "car_driver_info", "");
detailsVo.setOperaImage(operaImage); detailsVo.setOperaImage(operaImage);
} }
List<AuditRecordVo> record= recordService.getRecordList("out-"+data.getId()); List<AuditRecordVo> record = recordService.getRecordList("out-" + data.getId());
vo.setRecordList(record); vo.setRecordList(record);
vo.setDetailsVoList(list); vo.setDetailsVoList(list);
} }
return ServerResponse.createSuccess("查询成功",vo); return ServerResponse.createSuccess("查询成功", vo);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return ServerResponse.createSuccess("查询失败",new CarPlanOutVo()); return ServerResponse.createSuccess("查询失败", new CarPlanOutVo());
} }
@Override @Override
public ServerResponse getDispatchCarListData(CarPlanOutVo data) { public ServerResponse getDispatchCarListData(CarPlanOutVo data) {
List<CarNeedPlanDetailVo> list=new ArrayList<>(); List<CarNeedPlanDetailVo> list = new ArrayList<>();
try { try {
list=mapper.getDispatchCarListData(data); list = mapper.getDispatchCarListData(data);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return ServerResponse.createSuccess(list); return ServerResponse.createSuccess(list);
@ -424,106 +427,109 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
/** /**
* 校验价格 * 校验价格
*
* @return * @return
*/ */
private String getContractMoney(List<CarPlanOutVoDetailsVo> list,int planType,CarPlanOutVo outVo){ private String getContractMoney(List<CarPlanOutVoDetailsVo> list, int planType, CarPlanOutVo outVo) {
BigDecimal allMoney=new BigDecimal(0); BigDecimal allMoney = new BigDecimal(0);
for (CarPlanOutVoDetailsVo vo:list){ for (CarPlanOutVoDetailsVo vo : list) {
StringBuilder sb=new StringBuilder(); StringBuilder sb = new StringBuilder();
BigDecimal cost=new BigDecimal(0); BigDecimal cost = new BigDecimal(0);
if(StringHelper.isEmpty(outVo.getContractId())){ if (StringHelper.isEmpty(outVo.getContractId())) {
outVo.setContractId(vo.getContractId()); outVo.setContractId(vo.getContractId());
} }
if(StringHelper.isEmpty(vo.getSupId())){ if (StringHelper.isEmpty(vo.getSupId())) {
vo.setSupId(outVo.getSupId()); vo.setSupId(outVo.getSupId());
} }
//车辆 //车辆
if(planType==1){ if (planType == 1) {
//公里数必填 //公里数必填
String gls=vo.getGls(); String gls = vo.getGls();
try{ try {
PriceVo priceVo=getMoney(vo.getContractId(),null,vo.getSupId(),gls); PriceVo priceVo = getMoney(vo.getContractId(), null, vo.getSupId(), gls);
sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd()); sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd());
sb.append("公里:").append(priceVo.getPrice()).append(""); sb.append("公里:").append(priceVo.getPrice()).append("");
vo.setRemark(sb.toString()); vo.setRemark(sb.toString());
vo.setPriceId(priceVo.getId()); vo.setPriceId(priceVo.getId());
vo.setGlsPrice(priceVo.getPrice()); vo.setGlsPrice(priceVo.getPrice());
BigDecimal nowGls=new BigDecimal(gls); BigDecimal ton = new BigDecimal(vo.getTon());
BigDecimal price=new BigDecimal(priceVo.getPrice()); BigDecimal nowGls = new BigDecimal(gls);
BigDecimal glsMoney=nowGls.multiply(price); BigDecimal price = new BigDecimal(priceVo.getPrice());
allMoney=allMoney.add(glsMoney); // 公里*每公里*吨位
BigDecimal glsMoney = nowGls.multiply(price).multiply(ton);
allMoney = allMoney.add(glsMoney);
vo.setCost(glsMoney.toString()); vo.setCost(glsMoney.toString());
vo.setGlsMoney(glsMoney.toString()); vo.setGlsMoney(glsMoney.toString());
}catch (Exception e){ } catch (Exception e) {
return "公里数不在厂商合同范围内"; return "公里数不在厂商合同范围内";
} }
}else{ } else {
//计划天数 //计划天数
int day=vo.getPlanDay(); int day = vo.getPlanDay();
int isOutSet=vo.getIsOutSet(); int isOutSet = vo.getIsOutSet();
try{ try {
BigDecimal days=new BigDecimal(day); BigDecimal days = new BigDecimal(day);
BigDecimal dcMoney=new BigDecimal("0"); BigDecimal dcMoney = new BigDecimal("0");
BigDecimal month=new BigDecimal("30"); BigDecimal month = new BigDecimal("30");
PriceVo priceVo=getMoney(vo.getContractId(),vo.getModelId(),vo.getSupId(),null); PriceVo priceVo = getMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), null);
sb.append("依据:").append(priceVo.getName()).append("-").append(priceVo.getModel()); sb.append("依据:").append(priceVo.getName()).append("-").append(priceVo.getModel());
vo.setPriceId(priceVo.getId()); vo.setPriceId(priceVo.getId());
vo.setGlsPrice(priceVo.getPrice()); vo.setGlsPrice(priceVo.getPrice());
int dayToMonth= priceVo.getDayToMonth(); int dayToMonth = priceVo.getDayToMonth();
if (day>=dayToMonth){ if (day >= dayToMonth) {
sb.append("、作业天数>=").append(dayToMonth); sb.append("、作业天数>=").append(dayToMonth);
vo.setDcUnit("元/月/台"); vo.setDcUnit("元/月/台");
vo.setIsDayOrMonth("2"); vo.setIsDayOrMonth("2");
BigDecimal monthPrice=new BigDecimal(priceVo.getMonthPrice()); BigDecimal monthPrice = new BigDecimal(priceVo.getMonthPrice());
if(day>30){ if (day > 30) {
vo.setDcPrice(monthPrice.divide(month, RoundingMode.CEILING).toString()); vo.setDcPrice(monthPrice.divide(month, RoundingMode.CEILING).toString());
dcMoney=monthPrice.divide(month, RoundingMode.CEILING).multiply(days); dcMoney = monthPrice.divide(month, RoundingMode.CEILING).multiply(days);
vo.setDcMoney(dcMoney.toString()); vo.setDcMoney(dcMoney.toString());
allMoney=allMoney.add(dcMoney); allMoney = allMoney.add(dcMoney);
cost=cost.add(dcMoney); cost = cost.add(dcMoney);
vo.setCost(cost.toString()); vo.setCost(cost.toString());
}else{ } else {
vo.setDcPrice(priceVo.getMonthPrice()); vo.setDcPrice(priceVo.getMonthPrice());
vo.setDcMoney(priceVo.getMonthPrice()); vo.setDcMoney(priceVo.getMonthPrice());
allMoney=allMoney.add(monthPrice); allMoney = allMoney.add(monthPrice);
cost=cost.add(monthPrice); cost = cost.add(monthPrice);
vo.setCost(cost.toString()); vo.setCost(cost.toString());
} }
}else{ } else {
sb.append("、作业天数<").append(dayToMonth); sb.append("、作业天数<").append(dayToMonth);
vo.setIsDayOrMonth("1"); vo.setIsDayOrMonth("1");
vo.setDcPrice(priceVo.getDayPrice()); vo.setDcPrice(priceVo.getDayPrice());
vo.setDcUnit("元/天/台"); vo.setDcUnit("元/天/台");
BigDecimal dayPrice=new BigDecimal(priceVo.getDayPrice()); BigDecimal dayPrice = new BigDecimal(priceVo.getDayPrice());
dcMoney=dayPrice.multiply(days); dcMoney = dayPrice.multiply(days);
vo.setDcMoney(dcMoney.toString()); vo.setDcMoney(dcMoney.toString());
allMoney=allMoney.add(dcMoney); allMoney = allMoney.add(dcMoney);
cost=cost.add(dcMoney); cost = cost.add(dcMoney);
vo.setCost(cost.toString()); vo.setCost(cost.toString());
} }
if(isOutSet==1){ if (isOutSet == 1) {
sb.append("@"); sb.append("@");
sb.append(priceVo.getName()).append("-").append(priceVo.getModel()+"收取进出场费用"); sb.append(priceVo.getName()).append("-").append(priceVo.getModel() + "收取进出场费用");
} }
vo.setDayPrice(priceVo.getDayPrice()); vo.setDayPrice(priceVo.getDayPrice());
vo.setMonthPrice(priceVo.getMonthPrice()); vo.setMonthPrice(priceVo.getMonthPrice());
}catch (Exception e){ } catch (Exception e) {
return "公里数不在厂商合同范围内"; return "公里数不在厂商合同范围内";
} }
if(isOutSet==1){ if (isOutSet == 1) {
//进出场公里数 //进出场公里数
String jcGls=vo.getJcGls(); String jcGls = vo.getJcGls();
try{ try {
PriceVo priceVo =getJccMoney(vo.getContractId(),vo.getModelId(),vo.getSupId(),jcGls); PriceVo priceVo = getJccMoney(vo.getContractId(), vo.getModelId(), vo.getSupId(), jcGls);
sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd()); sb.append("依据:").append(priceVo.getGlsStart()).append("-").append(priceVo.getGlsEnd());
sb.append("公里:").append(priceVo.getPrice()).append(""); sb.append("公里:").append(priceVo.getPrice()).append("");
vo.setCarOutId(priceVo.getId()); vo.setCarOutId(priceVo.getId());
vo.setJcMoney(priceVo.getPrice()); vo.setJcMoney(priceVo.getPrice());
BigDecimal jcMoney=new BigDecimal(priceVo.getPrice()); BigDecimal jcMoney = new BigDecimal(priceVo.getPrice());
allMoney=allMoney.add(jcMoney); allMoney = allMoney.add(jcMoney);
cost=cost.add(jcMoney); cost = cost.add(jcMoney);
vo.setCost(cost.toString()); vo.setCost(cost.toString());
}catch (Exception e){ } catch (Exception e) {
return "公里数不在进出场费用范围内"; return "公里数不在进出场费用范围内";
} }
} }
@ -531,34 +537,36 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
} }
} }
outVo.setMoney(allMoney.toString()); outVo.setMoney(allMoney.toString());
return null; return null;
} }
/** /**
* 计算 车辆 公里数价格 * 计算 车辆 公里数价格
*
* @param gls * @param gls
* @return * @return
*/ */
private PriceVo getMoney(String contractId,String modelId,String supId,String gls) throws Exception { private PriceVo getMoney(String contractId, String modelId, String supId, String gls) throws Exception {
List<PriceVo> list=mapper.getContractPriceList(contractId,modelId,supId); List<PriceVo> list = mapper.getContractPriceList(contractId, modelId, supId);
//车辆 //车辆
if(StringHelper.isEmpty(modelId)){ if (StringHelper.isEmpty(modelId)) {
BigDecimal nowGls=new BigDecimal(gls); BigDecimal nowGls = new BigDecimal(gls);
for (PriceVo priceVo:list){ for (PriceVo priceVo : list) {
BigDecimal glsEnd=new BigDecimal(priceVo.getGlsEnd()); BigDecimal glsEnd = new BigDecimal(priceVo.getGlsEnd());
BigDecimal glsStart=new BigDecimal(priceVo.getGlsStart()); BigDecimal glsStart = new BigDecimal(priceVo.getGlsStart());
if(nowGls.compareTo(glsEnd)<=0 && nowGls.compareTo(glsStart)>= 0){ if (nowGls.compareTo(glsEnd) <= 0 && nowGls.compareTo(glsStart) >= 0) {
return priceVo; return priceVo;
} }
}
throw new Exception();
}else{
return list.get(0);
} }
throw new Exception();
} else {
return list.get(0);
}
} }
/** /**
* 进出场费用 * 进出场费用
*
* @param contractId * @param contractId
* @param modelId * @param modelId
* @param supId * @param supId
@ -566,17 +574,17 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
* @return * @return
* @throws Exception * @throws Exception
*/ */
private PriceVo getJccMoney(String contractId,String modelId,String supId,String gls) throws Exception { private PriceVo getJccMoney(String contractId, String modelId, String supId, String gls) throws Exception {
List<PriceVo> list=mapper.getCarOutList(contractId,modelId,supId); List<PriceVo> list = mapper.getCarOutList(contractId, modelId, supId);
BigDecimal nowGls=new BigDecimal(gls); BigDecimal nowGls = new BigDecimal(gls);
for (PriceVo priceVo:list){ for (PriceVo priceVo : list) {
BigDecimal glsEnd=new BigDecimal(priceVo.getGlsEnd()); BigDecimal glsEnd = new BigDecimal(priceVo.getGlsEnd());
BigDecimal glsStart=new BigDecimal(priceVo.getGlsStart()); BigDecimal glsStart = new BigDecimal(priceVo.getGlsStart());
if(nowGls.compareTo(glsEnd)<=0 && nowGls.compareTo(glsStart)> 0){ if (nowGls.compareTo(glsEnd) <= 0 && nowGls.compareTo(glsStart) > 0) {
return priceVo; return priceVo;
} }
} }
throw new Exception(); throw new Exception();
} }
@ -586,7 +594,7 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
try { try {
//先查询数据 //先查询数据
List<CarPlanOutVo> list = mapper.getData(data); List<CarPlanOutVo> list = mapper.getData(data);
for (CarPlanOutVo outVo:list){ for (CarPlanOutVo outVo : list) {
//删除car_plan_out //删除car_plan_out
int res = mapper.delCarPlanOutData(outVo); int res = mapper.delCarPlanOutData(outVo);
//删除car_plan_out_record //删除car_plan_out_record
@ -608,21 +616,16 @@ public class SupDispatchCarServiceImpl implements SupDispatchCarService{
//修改car_plan_apply状态 //修改car_plan_apply状态
int res7 = mapper.updateCarPlanApplyStatus(outVo); int res7 = mapper.updateCarPlanApplyStatus(outVo);
//删除car_plan_audit_record //删除car_plan_audit_record
outVo.setOutId("out-"+outVo.getOutId()); outVo.setOutId("out-" + outVo.getOutId());
int res8 = mapper.delAuditRecord(outVo); int res8 = mapper.delAuditRecord(outVo);
} }
return ServerResponse.createSuccess("删除成功","删除成功"); return ServerResponse.createSuccess("删除成功", "删除成功");
} catch (Exception e) { } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServerResponse.createErroe("删除失败"); return ServerResponse.createErroe("删除失败");
} }
} }
} }