提交 15ba6c82 authored 作者: 窦馨雨's avatar 窦馨雨

Merge branch 'qa' into 'dxy'

# Conflicts: # src/main/java/com/wangxiaolu/promotion/domain/user/mapper/entity/QinCeClienteleStoreDO.java
...@@ -45,11 +45,6 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao { ...@@ -45,11 +45,6 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
try { try {
QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class); QinCeClienteleStoreDO qinCeShopDO = JSONObject.parseObject(responseData.toString(), QinCeClienteleStoreDO.class);
// if (qinCeShopDO.getStoreStatus().equals("0") && Objects.nonNull(qinCeShopDO.getQcId())){
// qinCeClienteleStoreMapper.updateStatusById(qinCeShopDO.getQcId());
// continue;
// }
// 添加经销商 // 添加经销商
List<JSONObject> dealers = qinCeShopDO.getDealers(); List<JSONObject> dealers = qinCeShopDO.getDealers();
if (!CollectionUtils.isEmpty(dealers)){ if (!CollectionUtils.isEmpty(dealers)){
......
...@@ -13,9 +13,10 @@ import java.util.List; ...@@ -13,9 +13,10 @@ import java.util.List;
/** /**
* 勤策-客户管理-终端 * 勤策-客户管理-终端
*
* @TableName qc_clientele_shop * @TableName qc_clientele_shop
*/ */
@TableName(value ="qince_clientele_store") @TableName(value = "qince_clientele_store")
@Data @Data
public class QinCeClienteleStoreDO implements Serializable { public class QinCeClienteleStoreDO implements Serializable {
/** /**
...@@ -210,8 +211,8 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -210,8 +211,8 @@ public class QinCeClienteleStoreDO implements Serializable {
private List<JSONObject> dealers; private List<JSONObject> dealers;
/** /**
* "store_ext_key": "系统名称", * "store_ext_key": "系统名称",
* "store_ext_value": "永辉超市" * "store_ext_value": "永辉超市"
*/ */
@TableField(exist = false) @TableField(exist = false)
@JsonProperty("exts") @JsonProperty("exts")
...@@ -229,6 +230,13 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -229,6 +230,13 @@ public class QinCeClienteleStoreDO implements Serializable {
@JsonProperty("create_time") @JsonProperty("create_time")
private String createTime; private String createTime;
// 门店类型 -->> 不变
private String storeTypeExt;
// 渠道大类 -->> 合作模式
private String cooperationModeExt;
// 渠道小类 -->> 渠道类型
private String channelTypeExt;
@JsonProperty("store_selling_area") @JsonProperty("store_selling_area")
private String storeSellingArea; private String storeSellingArea;
...@@ -236,7 +244,7 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -236,7 +244,7 @@ public class QinCeClienteleStoreDO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Data @Data
public class Exts{ public class Exts {
@JsonProperty("store_ext_key") @JsonProperty("store_ext_key")
private String storeExtKey; private String storeExtKey;
@JsonProperty("store_ext_value") @JsonProperty("store_ext_value")
...@@ -248,7 +256,7 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -248,7 +256,7 @@ public class QinCeClienteleStoreDO implements Serializable {
for (Exts e : exts) { for (Exts e : exts) {
String extKey = e.getStoreExtKey(); String extKey = e.getStoreExtKey();
String extValue = e.getStoreExtValue(); String extValue = e.getStoreExtValue();
if ("CVS、KA".contains(this.storeType) && "是否连锁".equals(extKey) && "是".equals(extValue)){ if ("CVS、KA".contains(this.storeType) && "是否连锁".equals(extKey) && "是".equals(extValue)) {
isChain = true; isChain = true;
} }
if ("是否连锁".equals(extKey)) { if ("是否连锁".equals(extKey)) {
...@@ -257,11 +265,17 @@ public class QinCeClienteleStoreDO implements Serializable { ...@@ -257,11 +265,17 @@ public class QinCeClienteleStoreDO implements Serializable {
if ("系统名称".equals(extKey)) { if ("系统名称".equals(extKey)) {
this.lineName = extValue; this.lineName = extValue;
} }
if ("是否双T门店".equals(extKey)) { if ("渠道小类".equals(extKey)) {
this.bothT = extValue; this.channelTypeExt = extValue;
}
if ("渠道大类".equals(extKey)) {
this.cooperationModeExt = extValue;
}
if ("门店类型".equals(extKey)) {
this.storeTypeExt = extValue;
} }
} }
if (!isChain){ if (!isChain) {
this.lineName = this.storeType; this.lineName = this.storeType;
} }
} }
......
...@@ -36,6 +36,16 @@ public class QinceDealerDO implements Serializable { ...@@ -36,6 +36,16 @@ public class QinceDealerDO implements Serializable {
*/ */
private String dealerCooperateStatus; private String dealerCooperateStatus;
/**
* 经销商助理ID(多个用逗号隔开)
*/
private String dealerAssistantId;
/**
* 经销商助理姓名(多个用逗号隔开)
*/
private String dealerAssistantName;
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.wangxiaolu.promotion.service.user.impl; package com.wangxiaolu.promotion.service.user.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.redis.RedisKeys; import com.wangxiaolu.promotion.common.redis.RedisKeys;
...@@ -163,8 +164,8 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService { ...@@ -163,8 +164,8 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
return false; return false;
} }
List<Object> dealerAddJsons = new ArrayList<>(1500); List<Object> dealerAddJsons = new ArrayList<>(1500); // 存储所有要保存的经销商数据
Map<Object,Object> dealers = new HashMap<>(1500); Map<Object,Object> dealers = new HashMap<>(1500); // 存储合作中的经销商(用于 Redis)
for (int index = 0; index < responseDatas.size(); index++) { for (int index = 0; index < responseDatas.size(); index++) {
JSONObject jsonObject = responseDatas.getJSONObject(index); JSONObject jsonObject = responseDatas.getJSONObject(index);
...@@ -184,6 +185,55 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService { ...@@ -184,6 +185,55 @@ public class QinCeDataTaskServiceImpl implements QinCeDataTaskService {
jsonObject.put("dealer_manager_code",""); jsonObject.put("dealer_manager_code","");
jsonObject.put("dealer_manager",""); jsonObject.put("dealer_manager","");
} }
// 处理经销商助理ID:从勤策员工ID转换为emp_code
String dealerAssistantId = jsonObject.getString("dealer_assistant_id");
if (StringUtils.isNotBlank(dealerAssistantId)) {
String[] assistantIds = dealerAssistantId.split(",");
StringBuilder empCodes = new StringBuilder();
StringBuilder empNames = new StringBuilder();
for (String assistantId : assistantIds) {
assistantId = assistantId.trim();
if (StringUtils.isBlank(assistantId)) {
continue;
}
try {
// 调用员工查询接口获取emp_code
Map<String, Object> empParams = qinCeUtils.queryEmployeeByIdParam(assistantId);
String empUrl = qinCeUtils.builderUrl(QinCeUtils.QUERY_EMPLOYEE_BY_ID, empParams);
JSONObject empResultJson = OkHttp.postQC(empUrl, empParams);
JSONArray empDatas = empResultJson.getJSONArray("response_data");
if (empDatas != null && empDatas.size() > 0) {
JSONObject empInfo = empDatas.getJSONObject(0);
String empCode = empInfo.getString("emp_code");
String empName = empInfo.getString("emp_name");
if (StringUtils.isNotBlank(empCode)) {
if (empCodes.length() > 0) {
empCodes.append(",");
}
empCodes.append(empCode);
}
if (StringUtils.isNotBlank(empName)) {
if (empNames.length() > 0) {
empNames.append(",");
}
empNames.append(empName);
}
}
} catch (Exception e) {
log.error("勤策-查询员工信息失败,员工ID:{},错误:{}", assistantId, e.getMessage());
}
}
// 更新为emp_code和emp_name
jsonObject.put("dealer_assistant_id", empCodes.toString());
jsonObject.put("dealer_assistant_name", empNames.toString());
}
dealerAddJsons.add(jsonObject); dealerAddJsons.add(jsonObject);
// 如果经销商不是合作中,则不存在到redis中 // 如果经销商不是合作中,则不存在到redis中
......
...@@ -50,6 +50,8 @@ public class QinCeUtils { ...@@ -50,6 +50,8 @@ public class QinCeUtils {
public static final String QUERY_PRODUCT = "/api/product/v1/queryProduct/"; public static final String QUERY_PRODUCT = "/api/product/v1/queryProduct/";
// 经销商 // 经销商
public static final String QUERY_DEALER = "/api/dealer/v1/queryDealer/"; public static final String QUERY_DEALER = "/api/dealer/v1/queryDealer/";
// 查询员工(用于获取emp_code)
public static final String QUERY_EMPLOYEE_BY_ID = "/api/employee/v3/queryEmployee/";
public String builderUrl(String sidepath, Map<String, Object> params) { public String builderUrl(String sidepath, Map<String, Object> params) {
String msgId = UUID.randomUUID().toString(); String msgId = UUID.randomUUID().toString();
...@@ -176,4 +178,13 @@ public class QinCeUtils { ...@@ -176,4 +178,13 @@ public class QinCeUtils {
// params.put("after_create_date", DateUtil.format(dateTime, DatePattern.NORM_DATETIME_PATTERN)); // params.put("after_create_date", DateUtil.format(dateTime, DatePattern.NORM_DATETIME_PATTERN));
return params; return params;
} }
/**
* 根据员工ID查询员工信息参数
*/
public Map<String, Object> queryEmployeeByIdParam(String empId) {
Map<String, Object> params = new HashMap<>();
params.put("id", empId);
return params;
}
} }
...@@ -9,24 +9,29 @@ ...@@ -9,24 +9,29 @@
<result property="dealerId" column="dealer_id" jdbcType="VARCHAR"/> <result property="dealerId" column="dealer_id" jdbcType="VARCHAR"/>
<result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/> <result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/>
<result property="dealerCooperateStatus" column="dealer_cooperate_status" jdbcType="CHAR"/> <result property="dealerCooperateStatus" column="dealer_cooperate_status" jdbcType="CHAR"/>
<result property="dealerAssistantId" column="dealer_assistant_id" jdbcType="VARCHAR"/>
<result property="dealerAssistantName" column="dealer_assistant_name" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,dealer_id,dealer_name, id,dealer_id,dealer_name,
dealer_cooperate_status,dealer_modify_time dealer_cooperate_status,dealer_modify_time,
dealer_assistant_id,dealer_assistant_name
</sql> </sql>
<insert id="saveList"> <insert id="saveList">
insert into qince_dealer insert into qince_dealer
(dealer_id, dealer_name, dealer_cooperate_status) (dealer_id, dealer_name, dealer_cooperate_status, dealer_assistant_id, dealer_assistant_name)
VALUES VALUES
<foreach collection="dealerJsons" item="item" separator=","> <foreach collection="dealerJsons" item="item" separator=",">
(#{item.dealer_id}, #{item.dealer_name}, (#{item.dealer_id}, #{item.dealer_name},
#{item.dealer_cooperate_status}) #{item.dealer_cooperate_status}, #{item.dealer_assistant_id}, #{item.dealer_assistant_name})
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
dealer_name = values(dealer_name), dealer_name = values(dealer_name),
dealer_cooperate_status = values(dealer_cooperate_status) dealer_cooperate_status = values(dealer_cooperate_status),
dealer_assistant_id = values(dealer_assistant_id),
dealer_assistant_name = values(dealer_assistant_name)
</insert> </insert>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论