|
|
|
|
@@ -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);
|
|
|
|
|
|