Authored by caoyan

UFO比价

... ... @@ -19,10 +19,9 @@ public interface ChannelSkuCompareMapper {
ChannelSkuCompare selectById(@Param("id") Integer id);
int updateChangeStatusById(@Param("id")Integer id, @Param("status")Integer status, @Param("changeStatusTime") Integer changeStatusTime,
@Param("changeStatusUid")Integer changeStatusUid);
int updateChangeStatusById(@Param("id")Integer id, @Param("status")Integer status, @Param("updateUid")Integer updateUid);
int updateRateById(@Param("id")Integer id, @Param("lowRate")BigDecimal lowRate, @Param("highRate")BigDecimal highRate);
int updateRateById(@Param("id")Integer id, @Param("lowRate")BigDecimal lowRate, @Param("highRate")BigDecimal highRate, @Param("uid")Integer uid);
int updateStatusByIds(@Param("idList") List<Integer> idList, @Param("status") Integer status);
int updateStatusByIds(@Param("idList") List<Integer> idList, @Param("status") Integer status, @Param("uid") Integer uid);
}
... ...
... ... @@ -31,15 +31,13 @@ public class ChannelSkuCompare implements Serializable {
private BigDecimal highRate;
private Integer updateTime;
private String channelUrl;
private Integer status;
private Integer changeStatusTime;
private Integer updateTime;
private Integer changeStatusUid;
private Integer updateUid;
public Integer getId() {
return id;
... ... @@ -121,20 +119,12 @@ public class ChannelSkuCompare implements Serializable {
this.status = status;
}
public Integer getChangeStatusTime() {
return changeStatusTime;
}
public void setChangeStatusTime(Integer changeStatusTime) {
this.changeStatusTime = changeStatusTime;
}
public Integer getChangeStatusUid() {
return changeStatusUid;
public Integer getUpdateUid() {
return updateUid;
}
public void setChangeStatusUid(Integer changeStatusUid) {
this.changeStatusUid = changeStatusUid;
public void setUpdateUid(Integer updateUid) {
this.updateUid = updateUid;
}
@Override
... ... @@ -150,8 +140,7 @@ public class ChannelSkuCompare implements Serializable {
", updateTime=" + updateTime +
", channelUrl=" + channelUrl +
", status=" + status +
", changeStatusTime=" + changeStatusTime +
", changeStatusUid=" + changeStatusUid +
", updateUid=" + updateUid +
'}';
}
}
... ...
... ... @@ -9,16 +9,15 @@
<result column="channel_price" property="channelPrice" jdbcType="DECIMAL" />
<result column="low_rate" property="lowRate" jdbcType="DECIMAL" />
<result column="high_rate" property="highRate" jdbcType="DECIMAL" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="channel_url" property="channelUrl" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="change_status_time" property="changeStatusTime" jdbcType="INTEGER" />
<result column="change_status_uid" property="changeStatusUid" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_uid" property="updateUid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, sku, size_id, channel_price, low_rate, high_rate, update_time, channel_url,
status, change_status_time, change_status_uid
id, product_id, sku, size_id, channel_price, low_rate, high_rate, channel_url,
status, update_time, update_uid
</sql>
<select id="selectById" resultMap="BaseResultMap">
... ... @@ -70,17 +69,17 @@
</select>
<update id="updateChangeStatusById">
update channel_sku_compare set status=#{status}, change_status_time=#{changeStatusTime}, change_status_uid=#{changeStatusUid}
update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{updateUid}
where id=#{id}
</update>
<update id="updateRateById">
update channel_sku_compare set low_rate=#{lowRate}, high_rate=#{highRate}
update channel_sku_compare set low_rate=#{lowRate}, high_rate=#{highRate}, update_uid=#{uid}, update_time=unix_timestamp()
where id=#{id}
</update>
<update id="updateStatusByIds">
update channel_sku_compare set status=#{status} where id in
update channel_sku_compare set status=#{status}, update_time=unix_timestamp(), update_uid=#{uid} where id in
<foreach collection="idList" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
... ...
... ... @@ -3,7 +3,6 @@ package com.yoho.ufo.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ...
... ... @@ -144,7 +144,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(csc.getLowRate()));
BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(csc.getHighRate()));
//记录变更人信息
channelSkuCompareMapper.updateChangeStatusById(req.getId(), req.getStatus(), DateUtil.getCurrentTimeSecond(), new UserHelper().getUserId());
channelSkuCompareMapper.updateChangeStatusById(req.getId(), req.getStatus(), new UserHelper().getUserId());
return storageMapper.updateSuggestPriceById(csc.getSku(), suggestLowPrice, suggestHighPrice);
... ... @@ -165,8 +165,16 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
BigDecimal lowRate = null == req.getSuggestLowRate() ? csc.getLowRate() : req.getSuggestLowRate();
BigDecimal highRate = null == req.getSuggestHighRate() ? csc.getHighRate() : req.getSuggestHighRate();
BigDecimal suggestLowPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).subtract(lowRate));
BigDecimal suggestHighPrice = csc.getChannelPrice().multiply(BigDecimal.valueOf(1).add(highRate));
//更新storage表的建议价
storageMapper.updateSuggestPriceById(csc.getSku(), suggestLowPrice, suggestHighPrice);
//更新比例
return channelSkuCompareMapper.updateRateById(req.getId(), lowRate, highRate);
return channelSkuCompareMapper.updateRateById(req.getId(), lowRate, highRate, new UserHelper().getUserId());
}
... ... @@ -208,7 +216,7 @@ public class ChannelSkuCompareServiceImpl implements IChannelSkuCompareService,
}
//更新异常数据状态
channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL);
channelSkuCompareMapper.updateStatusByIds(abnormalIdList, CHANNEL_SKU_COMPARE_ABNORMAL, 0);//uid=0表示系统操作
//更新正常数据的建议价到storage表
storageMapper.updateBatchSuggestPrice(storageList);
... ...