提交 0dd680f9 authored 作者: 窦馨雨's avatar 窦馨雨

合并分支 'dxy' 到 'qa'

增加飞书审批完成后同步到勤策系统【基本单位建议零售价】中 查看合并请求 !120
...@@ -41,6 +41,9 @@ public class EventCallbackLuzx { ...@@ -41,6 +41,9 @@ public class EventCallbackLuzx {
private String encryptKeyP; private String encryptKeyP;
@Value("${feishu.approval.scfy}") @Value("${feishu.approval.scfy}")
private String scfyCode; private String scfyCode;
@Value("${feishu.approval.xpss_cpdj}")
private String xpssCode;
@Autowired @Autowired
private IEventCallbackService eventCallbackService; private IEventCallbackService eventCallbackService;
@Autowired @Autowired
...@@ -122,9 +125,15 @@ public class EventCallbackLuzx { ...@@ -122,9 +125,15 @@ public class EventCallbackLuzx {
EventCallBackDto eventCallBackDto = JSONObject.parseObject(decrypt, EventCallBackDto.class); EventCallBackDto eventCallBackDto = JSONObject.parseObject(decrypt, EventCallBackDto.class);
EventCallBackDto.Event event = eventCallBackDto.getEvent(); EventCallBackDto.Event event = eventCallBackDto.getEvent();
// 市场推广费用申请(审批实例CODE:258B4D93-96D4-49E4-B9E1-DA6AB45740B0) // 市场推广费用申请(审批实例CODE:258B4D93-96D4-49E4-B9E1-DA6AB45740B0)
if (Constants.FEISHU_APPROVAL_INSTANCE.equals(event.getType()) && scfyCode.equals(event.getApprovalCode())){ // if (Constants.FEISHU_APPROVAL_INSTANCE.equals(event.getType()) && scfyCode.equals(event.getApprovalCode())){
if (!event.getStatus().equals(PlanStatus.PENDING.name())){ // if (!event.getStatus().equals(PlanStatus.PENDING.name())){
eventCallbackService.planCP(event); // eventCallbackService.planCP(event);
// }
// }
// 新品上市产品定价申请 (审批实例CODE: B4DBC1A9-D555-469D-AB69-4F353D8D2985)
if (Constants.FEISHU_APPROVAL_INSTANCE.equals(event.getType()) && xpssCode.equals(event.getApprovalCode())){
if (event.getStatus().equals(PlanStatus.APPROVED.name())){
eventCallbackService.getMinimumSellingPrice(event,xpssCode);
} }
} }
} }
......
...@@ -19,4 +19,10 @@ public interface IEventCallbackService { ...@@ -19,4 +19,10 @@ public interface IEventCallbackService {
void userUpdateByPersonId(String personId); void userUpdateByPersonId(String personId);
void userResigned(String employmentId); void userResigned(String employmentId);
/**
* 自动获取最小销售价设置给勤策
* @param event
*/
void getMinimumSellingPrice(EventCallBackDto.Event event , String approveTemplateCode);
} }
...@@ -52,6 +52,11 @@ public class QinCeUtils { ...@@ -52,6 +52,11 @@ public class QinCeUtils {
public static final String MODIFY_USER = "/api/employee/v3/modifyEmployee/"; public static final String MODIFY_USER = "/api/employee/v3/modifyEmployee/";
// 商品信息查询
public static final String QUERY_PRODUCT_INFO = "/api/product/v1/queryProduct/";
// 商品价格更新
public static final String MODIFY_PRODUCT_PRICE = "/api/pd/v2/modifyProduct/";
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();
...@@ -129,4 +134,66 @@ public class QinCeUtils { ...@@ -129,4 +134,66 @@ public class QinCeUtils {
JSONObject jsonObject = postQC(url, params); JSONObject jsonObject = postQC(url, params);
return jsonObject.getJSONArray("response_data"); return jsonObject.getJSONArray("response_data");
} }
/**
* 构建勤策商品查询参数(贴合官方queryProduct接口要求)
* @param productCode 产品编码(官方必传字段)
* @return 符合官方规范的查询参数
*/
public Map<String, Object> queryProductOfficialParams(String productCode) {
Map<String, Object> params = new HashMap<>();
// 官方必传:产品编码(prd_code为勤策官方字段名)
params.put("prd_code", productCode);
return params;
}
/**
* 调用勤策官方查询商品接口(pd/v2/queryProduct)
* @param productCode 产品编码
* @return 商品信息JSON对象(返回第一条数据)
* @throws Exception 接口调用异常
*/
public JSONObject queryProductInfo(String productCode) throws Exception {
Map<String, Object> params = queryProductOfficialParams(productCode);
String url = builderUrl(QUERY_PRODUCT_INFO, params);
log.info("调用勤策官方商品查询接口,URL:{},参数:{}", url, params);
JSONObject result = postQC(url, params);
JSONArray dataArray = result.getJSONArray("response_data");
return CollectionUtils.isEmpty(dataArray) ? null : dataArray.getJSONObject(0);
}
public boolean modifyProductByFullJson(JSONObject fullProductJson) {
// 空值校验
if (fullProductJson == null || fullProductJson.isEmpty()) {
log.error("勤策修改商品的JSON为空,无法调用接口");
return false;
}
try {
// 将JSONObject转为Map,满足builderUrl生成digest的要求(你原有逻辑依赖Map)
Map<String, Object> modifyParams = JSONObject.parseObject(fullProductJson.toJSONString(), Map.class);
// 复用你原有builderUrl方法生成接口地址(传入修改参数Map)
String url = builderUrl(MODIFY_PRODUCT_PRICE, modifyParams);
log.info("调用勤策商品修改接口,URL:{},参数:{}", url, modifyParams);
// 复用你原有postQC方法(保持异常抛出逻辑一致)
JSONObject respObj = postQC(url, modifyParams);
// 解析返回结果(沿用你原有return_code校验逻辑)
String returnCode = respObj.getString("return_code");
if ("0".equals(returnCode)) {
log.info("勤策商品修改成功,修改字段:prd_suggest_price,商品编码:{}", fullProductJson.getString("prd_code"));
return true;
} else {
log.error("勤策商品修改失败,返回信息:{}", respObj);
return false;
}
} catch (Exception e) {
log.error("调用勤策修改商品接口异常,JSON:{}", fullProductJson.toJSONString(), e);
return false;
}
}
} }
...@@ -25,13 +25,13 @@ public class TestTask { ...@@ -25,13 +25,13 @@ public class TestTask {
@XxlJob("ls_store_guangzhou") @XxlJob("ls_store_guangzhou")
public void lsStoreGuangzhou() { public void lsStoreGuangzhou() {
lsDisStoreDaoImpl.baiduAddressGuangzhou(500000L); lsDisStoreDaoImpl.baiduAddressGuangzhou(40000L);
} }
@XxlJob("ls_store_ahsp") @XxlJob("ls_store_ahsp")
public void lsStoreAnHuisp() { public void lsStoreAnHuisp() {
lsDisStoreDaoImpl.baiduAddressAnHuisp(1000000L); lsDisStoreDaoImpl.baiduAddressAnHuisp(80000L);
} }
/** /**
...@@ -43,26 +43,26 @@ public class TestTask { ...@@ -43,26 +43,26 @@ public class TestTask {
} }
@XxlJob("ls_store_n_xy") @XxlJob("ls_store_n_xy")
public void lsStoreNXY() { public void lsStoreNXY() {
lsDisStoreDaoImpl.lsStoreNXY(250000L); lsDisStoreDaoImpl.lsStoreNXY(20000L);
} }
@XxlJob("ls_store_n_gh") @XxlJob("ls_store_n_gh")
public void lsStoreNGH() { public void lsStoreNGH() {
lsDisStoreDaoImpl.lsStoreNGH(500000L); lsDisStoreDaoImpl.lsStoreNGH(40000L);
} }
@XxlJob("ls_store_n_hs") @XxlJob("ls_store_n_hs")
public void lsStoreNHS() { public void lsStoreNHS() {
lsDisStoreDaoImpl.lsStoreNHS(750000L); lsDisStoreDaoImpl.lsStoreNHS(60000L);
} }
@XxlJob("ls_store_n_dx") @XxlJob("ls_store_n_dx")
public void lsStoreNDX() { public void lsStoreNDX() {
lsDisStoreDaoImpl.lsStoreNDX(1000000L); lsDisStoreDaoImpl.lsStoreNDX(80000L);
} }
@XxlJob("ls_store_n_ql") // @XxlJob("ls_store_n_ql")
public void lsStoreNQL() { // public void lsStoreNQL() {
lsDisStoreDaoImpl.lsStoreNQL(1250000L); // lsDisStoreDaoImpl.lsStoreNQL(120000L);
} // }
} }
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<!-- 修改 limit 数量--> <!-- 修改 limit 数量-->
<select id="selectBaseO" resultMap="LsDisStoreBase"> <select id="selectBaseO" resultMap="LsDisStoreBase">
select lds_if,re_province,re_city,outlet_address,outlet_name select lds_if,re_province,re_city,outlet_address,outlet_name
from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 500000 and re_area is null and lng is null limit 1000; from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 40000 and lng is null limit 1000;
</select> </select>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<select id="selectBaseT" resultMap="LsDisStoreBase"> <select id="selectBaseT" resultMap="LsDisStoreBase">
select lds_if,re_province,re_city,outlet_address,outlet_name select lds_if,re_province,re_city,outlet_address,outlet_name
from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 1000000 and re_area is null and lng is null limit 1000; from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 80000 and lng is null limit 1000;
</select> </select>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<select id="selectBaseS" resultMap="LsDisStoreBase"> <select id="selectBaseS" resultMap="LsDisStoreBase">
select lds_if,re_province,re_city,outlet_address,outlet_name select lds_if,re_province,re_city,outlet_address,outlet_name
from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 1537130 and re_area is null and lng is null limit 1000; from ls_dis_store where lds_if &gt; #{lastId} and lds_if &lt;= 120000 and lng is null limit 1000;
</select> </select>
...@@ -74,37 +74,37 @@ ...@@ -74,37 +74,37 @@
<select id="selectBaseLO" resultMap="LsDisStoreBase"> <select id="selectBaseLO" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 20000 limit 1000;
</select> </select>
<select id="selectBaseLT" resultMap="LsDisStoreBase"> <select id="selectBaseLT" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null and lds_if &gt; #{lastId} and lds_if &lt;= 500000 limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 40000 limit 1000;
</select> </select>
<select id="selectBaseLS" resultMap="LsDisStoreBase"> <select id="selectBaseLS" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null and lds_if &gt; #{lastId} and lds_if &lt;= 750000 limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 60000 limit 1000;
</select> </select>
<select id="selectBaseLF" resultMap="LsDisStoreBase"> <select id="selectBaseLF" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null and lds_if &gt; #{lastId} and lds_if &lt;= 1000000 limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 80000 limit 1000;
</select> </select>
<select id="selectBaseLV" resultMap="LsDisStoreBase"> <select id="selectBaseLV" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null and lds_if &gt; #{lastId} and lds_if &lt;= 1250000 limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 120000 limit 1000;
</select> </select>
<select id="selectBaseLX" resultMap="LsDisStoreBase"> <select id="selectBaseLX" resultMap="LsDisStoreBase">
select lds_if,lng select lds_if,lng
from ls_dis_store where lng is not null and re_area is null and lds_if &gt; #{lastId} and lds_if &lt;= 1537130 limit 1000; from ls_dis_store where lng is not null and re_city is null and lds_if &gt; #{lastId} and lds_if &lt;= 1537130 limit 1000;
</select> </select>
<update id="updateListNO" parameterType="java.util.List"> <update id="updateListNO" parameterType="java.util.List">
<foreach collection="lsDisStores" item="item" separator=";"> <foreach collection="lsDisStores" item="item" separator=";">
update ls_dis_store set re_address = #{item.reAddress},re_area = #{item.reArea} where lds_if = #{item.ldsIf} update ls_dis_store set re_address = #{item.reAddress},re_area = #{item.reArea},re_province = #{item.reProvince},re_city = #{item.reCity} where lds_if = #{item.ldsIf}
</foreach> </foreach>
</update> </update>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论