From 956430467021135c2302c063097b9c06bfd7f26e Mon Sep 17 00:00:00 2001 From: xiepeng Date: Thu, 9 May 2024 18:08:34 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppTrafficCommitentItemController.java | 68 ++++++++++++ .../AppTrafficDrivingTypeController.java | 20 ++++ ...cSecurityCustomerManagementController.java | 2 +- ...cSecurityLocationManagementController.java | 2 - ...SecurityWaybillRegistrationController.java | 2 +- .../controller/insure/InsureController.java | 66 +++++------ .../TrafficCommitentItemMapper.java | 24 ++++ .../TrafficCommitentItemService.java | 17 +++ .../impl/TrafficCommitentItemServiceImpl.java | 72 ++++++++++++ .../TrafficCommitentItemMapper.xml | 105 ++++++++++++++++++ 10 files changed, 336 insertions(+), 42 deletions(-) create mode 100644 src/main/java/com/zcloud/controller/comprehensive/AppTrafficCommitentItemController.java create mode 100644 src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficCommitentItemMapper.java create mode 100644 src/main/java/com/zcloud/service/comprehensive/TrafficCommitentItemService.java create mode 100644 src/main/java/com/zcloud/service/comprehensive/impl/TrafficCommitentItemServiceImpl.java create mode 100644 src/main/resources/mybatis/datasource/comprehensive/TrafficCommitentItemMapper.xml diff --git a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficCommitentItemController.java b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficCommitentItemController.java new file mode 100644 index 0000000..2801c12 --- /dev/null +++ b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficCommitentItemController.java @@ -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 map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + List fileList = new ArrayList(); + 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; + } + +} diff --git a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficDrivingTypeController.java b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficDrivingTypeController.java index 53fc410..b6eb652 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/AppTrafficDrivingTypeController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/AppTrafficDrivingTypeController.java @@ -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 map = new HashMap(); + String errInfo = "success"; + PageData pd = new PageData(); + pd = this.getPageData(); + page.setPd(pd); + List 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{ diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java index df88e60..f9c3ec5 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCustomerManagementController.java @@ -121,7 +121,7 @@ public class TrafficSecurityCustomerManagementController extends BaseController page.setPd(pageData); List 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); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java index ae851b0..fe050dd 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLocationManagementController.java @@ -152,13 +152,11 @@ public class TrafficSecurityLocationManagementController extends BaseController Map map = new HashMap(); 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; diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java index 309fdc0..0415806 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegistrationController.java @@ -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); diff --git a/src/main/java/com/zcloud/controller/insure/InsureController.java b/src/main/java/com/zcloud/controller/insure/InsureController.java index 99fdb58..7ef9fa3 100644 --- a/src/main/java/com/zcloud/controller/insure/InsureController.java +++ b/src/main/java/com/zcloud/controller/insure/InsureController.java @@ -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 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 operatingList = operatingVehiclesService.operationVehicleList(pd.getString("CORPINFO_ID")); page.setPd(pd); List insAnnually = insureService.list(page); - + List id = new ArrayList<>(); // 获取保险列表中所有的营运车辆 - List insures = insAnnually.stream() - .filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "1")) - .collect(Collectors.toList()); + 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 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; - } + List 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 freightList = freightTrailerService.trailerList(pd.getString("CORPINFO_ID")); page.setPd(pd); List insureList = insureService.list(page); - + List id = new ArrayList<>(); // 获取保险列表中所有挂车信息 - List insures = insureList.stream().filter(data -> StringUtils.equals(data.getString("VEHICLE_MODEL"), "2")) - .collect(Collectors.toList()); - - // 过滤掉保险列表中所有已存在的挂车 - List 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 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")); diff --git a/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficCommitentItemMapper.java b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficCommitentItemMapper.java new file mode 100644 index 0000000..106635d --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/comprehensive/TrafficCommitentItemMapper.java @@ -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); + +} diff --git a/src/main/java/com/zcloud/service/comprehensive/TrafficCommitentItemService.java b/src/main/java/com/zcloud/service/comprehensive/TrafficCommitentItemService.java new file mode 100644 index 0000000..884de5b --- /dev/null +++ b/src/main/java/com/zcloud/service/comprehensive/TrafficCommitentItemService.java @@ -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; + + +} diff --git a/src/main/java/com/zcloud/service/comprehensive/impl/TrafficCommitentItemServiceImpl.java b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficCommitentItemServiceImpl.java new file mode 100644 index 0000000..05f7ae9 --- /dev/null +++ b/src/main/java/com/zcloud/service/comprehensive/impl/TrafficCommitentItemServiceImpl.java @@ -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 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 list = (List) 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); + } + } + } +} diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficCommitentItemMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficCommitentItemMapper.xml new file mode 100644 index 0000000..b1e016e --- /dev/null +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficCommitentItemMapper.xml @@ -0,0 +1,105 @@ + + + + + + BUS_TRAFFIC_COMMITMENT_ITEM + + + + + SYS_DICTIONARIES + + + + + 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 + + + + + COMMITMENT_ITEM_ID, + DRIVING_SIGN_ID, + DRIVINGTYPE_ID, + STATUS, + REMARK, + CREATOR, + CREATORNAME, + CREATTIME, + OPERATOR, + OPERATORNAME, + OPERATTIME, + DELETOR, + DELETORNAME, + DELETETIME, + ISDELETE + + + + + #{COMMITMENT_ITEM_ID}, + #{DRIVING_SIGN_ID}, + #{DRIVINGTYPE_ID}, + #{STATUS}, + #{REMARK}, + #{CREATOR}, + #{CREATORNAME}, + #{CREATTIME}, + #{OPERATOR}, + #{OPERATORNAME}, + #{OPERATTIME}, + #{DELETOR}, + #{DELETORNAME}, + #{DELETETIME}, + #{ISDELETE} + + + + + insert into + + ( + + ) values ( + + ) + + + + update + + 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} + + +