Parcourir la source

feat:“添加P20和P10商品"

soobin il y a 10 mois
Parent
commit
7b04db6a0a

+ 21 - 5
src/main/java/com/szwl/controller/IndexController.java

@@ -314,7 +314,7 @@ public class IndexController {
         LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
         query.like(TEquipment::getClientId, clientId);
         List<TEquipment> list = equipmentService.list(query);
-        if (list.size() > 0) {
+        if (!list.isEmpty()) {
             TEquipment equipment = list.get(0);
             if (equipment.getAdminId() != 31) {
                 if (!equipment.getClientId().substring(equipment.getClientId().length() - 3, equipment.getClientId().length()).equals("xxx")) {
@@ -599,10 +599,22 @@ public class IndexController {
                                     saveProduct(equipmentId);
                                 }
                             } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")) {
-                                saveGoodsData(equipmentId, machineType, 6);
+                                switch (equimentType) {
+                                    case "P30":
+                                        saveGoodsData(equipmentId, machineType, 6, equimentType);
+                                        break;
+                                    case "P20":
+                                        saveGoodsData(equipmentId, machineType, 12, equimentType);
+                                        break;
+                                    case "P10 ":
+                                        saveGoodsData(equipmentId, machineType, 2, equimentType);
+                                        break;
+                                    default:
+                                        break;
+                                }
                             } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")) {
                                 if (equimentType.equals("SI320")) {
-                                    saveGoodsData(equipmentId, machineType, 6);
+                                    saveGoodsData(equipmentId, machineType, 6, equimentType);
                                 }
                             }
                         }
@@ -685,10 +697,13 @@ public class IndexController {
      * @param machineType
      * @param number
      */
-    private void saveGoodsData(Long id, String machineType, Integer number) {
+    private void saveGoodsData(Long id, String machineType, Integer number, String equipmentType) {
         LambdaQueryWrapper<TGoodsData> wrapper = Wrappers.lambdaQuery();
         wrapper.eq(TGoodsData::getNumber, number);
         wrapper.eq(TGoodsData::getMachineType, machineType);
+        if (!machineType.equals("0")) {
+            wrapper.eq(TGoodsData::getEquipmentType, equipmentType);
+        }
         TGoodsData goodsData = goodsDataService.getOne(wrapper);
         String goods = goodsData.getGoods();
         String[] str = goods.split(",");
@@ -974,8 +989,9 @@ public class IndexController {
             if (StringUtils.isEmpty(equipment.getMachineType())) {
                 machineType = "0";
             }
+            String equipmentType = equipment.getEquimentType();
             //创建花型
-            saveGoodsData(id, machineType, Integer.parseInt(number));
+            saveGoodsData(id, machineType, Integer.parseInt(number), equipmentType);
             return "success";
         } else {
             return "error";

+ 18 - 21
src/main/java/com/szwl/controller/TEquipmentApplyController.java

@@ -1,14 +1,11 @@
 package com.szwl.controller;
 
 
-import cn.com.crbank.ommo.bean.ResultMessage;
-import cn.com.crbank.ommo.esUtil.BeanUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.szwl.constant.ResponseCodesEnum;
-import com.szwl.model.bean.TEquipmentDTO;
 import com.szwl.model.bo.R;
 import com.szwl.model.bo.ResponseModel;
 import com.szwl.model.entity.*;
@@ -23,12 +20,8 @@ import org.springframework.amqp.core.AmqpAdmin;
 import org.springframework.amqp.core.Binding;
 import org.springframework.amqp.core.Queue;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
@@ -298,23 +291,24 @@ public class TEquipmentApplyController {
                                 saveProduct(equipmentId);
                             }
                         } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")){
-                            saveGoodsData(equipmentId, machineType, 6);
+                            switch (equipmentType) {
+                                case "P30":
+                                    saveGoodsData(equipmentId, machineType, 6, equipmentType);
+                                    break;
+                                case "P20":
+                                    saveGoodsData(equipmentId, machineType, 12, equipmentType);
+                                    break;
+                                case "P10 ":
+                                    saveGoodsData(equipmentId, machineType, 2, equipmentType);
+                                    break;
+                                default:
+                                    break;
+                            }
                         } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")){
                             if (equipmentType.equals("SI320")) {
-                                saveGoodsData(equipmentId, machineType, 6);
+                                saveGoodsData(equipmentId, machineType, 6, equipmentType);
                             }
                         }
-//                        if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG280")){
-//                            saveProductMG280(equipmentId);
-//                        } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG320-1")){
-//                            saveProductMG1(equipmentId);
-//                        } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("P30")){
-//                            saveProductP30(equipmentId);
-//                        } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("SI320")){
-//                            saveProductSI320(equipmentId);
-//                        } else {
-//                            saveProduct(equipmentId);
-//                        }
                         LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
                         query1.eq(TEquipment::getClientId,clientId);
                         TEquipment tEquipment = equipmentService.getOne(query1);
@@ -366,10 +360,13 @@ public class TEquipmentApplyController {
      * @param machineType
      * @param number
      */
-    private void saveGoodsData(Long id, String machineType, Integer number) {
+    private void saveGoodsData(Long id, String machineType, Integer number, String equipmentType) {
         LambdaQueryWrapper<TGoodsData> wrapper = Wrappers.lambdaQuery();
         wrapper.eq(TGoodsData::getNumber, number);
         wrapper.eq(TGoodsData::getMachineType, machineType);
+        if (!machineType.equals("0")) {
+            wrapper.eq(TGoodsData::getEquipmentType, equipmentType);
+        }
         TGoodsData goodsData = goodsDataService.getOne(wrapper);
         String goods = goodsData.getGoods();
         String[] str = goods.split(",");

+ 2 - 1
src/main/java/com/szwl/mapper/xml/TGoodsDataMapper.xml

@@ -8,6 +8,7 @@
         <result column="create_date" property="createDate" />
         <result column="modify_date" property="modifyDate" />
         <result column="number" property="number" />
+        <result column="equipment_type" property="equipmentType" />
         <result column="machine_type" property="machineType" />
         <result column="goods" property="goods" />
         <result column="remark" property="remark" />
@@ -15,7 +16,7 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, create_date, modify_date, number, machine_type, goods, remark
+        id, create_date, modify_date, number, equipment_type, machine_type, goods, remark
     </sql>
 
 </mapper>

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

@@ -15,7 +15,7 @@ import lombok.EqualsAndHashCode;
  * </p>
  *
  * @author wuhs
- * @since 2024-01-19
+ * @since 2024-10-18
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -36,6 +36,9 @@ public class TGoodsData implements Serializable {
     @ApiModelProperty(value = "商品数")
     private Integer number;
 
+    @ApiModelProperty(value = "棉花糖机器类型,mg320,mg301")
+    private String equipmentType;
+
     @ApiModelProperty(value = "设备类型,0:棉花糖,1:爆米花,2:冰淇淋")
     private String machineType;