Authored by caoyan

Merge branch 'test6.9.9' of http://git.yoho.cn/ufo/ufo-platform into test6.9.9

  1 +package com.yoho.order.dal;
  2 +
  3 +import com.yoho.order.model.ProductSize;
  4 +
  5 +public interface ProductSizeMapper {
  6 +
  7 + int insert(ProductSize record);
  8 +
  9 + int updateBySizeId(ProductSize record);
  10 +
  11 +}
@@ -22,7 +22,7 @@ public interface StorageDepositMapper { @@ -22,7 +22,7 @@ public interface StorageDepositMapper {
22 * @param curTime 22 * @param curTime
23 * @return 最多返回500条记录,怕内存不够 23 * @return 最多返回500条记录,怕内存不够
24 */ 24 */
25 - List<StorageDeposit> selectNeddRemindDeposit(@Param("curTime") Integer curTime, @Param("remindStatus") Integer remindStatus); 25 + List<StorageDeposit> selectNeddRemindDeposit(@Param("curTime") Integer curTime, @Param("remindStatus") List<Integer> remindStatus);
26 26
27 /** 27 /**
28 * 更新通知快到期的状态 28 * 更新通知快到期的状态
  1 +package com.yoho.order.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class ProductSize {
  7 + private Integer id;
  8 +
  9 + private Integer sizeId;
  10 +
  11 + private String sizeName;
  12 +
  13 + private Integer orderBy;
  14 +
  15 + private Integer createTime;
  16 +
  17 + private Integer updateTime;
  18 +
  19 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.order.dal.ProductSizeMapper" >
  4 +
  5 + <resultMap id="BaseResultMap" type="com.yoho.order.model.ProductSize" >
  6 + <id column="id" property="id" jdbcType="INTEGER" />
  7 + <result column="size_id" property="sizeId" jdbcType="INTEGER" />
  8 + <result column="size_name" property="sizeName" jdbcType="VARCHAR" />
  9 + <result column="order_by" property="orderBy" jdbcType="INTEGER" />
  10 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  11 + <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  12 + </resultMap>
  13 +
  14 + <sql id="Base_Column_List" >
  15 + id, size_id, size_name, order_by, create_time, update_time
  16 + </sql>
  17 +
  18 + <insert id="insert" parameterType="com.yoho.order.model.ProductSize" >
  19 + insert into product_size (id, size_id, size_name,
  20 + order_by, create_time,
  21 + update_time)
  22 + values (#{id,jdbcType=INTEGER}, #{sizeId,jdbcType=INTEGER}, #{sizeName,jdbcType=VARCHAR},
  23 + #{orderBy,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
  24 + #{updateTime,jdbcType=INTEGER})
  25 + </insert>
  26 +
  27 + <update id="updateBySizeId" parameterType="com.yoho.order.model.ProductSize" >
  28 + update product_size
  29 + <set >
  30 + <if test="sizeName != null" >
  31 + size_name = #{sizeName,jdbcType=VARCHAR},
  32 + </if>
  33 + <if test="orderBy != null" >
  34 + order_by = #{orderBy,jdbcType=INTEGER},
  35 + </if>
  36 + <if test="createTime != null" >
  37 + create_time = #{createTime,jdbcType=INTEGER},
  38 + </if>
  39 + <if test="updateTime != null" >
  40 + update_time = #{updateTime,jdbcType=INTEGER},
  41 + </if>
  42 + </set>
  43 + where size_id = #{sizeId,jdbcType=INTEGER}
  44 + </update>
  45 +
  46 +</mapper>
@@ -95,7 +95,11 @@ @@ -95,7 +95,11 @@
95 95
96 <select id="selectNeddRemindDeposit" resultMap="BaseResultMap"> 96 <select id="selectNeddRemindDeposit" resultMap="BaseResultMap">
97 select <include refid="Base_Column_List"></include> 97 select <include refid="Base_Column_List"></include>
98 - from storage_deposit WHERE del_status = 0 and deposit_end_time &lt;= #{curTime} and remind_status = #{remindStatus} AND status = 1 limit 500 98 + from storage_deposit WHERE del_status = 0 and deposit_end_time &lt;= #{curTime} and remind_status in
  99 + <foreach collection="remindStatus" item="item" open="(" close=")" separator=",">
  100 + #{item}
  101 + </foreach>
  102 + AND status = 1 limit 500
99 </select> 103 </select>
100 104
101 <update id="updateHasRemind"> 105 <update id="updateHasRemind">
@@ -11,6 +11,7 @@ import com.yoho.ufo.model.ChannelSkuCompareReq; @@ -11,6 +11,7 @@ import com.yoho.ufo.model.ChannelSkuCompareReq;
11 import com.yoho.ufo.model.ChannelSkuCompareRspBo; 11 import com.yoho.ufo.model.ChannelSkuCompareRspBo;
12 import com.yoho.ufo.order.service.impl.exportbean.OrderInfoForPackageNum; 12 import com.yoho.ufo.order.service.impl.exportbean.OrderInfoForPackageNum;
13 import com.yoho.ufo.service.IBusinessExportService; 13 import com.yoho.ufo.service.IBusinessExportService;
  14 +import com.yoho.ufo.service.model.ApiResponse;
14 import com.yoho.ufo.service.model.PageResponseBO; 15 import com.yoho.ufo.service.model.PageResponseBO;
15 import org.apache.commons.collections.CollectionUtils; 16 import org.apache.commons.collections.CollectionUtils;
16 import org.apache.commons.lang3.StringUtils; 17 import org.apache.commons.lang3.StringUtils;
@@ -25,7 +26,7 @@ import java.util.Map; @@ -25,7 +26,7 @@ import java.util.Map;
25 /** 26 /**
26 * Created by li.ma on 2019/7/19. 27 * Created by li.ma on 2019/7/19.
27 */ 28 */
28 -@Service 29 +@Service(value = "ClearanceRecordService")
29 public class ClearanceRecordService implements IBusinessExportService { 30 public class ClearanceRecordService implements IBusinessExportService {
30 private static final Logger LOGGER = LoggerFactory.getLogger(ClearanceRecordService.class); 31 private static final Logger LOGGER = LoggerFactory.getLogger(ClearanceRecordService.class);
31 32
@@ -71,6 +72,9 @@ public class ClearanceRecordService implements IBusinessExportService { @@ -71,6 +72,9 @@ public class ClearanceRecordService implements IBusinessExportService {
71 throw new ServiceException(400, "没有要导出的数据"); 72 throw new ServiceException(400, "没有要导出的数据");
72 } 73 }
73 74
  75 + if (request.getOrderCode() == null && StringUtils.isEmpty(request.getWaybillCode())) {
  76 + throw new ServiceException(400, "没有要导出的数据");
  77 + }
74 78
75 ClearanceRecord clearanceRecord = clearanceRecordMapper.selectByOrderCode(request); 79 ClearanceRecord clearanceRecord = clearanceRecordMapper.selectByOrderCode(request);
76 if (null == clearanceRecord) { 80 if (null == clearanceRecord) {
@@ -128,7 +128,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ @@ -128,7 +128,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
128 * @return 128 * @return
129 */ 129 */
130 public List<StorageDeposit> selectNeddRemindDeposit() { 130 public List<StorageDeposit> selectNeddRemindDeposit() {
131 - return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() + 24 * 60 * 60, 0); 131 + return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() + 24 * 60 * 60, Lists.newArrayList(0, 1));
132 } 132 }
133 133
134 134
@@ -447,7 +447,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ @@ -447,7 +447,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
447 } 447 }
448 448
449 public int updateHasRemind(Integer id) { 449 public int updateHasRemind(Integer id) {
450 - return storageDepositMapper.updateHasRemind(id, 1); 450 + return storageDepositMapper.updateHasRemind(id, 2);
451 } 451 }
452 452
453 public List<StorageDeposit> selectNeddDownDeposit() { 453 public List<StorageDeposit> selectNeddDownDeposit() {
@@ -505,7 +505,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ @@ -505,7 +505,7 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
505 } 505 }
506 506
507 public List<StorageDeposit> selectThreedDayNeedRemindDeposit() { 507 public List<StorageDeposit> selectThreedDayNeedRemindDeposit() {
508 - return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() + 72 * 60 * 60, 0); 508 + return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() + 72 * 60 * 60, Lists.newArrayList(0));
509 } 509 }
510 510
511 public int updateThreedDayHasRemind(Integer id) { 511 public int updateThreedDayHasRemind(Integer id) {
@@ -72,25 +72,25 @@ public class StorageDepositAutoDown implements YhJob { @@ -72,25 +72,25 @@ public class StorageDepositAutoDown implements YhJob {
72 storageDeposits.stream().forEach(item -> { 72 storageDeposits.stream().forEach(item -> {
73 LOGGER.info("method StorageDepositAutoDown.process item is {}", item); 73 LOGGER.info("method StorageDepositAutoDown.process item is {}", item);
74 74
75 - int downResult = 0;  
76 - if (item.getOrderStatus() == 1) {  
77 - boolean offResult = offShelveByErp(item);  
78 - if (offResult) { // 下架成功之后触发,变成待拣货状态  
79 - downResult = storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(),  
80 - 0, DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode(), StorageDepositStatusEnum.HAS_IN.getCode());  
81 - }  
82 - } else { // 下架成功之后触发,变成待拣货状态  
83 - downResult = storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(),  
84 - 0, DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode(), StorageDepositStatusEnum.HAS_IN.getCode()); 75 + //int downResult = 0;
  76 + if (item.getOrderStatus() == 1 && offShelveByErp(item)) { // 到期商品直接下架
  77 + notifyOwnerUid(item); // 修改成功之后,调用发通知
85 } 78 }
  79 + //if (offResult) { // 下架成功之后触发,变成待拣货状态
  80 + //downResult = storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(),
  81 + // 0, DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode(), StorageDepositStatusEnum.HAS_IN.getCode());
  82 + // }
  83 + //} else { // 下架成功之后触发,变成待拣货状态
  84 + // downResult = storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(),
  85 + // 0, DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode(), StorageDepositStatusEnum.HAS_IN.getCode());
  86 + //}
86 87
87 - if (downResult > 0) {  
88 - notifyOwnerUid(item); // 修改成功之后,调用发通知 88 + //if (downResult > 0) {
89 89
90 - clearOrderInfoCache(item);  
91 - } else {  
92 - LOGGER.error("storageDepositService.updateStatus find wrong, item is {}", item);  
93 - } 90 +
  91 + //clearOrderInfoCache(item);
  92 + //} else {
  93 + // LOGGER.error("storageDepositService.updateStatus find wrong, item is {}", item);
94 }); 94 });
95 95
96 result.setJobResultCode(JobResultCode.SUCCESS); 96 result.setJobResultCode(JobResultCode.SUCCESS);
@@ -27,9 +27,9 @@ import java.util.List; @@ -27,9 +27,9 @@ import java.util.List;
27 * Created by li.ma on 2019/7/8. 27 * Created by li.ma on 2019/7/8.
28 * 扫描库存到期前24小时的到期提醒 28 * 扫描库存到期前24小时的到期提醒
29 */ 29 */
30 -/*@Service(value="StorageDepositThreeddayRemind") 30 +@Service(value="StorageDepositThreeddayRemind")
31 @YhJobDef(desc = "72小时库存寄存到期处理", jobName = "StorageDepositThreeddayRemind", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING, 31 @YhJobDef(desc = "72小时库存寄存到期处理", jobName = "StorageDepositThreeddayRemind", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING,
32 - jobType = JobType.CRON, jobGroup = "ufoPlatform")*/ 32 + jobType = JobType.CRON, jobGroup = "ufoPlatform")
33 public class StorageDepositThreeddayRemind implements YhJob { 33 public class StorageDepositThreeddayRemind implements YhJob {
34 private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog"); 34 private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog");
35 35
  1 +package com.yoho.ufo.service.impl;
  2 +
  3 +import com.yoho.order.dal.ProductSizeMapper;
  4 +import com.yoho.order.model.ProductSize;
  5 +import com.yoho.ufo.dal.UfoSizeMapper;
  6 +import com.yoho.ufo.model.commoditybasicrole.size.Size;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.apache.ibatis.annotations.Param;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +@Slf4j
  13 +@Service
  14 +public class SizeManage {
  15 +
  16 + @Autowired
  17 + private UfoSizeMapper ufoSizeMapper;
  18 +
  19 + @Autowired
  20 + private ProductSizeMapper productSizeMapper;
  21 +
  22 + /**
  23 + * 插入一条尺寸数据
  24 + *
  25 + * @param size
  26 + * @return
  27 + */
  28 + public int insertSize(Size size) {
  29 + int rows = ufoSizeMapper.insertSize(size);
  30 + if (rows > 0) {
  31 + if (productSizeMapper.insert(newProductSize(size)) == 0) {
  32 + log.warn("product size {} {} insert fail", size.getSizeId(), size.getSizeName());
  33 + }
  34 + }
  35 + return rows;
  36 + }
  37 +
  38 + /**
  39 + * 更新尺寸数据
  40 + *
  41 + * @param size
  42 + * @return
  43 + */
  44 + public int updateSize(@Param("size") Size size) {
  45 + int rows = ufoSizeMapper.updateSize(size);
  46 + if (rows > 0) {
  47 + if (productSizeMapper.updateBySizeId(newProductSize(size)) == 0) {
  48 + log.warn("product size {} {} update fail", size.getSizeId(), size.getSizeName());
  49 + }
  50 + }
  51 + return rows;
  52 + }
  53 +
  54 + private ProductSize newProductSize(Size size) {
  55 + ProductSize productSize = new ProductSize();
  56 + productSize.setSizeId(size.getId());
  57 + productSize.setSizeName(size.getSizeName());
  58 + productSize.setOrderBy(size.getOrderBy());
  59 + productSize.setCreateTime(size.getCreateTime());
  60 + productSize.setUpdateTime(size.getUpdateTime());
  61 + return productSize;
  62 + }
  63 +
  64 +
  65 +}
@@ -58,6 +58,9 @@ public class SizeServiceImpl implements ISizeService { @@ -58,6 +58,9 @@ public class SizeServiceImpl implements ISizeService {
58 @Autowired 58 @Autowired
59 private ISizeService sizeService; 59 private ISizeService sizeService;
60 60
  61 + @Autowired
  62 + private SizeManage sizeManage;
  63 +
61 @Override 64 @Override
62 public int saveOrUpdateSize(SizeRequestBo sizeRequestBo) { 65 public int saveOrUpdateSize(SizeRequestBo sizeRequestBo) {
63 LOGGER.info("saveOrUpdateSize param = {}", sizeRequestBo); 66 LOGGER.info("saveOrUpdateSize param = {}", sizeRequestBo);
@@ -76,7 +79,7 @@ public class SizeServiceImpl implements ISizeService { @@ -76,7 +79,7 @@ public class SizeServiceImpl implements ISizeService {
76 size.setOrderBy(0); 79 size.setOrderBy(0);
77 } 80 }
78 // 新增 81 // 新增
79 - return ufoSizeMapper.insertSize(size); 82 + return sizeManage.insertSize(size);
80 } else { 83 } else {
81 List<Size> sizes = ufoSizeMapper.selectBySizeNameEx(size.getSizeName(), size.getId()); 84 List<Size> sizes = ufoSizeMapper.selectBySizeNameEx(size.getSizeName(), size.getId());
82 if (CollectionUtils.isNotEmpty(sizes)) { 85 if (CollectionUtils.isNotEmpty(sizes)) {
@@ -85,7 +88,7 @@ public class SizeServiceImpl implements ISizeService { @@ -85,7 +88,7 @@ public class SizeServiceImpl implements ISizeService {
85 88
86 // 更新 89 // 更新
87 size.setUpdateTime(DateUtil.currentTimeSeconds()); 90 size.setUpdateTime(DateUtil.currentTimeSeconds());
88 - return ufoSizeMapper.updateSize(size); 91 + return sizeManage.updateSize(size);
89 } 92 }
90 } 93 }
91 94
@@ -346,7 +349,7 @@ public class SizeServiceImpl implements ISizeService { @@ -346,7 +349,7 @@ public class SizeServiceImpl implements ISizeService {
346 s.setCreateTime(time); 349 s.setCreateTime(time);
347 s.setUpdateTime(0); 350 s.setUpdateTime(0);
348 LOGGER.info("切换品类尺码数据, 构建新尺码:{}", s); 351 LOGGER.info("切换品类尺码数据, 构建新尺码:{}", s);
349 - ufoSizeMapper.insertSize(s); 352 + sizeManage.insertSize(s);
350 LOGGER.info("切换品类尺码数据, 保存新尺码成功:{}", s); 353 LOGGER.info("切换品类尺码数据, 保存新尺码成功:{}", s);
351 354
352 LOGGER.info("切换品类尺码数据, 获取 {} 绑定的类别", sName); 355 LOGGER.info("切换品类尺码数据, 获取 {} 绑定的类别", sName);
@@ -93,6 +93,7 @@ @@ -93,6 +93,7 @@
93 <entry key="couponServiceImpl" value-ref="couponServiceImpl"></entry> 93 <entry key="couponServiceImpl" value-ref="couponServiceImpl"></entry>
94 <entry key="channelSkuCompareServiceImpl" value-ref="channelSkuCompareServiceImpl"/> 94 <entry key="channelSkuCompareServiceImpl" value-ref="channelSkuCompareServiceImpl"/>
95 <entry key="productPoolDetailsServiceImpl" value-ref="productPoolDetailsServiceImpl"/> 95 <entry key="productPoolDetailsServiceImpl" value-ref="productPoolDetailsServiceImpl"/>
  96 + <entry key="ClearanceRecordService" value-ref="ClearanceRecordService"/>
96 </util:map> 97 </util:map>
97 98
98 </beans> 99 </beans>
@@ -60,6 +60,7 @@ datasources: @@ -60,6 +60,7 @@ datasources:
60 - com.yoho.order.dal.DepositOrderMapper 60 - com.yoho.order.dal.DepositOrderMapper
61 - com.yoho.order.dal.DepositCodeMapper 61 - com.yoho.order.dal.DepositCodeMapper
62 - com.yoho.order.dal.ClearanceRecordMapper 62 - com.yoho.order.dal.ClearanceRecordMapper
  63 + - com.yoho.order.dal.ProductSizeMapper
63 64
64 ufo_resource: 65 ufo_resource:
65 servers: 66 servers:
@@ -61,6 +61,7 @@ datasources: @@ -61,6 +61,7 @@ datasources:
61 - com.yoho.order.dal.DepositOrderMapper 61 - com.yoho.order.dal.DepositOrderMapper
62 - com.yoho.order.dal.DepositCodeMapper 62 - com.yoho.order.dal.DepositCodeMapper
63 - com.yoho.order.dal.ClearanceRecordMapper 63 - com.yoho.order.dal.ClearanceRecordMapper
  64 + - com.yoho.order.dal.ProductSizeMapper
64 65
65 ufo_resource: 66 ufo_resource:
66 servers: 67 servers:
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 // var params = {"poolId": poolId.toString()}; 90 // var params = {"poolId": poolId.toString()};
91 91
92 var param = getParams(); 92 var param = getParams();
93 - window.open(contextPath + "/batch/export.do?type=ClearanceRecordService&queryConf=" + JSON.stringify(param)); 93 + window.open(contextPath + "/batch/export.do?type=ClearanceRecordService&queryConf=" + escape(JSON.stringify(param)));
94 } 94 }
95 }); 95 });
96 96
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 * 提取出搜索参数 98 * 提取出搜索参数
99 */ 99 */
100 function getParams() { 100 function getParams() {
101 - var waybillCode = $("#sellerWaybillCode").val(); 101 + var waybillCode = $("#waybillCode").val();
102 var orderCode = $("#orderCode").val(); 102 var orderCode = $("#orderCode").val();
103 var param = {}; 103 var param = {};
104 if (undefined !== orderCode && null !== orderCode && "" !== orderCode) { 104 if (undefined !== orderCode && null !== orderCode && "" !== orderCode) {