丽知:钉钉回调优化
This commit is contained in:
parent
27b3318324
commit
8558421247
|
@ -3,20 +3,44 @@ package com.hzya.frame.plugin.lets.dingtalk.callback.service.impl;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenResponseBody;
|
||||||
|
import com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponse;
|
||||||
|
import com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody;
|
||||||
import com.hzya.frame.plugin.lets.dingtalk.callback.service.CallBackService;
|
import com.hzya.frame.plugin.lets.dingtalk.callback.service.CallBackService;
|
||||||
|
import com.hzya.frame.plugin.lets.dingtalk.dao.IDingU8cBillDao;
|
||||||
|
import com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity;
|
||||||
|
import com.hzya.frame.plugin.lets.dingtalk.utils.DingTalkUtils;
|
||||||
import com.hzya.frame.plugin.lets.dingtalk.vo.DingCallbackCrypto;
|
import com.hzya.frame.plugin.lets.dingtalk.vo.DingCallbackCrypto;
|
||||||
|
import com.hzya.frame.plugin.lets.u8cdto.ArapDjzb;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service("callBackService")
|
@Service("callBackService")
|
||||||
public class CallBackServiceImpl implements CallBackService {
|
public class CallBackServiceImpl implements CallBackService {
|
||||||
|
|
||||||
protected static Logger logger = LogManager.getLogger(CallBackServiceImpl.class);
|
protected static Logger logger = LogManager.getLogger(CallBackServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDingU8cBillDao dingU8cBillDao;
|
||||||
|
|
||||||
|
@Value("${DING.CorpId}")
|
||||||
|
private String CorpId;
|
||||||
|
@Value("${DING.APIToken}")
|
||||||
|
private String APIToken;
|
||||||
|
|
||||||
|
@Value("${DING.APPKEY}")
|
||||||
|
private String APPKEY;
|
||||||
|
@Value("${DING.AppSecret}")
|
||||||
|
private String AppSecret;
|
||||||
|
|
||||||
@Value("${DING.call_back_token}")
|
@Value("${DING.call_back_token}")
|
||||||
private String token;
|
private String token;
|
||||||
@Value("${DING.call_back_aes_key}")
|
@Value("${DING.call_back_aes_key}")
|
||||||
|
@ -51,7 +75,7 @@ public class CallBackServiceImpl implements CallBackService {
|
||||||
break;
|
break;
|
||||||
case "PROC-285CCF2B-524F-4055-BE62-FC31F490C654":
|
case "PROC-285CCF2B-524F-4055-BE62-FC31F490C654":
|
||||||
logger.info("采购付款申请(店群专用) -> PROC-285CCF2B-524F-4055-BE62-FC31F490C654");
|
logger.info("采购付款申请(店群专用) -> PROC-285CCF2B-524F-4055-BE62-FC31F490C654");
|
||||||
// agencyBill(eventJson);//采购付款申请(店群专用)
|
agencyBill(eventJson);//采购付款申请(店群专用)
|
||||||
break;
|
break;
|
||||||
case "PROC-AC33FC85-FB44-49FC-B926-1D966AE3BBD2":
|
case "PROC-AC33FC85-FB44-49FC-B926-1D966AE3BBD2":
|
||||||
logger.info("采购付款申请(新) -> PROC-AC33FC85-FB44-49FC-B926-1D966AE3BBD2");
|
logger.info("采购付款申请(新) -> PROC-AC33FC85-FB44-49FC-B926-1D966AE3BBD2");
|
||||||
|
@ -71,4 +95,118 @@ public class CallBackServiceImpl implements CallBackService {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取钉钉应用token
|
||||||
|
*/
|
||||||
|
public String getDingTalkToken() throws Exception {
|
||||||
|
GetAccessTokenResponseBody tokenBody = DingTalkUtils.getTokenBody(APPKEY, AppSecret);
|
||||||
|
return tokenBody.getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 委外采购(付款单)->采购付款申请(新)
|
||||||
|
* 回调,审核付款单
|
||||||
|
*/
|
||||||
|
public void outSourceBill(JSONObject eventJson) throws Exception {
|
||||||
|
//获取token
|
||||||
|
String token = getDingTalkToken();
|
||||||
|
//实例ID
|
||||||
|
String processInstanceId = eventJson.getString("processInstanceId");
|
||||||
|
//查询实例的具体信息
|
||||||
|
GetProcessInstanceResponse processInstanceDetails = DingTalkUtils.getProcessInstanceDetails(token, processInstanceId);
|
||||||
|
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult processInstanceResponseBodyResult = processInstanceDetails.getBody().getResult();
|
||||||
|
//审批状态,该回调事件只监听,审批完成的
|
||||||
|
if (processInstanceResponseBodyResult.getStatus().equals("RUNNING")) {//审批中
|
||||||
|
logger.info("采购付款申请(新)--->审批中");
|
||||||
|
} else if (processInstanceResponseBodyResult.getStatus().equals("TERMINATED")) {//已撤销
|
||||||
|
logger.info("采购付款申请(新)--->已撤销");
|
||||||
|
} else if (processInstanceResponseBodyResult.getStatus().equals("COMPLETED")) {//审批完成
|
||||||
|
logger.info("采购付款申请(新)--->审批完成");
|
||||||
|
}
|
||||||
|
//获取所有审批意见
|
||||||
|
List<GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultOperationRecords> operationRecords = processInstanceResponseBodyResult.getOperationRecords();
|
||||||
|
|
||||||
|
//审批意见过滤掉:START_PROCESS_INSTANCE:发起流程实例
|
||||||
|
operationRecords = operationRecords.stream().filter(item -> !item.getType().equals("START_PROCESS_INSTANCE")).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理采购(付款单)->采购付款申请(店群专用)
|
||||||
|
* 回调,审核付款单
|
||||||
|
*/
|
||||||
|
public void agencyBill(JSONObject eventJson) throws Exception{
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
//获取token
|
||||||
|
String token = getDingTalkToken();
|
||||||
|
//实例ID
|
||||||
|
String processInstanceId = eventJson.getString("processInstanceId");
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = queryU8CDing(processInstanceId);
|
||||||
|
if (dingU8cBillEntity == null) {
|
||||||
|
Assert.state(false,"代理采购(付款单)->采购付款申请(店群专用)回调:未查询到相关审批实例,实例id:{}",processInstanceId);
|
||||||
|
}
|
||||||
|
//查询实例的具体信息
|
||||||
|
GetProcessInstanceResponse processInstanceDetails = DingTalkUtils.getProcessInstanceDetails(token, processInstanceId);
|
||||||
|
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult processInstanceResponseBodyResult = processInstanceDetails.getBody().getResult();
|
||||||
|
//审批状态,该回调事件只监听,审批完成的
|
||||||
|
if (processInstanceResponseBodyResult.getStatus().equals("RUNNING")) {//审批中
|
||||||
|
logger.info("采购付款申请(店群专用)--->审批中");
|
||||||
|
} else if (processInstanceResponseBodyResult.getStatus().equals("TERMINATED")) {//已撤销
|
||||||
|
logger.info("采购付款申请(店群专用)--->已撤销");
|
||||||
|
} else if (processInstanceResponseBodyResult.getStatus().equals("COMPLETED")) {//审批完成
|
||||||
|
logger.info("采购付款申请(店群专用)--->审批完成");
|
||||||
|
}
|
||||||
|
//获取所有审批意见
|
||||||
|
List<GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultOperationRecords> operationRecords = processInstanceResponseBodyResult.getOperationRecords();
|
||||||
|
|
||||||
|
//审批意见过滤掉:START_PROCESS_INSTANCE:发起流程实例
|
||||||
|
operationRecords = operationRecords.stream().filter(item -> !item.getType().equals("START_PROCESS_INSTANCE")).collect(Collectors.toList());
|
||||||
|
System.out.println(operationRecords);
|
||||||
|
|
||||||
|
//钉钉问题记录执行明细
|
||||||
|
for (GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultOperationRecords operationRecord : operationRecords) {
|
||||||
|
//操作结果
|
||||||
|
switch (operationRecord.getResult()) {
|
||||||
|
case "AGREE":
|
||||||
|
dingU8cBillEntity.setDing_res("同意");
|
||||||
|
break;
|
||||||
|
case "REFUSE":
|
||||||
|
dingU8cBillEntity.setDing_res("拒绝");
|
||||||
|
break;
|
||||||
|
case "NONE":
|
||||||
|
dingU8cBillEntity.setDing_res("未处理");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("代理采购(付款单)->采购付款申请(店群专用)回调报错:"+e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ding_talk_process_id查询
|
||||||
|
*/
|
||||||
|
public DingU8cBillEntity queryU8CDing(String ding_talk_process_id){
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity();
|
||||||
|
dingU8cBillEntity.setDingTalkProcessId(ding_talk_process_id);
|
||||||
|
List<DingU8cBillEntity> query = dingU8cBillDao.query(dingU8cBillEntity);
|
||||||
|
if(query.size()==0){
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
return query.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核付款单
|
||||||
|
* @param vbillcode 单据号
|
||||||
|
* @param corpCode 公司编码
|
||||||
|
*/
|
||||||
|
public void approveArapDjzb(String vbillcode,String corpCode){
|
||||||
|
ArapDjzb arapDjzb = new ArapDjzb();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
* @since 2024-10-28 15:45:32
|
* @since 2024-10-28 15:45:32
|
||||||
*/
|
*/
|
||||||
public interface IDingU8cBillDao extends IBaseDao<DingU8cBillEntity, String> {
|
public interface IDingU8cBillDao extends IBaseDao<DingU8cBillEntity, String> {
|
||||||
|
public void saveOrUpDateV2(DingU8cBillEntity dingU8cBillEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,61 @@ package com.hzya.frame.plugin.lets.dingtalk.dao.impl;
|
||||||
|
|
||||||
import com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity;
|
import com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity;
|
||||||
import com.hzya.frame.plugin.lets.dingtalk.dao.IDingU8cBillDao;
|
import com.hzya.frame.plugin.lets.dingtalk.dao.IDingU8cBillDao;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (DingU8cBill)表数据库访问层
|
* (DingU8cBill)表数据库访问层
|
||||||
*
|
* ->Y
|
||||||
|
* ->N
|
||||||
|
* N->N
|
||||||
|
* N->Y
|
||||||
|
* Y->Y
|
||||||
* @author makejava
|
* @author makejava
|
||||||
* @since 2024-10-28 15:45:32
|
* @since 2024-10-28 15:45:32
|
||||||
*/
|
*/
|
||||||
@Repository("dingU8cBillDao")
|
@Repository("dingU8cBillDao")
|
||||||
public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, String> implements IDingU8cBillDao{
|
public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, String> implements IDingU8cBillDao{
|
||||||
|
|
||||||
|
// private IDingU8cBillDao dingU8cBillDao;
|
||||||
|
@Override
|
||||||
|
public void saveOrUpDateV2(DingU8cBillEntity dingU8cBillEntityNew) {
|
||||||
|
DingU8cBillEntity dingU8cBill = new DingU8cBillEntity();
|
||||||
|
String u8cCodeCorp = dingU8cBillEntityNew.getU8cCodeCorp();
|
||||||
|
String u8cBillCode = dingU8cBillEntityNew.getU8cBillCode();
|
||||||
|
String u8cBillId = dingU8cBillEntityNew.getU8cBillId();
|
||||||
|
dingU8cBill.setU8cCodeCorp(u8cCodeCorp);
|
||||||
|
dingU8cBill.setU8cBillCode(u8cBillCode);
|
||||||
|
dingU8cBill.setU8cBillId(u8cBillId);
|
||||||
|
dingU8cBill.setSts("Y");
|
||||||
|
List<DingU8cBillEntity> query = this.query(dingU8cBill);
|
||||||
|
if (query.size() == 0) {
|
||||||
|
//->N
|
||||||
|
//->Y
|
||||||
|
this.save(dingU8cBillEntityNew);
|
||||||
|
}else {
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = query.get(0);
|
||||||
|
String pushStatus = dingU8cBillEntity.getPushStatus();
|
||||||
|
String pushStatusNew = dingU8cBillEntityNew.getPushStatus();
|
||||||
|
if("N".equals(pushStatus)&&"N".equals(pushStatusNew)){
|
||||||
|
//N->N
|
||||||
|
dingU8cBill.setPushStatus("N");
|
||||||
|
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||||
|
this.update(dingU8cBill);
|
||||||
|
}else if("N".equals(pushStatus)&&"Y".equals(pushStatusNew)){
|
||||||
|
//N->Y
|
||||||
|
dingU8cBill.setPushStatus("Y");
|
||||||
|
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||||
|
this.update(dingU8cBill);
|
||||||
|
}else if("Y".equals(pushStatus)&&"Y".equals(pushStatusNew)){
|
||||||
|
//Y->Y
|
||||||
|
dingU8cBill.setDing_res(dingU8cBillEntityNew.getDing_res());
|
||||||
|
this.update(dingU8cBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class DingU8cBillEntity extends BaseEntity {
|
||||||
private String pushInfo;
|
private String pushInfo;
|
||||||
/** 钉钉审批实例id */
|
/** 钉钉审批实例id */
|
||||||
private String dingTalkProcessId;
|
private String dingTalkProcessId;
|
||||||
|
/** 钉钉返回结果 */
|
||||||
|
private String ding_res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<result property="pushStatus" column="push_status" jdbcType="VARCHAR"/>
|
<result property="pushStatus" column="push_status" jdbcType="VARCHAR"/>
|
||||||
<result property="pushInfo" column="push_info" jdbcType="VARCHAR"/>
|
<result property="pushInfo" column="push_info" jdbcType="VARCHAR"/>
|
||||||
<result property="dingTalkProcessId" column="ding_talk_process_id" jdbcType="VARCHAR"/>
|
<result property="dingTalkProcessId" column="ding_talk_process_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="ding_res" column="ding_res" jdbcType="VARCHAR"/>
|
||||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
,push_status
|
,push_status
|
||||||
,push_info
|
,push_info
|
||||||
,ding_talk_process_id
|
,ding_talk_process_id
|
||||||
|
,ding_res
|
||||||
,modify_time
|
,modify_time
|
||||||
,create_time
|
,create_time
|
||||||
,sts
|
,sts
|
||||||
|
@ -46,6 +48,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus} </if>
|
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus} </if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> and push_info = #{pushInfo} </if>
|
<if test="pushInfo != null and pushInfo != ''"> and push_info = #{pushInfo} </if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> and ding_res = #{ding_res} </if>
|
||||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||||
|
@ -66,6 +69,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus} </if>
|
<if test="pushStatus != null and pushStatus != ''"> and push_status = #{pushStatus} </if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> and push_info = #{pushInfo} </if>
|
<if test="pushInfo != null and pushInfo != ''"> and push_info = #{pushInfo} </if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> and ding_res = #{ding_res} </if>
|
||||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||||
|
@ -88,6 +92,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> and push_status like concat('%',#{pushStatus},'%') </if>
|
<if test="pushStatus != null and pushStatus != ''"> and push_status like concat('%',#{pushStatus},'%') </if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> and push_info like concat('%',#{pushInfo},'%') </if>
|
<if test="pushInfo != null and pushInfo != ''"> and push_info like concat('%',#{pushInfo},'%') </if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id like concat('%',#{dingTalkProcessId},'%') </if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id like concat('%',#{dingTalkProcessId},'%') </if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> and ding_res like concat('%',#{ding_res},'%') </if>
|
||||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||||
|
@ -110,6 +115,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> or push_status = #{pushStatus} </if>
|
<if test="pushStatus != null and pushStatus != ''"> or push_status = #{pushStatus} </if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> or push_info = #{pushInfo} </if>
|
<if test="pushInfo != null and pushInfo != ''"> or push_info = #{pushInfo} </if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> or ding_talk_process_id = #{dingTalkProcessId} </if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> or ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> or ding_res = #{ding_res} </if>
|
||||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||||
|
@ -130,6 +136,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> push_status , </if>
|
<if test="pushStatus != null and pushStatus != ''"> push_status , </if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> push_info , </if>
|
<if test="pushInfo != null and pushInfo != ''"> push_info , </if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id , </if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id , </if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> ding_res , </if>
|
||||||
<if test="modify_time != null"> modify_time , </if>
|
<if test="modify_time != null"> modify_time , </if>
|
||||||
<if test="create_time != null"> create_time , </if>
|
<if test="create_time != null"> create_time , </if>
|
||||||
<if test="sts != null and sts != ''"> sts , </if>
|
<if test="sts != null and sts != ''"> sts , </if>
|
||||||
|
@ -146,6 +153,7 @@
|
||||||
<if test="pushStatus != null and pushStatus != ''"> #{pushStatus} ,</if>
|
<if test="pushStatus != null and pushStatus != ''"> #{pushStatus} ,</if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> #{pushInfo} ,</if>
|
<if test="pushInfo != null and pushInfo != ''"> #{pushInfo} ,</if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> #{dingTalkProcessId} ,</if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> #{dingTalkProcessId} ,</if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> #{ding_res} ,</if>
|
||||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||||
<if test="create_time != null"> #{create_time} ,</if>
|
<if test="create_time != null"> #{create_time} ,</if>
|
||||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||||
|
@ -192,6 +200,7 @@ update ding_u8c_bill set
|
||||||
<if test="pushStatus != null and pushStatus != ''"> push_status = #{pushStatus},</if>
|
<if test="pushStatus != null and pushStatus != ''"> push_status = #{pushStatus},</if>
|
||||||
<if test="pushInfo != null and pushInfo != ''"> push_info = #{pushInfo},</if>
|
<if test="pushInfo != null and pushInfo != ''"> push_info = #{pushInfo},</if>
|
||||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id = #{dingTalkProcessId},</if>
|
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id = #{dingTalkProcessId},</if>
|
||||||
|
<if test="ding_res != null and ding_res != ''"> ding_res = #{ding_res},</if>
|
||||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||||
|
|
|
@ -72,6 +72,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
|
|
||||||
Logger logger = LoggerFactory.getLogger(PushU8CServiceImpl.class);
|
Logger logger = LoggerFactory.getLogger(PushU8CServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDingU8cBillDao dingU8cBillDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委外采购(付款单)->采购付款申请(新)
|
* 委外采购(付款单)->采购付款申请(新)
|
||||||
|
@ -90,6 +93,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
Assert.state(false, "录入人手机号为空!!!");
|
Assert.state(false, "录入人手机号为空!!!");
|
||||||
}
|
}
|
||||||
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
||||||
|
if(userByMobile.getResult()==null){
|
||||||
|
Assert.state(false,userByMobile.getErrmsg());
|
||||||
|
}
|
||||||
String userid = userByMobile.getResult().getUserid();
|
String userid = userByMobile.getResult().getUserid();
|
||||||
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
||||||
String unionid = userById.getResult().getUnionid();
|
String unionid = userById.getResult().getUnionid();
|
||||||
|
@ -102,6 +108,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("委外采购(付款单)->采购付款申请(新)报错", e);
|
logger.error("委外采购(付款单)->采购付款申请(新)报错", e);
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(djFileVO.getDjzbVO().getParentvo().getDwbm(), djFileVO.getDjzbVO().getParentvo().getDwbm_code(), djFileVO.getDjzbVO().getParentvo().getBusitypecode(), djFileVO.getDjzbVO().getParentvo().getDjbh(), djFileVO.getDjzbVO().getParentvo().getVouchid(), "N", e.getMessage(), null,null);
|
||||||
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
}
|
}
|
||||||
return instanceId;
|
return instanceId;
|
||||||
}
|
}
|
||||||
|
@ -122,6 +131,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
}
|
}
|
||||||
//制单人的钉钉unionid:通过手机号获取钉钉的userid在获取unionid 13783530043
|
//制单人的钉钉unionid:通过手机号获取钉钉的userid在获取unionid 13783530043
|
||||||
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
||||||
|
if(userByMobile.getResult()==null){
|
||||||
|
Assert.state(false,userByMobile.getErrmsg());
|
||||||
|
}
|
||||||
String userid = userByMobile.getResult().getUserid();
|
String userid = userByMobile.getResult().getUserid();
|
||||||
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
||||||
String unionid = userById.getResult().getUnionid();
|
String unionid = userById.getResult().getUnionid();
|
||||||
|
@ -135,6 +147,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("代理采购(付款单)->采购付款申请(店群专用)报错", e);
|
logger.error("代理采购(付款单)->采购付款申请(店群专用)报错", e);
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(djFileVO.getDjzbVO().getParentvo().getDwbm(), djFileVO.getDjzbVO().getParentvo().getDwbm_code(), djFileVO.getDjzbVO().getParentvo().getBusitypecode(), djFileVO.getDjzbVO().getParentvo().getDjbh(), djFileVO.getDjzbVO().getParentvo().getVouchid(), "N", e.getMessage(), null,null);
|
||||||
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
}
|
}
|
||||||
return instanceId;
|
return instanceId;
|
||||||
}
|
}
|
||||||
|
@ -155,6 +170,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
}
|
}
|
||||||
//制单人的钉钉unionid:通过手机号获取钉钉的userid在获取unionid 13783530043
|
//制单人的钉钉unionid:通过手机号获取钉钉的userid在获取unionid 13783530043
|
||||||
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
OapiV2UserGetbymobileResponse userByMobile = DingTalkUtils.getUserByMobile(tokenBody.getAccessToken(), djFileVO.getDjzbVO().getParentvo().getLrr_code());
|
||||||
|
if(userByMobile.getResult()==null){
|
||||||
|
Assert.state(false,userByMobile.getErrmsg());
|
||||||
|
}
|
||||||
String userid = userByMobile.getResult().getUserid();
|
String userid = userByMobile.getResult().getUserid();
|
||||||
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
OapiV2UserGetResponse userById = DingTalkUtils.getUserById(tokenBody.getAccessToken(), userid);
|
||||||
String unionid = userById.getResult().getUnionid();
|
String unionid = userById.getResult().getUnionid();
|
||||||
|
@ -166,6 +184,9 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("调拨单内部交易(付款单)->特殊业务处理(新)报错", e);
|
logger.error("调拨单内部交易(付款单)->特殊业务处理(新)报错", e);
|
||||||
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(djFileVO.getDjzbVO().getParentvo().getDwbm(), djFileVO.getDjzbVO().getParentvo().getDwbm_code(), djFileVO.getDjzbVO().getParentvo().getBusitypecode(), djFileVO.getDjzbVO().getParentvo().getDjbh(), djFileVO.getDjzbVO().getParentvo().getVouchid(), "N", e.getMessage(), null,null);
|
||||||
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
}
|
}
|
||||||
return instanceId;
|
return instanceId;
|
||||||
}
|
}
|
||||||
|
@ -223,8 +244,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IDingU8cBillDao dingU8cBillDao;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 委外采购(付款单)->采购付款申请(新):推送钉钉审批实例
|
* 委外采购(付款单)->采购付款申请(新):推送钉钉审批实例
|
||||||
|
@ -304,45 +324,17 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
||||||
|
|
||||||
//记录成功记录
|
//记录成功记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
try {
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
|
||||||
} catch (Exception e) {
|
|
||||||
DingU8cBillEntity dingU8cBillEntity1 = new DingU8cBillEntity();
|
|
||||||
dingU8cBillEntity1.setU8cPkCorp(parentvo.getDwbm());
|
|
||||||
dingU8cBillEntity1.setU8cCodeCorp(parentvo.getDwbm_code());
|
|
||||||
dingU8cBillEntity1.setU8cBillType(parentvo.getBusitypecode());
|
|
||||||
dingU8cBillEntity1.setU8cBillCode(parentvo.getDjbh());
|
|
||||||
dingU8cBillEntity1.setU8cBillId(parentvo.getVouchid());
|
|
||||||
dingU8cBillEntity1.setPushStatus("Y");
|
|
||||||
dingU8cBillEntity1.setPushInfo(e.getMessage());
|
|
||||||
dingU8cBillEntity1.setDingTalkProcessId(instanceId);
|
|
||||||
dingU8cBillEntity1.setCreate_time(new Date());
|
|
||||||
dingU8cBillDao.save(dingU8cBillEntity1);
|
|
||||||
}
|
|
||||||
return instanceId;
|
return instanceId;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
//记录失败记录
|
//记录失败记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
try {
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
|
||||||
} catch (Exception e1) {
|
|
||||||
DingU8cBillEntity dingU8cBillEntity1 = new DingU8cBillEntity();
|
|
||||||
dingU8cBillEntity1.setU8cPkCorp(parentvo.getDwbm());
|
|
||||||
dingU8cBillEntity1.setU8cCodeCorp(parentvo.getDwbm_code());
|
|
||||||
dingU8cBillEntity1.setU8cBillType(parentvo.getBusitypecode());
|
|
||||||
dingU8cBillEntity1.setU8cBillCode(parentvo.getDjbh());
|
|
||||||
dingU8cBillEntity1.setU8cBillId(parentvo.getVouchid());
|
|
||||||
dingU8cBillEntity1.setPushStatus("N");
|
|
||||||
dingU8cBillEntity1.setPushInfo(e.getMessage());
|
|
||||||
dingU8cBillEntity1.setDingTalkProcessId(null);
|
|
||||||
dingU8cBillEntity1.setCreate_time(new Date());
|
|
||||||
dingU8cBillDao.save(dingU8cBillEntity1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -386,18 +378,18 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
||||||
|
|
||||||
//记录成功记录
|
//记录成功记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
|
|
||||||
return instanceId;
|
return instanceId;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
//记录失败记录
|
//记录失败记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
}
|
}
|
||||||
return instanceId;
|
return instanceId;
|
||||||
}
|
}
|
||||||
|
@ -438,16 +430,16 @@ public class PushU8CServiceImpl implements PushU8CService {
|
||||||
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
instanceId = JSONUtil.parseObj(jsonObject.get("body")).get("instanceId").toString();
|
||||||
|
|
||||||
//记录成功记录
|
//记录成功记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
//记录失败记录
|
//记录失败记录
|
||||||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null);
|
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "N", e.getMessage(), null,null);
|
||||||
dingU8cBillEntity.setCreate_time(new Date());
|
dingU8cBillEntity.setCreate_time(new Date());
|
||||||
dingU8cBillDao.save(dingU8cBillEntity);
|
dingU8cBillDao.saveOrUpDateV2(dingU8cBillEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
return instanceId;
|
return instanceId;
|
||||||
|
|
Loading…
Reference in New Issue