fix
This commit is contained in:
@@ -108,6 +108,7 @@ public class LinePaySubmitRequest {
|
||||
linePayDO.setPayBusinessType(request.getPayBusinessType());
|
||||
linePayDO.setXgjClaimStatus(0);
|
||||
linePayDO.setRemark(request.getRemark());
|
||||
linePayDO.setDeleted(false);
|
||||
return linePayDO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,13 +159,13 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
if (!checkSubmitFranchiseFeePayRequest(request)) {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
if (StringUtils.isBlank(userId)){
|
||||
throw new ServiceException(ErrorCodeEnum.ACCESS_TOKEN_INVALID);
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
throw new ServiceException(ErrorCodeEnum.ACCESS_TOKEN_INVALID);
|
||||
}
|
||||
//判断付款人最多2人(可重复)
|
||||
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(request.getShopId());
|
||||
Set<String> payUserList = list.stream().map(LinePayDO::getPayUserName).collect(Collectors.toSet());
|
||||
if (!payUserList.contains(request.getPayUserName())&&payUserList.size()>=2){
|
||||
if (!payUserList.contains(request.getPayUserName()) && payUserList.size() >= 2) {
|
||||
throw new ServiceException(ErrorCodeEnum.PAY_USER_NAME_ERROR);
|
||||
}
|
||||
if (request.getId() != null) {
|
||||
@@ -196,18 +196,23 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
linePayDO.setCreateUserId(userId);
|
||||
linePayDO.setCreateTime(new Date());
|
||||
if (linePayDO.getId() != null) {
|
||||
linePayDAO.updateLinePay(linePayDO);
|
||||
LinePayDO linePayById = linePayDAO.getById(linePayDO.getId());
|
||||
if (linePayById == null) {
|
||||
log.info("linePayById is null");
|
||||
throw new ServiceException(ErrorCodeEnum.UPDATE_ERROR);
|
||||
} else {
|
||||
linePayDAO.updateLinePay(linePayDO);
|
||||
}
|
||||
} else {
|
||||
linePayDO.setPaymentReceiptCode(getPaymentReceiptCode());
|
||||
Long payId = linePayDAO.addLinePay(linePayDO);
|
||||
linePayDO.setId(payId);
|
||||
}
|
||||
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus()))
|
||||
{
|
||||
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus())) {
|
||||
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
|
||||
}
|
||||
//推送数据
|
||||
this.pushPayInfo(request.getShopId(),linePayDO);
|
||||
this.pushPayInfo(request.getShopId(), linePayDO);
|
||||
return linePayDO.getId();
|
||||
} else {
|
||||
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
|
||||
@@ -223,14 +228,14 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentReceiptCode(){
|
||||
public String getPaymentReceiptCode() {
|
||||
//当前日期
|
||||
String today = CoolDateUtils.getToday();
|
||||
String redisKey = redisConstantUtil.getPaymentReceiptCode(today);
|
||||
Long sequence = redisUtilPool.incrby(redisKey, 1);
|
||||
//第一次设置过期时间 一天
|
||||
if (sequence==1){
|
||||
redisUtilPool.expire(redisKey,RedisConstant.ONE_DAY_SECONDS);
|
||||
if (sequence == 1) {
|
||||
redisUtilPool.expire(redisKey, RedisConstant.ONE_DAY_SECONDS);
|
||||
}
|
||||
return "12" + today + String.format("%04d", sequence);
|
||||
}
|
||||
@@ -239,16 +244,16 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
public List<FranchiseFeePayInfoResponse> getFranchiseFeePayInfoList(Long shopId) {
|
||||
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(shopId);
|
||||
List<FranchiseFeePayInfoResponse> result = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return result;
|
||||
}
|
||||
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
|
||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
|
||||
String username = lineInfoDO.getUsername();
|
||||
for (LinePayDO linePayDO : list){
|
||||
for (LinePayDO linePayDO : list) {
|
||||
FranchiseFeePayInfoResponse response = new FranchiseFeePayInfoResponse();
|
||||
BeanUtil.copyProperties(linePayDO, response);
|
||||
response.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START,linePayDO.getPayTime()));
|
||||
response.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START, linePayDO.getPayTime()));
|
||||
response.setPartnerName(username);
|
||||
result.add(response);
|
||||
}
|
||||
@@ -257,19 +262,19 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteFranchiseFeePayInfo(Long id,String userId) {
|
||||
public Boolean deleteFranchiseFeePayInfo(Long id, String userId) {
|
||||
LinePayDO linePay = linePayDAO.getById(id);
|
||||
if (linePay == null){
|
||||
if (linePay == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.DELETE_ERROR);
|
||||
}
|
||||
if (linePay.getXgjClaimStatus().equals(ClaimStatusEnum.Claimed.getCode())) {
|
||||
throw new ServiceException(ErrorCodeEnum.CLAIM_STATUS_ERROR);
|
||||
}
|
||||
linePayDAO.deleteById(id,userId);
|
||||
linePayDAO.deleteById(id, userId);
|
||||
//置为删除状态
|
||||
linePay.setDeleted(Boolean.TRUE);
|
||||
//推送数据
|
||||
this.pushPayInfo(linePay.getShopId(),linePay);
|
||||
this.pushPayInfo(linePay.getShopId(), linePay);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -286,7 +291,7 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResponse<Boolean> ReceiptCallBack(ReceiptCallBackRequest request) {
|
||||
LinePayDO linePayDO = linePayDAO.selectByPaymentReceiptCode(request.getReceiptId());
|
||||
if (Objects.isNull(linePayDO)){
|
||||
if (Objects.isNull(linePayDO)) {
|
||||
return ApiResponse.error(ErrorCodeEnum.RECEIPT_NOT_EXIST);
|
||||
}
|
||||
linePayDO.setXgjClaimStatus(request.getClaimStatus());
|
||||
@@ -295,15 +300,14 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public FranchiseFeePayInfoResponse getById(Long id) {
|
||||
if (id == null){
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
LinePayDO linePay = linePayDAO.getById(id);
|
||||
if (linePay == null){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
if (linePay == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
FranchiseFeePayInfoResponse response = new FranchiseFeePayInfoResponse();
|
||||
BeanUtil.copyProperties(linePay, response);
|
||||
@@ -321,7 +325,7 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
if (!request.getPayBusinessType().equals(PayBusinessTypeEnum.FRANCHISE_FEE.getCode())) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user