Browse Source

修改价格界面逻辑

YL2767 3 months ago
parent
commit
9e4235639a

+ 2
- 2
src/main/java/com/th/demo/mapping/maint/PriceMapper.java View File

@@ -19,9 +19,9 @@ public interface PriceMapper {
19 19
 
20 20
     int updateByPrimaryKey(Price record);
21 21
 
22
-    Price selectByMaterialChangeTime(String materialId, int changeTime,String belongId);
22
+    Price selectByMaterialChangeTime(String id, int changeTime,String belongId);
23 23
 
24
-    List<Price> select(String materialName, String standard, String belongId);
24
+    List<Price> select(String customerName,  String belongId);
25 25
 
26 26
     int selectCntByMaterialChangeTime(String id, int i, String belongId);
27 27
 

+ 39
- 0
src/main/java/com/th/demo/model/maint/Price.java View File

@@ -1,6 +1,7 @@
1 1
 package com.th.demo.model.maint;
2 2
 
3 3
 import com.th.demo.model.system.SysUser;
4
+import com.th.demo.model.maint.Customer;
4 5
 
5 6
 import java.util.Date;
6 7
 
@@ -33,6 +34,44 @@ public class Price {
33 34
 
34 35
     private String   storageType;
35 36
 
37
+    // 20250324新增字段
38
+    private Customer customer;
39
+    private int keepDay;
40
+    private double ordPrice;
41
+    private double outOrdPrice;
42
+
43
+    public Customer getCustomer() {
44
+        return customer;
45
+    }
46
+
47
+    public void setCustomer(Customer customer) {
48
+        this.customer = customer;
49
+    }
50
+
51
+    public int getKeepDay() {
52
+        return keepDay;
53
+    }
54
+
55
+    public void setKeepDay(int keepDay) {
56
+        this.keepDay = keepDay;
57
+    }
58
+
59
+    public double getOrdPrice() {
60
+        return ordPrice;
61
+    }
62
+
63
+    public void setOrdPrice(double ordPrice) {
64
+        this.ordPrice = ordPrice;
65
+    }
66
+
67
+    public double getOutOrdPrice() {
68
+        return outOrdPrice;
69
+    }
70
+
71
+    public void setOutOrdPrice(double outOrdPrice) {
72
+        this.outOrdPrice = outOrdPrice;
73
+    }
74
+
36 75
     public String getId() {
37 76
         return id;
38 77
     }

+ 12
- 2
src/main/java/com/th/demo/service/impl/maint/PriceServiceImpl.java View File

@@ -6,8 +6,10 @@ import com.github.pagehelper.PageHelper;
6 6
 import com.github.pagehelper.PageInfo;
7 7
 import com.th.demo.mapping.maint.PriceMapper;
8 8
 import com.th.demo.mapping.maint.ProdPriceMapper;
9
+import com.th.demo.mapping.maint.CustomerMapper;
9 10
 import com.th.demo.model.maint.Price;
10 11
 import com.th.demo.model.maint.ProdPrice;
12
+import com.th.demo.model.maint.Customer;
11 13
 import com.th.demo.model.system.SysUser;
12 14
 import com.th.demo.model.system.Type;
13 15
 import com.th.demo.service.maint.PriceService;
@@ -26,6 +28,8 @@ public class PriceServiceImpl implements PriceService {
26 28
     public PriceMapper priceMapper;
27 29
     @Autowired
28 30
     ProdPriceMapper prodPriceMapper;
31
+    @Autowired
32
+    public CustomerMapper customerMapper;
29 33
 
30 34
     String result = Type.FAIL;
31 35
     int num = 0;
@@ -33,7 +37,7 @@ public class PriceServiceImpl implements PriceService {
33 37
     @Override
34 38
     public String query(int page, int rows, String materialName,String standard, String userId, String belongId) {
35 39
         PageHelper.startPage(page, rows);
36
-        List<Price> list = priceMapper.select(  materialName,standard, belongId);
40
+        List<Price> list = priceMapper.select(materialName,belongId);
37 41
         PageInfo<Price> pageInfo = new PageInfo<>(list);
38 42
         result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
39 43
         return result;
@@ -43,7 +47,13 @@ public class PriceServiceImpl implements PriceService {
43 47
     public String save(String json, String userId, String belongId) {
44 48
         Price price = JSON.parseObject(json,new TypeReference<Price>(){});
45 49
         if(price.getId()==null||price.getId().equals("")){
46
-            int priceCnt = priceMapper.selectCntByMaterialChangeTime(price.getMaterial().getId(),Integer.parseInt(price.getStorageType()) , belongId);
50
+            Customer customers = customerMapper.selectByName(price.getCustomer().getName(),belongId);
51
+            if (customers.getId()==null||customers.getId().equals("")){
52
+                result = JSONTools.toStringyyyyMMddHHmmss(0);
53
+                result = "该客户名称不存才";
54
+                return result;
55
+            }
56
+            int priceCnt = priceMapper.selectCntByMaterialChangeTime(customers.getId(),0 , belongId);
47 57
             if(priceCnt > 0){
48 58
                 result = JSONTools.toStringyyyyMMddHHmmss(0);
49 59
                 result = "已存在该价格信息";

+ 25
- 14
src/main/resource/mapper/maint/PriceMapper.xml View File

@@ -16,14 +16,19 @@
16 16
     <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
17 17
     <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
18 18
 
19
+    <result column="keep_day" property="keepDay" jdbcType="INTEGER" />
20
+    <result column="ord_price" property="ordPrice" jdbcType="DOUBLE" />
21
+    <result column="out_ord_price" property="outOrdPrice" jdbcType="DOUBLE" />
22
+
19 23
       <association  column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
20 24
       <association  column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
21 25
     <association  column="modify_id" property="modifyUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
26
+    <association  column="customer_id" property="customer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
22 27
 
23 28
   </resultMap>
24 29
   <sql id="Base_Column_List" >
25 30
     id, material_id, storage_price,transfer_price, weight_price, add_id, add_time,
26
-    modify_id, modify_time, cancel_id, cancel_time, cancel_flag, belong_id,storage_type
31
+    modify_id, modify_time, cancel_id, cancel_time, cancel_flag, belong_id,storage_type,customer_id,keep_day,ord_price,out_ord_price
27 32
   </sql>
28 33
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
29 34
     select 
@@ -45,12 +50,14 @@
45 50
       transfer_price, weight_price, add_id,
46 51
       add_time, modify_id, modify_time, 
47 52
       cancel_id, cancel_time, cancel_flag, 
48
-      belong_id,storage_type)
53
+      belong_id,storage_type,customer_id,
54
+      keep_day,ord_price,out_ord_price)
49 55
     values (#{id,jdbcType=VARCHAR}, #{material.id,jdbcType=VARCHAR}, #{storagePrice,jdbcType=DOUBLE},
50 56
       #{transferPrice,jdbcType=DOUBLE}, #{weightPrice,jdbcType=DOUBLE}, #{addUser.id,jdbcType=VARCHAR},
51 57
       #{addTime,jdbcType=TIMESTAMP}, #{modifyUser.id,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
52 58
       #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, 
53
-      #{belongId,jdbcType=VARCHAR},#{storageType,jdbcType=VARCHAR})
59
+      #{belongId,jdbcType=VARCHAR},#{storageType,jdbcType=VARCHAR},#{customer.id,jdbcType=VARCHAR},
60
+      #{keepDay,jdbcType=INTEGER},#{ordPrice,jdbcType=DOUBLE},#{outOrdPrice,jdbcType=DOUBLE}  )
54 61
   </insert>
55 62
   <insert id="insertSelective" parameterType="com.th.demo.model.maint.Price" >
56 63
     insert into t_maint_price
@@ -193,33 +200,37 @@ transfer_price,
193 200
       cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
194 201
       cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
195 202
       belong_id =  #{belongId,jdbcType=VARCHAR},
196
-     storage_type = #{storageType,jdbcType=VARCHAR}
203
+      storage_type = #{storageType,jdbcType=VARCHAR},
204
+      customer_id = #{customer.id,jdbcType=VARCHAR},
205
+        keep_day = #{keepDay,jdbcType=INTEGER},
206
+        ord_price = #{ordPrice,jdbcType=VARCHAR},
207
+        out_ord_price = #{outOrdPrice,jdbcType=VARCHAR}
197 208
     where id = #{id,jdbcType=VARCHAR}
198 209
   </update>
199 210
 
200 211
   <select id="selectByMaterialChangeTime" resultMap="BaseResultMap" >
201 212
     select *   from t_maint_price
202
-    where material_id = #{param1,jdbcType=VARCHAR}
203
-      and storage_type = #{param2,jdbcType=VARCHAR}
204
-     and belong_id = #{param3,jdbcType=VARCHAR}
213
+    where 1=1 --material_id = #{param1,jdbcType=VARCHAR}
214
+      --and storage_type = #{param2,jdbcType=VARCHAR}
215
+      and customer_id = #{param1,jdbcType=VARCHAR}
216
+     and belong_id = #{param2,jdbcType=VARCHAR}
205 217
      and cancel_flag = '0'
206 218
   </select>
207 219
 
208 220
 
209 221
   <select id="select" resultMap="BaseResultMap" >
210
-    select  t.*   from t_maint_price t ,t_maint_material d
211
-    where t.material_id = d.id
212
-    and d.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
213
-      and d.standard like concat('%',#{param2,jdbcType=VARCHAR},'%')
214
-     and t.belong_id=#{param3,jdbcType=VARCHAR}
222
+    select  t.*   from t_maint_price t ,t_maint_customer d
223
+    where t.customer_id = d.id
224
+      and d.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
225
+      and t.belong_id = #{param2,jdbcType=VARCHAR}
215 226
       and t.cancel_flag = '0'
216 227
   </select>
217 228
 
218 229
 
219 230
   <select id="selectCntByMaterialChangeTime" resultType="java.lang.Integer" >
220 231
     select count(*)  from t_maint_price
221
-    where material_id = #{param1,jdbcType=VARCHAR}
222
-      and storage_type = #{param2,jdbcType=VARCHAR}
232
+    where 1=1
233
+     and customer_id = #{param1,jdbcType=VARCHAR}
223 234
      and belong_id = #{param3,jdbcType=VARCHAR}
224 235
      and cancel_flag = '0'
225 236
   </select>

Loading…
Cancel
Save