Authored by qinchao

Merge branch 'dev_qc_1119_intf2' into test6.8.2

... ... @@ -9,6 +9,10 @@ public interface IStoredSellerDao {
int insert(StoredSeller storedSeller);
int updateStatusByPrimaryKey(@Param("id")int id,@Param("validStatus") int validStatus);
int updateStatusByPrimaryKey(@Param("id")int id,@Param("validStatus") int validStatus ,@Param("expectStatus") int expectStatus);
int updateToQuitByPrimaryKey(@Param("id")int id,@Param("validStatus") int validStatus ,@Param("expectStatus") int expectStatus
,@Param("operatorUid") int operatorUid,@Param("operatorName") String operatorName
,@Param("quitTime") long quitTime,@Param("updateTime") long updateTime);
}
... ...
... ... @@ -38,7 +38,14 @@
<update id="updateStatusByPrimaryKey">
update stored_seller
set valid_status = #{validStatus}
where id = #{id}
where id = #{id} and valid_status = #{expectStatus}
</update>
<update id="updateToQuitByPrimaryKey">
update stored_seller
set valid_status = #{validStatus},operator_uid = #{operatorUid},operator_name=#{operatorName},
quit_time = #{quitTime} ,update_time = #{updateTime}
where id = #{id} and valid_status = #{expectStatus}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -32,4 +32,18 @@ public class AssetsController {
AssetsResp resp = assetsService.getAssetsDetails(uid, page, limit);
return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("流水详情").build();
}
/**
* 入驻商家的保证金明细
*/
@RequestMapping(params = "method=ufo.asssets.storedSellerDepositDetail")
@ResponseBody
public ApiResponse storedSellerDepositDetail(@RequestParam(name = "uid")int uid,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit){
logger.info("in ufo.sellerOrder.storedSellerDepositDetail, uid {},page {},limit {}", uid, page, limit);
return new ApiResponse.ApiResponseBuilder().code(200).data(null).message("入驻商家保证金流水").build();
}
}
... ...
... ... @@ -6,8 +6,11 @@ import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.dal.user.model.UserAuthorizeInfo;
import com.yohoufo.user.requestVO.RealNameAuthorizeReqVO;
import com.yohoufo.user.service.IRealNameAuthorizeService;
import com.yohoufo.user.service.IStoredSellerService;
import com.yohoufo.user.service.risk.GraphVerifyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -32,6 +35,9 @@ public class RealNameAuthorize4PlatformController {
@Autowired
GraphVerifyService graphVerifyService;
@Autowired
private IStoredSellerService storedSellerService;
/**
* 查询支付宝信息
* 提供给运营平台使用
... ... @@ -50,4 +56,22 @@ public class RealNameAuthorize4PlatformController {
return new ApiResponse.ApiResponseBuilder().code(200)
.data(info).message("").build();
}
/**
* 商户退驻
*/
@RequestMapping(value="/quitStoredSeller")
@IgnoreSession
@IgnoreSignature
public ApiResponse quitStoredSeller(RealNameAuthorizeReqVO reqVO) throws GatewayException {
logger.info("enter StoredSellerController applyQuitStoredSeller param reqVO is {}", reqVO);
//(1) 优先校验请求的参数
if (reqVO == null || reqVO.getUid() <=0 ){
throw new GatewayException(400, "参数错误,uid不存在!");
}
storedSellerService.quitStoredSeller(reqVO);
return new ApiResponse();
}
}
... ...
... ... @@ -20,4 +20,8 @@ public class RealNameAuthorizeReqVO extends BaseBO {
//芝麻调用的bizNO
private String zhiMaBizNo;
private Integer operatorUid;
private String operatorName;
}
... ...
package com.yohoufo.user.service;
import com.yohoufo.user.requestVO.RealNameAuthorizeReqVO;
public interface IStoredSellerService {
boolean isStoredSeller(Integer uid);
... ... @@ -7,4 +9,7 @@ public interface IStoredSellerService {
void addUserAsStoredSeller(Integer uid);
void applyQuitStoredSeller(Integer uid);
void quitStoredSeller(RealNameAuthorizeReqVO reqVO);
}
... ...
... ... @@ -6,6 +6,7 @@ import com.yohoufo.dal.user.IStoredSellerDao;
import com.yohoufo.dal.user.model.StoredSeller;
import com.yohoufo.dal.user.model.ZhiMaCert;
import com.yohoufo.user.cache.CacheService;
import com.yohoufo.user.requestVO.RealNameAuthorizeReqVO;
import com.yohoufo.user.service.IRealNameAuthorizeService;
import com.yohoufo.user.service.IStoredSellerService;
import org.slf4j.Logger;
... ... @@ -30,6 +31,47 @@ public class StoredSellerServiceImpl implements IStoredSellerService {
@Autowired
private IStoredSellerDao storedSellerDao;
/**
* 退出入驻
* @param reqVO
*/
@Override
public void quitStoredSeller(RealNameAuthorizeReqVO reqVO){
logger.info("StoredSellerServiceImpl quitStoredSeller enter reqVO is {} ",reqVO);
Integer uid=reqVO.getUid();
StoredSeller storedSeller = getValidStoredSeller(uid);
if(null==storedSeller){
logger.error("StoredSellerServiceImpl quitStoredSeller store seller is null,uid is {} ",uid);
throw new ServiceException(400,"未找到入驻信息");
}
Integer expectStatus=StoredSellerStatusEnum.apply_quit.getId();
if(!expectStatus.equals(storedSeller.getValidStatus())){
throw new ServiceException(400,"商户入驻状态变化,不允许申请退出!");
}
LocalDateTime now=LocalDateTime.now();
long ts=now.toEpochSecond(ZoneOffset.of("+8"));
//更新为退驻
int num = storedSellerDao.updateToQuitByPrimaryKey(storedSeller.getId(),StoredSellerStatusEnum.quit.getId(),StoredSellerStatusEnum.apply_quit.getId(),
reqVO.getOperatorUid(),reqVO.getOperatorName(),
ts,ts);
//清掉缓存
cacheService.removeStoredSeller(uid);
logger.info("StoredSellerServiceImpl quitStoredSeller end ,uid is {} ,update num ",uid,num);
if(num > 0){
//@TODO 执行退保证金的操作
}else{
logger.error("StoredSellerServiceImpl quitStoredSeller update row is 0,reqVo {}",reqVO);
}
}
@Override
public void applyQuitStoredSeller(Integer uid){
logger.info("StoredSellerServiceImpl applyQuitStoredSeller uid is {} ",uid);
... ... @@ -39,7 +81,8 @@ public class StoredSellerServiceImpl implements IStoredSellerService {
throw new ServiceException(400,"未找到入驻信息");
}
if(!StoredSellerStatusEnum.entered.getId().equals(storedSeller.getValidStatus())){
Integer expectStatus =StoredSellerStatusEnum.entered.getId();
if(!expectStatus.equals(storedSeller.getValidStatus())){
throw new ServiceException(400,"商户入驻状态变化,不允许申请退出!");
}
... ... @@ -48,7 +91,7 @@ public class StoredSellerServiceImpl implements IStoredSellerService {
throw new ServiceException(400,"商户入驻操作错误,不允许申请退出!");
}
int num = storedSellerDao.updateStatusByPrimaryKey(storedSeller.getId(),StoredSellerStatusEnum.apply_quit.getId());
int num = storedSellerDao.updateStatusByPrimaryKey(storedSeller.getId(),StoredSellerStatusEnum.apply_quit.getId(),expectStatus);
//清掉缓存
cacheService.removeStoredSeller(uid);
... ...