瀏覽代碼

修改价格界面逻辑

YL2767 3 月之前
父節點
當前提交
9e4235639a

+ 2
- 2
src/main/java/com/th/demo/mapping/maint/PriceMapper.java 查看文件

19
 
19
 
20
     int updateByPrimaryKey(Price record);
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
     int selectCntByMaterialChangeTime(String id, int i, String belongId);
26
     int selectCntByMaterialChangeTime(String id, int i, String belongId);
27
 
27
 

+ 39
- 0
src/main/java/com/th/demo/model/maint/Price.java 查看文件

1
 package com.th.demo.model.maint;
1
 package com.th.demo.model.maint;
2
 
2
 
3
 import com.th.demo.model.system.SysUser;
3
 import com.th.demo.model.system.SysUser;
4
+import com.th.demo.model.maint.Customer;
4
 
5
 
5
 import java.util.Date;
6
 import java.util.Date;
6
 
7
 
33
 
34
 
34
     private String   storageType;
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
     public String getId() {
75
     public String getId() {
37
         return id;
76
         return id;
38
     }
77
     }

+ 12
- 2
src/main/java/com/th/demo/service/impl/maint/PriceServiceImpl.java 查看文件

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

+ 25
- 14
src/main/resource/mapper/maint/PriceMapper.xml 查看文件

16
     <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
16
     <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
17
     <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
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
       <association  column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
23
       <association  column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
20
       <association  column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
24
       <association  column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
21
     <association  column="modify_id" property="modifyUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
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
   </resultMap>
28
   </resultMap>
24
   <sql id="Base_Column_List" >
29
   <sql id="Base_Column_List" >
25
     id, material_id, storage_price,transfer_price, weight_price, add_id, add_time,
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
   </sql>
32
   </sql>
28
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
33
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
29
     select 
34
     select 
45
       transfer_price, weight_price, add_id,
50
       transfer_price, weight_price, add_id,
46
       add_time, modify_id, modify_time, 
51
       add_time, modify_id, modify_time, 
47
       cancel_id, cancel_time, cancel_flag, 
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
     values (#{id,jdbcType=VARCHAR}, #{material.id,jdbcType=VARCHAR}, #{storagePrice,jdbcType=DOUBLE},
55
     values (#{id,jdbcType=VARCHAR}, #{material.id,jdbcType=VARCHAR}, #{storagePrice,jdbcType=DOUBLE},
50
       #{transferPrice,jdbcType=DOUBLE}, #{weightPrice,jdbcType=DOUBLE}, #{addUser.id,jdbcType=VARCHAR},
56
       #{transferPrice,jdbcType=DOUBLE}, #{weightPrice,jdbcType=DOUBLE}, #{addUser.id,jdbcType=VARCHAR},
51
       #{addTime,jdbcType=TIMESTAMP}, #{modifyUser.id,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
57
       #{addTime,jdbcType=TIMESTAMP}, #{modifyUser.id,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
52
       #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, 
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
   </insert>
61
   </insert>
55
   <insert id="insertSelective" parameterType="com.th.demo.model.maint.Price" >
62
   <insert id="insertSelective" parameterType="com.th.demo.model.maint.Price" >
56
     insert into t_maint_price
63
     insert into t_maint_price
193
       cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
200
       cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
194
       cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
201
       cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
195
       belong_id =  #{belongId,jdbcType=VARCHAR},
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
     where id = #{id,jdbcType=VARCHAR}
208
     where id = #{id,jdbcType=VARCHAR}
198
   </update>
209
   </update>
199
 
210
 
200
   <select id="selectByMaterialChangeTime" resultMap="BaseResultMap" >
211
   <select id="selectByMaterialChangeTime" resultMap="BaseResultMap" >
201
     select *   from t_maint_price
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
      and cancel_flag = '0'
217
      and cancel_flag = '0'
206
   </select>
218
   </select>
207
 
219
 
208
 
220
 
209
   <select id="select" resultMap="BaseResultMap" >
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
       and t.cancel_flag = '0'
226
       and t.cancel_flag = '0'
216
   </select>
227
   </select>
217
 
228
 
218
 
229
 
219
   <select id="selectCntByMaterialChangeTime" resultType="java.lang.Integer" >
230
   <select id="selectCntByMaterialChangeTime" resultType="java.lang.Integer" >
220
     select count(*)  from t_maint_price
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
      and belong_id = #{param3,jdbcType=VARCHAR}
234
      and belong_id = #{param3,jdbcType=VARCHAR}
224
      and cancel_flag = '0'
235
      and cancel_flag = '0'
225
   </select>
236
   </select>

Loading…
取消
儲存