Merge remote-tracking branch 'origin/cc_partner_init' into cc_partner_init

This commit is contained in:
zhangchenbiao
2024-04-25 18:07:42 +08:00
14 changed files with 369 additions and 14 deletions

View File

@@ -0,0 +1,20 @@
package com.cool.store.service;
import com.cool.store.request.FranchiseFeeRequest;
import com.cool.store.response.FranchiseFeeResponse;
public interface FranchiseFeeService {
/**
* 提交加盟费信息
* @param request
* @return
*/
Boolean submitLicense(FranchiseFeeRequest request);
/**
* 查询加盟费信息
* @param shopId
* @return
*/
FranchiseFeeResponse getDetail(Long shopId);
}

View File

@@ -0,0 +1,37 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.entity.FranchiseFeeDO;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.request.FranchiseFeeRequest;
import com.cool.store.response.FranchiseFeeResponse;
import com.cool.store.service.FranchiseFeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
@Slf4j
public class FranchiseFeeServiceImpl implements FranchiseFeeService {
@Resource
FranchiseFeeMapper franchiseFeeMapper;
@Override
public Boolean submitLicense(FranchiseFeeRequest request) {
log.info("submitLicense request{}", JSONObject.toJSONString(request));
FranchiseFeeDO franchiseFeeDO = request.toFranchiseFeeDO();
franchiseFeeMapper.insertSelective(franchiseFeeDO);
return null;
}
@Override
public FranchiseFeeResponse getDetail(Long shopId) {
FranchiseFeeDO franchiseFeeDO = new FranchiseFeeDO();
franchiseFeeDO.setShopId(shopId);
FranchiseFeeDO result = franchiseFeeMapper.selectOneByExample(franchiseFeeDO);
FranchiseFeeResponse resp = FranchiseFeeResponse.from(result);
return resp;
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.cool.store.dao.HyPartnerUserInfoDAO;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.LinePayDAO;
import com.cool.store.entity.FranchiseFeeDO;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.LinePayDO;
@@ -11,16 +12,20 @@ import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.service.LinePayService;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
@@ -37,6 +42,9 @@ public class LinePayServiceImpl implements LinePayService {
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
FranchiseFeeMapper franchiseFeeMapper;
@Override
public LinePayVO getLinePayInfo(Long lineId) {
LinePayVO result = null;
@@ -58,20 +66,39 @@ public class LinePayServiceImpl implements LinePayService {
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
LinePayDO linePayDO = linePayDAO.getLinePayByLineId(request.getLineId());
if(linePayDO == null){
linePayDO = new LinePayDO();
fillLinePay(true, linePayDO, request, partnerUser);
linePayDAO.addLinePay(linePayDO);
if (request.getPayBusinessType() != null
&& request.getPayBusinessType() == Constants.ONE_INTEGER
&& request.getShopId() != null){
LinePayDO linePayDO = linePayDAO.getLinePayByLineIdAndPayType(request.getLineId(),request.getPayBusinessType());
if (Objects.isNull(linePayDO)){
fillLinePay(true, linePayDO, request, partnerUser);
Long aLong = linePayDAO.addLinePay(linePayDO);
FranchiseFeeDO franchiseFeeDO = new FranchiseFeeDO();
franchiseFeeDO.setShopId(request.getShopId());
FranchiseFeeDO result = franchiseFeeMapper.selectOneByExample(franchiseFeeDO);
result.setPayId(aLong);
franchiseFeeMapper.updateByPrimaryKeySelective(result);
}else {
fillLinePay(false, linePayDO, request, partnerUser);
linePayDAO.updateLinePay(linePayDO);
}
}else {
fillLinePay(false, linePayDO, request, partnerUser);
linePayDAO.updateLinePay(linePayDO);
}
LinePayDO linePayDO = linePayDAO.getLinePayByLineIdAndPayType(request.getLineId(),0);
if(linePayDO == null){
linePayDO = new LinePayDO();
fillLinePay(true, linePayDO, request, partnerUser);
linePayDAO.addLinePay(linePayDO);
}else {
fillLinePay(false, linePayDO, request, partnerUser);
linePayDAO.updateLinePay(linePayDO);
}
lineInfo.setWorkflowSubStage(WorkflowSubStageEnum.PAY_DEPOSIT.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
lineInfoDAO.insertOrUpdate(lineInfo);
return linePayDO.getId();
lineInfo.setWorkflowSubStage(WorkflowSubStageEnum.PAY_DEPOSIT.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
lineInfoDAO.insertOrUpdate(lineInfo);
return linePayDO.getId();
}
return null;
}
private void fillLinePay(Boolean isAdd, LinePayDO linePayDO, LinePaySubmitRequest request, PartnerUserInfoVO partnerUser) {
@@ -86,6 +113,7 @@ public class LinePayServiceImpl implements LinePayService {
linePayDO.setPayPic(request.getPayPic());
linePayDO.setPromisePic(request.getPromisePic());
linePayDO.setPayStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
linePayDO.setPayBusinessType(request.getPayBusinessType());
if(isAdd){
linePayDO.setPartnerId(partnerUser.getPartnerId());
linePayDO.setLineId(request.getLineId());