Authored by caoyan

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
... ... @@ -71,5 +71,9 @@
<groupId>com.yoho.ufo.model</groupId>
<artifactId>user-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>product-ufo-model</artifactId>
</dependency>
</dependencies>
</project>
... ...
package com.yoho.ufo.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -49,4 +50,28 @@ public class InboxServiceImpl {
LOGGER.info("addInboxForPlatform.sendSmsMessage call result is {}", jsonObject);
}
// 发送站内信
public void addInboxForPlatformEx(int uid, Integer type, Integer businessType, Object... params){
InboxReqVO reqVO = InboxReqVO.builder().businessType(businessType).params(buildParams(params)).type(type).uid(uid).build();
LOGGER.info("addInboxForPlatform.addInbox with reqVO is {}", reqVO);
String jsonObject = serviceCaller.asyncCall("ufo-gateway.addInboxForPlatform", reqVO, String.class).get();
LOGGER.info("addInboxForPlatform.addInbox call result is {}", jsonObject);
}
private String buildParams(Object... objects) {
if (objects == null) {
return null;
}
if (objects.length == 1) {
return objects[0].toString();
}
String params = StringUtils.join(objects, ",");
return params;
}
}
... ...
package com.yoho.ufo.service;
package com.yoho.ufo.service.impl;
import java.util.List;
import java.util.Map;
... ... @@ -6,6 +6,7 @@ import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.yoho.ufo.util.AddressInfoConvertor;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -22,7 +23,6 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.request.UserAddressReqBO;
import com.yoho.service.model.response.ProfileInfoRsp;
import com.yoho.ufo.convert.AddressInfoConvertor;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
... ...
package com.yoho.ufo.convert;
package com.yoho.ufo.util;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
... ...
... ... @@ -17,4 +17,33 @@ public interface StorageDepositMapper {
List<StorageDeposit> selectByCondition(@Param("storageDepositReq") StorageDepositReq req);
/**
* 查询需要提醒库存续约的集合
* @param curTime
* @return
*/
List<StorageDeposit> selectNeddRemindDeposit(@Param("curTime") Integer curTime);
/**
* 更新通知快到期的状态
* @param id
* @return
*/
int updateHasRemind(@Param("id")Integer id);
/**
* 查询需要寄回给卖家的库存
* @param curTime
* @return
*/
List<StorageDeposit> selectNeddDownDeposit(@Param("curTime") Integer curTime);
/**
* 更新状态为待拣货状态,必须要是订单下架状态
* @param id
* @param status
* @param orderStatus
* @return
*/
int updateStatus(@Param("id")Integer id, @Param("status")Integer status, @Param("orderStatus")int orderStatus);
}
\ No newline at end of file
... ...
package com.yoho.order.model;
import lombok.Data;
import lombok.ToString;
@ToString
@Data
public class StorageDeposit {
private Integer id;
... ... @@ -38,140 +40,7 @@ public class StorageDeposit {
private Integer outType;
public Integer getId() {
return id;
}
private Integer delStatus;
public void setId(Integer id) {
this.id = id;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public String getDepositCode() {
return depositCode;
}
public void setDepositCode(String depositCode) {
this.depositCode = depositCode;
}
public String getShelfCode() {
return shelfCode;
}
public void setShelfCode(String shelfCode) {
this.shelfCode = shelfCode;
}
public Integer getOwnerUid() {
return ownerUid;
}
public void setOwnerUid(Integer ownerUid) {
this.ownerUid = ownerUid;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public Integer getSkup() {
return skup;
}
public void setSkup(Integer skup) {
this.skup = skup;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getDepositStartTime() {
return depositStartTime;
}
public void setDepositStartTime(Integer depositStartTime) {
this.depositStartTime = depositStartTime;
}
public Integer getDepositEndTime() {
return depositEndTime;
}
public void setDepositEndTime(Integer depositEndTime) {
this.depositEndTime = depositEndTime;
}
public Integer getEditPid() {
return editPid;
}
public void setEditPid(Integer editPid) {
this.editPid = editPid;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOutType() {
return outType;
}
public void setOutType(Integer outType) {
this.outType = outType;
}
private Integer remindStatus;
}
\ No newline at end of file
... ...
... ... @@ -18,13 +18,15 @@
<result column="deposit_start_time" property="depositStartTime" jdbcType="INTEGER" />
<result column="deposit_end_time" property="depositEndTime" jdbcType="INTEGER" />
<result column="edit_pid" property="editPid" jdbcType="INTEGER" />
<result column="del_status" property="delStatus" jdbcType="INTEGER" />
<result column="remind_status" property="remindStatus" jdbcType="INTEGER" />
<result column="out_type" property="outType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
skup, status, order_status, update_time, create_time, deposit_start_time,
deposit_end_time, edit_pid, out_type
deposit_end_time, edit_pid, out_type, del_status, remind_status
</sql>
<insert id="insert" parameterType="com.yoho.order.model.StorageDeposit">
... ... @@ -84,5 +86,22 @@
limit #{storageDepositReq.start},#{storageDepositReq.size}
</if>
</select>
<select id="selectNeddRemindDeposit" resultMap="BaseResultMap">
select a.*
from storage_deposit a WHERE del_status = 0 and deposit_end_time &lt;= #{curTime} and remind_status = 0 AND status = 1
</select>
<update id="updateHasRemind">
UPDATE storage_deposit a SET remind_status = 1 WHERE id = #{id}
</update>
<select id="selectNeddDownDeposit" resultMap="BaseResultMap">
select a.*
from storage_deposit a WHERE del_status = 0 and deposit_end_time &lt;= #{curTime} AND status = 1
</select>
<update id="updateStatus">
UPDATE storage_deposit a SET status = #{status} WHERE id = #{id} AND order_status = #{orderStatus}
</update>
</mapper>
\ No newline at end of file
... ...
package com.yoho.ufo.order.service;
import java.util.List;
import java.util.Map;
import com.yoho.order.model.StorageDeposit;
import com.yoho.order.model.StorageDepositReq;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.StorageDepositRsp;
import com.yoho.ufo.service.model.PageResponseBO;
public interface IStorageDepositService {
Map<String, Integer> getCountByStatus(StorageDepositReq req);
List<StorageDeposit> selectNeddRemindDeposit();
int updateHasRemind(@Param("id")Integer id);
List<StorageDeposit> selectNeddDownDeposit();
int updateStatus(@Param("id")Integer id, @Param("status")Integer status, @Param("orderStatus")int orderStatus);
PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req);
}
... ...
... ... @@ -309,7 +309,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
//问题单
private static final Byte QC_STATUS_PROBLEM = 3;
//待入库
//待处理
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); //平台质检中
... ...
... ... @@ -3,8 +3,10 @@ package com.yoho.ufo.order.service.impl;
import java.util.List;
import java.util.Map;
import com.yoho.ufo.util.DateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.elasticsearch.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -46,7 +48,16 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
return resultMap;
}
/**
* 查询一天就会到期的库存
* @return
*/
public List<StorageDeposit> selectNeddRemindDeposit() {
return storageDepositMapper.selectNeddRemindDeposit(DateUtil.getCurrentTimeSeconds() - 24 * 60 * 60);
}
@Override
public PageResponseBO<StorageDepositRsp> queryDepositListByStatus(StorageDepositReq req){
req.setDepotNo(null == req.getDepotNo() ? DEPOT_NO_NANJING : req.getDepotNo());
... ... @@ -143,7 +154,19 @@ public class StorageDepositServiceImpl implements IStorageDepositService{
return resultMap;
}
public int updateHasRemind(Integer id) {
return storageDepositMapper.updateHasRemind(id);
}
public List<StorageDeposit> selectNeddDownDeposit() {
return storageDepositMapper.selectNeddDownDeposit(DateUtil.getCurrentTimeSeconds());
}
public int updateStatus(Integer id, Integer status, int orderStatus){
return storageDepositMapper.updateStatus(id, status, orderStatus);
}
private List<StorageDeposit> queryOrderNumByQueryStr(String queryStr, Integer depotNo){
//先按订单号来查
StorageDepositReq req = new StorageDepositReq();
... ...
package com.yoho.ufo.order.service.scheduled;
import com.google.common.collect.Lists;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.model.StorageDeposit;
import com.yoho.quartz.annotation.JobType;
import com.yoho.quartz.annotation.MisfiredPolicy;
import com.yoho.quartz.annotation.YhJobDef;
import com.yoho.quartz.domain.JobProcessResult;
import com.yoho.quartz.domain.JobResultCode;
import com.yoho.quartz.job.YhJob;
import com.yoho.ufo.order.service.IStorageDepositService;
import com.yoho.ufo.service.impl.InboxServiceImpl;
import com.yoho.ufo.service.impl.UfoServiceCaller;
import com.yoho.ufo.service.impl.UserProxyService;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.message.SmsMessageReq;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by li.ma on 2019/7/8.
* 扫描库存到期自动下架 寄回
*/
@Service(value="storageDepositAutoDown")
@YhJobDef(desc = "库存寄存到期处理", jobName = "storageDepositAutoDown", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING,
jobType = JobType.CRON, jobGroup = "ufoPlatform")
public class StorageDepositAutoDown implements YhJob {
private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog");
@Autowired
private IStorageDepositService storageDepositService;
@Autowired
private ServiceCaller serviceCaller;
public JobProcessResult process(String jobContext) {
LOGGER.info("storageDepositAutoDown begin.");
JobProcessResult result = new JobProcessResult();
List<StorageDeposit> storageDeposits = storageDepositService.selectNeddDownDeposit(); // 查询待通知续约的库存
storageDeposits.stream().forEach(item -> {
LOGGER.info("method StorageDepositAutoDown.process item is {}", item);
if (item.getOrderStatus() == 1) {
boolean offResult = offShelveByErp(item);
if (offResult) { // 下架成功之后触发,变成待拣货状态
storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(), 0);
}
} else { // 下架成功之后触发,变成待拣货状态
storageDepositService.updateStatus(item.getId(), StorageDepositStatusEnum.WAITING_QUERY.getCode(), 0);
}
});
result.setJobResultCode(JobResultCode.SUCCESS);
LOGGER.info("storageDepositAutoDown end.");
return result;
}
private boolean offShelveByErp (StorageDeposit storageDeposit) {
LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}", storageDeposit);
try {
ApiResponse apiResponse = serviceCaller.call("ufo-gateway.offShelveByErp", storageDeposit, ApiResponse.class, 10); // 下架订单
if (apiResponse.getCode() == 200) {
LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}, apiResponse is {}", storageDeposit, apiResponse);
return true;
}
} catch (Exception e) {
LOGGER.info("method StorageDepositAutoDown.offShelveByErp storageDeposit is {}", storageDeposit);
}
return false;
}
}
... ...
package com.yoho.ufo.order.service.scheduled;
import com.google.common.collect.Lists;
import com.yoho.order.model.StorageDeposit;
import com.yoho.quartz.annotation.JobType;
import com.yoho.quartz.annotation.MisfiredPolicy;
import com.yoho.quartz.annotation.YhJobDef;
import com.yoho.quartz.domain.JobProcessResult;
import com.yoho.quartz.domain.JobResultCode;
import com.yoho.quartz.job.YhJob;
import com.yoho.ufo.order.service.IStorageDepositService;
import com.yoho.ufo.service.impl.InboxServiceImpl;
import com.yoho.ufo.service.impl.UfoServiceCaller;
import com.yoho.ufo.service.impl.UserProxyService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.message.SmsMessageReq;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by li.ma on 2019/7/8.
* 扫描库存到期前24小时的到期提醒
*/
@Service(value="storageDepositRemind")
@YhJobDef(desc = "库存寄存到期处理", jobName = "storageDepositRemind", cron = "0 0/10 * * * ?", misfiredPolicy = MisfiredPolicy.CRON_DO_NOTHING,
jobType = JobType.CRON, jobGroup = "ufoPlatform")
public class StorageDepositRemind implements YhJob {
private static final Logger LOGGER = LoggerFactory.getLogger("scheduledLog");
@Autowired
private IStorageDepositService storageDepositService;
@Autowired
private InboxServiceImpl inboxService;
@Autowired
private UserProxyService userProxyService;
@Autowired
private UfoServiceCaller ufoServiceCaller;
public JobProcessResult process(String jobContext) {
LOGGER.info("StorageDepositRemind begin.");
JobProcessResult result = new JobProcessResult();
List<StorageDeposit> storageDeposits = storageDepositService.selectNeddRemindDeposit(); // 查询待通知续约的库存
storageDeposits.stream().forEach(item -> {
ProductResponceBo productResponceBo = ufoServiceCaller.call("ufo.product.storageDetial", ProductResponceBo.class, item.getStorageId());
LOGGER.info("StorageDepositRemind run. item is {}, productResponceBo is {}", item, productResponceBo);
inboxService.addInboxForPlatformEx(item.getOwnerUid(), InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_REMIND.getType(),
InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_REMIND.getBusinessType(),
productResponceBo.getProductName(), productResponceBo.getSizeName(), productResponceBo.getProductCode());
SmsMessageReq smsReq = new SmsMessageReq(); //发送短信
String mobile = userProxyService.getMobile(item.getOwnerUid()); //获取手机号
smsReq.setMobileList(Lists.newArrayList(mobile));
smsReq.setContent(getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_REMIND.getContent(), productResponceBo.getProductName(),
productResponceBo.getSizeName(), productResponceBo.getProductCode()));
inboxService.sendSmsMessage(new SmsMessageReq());
storageDepositService.updateHasRemind(item.getId()); // 置库存记录为已通知状态
});
result.setJobResultCode(JobResultCode.SUCCESS);
LOGGER.info("StorageDepositRemind end.");
return result;
}
private String getReplacedContent(String content ,Object... params) {
return MessageFormatter.arrayFormat(content, params).getMessage();
}
}
... ...
... ... @@ -103,4 +103,17 @@ public class StorageController {
Boolean result = storageService.updateSkuStatus(req.getStorageId(), req.getStatus());
return new com.yoho.ufo.service.model.ApiResponse.ApiResponseBuilder().code(200).data(result).message("更新成功").build();
}
/**
* 供订单model内部调用
*
*/
@RequestMapping(params = "method=ufo.product.storageDetial")
@ResponseBody
public ProductResponceBo storageDetial(Integer storageId) {
LOGGER.info("storageDetial begin. storageId is {}", storageId);
ProductResponceBo result = storageService.storageDetial(storageId);
LOGGER.info("storageDetial success. storageId is {}", storageId);
return result;
}
}
... ...
... ... @@ -13,6 +13,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
... ... @@ -53,7 +55,6 @@ import com.yoho.ufo.dal.model.ProductLimitSale;
import com.yoho.ufo.dal.model.ProductSales;
import com.yoho.ufo.dal.model.Storage;
import com.yoho.ufo.dal.model.StoragePrice;
import com.yoho.ufo.event.model.StorageNumEvent;
import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.model.brand.Brand;
... ... @@ -62,7 +63,6 @@ import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yoho.ufo.model.commoditybasicrole.color.ProductColor;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.service.IProductService;
import com.yoho.ufo.service.UserProxyService;
import com.yoho.ufo.util.CollectionUtil;
import com.yoho.ufo.util.DateUtil;
import com.yoho.ufo.util.ImagesConstant;
... ... @@ -930,7 +930,7 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
}
return new ApiResponse<>(200, "查询成功", item);
}
private static final int HK_AREA_CODE = 852;
@Override
public ApiResponse<Integer> batchImportFromXls(MultipartFile file, Integer editUid) throws Exception {
LOGGER.info("用户{}开始导入商品数据!", editUid);
... ... @@ -1127,8 +1127,11 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
AddressInfo addressHidden = null;
if(userResp.isLargeSettlementSuper()) {
address = new AddressInfo();
String areaCode = String.valueOf(HK_AREA_CODE);
address.setAreaCode(areaCode);
address.setAddress("香港客户地址");
addressHidden = new AddressInfo();
addressHidden.setAreaCode(areaCode);
addressHidden.setAddress("香港客户地址");
} else {
try {
... ... @@ -1188,13 +1191,16 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
ApiResponse response = null;
try {
LOGGER.info("batch import send taskId={}, batchId={}", tran.getId(), (i + 1));
response = serviceCaller.call("ufo-gateway.batchImportPrds", batchReq, ApiResponse.class, 10);
LOGGER.info("batch import send success taskId={}, batchId={}", tran.getId(), (i + 1));
JSONObject res = serviceCaller.call("ufo-gateway.batchImportPrds", batchReq, JSONObject.class, 10);
LOGGER.info("batch import send success taskId={}, batchId={}, resp={}", tran.getId(), (i + 1), res);
if (res != null) {
response = res.toJavaObject(ApiResponse.class);
}
} catch (Exception e) {
LOGGER.info("batch import send failed taskId={}, batchId={}, err={}", tran.getId(), (i + 1), e);
}
if (response != null && response.getCode() != 200) {
LOGGER.info("batch import send failed broke taskId={}, batchId={}, resp={}", tran.getId(), (i + 1), response);
LOGGER.info("batch import send failed broke taskId={}, batchId={}, respObj={}", tran.getId(), (i + 1), JSON.toJSONString(response));
throw new PlatformException("导入出错:" + response.getMessage(), response.getCode());
}
}
... ...
... ... @@ -20,7 +20,6 @@ import com.yoho.product.model.SelfShelvesReq;
import com.yoho.product.model.SelfShelvesRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.service.ISelfShelvesService;
import com.yoho.ufo.service.UserProxyService;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.message.SmsMessageReq;
... ...
... ... @@ -38,7 +38,6 @@ import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.model.brand.Brand;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.service.ISelfSizeService;
import com.yoho.ufo.service.UserProxyService;
import com.yoho.ufo.service.model.PageResponseBO;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.message.SmsMessageReq;
... ...
package com.yoho.ufo.service.impl;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.product.model.SecondhandImages;
import com.yoho.product.model.SecondhandInfo;
import com.yoho.ufo.convert.ProductConvertService;
import com.yoho.ufo.dal.GoodsMapper;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.StorageMapper;
import com.yoho.ufo.dal.StoragePriceMapper;
import com.yoho.ufo.dal.*;
import com.yoho.ufo.dal.model.*;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.util.*;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
... ... @@ -16,6 +15,7 @@ import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.resp.product.ProductResponceBo;
import com.yohobuy.ufo.model.resp.product.SecondDetailResp;
import com.yohobuy.ufo.model.resp.product.SkupImageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -64,6 +64,9 @@ public class StorageService {
@Autowired
private StorageMapper storageMapper;
@Autowired
private UfoSizeMapper sizeMapper;
private static final Integer DEFAULT_SKUP_STATUS = 1;
//商品编码 商品名称 品牌 最低价 可售库存
... ... @@ -360,4 +363,23 @@ public class StorageService {
}
return storageMapper.updateSkuStatus(storageId, status) > 0;
}
public ProductResponceBo storageDetial(Integer storageId) {
ProductResponceBo productResponceBo = new ProductResponceBo();
Storage storage = storageMapper.selectByPrimaryKey(storageId);
if (storage == null) {
return productResponceBo;
}
List<Size> sizes = sizeMapper.selectByIdList(Lists.newArrayList(storage.getSizeId()));
productResponceBo.setSizeName(CollectionUtils.isNotEmpty(sizes) ? sizes.get(0).getSizeName() : "");
Product product = productMapper.selectByPrimaryKey(storage.getProductId());
if (null != product) {
productResponceBo.setProductName(product.getProductName());
productResponceBo.setProductCode(product.getProductCode());
}
return productResponceBo;
}
}
... ...