加盟费改造

This commit is contained in:
shuo.wang
2025-05-30 18:17:57 +08:00
parent 20fcd02ac2
commit c014841e8c
15 changed files with 464 additions and 43 deletions

View File

@@ -0,0 +1,25 @@
package com.cool.store.enums;
/**
* @Author: WangShuo
* @Date: 2025/05/30/15:52
* @Version 1.0
* @注释:
*/
public enum ClaimStatusEnum {
TO_BE_CLAIMED(0,"待认领"),
Claimed(1,"已认领");
private Integer code;
private String message;
ClaimStatusEnum(Integer code,String message){
this.code = code;
this.message =message;
}
public Integer getCode(){
return code;
}
public String getMessage(){
return message;
}
}

View File

@@ -263,6 +263,14 @@ public enum ErrorCodeEnum {
USER_ACCOUNT_WAIT_AUDIT(151015, "账号信息等待审核",null),
SHOP_HAVE_NOT_OVER_ACCORDING(1511014,"该加盟商下有未结束跟进的门店,请先结束门店",null),
MOBILE_NOT_EXIST(151016,"手机号不存在,请先维护手机号!",null),
API_CALL_ERROR(1511020,"接口调用错误",null),
ADD_PAY_INFO_FAIL(1511021,"添加缴费信息失败",null),
UPDATE_ERROR(1511022,"修改信息失败",null),
CLAIM_STATUS_ERROR(1511023,"当前状态为已认领,不能进行操作",null),
PAY_USER_NAME_ERROR(1511024,"付款人最多为2人",null),
DELETE_ERROR(1511025,"删除信息失败",null),
;

View File

@@ -3,6 +3,8 @@ package com.cool.store.utils;
import cn.hutool.core.util.IdUtil;
import org.apache.commons.lang3.StringUtils;
import java.util.Random;
/**
* 唯一性ID工具类
*
@@ -26,5 +28,23 @@ public class UUIDUtils {
long uuid = (int) (Math.random() * 90000000 + 10000000);
return uuid;
}
// 生成 UUID 方法
public static String generateCustomUUID() {
// 获取当前时间戳(毫秒)
long timestamp = System.currentTimeMillis();
// 生成4位随机数字0000 - 9999
int randomNumber = new Random().nextInt(10000);
String randomDigits = String.format("%04d", randomNumber);
// 生成2个随机大写字母
String randomLetters = "";
Random random = new Random();
for (int i = 0; i < 2; i++) {
char c = (char) ('A' + random.nextInt(26));
randomLetters += c;
}
return timestamp + randomDigits + randomLetters;
}
}

View File

@@ -5,6 +5,7 @@ import com.cool.store.mapper.LinePayMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.*;
@@ -69,4 +70,21 @@ public class LinePayDAO {
List<LinePayDO> linePayDO = linePayMapper.getLinePayByLineIds(null,shopIds,payBusinessType);
return linePayDO.stream().collect(Collectors.toMap(LinePayDO::getShopId, linePayDO1 -> linePayDO1, (o, n) -> o));
}
public List<LinePayDO>getFranchiseFeePayInfoByShopId(Long shopId){
if (Objects.isNull(shopId)){
return null;
}
List<LinePayDO> franchiseFeePayInfoByShopId = linePayMapper.getFranchiseFeePayInfoByShopId(shopId);
if (CollectionUtils.isEmpty(franchiseFeePayInfoByShopId)){
return new ArrayList<>();
}
return franchiseFeePayInfoByShopId;
}
public LinePayDO getById(Long id) {
return linePayMapper.selectByPrimaryKey(id);
}
public Integer deleteById(Long id,String userId) {
return linePayMapper.deleteById(id,userId);
}
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.mapper;
import com.cool.store.entity.LinePayDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
@@ -55,4 +56,8 @@ public interface LinePayMapper {
void updateByPidAndLid(@Param("lineId") Long lineId,
@Param("partnerId") String partnerId,
@Param("auditId") Long auditId);
List<LinePayDO>getFranchiseFeePayInfoByShopId(@Param("shopId") Long shopId);
Integer deleteById(@Param("id") Long id,@Param("userId")String userId);
}

View File

@@ -28,17 +28,19 @@
<result column="xgj_claim_status" jdbcType="TINYINT" property="xgjClaimStatus"/>
<result column="payment_receipt_code" jdbcType="VARCHAR" property="paymentReceiptCode"/>
<result column="pay_serial_number" jdbcType="VARCHAR" property="paySerialNumber"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
id,shop_id, partner_id, line_id, pay_status, pay_type, pay_user_name, pay_account, bank_code,
bank_name, branch_bank_code, branch_bank_name, pay_time, pay_pic, promise_pic, create_time,
update_time, create_user_id, update_user_id, deleted,pay_business_type,amount,combined_field,xgj_claim_status,payment_receipt_code,pay_serial_number
update_time, create_user_id, update_user_id, deleted,pay_business_type,amount,combined_field,xgj_claim_status,payment_receipt_code,pay_serial_number,
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xfsg_line_pay
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} and deleted = 0
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
@@ -114,6 +116,18 @@
<if test="combinedField != null">
combined_field,
</if>
<if test="xgjClaimStatus !=null">
xgj_claim_status,
</if>
<if test="paymentReceiptCode !=null">
payment_receipt_code,
</if>
<if test="paySerialNumber !=null">
pay_serial_number,
</if>
<if test="remark != null">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="partnerId != null">
@@ -178,6 +192,18 @@
<if test="combinedField != null">
#{combinedField,jdbcType=VARCHAR},
</if>
<if test="xgjClaimStatus !=null">
#{xgjClaimStatus,jdbcType=TINYINT},
</if>
<if test="paymentReceiptCode !=null">
#{paymentReceiptCode,jdbcType=VARCHAR},
</if>
<if test="paySerialNumber !=null">
#{paySerialNumber,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR}
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.LinePayDO">
@@ -240,6 +266,18 @@
<if test="combinedField != null">
combined_field = #{combinedField,jdbcType=VARCHAR},
</if>
<if test="xgjClaimStatus !=null">
xgj_claim_status = #{xgjClaimStatus,jdbcType=TINYINT},
</if>
<if test="paymentReceiptCode !=null">
payment_receipt_code = #{paymentReceiptCode,jdbcType=VARCHAR},
</if>
<if test="paySerialNumber !=null">
pay_serial_number = #{paySerialNumber,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR}
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -349,4 +387,10 @@
</foreach>
</if>
</select>
<select id="getFranchiseFeePayInfoByShopId" resultType="com.cool.store.entity.LinePayDO">
select * from xfsg_line_pay where deleted = 0 and shop_id = #{shopId} and pay_business_type = 1
</select>
<update id="deleteById">
update xfsg_line_pay set deleted = 1 ,update_time = now(),update_user_id = #{userId} where id = #{id}
</update>
</mapper>

View File

@@ -37,7 +37,7 @@ public class LinePayDO implements Serializable {
@ApiModelProperty("支付状态 45:待缴费 50:已缴费 55缴费失败")
private Integer payStatus;
@ApiModelProperty("支付方式 1微信 2银行转账")
@ApiModelProperty("支付方式 1微信 2银行转账 3-线下支付4-线上支付")
private Integer payType;
@ApiModelProperty("付款人姓名")
@@ -102,4 +102,7 @@ public class LinePayDO implements Serializable {
@ApiModelProperty("交易流水号")
private String paySerialNumber;
@Column(name = "remark")
private String remark;
}

View File

@@ -1,17 +1,26 @@
package com.cool.store.request;
import com.cool.store.entity.LinePayDO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.tika.utils.DateUtils;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import static com.cool.store.enums.WorkflowSubStageStatusEnum.PAY_DEPOSIT_50;
@Data
public class LinePaySubmitRequest {
private Long id;
@ApiModelProperty("xfsg_user_info.partner_id")
private String partnerId;
@@ -42,7 +51,6 @@ public class LinePaySubmitRequest {
@ApiModelProperty("支行名称")
private String branchBankName;
//正新缴纳加盟费后续payTimepayPic废弃使用combinedField
@ApiModelProperty("缴纳时间")
private String payTime;
@@ -52,15 +60,49 @@ public class LinePaySubmitRequest {
@ApiModelProperty("承诺书图片")
private String promisePic;
@ApiModelProperty("支付类型 0-缴纳意向金 1-缴纳加盟费 2-装修款")
@ApiModelProperty("支付类型 1-缴纳加盟费")
private Integer payBusinessType;
@ApiModelProperty("铺位id")
private Long shopId;
@ApiModelProperty("缴费金额")
private BigDecimal amount;
//废弃
@ApiModelProperty("组合字段:缴费时间+付款截图,数组")
private String combinedField;
@ApiModelProperty("交易流水号")
private String paySerialNumber;
@ApiModelProperty("备注")
private String remark;
/**
* @Auther: wangshuo
* @Date: 2025/5/30
* @description:加盟费使用
*/
public static LinePayDO convertFranchiseFee(LinePaySubmitRequest request) {
LinePayDO linePayDO = new LinePayDO();
linePayDO.setId(request.getId());
linePayDO.setPartnerId(request.getPartnerId());
linePayDO.setLineId(request.getLineId());
linePayDO.setPayStatus(PAY_DEPOSIT_50.getCode());
linePayDO.setPayType(request.getPayType());
linePayDO.setPayUserName(request.getPayUserName());
linePayDO.setPayAccount(request.getPayAccount());
linePayDO.setBankCode(request.getBankCode());
linePayDO.setBankName(request.getBankName());
linePayDO.setBranchBankCode(request.getBranchBankCode());
linePayDO.setBranchBankName(request.getBranchBankName());
try {
linePayDO.setPayTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(request.getPayTime()));
} catch (ParseException e) {
throw new RuntimeException(e);
}
linePayDO.setPayPic(request.getPayPic());
linePayDO.setPaySerialNumber(request.getPaySerialNumber());
linePayDO.setPayBusinessType(request.getPayBusinessType());
linePayDO.setRemark(request.getRemark());
return linePayDO;
}
}

View File

@@ -0,0 +1,71 @@
package com.cool.store.response;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author: WangShuo
* @Date: 2025/05/30/16:51
* @Version 1.0
* @注释:
*/
@Data
public class FranchiseFeePayInfoResponse {
private Long id;
private String partnerName;
@ApiModelProperty("xfsg_user_info.partner_id")
private String partnerId;
@ApiModelProperty("line_info.id")
private Long lineId;
@ApiModelProperty("铺位id")
private Long shopId;
@ApiModelProperty("支付方式 1微信 2银行转账,3-线上支付,4-线下支持")
private Integer payType;
@ApiModelProperty("付款人姓名/加盟商姓名")
private String payUserName;
@ApiModelProperty("付款账号")
private String payAccount;
@ApiModelProperty("开户行code")
private String bankCode;
@ApiModelProperty("开户行名称")
private String bankName;
@ApiModelProperty("支行code")
private String branchBankCode;
@ApiModelProperty("支行名称")
private String branchBankName;
@ApiModelProperty("缴纳时间")
private String payTime;
@ApiModelProperty("付款截图")
private String payPic;
@ApiModelProperty("缴费金额")
private BigDecimal amount;
@ApiModelProperty("交易流水号")
private String paySerialNumber;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("提交时间")
private Date createTime;
@ApiModelProperty("认领状态 0-待认领 1-已认领")
private Integer xgjClaimStatus;
}

View File

@@ -6,12 +6,13 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class FranchiseFeeResponse {
private Long id;
@ApiModelProperty("shopId")
@ApiModelProperty("shopId门店id")
private Long shopId;
@ApiModelProperty("payId")
private Long payId;
@@ -53,6 +54,17 @@ public class FranchiseFeeResponse {
@ApiModelProperty("铺位面积")
private String pointArea;
@ApiModelProperty("收款状态 0-待缴费 1-部分缴款 2-已完成")
private Integer xgjCollectionStatus;
@ApiModelProperty("剩余待缴金额")
private BigDecimal xgjRemainderPayableAmount;
@ApiModelProperty("新管家已缴金额")
private BigDecimal xgjFeesPaid;
@Data
public static class LinePay{
@ApiModelProperty("")
@@ -185,6 +197,9 @@ public class FranchiseFeeResponse {
franchiseFeeResponse.setUpdateTime(franchiseFeeDO.getUpdateTime());
franchiseFeeResponse.setFirstYearManageFee(franchiseFeeDO.getFirstYearManageFee());
franchiseFeeResponse.setDiscountReason(franchiseFeeDO.getDiscountReason());
franchiseFeeResponse.setXgjCollectionStatus(franchiseFeeDO.getXgjCollectionStatus());
franchiseFeeResponse.setXgjRemainderPayableAmount(franchiseFeeDO.getXgjRemainderPayableAmount());
franchiseFeeResponse.setXgjFeesPaid(franchiseFeeDO.getXgjFeesPaid());
return franchiseFeeResponse;
}
}

View File

@@ -4,9 +4,12 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.AmountDTO;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import java.util.List;
/**
* @Author wxp
* @Date 2024/3/25 13:45
@@ -27,5 +30,9 @@ public interface LinePayService {
Long submitPayInfo(LinePaySubmitRequest followLog, PartnerUserInfoVO partnerUser);
Long submitFranchiseFeePayInfo(LinePaySubmitRequest request, String userId);
List<FranchiseFeePayInfoResponse> getFranchiseFeePayInfoList(Long shopId);
Boolean deleteFranchiseFeePayInfo(Long id,String userId);
}

View File

@@ -103,22 +103,6 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
return new FranchiseFeeResponse();
}
FranchiseFeeResponse resp = FranchiseFeeResponse.from(result);
LinePayDO linePayDO = linePayMapper.selectByPrimaryKey(result.getPayId());
if (Objects.nonNull(linePayDO)) {
FranchiseFeeResponse.LinePay linePayResult = FranchiseFeeResponse.LinePay.from(linePayDO);
if (Objects.nonNull(linePayDO.getLineId())){
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(linePayDO.getLineId());
linePayResult.setPartnerName(lineInfoDO.getUsername());
}
linePayResult.setAmount(new BigDecimal(result.getPerformanceBond()).add(new BigDecimal(result.getFirstYearFee())).add(new BigDecimal(result.getFirstYearManageFee()))
.add(new BigDecimal(result.getYearFranchiseFee())).add(new BigDecimal(result.getLoanMargin())).toString());
if (Objects.nonNull(result.getAuditId())) {
ShopAuditInfoDO shopAuditInfoDO = shopAuditInfoMapper.selectByPrimaryKey(result.getAuditId());
linePayResult.setStatus(shopAuditInfoDO.getResultType());
linePayResult.setResult(shopAuditInfoDO.getResultType() == 0 ? shopAuditInfoDO.getPassReason() : shopAuditInfoDO.getRejectReason());
}
resp.setLinePayDO(linePayResult);
}
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
if (shopInfoDO.getPointId() != null ){
PointInfoDO pointInfoDO = pointInfoDAO.getPointInfoById(shopInfoDO.getPointId());

View File

@@ -14,21 +14,25 @@ import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.PayTypeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.ShopInfoMapper;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.service.LinePayService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -132,6 +136,122 @@ public class LinePayServiceImpl implements LinePayService {
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long submitFranchiseFeePayInfo(LinePaySubmitRequest request, String userId) {
log.info("submitPayInfo request{}userId{}", JSONObject.toJSONString(request), JSONObject.toJSONString(userId));
if (!checkSubmitFranchiseFeePayRequest(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
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){
throw new ServiceException(ErrorCodeEnum.PAY_USER_NAME_ERROR);
}
if (request.getId() != null) {
LinePayDO linePayById = linePayDAO.getById(request.getId());
if (linePayById == null) {
throw new ServiceException(ErrorCodeEnum.UPDATE_ERROR);
}
if (linePayById.getXgjClaimStatus().equals(ClaimStatusEnum.Claimed.getCode())) {
throw new ServiceException(ErrorCodeEnum.CLAIM_STATUS_ERROR);
}
}
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_7);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
String lockKey = "submitFranchiseFeePayInfo:lineId" + request.getLineId() + "shopId" + request.getShopId();
//流水
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
//10s过期
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
LinePayDO linePayDO = LinePaySubmitRequest.convertFranchiseFee(request);
linePayDO.setPartnerId(lineInfo.getPartnerId());
linePayDO.setCreateUserId(userId);
linePayDO.setCreateTime(new Date());
if (linePayDO.getId() != null) {
linePayDAO.updateLinePay(linePayDO);
} else {
linePayDO.setPaymentReceiptCode(UUIDUtils.generateCustomUUID());
linePayDAO.addLinePay(linePayDO);
}
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_71.getShopSubStageStatus()))
{
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
}
//todo 苏竹红推送数据
return linePayDO.getId();
} else {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}
} finally {
if (Boolean.TRUE.equals(acquired)) {
String currentValue = redisUtilPool.getString(lockKey);
if (lockValue.equals(currentValue)) {
redisUtilPool.delKey(lockKey);
}
}
}
}
@Override
public List<FranchiseFeePayInfoResponse> getFranchiseFeePayInfoList(Long shopId) {
List<LinePayDO> list = linePayDAO.getFranchiseFeePayInfoByShopId(shopId);
List<FranchiseFeePayInfoResponse> result = new ArrayList<>();
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){
FranchiseFeePayInfoResponse response = new FranchiseFeePayInfoResponse();
BeanUtil.copyProperties(linePayDO, response);
response.setPartnerName(username);
result.add(response);
}
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteFranchiseFeePayInfo(Long id,String userId) {
LinePayDO linePay = linePayDAO.getById(id);
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);
//todo 苏竹红推送数据
return Boolean.TRUE;
}
private Boolean checkSubmitFranchiseFeePayRequest(LinePaySubmitRequest request) {
if (StringUtils.isAnyBlank(request.getPayUserName(), request.getPayAccount(), request.getBankName(), request.getBranchBankName(),
request.getPayTime(), request.getPayPic())) {
return Boolean.FALSE;
}
if (Objects.isNull(request.getPayType()) || request.getLineId() == null || request.getShopId() == null) {
return Boolean.FALSE;
}
if (!request.getPayBusinessType().equals(PayBusinessTypeEnum.FRANCHISE_FEE.getCode())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long submitPayInfo(LinePaySubmitRequest request, PartnerUserInfoVO partnerUser) {
@@ -139,26 +259,54 @@ public class LinePayServiceImpl implements LinePayService {
if (Objects.isNull(request.getPayBusinessType())) {
request.setPayBusinessType(Constants.ZERO_INTEGER);
}
if (request.getPayBusinessType().equals(PayBusinessTypeEnum.FRANCHISE_FEE.getCode())) {
throw new ServiceException(ErrorCodeEnum.API_CALL_ERROR);
}
LineInfoDO lineInfo = new LineInfoDO();
if (request.getLineId() != null) {
lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
}
// //缴纳加盟费检验缴费人必须是加盟商
// if(PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && !lineInfo.getUsername().trim().equals(request.getPayUserName().trim())){
// throw new ServiceException(ErrorCodeEnum.CHECK_PAYER_ERROR);
// }
LinePayDO linePayDO = linePayDAO.getByLineIdAndPayTypeAndShopId(request.getLineId(), request.getPayBusinessType(), request.getShopId());
linePayDO = checkAndFill(linePayDO, request, partnerUser);
Long payId = linePayDO.getId();
if (PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && payId != null) {
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
if (Objects.isNull(franchiseFeeDO)) {
throw new ServiceException(ErrorCodeEnum.UNISSUED_STATEMENT);
}
franchiseFeeDO.setPayId(payId);
franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
//todo 苏竹红推送数据
// if (PayBusinessTypeEnum.FRANCHISE_FEE.getCode().equals(request.getPayBusinessType()) && payId != null) {
// FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
// if (Objects.isNull(franchiseFeeDO)) {
// throw new ServiceException(ErrorCodeEnum.UNISSUED_STATEMENT);
// }
// franchiseFeeDO.setPayId(payId);
// franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
// shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_72);
// ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(franchiseFeeDO.getShopId());
// Set<String> auditFranchiseFeeUsers = new HashSet<>();
// List<EnterpriseUserDO> branchUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.BRANCH_OFFICE, shopInfoDO.getRegionId());
// if (Objects.nonNull(branchUser)) {
// Set<String> branchUserIds = branchUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
// auditFranchiseFeeUsers.addAll(branchUserIds);
// }
// List<EnterpriseUserDO> regionUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.REGION_OFFICE, shopInfoDO.getRegionId());
// if (Objects.nonNull(regionUser)) {
// Set<String> regionUserIds = regionUser.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toSet());
// auditFranchiseFeeUsers.addAll(regionUserIds);
// }
// HashMap<String, String> map = new HashMap<>();
// map.put("partnerUsername", lineInfo.getUsername());
// map.put("partnerMobile", lineInfo.getMobile());
// map.put("storeName", shopInfoDO.getShopName());
// commonService.sendQWMessage(new ArrayList<>(auditFranchiseFeeUsers),
// MessageEnum.MESSAGE_18,
// map);
// }
if (PayBusinessTypeEnum.INTENT_MONEY.getCode().equals(request.getPayBusinessType())) {
lineInfo.setWorkflowSubStage(WorkflowSubStageEnum.PAY_DEPOSIT.getCode());
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
lineInfoDAO.insertOrUpdate(lineInfo);
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfo.getUsername());
map.put("partnerMobile", lineInfo.getMobile());
commonService.sendQWMessage(Collections.singletonList(lineInfo.getInvestmentManager()),
MessageEnum.MESSAGE_5,
map);
}
return payId == null ? null : payId;
}
@@ -179,7 +327,6 @@ public class LinePayServiceImpl implements LinePayService {
}
private void fillLinePay(Boolean isAdd, LinePayDO linePayDO, LinePaySubmitRequest request, PartnerUserInfoVO partnerUser) {
linePayDO.setPaySerialNumber(request.getPaySerialNumber());
linePayDO.setCombinedField(request.getCombinedField());
linePayDO.setPayType(request.getPayType());
linePayDO.setPayUserName(request.getPayUserName());

View File

@@ -5,6 +5,7 @@ import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dto.AmountDTO;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LinePayService;
import com.cool.store.vo.LinePayVO;
@@ -17,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author wxp
@@ -44,12 +46,22 @@ public class PCLinePayController {
return ResponseResult.success(linePayService.getAmount(lineId));
}
@ApiOperation("缴纳意向金/加盟费")
@PostMapping("/submitPayInfo")
public ResponseResult<Long> submitPayInfo(@RequestBody LinePaySubmitRequest request){
PartnerUserInfoVO partnerUser = PartnerUserHolder.getUser();
return ResponseResult.success(linePayService.submitPayInfo(request, partnerUser));
@ApiOperation("加盟费提交缴费信息")
@PostMapping("/submitFranchiseFeePayInfo")
public ResponseResult<Long> submitFranchiseFeePayInfo(@RequestBody LinePaySubmitRequest request){
return ResponseResult.success(linePayService.submitFranchiseFeePayInfo(request, CurrentUserHolder.getUserId()));
}
@ApiOperation("查询加盟费缴费信息")
@GetMapping("/getFranchiseFeePayInfoList")
public ResponseResult<List<FranchiseFeePayInfoResponse>> getFranchiseFeePayInfoList(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(linePayService.getFranchiseFeePayInfoList(shopId));
}
@ApiOperation("删除加盟费缴费信息")
@GetMapping("/deleteFranchiseFeePayInfo")
public ResponseResult<Boolean> deleteFranchiseFeePayInfo(@RequestParam("id") Long id) {
return ResponseResult.success(linePayService.deleteFranchiseFeePayInfo(id, CurrentUserHolder.getUserId()));
}
}

View File

@@ -5,6 +5,7 @@ import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dto.AmountDTO;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.response.FranchiseFeePayInfoResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LinePayService;
import com.cool.store.vo.LinePayVO;
@@ -17,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author wxp
@@ -54,4 +56,22 @@ public class LinePayController {
return ResponseResult.success(linePayService.getAmount(lineId));
}
@ApiOperation("加盟费提交缴费信息")
@PostMapping("/submitFranchiseFeePayInfo")
public ResponseResult<Long> submitFranchiseFeePayInfo(@RequestBody LinePaySubmitRequest request){
return ResponseResult.success(linePayService.submitFranchiseFeePayInfo(request, PartnerUserHolder.getUser().getPartnerId()));
}
@ApiOperation("查询加盟费缴费信息")
@GetMapping("/getFranchiseFeePayInfoList")
public ResponseResult<List<FranchiseFeePayInfoResponse>> getFranchiseFeePayInfoList(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(linePayService.getFranchiseFeePayInfoList(shopId));
}
@ApiOperation("删除加盟费缴费信息")
@GetMapping("/deleteFranchiseFeePayInfo")
public ResponseResult<Boolean> deleteFranchiseFeePayInfo(@RequestParam("id") Long id) {
return ResponseResult.success(linePayService.deleteFranchiseFeePayInfo(id, PartnerUserHolder.getUser().getPartnerId()));
}
}