加盟商编码

This commit is contained in:
guohb
2024-04-08 15:12:58 +08:00
parent 19ca51a3be
commit de3fca1aee
10 changed files with 258 additions and 10 deletions

View File

@@ -0,0 +1,44 @@
package com.cool.store.enums;
public enum ReceivingBankEnum {
XFSG_RECEIVING_BANK("鲜丰水果股份有限公司","33050161642700001117","中国建设银行浙江省分行文晖支行"),
;
private String accountName;
private String accountNum;
private String bank;
ReceivingBankEnum(String accountName, String accountNum, String bank) {
this.accountName = accountName;
this.accountNum = accountNum;
this.bank = bank;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNum() {
return accountNum;
}
public void setAccountNum(String accountNum) {
this.accountNum = accountNum;
}
public String getBank() {
return bank;
}
public void setBank(String bank) {
this.bank = bank;
}
}

View File

@@ -113,7 +113,10 @@
update_user_id,
</if>
<if test="param.deleted != null">
deleted
deleted,
</if>
<if test="param.partnerNum != null">
partner_num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -198,6 +201,9 @@
<if test="param.deleted != null">
#{param.deleted}
</if>
<if test="param.partnerNum != null">
#{param.partnerNum}
</if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
@@ -279,6 +285,9 @@
<if test="param.deleted != null">
deleted = #{param.deleted}
</if>
<if test="param.partnerNum != null">
partner_num = #{param.partnerNum}
</if>
</trim>
</insert>
<update id="toExperiencing">

View File

@@ -0,0 +1,72 @@
package com.cool.store.entity;
import lombok.Data;
@Data
public class FranchiseeDO {
/**
* 开户行
*/
private String bank;
/**
* 开户行支行
*/
private String bankSub;
/**
* 生日
*/
private String birthday;
/**
* 城市代码
*/
private String cityCode;
/**
* 加盟商手机号码
*/
private String frMobile;
/**
* 加盟商姓名
*/
private String frName;
/**
* 个人身份证号/企业统一社会信用代码
*/
private String idCard;
/**
* 身份证地址/公司地址
*/
private String idCardAddress;
/**
* 身份证原件国徽面/食品经营许可证上传
*/
private String idCardBackUrl;
/**
* 身份证原件正面地址/营业执照拍照上传
*/
private String idCardFrontUrl;
/**
* 操作人工号
*/
private String operator;
/**
* 缴款时间
*/
private String payDateStr;
/**
* 省份代码
*/
private String provinceCode;
/**
* 收款账户
*/
private String retAccount;
/**
* 性别0-女1-男
*/
private Integer sex;
/**
* 签约类型0-个人签约1-企业签约
*/
private long signType;
}

View File

@@ -163,7 +163,9 @@ public class LineInfoDO {
* 是否删除0.否 1.是
*/
private Boolean deleted;
/**
* 加盟商编码
*/
private String partnerNum;
}

View File

@@ -0,0 +1,54 @@
package com.cool.store.request;
import com.cool.store.entity.FranchiseeDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class FranchiseeSaveRequest {
private String partnerId;
private Long lineId;
@ApiModelProperty("加盟商姓名")
private String frName;
@ApiModelProperty("加盟商手机号码")
private String frMobile;
@ApiModelProperty("个人身份证号/企业统一社会信用代码")
private String idCard;
@ApiModelProperty("身份证地址/公司地址")
private String idCardAddress;
@ApiModelProperty("性别0-女1-男")
private Integer sex;
@ApiModelProperty("身份证原件正面地址/营业执照拍照上传")
private String idCardFrontUrl;
@ApiModelProperty("身份证原件国徽面/食品经营许可证上传")
private String idCardBackUrl;
@ApiModelProperty("0-个人签约1-企业签约")
private Integer signType;
@ApiModelProperty("生日,企业不用传")
private String birthday;
public FranchiseeDO toFranchiseeDO() {
FranchiseeDO franchiseeDO = new FranchiseeDO();
franchiseeDO.setBirthday(this.birthday);
franchiseeDO.setFrMobile(this.frMobile);
franchiseeDO.setFrName(this.frName);
franchiseeDO.setIdCard(this.idCard);
franchiseeDO.setIdCardAddress(this.idCardAddress);
franchiseeDO.setIdCardBackUrl(this.idCardBackUrl);
franchiseeDO.setIdCardFrontUrl(this.idCardFrontUrl);
franchiseeDO.setSex(this.sex);
franchiseeDO.setSignType(this.signType);
return franchiseeDO;
}
}

View File

@@ -31,4 +31,8 @@ public class LoginUserInfo {
// private SysRoleDO sysRole;
private Integer onlineStatus;
/**
* 工号
*/
private String jobNumber;
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.service;
import com.cool.store.request.FranchiseeSaveRequest;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.InitiatingResponse;
@@ -22,4 +23,6 @@ public interface IntentAgreementService {
SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId);
InitiatingResponse initiating(InitiatingRequest request);
InitiatingResponse save(FranchiseeSaveRequest request);
}

View File

@@ -1,19 +1,19 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ReceivingBankEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.IntentAgreementMapper;
import com.cool.store.mapper.JoinIntentionMapper;
import com.cool.store.mapper.LineAuditInfoMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.*;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.FranchiseeSaveRequest;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.request.IntentAgreementSubmitRequest;
import com.cool.store.response.InitiatingResponse;
@@ -28,11 +28,11 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import static com.cool.store.enums.ErrorCodeEnum.PARAMS_VALIDATE_ERROR;
@Service
@Slf4j
@@ -60,6 +60,12 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Resource
LineAuditInfoMapper lineAuditInfoMapper;
@Resource
LinePayMapper linePayMapper;
@Resource
HyOpenAreaInfoMapper openAreaInfoMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -88,7 +94,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
@Override
public SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId) {
if (StringUtil.isBlank(partnerId) && lineId == null) {
throw new ServiceException(PARAMS_VALIDATE_ERROR);
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(partnerId, lineId);
if (Objects.isNull(signingBaseInfoDO)) {
@@ -98,9 +104,9 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
SigningBaseInfoResponse response = SigningBaseInfoResponse.from(signingBaseInfoDO);
MemberQuestionDO byLineId = joinIntentionMapper.getByLineId(lineId);
response.setType(byLineId.getJoinType());
if (Objects.nonNull(signingBaseInfoDO.getAuditId())){
if (Objects.nonNull(signingBaseInfoDO.getAuditId())) {
LineAuditInfoDO lineAuditInfoDO = lineAuditInfoMapper.selectByPrimaryKey(signingBaseInfoDO.getAuditId());
if (Objects.isNull(lineAuditInfoDO)){
if (Objects.isNull(lineAuditInfoDO)) {
response.setRejectPublicReason(null);
}
response.setRejectPublicReason(lineAuditInfoDO.getRejectPublicReason());
@@ -187,6 +193,46 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
}
@Override
public InitiatingResponse save(FranchiseeSaveRequest request) {
log.info("save request:{}", JSONObject.toJSONString(request));
if (Objects.isNull(request)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap);
String url = xfsgUrl + Constants.FRANCHISEE_STORE_NUM + "?timestamp=" + requestMap.get("timestamp") + "&signature=" + requestMap.get("signature");
FranchiseeDO franchiseeDO = request.toFranchiseeDO();
//查银行信息
LinePayDO linePayDO = linePayMapper.getLinePayByLineId(request.getLineId());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateString = sdf.format(linePayDO.getPayTime());
franchiseeDO.setPayDateStr(dateString);
franchiseeDO.setRetAccount(ReceivingBankEnum.XFSG_RECEIVING_BANK.getAccountNum());
franchiseeDO.setBank(linePayDO.getBankCode());
franchiseeDO.setBankSub(linePayDO.getBranchBankCode());
//查城市信息
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId());
HyOpenAreaInfoDO openAreaInfoDO = openAreaInfoMapper.selectById(lineInfoDO.getWantShopAreaId());
franchiseeDO.setProvinceCode(String.valueOf(openAreaInfoDO.getParentId()));
franchiseeDO.setCityCode(String.valueOf(openAreaInfoDO.getId()));
//操作人工号 暂时写死
LoginUserInfo user = CurrentUserHolder.getUser();
franchiseeDO.setOperator("22090043");
InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, franchiseeDO, InitiatingResponse.class);
//更新线索(进入蓄水池并回填加盟商编码)
if (initiatingResponse.getCode() == 0){
LineInfoDO lineInfoParam = new LineInfoDO();
lineInfoParam.setId(request.getLineId());
//蓄水池
lineInfoParam.setJoinStatus(1);
lineInfoParam.setPartnerNum(initiatingResponse.getData());
lineInfoMapper.updateByPrimaryKeySelective(lineInfoParam);
}
return initiatingResponse;
}
private void fillSignatureInfo(Map<String, Object> requestMap) {
long timestamp = System.currentTimeMillis();
String signature = SecureUtil.getSignature(timestamp);

View File

@@ -170,6 +170,11 @@ public class Constants
public static final String INTENTION_CONTRACT_URL = "/api/coolstore/start-flow/intention-contract";
public static final String FRANCHISEE_STORE_NUM = "/api/kdz/franchisee/save";
public static final Integer ZERO_INTEGER = 0;
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.controller.webb;
import com.cool.store.request.FranchiseeSaveRequest;
import com.cool.store.request.InitiatingRequest;
import com.cool.store.response.InitiatingResponse;
import com.cool.store.response.ResponseResult;
@@ -36,5 +37,13 @@ public class PCIntentAgreementController {
return ResponseResult.success(intentAgreementService.initiating(request));
}
@PostMapping(path = "/franchisee/save")
@ApiOperation("kdz -> xfsg 加盟商新增")
public ResponseResult<InitiatingResponse> save(@RequestBody FranchiseeSaveRequest request) {
return ResponseResult.success(intentAgreementService.save(request));
}
}