diff --git a/src/main/java/com/zcloud/controller/inspectAnnually/InspectAnnuallyController.java b/src/main/java/com/zcloud/controller/inspectAnnually/InspectAnnuallyController.java index d9d4545..8a84bc8 100644 --- a/src/main/java/com/zcloud/controller/inspectAnnually/InspectAnnuallyController.java +++ b/src/main/java/com/zcloud/controller/inspectAnnually/InspectAnnuallyController.java @@ -245,43 +245,45 @@ public class InspectAnnuallyController extends BaseController { } Map dataMap = new HashMap(); List titles = new ArrayList(); - titles.add("年检车辆"); //1 - titles.add("车架号"); //2 - //titles.add("车身编号"); //3 - titles.add("车辆类型"); //4 - titles.add("运营证号"); //5 - titles.add("归属部门"); //6 - titles.add("车主"); //7 - titles.add("车主电话"); //8 - titles.add("初登日期"); //9 - titles.add("发证日期"); //10 - titles.add("到期日期"); //11 - titles.add("车辆品牌"); //12 - titles.add("车辆型号"); //13 - titles.add("核定总质量"); //14 - titles.add("核定载质量"); //15 - //titles.add("容积"); //16 + titles.add("自编号"); //1 + titles.add("年检车辆"); //2 + titles.add("车辆品牌"); //3 + titles.add("年检车型"); //4 + titles.add("车主业户"); //5 + titles.add("联系电话"); //6 + titles.add("登记人"); //7 + titles.add("办理日期"); //8 + titles.add("年检周期"); //9 + titles.add("到期日期"); //10 + titles.add("年检费用"); //11 + titles.add("实收费用"); //12 + titles.add("年检地址"); //13 + titles.add("提醒天数"); //14 + titles.add("提醒日期"); //15 + titles.add("年检资料"); //16 + titles.add("备注"); //17 dataMap.put("titles", titles); List varOList = inspectAnnuallyService.listOut(pd); List varList = new ArrayList(); for(int i=0;i map = new HashMap(); + String errInfo = "success"; + StringBuffer errorStr = new StringBuffer(); + if (null != file && !file.isEmpty()) { + File tempFile = new File(file.getOriginalFilename()); //新建file + FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); //将MultipartFile复制到File + List listPd = (List) ObjectExcelRead.readExcel(tempFile, 1, 0, 0); // 执行读EXCEL操作,读出的数据导入List + // 2:从第3行开始;0:从第A列开始;0:第0个sheet + /** + * var0 :风险点(单元) var1 :所属部门 + */ + + try { + if (listPd.size() < 1) { + map.put("result", "error"); // 返回结果 + map.put("resultStr", "Excel数据为空,请检查数据后,重新上传!"); + FileUtils.deleteQuietly(tempFile);//删除临时文件 + return map; + } + List riskunitList = new ArrayList<>(); + PageData pd = new PageData(); + pd.put("ISDELETE", "0"); + pd.put("BELONGING_DEPT", Jurisdiction.getCORPINFO_ID()); + List riskunitListAll = operatingVehiclesService.listAll(pd); + Map riskunitMapAll = new HashMap<>(); + for (PageData pageData : riskunitListAll) { + // 使用车牌号作为键 + String plateNumberKey = Tools.excelHandle(pageData.getString("PLATE_NUMBER")); + riskunitMapAll.put(plateNumberKey, pageData); + } + List header = new ArrayList<>(); + header.add("自编号"); + header.add("车牌号"); + header.add("车架号"); + /*header.add("车身编号");*/ + header.add("车辆类型"); + header.add("运营证号"); + header.add("归属部门"); + header.add("车主"); + header.add("车主电话"); + header.add("联系人"); + header.add("联系电话"); + header.add("初登日期"); + header.add("发证日期"); + header.add("到期日期"); + header.add("车辆品牌"); + header.add("车辆型号"); + header.add("核定总质量"); + header.add("核定载质量"); + /*header.add("容积");*/ + header.add("备注"); + Map hasRiskUnit = new HashMap<>(); + int succeeNum = 1; + for (PageData lpd : listPd) { + succeeNum++; + convertExcelDate(lpd, "var10"); // 初登日期 FIRSTSHOW_DATE + convertExcelDate(lpd, "var11"); // 发证日期 CERTIFICATE_DATE + convertExcelDate(lpd, "var12"); // 到期日期 EXPIRE_DATE + System.out.println(lpd.get("var10")+"--"+lpd.get("var11")+"--"+lpd.get("var12")); + for (int i = 0; i < header.size(); i++) { + if (!lpd.containsKey("var" + i)) { + errorStr.append("

第" + succeeNum + "行的\"" + header.get(i) + "\"无数据

"); + continue; + } + if (Tools.isEmpty(lpd.get("var" + i))) { + errorStr.append("

第" + succeeNum + "行的\"" + header.get(i) + "\"无数据

"); + continue; + } + } + + String plateNumberVar = Tools.isEmpty(lpd.get("var1")) ? "" : Tools.excelHandle(lpd.get("var1")); + + if (riskunitMapAll.containsKey(plateNumberVar)) { + errorStr.append("

第" + succeeNum + "行:" + "车牌号为\"" + plateNumberVar + "\"的记录已存在,请检查!" + "

"); + continue; + } + if (hasRiskUnit.containsKey(plateNumberVar)) { + errorStr.append("

第" + succeeNum + "行:" + "车牌号重复,请重新检查内容!" + "

"); + continue; + } + hasRiskUnit.put(plateNumberVar, "1"); + PageData riskunit = new PageData(); + riskunit.put("GOODSSELFNUMBER", lpd.get("var0")); + riskunit.put("PLATE_NUMBER", lpd.get("var1")); + riskunit.put("FRAMES_NUMBER", lpd.get("var2")); + riskunit.put("VEHICLE_TYPE", lpd.get("var3")); + riskunit.put("OPERATING_CERTIFICATE", lpd.get("var4")); + riskunit.put("BELONGING_DEPARTMENT", lpd.get("var5")); + riskunit.put("VEHICLEOWNER", lpd.get("var6")); + riskunit.put("VEHICLEOWNER_NUMBER", lpd.get("var7")); + riskunit.put("CONTACT", lpd.get("var8")); + riskunit.put("CONTACT_NUMBER", lpd.get("var9")); + riskunit.put("FIRSTSHOW_DATE", lpd.get("var10")); + riskunit.put("CERTIFICATE_DATE", lpd.get("var11")); + riskunit.put("EXPIRE_DATE", lpd.get("var12")); + riskunit.put("VEHICLE_BRAND", lpd.get("var13")); + riskunit.put("VEHICLE_MODEL", lpd.get("var14")); + riskunit.put("VOUCH_TOTALMASS", lpd.get("var15")); + riskunit.put("VOUCH_PAYLOAD", lpd.get("var16")); + riskunit.put("REMARK", lpd.get("var18")); + riskunit.put("OPERATING_ID", this.get32UUID()); + riskunit.put("ISDELETE", "0"); + riskunit.put("CREATOR", Jurisdiction.getUsername()); + riskunit.put("CREATTIME", DateUtil.date2Str(new Date())); + riskunit.put("OPERATOR", Jurisdiction.getUsername()); + riskunit.put("OPERATTIME", DateUtil.date2Str(new Date())); + riskunit.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + riskunitList.add(riskunit); + } + if (Tools.isEmpty(errorStr.toString())) { + for (PageData riskunit : riskunitList) { + operatingVehiclesService.save(riskunit); + } + errorStr.append("成功导入" + riskunitList.size() + "条数据!"); + } else { + errInfo = "error"; + } + + FileUtils.deleteQuietly(tempFile);//删除临时文件 + } catch (Exception e) { + map.put("result", "fail"); // 返回结果 + map.put("resultStr", errorStr.toString()); + FileUtils.deleteQuietly(tempFile);//删除临时文件 + return map; + } + } + map.put("result", "success");//返回结果 + map.put("resultType", errInfo);//返回message类型 + map.put("isExcel","1");//返回类型 + map.put("resultStr", errorStr.toString()); + return map; + } + + private void convertExcelDate(PageData lpd, String field) { + Object excelDateObj = lpd.get(field); + if (excelDateObj != null) { + // 尝试将对象转换为Double,因为Excel中的日期是以Double类型的数字存储的 + double excelDate = Double.parseDouble(excelDateObj.toString()); + // 使用Apache POI的DateUtil获取Java日期对象 + Date javaDate = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(excelDate); + // 使用您的DateUtil工具类进行日期格式化 + String formattedDate = DateUtil.date2Str(javaDate, "yyyy-MM-dd"); + // 更新lpd对象中的日期字段 + lpd.put(field, formattedDate); + } + } + } diff --git a/src/main/java/com/zcloud/controller/scrapManage/ScrapManageController.java b/src/main/java/com/zcloud/controller/scrapManage/ScrapManageController.java index 0fb7d07..6166a74 100644 --- a/src/main/java/com/zcloud/controller/scrapManage/ScrapManageController.java +++ b/src/main/java/com/zcloud/controller/scrapManage/ScrapManageController.java @@ -55,6 +55,7 @@ public class ScrapManageController extends BaseController { pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 + pd.put("ISSCRAP", "1"); freightTrailerService.editScrapStatus(pd); scrapManageService.save(pd); map.put("pd", pd); diff --git a/src/main/java/com/zcloud/controller/taxationManage/TaxationManageController.java b/src/main/java/com/zcloud/controller/taxationManage/TaxationManageController.java index 4bf5500..adb64d1 100644 --- a/src/main/java/com/zcloud/controller/taxationManage/TaxationManageController.java +++ b/src/main/java/com/zcloud/controller/taxationManage/TaxationManageController.java @@ -51,9 +51,6 @@ public class TaxationManageController extends BaseController { pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 - pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id - pd.put("OPERATORNAME", Jurisdiction.getUsername()); // 修改人名字 - pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间 if("".equals(pd.getString("EXPIRE_STATUS"))) { String expireDate = pd.getString("EXPIRE_DATE"); String day = DateUtil.getDay(); @@ -188,10 +185,10 @@ public class TaxationManageController extends BaseController { pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID page.setPd(pd); List varList = freightTrailerService.list(page); // 列出所有挂车列表 - List taxationList = taxationManageService.list(page); // 列出车船税列表 + List taxationList = taxationManageService.taxationList(pd.getString("CORPINFO_ID")); // 列出车船税列表 for (int i = 0; i < taxationList.size(); i++) { for (int j = 0; j < varList.size(); j++) { - if (taxationList.get(i).get("PLATE_NUMBER").equals(varList.get(j).get("PLATE_NUMBER")) || varList.get(j).get("ISSCRAP").equals("1")) { + if (taxationList.get(i).get("PLATE_NUMBER").equals(varList.get(j).get("PLATE_NUMBER")) && varList.get(j).get("ISSCRAP").equals("1")) { varList.remove(j); } } diff --git a/src/main/java/com/zcloud/mapper/datasource/operatingvehicles/OperatingVehiclesMapper.java b/src/main/java/com/zcloud/mapper/datasource/operatingvehicles/OperatingVehiclesMapper.java index d342cee..3bd32b6 100644 --- a/src/main/java/com/zcloud/mapper/datasource/operatingvehicles/OperatingVehiclesMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/operatingvehicles/OperatingVehiclesMapper.java @@ -43,4 +43,6 @@ public interface OperatingVehiclesMapper { void setScrapStatus(PageData pd); List listOut(PageData pd); + + List listAll(PageData pd); } diff --git a/src/main/java/com/zcloud/service/operatingvehicles/OperatingVehiclesService.java b/src/main/java/com/zcloud/service/operatingvehicles/OperatingVehiclesService.java index 213a58c..aa74322 100644 --- a/src/main/java/com/zcloud/service/operatingvehicles/OperatingVehiclesService.java +++ b/src/main/java/com/zcloud/service/operatingvehicles/OperatingVehiclesService.java @@ -43,4 +43,6 @@ public interface OperatingVehiclesService { void setScrapStatus(PageData pd); List listOut(PageData pd); + + List listAll(PageData pd); } diff --git a/src/main/java/com/zcloud/service/operatingvehicles/impl/OperatingVehiclesServiceImpl.java b/src/main/java/com/zcloud/service/operatingvehicles/impl/OperatingVehiclesServiceImpl.java index 340c82f..c826c8e 100644 --- a/src/main/java/com/zcloud/service/operatingvehicles/impl/OperatingVehiclesServiceImpl.java +++ b/src/main/java/com/zcloud/service/operatingvehicles/impl/OperatingVehiclesServiceImpl.java @@ -66,4 +66,9 @@ public class OperatingVehiclesServiceImpl implements OperatingVehiclesService { public List listOut(PageData pd) { return operatingVehiclesMapper.listOut(pd); } + + @Override + public List listAll(PageData pd) { + return operatingVehiclesMapper.listAll(pd); + } } diff --git a/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml b/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml index 17624e0..2819260 100644 --- a/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml +++ b/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml @@ -262,18 +262,20 @@ select f.*, case when f.DUE_DATE < NOW() then 0 else 1 end as DUE_DATE_TYPE, - v1.PLATE_NUMBER, - case + v1.PLATE_NUMBER + /*case when btsm.PLATE_NUMBER is not null then '1' when bta.RAW_PLATE_NUMBER is not null then '2' else f.ARCHIVES_TYPE - end as NEW_ARCHIVES_TYPE + end as NEW_ARCHIVES_TYPE*/ from f INNER JOIN v_traffic v1 on f.VEHICLE=v1.ID - LEFT JOIN BUS_TRAFFIC_SCRAP_MANAGEMENT btsm on v1.PLATE_NUMBER = btsm.PLATE_NUMBER - LEFT JOIN BUS_TRAFFIC_ASSIGNED bta on v1.PLATE_NUMBER = bta.RAW_PLATE_NUMBER - where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} + /*LEFT JOIN BUS_TRAFFIC_SCRAP_MANAGEMENT btsm on v1.PLATE_NUMBER = btsm.PLATE_NUMBER + LEFT JOIN BUS_TRAFFIC_ASSIGNED bta on v1.PLATE_NUMBER = bta.RAW_PLATE_NUMBER*/ + LEFT JOIN bus_traffic_mechanical_freighttrailer btmf on btmf.FREIGHTTRAILER_ID = f.VEHICLE + LEFT JOIN bus_traffic_operatingvehicle bto on bto.OPERATING_ID = f.VEHICLE + where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} and (btmf.ISSCRAP = '0' OR bto.ISSCRAP = '0') and f.BASICINFO_LICENSE_PLATE LIKE CONCAT(CONCAT('%', #{pd.BASICINFO_LICENSE_PLATE}),'%') diff --git a/src/main/resources/mybatis/datasource/inspectAnnually/InspectAnnuallyMapper.xml b/src/main/resources/mybatis/datasource/inspectAnnually/InspectAnnuallyMapper.xml index 78263cd..14c2ead 100644 --- a/src/main/resources/mybatis/datasource/inspectAnnually/InspectAnnuallyMapper.xml +++ b/src/main/resources/mybatis/datasource/inspectAnnually/InspectAnnuallyMapper.xml @@ -187,8 +187,10 @@ from f left join sys_dictionaries b on f.ANNUAL_INSPECTION_CYCLE = b.DICTIONARIES_ID AND b.PARENT_ID = '8b7dea3977fd4360a3cc8112368b90ff' - INNER JOIN v_traffic v1 on f.VEHICLE=v1.ID - where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} + INNER JOIN v_traffic v1 on f.VEHICLE = v1.ID + LEFT JOIN bus_traffic_operatingvehicle bto on bto.OPERATING_ID = f.VEHICLE + LEFT JOIN bus_traffic_mechanical_freighttrailer btmf on btmf.FREIGHTTRAILER_ID = f.VEHICLE + where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} and (bto.ISSCRAP = '0' OR btmf.ISSCRAP = '0') and v1.PLATE_NUMBER LIKE CONCAT(CONCAT('%', #{pd.PLATE_NUMBER}),'%') @@ -224,5 +226,17 @@ f.CORPINFO_ID = #{pd.CORPINFO_ID} + + diff --git a/src/main/resources/mybatis/datasource/insure/InsureMapper.xml b/src/main/resources/mybatis/datasource/insure/InsureMapper.xml index 0dd2fbd..3e8880e 100644 --- a/src/main/resources/mybatis/datasource/insure/InsureMapper.xml +++ b/src/main/resources/mybatis/datasource/insure/InsureMapper.xml @@ -197,7 +197,9 @@ f INNER JOIN v_traffic v1 on f.VEHICLE=v1.ID - where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} + LEFT JOIN bus_traffic_operatingvehicle bto on bto.OPERATING_ID = f.VEHICLE + LEFT JOIN bus_traffic_mechanical_freighttrailer btmf on btmf.FREIGHTTRAILER_ID = f.VEHICLE + where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} AND (bto.ISSCRAP = '0' OR btmf.ISSCRAP = '0') and f.BASICINFO_LICENSE_PLATE LIKE CONCAT(CONCAT('%', #{pd.BASICINFO_LICENSE_PLATE}),'%') diff --git a/src/main/resources/mybatis/datasource/operatingvehicles/OperatingVehiclesMapper.xml b/src/main/resources/mybatis/datasource/operatingvehicles/OperatingVehiclesMapper.xml index 1922030..943f11d 100644 --- a/src/main/resources/mybatis/datasource/operatingvehicles/OperatingVehiclesMapper.xml +++ b/src/main/resources/mybatis/datasource/operatingvehicles/OperatingVehiclesMapper.xml @@ -313,6 +313,14 @@ f.CORPINFO_ID = #{CORPINFO_ID} + +