BUG优化

dev
xiepeng 2024-05-09 18:08:34 +08:00
parent da30f04dbe
commit 9564304670
10 changed files with 336 additions and 42 deletions

View File

@ -0,0 +1,68 @@
package com.zcloud.controller.comprehensive;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.comprehensive.TrafficCommitentItemService;
import com.zcloud.service.comprehensive.TrafficDrivingItemService;
import com.zcloud.service.comprehensive.TrafficDrivingSignService;
import com.zcloud.service.comprehensive.TrafficSecurityWaybillRegistrationService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Smb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import java.util.*;
@Controller
@RequestMapping("/app/commitentitem")
public class AppTrafficCommitentItemController extends BaseController {
@Autowired
private TrafficCommitentItemService trafficCommitentItemService;
@Autowired
private Smb smb;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/add")
@ResponseBody
@Transactional
public Object add(MultipartRequest request) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
String SIGNTIME[] = pd.getString("SIGNTIME").split(",");
for (int i = 0; i < SIGNTIME.length; i++) {
fileList.add(request.getFile("file" + i));
}
pd.put("DRIVING_SIGN_ID", this.get32UUID());
pd.put("ISDELETE", "0"); //是否删除
pd.put("CREATORNAME", pd.getString("USER_NAME"));
pd.put("CREATOR", pd.getString("USER_ID"));
pd.put("CREATTIME", DateUtil.date2Str(new Date()));
pd.put("OPERATOR", pd.getString("USER_ID"));
pd.put("OPERATORNAME", pd.getString("USER_NAME"));
pd.put("OPERATTIME", DateUtil.date2Str(new Date()));
pd.put("PRACTITIONER", pd.getString("USER_ID"));
trafficCommitentItemService.save(pd, fileList.toArray(new MultipartFile[fileList.size()]));
map.put("pd",pd);
map.put("result", errInfo);
return map;
}
}

View File

@ -3,6 +3,7 @@ package com.zcloud.controller.comprehensive;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.comprehensive.TrafficDrivingCommitmentService;
import com.zcloud.service.comprehensive.TrafficDrivingTypeService;
import com.zcloud.util.Const;
import com.zcloud.util.DateUtil;
@ -29,6 +30,9 @@ public class AppTrafficDrivingTypeController extends BaseController {
@Autowired
private Smb smb;
@Autowired
private TrafficDrivingCommitmentService trafficDrivingCommitmentService;
/**
@ -99,6 +103,22 @@ public class AppTrafficDrivingTypeController extends BaseController {
return map;
}
@RequestMapping(value = "/safetycommitment")
@ResponseBody
public Object safetycommitment(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = trafficDrivingCommitmentService.listForDrivingCommitment(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping("/saveFile")
@ResponseBody
public Object saveFile(@RequestParam(value="file",required=false) MultipartFile file) throws Exception{

View File

@ -121,7 +121,7 @@ public class TrafficSecurityCustomerManagementController extends BaseController
page.setPd(pageData);
List<PageData> waybillRegistrations = trafficSecurityWaybillRegistrationService.listForSecurityWaybill(page);
for (PageData customer : customers) {
if(waybillRegistrations.stream()
if (waybillRegistrations.stream()
.filter(waybillRegistration -> waybillRegistration.containsValue(customer.getString("CONTACT_ID"))).findAny().isPresent()) {
map.put("pd", "1");
map.put("result", errInfo);

View File

@ -152,13 +152,11 @@ public class TrafficSecurityLocationManagementController extends BaseController
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id
pd.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
locationManagementService.edit(pd);
map.put("result", errInfo);
map.put("pd", pd);
return map;

View File

@ -113,7 +113,7 @@ public class TrafficSecurityWaybillRegistrationController extends BaseController
if (shippingDate != null && shippingDate.after(new Date())) {
pd.put("WAYBILLSTATUS", "1");
} else {
pd.put("WAYBILLSTATUS", "0");
pd.put("WAYBILLSTATUS", "3");
}
trafficSecurityWaybillRegistrationService.save(pd);

View File

@ -1,6 +1,7 @@
package com.zcloud.controller.insure;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
@ -62,11 +63,11 @@ public class InsureController extends BaseController {
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID
pd.put("VEHICLE", pd.getString("PLATE_NUMBER"));
if(DateUtil.compareDate(pd.getString("DUE_DATE"),DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(),pd.getString("REMINDER_DATE"))) {
if (DateUtil.compareDate(pd.getString("DUE_DATE"), DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(), pd.getString("REMINDER_DATE"))) {
pd.put("REVERT", 2);
} else if (DateUtil.compareDate(DateUtil.getDay(),pd.getString("DUE_DATE"))) {
} else if (DateUtil.compareDate(DateUtil.getDay(), pd.getString("DUE_DATE"))) {
pd.put("REVERT", 0);
} else if (DateUtil.compareDate(pd.getString("DUE_DATE"),DateUtil.getDay())) {
} else if (DateUtil.compareDate(pd.getString("DUE_DATE"), DateUtil.getDay())) {
pd.put("REVERT", 1);
}
insureService.save(pd);
@ -117,11 +118,11 @@ public class InsureController extends BaseController {
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id
pd.put("OPERATORNAME", Jurisdiction.getName()); //修改人
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
if(DateUtil.compareDate(pd.getString("DUE_DATE"),DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(),pd.getString("REMINDER_DATE"))) {
if (DateUtil.compareDate(pd.getString("DUE_DATE"), DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(), pd.getString("REMINDER_DATE"))) {
pd.put("REVERT", 2);
} else if (DateUtil.compareDate(DateUtil.getDay(),pd.getString("DUE_DATE"))) {
} else if (DateUtil.compareDate(DateUtil.getDay(), pd.getString("DUE_DATE"))) {
pd.put("REVERT", 0);
} else if (DateUtil.compareDate(pd.getString("DUE_DATE"),DateUtil.getDay())) {
} else if (DateUtil.compareDate(pd.getString("DUE_DATE"), DateUtil.getDay())) {
pd.put("REVERT", 1);
}
insureService.edit(pd);
@ -174,11 +175,11 @@ public class InsureController extends BaseController {
List<PageData> varList = insureService.list(page); //列出Question列表
// 到期状态
varList.stream().forEach(data -> {
if(DateUtil.compareDate(data.getString("DUE_DATE"),DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(),data.getString("REMINDER_DATE"))) {
if (DateUtil.compareDate(data.getString("DUE_DATE"), DateUtil.getDay()) && DateUtil.compareDate(DateUtil.getDay(), data.getString("REMINDER_DATE"))) {
data.put("DUE_DATE_TYPE", 2);
} else if (DateUtil.compareDate(DateUtil.getDay(),data.getString("DUE_DATE"))) {
} else if (DateUtil.compareDate(DateUtil.getDay(), data.getString("DUE_DATE"))) {
data.put("DUE_DATE_TYPE", 0);
} else if (DateUtil.compareDate(data.getString("DUE_DATE"),DateUtil.getDay())) {
} else if (DateUtil.compareDate(data.getString("DUE_DATE"), DateUtil.getDay())) {
data.put("DUE_DATE_TYPE", 1);
}
});
@ -244,23 +245,17 @@ public class InsureController extends BaseController {
List<PageData> operatingList = operatingVehiclesService.operationVehicleList(pd.getString("CORPINFO_ID"));
page.setPd(pd);
List<PageData> insAnnually = insureService.list(page);
List<String> id = new ArrayList<>();
// 获取保险列表中所有的营运车辆
List<PageData> insures = insAnnually.stream()
.filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "1"))
.collect(Collectors.toList());
// 过滤掉保险列表中所有的营运车辆
List<PageData> varList = new ArrayList<>();
if (!CollectionUtils.isEmpty(insures)) {
varList = operatingList.stream().parallel()
.filter(operating -> insures.stream()
.noneMatch(ins -> StringUtils.equals(operating.getString("OPERATING_ID"), ins.getString("VEHICLE"))))
.collect(Collectors.toList());
} else {
varList = operatingList;
insAnnually.stream().filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "1")).collect(Collectors.toList())
.stream().parallel().collect(Collectors.groupingBy(data -> data.getString("VEHICLE"))).forEach((key, value) -> {
if (value.size() == 3) {
id.add(key);
}
});
List<PageData> varList = operatingList.stream().filter(operating -> id.stream()
.noneMatch(data -> StringUtils.equals(operating.getString("OPERATING_ID"), data))).collect(Collectors.toList());
if (pd.containsKey("ID")) {
pd.put("OPERATING_ID", pd.getString("ID"));
@ -281,21 +276,16 @@ public class InsureController extends BaseController {
List<PageData> freightList = freightTrailerService.trailerList(pd.getString("CORPINFO_ID"));
page.setPd(pd);
List<PageData> insureList = insureService.list(page);
List<String> id = new ArrayList<>();
// 获取保险列表中所有挂车信息
List<PageData> insures = insureList.stream().filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "2"))
.collect(Collectors.toList());
// 过滤掉保险列表中所有已存在的挂车
List<PageData> varList = new ArrayList<>();
if (!CollectionUtils.isEmpty(insures)) {
varList = freightList.stream().parallel()
.filter(freight -> insures.stream()
.noneMatch(ins -> StringUtils.equals(freight.getString("FREIGHTTRAILER_ID"), ins.getString("VEHICLE"))))
.collect(Collectors.toList());
} else {
varList = freightList;
insureList.stream().filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "2")).collect(Collectors.toList())
.stream().collect(Collectors.groupingBy(data -> data.getString("VEHICLE"))).forEach((key, value) -> {
if (value.size() == 3) {
id.add(key);
}
});
List<PageData> varList = freightList.stream().filter(freight -> id.stream()
.noneMatch(data -> StringUtils.equals(freight.getString("FREIGHTTRAILER_ID"), data))).collect(Collectors.toList());
if (pd.containsKey("ID")) {
pd.put("FREIGHTTRAILER_ID", pd.getString("ID"));

View File

@ -0,0 +1,24 @@
package com.zcloud.mapper.datasource.comprehensive;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TrafficCommitentItemMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
}

View File

@ -0,0 +1,17 @@
package com.zcloud.service.comprehensive;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface TrafficCommitentItemService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd, MultipartFile[] files)throws Exception;
}

View File

@ -0,0 +1,72 @@
package com.zcloud.service.comprehensive.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.comprehensive.TrafficCommitentItemMapper;
import com.zcloud.mapper.datasource.comprehensive.TrafficDrivingItemMapper;
import com.zcloud.mapper.datasource.comprehensive.TrafficDrivingSignMapper;
import com.zcloud.service.comprehensive.TrafficCommitentItemService;
import com.zcloud.service.comprehensive.TrafficDrivingItemService;
import com.zcloud.util.Const;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Smb;
import com.zcloud.util.UuidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
@Service
public class TrafficCommitentItemServiceImpl implements TrafficCommitentItemService {
@Autowired
private TrafficCommitentItemMapper trafficCommitentItemMapper;
@Autowired
private TrafficDrivingSignMapper trafficDrivingSignMapper;
@Autowired
private com.zcloud.mapper.datasource.comprehensive.TrafficSecurityWaybillRegistrationMapper TrafficSecurityWaybillRegistrationMapper;
@Autowired
private Smb smb;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd, MultipartFile[] files)throws Exception{
List<String> filePaths = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
//保存签名文件
String ffile = DateUtil.getDays();
String fileName = UuidUtil.get32UUID() + files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf("."));
smb.sshSftp(files[i], fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
filePaths.add(Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
}
pd.put("SIGN_TIME", pd.getString("SIGNTIME"));
pd.put("SIGN_PATH", String.join(",",filePaths));
trafficDrivingSignMapper.save(pd);
TrafficSecurityWaybillRegistrationMapper.editStatus(pd);
if (pd.get("checklist") != null && !pd.get("checklist").equals("")) { //安全措施确认步骤
List<JSONObject> list = (List<JSONObject>) JSON.parse(pd.get("checklist").toString());
for (JSONObject json : list) {
PageData checklist = new PageData();
checklist.put("DRIVING_SIGN_ID",pd.get("DRIVING_SIGN_ID"));
checklist.put("DRIVINGTYPE_ID",json.get("DRIVINGCOMMITMENT_ID"));
checklist.put("REMARK", json.get("REMARK"));
checklist.put("STATUS", json.get("ISNORMAL"));
checklist.put("OPERATTIME", json.get("OPERATTIME"));
checklist.put("OPERATORNAME", json.get("OPERATORNAME"));
checklist.put("OPERATOR", json.get("OPERATOR"));
checklist.put("ISDELETE", json.get("ISDELETE"));
checklist.put("COMMITMENT_ITEM_ID", UuidUtil.get32UUID());
trafficCommitentItemMapper.save(checklist);
}
}
}
}

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.comprehensive.TrafficCommitentItemMapper">
<!--表名 -->
<sql id="tableName">
BUS_TRAFFIC_COMMITMENT_ITEM
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.COMMITMENT_ITEM_ID,
f.DRIVING_SIGN_ID,
f.DRIVINGTYPE_ID,
f.STATUS,
f.REMARK,
f.CREATOR,
f.CREATORNAME,
f.CREATTIME,
f.OPERATOR,
f.OPERATORNAME,
f.OPERATTIME,
f.DELETOR,
f.DELETORNAME,
f.DELETETIME,
f.ISDELETE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
COMMITMENT_ITEM_ID,
DRIVING_SIGN_ID,
DRIVINGTYPE_ID,
STATUS,
REMARK,
CREATOR,
CREATORNAME,
CREATTIME,
OPERATOR,
OPERATORNAME,
OPERATTIME,
DELETOR,
DELETORNAME,
DELETETIME,
ISDELETE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{COMMITMENT_ITEM_ID},
#{DRIVING_SIGN_ID},
#{DRIVINGTYPE_ID},
#{STATUS},
#{REMARK},
#{CREATOR},
#{CREATORNAME},
#{CREATTIME},
#{OPERATOR},
#{OPERATORNAME},
#{OPERATTIME},
#{DELETOR},
#{DELETORNAME},
#{DELETETIME},
#{ISDELETE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
COMMITMENT_ITEM_ID = #{COMMITMENT_ITEM_ID},
DRIVING_SIGN_ID = #{DRIVING_SIGN_ID},
DRIVINGTYPE_ID = #{DRIVINGTYPE_ID},
STATUS = #{STATUS},
REMARK = #{REMARK},
CREATOR = #{CREATOR},
CREATORNAME = #{CREATORNAME},
CREATTIME = #{CREATTIME},
OPERATOR = #{OPERATOR},
OPERATORNAME = #{OPERATORNAME},
OPERATTIME = #{OPERATTIME},
DELETOR = #{DELETOR},
DELETORNAME = #{DELETORNAME},
DELETETIME = #{DELETETIME},
ISDELETE = #{ISDELETE}
where
COMMITMENT_ITEM_ID = #{COMMITMENT_ITEM_ID}
</update>
</mapper>