Authored by chenchao

Merge branch 'hotfix_支付宝黑名单' into test6.9.9

... ... @@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StorageDepositMapper {
int deleteByPrimaryKey(Integer id);
int insert(StorageDeposit record);
... ... @@ -88,4 +87,11 @@ public interface StorageDepositMapper {
* @return
*/
int updateDelStatusByCode(@Param("uid")Integer uid, @Param("depositCode")String depositCode, @Param("status")Integer status);
int updateStorageShelveStatusByCAS(@Param("uid")int uid,
@Param("depositCode")String depositCode,
@Param("status")int status,
@Param("expectStatus")int expectStatus
);
}
\ No newline at end of file
... ...
... ... @@ -43,6 +43,7 @@
from storage_deposit
where id = #{id,jdbcType=INTEGER}
</select>
<select id="queryByDepositCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
... ... @@ -50,10 +51,6 @@
where deposit_code = #{depositCode} and del_status=0 and owner_uid=#{uid}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from storage_deposit
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.StorageDeposit" >
insert into storage_deposit (id, product_id, goods_id,
storage_id, deposit_code, shelf_code,
... ... @@ -283,7 +280,11 @@
</select>
<select id="queryUserDepositProduct" resultMap="CountResultMap">
select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
select product_id ,
count(distinct storage_id) as storage_id_count,
count(*) as storage_count,
sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,
max(skup) as skup from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0
and product_id in
<foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
... ... @@ -291,10 +292,12 @@
</foreach>
group by product_id
</select>
<select id="queryUserDopositBackCount" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
select count(*) from storage_deposit
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0
</select>
<select id="queryUserDopositBack" resultMap="BaseResultMap">
select * from storage_deposit
where owner_uid = #{uid} and status in(2,3,4,5) and out_type in(1,3) and del_status=0
... ... @@ -331,7 +334,8 @@
<select id="getDepositOffs" resultMap="BaseResultMap">
select * from storage_deposit
where owner_uid = #{uid} and storage_id = #{storageId} and status=1 and order_status=0 and del_status=0 limit 0, #{count}
where owner_uid = #{uid} and storage_id = #{storageId}
and status=1 and order_status=0 and del_status=0 limit 0, #{count}
</select>
<select id="selectByDepositCode" resultMap="BaseResultMap">
... ... @@ -350,7 +354,10 @@
<if test="outType != null" >
, out_type = #{outType}
</if>
where id = #{depositId,jdbcType=INTEGER} AND del_status = 0 AND order_status = #{orderStatus,jdbcType=INTEGER} AND owner_uid = #{uid,jdbcType=INTEGER}
where id = #{depositId,jdbcType=INTEGER}
AND del_status = 0
AND order_status = #{orderStatus,jdbcType=INTEGER}
AND owner_uid = #{uid,jdbcType=INTEGER}
</update>
<select id="selectByOrderCode" resultMap="BaseResultMap">
... ... @@ -401,6 +408,17 @@
<update id="updateDelStatusByCode">
update storage_deposit
set del_status = 1, update_time = unix_timestamp(now())
where deposit_code = #{depositCode,jdbcType=VARCHAR} AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER} AND status = #{status,jdbcType=INTEGER}
where deposit_code = #{depositCode,jdbcType=VARCHAR}
AND del_status = 0 AND owner_uid = #{uid,jdbcType=INTEGER}
AND status = #{status,jdbcType=INTEGER}
</update>
<update id="updateStorageShelveStatusByCAS">
update storage_deposit
set order_status = #{status,jdbcType=INTEGER} ,update_time = unix_timestamp(now())
where owner_uid = #{uid,jdbcType=INTEGER}
and deposit_code = #{depositCode,jdbcType=VARCHAR}
AND order_status = #{expectStatus,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -33,6 +33,7 @@ import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.SellerNoticeFacade;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -309,9 +310,34 @@ public class DepositServiceImpl implements DepositService {
return successList;
}
// 批量上架-查询
/**
* 批量上架-查询
* TODO 应当锁定相关记录,加中间状态
* @param uid
* @param storageId
* @param num
* @return
*/
public List<StorageDeposit> getStorageDeposit4Publish(Integer uid, Integer storageId, int num) {
return storageDepositMapper.getDepositOffs(uid, storageId, num);
List<StorageDeposit> sdList = storageDepositMapper.getDepositOffs(uid, storageId, num);
if (CollectionUtils.isEmpty(sdList)){
LOGGER.warn("in getStorageDeposit4Publish StorageDeposit empty, uid {} storageId {} num {}",
uid, storageId, num);
return sdList;
}
/*
List<StorageDeposit> lockedList = new ArrayList<>(sdList.size());
for (StorageDeposit sd : sdList){
int rows= storageDepositMapper.updateStorageShelveStatusByCAS(uid, sd.getDepositCode(), 11, 0);
if(rows == 1){
lockedList.add(sd);
}else{
LOGGER.warn("getStorageDeposit4Publish updateStorageShelveStatusByCAS fail ,{}", sd);
}
return lockedList;
*/
return sdList;
}
// 批量下架
... ...