Jelajahi Sumber

1、测试bug修复;

zk 2 tahun lalu
induk
melakukan
564499358c

+ 3 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/constant/Global.java

@@ -158,6 +158,9 @@ public class Global {
     /**+符号**/
     public static final String PLUS = "+";
 
+    /**-符号*/
+    public static final String MINUS_SIGN = "-";
+
     /**#符号**/
     public static final String POUND = "#";
 

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/utils/PasswordUtils.java

@@ -123,7 +123,7 @@ public class PasswordUtils {
     public static void main(String[] args) {
 
         String password = PasswordUtils.entryptPassword(PasswordUtils.md5("18581845668"));
-        String md5 = PasswordUtils.md5("18581845668");
+        String md5 = PasswordUtils.md5("123456");
         System.out.println(password);
         System.out.println(md5);
         System.out.println(validatePassword(md5, password));

+ 1 - 1
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/RemoteFleetService.java

@@ -77,5 +77,5 @@ public interface RemoteFleetService {
      * @author zk
      * @date 2023/9/4
      **/
-    List<Map<String, Object>> capacityStatistics(List entIds);
+    List<Map<String, Object>> capacityStatistics(List<Long> entIds, Integer capacityAmountMin, Integer capacityAmountMax);
 }

+ 5 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dao/KwfTruckMapper.java

@@ -51,9 +51,13 @@ public interface KwfTruckMapper extends BaseMapper<KwfTruck> {
     /**
      * 企业运力统计
      * @param entIds 企业id集
+     * @param capacityAmountMin 最小合计载重
+     * @param capacityAmountMax 最大合计载重
      * @return
      */
-    List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds);
+    List<Map<String, Object>> capacityStatistics(@Param("entIds") List entIds,
+                                                 @Param("capacityAmountMin") Integer capacityAmountMin,
+                                                 @Param("capacityAmountMax") Integer capacityAmountMax);
 
     /**
      * 查询企业车辆

+ 5 - 3
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/dubbo/RemoteFleetServiceImpl.java

@@ -171,13 +171,15 @@ public class RemoteFleetServiceImpl implements RemoteFleetService {
     }
 
     /**
-     * @param entIds 企业ID
+     * @param entIds 企业id集
+     * @param capacityAmountMin 最小合计载重
+     * @param capacityAmountMax 最大合计载重
      * @desc 企业运力统计
      * @author zk
      * @date 2023/9/4
      **/
     @Override
-    public List<Map<String, Object>> capacityStatistics(List entIds) {
-        return truckDao.capacityStatistics(entIds);
+    public List<Map<String, Object>> capacityStatistics(List<Long> entIds, Integer capacityAmountMin, Integer capacityAmountMax) {
+        return truckDao.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
     }
 }

+ 6 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/model/vo/KwfDriverVo.java

@@ -72,6 +72,12 @@ public class KwfDriverVo {
     @ExcelProperty(value = "准驾车型", index = 7)
     private String licenseType;
 
+    /**
+     * 准驾车型
+     */
+    @ExcelIgnore
+    private String licenseTypeName;
+
     /**
      * 驾驶证有效期至
      */

+ 13 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfDriverService.java

@@ -201,9 +201,11 @@ public class KwfDriverService {
         /**获取查询数据**/
         List<Long> createBys = new ArrayList<>();
         List<Long> entIds = new ArrayList<>();
+        List<String> dictKey = new ArrayList<>();
         for (KwfDriverVo driver:drivers) {
             createBys.add(Long.parseLong(driver.getCreateBy()));
             entIds.add(Long.parseLong(driver.getEntId()));
+            dictKey.add(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
         }
         //用户数据集
         createBys = createBys.stream().distinct().collect(Collectors.toList());
@@ -211,13 +213,18 @@ public class KwfDriverService {
         //企业数据集
         entIds = entIds.stream().distinct().collect(Collectors.toList());
         Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
+        //数据字典
+        dictKey = dictKey.stream().distinct().collect(Collectors.toList());
+        Map<String, SysDictResDto> dicts = remoteSystemService.queryDictMapByTypeValues(String.join(Global.COMMA, dictKey));
 
         /**数据组装**/
         for (KwfDriverVo driver:drivers) {
             UserCacheResDto user = users == null ? null : users.get(Long.parseLong(driver.getCreateBy()));
             EntCacheResDto ent = ents == null ? null : ents.get(Long.parseLong(driver.getEntId()));
+            SysDictResDto licenseType = dicts == null ? null : dicts.get(DictTypeEnum.APPROVED_DRIVING.getType() + Global.POUND + driver.getLicenseType());
             driver.setCreateByName(user != null ? user.getName() : null);
             driver.setFirmName(ent != null ? ent.getFirmName() : null);
+            driver.setLicenseTypeName(licenseType != null ? licenseType.getLabel() : null);
         }
         return drivers;
     }
@@ -477,6 +484,8 @@ public class KwfDriverService {
         driverCard.setStatus(Global.YES);
         if (StringUtils.isBlank(driverCard.getCertificateMain()) && StringUtils.isBlank(driverCard.getCertificateRevolt())) {
             driverCard.setStatus(Global.NO);
+            driverCard.setCertificateMain(Global.EMPTY_STRING);
+            driverCard.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -526,6 +535,8 @@ public class KwfDriverService {
         driverLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(driverLicense.getCertificateMain()) && StringUtils.isBlank(driverLicense.getCertificateRevolt())) {
             driverLicense.setStatus(Global.NO);
+            driverLicense.setCertificateMain(Global.EMPTY_STRING);
+            driverLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -576,6 +587,8 @@ public class KwfDriverService {
         driverQual.setStatus(Global.YES);
         if (StringUtils.isBlank(driverQual.getCertificateMain()) && StringUtils.isBlank(driverQual.getCertificateRevolt())) {
             driverQual.setStatus(Global.NO);
+            driverQual.setCertificateMain(Global.EMPTY_STRING);
+            driverQual.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/

+ 4 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -442,6 +442,8 @@ public class KwfTruckService {
         truckLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(truckLicense.getCertificateMain()) && StringUtils.isBlank(truckLicense.getCertificateRevolt())) {
             truckLicense.setStatus(Global.NO);
+            truckLicense.setCertificateMain(Global.EMPTY_STRING);
+            truckLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/
@@ -482,6 +484,8 @@ public class KwfTruckService {
         transportLicense.setStatus(Global.YES);
         if (StringUtils.isBlank(transportLicense.getCertificateMain()) && StringUtils.isBlank(transportLicense.getCertificateRevolt())) {
             transportLicense.setStatus(Global.NO);
+            transportLicense.setCertificateMain(Global.EMPTY_STRING);
+            transportLicense.setCertificateRevolt(Global.EMPTY_STRING);
         }
 
         /**数据更新**/

+ 7 - 0
sckw-modules/sckw-fleet/src/main/resources/mapper/KwfTruckMapper.xml

@@ -232,6 +232,13 @@
             </when>
         </choose>
         GROUP BY ent_id
+        HAVING 1=1
+        <if test="capacityAmountMin != null and capacityAmountMin != ''">
+            and capacityAmount <![CDATA[ >= ]]> #{capacityAmountMin, jdbcType=INTEGER}
+        </if>
+        <if test="capacityAmountMax != null and capacityAmountMax != ''">
+            and capacityAmount <![CDATA[ <= ]]> #{capacityAmountMax, jdbcType=INTEGER}
+        </if>
     </select>
 
     <select id="findTruckByEnt" resultType="com.sckw.fleet.model.vo.KwfTruckMonitorVo" >

+ 18 - 7
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwFleetService.java

@@ -7,6 +7,7 @@ import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.page.PageHelperUtil;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.utils.NumberUtils;
+import com.sckw.core.utils.StringUtils;
 import com.sckw.fleet.api.RemoteFleetService;
 import com.sckw.report.model.vo.KwfCapacityVo;
 import com.sckw.system.api.RemoteUserService;
@@ -37,14 +38,26 @@ public class KwFleetService {
      * @date 2023/9/1
      **/
     public PageResult capacity(HashMap<String, Object> params) {
-        //企业数据查询
-        List<KwfCapacityVo> list = new ArrayList<>();
+        // 参数组装
         List<Long> entIds = new ArrayList<>();
+        Integer capacityAmountMin = null;
+        Integer capacityAmountMax = null;
+        String totalLoadStr = StringUtils.objectStr(params.get("totalLoad"));
+        String [] array = StringUtils.isNotBlank(totalLoadStr) ? totalLoadStr.split(Global.MINUS_SIGN) : null;
+        capacityAmountMin = NumberUtils.parseEmptyInteger(array != null && array.length > 0 ? array[0] : null);
+        capacityAmountMax = NumberUtils.parseEmptyInteger(array != null && array.length > 1 ? array[1] : null);
+        if (capacityAmountMin != null || capacityAmountMax != null) {
+            List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
+            statistics.forEach(e -> entIds.add(NumberUtils.parseEmptyLong(e.get("entId"))));
+        }
+
+        // 企业数据查询
+        List<KwfCapacityVo> list = new ArrayList<>();
         Integer cityCode = NumberUtils.parseIntV1(params.get("cityCode"));
         List<Integer> entTypes = new ArrayList<>(Arrays.asList(3, 4));
         Integer page = PageResult.getPage(params);
         Integer pageSize = PageResult.getPageSize(params);
-        PageResult pageResult = userService.queryEntInfoByCityCodeAndEntTypesWithPage(cityCode, entTypes, page, pageSize);
+        PageResult pageResult = userService.queryEntInfoByCityCodeAndEntTypesWithPage(cityCode, entTypes, entIds, page, pageSize);
         List<KwsEnterpriseResDto> ents = JSON.parseArray(JSON.toJSONString(pageResult.getList()), KwsEnterpriseResDto.class);
         for (KwsEnterpriseResDto ent:ents) {
             KwfCapacityVo capacity = new KwfCapacityVo();
@@ -58,11 +71,9 @@ public class KwFleetService {
         }
 
         //企业运力统计
-        List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds);
+        List<Map<String, Object>> statistics = fleetService.capacityStatistics(entIds, capacityAmountMin, capacityAmountMax);
         Map<Long, Map<String, Object>> entMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
-        for (Map<String, Object> statistic:statistics) {
-            entMap.put(NumberUtils.parseLong(statistic.get("entId")), statistic);
-        }
+        statistics.forEach(e -> entMap.put(NumberUtils.parseEmptyLong(e.get("entId")), e));
 
         //企业运力统计查询
         for (KwfCapacityVo capacity:list) {