Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/ufo-platform into test6.9.8
# Conflicts: # dal/src/main/java/com/yoho/order/model/StorageDeposit.java # order/src/main/java/com/yoho/ufo/order/service/impl/BuyerOrderServiceImpl.java
Showing
17 changed files
with
336 additions
and
156 deletions
@@ -71,5 +71,9 @@ | @@ -71,5 +71,9 @@ | ||
71 | <groupId>com.yoho.ufo.model</groupId> | 71 | <groupId>com.yoho.ufo.model</groupId> |
72 | <artifactId>user-ufo-model</artifactId> | 72 | <artifactId>user-ufo-model</artifactId> |
73 | </dependency> | 73 | </dependency> |
74 | + <dependency> | ||
75 | + <groupId>com.yoho.ufo.model</groupId> | ||
76 | + <artifactId>product-ufo-model</artifactId> | ||
77 | + </dependency> | ||
74 | </dependencies> | 78 | </dependencies> |
75 | </project> | 79 | </project> |
1 | package com.yoho.ufo.service.impl; | 1 | package com.yoho.ufo.service.impl; |
2 | 2 | ||
3 | +import org.apache.commons.lang3.StringUtils; | ||
3 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
4 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -49,4 +50,28 @@ public class InboxServiceImpl { | @@ -49,4 +50,28 @@ public class InboxServiceImpl { | ||
49 | 50 | ||
50 | LOGGER.info("addInboxForPlatform.sendSmsMessage call result is {}", jsonObject); | 51 | LOGGER.info("addInboxForPlatform.sendSmsMessage call result is {}", jsonObject); |
51 | } | 52 | } |
53 | + | ||
54 | + // 发送站内信 | ||
55 | + public void addInboxForPlatformEx(int uid, Integer type, Integer businessType, Object... params){ | ||
56 | + InboxReqVO reqVO = InboxReqVO.builder().businessType(businessType).params(buildParams(params)).type(type).uid(uid).build(); | ||
57 | + | ||
58 | + LOGGER.info("addInboxForPlatform.addInbox with reqVO is {}", reqVO); | ||
59 | + | ||
60 | + String jsonObject = serviceCaller.asyncCall("ufo-gateway.addInboxForPlatform", reqVO, String.class).get(); | ||
61 | + | ||
62 | + LOGGER.info("addInboxForPlatform.addInbox call result is {}", jsonObject); | ||
63 | + } | ||
64 | + | ||
65 | + private String buildParams(Object... objects) { | ||
66 | + if (objects == null) { | ||
67 | + return null; | ||
68 | + } | ||
69 | + | ||
70 | + if (objects.length == 1) { | ||
71 | + return objects[0].toString(); | ||
72 | + } | ||
73 | + | ||
74 | + String params = StringUtils.join(objects, ","); | ||
75 | + return params; | ||
76 | + } | ||
52 | } | 77 | } |
1 | -package com.yoho.ufo.service; | 1 | +package com.yoho.ufo.service.impl; |
2 | 2 | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | import java.util.Map; | 4 | import java.util.Map; |
@@ -6,6 +6,7 @@ import java.util.Objects; | @@ -6,6 +6,7 @@ import java.util.Objects; | ||
6 | import java.util.concurrent.TimeUnit; | 6 | import java.util.concurrent.TimeUnit; |
7 | import java.util.stream.Collectors; | 7 | import java.util.stream.Collectors; |
8 | 8 | ||
9 | +import com.yoho.ufo.util.AddressInfoConvertor; | ||
9 | import org.apache.commons.lang3.StringUtils; | 10 | import org.apache.commons.lang3.StringUtils; |
10 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
11 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
@@ -22,7 +23,6 @@ import com.yoho.error.ServiceError; | @@ -22,7 +23,6 @@ import com.yoho.error.ServiceError; | ||
22 | import com.yoho.error.exception.ServiceException; | 23 | import com.yoho.error.exception.ServiceException; |
23 | import com.yoho.service.model.request.UserAddressReqBO; | 24 | import com.yoho.service.model.request.UserAddressReqBO; |
24 | import com.yoho.service.model.response.ProfileInfoRsp; | 25 | import com.yoho.service.model.response.ProfileInfoRsp; |
25 | -import com.yoho.ufo.convert.AddressInfoConvertor; | ||
26 | import com.yohobuy.ufo.model.common.ApiResponse; | 26 | import com.yohobuy.ufo.model.common.ApiResponse; |
27 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 27 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
28 | 28 |
@@ -17,4 +17,33 @@ public interface StorageDepositMapper { | @@ -17,4 +17,33 @@ public interface StorageDepositMapper { | ||
17 | 17 | ||
18 | List<StorageDeposit> selectByCondition(@Param("storageDepositReq") StorageDepositReq req); | 18 | List<StorageDeposit> selectByCondition(@Param("storageDepositReq") StorageDepositReq req); |
19 | 19 | ||
20 | + /** | ||
21 | + * 查询需要提醒库存续约的集合 | ||
22 | + * @param curTime | ||
23 | + * @return | ||
24 | + */ | ||
25 | + List<StorageDeposit> selectNeddRemindDeposit(@Param("curTime") Integer curTime); | ||
26 | + | ||
27 | + /** | ||
28 | + * 更新通知快到期的状态 | ||
29 | + * @param id | ||
30 | + * @return | ||
31 | + */ | ||
32 | + int updateHasRemind(@Param("id")Integer id); | ||
33 | + | ||
34 | + /** | ||
35 | + * 查询需要寄回给卖家的库存 | ||
36 | + * @param curTime | ||
37 | + * @return | ||
38 | + */ | ||
39 | + List<StorageDeposit> selectNeddDownDeposit(@Param("curTime") Integer curTime); | ||
40 | + | ||
41 | + /** | ||
42 | + * 更新状态为待拣货状态,必须要是订单下架状态 | ||
43 | + * @param id | ||
44 | + * @param status | ||
45 | + * @param orderStatus | ||
46 | + * @return | ||
47 | + */ | ||
48 | + int updateStatus(@Param("id")Integer id, @Param("status")Integer status, @Param("orderStatus")int orderStatus); | ||
20 | } | 49 | } |
1 | package com.yoho.order.model; | 1 | package com.yoho.order.model; |
2 | 2 | ||
3 | +import lombok.Data; | ||
3 | import lombok.ToString; | 4 | import lombok.ToString; |
4 | 5 | ||
5 | @ToString | 6 | @ToString |
7 | +@Data | ||
6 | public class StorageDeposit { | 8 | public class StorageDeposit { |
7 | private Integer id; | 9 | private Integer id; |
8 | 10 | ||
@@ -38,140 +40,7 @@ public class StorageDeposit { | @@ -38,140 +40,7 @@ public class StorageDeposit { | ||
38 | 40 | ||
39 | private Integer outType; | 41 | private Integer outType; |
40 | 42 | ||
41 | - public Integer getId() { | ||
42 | - return id; | ||
43 | - } | 43 | + private Integer delStatus; |
44 | 44 | ||
45 | - public void setId(Integer id) { | ||
46 | - this.id = id; | ||
47 | - } | ||
48 | - | ||
49 | - public Integer getProductId() { | ||
50 | - return productId; | ||
51 | - } | ||
52 | - | ||
53 | - public void setProductId(Integer productId) { | ||
54 | - this.productId = productId; | ||
55 | - } | ||
56 | - | ||
57 | - public Integer getGoodsId() { | ||
58 | - return goodsId; | ||
59 | - } | ||
60 | - | ||
61 | - public void setGoodsId(Integer goodsId) { | ||
62 | - this.goodsId = goodsId; | ||
63 | - } | ||
64 | - | ||
65 | - public Integer getStorageId() { | ||
66 | - return storageId; | ||
67 | - } | ||
68 | - | ||
69 | - public void setStorageId(Integer storageId) { | ||
70 | - this.storageId = storageId; | ||
71 | - } | ||
72 | - | ||
73 | - public String getDepositCode() { | ||
74 | - return depositCode; | ||
75 | - } | ||
76 | - | ||
77 | - public void setDepositCode(String depositCode) { | ||
78 | - this.depositCode = depositCode; | ||
79 | - } | ||
80 | - | ||
81 | - public String getShelfCode() { | ||
82 | - return shelfCode; | ||
83 | - } | ||
84 | - | ||
85 | - public void setShelfCode(String shelfCode) { | ||
86 | - this.shelfCode = shelfCode; | ||
87 | - } | ||
88 | - | ||
89 | - public Integer getOwnerUid() { | ||
90 | - return ownerUid; | ||
91 | - } | ||
92 | - | ||
93 | - public void setOwnerUid(Integer ownerUid) { | ||
94 | - this.ownerUid = ownerUid; | ||
95 | - } | ||
96 | - | ||
97 | - public String getOrderCode() { | ||
98 | - return orderCode; | ||
99 | - } | ||
100 | - | ||
101 | - public void setOrderCode(String orderCode) { | ||
102 | - this.orderCode = orderCode; | ||
103 | - } | ||
104 | - | ||
105 | - public Integer getSkup() { | ||
106 | - return skup; | ||
107 | - } | ||
108 | - | ||
109 | - public void setSkup(Integer skup) { | ||
110 | - this.skup = skup; | ||
111 | - } | ||
112 | - | ||
113 | - public Integer getOrderStatus() { | ||
114 | - return orderStatus; | ||
115 | - } | ||
116 | - | ||
117 | - public void setOrderStatus(Integer orderStatus) { | ||
118 | - this.orderStatus = orderStatus; | ||
119 | - } | ||
120 | - | ||
121 | - public Integer getUpdateTime() { | ||
122 | - return updateTime; | ||
123 | - } | ||
124 | - | ||
125 | - public void setUpdateTime(Integer updateTime) { | ||
126 | - this.updateTime = updateTime; | ||
127 | - } | ||
128 | - | ||
129 | - public Integer getCreateTime() { | ||
130 | - return createTime; | ||
131 | - } | ||
132 | - | ||
133 | - public void setCreateTime(Integer createTime) { | ||
134 | - this.createTime = createTime; | ||
135 | - } | ||
136 | - | ||
137 | - public Integer getDepositStartTime() { | ||
138 | - return depositStartTime; | ||
139 | - } | ||
140 | - | ||
141 | - public void setDepositStartTime(Integer depositStartTime) { | ||
142 | - this.depositStartTime = depositStartTime; | ||
143 | - } | ||
144 | - | ||
145 | - public Integer getDepositEndTime() { | ||
146 | - return depositEndTime; | ||
147 | - } | ||
148 | - | ||
149 | - public void setDepositEndTime(Integer depositEndTime) { | ||
150 | - this.depositEndTime = depositEndTime; | ||
151 | - } | ||
152 | - | ||
153 | - public Integer getEditPid() { | ||
154 | - return editPid; | ||
155 | - } | ||
156 | - | ||
157 | - public void setEditPid(Integer editPid) { | ||
158 | - this.editPid = editPid; | ||
159 | - } | ||
160 | - | ||
161 | - public Integer getStatus() { | ||
162 | - return status; | ||
163 | - } | ||
164 | - | ||
165 | - public void setStatus(Integer status) { | ||
166 | - this.status = status; | ||
167 | - } | ||
168 | - | ||
169 | - public Integer getOutType() { | ||
170 | - return outType; | ||
171 | - } | ||
172 | - | ||
173 | - public void setOutType(Integer outType) { | ||
174 | - this.outType = outType; | ||
175 | - } | ||
176 | - | 45 | + private Integer remindStatus; |
177 | } | 46 | } |
@@ -18,13 +18,15 @@ | @@ -18,13 +18,15 @@ | ||
18 | <result column="deposit_start_time" property="depositStartTime" jdbcType="INTEGER" /> | 18 | <result column="deposit_start_time" property="depositStartTime" jdbcType="INTEGER" /> |
19 | <result column="deposit_end_time" property="depositEndTime" jdbcType="INTEGER" /> | 19 | <result column="deposit_end_time" property="depositEndTime" jdbcType="INTEGER" /> |
20 | <result column="edit_pid" property="editPid" jdbcType="INTEGER" /> | 20 | <result column="edit_pid" property="editPid" jdbcType="INTEGER" /> |
21 | + <result column="del_status" property="delStatus" jdbcType="INTEGER" /> | ||
22 | + <result column="remind_status" property="remindStatus" jdbcType="INTEGER" /> | ||
21 | <result column="out_type" property="outType" jdbcType="INTEGER" /> | 23 | <result column="out_type" property="outType" jdbcType="INTEGER" /> |
22 | </resultMap> | 24 | </resultMap> |
23 | 25 | ||
24 | <sql id="Base_Column_List"> | 26 | <sql id="Base_Column_List"> |
25 | id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code, | 27 | id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code, |
26 | skup, status, order_status, update_time, create_time, deposit_start_time, | 28 | skup, status, order_status, update_time, create_time, deposit_start_time, |
27 | - deposit_end_time, edit_pid, out_type | 29 | + deposit_end_time, edit_pid, out_type, del_status, remind_status |
28 | </sql> | 30 | </sql> |
29 | 31 | ||
30 | <insert id="insert" parameterType="com.yoho.order.model.StorageDeposit"> | 32 | <insert id="insert" parameterType="com.yoho.order.model.StorageDeposit"> |
@@ -84,5 +86,22 @@ | @@ -84,5 +86,22 @@ | ||
84 | limit #{storageDepositReq.start},#{storageDepositReq.size} | 86 | limit #{storageDepositReq.start},#{storageDepositReq.size} |
85 | </if> | 87 | </if> |
86 | </select> | 88 | </select> |
87 | - | 89 | + |
90 | + <select id="selectNeddRemindDeposit" resultMap="BaseResultMap"> | ||
91 | + select a.* | ||
92 | + from storage_deposit a WHERE del_status = 0 and deposit_end_time <= #{curTime} and remind_status = 0 AND status = 1 | ||
93 | + </select> | ||
94 | + | ||
95 | + <update id="updateHasRemind"> | ||
96 | + UPDATE storage_deposit a SET remind_status = 1 WHERE id = #{id} | ||
97 | + </update> | ||
98 | + | ||
99 | + <select id="selectNeddDownDeposit" resultMap="BaseResultMap"> | ||
100 | + select a.* | ||
101 | + from storage_deposit a WHERE del_status = 0 and deposit_end_time <= #{curTime} AND status = 1 | ||
102 | + </select> | ||
103 | + | ||
104 | + <update id="updateStatus"> | ||
105 | + UPDATE storage_deposit a SET status = #{status} WHERE id = #{id} AND order_status = #{orderStatus} | ||
106 | + </update> | ||
88 | </mapper> | 107 | </mapper> |
1 | package com.yoho.ufo.order.service; | 1 | package com.yoho.ufo.order.service; |
2 | 2 | ||
3 | +import java.util.List; | ||
3 | import java.util.Map; | 4 | import java.util.Map; |
4 | 5 | ||
6 | +import com.yoho.order.model.StorageDeposit; | ||
5 | import com.yoho.order.model.StorageDepositReq; | 7 | import com.yoho.order.model.StorageDepositReq; |
8 | +import org.apache.ibatis.annotations.Param; | ||
6 | import com.yoho.order.model.StorageDepositRsp; | 9 | import com.yoho.order.model.StorageDepositRsp; |
7 | import com.yoho.ufo.service.model.PageResponseBO; | 10 | import com.yoho.ufo.service.model.PageResponseBO; |
8 | 11 | ||
9 | public interface IStorageDepositService { | 12 | public interface IStorageDepositService { |
10 | 13 | ||
11 | Map<String, Integer> getCountByStatus(StorageDepositReq req); | 14 | Map<String, Integer> getCountByStatus(StorageDepositReq req); |
12 | - | 15 | + |
16 | + List<StorageDeposit> selectNeddRemindDeposit(); | ||
17 | + | ||
18 | + int updateHasRemind(@Param("id")Integer id); | ||
19 | + | ||
20 | + List<StorageDeposit> selectNeddDownDeposit(); | ||
21 | + | ||
22 | + int updateStatus(@Param("id")Integer id, @Param("status")Integer status, @Param("orderStatus")int orderStatus); | ||
23 | + | ||
13 | PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req); | 24 | PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req); |
14 | 25 | ||
15 | } | 26 | } |
@@ -309,7 +309,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon | @@ -309,7 +309,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon | ||
309 | //问题单 | 309 | //问题单 |
310 | private static final Byte QC_STATUS_PROBLEM = 3; | 310 | private static final Byte QC_STATUS_PROBLEM = 3; |
311 | 311 | ||
312 | - //待入库 | ||
313 | //待处理 | 312 | //待处理 |
314 | private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货 | 313 | private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货 |
315 | Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中 | 314 | Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中 |
@@ -3,8 +3,10 @@ package com.yoho.ufo.order.service.impl; | @@ -3,8 +3,10 @@ package com.yoho.ufo.order.service.impl; | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | import java.util.Map; | 4 | import java.util.Map; |
5 | 5 | ||
6 | +import com.yoho.ufo.util.DateUtil; | ||
6 | import org.apache.commons.collections.CollectionUtils; | 7 | import org.apache.commons.collections.CollectionUtils; |
7 | import org.apache.commons.lang3.StringUtils; | 8 | import org.apache.commons.lang3.StringUtils; |
9 | +import org.apache.ibatis.annotations.Param; | ||
8 | import org.elasticsearch.common.collect.Maps; | 10 | import org.elasticsearch.common.collect.Maps; |
9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
10 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
@@ -46,7 +48,16 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ | @@ -46,7 +48,16 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ | ||
46 | 48 | ||
47 | return resultMap; | 49 | return resultMap; |
48 | } | 50 | } |
49 | - | 51 | + |
52 | + /** | ||
53 | + * 查询一天就会到期的库存 | ||
54 | + * @return | ||
55 | + */ | ||
56 | + public List<StorageDeposit> selectNeddRemindDeposit() { | ||
57 | + return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() - 24 * 60 * 60); | ||
58 | + } | ||
59 | + | ||
60 | + | ||
50 | @Override | 61 | @Override |
51 | public PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req){ | 62 | public PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req){ |
52 | req.setDepotNo(null == req.getDepotNo() ? DEPOT_NO_NANJING : req.getDepotNo()); | 63 | req.setDepotNo(null == req.getDepotNo() ? DEPOT_NO_NANJING : req.getDepotNo()); |
@@ -143,7 +154,19 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ | @@ -143,7 +154,19 @@ public class StorageDepositServiceImpl implements IStorageDepositService{ | ||
143 | 154 | ||
144 | return resultMap; | 155 | return resultMap; |
145 | } | 156 | } |
146 | - | 157 | + |
158 | + public int updateHasRemind(Integer id) { | ||
159 | + return storageDepositMapper.updateHasRemind(id); | ||
160 | + } | ||
161 | + | ||
162 | + public List<StorageDeposit> selectNeddDownDeposit() { | ||
163 | + return storageDepositMapper.selectNeddDownDeposit(DateUtil.getCurrentTimeSeconds()); | ||
164 | + } | ||
165 | + | ||
166 | + public int updateStatus(Integer id, Integer status, int orderStatus){ | ||
167 | + return storageDepositMapper.updateStatus(id, status, orderStatus); | ||
168 | + } | ||
169 | + | ||
147 | private List<StorageDeposit> queryOrderNumByQueryStr(String queryStr, Integer depotNo){ | 170 | private List<StorageDeposit> queryOrderNumByQueryStr(String queryStr, Integer depotNo){ |
148 | //先按订单号来查 | 171 | //先按订单号来查 |
149 | StorageDepositReq req = new StorageDepositReq(); | 172 | StorageDepositReq req = new StorageDepositReq(); |
1 | +package com.yoho.ufo.order.service.scheduled; | ||
2 | + | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yoho.core.rest.client.ServiceCaller; | ||
5 | +import com.yoho.order.model.StorageDeposit; | ||
6 | +import com.yoho.quartz.annotation.JobType; | ||
7 | +import com.yoho.quartz.annotation.MisfiredPolicy; | ||
8 | +import com.yoho.quartz.annotation.YhJobDef; | ||
9 | +import com.yoho.quartz.domain.JobProcessResult; | ||
10 | +import com.yoho.quartz.domain.JobResultCode; | ||
11 | +import com.yoho.quartz.job.YhJob; | ||
12 | +import com.yoho.ufo.order.service.IStorageDepositService; | ||
13 | +import com.yoho.ufo.service.impl.InboxServiceImpl; | ||
14 | +import com.yoho.ufo.service.impl.UfoServiceCaller; | ||
15 | +import com.yoho.ufo.service.impl.UserProxyService; | ||
16 | +import com.yohobuy.ufo.model.common.ApiResponse; | ||
17 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
18 | +import com.yohobuy.ufo.model.message.SmsMessageReq; | ||
19 | +import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; | ||
20 | +import com.yohobuy.ufo.model.resp.product.ProductResponceBo; | ||
21 | +import org.slf4j.Logger; | ||
22 | +import org.slf4j.LoggerFactory; | ||
23 | +import org.springframework.beans.factory.annotation.Autowired; | ||
24 | +import org.springframework.stereotype.Service; | ||
25 | + | ||
26 | +import java.util.List; | ||
27 | + | ||
28 | +/** | ||
29 | + * Created by li.ma on 2019/7/8. | ||
30 | + * 扫描库存到期自动下架 寄回 | ||
31 | + */ | ||
32 | +@Service(value="storageDepositAutoDown") | ||
33 | +@YhJobDef(desc = "库存寄存到期处理", jobName = "storageDepositAutoDown", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING, | ||
34 | + jobType = JobType.CRON, jobGroup = "ufoPlatform") | ||
35 | +public class StorageDepositAutoDown implements YhJob { | ||
36 | + private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog"); | ||
37 | + | ||
38 | + @Autowired | ||
39 | + private IStorageDepositService storageDepositService; | ||
40 | + | ||
41 | + @Autowired | ||
42 | + private ServiceCaller serviceCaller; | ||
43 | + | ||
44 | + | ||
45 | + public JobProcessResult process(String jobContext) { | ||
46 | + LOGGER.info("storageDepositAutoDown begin."); | ||
47 | + JobProcessResult result = new JobProcessResult(); | ||
48 | + List<StorageDeposit> storageDeposits = storageDepositService.selectNeddDownDeposit(); // 查询待通知续约的库存 | ||
49 | + | ||
50 | + storageDeposits.stream().forEach(item -> { | ||
51 | + LOGGER.info("method StorageDepositAutoDown.process item is {}", item); | ||
52 | + | ||
53 | + if (item.getOrderStatus() == 1) { | ||
54 | + boolean offResult = offShelveByErp(item); | ||
55 | + if (offResult) { // 下架成功之后触发,变成待拣货状态 | ||
56 | + storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(), 0); | ||
57 | + } | ||
58 | + } else { // 下架成功之后触发,变成待拣货状态 | ||
59 | + storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(), 0); | ||
60 | + } | ||
61 | + }); | ||
62 | + | ||
63 | + result.setJobResultCode(JobResultCode.SUCCESS); | ||
64 | + LOGGER.info("storageDepositAutoDown end."); | ||
65 | + return result; | ||
66 | + } | ||
67 | + | ||
68 | + private boolean offShelveByErp (StorageDeposit storageDeposit) { | ||
69 | + LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}", storageDeposit); | ||
70 | + try { | ||
71 | + ApiResponse apiResponse = serviceCaller.call("ufo-gateway.offShelveByErp", storageDeposit, ApiResponse.class, 10); // 下架订单 | ||
72 | + if (apiResponse.getCode() == 200) { | ||
73 | + LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}, apiResponse is {}", storageDeposit, apiResponse); | ||
74 | + return true; | ||
75 | + } | ||
76 | + } catch (Exception e) { | ||
77 | + LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}", storageDeposit); | ||
78 | + } | ||
79 | + return false; | ||
80 | + } | ||
81 | +} |
1 | +package com.yoho.ufo.order.service.scheduled; | ||
2 | + | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yoho.order.model.StorageDeposit; | ||
5 | +import com.yoho.quartz.annotation.JobType; | ||
6 | +import com.yoho.quartz.annotation.MisfiredPolicy; | ||
7 | +import com.yoho.quartz.annotation.YhJobDef; | ||
8 | +import com.yoho.quartz.domain.JobProcessResult; | ||
9 | +import com.yoho.quartz.domain.JobResultCode; | ||
10 | +import com.yoho.quartz.job.YhJob; | ||
11 | +import com.yoho.ufo.order.service.IStorageDepositService; | ||
12 | +import com.yoho.ufo.service.impl.InboxServiceImpl; | ||
13 | +import com.yoho.ufo.service.impl.UfoServiceCaller; | ||
14 | +import com.yoho.ufo.service.impl.UserProxyService; | ||
15 | +import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | ||
16 | +import com.yohobuy.ufo.model.message.SmsMessageReq; | ||
17 | +import com.yohobuy.ufo.model.resp.product.ProductResponceBo; | ||
18 | +import com.yohobuy.ufo.model.resp.product.SecondDetailResp; | ||
19 | +import org.slf4j.Logger; | ||
20 | +import org.slf4j.LoggerFactory; | ||
21 | +import org.slf4j.helpers.MessageFormatter; | ||
22 | +import org.springframework.beans.factory.annotation.Autowired; | ||
23 | +import org.springframework.stereotype.Service; | ||
24 | + | ||
25 | +import java.util.List; | ||
26 | + | ||
27 | +/** | ||
28 | + * Created by li.ma on 2019/7/8. | ||
29 | + * 扫描库存到期前24小时的到期提醒 | ||
30 | + */ | ||
31 | +@Service(value="storageDepositRemind") | ||
32 | +@YhJobDef(desc = "库存寄存到期处理", jobName = "storageDepositRemind", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING, | ||
33 | + jobType = JobType.CRON, jobGroup = "ufoPlatform") | ||
34 | +public class StorageDepositRemind implements YhJob { | ||
35 | + private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog"); | ||
36 | + | ||
37 | + @Autowired | ||
38 | + private IStorageDepositService storageDepositService; | ||
39 | + | ||
40 | + @Autowired | ||
41 | + private InboxServiceImpl inboxService; | ||
42 | + | ||
43 | + @Autowired | ||
44 | + private UserProxyService userProxyService; | ||
45 | + | ||
46 | + @Autowired | ||
47 | + private UfoServiceCaller ufoServiceCaller; | ||
48 | + | ||
49 | + public JobProcessResult process(String jobContext) { | ||
50 | + LOGGER.info("StorageDepositRemind begin."); | ||
51 | + JobProcessResult result = new JobProcessResult(); | ||
52 | + List<StorageDeposit> storageDeposits = storageDepositService.selectNeddRemindDeposit(); // 查询待通知续约的库存 | ||
53 | + | ||
54 | + storageDeposits.stream().forEach(item -> { | ||
55 | + | ||
56 | + ProductResponceBo productResponceBo = ufoServiceCaller.call("ufo.product.storageDetial", ProductResponceBo.class, item.getStorageId()); | ||
57 | + LOGGER.info("StorageDepositRemind run. item is {}, productResponceBo is {}", item, productResponceBo); | ||
58 | + | ||
59 | + inboxService.addInboxForPlatformEx(item.getOwnerUid(), InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_REMIND.getType(), | ||
60 | + InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_REMIND.getBusinessType(), | ||
61 | + productResponceBo.getProductName(), productResponceBo.getSizeName(), productResponceBo.getProductCode()); | ||
62 | + | ||
63 | + SmsMessageReq smsReq = new SmsMessageReq(); //发送短信 | ||
64 | + String mobile = userProxyService.getMobile(item.getOwnerUid()); //获取手机号 | ||
65 | + smsReq.setMobileList(Lists.newArrayList(mobile)); | ||
66 | + smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_REMIND.getContent(), productResponceBo.getProductName(), | ||
67 | + productResponceBo.getSizeName(), productResponceBo.getProductCode())); | ||
68 | + inboxService.sendSmsMessage(new SmsMessageReq()); | ||
69 | + | ||
70 | + storageDepositService.updateHasRemind(item.getId()); // 置库存记录为已通知状态 | ||
71 | + }); | ||
72 | + | ||
73 | + result.setJobResultCode(JobResultCode.SUCCESS); | ||
74 | + LOGGER.info("StorageDepositRemind end."); | ||
75 | + return result; | ||
76 | + } | ||
77 | + | ||
78 | + private String getReplacedContent(String content ,Object... params) { | ||
79 | + return MessageFormatter.arrayFormat(content, params).getMessage(); | ||
80 | + } | ||
81 | +} |
@@ -103,4 +103,17 @@ public class StorageController { | @@ -103,4 +103,17 @@ public class StorageController { | ||
103 | Boolean result = storageService.updateSkuStatus(req.getStorageId(), req.getStatus()); | 103 | Boolean result = storageService.updateSkuStatus(req.getStorageId(), req.getStatus()); |
104 | return new com.yoho.ufo.service.model.ApiResponse.ApiResponseBuilder().code(200).data(result).message("更新成功").build(); | 104 | return new com.yoho.ufo.service.model.ApiResponse.ApiResponseBuilder().code(200).data(result).message("更新成功").build(); |
105 | } | 105 | } |
106 | + | ||
107 | + /** | ||
108 | + * 供订单model内部调用 | ||
109 | + * | ||
110 | + */ | ||
111 | + @RequestMapping(params = "method=ufo.product.storageDetial") | ||
112 | + @ResponseBody | ||
113 | + public ProductResponceBo storageDetial(Integer storageId) { | ||
114 | + LOGGER.info("storageDetial begin. storageId is {}", storageId); | ||
115 | + ProductResponceBo result = storageService.storageDetial(storageId); | ||
116 | + LOGGER.info("storageDetial success. storageId is {}", storageId); | ||
117 | + return result; | ||
118 | + } | ||
106 | } | 119 | } |
@@ -13,6 +13,8 @@ import java.util.Map; | @@ -13,6 +13,8 @@ import java.util.Map; | ||
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | 15 | ||
16 | +import com.alibaba.fastjson.JSON; | ||
17 | +import com.alibaba.fastjson.JSONObject; | ||
16 | import com.yohobuy.ufo.model.order.bo.SellerBo; | 18 | import com.yohobuy.ufo.model.order.bo.SellerBo; |
17 | import org.apache.commons.collections.CollectionUtils; | 19 | import org.apache.commons.collections.CollectionUtils; |
18 | import org.apache.commons.collections.map.HashedMap; | 20 | import org.apache.commons.collections.map.HashedMap; |
@@ -53,7 +55,6 @@ import com.yoho.ufo.dal.model.ProductLimitSale; | @@ -53,7 +55,6 @@ import com.yoho.ufo.dal.model.ProductLimitSale; | ||
53 | import com.yoho.ufo.dal.model.ProductSales; | 55 | import com.yoho.ufo.dal.model.ProductSales; |
54 | import com.yoho.ufo.dal.model.Storage; | 56 | import com.yoho.ufo.dal.model.Storage; |
55 | import com.yoho.ufo.dal.model.StoragePrice; | 57 | import com.yoho.ufo.dal.model.StoragePrice; |
56 | -import com.yoho.ufo.event.model.StorageNumEvent; | ||
57 | import com.yoho.ufo.exception.CommonException; | 58 | import com.yoho.ufo.exception.CommonException; |
58 | import com.yoho.ufo.exception.PlatformException; | 59 | import com.yoho.ufo.exception.PlatformException; |
59 | import com.yoho.ufo.model.brand.Brand; | 60 | import com.yoho.ufo.model.brand.Brand; |
@@ -62,7 +63,6 @@ import com.yoho.ufo.model.commoditybasicrole.category.ProductSort; | @@ -62,7 +63,6 @@ import com.yoho.ufo.model.commoditybasicrole.category.ProductSort; | ||
62 | import com.yoho.ufo.model.commoditybasicrole.color.ProductColor; | 63 | import com.yoho.ufo.model.commoditybasicrole.color.ProductColor; |
63 | import com.yoho.ufo.model.commoditybasicrole.size.Size; | 64 | import com.yoho.ufo.model.commoditybasicrole.size.Size; |
64 | import com.yoho.ufo.service.IProductService; | 65 | import com.yoho.ufo.service.IProductService; |
65 | -import com.yoho.ufo.service.UserProxyService; | ||
66 | import com.yoho.ufo.util.CollectionUtil; | 66 | import com.yoho.ufo.util.CollectionUtil; |
67 | import com.yoho.ufo.util.DateUtil; | 67 | import com.yoho.ufo.util.DateUtil; |
68 | import com.yoho.ufo.util.ImagesConstant; | 68 | import com.yoho.ufo.util.ImagesConstant; |
@@ -930,7 +930,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | @@ -930,7 +930,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | ||
930 | } | 930 | } |
931 | return new ApiResponse<>(200, "查询成功", item); | 931 | return new ApiResponse<>(200, "查询成功", item); |
932 | } | 932 | } |
933 | - | 933 | + private static final int HK_AREA_CODE = 852; |
934 | @Override | 934 | @Override |
935 | public ApiResponse<Integer> batchImportFromXls(MultipartFile file, Integer editUid) throws Exception { | 935 | public ApiResponse<Integer> batchImportFromXls(MultipartFile file, Integer editUid) throws Exception { |
936 | LOGGER.info("用户{}开始导入商品数据!", editUid); | 936 | LOGGER.info("用户{}开始导入商品数据!", editUid); |
@@ -1127,8 +1127,11 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | @@ -1127,8 +1127,11 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | ||
1127 | AddressInfo addressHidden = null; | 1127 | AddressInfo addressHidden = null; |
1128 | if(userResp.isLargeSettlementSuper()) { | 1128 | if(userResp.isLargeSettlementSuper()) { |
1129 | address = new AddressInfo(); | 1129 | address = new AddressInfo(); |
1130 | + String areaCode = String.valueOf(HK_AREA_CODE); | ||
1131 | + address.setAreaCode(areaCode); | ||
1130 | address.setAddress("香港客户地址"); | 1132 | address.setAddress("香港客户地址"); |
1131 | addressHidden = new AddressInfo(); | 1133 | addressHidden = new AddressInfo(); |
1134 | + addressHidden.setAreaCode(areaCode); | ||
1132 | addressHidden.setAddress("香港客户地址"); | 1135 | addressHidden.setAddress("香港客户地址"); |
1133 | } else { | 1136 | } else { |
1134 | try { | 1137 | try { |
@@ -1188,13 +1191,16 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | @@ -1188,13 +1191,16 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw | ||
1188 | ApiResponse response = null; | 1191 | ApiResponse response = null; |
1189 | try { | 1192 | try { |
1190 | LOGGER.info("batch import send taskId={}, batchId={}", tran.getId(), (i + 1)); | 1193 | LOGGER.info("batch import send taskId={}, batchId={}", tran.getId(), (i + 1)); |
1191 | - response = serviceCaller.call("ufo-gateway.batchImportPrds", batchReq, ApiResponse.class, 10); | ||
1192 | - LOGGER.info("batch import send success taskId={}, batchId={}", tran.getId(), (i + 1)); | 1194 | + JSONObject res = serviceCaller.call("ufo-gateway.batchImportPrds", batchReq, JSONObject.class, 10); |
1195 | + LOGGER.info("batch import send success taskId={}, batchId={}, resp={}", tran.getId(), (i + 1), res); | ||
1196 | + if (res != null) { | ||
1197 | + response = res.toJavaObject(ApiResponse.class); | ||
1198 | + } | ||
1193 | } catch (Exception e) { | 1199 | } catch (Exception e) { |
1194 | LOGGER.info("batch import send failed taskId={}, batchId={}, err={}", tran.getId(), (i + 1), e); | 1200 | LOGGER.info("batch import send failed taskId={}, batchId={}, err={}", tran.getId(), (i + 1), e); |
1195 | } | 1201 | } |
1196 | if (response != null && response.getCode() != 200) { | 1202 | if (response != null && response.getCode() != 200) { |
1197 | - LOGGER.info("batch import send failed broke taskId={}, batchId={}, resp={}", tran.getId(), (i + 1), response); | 1203 | + LOGGER.info("batch import send failed broke taskId={}, batchId={}, respObj={}", tran.getId(), (i + 1), JSON.toJSONString(response)); |
1198 | throw new PlatformException("导入出错:" + response.getMessage(), response.getCode()); | 1204 | throw new PlatformException("导入出错:" + response.getMessage(), response.getCode()); |
1199 | } | 1205 | } |
1200 | } | 1206 | } |
@@ -20,7 +20,6 @@ import com.yoho.product.model.SelfShelvesReq; | @@ -20,7 +20,6 @@ import com.yoho.product.model.SelfShelvesReq; | ||
20 | import com.yoho.product.model.SelfShelvesRsp; | 20 | import com.yoho.product.model.SelfShelvesRsp; |
21 | import com.yoho.ufo.exception.PlatformException; | 21 | import com.yoho.ufo.exception.PlatformException; |
22 | import com.yoho.ufo.service.ISelfShelvesService; | 22 | import com.yoho.ufo.service.ISelfShelvesService; |
23 | -import com.yoho.ufo.service.UserProxyService; | ||
24 | import com.yoho.ufo.service.model.PageResponseBO; | 23 | import com.yoho.ufo.service.model.PageResponseBO; |
25 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | 24 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; |
26 | import com.yohobuy.ufo.model.message.SmsMessageReq; | 25 | import com.yohobuy.ufo.model.message.SmsMessageReq; |
@@ -38,7 +38,6 @@ import com.yoho.ufo.exception.PlatformException; | @@ -38,7 +38,6 @@ import com.yoho.ufo.exception.PlatformException; | ||
38 | import com.yoho.ufo.model.brand.Brand; | 38 | import com.yoho.ufo.model.brand.Brand; |
39 | import com.yoho.ufo.model.commoditybasicrole.size.Size; | 39 | import com.yoho.ufo.model.commoditybasicrole.size.Size; |
40 | import com.yoho.ufo.service.ISelfSizeService; | 40 | import com.yoho.ufo.service.ISelfSizeService; |
41 | -import com.yoho.ufo.service.UserProxyService; | ||
42 | import com.yoho.ufo.service.model.PageResponseBO; | 41 | import com.yoho.ufo.service.model.PageResponseBO; |
43 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | 42 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; |
44 | import com.yohobuy.ufo.model.message.SmsMessageReq; | 43 | import com.yohobuy.ufo.model.message.SmsMessageReq; |
1 | package com.yoho.ufo.service.impl; | 1 | package com.yoho.ufo.service.impl; |
2 | 2 | ||
3 | +import com.google.common.collect.Lists; | ||
3 | import com.yoho.core.common.utils.DateUtil; | 4 | import com.yoho.core.common.utils.DateUtil; |
4 | import com.yoho.product.model.SecondhandImages; | 5 | import com.yoho.product.model.SecondhandImages; |
5 | import com.yoho.product.model.SecondhandInfo; | 6 | import com.yoho.product.model.SecondhandInfo; |
6 | import com.yoho.ufo.convert.ProductConvertService; | 7 | import com.yoho.ufo.convert.ProductConvertService; |
7 | -import com.yoho.ufo.dal.GoodsMapper; | ||
8 | -import com.yoho.ufo.dal.ProductMapper; | ||
9 | -import com.yoho.ufo.dal.StorageMapper; | ||
10 | -import com.yoho.ufo.dal.StoragePriceMapper; | 8 | +import com.yoho.ufo.dal.*; |
11 | import com.yoho.ufo.dal.model.*; | 9 | import com.yoho.ufo.dal.model.*; |
10 | +import com.yoho.ufo.model.commoditybasicrole.size.Size; | ||
12 | import com.yoho.ufo.util.*; | 11 | import com.yoho.ufo.util.*; |
13 | import com.yohobuy.ufo.model.common.ApiResponse; | 12 | import com.yohobuy.ufo.model.common.ApiResponse; |
14 | import com.yohobuy.ufo.model.common.PageResponseBO; | 13 | import com.yohobuy.ufo.model.common.PageResponseBO; |
@@ -16,6 +15,7 @@ import com.yohobuy.ufo.model.request.product.ProductRequestBo; | @@ -16,6 +15,7 @@ import com.yohobuy.ufo.model.request.product.ProductRequestBo; | ||
16 | import com.yohobuy.ufo.model.resp.product.ProductResponceBo; | 15 | import com.yohobuy.ufo.model.resp.product.ProductResponceBo; |
17 | import com.yohobuy.ufo.model.resp.product.SecondDetailResp; | 16 | import com.yohobuy.ufo.model.resp.product.SecondDetailResp; |
18 | import com.yohobuy.ufo.model.resp.product.SkupImageInfo; | 17 | import com.yohobuy.ufo.model.resp.product.SkupImageInfo; |
18 | +import org.apache.commons.collections.CollectionUtils; | ||
19 | import org.apache.poi.ss.usermodel.Workbook; | 19 | import org.apache.poi.ss.usermodel.Workbook; |
20 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
21 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
@@ -64,6 +64,9 @@ public class StorageService { | @@ -64,6 +64,9 @@ public class StorageService { | ||
64 | @Autowired | 64 | @Autowired |
65 | private StorageMapper storageMapper; | 65 | private StorageMapper storageMapper; |
66 | 66 | ||
67 | + @Autowired | ||
68 | + private UfoSizeMapper sizeMapper; | ||
69 | + | ||
67 | private static final Integer DEFAULT_SKUP_STATUS = 1; | 70 | private static final Integer DEFAULT_SKUP_STATUS = 1; |
68 | 71 | ||
69 | //商品编码 商品名称 品牌 最低价 可售库存 | 72 | //商品编码 商品名称 品牌 最低价 可售库存 |
@@ -360,4 +363,23 @@ public class StorageService { | @@ -360,4 +363,23 @@ public class StorageService { | ||
360 | } | 363 | } |
361 | return storageMapper.updateSkuStatus(storageId, status) > 0; | 364 | return storageMapper.updateSkuStatus(storageId, status) > 0; |
362 | } | 365 | } |
366 | + | ||
367 | + public ProductResponceBo storageDetial(Integer storageId) { | ||
368 | + ProductResponceBo productResponceBo = new ProductResponceBo(); | ||
369 | + Storage storage = storageMapper.selectByPrimaryKey(storageId); | ||
370 | + if (storage == null) { | ||
371 | + return productResponceBo; | ||
372 | + } | ||
373 | + | ||
374 | + List<Size> sizes = sizeMapper.selectByIdList(Lists.newArrayList(storage.getSizeId())); | ||
375 | + productResponceBo.setSizeName(CollectionUtils.isNotEmpty(sizes) ? sizes.get(0).getSizeName() : ""); | ||
376 | + | ||
377 | + Product product = productMapper.selectByPrimaryKey(storage.getProductId()); | ||
378 | + if (null != product) { | ||
379 | + productResponceBo.setProductName(product.getProductName()); | ||
380 | + productResponceBo.setProductCode(product.getProductCode()); | ||
381 | + } | ||
382 | + | ||
383 | + return productResponceBo; | ||
384 | + } | ||
363 | } | 385 | } |
-
Please register or login to post a comment