Merge remote-tracking branch 'hsayi/dev/feat/partner1.4_20231009' into dev/feat/partner1.4_20231009
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.HyPartnerFraSourceDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface HyPartnerFraSourceMapper {
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(HyPartnerFraSourceDO record);
|
||||
|
||||
int insertSelective(HyPartnerFraSourceDO record);
|
||||
|
||||
HyPartnerFraSourceDO selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(HyPartnerFraSourceDO record);
|
||||
|
||||
int updateByPrimaryKey(HyPartnerFraSourceDO record);
|
||||
|
||||
List<HyPartnerFraSourceDO> selectAllFraSourceList();
|
||||
|
||||
int batchInsertSelective(@Param("insertList") List<HyPartnerFraSourceDO> collect);
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.cool.store.mapper.HyPartnerFraSourceMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerFraSourceDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
||||
<result column="dict_id" jdbcType="VARCHAR" property="dictId" />
|
||||
<result column="source_id" jdbcType="VARCHAR" property="sourceId" />
|
||||
<result column="enabled" jdbcType="BOOLEAN" property="enabled" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, code, dict_id, source_id, enabled, create_time, update_time, remark
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from hy_partner_fra_source
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectAllFraSourceList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from hy_partner_fra_source where enabled=1
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from hy_partner_fra_source
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.cool.store.entity.HyPartnerFraSourceDO" useGeneratedKeys="true">
|
||||
insert into hy_partner_fra_source (`name`, code, dict_id,
|
||||
source_id, enabled, create_time,
|
||||
update_time, remark)
|
||||
values (#{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{dictId,jdbcType=VARCHAR},
|
||||
#{sourceId,jdbcType=VARCHAR}, #{enabled,jdbcType=BOOLEAN}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.cool.store.entity.HyPartnerFraSourceDO" useGeneratedKeys="true">
|
||||
insert into hy_partner_fra_source
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code,
|
||||
</if>
|
||||
<if test="dictId != null">
|
||||
dict_id,
|
||||
</if>
|
||||
<if test="sourceId != null">
|
||||
source_id,
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
#{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dictId != null">
|
||||
#{dictId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceId != null">
|
||||
#{sourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
#{enabled,jdbcType=BOOLEAN},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="batchInsertSelective">
|
||||
<foreach collection="insertList" item="record" separator=";">
|
||||
insert into hy_partner_fra_source
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="record.code != null">
|
||||
`code`,
|
||||
</if>
|
||||
<if test="record.dictId != null">
|
||||
dict_id,
|
||||
</if>
|
||||
<if test="record.sourceId != null">
|
||||
source_id,
|
||||
</if>
|
||||
<if test="record.enabled != null">
|
||||
enabled,
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="record.remark != null">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="record.name != null">
|
||||
#{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.code != null">
|
||||
#{record.code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.dictId != null">
|
||||
#{record.dictId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.sourceId != null">
|
||||
#{record.sourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.enabled != null">
|
||||
#{record.enabled,jdbcType=BOOLEAN},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
#{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.remark != null">
|
||||
#{record.remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE update_time = now(), enabled = values(enabled), `name` = values(`name`), `code` = values(`code`), dict_id = values(dict_id)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyPartnerFraSourceDO">
|
||||
update hy_partner_fra_source
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dictId != null">
|
||||
dict_id = #{dictId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceId != null">
|
||||
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled = #{enabled,jdbcType=BOOLEAN},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerFraSourceDO">
|
||||
update hy_partner_fra_source
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
dict_id = #{dictId,jdbcType=VARCHAR},
|
||||
source_id = #{sourceId,jdbcType=VARCHAR},
|
||||
enabled = #{enabled,jdbcType=BOOLEAN},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
remark = #{remark,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -37,6 +37,9 @@ public class RpcCreateQualifyVerifyReq {
|
||||
@ApiModelProperty(value = "意向签约人手机号", required = true)
|
||||
private String intendedSignerTel;
|
||||
|
||||
@ApiModelProperty(value = "系统来源", required = false)
|
||||
private String systemsource;
|
||||
|
||||
@ApiModelProperty(value = "合作关系", required = true)
|
||||
private KeyText partnership;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -86,6 +87,28 @@ public class MDMHttpRequest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ResponseEntity<MDMResultDTO> getDictList() throws ApiException {
|
||||
String url = mdmBaseUrl + "/api/openapi/dict/api/dictListByCode?code=mdFraSource";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
try {
|
||||
RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq();
|
||||
rpcGetMDMTokenReq.setAppKey(mdmAppKey);
|
||||
rpcGetMDMTokenReq.setAppSecret(mdmAppSec);
|
||||
Map<String, String> headers = new HashMap<>(1);
|
||||
headers.put("Authorization",getMdmAccessToken());
|
||||
responseEntity = RestTemplateUtil.get(url, headers, MDMResultDTO.class);
|
||||
log.info("url:{}, header:{}, response:{}", url, JSONObject.toJSONString(headers), JSONObject.toJSONString(responseEntity));
|
||||
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
|
||||
return responseEntity;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("调用MDM接口出错 url{}, e{}", url, e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 mdm 所有业务区域
|
||||
* @param headers headers
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
package com.cool.store.job;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.cool.store.dto.mdm.AccessTokenDTO;
|
||||
import com.cool.store.dto.response.DictResultDTO;
|
||||
import com.cool.store.dto.response.MDMResultDTO;
|
||||
import com.cool.store.entity.HyPartnerFraSourceDO;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.HyPartnerFraSourceMapper;
|
||||
import com.cool.store.request.RpcGetMdmTokenReq;
|
||||
import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hxd
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class FraSourceSyncJob {
|
||||
|
||||
|
||||
@Value("${hs.mdm.baseUrl:null}")
|
||||
private String mdmBaseUrl;
|
||||
|
||||
@Value("${hs.mdm.appkey:null}")
|
||||
private String mdmAppKey;
|
||||
|
||||
@Value("${hs.mdm.appsec:null}")
|
||||
private String mdmAppSec;
|
||||
|
||||
@Resource
|
||||
private HyPartnerFraSourceMapper hyPartnerFraSourceMapper;
|
||||
|
||||
@XxlJob("FraSourceSyncJob")
|
||||
public void fraSourceSyncJob() {
|
||||
XxlJobHelper.log("-------------------------------定时同步800请求来源开始-------------------------------");
|
||||
execute();
|
||||
XxlJobHelper.log("-------------------------------定时同步800请求来源结束-------------------------------");
|
||||
XxlJobHelper.handleSuccess();
|
||||
}
|
||||
|
||||
private void execute() {
|
||||
DictResultDTO dictResultDTO = null;
|
||||
try {
|
||||
dictResultDTO = JSON.parseObject(getDictList(), new TypeReference<DictResultDTO>() {
|
||||
});
|
||||
} catch (ApiException e) {
|
||||
log.error("请求800获取字典报错:" + JSONObject.toJSONString(e));
|
||||
}
|
||||
if (ObjectUtil.isNull(dictResultDTO)) {
|
||||
return;
|
||||
}
|
||||
List<DictResultDTO.Dict> configList = dictResultDTO.getConfigList();
|
||||
List<HyPartnerFraSourceDO> collect = configList.stream().map(item -> {
|
||||
HyPartnerFraSourceDO hyPartnerFraSourceDO = new HyPartnerFraSourceDO();
|
||||
BeanUtil.copyProperties(item, hyPartnerFraSourceDO);
|
||||
hyPartnerFraSourceDO.setSourceId(item.getId());
|
||||
return hyPartnerFraSourceDO;
|
||||
}).collect(Collectors.toList());
|
||||
hyPartnerFraSourceMapper.batchInsertSelective(collect);
|
||||
}
|
||||
|
||||
public String getDictList() throws ApiException {
|
||||
String url = mdmBaseUrl + "/api/openapi/dict/api/dictListByCode?code=mdFraSource";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
try {
|
||||
RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq();
|
||||
rpcGetMDMTokenReq.setAppKey(mdmAppKey);
|
||||
rpcGetMDMTokenReq.setAppSecret(mdmAppSec);
|
||||
Map<String, String> headers = new HashMap<>(1);
|
||||
headers.put("Authorization", getMdmAccessToken(rpcGetMDMTokenReq));
|
||||
responseEntity = RestTemplateUtil.get(url, headers, MDMResultDTO.class);
|
||||
log.info("url:{}, header:{}, response:{}", url, JSONObject.toJSONString(headers), JSONObject.toJSONString(responseEntity));
|
||||
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
|
||||
return JSONObject.toJSONString(responseEntity.getBody().getData());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("调用MDM接口出错 url{}, e{}", url, e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMdmAccessToken(RpcGetMdmTokenReq rpcGetMDMTokenReq) throws ApiException {
|
||||
String url = mdmBaseUrl + "/api/oauth2/accessToken";
|
||||
ResponseEntity<MDMResultDTO> responseEntity = null;
|
||||
try {
|
||||
responseEntity = RestTemplateUtil.post(url, rpcGetMDMTokenReq, MDMResultDTO.class);
|
||||
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
|
||||
AccessTokenDTO accessTokenDTO = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), AccessTokenDTO.class);
|
||||
if (accessTokenDTO == null || StringUtils.isBlank(accessTokenDTO.getAccessToken())) {
|
||||
throw new ServiceException("获取Mdm token失败!");
|
||||
}
|
||||
return accessTokenDTO.getAccessToken();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("获取MDM Token 出错 url:\t{}, e:\t{}", url, e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.cool.store.dao.HyPartnerBaseInfoDAO;
|
||||
import com.cool.store.dto.log.CreateQualifyVerifyDTO;
|
||||
import com.cool.store.dto.log.LogBasicDTO;
|
||||
import com.cool.store.dto.mdm.AccessTokenDTO;
|
||||
import com.cool.store.dto.response.DictResultDTO;
|
||||
import com.cool.store.dto.response.MDMResultDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.*;
|
||||
@@ -27,6 +28,7 @@ import com.cool.store.request.data.flow.KeyText;
|
||||
import com.cool.store.request.data.flow.SkrRelshipProve;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.*;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -42,6 +44,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: young.yu
|
||||
@@ -52,14 +55,6 @@ import java.util.*;
|
||||
@Service
|
||||
public class FlowServiceImpl implements FlowService {
|
||||
|
||||
@Value("${hs.mdm.baseUrl:null}")
|
||||
private String mdmBaseUrl;
|
||||
|
||||
@Value("${hs.mdm.appkey:null}")
|
||||
private String mdmAppKey;
|
||||
|
||||
@Value("${hs.mdm.appsec:null}")
|
||||
private String mdmAppSec;
|
||||
|
||||
@Autowired
|
||||
private RedisUtilPool redisUtilPool;
|
||||
@@ -101,8 +96,8 @@ public class FlowServiceImpl implements FlowService {
|
||||
@Autowired
|
||||
private WechatMiniAppService wechatMiniAppService;
|
||||
|
||||
@Autowired
|
||||
private HyPartnerFraSourceMapper hyPartnerFraSourceMapper;
|
||||
@Value("${hs.mdm.appkey:null}")
|
||||
private String mdmAppKey;
|
||||
|
||||
@Autowired
|
||||
private MDMHttpRequest mdmHttpRequest;
|
||||
@@ -141,6 +136,7 @@ public class FlowServiceImpl implements FlowService {
|
||||
dataBody.setAmtJoin(request.getPartnerFee());
|
||||
dataBody.setAmtTechSer(request.getTechnicalServiceFee());
|
||||
dataBody.setAmtIntended(request.getIntentionMoney());
|
||||
dataBody.setSystemsource(mdmAppKey);
|
||||
rpcRequest.setData(dataBody);
|
||||
|
||||
//获取授权码
|
||||
@@ -269,7 +265,6 @@ public class FlowServiceImpl implements FlowService {
|
||||
if (hyPartnerInterviewDO == null || hyPartnerInterviewDO.getInterviewPlanId() == null) {
|
||||
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
|
||||
}
|
||||
String interviewId = hyPartnerInterviewDO.getId().toString();
|
||||
String interviewPlanId = hyPartnerInterviewDO.getInterviewPlanId().toString();
|
||||
Long partnerLineId = hyPartnerInterviewDO.getPartnerLineId();
|
||||
//审核通过
|
||||
@@ -304,9 +299,19 @@ public class FlowServiceImpl implements FlowService {
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<HyPartnerFraSourceDO> getDictList() {
|
||||
return hyPartnerFraSourceMapper.selectAllFraSourceList();
|
||||
String s = JSONObject.toJSONString(mdmHttpRequest.getDictList().getBody().getData());
|
||||
DictResultDTO dictResultDTO = JSON.parseObject(s, new TypeReference<DictResultDTO>() {
|
||||
});
|
||||
List<HyPartnerFraSourceDO> collect = dictResultDTO.getConfigList().stream().map(item -> {
|
||||
HyPartnerFraSourceDO hyPartnerFraSourceDO = new HyPartnerFraSourceDO();
|
||||
BeanUtil.copyProperties(item, hyPartnerFraSourceDO);
|
||||
hyPartnerFraSourceDO.setSourceId(item.getId());
|
||||
return hyPartnerFraSourceDO;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
private List<SkrRelshipProve> OSSFileToMDMFile(Map<String, String> headers, List<String> fileUrlList) throws ApiException, IOException {
|
||||
|
||||
Reference in New Issue
Block a user