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

This commit is contained in:
zhangchenbiao
2024-04-29 17:08:12 +08:00
57 changed files with 2339 additions and 408 deletions

View File

@@ -3,6 +3,7 @@ package com.cool.store.service;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.decoration.DecorationModelDTO;
import com.cool.store.request.DecorationPayRequest;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.vo.DesignInfoVo;
import com.cool.store.vo.PartnerUserInfoVO;
@@ -26,23 +27,23 @@ public interface DecorationService {
* @Date: 2024/4/28
* @description:设计阶段信息
*/
DesignInfoVo DesignInfo(String shopCode);
DesignInfoVo DesignInfo(Long shopId);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:获取装修款和支付二维码
*/
DecorationModelDTO DecorationModel(String shopCode);
DecorationModelDTO DecorationModel(Long shopId);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:提交装修款付款凭证
*/
String submitDecorationModel(DecorationPayRequest decorationPayRequest, PartnerUserInfoVO partnerUserInfoVO);
String submitDecorationModel(LinePaySubmitRequest LinePaySubmitRequest, PartnerUserInfoVO partnerUserInfoVO);
/**
* @Auther: wangshuo
* @Date: 2024/4/28
* @description:施工阶段
*/
List<ConstructionScheduleDTO> getConstruction(String shopCode);
List<ConstructionScheduleDTO> getConstruction(Long shopId);
}

View File

@@ -1,13 +1,19 @@
package com.cool.store.service;
import com.cool.store.request.AddSignFranchiseRequest;
import com.cool.store.response.AddSignFranchiseResponse;
import com.cool.store.response.ResponseResult;
public interface SignFranchiseService {
/**
* 提交加盟合同签约
*
* @param request
* @return
*/
ResponseResult submitSignFranchise(AddSignFranchiseRequest request);
AddSignFranchiseResponse getSignFranchise(Long shopId);
}

View File

@@ -14,7 +14,6 @@ public interface XfsgEhrService {
* @return
*/
StaffBaseInfoDTO getUserInfoByCode(String staffNumber);
/**
* 根据加盟商编码查询加盟商
* @param frId
@@ -22,5 +21,8 @@ public interface XfsgEhrService {
*/
FranchiseeInfoDTO getFranchiseeInfoByFrId(String frId);
StaffBaseInfoDTO getUserInfoByIdCard(String idCard);
}

View File

@@ -0,0 +1,18 @@
package com.cool.store.service;
import com.cool.store.dto.yun.StudentResultDTO;
import java.util.List;
import java.util.Map;
/**
* @author byd
* @date 2024-04-29 9:55
*/
public interface YunXueTangApiService {
String getAccessToken();
Map<String, StudentResultDTO> studentResultUserList(List<String> userIdList);
}

View File

@@ -3,17 +3,26 @@ package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.LinePayDAO;
import com.cool.store.dao.RegionQrcodeConfigDao;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dto.decoration.*;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.LinePayDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.PayTypeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.DecorationPayRequest;
import com.cool.store.request.LinePaySubmitRequest;
import com.cool.store.service.DecorationService;
import com.cool.store.service.LinePayService;
import com.cool.store.service.YlfService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.DesignInfoVo;
import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.log.DesignLogVo;
@@ -21,6 +30,7 @@ import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
@@ -44,7 +54,10 @@ public class DecorationServiceImpl implements DecorationService {
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private LinePayDAO linePayDAO;
private LineInfoDAO lineInfoDAO;
@Resource
private LinePayService linePayService;
private static String MEASURING_THE_ROOM = "量房";
private static String CONSTRUCTION_DRAWING = "施工图+预算";
@Override
@@ -53,10 +66,8 @@ public class DecorationServiceImpl implements DecorationService {
}
@Override
public DesignInfoVo DesignInfo(String shopCode) {
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
public DesignInfoVo DesignInfo(Long shopId) {
DecorationDTO decoration = getDecorationDTO(shopId);
List<DesignSchemeDTO> designScheme = decoration.getDesignScheme();
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
@@ -78,54 +89,61 @@ public class DecorationServiceImpl implements DecorationService {
return designInfoVo;
}
@Override
public DecorationModelDTO DecorationModel(String shopCode) {
if (StringUtils.isEmpty(shopCode)){
public DecorationModelDTO DecorationModel(Long shopId) {
if (shopId == null){
log.error("DecorationModel shopCode is null");
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
DecorationDTO decoration = getDecorationDTO(shopId);
//TODO 验证
//预算
List<BudgetDTO> proposedBookBudget = decoration.getProposedBookBudget();
Collections.sort(decoration.getProposedBookBudget(),(x1,x2)->x2.getId().compareTo(x1.getId()));
String totalAmount = proposedBookBudget.get(0).getTotalAmount();
//支付二维码url
Long regionId = shopInfoDAO.getRegionIdByShopCode(shopCode);
Long regionId = shopInfoDAO.getRegionIdByid(shopId);
String payPic = regionQrcodeConfigDao.getPayPicByRegionId(regionId);
DecorationModelDTO decorationModelDTO = new DecorationModelDTO();
decorationModelDTO.setPayUrl(payPic);
decorationModelDTO.setTotalAmount(totalAmount);
return decorationModelDTO;
}
@Transactional(rollbackFor = Exception.class)
@Override
public String submitDecorationModel(DecorationPayRequest decorationPayRequest, PartnerUserInfoVO partnerUserInfoVO) {
LinePayDO linePayDO =new LinePayDO();
BeanUtil.copyProperties(decorationPayRequest, linePayDO);
linePayDO.setCreateTime(new Date());
linePayDO.setUpdateTime(new Date());
linePayDO.setLineId(partnerUserInfoVO.getLineId());
linePayDO.setCreateUserId(partnerUserInfoVO.getUsername());
linePayDO.setUpdateUserId(partnerUserInfoVO.getUsername());
linePayDO.setPayBusinessType(2);
linePayDO.setPayType(2);
return "";
public String submitDecorationModel(LinePaySubmitRequest request, PartnerUserInfoVO partnerUserInfoVO) {
DecorationDTO decoration = getDecorationDTO(request.getShopId());
if ( decoration.getPayment() != null && decoration.getPayment().size()>0){
request.setPayStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
}else {
request.setPayStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_45.getCode());
}
Long payId = linePayService.submitPayInfo(request, partnerUserInfoVO);
return payId.toString();
}
@Override
public List<ConstructionScheduleDTO> getConstruction(String shopCode) {
ProjectDTO projectList = ylfService.getProjectList(shopCode);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
public List<ConstructionScheduleDTO> getConstruction(Long shopId) {
DecorationDTO decoration = getDecorationDTO(shopId);
List<ConstructionScheduleDTO> constructionSchedule = decoration.getConstructionSchedule();
Map<String, ConstructionScheduleDTO> constructionScheduleMap = constructionSchedule.stream().collect(Collectors.toMap(ConstructionScheduleDTO::getName,
dto -> dto));
constructionScheduleMap.remove(MEASURING_THE_ROOM);
constructionScheduleMap.remove(CONSTRUCTION_DRAWING);
List<ConstructionScheduleDTO> collect = constructionScheduleMap.values().stream().collect(Collectors.toList());
collect.sort(Comparator.comparing(ConstructionScheduleDTO::getId));
return collect;
}
private DecorationDTO getDecorationDTO(Long shopId) {
List<Long> shopIds =new ArrayList<>();
shopIds.add(shopId);
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryStoreNumeListByid(shopIds);
String storeNum = openPlanShopInfoDTOS.get(0).getStoreNum();
ProjectDTO projectList = ylfService.getProjectList(storeNum);
String projectId = projectList.getProjectId();
DecorationDTO decoration = ylfService.getDecoration(Long.parseLong(projectId));
return decoration;
}
}

View File

@@ -5,11 +5,13 @@ import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.FranchiseFeeDO;
import com.cool.store.entity.LineInfoDO;
import com.cool.store.entity.LinePayDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.LinePayMapper;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.cool.store.request.AuditFranchiseFeeRequest;
@@ -22,6 +24,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.Objects;
@Service
@Slf4j
@@ -39,6 +43,9 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
@Resource
ShopStageInfoDAO shopStageInfoDAO;
@Resource
LineInfoMapper lineInfoMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean submitLicense(FranchiseFeeRequest request) {
@@ -54,8 +61,17 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
franchiseFeeDO.setShopId(shopId);
FranchiseFeeDO result = franchiseFeeMapper.selectOneByExample(franchiseFeeDO);
LinePayDO linePayDO = linePayMapper.selectByPrimaryKey(result.getPayId());
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(linePayDO.getLineId());
FranchiseFeeResponse resp = FranchiseFeeResponse.from(result);
resp.setLinePayDO(linePayDO);
FranchiseFeeResponse.LinePay linePayResult = FranchiseFeeResponse.LinePay.from(linePayDO);
linePayResult.setAmount(new BigInteger(result.getPerformanceBond()).add(new BigInteger(result.getFirstYearFee())).toString());
linePayResult.setPartnerName(lineInfoDO.getUsername());
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);
return resp;
}
@@ -64,7 +80,7 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
shopAuditInfoDO.setShopId(request.getShopId());
ShopSubStageStatusEnum shopSubStageStatusEnum = null;
shopAuditInfoDO.setAuditType(AuditTypeEnum.LICENSE_APPROVAL.getCode());
shopAuditInfoDO.setAuditType(AuditTypeEnum.PAY_FRANCHISE_FEE.getCode());
LoginUserInfo user = CurrentUserHolder.getUser();
shopAuditInfoDO.setSubmittedUserId(user.getUserId());
shopAuditInfoDO.setSubmittedUserName(user.getName());
@@ -77,7 +93,14 @@ public class FranchiseFeeServiceImpl implements FranchiseFeeService {
shopAuditInfoDO.setRejectReason(request.getResult());
shopSubStageStatusEnum = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_74;
}
//更新阶段信息
shopStageInfoDAO.updateShopStageInfo(request.getShopId(),shopSubStageStatusEnum);
return shopAuditInfoMapper.insertSelective(shopAuditInfoDO) == 1 ? true : false;
//插入audit
shopAuditInfoMapper.insertSelective(shopAuditInfoDO);
//更新auditId
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByPrimaryKey(request.getId());
franchiseFeeDO.setAuditId(shopAuditInfoDO.getId());
franchiseFeeMapper.updateByPrimaryKeySelective(franchiseFeeDO);
return true;
}
}

View File

@@ -11,6 +11,8 @@ import com.cool.store.entity.LinePayDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.point.PayBusinessTypeEnum;
import com.cool.store.enums.point.PayTypeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.mapper.LineInfoMapper;
@@ -82,7 +84,10 @@ public class LinePayServiceImpl implements LinePayService {
fillLinePay(false, linePayDO, request, partnerUser);
linePayDAO.updateLinePay(linePayDO);
}
}else {
}
if(request.getPayBusinessType() != null
&& request.getPayBusinessType() == 0
&& request.getShopId() != null) {
LinePayDO linePayDO = linePayDAO.getLinePayByLineIdAndPayType(request.getLineId(),0);
if(linePayDO == null){
linePayDO = new LinePayDO();
@@ -98,6 +103,20 @@ public class LinePayServiceImpl implements LinePayService {
lineInfoDAO.insertOrUpdate(lineInfo);
return linePayDO.getId();
}
if (request.getPayBusinessType() != null
&& request.getPayBusinessType() == PayBusinessTypeEnum.DECORATION_MODEL.getCode()
&& request.getShopId() != null){
LinePayDO linePayDO = linePayDAO.getLinePayByLineIdAndPayType(request.getLineId(),PayBusinessTypeEnum.DECORATION_MODEL.getCode());
if(linePayDO == null){
linePayDO = new LinePayDO();
fillLinePay(true, linePayDO, request, partnerUser);
linePayDAO.addLinePay(linePayDO);
}else {
fillLinePay(false, linePayDO, request, partnerUser);
linePayDAO.updateLinePay(linePayDO);
}
return linePayDO.getId();
}
return null;
}

View File

@@ -164,7 +164,7 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
OpeningOperationPlanListVO openingOperationPlanListVO = new OpeningOperationPlanListVO();
openingOperationPlanListVO.setShopId(x.getShopId());
openingOperationPlanListVO.setShopName(x.getShopName());
openingOperationPlanListVO.setShopCode(x.getShopCode());
openingOperationPlanListVO.setStoreNum(x.getStoreNum());
openingOperationPlanListVO.setPartnerName(x.getPartnerName());
openingOperationPlanListVO.setMobile(x.getMobile());
String[] split = regionNameMap.getOrDefault(x.getRegionId(), "").split("-");

View File

@@ -2,7 +2,6 @@ package com.cool.store.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
@@ -10,6 +9,7 @@ import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.*;
import com.cool.store.enums.AuditEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.FranchiseeTypeEnum;
import com.cool.store.enums.SignTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
@@ -17,11 +17,12 @@ import com.cool.store.mapper.*;
import com.cool.store.request.AddSignFranchiseRequest;
import com.cool.store.request.AuditResultRequest;
import com.cool.store.request.FranchiseAgreementRequest;
import com.cool.store.response.AddSignFranchiseResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.SignFranchiseService;
import com.cool.store.service.SysStoreAppService;
import com.cool.store.utils.poi.DateUtils;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -34,7 +35,7 @@ import java.util.Objects;
@Service
@Slf4j
public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResultService{
public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResultService {
@Resource
SignFranchiseMapper signFranchiseMapper;
@@ -76,15 +77,15 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
@Override
public Boolean auditResult(AuditResultRequest request) {
log.info("SignFranchiseServiceImpl auditResult request{}",JSONObject.toJSONString(request));
log.info("SignFranchiseServiceImpl auditResult request{}", JSONObject.toJSONString(request));
Long shopId = getShopId(request.getKdzBusinessId());
ShopSubStageStatusEnum shopSubStageStatusEnum = null;
if (request.getAuditResult() == 1){
if (request.getAuditResult() == 1) {
shopSubStageStatusEnum = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84;
}else if (request.getAuditResult() == 0){
} else if (request.getAuditResult() == 0) {
shopSubStageStatusEnum = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_85;
}
shopStageInfoDAO.updateShopStageInfo(shopId,shopSubStageStatusEnum);
shopStageInfoDAO.updateShopStageInfo(shopId, shopSubStageStatusEnum);
return null;
}
@@ -111,7 +112,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
}
//店铺信息
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(request.getShopId());
FranchiseAgreementRequest franchiseAgreementRequest = convertFranchiseAgreement(request,shopInfoDO);
FranchiseAgreementRequest franchiseAgreementRequest = convertFranchiseAgreement(request, shopInfoDO);
MemberQuestionDO memberQuestionDO = joinIntentionMapper.getByLineId(shopInfoDO.getLineId());
ResponseResult responseResult = coolStoreStartFlowService.franchiseAgreement(franchiseAgreementRequest, memberQuestionDO.getJoinType());
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_83);
@@ -120,7 +121,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
public FranchiseAgreementRequest convertFranchiseAgreement(AddSignFranchiseRequest request,
ShopInfoDO shopInfoDO){
ShopInfoDO shopInfoDO) {
LoginUserInfo user = CurrentUserHolder.getUser();
//shopId
@@ -142,9 +143,10 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
//证照办理
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectOne(LicenseTransactDO.builder().shopId(shopId).build());
//三方部门表
ThirdDepartmentDO thirdDepartmentDO= thirdDepartmentMapper.getByName(systemBuildingShopDO.getBigName());
ThirdDepartmentDO thirdDepartmentDO = thirdDepartmentMapper.getByName(systemBuildingShopDO.getBigName());
//找不到的url统一用这个
List<String> temp = new ArrayList<>();temp.add("object");
List<String> temp = new ArrayList<>();
temp.add("object");
Convert.digitToChinese(123);
FranchiseAgreementRequest buildResult = FranchiseAgreementRequest.builder()
.apply_user(user.getJobNumber())
@@ -214,7 +216,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
.jmsxm1(lineInfoDO.getUsername())
.jsrq(DateUtils.dateTime(request.getContractStartEndTime()))
.jszhhz(linePayDO.getPayAccount())
.kdzBusinessId(AuditEnum.SIGN_FRANCHISE+"_"+shopId+"_"+lineId)
.kdzBusinessId(AuditEnum.SIGN_FRANCHISE + "_" + shopId + "_" + lineId)
.khhjzh(linePayDO.getBankName())
.lvbzj(Integer.valueOf(franchiseFeeDO.getPerformanceBond()))
.lybzjdx(Integer.valueOf(franchiseFeeDO.getPerformanceBond()))
@@ -237,13 +239,13 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
.remark(request.getRemark())
.remark2(systemBuildingShopDO.getReasons())
.sfbq__add(request.getResign())
.sj1(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_END,request.getBusinessStartHours()))
.sj2(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_END,request.getBusinessEndHours()))
.sj1(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_END, request.getBusinessStartHours()))
.sj2(DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_END, request.getBusinessEndHours()))
.social_credit_code(licenseTransactDO.getCreditCode())
.spltxkz(temp)
.sqr_name(user.getName())
.sqrq(DateUtils.getDate())
.title("特许经营合同审批申请2023-"+ lineInfoDO.getUsername() +"-" + DateUtils.getDate())
.title("特许经营合同审批申请2023-" + lineInfoDO.getUsername() + "-" + DateUtils.getDate())
.wlyzbm("201905081151092R")
.yycs(Integer.valueOf(request.getImpressionNum()))
.yyzzblsqs(temp)
@@ -254,4 +256,100 @@ public class SignFranchiseServiceImpl implements SignFranchiseService ,AuditResu
return buildResult;
}
@Override
public AddSignFranchiseResponse getSignFranchise(Long shopId) {
SignFranchiseDO signFranchiseDO = signFranchiseMapper.selectByShopId(shopId);
AddSignFranchiseResponse response = from(signFranchiseDO, shopId);
return response;
}
public AddSignFranchiseResponse from(SignFranchiseDO signFranchiseDO,
Long shopId) {
AddSignFranchiseResponse addSignFranchiseResponse = new AddSignFranchiseResponse();
//店铺信息
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
//线索信息
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(shopInfoDO.getLineId());
//缴费信息
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectOne(FranchiseFeeDO.builder().shopId(shopId).build());
//线索id
Long lineId = shopInfoDO.getLineId();
//签约信息
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineId);
//缴款信息
LinePayDO linePayDO = linePayMapper.getLinePayByLineIdAndPayType(lineId, 1);
//铺位信息
PointInfoDO pointInfoDO = pointInfoMapper.getDataByShopIdAndLineId(lineId, shopId);
//建店数据
SystemBuildingShopDO systemBuildingShopDO = systemBuildingShopMapper.selectOne(SystemBuildingShopDO.builder().shopId(shopId).lineId(lineId).build());
//证照办理
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectOne(LicenseTransactDO.builder().shopId(shopId).build());
if (Objects.nonNull(signFranchiseDO)) {
addSignFranchiseResponse.setId(signFranchiseDO.getId());
addSignFranchiseResponse.setShopId(signFranchiseDO.getShopId());
addSignFranchiseResponse.setSignType(signFranchiseDO.getSignType());
addSignFranchiseResponse.setBrandFee(signFranchiseDO.getBrandFee());
addSignFranchiseResponse.setIsBusinessLicense(signFranchiseDO.getIsBusinessLicense());
addSignFranchiseResponse.setIsFoodLicense(signFranchiseDO.getIsFoodLicense());
addSignFranchiseResponse.setContractStartTime(signFranchiseDO.getContractStartTime());
addSignFranchiseResponse.setContractStartEndTime(signFranchiseDO.getContractStartEndTime());
addSignFranchiseResponse.setImpressionNum(signFranchiseDO.getImpressionNum());
addSignFranchiseResponse.setBusinessStartHours(signFranchiseDO.getBusinessStartHours());
addSignFranchiseResponse.setBusinessEndHours(signFranchiseDO.getBusinessEndHours());
addSignFranchiseResponse.setIrregularReason(signFranchiseDO.getIrregularReason());
addSignFranchiseResponse.setRemark(signFranchiseDO.getRemark());
addSignFranchiseResponse.setResign(signFranchiseDO.getResign());
addSignFranchiseResponse.setMobile(signFranchiseDO.getMobile());
} else {
addSignFranchiseResponse.setMobile(lineInfoDO.getMobile());
}
if(Objects.nonNull(systemBuildingShopDO)){
addSignFranchiseResponse.setStoreName(systemBuildingShopDO.getStoreName());
addSignFranchiseResponse.setBigRegion(systemBuildingShopDO.getBigName());
addSignFranchiseResponse.setBigRegionManager(systemBuildingShopDO.getRegioGeneral());
addSignFranchiseResponse.setFranchiseeType(FranchiseeTypeEnum.getByCode(systemBuildingShopDO.getFranchiseeType()).getMessage());
addSignFranchiseResponse.setReasons(systemBuildingShopDO.getReasons());
}
if (Objects.nonNull(pointInfoDO)){
addSignFranchiseResponse.setStoreAddress(pointInfoDO.getAddress());
}
if (Objects.nonNull(linePayDO)){
addSignFranchiseResponse.setPayName(linePayDO.getPayUserName());
addSignFranchiseResponse.setBankCardNo(linePayDO.getPayAccount());
addSignFranchiseResponse.setBank(linePayDO.getBankName());
addSignFranchiseResponse.setSubBank(linePayDO.getBranchBankName());
addSignFranchiseResponse.setPayDate(linePayDO.getPayTime());
}
if (Objects.nonNull(licenseTransactDO)){
addSignFranchiseResponse.setLicenseName(licenseTransactDO.getBusinessLicense());
addSignFranchiseResponse.setOpeAddress(licenseTransactDO.getLicenseAddress());
addSignFranchiseResponse.setOperator(licenseTransactDO.getOperator());
}
if (Objects.nonNull(lineInfoDO)){
addSignFranchiseResponse.setPartnerName(lineInfoDO.getUsername());
}
if (Objects.nonNull(signingBaseInfoDO)){
addSignFranchiseResponse.setIdCardNo(signingBaseInfoDO.getIdCardNo());
addSignFranchiseResponse.setIdCardAddress(signingBaseInfoDO.getIdCardAddress());
}
if (Objects.nonNull(franchiseFeeDO)){
addSignFranchiseResponse.setYearFranchiseFee(franchiseFeeDO.getYearFranchiseFee());
addSignFranchiseResponse.setBigYearFranchiseFee(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getYearFranchiseFee())));
addSignFranchiseResponse.setLoanMargin(franchiseFeeDO.getLoanMargin());
addSignFranchiseResponse.setBigLoanMargin(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getLoanMargin())));
addSignFranchiseResponse.setFirstYearStartTime(franchiseFeeDO.getFirstYearStartTime());
addSignFranchiseResponse.setFirstYearEndTime(franchiseFeeDO.getFirstYearEndTime());
addSignFranchiseResponse.setFirstYearFee(franchiseFeeDO.getFirstYearFee());
addSignFranchiseResponse.setSecondYearStartTime(franchiseFeeDO.getSecondYearStartTime());
addSignFranchiseResponse.setSecondYearEndTime(franchiseFeeDO.getSecondYearEndTime());
addSignFranchiseResponse.setSecondYearFee(franchiseFeeDO.getSecondYearFee());
addSignFranchiseResponse.setThirdYearStartTime(franchiseFeeDO.getThirdYearStartTime());
addSignFranchiseResponse.setThirdYearEndTime(franchiseFeeDO.getThirdYearEndTime());
addSignFranchiseResponse.setThirdYearFee(franchiseFeeDO.getThirdYearFee());
addSignFranchiseResponse.setPerformanceBond(franchiseFeeDO.getPerformanceBond());
addSignFranchiseResponse.setBigPerformanceBond(Convert.digitToChinese(Integer.valueOf(franchiseFeeDO.getPerformanceBond())));
}
return addSignFranchiseResponse;
}
}

View File

@@ -2,11 +2,16 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dto.ehr.FranchiseeInfoDTO;
import com.cool.store.dto.ehr.StaffBaseInfoDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.service.XfsgEhrService;
import com.cool.store.utils.SecureUtil;
import com.cool.store.utils.StringUtil;
import com.cool.store.utils.poi.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@@ -15,6 +20,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* describe: 鲜丰水果api
@@ -31,6 +37,10 @@ public class XfsgEhrServiceImpl implements XfsgEhrService {
@Resource
private HttpRestTemplateService httpRestTemplateService;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Override
public StaffBaseInfoDTO getUserInfoByCode(String staffNumber) {
Map<String, Object> requestMap = new HashMap<>();
@@ -73,6 +83,21 @@ public class XfsgEhrServiceImpl implements XfsgEhrService {
return franchiseeInfoDTO;
}
@Override
public StaffBaseInfoDTO getUserInfoByIdCard(String idCard) {
if (StringUtil.isBlank(idCard)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.getUserInfoByThirdOaUniqueFlag(idCard);
if(Objects.isNull(enterpriseUserDO)){
throw new ServiceException(ErrorCodeEnum.USER_NOT_EXIST);
}
if (StringUtil.isBlank(enterpriseUserDO.getJobnumber())) {
throw new ServiceException(ErrorCodeEnum.JOBNUMBER_NOT_EXIST);
}
return this.getUserInfoByCode(enterpriseUserDO.getJobnumber());
}
private void fillSignatureInfo(Map<String, Object> requestMap) {
long timestamp = System.currentTimeMillis();
String signature = SecureUtil.getSignature(timestamp);

View File

@@ -0,0 +1,108 @@
package com.cool.store.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dto.yun.StudentResultDTO;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.service.YunXueTangApiService;
import com.cool.store.utils.RedisUtilPool;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author byd
* @date 2024-04-29 9:55
*/
@Service
public class YunXueTangApiServiceImpl implements YunXueTangApiService {
private final static String REQUEST_URL = "https://openapi.yunxuetang.cn/";
private final static String APP_ID = "1782195114";
private final static String APP_SECRET = "W2Py1G4XYvBFGkXVgdbrZsm4C9zStM5QvBG8WS-0YYw4lPTcoKaFB9S6F5spshCJ";
private final static String ARRANGE_ID = "d011f26d-cd82-4a58-b705-529c63295198";
@Resource
private RedisUtilPool redisUtilPool;
@Resource
private HttpRestTemplateService httpRestTemplateService;
@Override
public String getAccessToken() {
//若果在缓存中存在,从缓存中去取
String accessToken = redisUtilPool.getString(RedisConstant.YUN_XUE_TANG_ACCESS_TOKEN);
if (StringUtils.isNotBlank(accessToken)) {
return accessToken;
}
Map<String, Object> body = new HashMap<>();
// 请求接口地址
String url = "token";
// url拼接所需参数
String pathUrl = REQUEST_URL + url + "?" + "appId=" + APP_ID + "&appSecret=" + APP_SECRET;
// 以post方式调用第三方接口,获取响应结果
String result = HttpUtil.post(pathUrl, body);
// 返回accessToken
JSONObject jsonObject = JSONObject.parseObject(result, JSONObject.class);
accessToken = jsonObject.getString("accessToken");
if (StringUtils.isNotBlank(accessToken)) {
Integer expiresIn = jsonObject.getInteger("expiresIn");
redisUtilPool.setString(RedisConstant.YUN_XUE_TANG_ACCESS_TOKEN, accessToken, expiresIn - 5 * 60);
}
return accessToken;
}
@Override
public Map<String, StudentResultDTO> studentResultUserList(List<String> userIdList) {
Map<String, Object> body = new HashMap<>();
body.put("arrangeId", ARRANGE_ID);
body.put("thirdUserIds", userIdList);
body.put("limit", userIdList.size());
String pathUrl = "v1/rpt2open/public/ote/student/result/user/list";
// 以post方式调用第三方接口,获取响应结果
Map<String, String> headMap = new HashMap<>();
headMap.put("Authorization", this.getAccessToken());
String result = httpRestTemplateService.postForObject(REQUEST_URL + pathUrl, body, String.class, headMap);
List<StudentResultDTO> resultDTOList = new ArrayList<>();
// 返回accessToken
JSONObject jsonObject = JSONObject.parseObject(result, JSONObject.class);
String code = jsonObject.getString("code");
if (CommonConstants.YUN_XUE_TANG_SUC_CODE.equals(code)) {
JSONObject data = jsonObject.getJSONObject("data");
JSONArray jsonArray = jsonObject.getJSONArray("datas");
if (CollectionUtils.isNotEmpty(jsonArray)) {
jsonArray.forEach(item -> {
JSONObject itemObj = (JSONObject) item;
StudentResultDTO resultDTO = new StudentResultDTO();
resultDTO.setUserId(itemObj.getString("thirdUserId"));
resultDTO.setPassed(itemObj.getInteger("passed"));
resultDTO.setNewScore(itemObj.getFloat("newScore"));
resultDTO.setUserExamStatus(itemObj.getInteger("userExamStatus"));
resultDTOList.add(resultDTO);
});
}
}
return resultDTOList.stream().collect(
Collectors.toMap(StudentResultDTO::getUserId, Function.identity()));
}
}