Selaa lähdekoodia

训练营更新
接收预发机接口调整

mac 2 vuotta sitten
vanhempi
commit
ff5a548a81

+ 0 - 7
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/dto/kxsapp/userAdvance/ConfirmAdvanceMachineDTO.java

@@ -17,13 +17,6 @@ import java.util.List;
 @Data
 public class ConfirmAdvanceMachineDTO {
 
-    /**
-     * 预发机订单ID
-     */
-    @Schema(description = "预发机订单ID")
-    @NotNull(message = "ID不能为空")
-    private Integer id;
-
     /**
      * 机具号集合
      */

+ 1 - 1
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/model/KxsMachineAdvanceInfo.java

@@ -56,7 +56,7 @@ public class KxsMachineAdvanceInfo extends Model<KxsMachineAdvanceInfo> implemen
      * 删除标记,0未删除,1已删除
      */
     @Schema(description = "删除标记,0未删除,1已删除")
-    private String delFlag;
+    private Integer delFlag;
 
 
     /**

+ 0 - 33
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/userAdvance/AdvanceDevModalInfoVO.java

@@ -1,33 +0,0 @@
-package com.kxs.store.api.vo.kxsapp.userAdvance;
-
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Builder;
-import lombok.Data;
-
-import java.io.Serial;
-import java.io.Serializable;
-
-/**
- * 接收预发机弹窗vo
- *
- * @author 系统
- * @date 2024-01-10 11:43:18
- */
-@Data
-@Schema(description = "接收预发机弹窗返回实体")
-@Builder
-public class AdvanceDevModalInfoVO implements Serializable {
-
-	@Serial
-	private static final long serialVersionUID = 1L;
-
-
-    /**
-     * 机具码
-     */
-    @Schema(description = "机具码")
-    private String posSn;
-	
-
-}

+ 7 - 4
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/vo/kxsapp/userAdvance/AdvanceDevModalVO.java

@@ -2,12 +2,10 @@ package com.kxs.store.api.vo.kxsapp.userAdvance;
 
 
 import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Builder;
 import lombok.Data;
 
 import java.io.Serial;
 import java.io.Serializable;
-import java.util.List;
 
 /**
  * 接收预发机弹窗vo
@@ -44,9 +42,14 @@ public class AdvanceDevModalVO implements Serializable {
     private String brandName;
 
     /**
-     * SN列表
+     * 品牌标识
      */
-    private List<AdvanceDevModalInfoVO> snList;
+    private String brandId;
+
+    /**
+     * SN
+     */
+    private String posSn;
 
 
 

+ 68 - 69
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsMachineAdvanceServiceImpl.java

@@ -144,7 +144,9 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
 
         machineAdvanceInfo.setIsReturn(CommonConstants.SUCCESS);
         machineAdvanceInfo.setReturnTime(LocalDateTime.now());
-        kxsMachineAdvanceInfoMapper.updateById(machineAdvanceInfo);
+        //直接删除记录
+        kxsMachineAdvanceInfoMapper.deleteById(machineAdvanceInfo.getId());
+        baseMapper.deleteById(machineAdvanceInfo.getOrderId());
 
         //修改状态为在库
         KxsMachine machine = new KxsMachine();
@@ -299,77 +301,73 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
                 .getData()
                 .orElseThrow(() -> new GlobalCustomerException(ErrorTypeEnum.USER_NOT_FOUND.getDescription()));
 
-        KxsMachineAdvance machineAdvance = baseMapper.selectById(param.getId());
-        if (machineAdvance == null) {
-            return R.failed(StoreErrorTypeEnum.DATA_ERROR.getDescription());
-        }
-        //查询仓库
-        KxsWarehouse warehouse = kxsWarehouseMapper.selectById(machineAdvance.getWarehouseId());
-
-        //查询品牌
-        R<KxsBrand> kxsBrandR = remoteKxsProductService.loadByBrand(warehouse.getBrandId(), SecurityConstants.FROM_IN);
-        KxsBrand brand = RetOps.of(kxsBrandR)
-                .getData()
-                .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
-
-        //查询用户预发额度
-        KxsWarehouseLimit userLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
-                .eq(KxsWarehouseLimit::getWarehouseType, WarehouseLimitTypeEnum.XFC.getType())
-                .eq(KxsWarehouseLimit::getUserId, userId));
-
-        List<KxsMachineAdvanceInfo> machineAdvanceInfos = kxsMachineAdvanceInfoMapper.selectList(Wrappers.<KxsMachineAdvanceInfo>lambdaQuery()
-                .in(KxsMachineAdvanceInfo::getPosSn, param.getSnList()));
-        for (KxsMachineAdvanceInfo machineAdvanceInfo : machineAdvanceInfos) {
-            if(machineAdvanceInfo.getIsConfirm() != 0){
-                return R.failed(machineAdvanceInfo.getPosSn() + "该机器已确认");
+        for (String sn : param.getSnList()) {
+            KxsMachineAdvanceInfo machineAdvanceInfo = kxsMachineAdvanceInfoMapper.selectOne(Wrappers.<KxsMachineAdvanceInfo>lambdaQuery()
+                            .eq(KxsMachineAdvanceInfo::getIsConfirm, CommonConstants.FAIL)
+                            .eq(KxsMachineAdvanceInfo::getIsReturn, CommonConstants.FAIL)
+                    .eq(KxsMachineAdvanceInfo::getPosSn, sn));
+            if(machineAdvanceInfo == null){
+                throw new GlobalCustomerException(sn + "已确认/已撤回");
             }
-        }
+            KxsMachineAdvance machineAdvance = baseMapper.selectById(machineAdvanceInfo.getOrderId());
 
-        //同意
-        if (Objects.equals(param.getConfirmType(), CommonConstants.SUCCESS)) {
-            //扣减用户预发额度
-            int amount;
-            if (Objects.equals(brand.getBrandType(), BrandTypeEnum.DIANQIAN.getType())) {
-                //电签
-                amount = machineAdvanceInfos.size() * BrandTypeEnum.DQ_PRICE.getType();
-            } else {
-                amount = machineAdvanceInfos.size() * BrandTypeEnum.DJ_PRICE.getType();
-            }
-            //额度充足
-            if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
+            //查询仓库
+            KxsWarehouse warehouse = kxsWarehouseMapper.selectById(machineAdvance.getWarehouseId());
+            //查询品牌
+            R<KxsBrand> kxsBrandR = remoteKxsProductService.loadByBrand(machineAdvance.getBrandId(), SecurityConstants.FROM_IN);
+            KxsBrand brand = RetOps.of(kxsBrandR)
+                    .getData()
+                    .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
 
-                //小分仓增加已用额度 刷新可用额度
-                userLimit.setUsedAmount(NumberUtil.add(userLimit.getUsedAmount(), amount));
-                userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(), amount));
-                kxsWarehouseLimitMapper.updateById(userLimit);
+            //查询用户预发额度
+            KxsWarehouseLimit userLimit = kxsWarehouseLimitMapper.selectOne(Wrappers.<KxsWarehouseLimit>lambdaQuery()
+                    .eq(KxsWarehouseLimit::getWarehouseType, WarehouseLimitTypeEnum.XFC.getType())
+                    .eq(KxsWarehouseLimit::getUserId, userId));
+
+            //同意
+            if (Objects.equals(param.getConfirmType(), CommonConstants.SUCCESS)) {
+                //扣减用户预发额度
+                int amount;
+                if (Objects.equals(brand.getBrandType(), BrandTypeEnum.DIANQIAN.getType())) {
+                    //电签
+                    amount = BrandTypeEnum.DQ_PRICE.getType();
+                } else {
+                    amount = BrandTypeEnum.DJ_PRICE.getType();
+                }
+                //额度充足
+                if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
 
-                //减少仓库已用额度增加仓库可用额度
-                kxsWarehouseLimitService.refreshWarehouseAmount(warehouse.getUserId(), amount, KindTypeEnum.SUB.getType());
-            }
-            for (KxsMachineAdvanceInfo info : machineAdvanceInfos) {
+                    //小分仓增加已用额度 刷新可用额度
+                    userLimit.setUsedAmount(NumberUtil.add(userLimit.getUsedAmount(), amount));
+                    userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(), amount));
+                    kxsWarehouseLimitMapper.updateById(userLimit);
+
+                    //减少仓库已用额度增加仓库可用额度
+                    kxsWarehouseLimitService.refreshWarehouseAmount(warehouse.getUserId(), amount, KindTypeEnum.SUB.getType());
+                }
                 //修改为占用预发额度标签
                 if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
-                    info.setIsUseAmount(CommonConstants.SUCCESS);
+                    machineAdvanceInfo.setIsUseAmount(CommonConstants.SUCCESS);
                 }
-                info.setIsConfirm(CommonConstants.SUCCESS);
-                kxsMachineAdvanceInfoMapper.updateById(info);
-            }
-            //给预发对象发送通知
-            KxsUserMsg toUserMsg = MsgTemplateUtil.confirmAdvanceMachineUserNote(userId.intValue(), warehouse.getWarehouseName(), machineAdvance.getBrandName(), param.getSnList());
-            //给仓库发送通知
-            KxsUserMsg toWarehouseMsg = MsgTemplateUtil.confirmAdvanceMachineWarehoiuseNote(warehouse.getUserId(), toUser.getUserCode(), toUser.getUsername(), warehouse.getWarehouseName(), brand.getName(), param.getSnList());
-            remoteUserMsgService.pushUserMsg(toUserMsg, SecurityConstants.FROM_IN);
-            remoteUserMsgService.pushUserMsg(toWarehouseMsg, SecurityConstants.FROM_IN);
-
-        } else {
-            //拒绝
-            for (KxsMachineAdvanceInfo info : machineAdvanceInfos) {
-                info.setIsConfirm(2);
-                kxsMachineAdvanceInfoMapper.updateById(info);
+                machineAdvanceInfo.setIsConfirm(CommonConstants.SUCCESS);
+                kxsMachineAdvanceInfoMapper.updateById(machineAdvanceInfo);
+                //给预发对象发送通知
+                KxsUserMsg toUserMsg = MsgTemplateUtil.confirmAdvanceMachineUserNote(userId.intValue(), warehouse.getWarehouseName(), machineAdvance.getBrandName(), param.getSnList());
+                //给仓库发送通知
+                KxsUserMsg toWarehouseMsg = MsgTemplateUtil.confirmAdvanceMachineWarehoiuseNote(warehouse.getUserId(), toUser.getUserCode(), toUser.getUsername(), warehouse.getWarehouseName(), brand.getName(), param.getSnList());
+                remoteUserMsgService.pushUserMsg(toUserMsg, SecurityConstants.FROM_IN);
+                remoteUserMsgService.pushUserMsg(toWarehouseMsg, SecurityConstants.FROM_IN);
+
+            } else {
+
+                //拒绝,直接删除记录
+//                machineAdvanceInfo.setIsConfirm(2);
+                kxsMachineAdvanceInfoMapper.deleteById(machineAdvanceInfo.getId());
+                baseMapper.deleteById(machineAdvanceInfo.getOrderId());
 
                 //修改状态为在库
                 KxsMachine machine = new KxsMachine();
-                machine.setId(info.getMachineId());
+                machine.setId(machineAdvanceInfo.getMachineId());
                 machine.setStatus(MachineTypeEnum.STATUS_IS.getType());
                 machine.setPreUserId(0);
                 R<Boolean> result = remoteKxsProductService.updateByMachine(machine, SecurityConstants.FROM_IN);
@@ -377,16 +375,17 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
                     throw new GlobalCustomerException(ErrorTypeEnum.REMOTE_DATA_ERROR.getDescription());
                 }
 
-            }
-            //给仓库发送模版消息
-            KxsUserMsg toWarehouseMsg = MsgTemplateUtil.advanceMachineCancelWarehouseNote(warehouse.getUserId(), toUser.getUserCode(), toUser.getUsername(), warehouse.getWarehouseName(), brand.getName(), param.getSnList());
-            //给用户发送消息
-            KxsUserMsg toUserMsg = MsgTemplateUtil.cancelAdvanceMachineUserNote(userId.intValue(), warehouse.getWarehouseName(), machineAdvance.getBrandName(), param.getSnList());
+                //给仓库发送模版消息
+                KxsUserMsg toWarehouseMsg = MsgTemplateUtil.advanceMachineCancelWarehouseNote(warehouse.getUserId(), toUser.getUserCode(), toUser.getUsername(), warehouse.getWarehouseName(), brand.getName(), param.getSnList());
+                //给用户发送消息
+                KxsUserMsg toUserMsg = MsgTemplateUtil.cancelAdvanceMachineUserNote(userId.intValue(), warehouse.getWarehouseName(), machineAdvance.getBrandName(), param.getSnList());
 
-            remoteUserMsgService.pushUserMsg(toUserMsg, SecurityConstants.FROM_IN);
-            remoteUserMsgService.pushUserMsg(toWarehouseMsg, SecurityConstants.FROM_IN);
+                remoteUserMsgService.pushUserMsg(toUserMsg, SecurityConstants.FROM_IN);
+                remoteUserMsgService.pushUserMsg(toWarehouseMsg, SecurityConstants.FROM_IN);
+            }
         }
 
+
         return R.ok();
     }
 

+ 2 - 10
kxs-store/kxs-store-biz/src/main/resources/mapper/KxsMachineAdvanceMapper.xml

@@ -75,19 +75,11 @@
         and b.is_return = 0
     </select>
 
-    <resultMap type="com.kxs.store.api.vo.kxsapp.userAdvance.AdvanceDevModalVO" id="AdvanceDevModalMap">
-        <result column="id" property="id"/>
-        <result column="warehouse_id" property="warehouseId"/>
-        <result column="warehouse_name" property="warehouseName"/>
-        <result column="brand_name" property="brandName"/>
-        <collection property="snList" ofType="com.kxs.store.api.vo.kxsapp.userAdvance.AdvanceDevModalInfoVO">
-            <result column="pos_sn" property="posSn"/>
-        </collection>
-    </resultMap>
-    <select id="selectToUserNeedConfirmList" resultMap="AdvanceDevModalMap">
+    <select id="selectToUserNeedConfirmList" resultType="com.kxs.store.api.vo.kxsapp.userAdvance.AdvanceDevModalVO">
 
         select a.id,
                a.brand_name,
+               a.brand_id,
                a.warehouse_id,
                a.warehouse_name,
                b.pos_sn

+ 2 - 2
kxs-system/kxs-system-api/src/main/java/com/kxs/system/api/vo/admin/camp/CampBonusLogVO.java

@@ -75,14 +75,14 @@ public class CampBonusLogVO implements Serializable {
      * 来源创客姓名
      */
     @Schema(description = "来源创客姓名")
-    @ExcelProperty(value = "来源创客姓名", index = 6)
+    @ExcelProperty(value = "来源创客姓名", index = 7)
     private String sourceName;
 
     /**
      * 来源创客编号
      */
     @Schema(description = "来源创客编号")
-    @ExcelProperty(value = "来源创客编号", index = 7)
+    @ExcelProperty(value = "来源创客编号", index = 8)
     private String sourceCode;
 
     /**