Преглед на файлове

feat:“添加冰淇淋SI320机型”

soobin преди 1 година
родител
ревизия
df5954934d

+ 49 - 9
src/main/java/com/szwl/controller/IndexController.java

@@ -383,9 +383,14 @@ public class IndexController {
         equipmentApply.setAdminId(adminId);
         equipmentApply.setAdminUserName(username);
         equipmentApply.setEquimentType(equimentType);
+        // 如果是爆米花
         if (equimentType.equals("P30")) {
             machineType = "1";
         }
+        // 如果是冰淇淋
+        if (equimentType.equals("SI320")) {
+            machineType = "2";
+        }
         equipmentApply.setMachineType(machineType);
         equipmentApply.setCreateDate(new Date());
         equipmentApply.setModifyDate(new Date());
@@ -471,13 +476,18 @@ public class IndexController {
                                     }
                                 }
                                 equipment.setEquimentType("MG320");
-                            }
-                            if (equipmentApply.getEquimentType().equals("MG330")) {
-                                equipment.setEquimentType("MG330");
-                            }
-                            if (equipmentApply.getEquimentType().equals("P30")) {
+                            } else {
                                 equipment.setEquimentType(equipmentApply.getEquimentType());
                             }
+//                            if (equipmentApply.getEquimentType().equals("MG330")) {
+//                                equipment.setEquimentType("MG330");
+//                            }
+//                            if (equipmentApply.getEquimentType().equals("P30")) {
+//                                equipment.setEquimentType(equipmentApply.getEquimentType());
+//                            }
+//                            if (equipmentApply.getEquimentType().equals("SI320")) {
+//                                equipment.setEquimentType(equipmentApply.getEquimentType());
+//                            }
                             equipmentService.updateById(equipment);
                             LambdaQueryWrapper<TProportion> queryProportion = Wrappers.lambdaQuery();
                             queryProportion.eq(TProportion::getEquipmentId, equipment.getId());
@@ -495,9 +505,12 @@ public class IndexController {
                             if (StringUtils.isEmpty(machineType) || machineType.equals("0")) {
                                 equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
                                 PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
-                            } else {
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")){
                                 equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
                                 PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")){
+                                equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
+                                PushUtils.push(equipmentApply.getGtClientId(), "【冰淇淋】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
                             }
                             if (equipment.getEquimentType().equals("280")) {
                                 equipmentService.sentMessage(clientId, PushUtils.buildJson("endDate", String.valueOf(equipment.getEndDate().getTime())).toString());
@@ -511,7 +524,6 @@ public class IndexController {
                                 equipmentDesc.setEquipmentId(equipment.getId());
                                 equipmentDescService.save(equipmentDesc);
                             }
-
                         } else {
 
                             TEquipment equipment = new TEquipment();
@@ -555,9 +567,12 @@ public class IndexController {
                             if (StringUtils.isEmpty(machineType) || machineType.equals("0")) {
                                 equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
                                 PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
-                            } else {
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")){
                                 equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
                                 PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")){
+                                equipmentService.sentMessage(clientId, PushUtils.buildJson("statusType", "agreed" + old).toString());
+                                PushUtils.push(equipmentApply.getGtClientId(), "【冰淇淋】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
                             }
                             LambdaQueryWrapper<TEquipment> query3 = Wrappers.lambdaQuery();
                             query3.eq(TEquipment::getClientId, clientId);
@@ -595,10 +610,14 @@ public class IndexController {
                             } else {
                                 saveProduct(equipmentId);
                             }
-                        } else {
+                        } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")){
                             if (equimentType.equals("P30")) {
                                 saveProductP30(equipmentId);
                             }
+                        } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")){
+                            if (equimentType.equals("SI320")) {
+                                saveProductSI320(equipmentId);
+                            }
                         }
 
                         if (String.valueOf(adminId).equals("3") || String.valueOf(adminId).equals("31") || String.valueOf(adminId).equals("506") || String.valueOf(adminId).equals("1090")) {
@@ -831,7 +850,28 @@ public class IndexController {
             product.setCodePrice(BigDecimal.ZERO);
             productService.save(product);
         }
+    }
 
+    /**
+     * 添加冰淇淋产品
+     *
+     * @param id
+     */
+    private void saveProductSI320(Long id) {
+        String[] str = {"冰淇淋-I01", "草莓酱-J01", "蓝莓酱-J02", "菠萝酱-J03", "榛子碎-C01", "花生碎-C02", "腰果碎-C03"};
+
+        for (int i = 0; i < str.length; i++) {
+            TProduct product = new TProduct();
+            product.setCreateDate(new Date());
+            product.setModifyDate(new Date());
+            product.setEquipmentId(id);
+            String[] split = str[i].split("-");
+            product.setProductName(split[0]);
+            product.setNo(split[1]);
+            product.setRmbPrice(BigDecimal.ZERO);
+            product.setCodePrice(BigDecimal.ZERO);
+            productService.save(product);
+        }
     }
 
     /**

+ 36 - 6
src/main/java/com/szwl/controller/TEquipmentApplyController.java

@@ -202,8 +202,10 @@ public class TEquipmentApplyController {
                             equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
                             if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
                                 PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
-                            } else {
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")) {
                                 PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                            } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")) {
+                                PushUtils.push(equipmentApply.getGtClientId(), "【冰淇淋】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
                             }
                             equipmentApplyService.updateById(equipmentApply);
                             if(equipment.getEndDate()!=null){
@@ -266,17 +268,21 @@ public class TEquipmentApplyController {
                         equipmentService.sentMessage(clientId,PushUtils.buildJson("statusType", "agreed" + old).toString());
                         if(StringUtils.isEmpty(machineType) || machineType.equals("0")) {
                             PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
-                        } else {
+                        } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")) {
                             PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
+                        } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")) {
+                            PushUtils.push(equipmentApply.getGtClientId(), "【冰淇淋】设备初始化申请", "同意", PushUtils.buildJson("statusType", "agreed" + old).toString());
                         }
                         //获取设备的id
                         Long equipmentId = equipment.getId();
-                        if(equimentType !=null && equimentType.equals("MG280")){
+                        if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("MG280")){
                             saveProductMG280(equipmentId);
-                        } else if(equimentType !=null&& equimentType.equals("MG320-1")){
+                        } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("MG320-1")){
                             saveProductMG1(equipmentId);
-                        } else if(equimentType !=null&& equimentType.equals("P30")){
+                        } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("P30")){
                             saveProductP30(equipmentId);
+                        } else if(StringUtils.isNotEmpty(equimentType) && equimentType.equals("SI320")){
+                            saveProductSI320(equipmentId);
                         } else {
                             saveProduct(equipmentId);
                         }
@@ -300,8 +306,10 @@ public class TEquipmentApplyController {
                         equipmentService.sentMessage(equipmentApply.getClientId(),PushUtils.buildJson("statusType", "rejected").toString());
                         if(StringUtils.isEmpty(equipmentApply.getMachineType()) || equipmentApply.getMachineType().equals("0")) {
                             PushUtils.push(equipmentApply.getGtClientId(), "【棉花糖】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
-                        } else {
+                        } else if (StringUtils.isNotEmpty(equipmentApply.getMachineType()) && equipmentApply.getMachineType().equals("1")) {
                             PushUtils.push(equipmentApply.getGtClientId(), "【爆米花】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
+                        } else if (StringUtils.isNotEmpty(equipmentApply.getMachineType()) && equipmentApply.getMachineType().equals("2")) {
+                            PushUtils.push(equipmentApply.getGtClientId(), "【冰淇淋】设备初始化申请", "拒绝", PushUtils.buildJson("statusType", "rejected").toString());
                         }
                     }
                     equipmentApplyService.updateById(equipmentApply);
@@ -449,6 +457,28 @@ public class TEquipmentApplyController {
     }
 
     /**
+     * 添加冰淇淋产品
+     *
+     * @param id
+     */
+    private void saveProductSI320(Long id) {
+        String[] str = {"冰淇淋-I01", "草莓酱-J01", "蓝莓酱-J02", "菠萝酱-J03", "榛子碎-C01", "花生碎-C02", "腰果碎-C03"};
+
+        for (int i = 0; i < str.length; i++) {
+            TProduct product = new TProduct();
+            product.setCreateDate(new Date());
+            product.setModifyDate(new Date());
+            product.setEquipmentId(id);
+            String[] split = str[i].split("-");
+            product.setProductName(split[0]);
+            product.setNo(split[1]);
+            product.setRmbPrice(BigDecimal.ZERO);
+            product.setCodePrice(BigDecimal.ZERO);
+            productService.save(product);
+        }
+    }
+
+    /**
      * 获取指定日期所在月份开始的时间戳
      * @param date 指定日期
      * @return

+ 1 - 1
src/main/java/com/szwl/model/entity/TEquipment.java

@@ -183,7 +183,7 @@ public class TEquipment implements Serializable {
     @ApiModelProperty(value = "花型数量")
     private String flowers;
 
-    @ApiModelProperty(value = "设备类型,0:棉花糖,1,爆米花")
+    @ApiModelProperty(value = "设备类型,0:棉花糖,1,爆米花,2:冰淇淋")
     private String machineType;
 
     @ApiModelProperty(value = "apk版本")