Authored by chenchao

Merge branch 'dev_order' into test6.8.2

# Conflicts:
#	web/src/main/resources/databases.yml
#	web/src/main/webapp/META-INF/autoconf/databases.yml
... ... @@ -23,12 +23,30 @@ public interface SellerOrderGoodsMapper {
int updateByPrimaryKey(SellerOrderGoods record);
/**
* GBB is group by batch no
* @param uid
* @param statusList
* @return
*/
int selectCntByUidStatusGBBNList(@Param("uid")int uid, @Param("statusList") List<Integer> statusList);
int selectCntByUidStatusList(@Param("uid")int uid, @Param("statusList") List<Integer> statusList);
List<SellerOrderGoods> selectByUidStatusList(@Param("uid")int uid,
@Param("statusList") List<Integer> statusList,
@Param("offset")Integer offset,
@Param("limit")Integer limit);
/**
* GBB is group by batch no
* @param uid
* @param statusList
* @return
*/
List<SellerOrderGoods> selectByUidStatusGBBNList(@Param("uid")int uid,
@Param("statusList") List<Integer> statusList,
@Param("offset")Integer offset,
@Param("limit")Integer limit);
int selectCntByUid(@Param("uid")int uid);
... ...
... ... @@ -35,6 +35,8 @@ public class SellerOrderGoods {
private Long batchNo;
private Integer num;
public String getImageUrl() {
return imageUrl;
}
... ... @@ -164,4 +166,12 @@ public class SellerOrderGoods {
public void setBatchNo(Long batchNo) {
this.batchNo = batchNo;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
}
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="is_del" jdbcType="TINYINT" property="isDel" />
<result column="batch_no" jdbcType="BIGINT" property="batchNo" />
<result column="num" jdbcType="INTEGER" property="num" />
</resultMap>
<sql id="Base_Column_List">
id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name,
... ... @@ -79,7 +79,6 @@
select count(*) from seller_order_goods where <include refid="sql_where_4_select_UidStatusList"/>
</select>
<select id="selectCntByUid" resultType="java.lang.Integer">
select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER}
</select>
... ... @@ -278,4 +277,26 @@
status = #{status,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<sql id="sql_where_4_select_UidStatusGBBNList">
uid = #{uid,jdbcType=INTEGER} and is_del = 1
<if test="statusList != null">
and status in
<foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
#{status, jdbcType=TINYINT}
</foreach>
</if>
group by batch_no , goods_price
</sql>
<select id="selectCntByUidStatusGBBNList" resultType="java.lang.Integer">
SELECT COUNT(*) FROM (SELECT batch_no FROM `seller_order_goods`
WHERE <include refid="sql_where_4_select_UidStatusGBBNList"/> ) t
</select>
<select id="selectByUidStatusGBBNList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />,count(*) num from seller_order_goods
where <include refid="sql_where_4_select_UidStatusGBBNList"/>
order by id desc
limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.controller;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.impl.SellerFeeService;
import com.yohoufo.order.service.impl.SellerOrderService;
... ...
... ... @@ -142,6 +142,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(orderInfo.getAmount());
swd.setIsBatch(0);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("充值后,处理增加钱包明细,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
logger.info("充值后,处理增加钱包明细成功,orderCode={}", orderInfo.getOrderCode());
... ... @@ -354,6 +355,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(amount);
swd.setIsBatch(isBatch);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("退还保证金,钱包明细记录,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
logger.info("退还保证金,钱包明细记录成功,bean={}", swd);
... ... @@ -395,6 +397,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(amount);
swd.setIsBatch(0);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("商家退出,退还保证金,钱包归零处理,增加扣减明细,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
... ... @@ -403,7 +406,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
// 支付保证金:明细
private SellerWalletDetail addUseEarnestDetail(SellerWallet sw, long orderCode, BigDecimal amount, Integer isBatch) {
Integer uid = sw.getId();
Integer uid = sw.getUid();
SellerWalletDetail swd = new SellerWalletDetail();
swd.setOrderCode(orderCode);
swd.setType(2);
... ... @@ -412,6 +415,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(amount);
swd.setIsBatch(isBatch);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("支付保证金,钱包明细记录,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
logger.info("支付保证金,钱包明细记录成功,bean={}", swd);
... ... @@ -420,7 +424,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
// 修改价格支付保证金:明细
private SellerWalletDetail addChangePriceWalletDetail(SellerWallet sw, long orderCode, BigDecimal amount, Integer isBatch) {
Integer uid = sw.getId();
Integer uid = sw.getUid();
SellerWalletDetail swd = new SellerWalletDetail();
swd.setOrderCode(orderCode);
swd.setType(4);
... ... @@ -429,6 +433,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(amount);
swd.setIsBatch(isBatch);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("修改价格支付保证金,钱包明细记录,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
logger.info("修改价格支付保证金,钱包明细记录成功,bean={}", swd);
... ... @@ -450,13 +455,16 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
CommonAlarmEventPublisher.publish(message + "失败", "ufo.order.changePrice", "钱包不可用uid=" + uid+", 金额为:"+money);
return null;
}
if (sw.getAmount().compareTo(money) < 0) {
if ((type == 2 || type == 4) && sw.getAmount().compareTo(money) < 0) {
logger.error(message + "{}失败,钱包余额不足,uid={}", money, uid);
CommonAlarmEventPublisher.publish(message + "失败", "ufo.order.changePrice", "钱包余额不足uid=" + uid+", 金额为:"+money+", 账户余额为:"+sw.getAmount());
return null;
}
sw.setAmount(money.multiply(new BigDecimal("-1")));
if (type == 2 || type == 4) {
sw.setAmount(money.multiply(new BigDecimal("-1")));
} else {
sw.setAmount(money);
}
sw.setUpdateTime(TimeUtils.getTimeStampSecond());
logger.info("{}修改钱包表余额,bean={}", sw);
if (sellerWalletMapper.addMoney(sw) == 0) {
... ... @@ -474,9 +482,10 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
swd.setAmount(money);
swd.setIsBatch(0);
swd.setCreateTime(TimeUtils.getTimeStampSecond());
swd.setUpdateTime(0);
logger.info("增加钱包明细汇总记录,bean={}", swd);
sellerWalletDetailMapper.insert(swd);
logger.info("增加钱包明细汇总成功,bean={}", swd);
logger.info("增加钱包明细汇总记录成功,bean={}", swd);
return sw;
}
... ...
... ... @@ -80,7 +80,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
List<Integer> statusList = initOrderListRequest(request);
boolean isEntry = userProxyService.isEntryShop(request.getUid());
final SellerType sellerType = isEntry ? SellerType.ENTRY : SellerType.COMMON;
int total = sellerOrderGoodsMapper.selectCntByUidStatusList(request.getUid(), statusList);
int total = sellerOrderGoodsMapper.selectCntByUidStatusGBBNList(request.getUid(), statusList);
int limit = request.getLimit();
respBuilder = PageResp.builder()
.page(request.getPage())
... ... @@ -91,7 +91,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
return respBuilder.build();
}
int offset = (request.getPage() - 1) * limit;
List<SellerOrderGoods> sogList = sellerOrderGoodsMapper.selectByUidStatusList(request.getUid(),
List<SellerOrderGoods> sogList = sellerOrderGoodsMapper.selectByUidStatusGBBNList(request.getUid(),
statusList, offset, limit);
sogList.stream().forEach(item -> {
... ... @@ -144,8 +144,6 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
orderListInfo.setUid(sellerOrder.getUid());
orderListInfo.setOrderCode(sellerOrder.getOrderCode());
orderListInfo.setRealPrice(sellerOrderGoods.getGoodsPrice().toPlainString());
SellerOrderStatus sellerOrderStatus = SellerOrderStatus.getSellerOrderStatus(sellerOrder.getStatus());
SkupStatus skupStatus = sellerOrderStatus.getSkupStatus();
if (skupStatus == null){
... ... @@ -175,6 +173,8 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
goodsInfo.setProductId(sellerOrderGoods.getProductId());
goodsInfo.setGoodPrice(sellerOrderGoods.getGoodsPrice().toPlainString());
goodsInfo.setStorageId(sellerOrderGoods.getStorageId());
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
goodsInfo.setStorageNum(sellerOrderGoods.getNum());
orderListInfo.setGoodsInfo(goodsInfo);
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
orderListInfo.setCreateTime(DateUtil.formatDate(sellerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
... ...
... ... @@ -56,6 +56,8 @@ datasources:
- com.yohoufo.dal.order.SellerWalletMapper
- com.yohoufo.dal.order.SellerWalletDetailMapper
- com.yohoufo.dal.order.OrderCouponMapper
- com.yohoufo.dal.order.EntrySellerRechargeOrderMapper
ufo_promotion:
servers:
... ...
... ... @@ -56,6 +56,8 @@ datasources:
- com.yohoufo.dal.order.SellerWalletMapper
- com.yohoufo.dal.order.SellerWalletDetailMapper
- com.yohoufo.dal.order.OrderCouponMapper
- com.yohoufo.dal.order.EntrySellerRechargeOrderMapper
ufo_promotion:
servers:
... ...