Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

xucaiqin 2 лет назад
Родитель
Сommit
dd52f8f5a9

+ 10 - 0
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckReportService.java

@@ -260,6 +260,11 @@ public class KwfTruckReportService {
                 } else {
                     continue;
                 }
+
+                //校验企业是否添加该车辆
+                KwfTruck truckEnt = new KwfTruck();
+                truckEnt.setId(truck.getId());
+                truckService.truckEntEdit(truckEnt);
             }
 
             /**档案信息**/
@@ -290,6 +295,11 @@ public class KwfTruckReportService {
                 } else {
                     continue;
                 }
+
+                //校验企业是否添加该司机
+                KwfDriver driverEnt = new KwfDriver();
+                driverEnt.setId(driver.getId());
+                driverService.driverEntEdit(driverEnt);
             }
             count += truckReportDao.insert(truckReport);
         }

+ 8 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTradeOrderService.java

@@ -779,6 +779,14 @@ public class KwoTradeOrderService {
             if (!Objects.equals(HttpStatus.SUCCESS_CODE, updateResult.getCode())) {
                 throw new BusinessException(updateResult.getMsg());
             }
+            //代客下单冻结金额
+            if (Objects.equals(source, OrderSourceEnum.SALE.getType()) && param.getTrading().startsWith("1")){
+                HttpResult freezeResult = paymentDubboService.freezeMoney(orderCheck.getProcureTopEntId(),
+                        ChannelEnum.getByTrading(param.getTrading()), orderCheck.getSupplyTopEntId(), param.getPrice(), order.getId());
+                if (!Objects.equals(HttpStatus.SUCCESS_CODE, freezeResult.getCode())) {
+                    throw new BusinessException(freezeResult.getMsg());
+                }
+            }
         }
         order.setAmount(param.getAmount()).setUnit(Objects.isNull(param.getGoodsInfo()) ? null : param.getGoodsInfo().getUnit())
                 .setPrice(param.getPrice()).setTrading(param.getTrading()).setPickupType(param.getPickupType())

+ 58 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/controller/SysVersionController.java

@@ -0,0 +1,58 @@
+package com.sckw.system.controller;
+
+import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.response.HttpResult;
+import com.sckw.system.model.vo.req.FindVersionListReqVo;
+import com.sckw.system.service.SysAreaService;
+import com.sckw.system.service.SysVersionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 版本管理
+ * @author zk
+ * @date 2023-05-30
+ */
+@RestController
+@RequestMapping("/sysVersion")
+public class SysVersionController {
+
+    @Autowired
+    private SysVersionService sysVersionService;
+
+    /**
+     * @param reqVo 入参
+     * @return HttpResult
+     * @desc: 查询版本管理列表
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    @PostMapping("/findPage")
+    public HttpResult findPage(@RequestBody FindVersionListReqVo reqVo,
+                               @RequestHeader(value = "System-Type") Integer systemType,
+                               @RequestHeader(value = "Client-Type") String clientType) {
+        reqVo.setSystemType(systemType);
+        if(StringUtils.isBlank(reqVo.getClientType())) {
+            reqVo.setClientType(clientType);
+        }
+        return HttpResult.ok(sysVersionService.findPage(reqVo));
+    }
+
+    /**
+     * @param clientType 客户端类型
+     * @return HttpResult
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    @GetMapping("/findLatestVersion")
+    public HttpResult findLatestVersion(@RequestParam(value = "clientType", required = true) String clientType,
+                                        @RequestParam(value = "systemType", required = true) Integer systemType) {
+        return HttpResult.ok(sysVersionService.findLatestVersion(systemType, clientType));
+    }
+
+}

+ 35 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/SysVersionDao.java

@@ -0,0 +1,35 @@
+package com.sckw.system.dao;
+
+import com.sckw.system.model.SysVersion;
+import com.sckw.system.model.vo.req.FindVersionListReqVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 版本管理
+ * @author zk
+ * @date 2023-05-31
+ */
+@Mapper
+public interface SysVersionDao {
+
+    /**
+     * @param reqVo
+     * @return FindVersionListResVo
+     * @desc: 查版本列表
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    List<SysVersion> findList(FindVersionListReqVo reqVo);
+
+    /**
+     * @param clientType 客户端类型
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    SysVersion findLatestVersion(@Param(value = "systemType") Integer systemType, @Param(value = "clientType") String clientType);
+
+}

+ 54 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/SysVersion.java

@@ -0,0 +1,54 @@
+package com.sckw.system.model;
+
+import com.sckw.core.model.base.BaseModel;
+import lombok.Data;
+
+/**
+ * 行政区域
+ * @author zk
+ * @date 2023-05-31
+ */
+@Data
+public class SysVersion extends BaseModel {
+
+    /**
+     * 应用服务类型
+     */
+    private String systemType;
+
+    /**
+     * 客户端类型
+     */
+    private String clientType;
+
+    /**
+     * 版本号,上线前和客户端保持一致,用于判断是否升级
+     */
+    private String versionCode;
+
+    /**
+     * 版本名称,用于客户端显示
+     */
+    private String versionName;
+
+    /**
+     * 版本升级信息
+     */
+    private String versionMessage;
+
+    /**
+     * 文件路径
+     */
+    private String filePath;
+
+    /**
+     * 是否强制升级
+     */
+    private Integer forceUpdate;
+
+    /**
+     * 是否热更新
+     */
+    private Integer hotUpdate;
+
+}

+ 57 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/req/FindVersionListReqVo.java

@@ -0,0 +1,57 @@
+package com.sckw.system.model.vo.req;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.core.model.page.PageRequest;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author czh
+ * @desc 版本查询入参
+ * @date 2023/10/10
+ */
+@Data
+public class FindVersionListReqVo extends PageRequest implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -1913272581630576735L;
+
+    /**
+     * 系统类型
+     */
+    private Integer systemType;
+
+    /**
+     * 设备类型
+     */
+    private String clientType;
+
+    /**
+     * 版本名
+     */
+    private String versionName;
+
+    /**
+     * 版本号
+     */
+    private String versionCode;
+
+    /**
+     * 开始时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    /**
+     * 结束时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+}

+ 93 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/FindVersionListResVo.java

@@ -0,0 +1,93 @@
+package com.sckw.system.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author czh
+ * @desc 版本查询返参
+ * @date 2023/10/10
+ */
+@Data
+public class FindVersionListResVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = -9036521550675071606L;
+
+    private Long id;
+
+    /**
+     * 版本号,上线前和客户端保持一致,用于判断是否升级
+     */
+    private String versionCode;
+
+    /**
+     * 版本名称,用于客户端显示
+     */
+    private String versionName;
+
+    /**
+     * 版本升级信息
+     */
+    private String versionMessage;
+
+    /**
+     * 文件路径
+     */
+    private String filePath;
+
+    /**
+     * 是否强制升级
+     */
+    private Integer forceUpdate;
+
+    /**
+     * 是否热更新
+     */
+    private Integer hotUpdate;
+
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 修改时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 创建人id
+     */
+    private Long createBy;
+
+    /**
+     * 修改人id
+     */
+    private Long updateBy;
+
+    /**
+     * 创建人
+     */
+    private String createByName;
+
+    /**
+     * 修改人
+     */
+    private String updateByName;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 5 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -337,6 +337,11 @@ public class KwsEnterpriseService {
             currentTypeList.addAll(listByEntId.stream().map(KwsEntType::getType).toList());
         }
         List<Integer> typeList = Arrays.stream(reqVo.getEntTypes().split(Global.COMMA)).map(Integer::parseInt).toList();
+
+        if (typeList.contains(EntTypeEnum.LOGISTICS3.getCode()) && typeList.contains(EntTypeEnum.LOGISTICS4.getCode())) {
+            throw new SystemException(HttpStatus.CODE_10301, HttpStatus.PL34);
+        }
+
         if (currentTypeList.contains(EntTypeEnum.LOGISTICS3.getCode()) && typeList.contains(EntTypeEnum.LOGISTICS4.getCode())) {
             throw new SystemException(HttpStatus.CODE_10301, HttpStatus.PL34);
         }

+ 98 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/SysVersionService.java

@@ -0,0 +1,98 @@
+package com.sckw.system.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.core.model.page.PageHelperUtil;
+import com.sckw.core.model.page.PageResult;
+import com.sckw.core.utils.BeanUtils;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.FileUtils;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
+import com.sckw.system.dao.SysVersionDao;
+import com.sckw.system.model.SysVersion;
+import com.sckw.system.model.vo.req.FindVersionListReqVo;
+import com.sckw.system.model.vo.res.FindVersionListResVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 版本管理service接口
+ * @author zk
+ * @date 2023-05-31
+ */
+@Service
+public class SysVersionService {
+
+    @Autowired
+    SysVersionDao sysVersionDao;
+
+    @Autowired
+    RemoteSystemService remoteSystemService;
+
+    public PageResult findPage(FindVersionListReqVo reqVo) {
+        PageHelper.startPage(reqVo.getPage(), reqVo.getPageSize());
+        List<SysVersion> list = sysVersionDao.findList(reqVo);
+        if(CollectionUtils.isEmpty(list)) {
+            return PageHelperUtil.getPageResult(new PageInfo<>());
+        }
+
+        List<FindVersionListResVo> findVersionListResVos = BeanUtils.copyToList(list, FindVersionListResVo.class);
+        List<Long> createByList = findVersionListResVos.stream().map(FindVersionListResVo::getCreateBy).collect(Collectors.toList());
+        List<Long> updateByList = findVersionListResVos.stream().map(FindVersionListResVo::getUpdateBy).toList();
+        createByList.addAll(updateByList);
+        Map<Long, UserCacheResDto> longUserCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(createByList);
+        findVersionListResVos.forEach(item -> {
+            UserCacheResDto userCacheResDto = longUserCacheResDtoMap.get(item.getCreateBy());
+            if (Objects.nonNull(userCacheResDto)) {
+                item.setCreateByName(userCacheResDto.getName());
+            }
+
+            UserCacheResDto userCacheResDto1 = longUserCacheResDtoMap.get(item.getUpdateBy());
+            if (Objects.nonNull(userCacheResDto1)) {
+                item.setUpdateByName(userCacheResDto1.getName());
+            }
+
+            item.setFilePath(FileUtils.splice(item.getFilePath()));
+        });
+
+        return PageHelperUtil.getPageResult(new PageInfo<>(findVersionListResVos), list, reqVo.getPageSize());
+    }
+
+
+    /**
+     * @param clientType 客户端类型
+     * @return HttpResult
+     * @desc: 查最新的版本信息
+     * @author: czh
+     * @date: 2023/10/10
+     */
+    public FindVersionListResVo findLatestVersion(Integer systemType, String clientType) {
+        SysVersion sysVersion = sysVersionDao.findLatestVersion(systemType, clientType);
+        if (Objects.isNull(sysVersion)) {
+            return null;
+        }
+
+        FindVersionListResVo findVersionListResVo = new FindVersionListResVo();
+        BeanUtils.copyProperties(sysVersion, findVersionListResVo);
+        List<Long> userIdList = new ArrayList<>();
+        userIdList.add(sysVersion.getCreateBy());
+        userIdList.add(sysVersion.getUpdateBy());
+        Map<Long, UserCacheResDto> longUserCacheResDtoMap = remoteSystemService.queryUserCacheMapByIds(userIdList);
+        UserCacheResDto userCacheResDto = longUserCacheResDtoMap.get(sysVersion.getCreateBy());
+        if (Objects.nonNull(userCacheResDto)) {
+            findVersionListResVo.setCreateByName(userCacheResDto.getName());
+        }
+
+        UserCacheResDto userCacheResDto2 = longUserCacheResDtoMap.get(sysVersion.getUpdateBy());
+        if (Objects.nonNull(userCacheResDto2)) {
+            findVersionListResVo.setUpdateByName(userCacheResDto2.getName());
+        }
+        findVersionListResVo.setFilePath(FileUtils.splice(findVersionListResVo.getFilePath()));
+        return findVersionListResVo;
+    }
+
+}

+ 7 - 5
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -182,11 +182,13 @@
 
   <select id="findList" resultType="com.sckw.system.model.vo.res.FindEntListResVo" parameterType="com.sckw.system.model.vo.req.FindListReqVo">
     select a.*,
-           b.id userId,
-           b.account,
-           b.name
+           d.id userId,
+           d.account,
+           d.name
       from kws_enterprise a
-    left join kws_user b on a.phone = b.account and b.del_flag = 0
+    left join kws_dept b on a.id = b.ent_id and b.del_flag = 0
+    left join kws_user_dept c on b.id = c.dept_id
+    left join kws_user d on c.user_id = d.id and d.del_flag = 0 and d.status = 0
     where a.del_flag = 0
     <if test="approval != null">
       and a.approval = #{approval}
@@ -195,7 +197,7 @@
         and a.firm_name like concat('%', #{entName}, '%')
       </if>
     <if test="entType != null">
-      and exists (select 1 from kws_ent_type b where a.id = b.ent_id and b.type = #{entType})
+      and exists (select 1 from kws_ent_type e where a.id = e.ent_id and e.type = #{entType})
     </if>
     order by a.create_time
   </select>

+ 42 - 0
sckw-modules/sckw-system/src/main/resources/mapper/SysVersionDao.xml

@@ -0,0 +1,42 @@
+<?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.sckw.system.dao.SysVersionDao">
+
+
+  <select id="findList" resultType="com.sckw.system.model.SysVersion">
+    select *
+      from sys_version
+     where del_flag = 0
+       and status = 0
+    <if test="systemType != null">
+      and system_type = #{systemType}
+    </if>
+    <if test="clientType != null and clientType != ''">
+      and client_type = #{clientType}
+    </if>
+    <if test="versionName != null and versionName != ''">
+      and version_name like concat('%', #{versionName}, '%')
+    </if>
+    <if test="versionCode != null and versionCode != ''">
+      and version_code like concat('%', #{versionCode}, '%')
+    </if>
+    <if test="startTime != null">
+      and update_time >= #{startTime}
+    </if>
+    <if test="endTime != null">
+      and update_time &lt;= #{endTime}
+    </if>
+  </select>
+
+  <select id="findLatestVersion" resultType="com.sckw.system.model.SysVersion">
+    select *
+      from sys_version
+     where del_flag = 0
+       and status = 0
+       and client_type = #{clientType}
+       and system_type = #{systemType}
+     order by update_time desc
+     limit 1
+  </select>
+
+</mapper>