Authored by caoyan

Merge branch 'dev_suggestPrice_20181119' into test6.8.2

@@ -19,10 +19,9 @@ public interface ChannelSkuCompareMapper { @@ -19,10 +19,9 @@ public interface ChannelSkuCompareMapper {
19 19
20 ChannelSkuCompare selectById(@Param("id") Integer id); 20 ChannelSkuCompare selectById(@Param("id") Integer id);
21 21
22 - int updateChangeStatusById(@Param("id")Integer id, @Param("status")Integer status, @Param("changeStatusTime") Integer changeStatusTime,  
23 - @Param("changeStatusUid")Integer changeStatusUid); 22 + int updateChangeStatusById(@Param("id")Integer id, @Param("status")Integer status, @Param("updateUid")Integer updateUid);
24 23
25 - int updateRateById(@Param("id")Integer id, @Param("lowRate")BigDecimal lowRate, @Param("highRate")BigDecimal highRate); 24 + int updateRateById(@Param("id")Integer id, @Param("lowRate")BigDecimal lowRate, @Param("highRate")BigDecimal highRate, @Param("uid")Integer uid);
26 25
27 - int updateStatusByIds(@Param("idList") List<Integer> idList, @Param("status") Integer status); 26 + int updateStatusByIds(@Param("idList") List<Integer> idList, @Param("status") Integer status, @Param("uid") Integer uid);
28 } 27 }
@@ -31,15 +31,13 @@ public class ChannelSkuCompare implements Serializable { @@ -31,15 +31,13 @@ public class ChannelSkuCompare implements Serializable {
31 31
32 private BigDecimal highRate; 32 private BigDecimal highRate;
33 33
34 - private Integer updateTime;  
35 -  
36 private String channelUrl; 34 private String channelUrl;
37 35
38 private Integer status; 36 private Integer status;
39 37
40 - private Integer changeStatusTime; 38 + private Integer updateTime;
41 39
42 - private Integer changeStatusUid; 40 + private Integer updateUid;
43 41
44 public Integer getId() { 42 public Integer getId() {
45 return id; 43 return id;
@@ -121,20 +119,12 @@ public class ChannelSkuCompare implements Serializable { @@ -121,20 +119,12 @@ public class ChannelSkuCompare implements Serializable {
121 this.status = status; 119 this.status = status;
122 } 120 }
123 121
124 - public Integer getChangeStatusTime() {  
125 - return changeStatusTime;  
126 - }  
127 -  
128 - public void setChangeStatusTime(Integer changeStatusTime) {  
129 - this.changeStatusTime = changeStatusTime;  
130 - }  
131 -  
132 - public Integer getChangeStatusUid() {  
133 - return changeStatusUid; 122 + public Integer getUpdateUid() {
  123 + return updateUid;
134 } 124 }
135 125
136 - public void setChangeStatusUid(Integer changeStatusUid) {  
137 - this.changeStatusUid = changeStatusUid; 126 + public void setUpdateUid(Integer updateUid) {
  127 + this.updateUid = updateUid;
138 } 128 }
139 129
140 @Override 130 @Override
@@ -150,8 +140,7 @@ public class ChannelSkuCompare implements Serializable { @@ -150,8 +140,7 @@ public class ChannelSkuCompare implements Serializable {
150 ", updateTime=" + updateTime + 140 ", updateTime=" + updateTime +
151 ", channelUrl=" + channelUrl + 141 ", channelUrl=" + channelUrl +
152 ", status=" + status + 142 ", status=" + status +
153 - ", changeStatusTime=" + changeStatusTime +  
154 - ", changeStatusUid=" + changeStatusUid + 143 + ", updateUid=" + updateUid +
155 '}'; 144 '}';
156 } 145 }
157 } 146 }
@@ -9,16 +9,15 @@ @@ -9,16 +9,15 @@
9 <result column="channel_price" property="channelPrice" jdbcType="DECIMAL" /> 9 <result column="channel_price" property="channelPrice" jdbcType="DECIMAL" />
10 <result column="low_rate" property="lowRate" jdbcType="DECIMAL" /> 10 <result column="low_rate" property="lowRate" jdbcType="DECIMAL" />
11 <result column="high_rate" property="highRate" jdbcType="DECIMAL" /> 11 <result column="high_rate" property="highRate" jdbcType="DECIMAL" />
12 - <result column="update_time" property="updateTime" jdbcType="INTEGER" />  
13 <result column="channel_url" property="channelUrl" jdbcType="VARCHAR" /> 12 <result column="channel_url" property="channelUrl" jdbcType="VARCHAR" />
14 <result column="status" property="status" jdbcType="INTEGER" /> 13 <result column="status" property="status" jdbcType="INTEGER" />
15 - <result column="change_status_time" property="changeStatusTime" jdbcType="INTEGER" />  
16 - <result column="change_status_uid" property="changeStatusUid" jdbcType="INTEGER" /> 14 + <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  15 + <result column="update_uid" property="updateUid" jdbcType="INTEGER" />
17 </resultMap> 16 </resultMap>
18 17
19 <sql id="Base_Column_List"> 18 <sql id="Base_Column_List">
20 - id, product_id, sku, size_id, channel_price, low_rate, high_rate, update_time, channel_url,  
21 - status, change_status_time, change_status_uid 19 + id, product_id, sku, size_id, channel_price, low_rate, high_rate, channel_url,
  20 + status, update_time, update_uid
22 </sql> 21 </sql>
23 22
24 <select id="selectById" resultMap="BaseResultMap"> 23 <select id="selectById" resultMap="BaseResultMap">
@@ -70,17 +69,17 @@ @@ -70,17 +69,17 @@
70 </select> 69 </select>
71 70
72 <update id="updateChangeStatusById"> 71 <update id="updateChangeStatusById">
73 - update channel_sku_compare set status=#{status}, change_status_time=#{changeStatusTime}, change_status_uid=#{changeStatusUid} 72 + update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{updateUid}
74 where id=#{id} 73 where id=#{id}
75 </update> 74 </update>
76 75
77 <update id="updateRateById"> 76 <update id="updateRateById">
78 - update channel_sku_compare set low_rate=#{lowRate}, high_rate=#{highRate} 77 + update channel_sku_compare set low_rate=#{lowRate}, high_rate=#{highRate}, update_uid=#{uid}, update_time=unix_timestamp()
79 where id=#{id} 78 where id=#{id}
80 </update> 79 </update>
81 80
82 <update id="updateStatusByIds"> 81 <update id="updateStatusByIds">
83 - update channel_sku_compare set status=#{status} where id in 82 + update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{uid} where id in
84 <foreach collection="idList" item="id" open="(" close=")" separator=","> 83 <foreach collection="idList" item="id" open="(" close=")" separator=",">
85 #{id} 84 #{id}
86 </foreach> 85 </foreach>
@@ -3,7 +3,6 @@ package com.yoho.ufo.controller; @@ -3,7 +3,6 @@ package com.yoho.ufo.controller;
3 import org.slf4j.Logger; 3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 4 import org.slf4j.LoggerFactory;
5 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
6 -import org.springframework.web.bind.annotation.RequestBody;  
7 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RestController; 7 import org.springframework.web.bind.annotation.RestController;
9 8
@@ -144,7 +144,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -144,7 +144,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
144 BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate())); 144 BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate()));
145 BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate())); 145 BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate()));
146 //记录变更人信息 146 //记录变更人信息
147 - channelSkuCompareMapper.updateChangeStatusById(req.getId(), req.getStatus(), DateUtil.getCurrentTimeSecond(), new UserHelper().getUserId()); 147 + channelSkuCompareMapper.updateChangeStatusById(req.getId(), req.getStatus(), new UserHelper().getUserId());
148 148
149 return storageMapper.updateSuggestPriceById(csc.getSku(), suggestLowPrice, suggestHighPrice); 149 return storageMapper.updateSuggestPriceById(csc.getSku(), suggestLowPrice, suggestHighPrice);
150 150
@@ -165,8 +165,16 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -165,8 +165,16 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
165 BigDecimal lowRate = null == req.getSuggestLowRate() ? csc.getLowRate() : req.getSuggestLowRate(); 165 BigDecimal lowRate = null == req.getSuggestLowRate() ? csc.getLowRate() : req.getSuggestLowRate();
166 BigDecimal highRate = null == req.getSuggestHighRate() ? csc.getHighRate() : req.getSuggestHighRate(); 166 BigDecimal highRate = null == req.getSuggestHighRate() ? csc.getHighRate() : req.getSuggestHighRate();
167 167
  168 + BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(lowRate));
  169 + BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(highRate));
  170 +
  171 + //更新storage表的建议价
  172 + storageMapper.updateSuggestPriceById(csc.getSku(), suggestLowPrice, suggestHighPrice);
  173 +
168 //更新比例 174 //更新比例
169 - return channelSkuCompareMapper.updateRateById(req.getId(), lowRate, highRate); 175 + return channelSkuCompareMapper.updateRateById(req.getId(), lowRate, highRate, new UserHelper().getUserId());
  176 +
  177 +
170 178
171 } 179 }
172 180
@@ -208,7 +216,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService, @@ -208,7 +216,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
208 } 216 }
209 217
210 //更新异常数据状态 218 //更新异常数据状态
211 - channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL); 219 + channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL, 0);//uid=0表示系统操作
212 220
213 //更新正常数据的建议价到storage表 221 //更新正常数据的建议价到storage表
214 storageMapper.updateBatchSuggestPrice(storageList); 222 storageMapper.updateBatchSuggestPrice(storageList);