丽知:1、新增钉钉报表
This commit is contained in:
parent
3e6239f0a3
commit
914b5b18fc
|
@ -0,0 +1,86 @@
|
|||
package com.hzya.frame.plugin.lets.dingtalk.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.page.PageAttribute;
|
||||
import com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity;
|
||||
import com.hzya.frame.plugin.lets.dingtalk.service.IDingU8cBillService;
|
||||
import com.hzya.frame.web.action.DefaultController;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.hzya.frame.web.entity.BaseResult.getSuccessMessageEntity;
|
||||
|
||||
|
||||
/**
|
||||
* 钉钉报表
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dingReport")
|
||||
public class DingU8CBillController extends DefaultController {
|
||||
|
||||
protected static Logger logger = LogManager.getLogger(DingU8CBillController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private IDingU8cBillService dingU8cBillService;
|
||||
|
||||
/** 分页查询 */
|
||||
// @RequestMapping(value = "queryPaged")
|
||||
// @ResponseBody
|
||||
// public PageAttribute queryPaged(@RequestBody DingU8cBillEntity dingU8cBillEntity){
|
||||
// DingU8cBillEntity dingU8cBillEntity1 = new DingU8cBillEntity();
|
||||
// dingU8cBillEntity1.setInitiate(null);
|
||||
// PageAttribute<DingU8cBillEntity> dingU8cBillEntityPageAttribute = dingU8cBillService.queryPaged(dingU8cBillEntity1);
|
||||
// return dingU8cBillEntityPageAttribute;
|
||||
// }
|
||||
|
||||
/** 列表查询 */
|
||||
@RequestMapping(value = "queryList")
|
||||
@ResponseBody
|
||||
public JsonResultEntity queryList(@RequestBody DingU8cBillEntity dingU8cBillEntity){
|
||||
List<DingU8cBillEntity> query = dingU8cBillService.query(dingU8cBillEntity);
|
||||
return getSuccessMessageEntity("查询成功",query);
|
||||
}
|
||||
|
||||
/** 根据Id查询 */
|
||||
@RequestMapping(value = "queryById")
|
||||
@ResponseBody
|
||||
public JsonResultEntity queryById(@RequestBody DingU8cBillEntity dingU8cBillEntity){
|
||||
try {
|
||||
DingU8cBillEntity query = dingU8cBillService.queryById(dingU8cBillEntity);
|
||||
if(query==null){
|
||||
Assert.state(false);
|
||||
}
|
||||
return getSuccessMessageEntity("根据Id查询成功",query);
|
||||
}catch (Exception e){
|
||||
return getFailureMessageEntity("根据Id查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
/** 根据Id补推 */
|
||||
@RequestMapping(value = "pushById")
|
||||
@ResponseBody
|
||||
public JsonResultEntity pushById(@RequestBody DingU8cBillEntity dingU8cBillEntity){
|
||||
try {
|
||||
DingU8cBillEntity query = dingU8cBillService.pushById(dingU8cBillEntity);
|
||||
if(query==null){
|
||||
Assert.state(false);
|
||||
}
|
||||
return getSuccessMessageEntity("根据Id补推",query);
|
||||
}catch (Exception e){
|
||||
return getFailureMessageEntity("根据Id补推失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -41,51 +41,51 @@ public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, Str
|
|||
@Override
|
||||
public void pushSaveOrUpdate(DingU8cBillEntity dingU8cBillEntityNew) {
|
||||
DingU8cBillEntity dingU8cBill = new DingU8cBillEntity();
|
||||
dingU8cBill.setU8cCodeCorp(dingU8cBillEntityNew.getU8cCodeCorp());//公司
|
||||
dingU8cBill.setU8cBillCode(dingU8cBillEntityNew.getU8cBillCode());//单据号
|
||||
// dingU8cBill.setDingTalkProcessId(dingU8cBillEntityNew.getDingTalkProcessId());//实例id
|
||||
dingU8cBill.setU8c_code_corp(dingU8cBillEntityNew.getU8c_code_corp());//公司
|
||||
dingU8cBill.setU8c_bill_code(dingU8cBillEntityNew.getU8c_bill_code());//单据号
|
||||
// dingU8cBill.setDing_talk_process_id(dingU8cBillEntityNew.getDing_talk_process_id());//实例id
|
||||
dingU8cBill.setInitiate(dingU8cBillEntityNew.getInitiate());//来源平台,默认是U,如果发自钉钉会传D
|
||||
List<DingU8cBillEntity> query = this.query(dingU8cBill);
|
||||
if (query.size() == 0) {
|
||||
if("N".equals(dingU8cBillEntityNew.getPushStatus())){
|
||||
if("N".equals(dingU8cBillEntityNew.getPush_status())){
|
||||
//->N
|
||||
this.save(dingU8cBillEntityNew);
|
||||
} else if ("Y".equals(dingU8cBillEntityNew.getPushStatus())) {
|
||||
} else if ("Y".equals(dingU8cBillEntityNew.getPush_status())) {
|
||||
//->Y
|
||||
dingU8cBillEntityNew.setPush_count(1L);
|
||||
dingU8cBillEntityNew.setPush_process_ids(dingU8cBillEntityNew.getDingTalkProcessId());
|
||||
dingU8cBillEntityNew.setPush_process_ids(dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
this.save(dingU8cBillEntityNew);
|
||||
}
|
||||
} else {
|
||||
DingU8cBillEntity dingU8cBillEntity = query.get(0);
|
||||
String pushStatus = dingU8cBillEntity.getPushStatus();
|
||||
String pushStatusNew = dingU8cBillEntityNew.getPushStatus();
|
||||
String pushStatus = dingU8cBillEntity.getPush_status();
|
||||
String pushStatusNew = dingU8cBillEntityNew.getPush_status();
|
||||
if ("N".equals(pushStatus) && "N".equals(pushStatusNew)) {
|
||||
//N->N
|
||||
dingU8cBill.setId(dingU8cBillEntity.getId());
|
||||
dingU8cBill.setModify_time(new Date());
|
||||
dingU8cBill.setPushStatus("N");
|
||||
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||
dingU8cBill.setPush_status("N");
|
||||
dingU8cBill.setPush_info(dingU8cBillEntityNew.getPush_info());
|
||||
this.update(dingU8cBill);
|
||||
} else if ("N".equals(pushStatus) && "Y".equals(pushStatusNew)) {
|
||||
//N->Y,可能重复推送
|
||||
dingU8cBill.setId(dingU8cBillEntity.getId());
|
||||
dingU8cBill.setDingTalkProcessId(dingU8cBillEntityNew.getDingTalkProcessId());
|
||||
dingU8cBill.setDing_talk_process_id(dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
dingU8cBill.setModify_time(new Date());
|
||||
dingU8cBill.setPushStatus("Y");
|
||||
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||
dingU8cBill.setPush_status("Y");
|
||||
dingU8cBill.setPush_info(dingU8cBillEntityNew.getPush_info());
|
||||
dingU8cBill.setPush_count(dingU8cBillEntity.getPush_count() == null ? 1L : dingU8cBillEntity.getPush_count() + 1);
|
||||
dingU8cBill.setPush_process_ids(dingU8cBillEntity.getPush_process_ids() == null ? dingU8cBillEntityNew.getDingTalkProcessId() : dingU8cBillEntity.getPush_process_ids() + "," + dingU8cBillEntityNew.getDingTalkProcessId());
|
||||
dingU8cBill.setPush_process_ids(dingU8cBillEntity.getPush_process_ids() == null ? dingU8cBillEntityNew.getDing_talk_process_id() : dingU8cBillEntity.getPush_process_ids() + "," + dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
this.update(dingU8cBill);
|
||||
}
|
||||
// else if ("Y".equals(pushStatus)&&"Y".equals(pushStatusNew)) {
|
||||
// //Y->Y
|
||||
// dingU8cBill.setId(dingU8cBillEntity.getId());
|
||||
// dingU8cBill.setDingTalkProcessId(dingU8cBillEntityNew.getDingTalkProcessId());
|
||||
// dingU8cBill.setDing_talk_process_id(dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
// dingU8cBill.setModify_time(new Date());
|
||||
// dingU8cBill.setDing_res(dingU8cBillEntityNew.getDing_res());
|
||||
// dingU8cBill.setApprove(dingU8cBillEntityNew.getApprove());
|
||||
// dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||
// dingU8cBill.setPush_info(dingU8cBillEntityNew.getPush_info());
|
||||
// dingU8cBill.setPush_count(dingU8cBillEntityNew.getPush_count());
|
||||
// dingU8cBill.setPush_process_ids(dingU8cBillEntityNew.getPush_process_ids());
|
||||
// this.update(dingU8cBill);
|
||||
|
@ -103,9 +103,9 @@ public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, Str
|
|||
public void callBackSaveOrUpdate(DingU8cBillEntity dingU8cBillEntityNew) {
|
||||
try {
|
||||
DingU8cBillEntity dingU8cBill = new DingU8cBillEntity();
|
||||
dingU8cBill.setU8cCodeCorp(dingU8cBillEntityNew.getU8cCodeCorp());//公司
|
||||
dingU8cBill.setU8cBillCode(dingU8cBillEntityNew.getU8cBillCode());//单据号
|
||||
dingU8cBill.setDingTalkProcessId(dingU8cBillEntityNew.getDingTalkProcessId());//实例id
|
||||
dingU8cBill.setU8c_code_corp(dingU8cBillEntityNew.getU8c_code_corp());//公司
|
||||
dingU8cBill.setU8c_bill_code(dingU8cBillEntityNew.getU8c_bill_code());//单据号
|
||||
dingU8cBill.setDing_talk_process_id(dingU8cBillEntityNew.getDing_talk_process_id());//实例id
|
||||
// dingU8cBill.setInitiate(dingU8cBillEntityNew.getInitiate());//来源平台,默认是U,如果发自钉钉会传D
|
||||
List<DingU8cBillEntity> query = this.query(dingU8cBill);
|
||||
if (query.size() == 0) {
|
||||
|
@ -115,8 +115,8 @@ public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, Str
|
|||
}
|
||||
} else if (query.size() == 1) {
|
||||
DingU8cBillEntity dingU8cBillEntity = query.get(0);
|
||||
String pushStatus = dingU8cBillEntity.getPushStatus();
|
||||
String pushStatusNew = dingU8cBillEntityNew.getPushStatus();
|
||||
String pushStatus = dingU8cBillEntity.getPush_status();
|
||||
String pushStatusNew = dingU8cBillEntityNew.getPush_status();
|
||||
String approveNew = dingU8cBillEntityNew.getApprove();
|
||||
//Y->Y 钉钉审批通过
|
||||
//Y->N 钉钉审批拒绝
|
||||
|
@ -126,21 +126,21 @@ public class DingU8cBillDaoImpl extends MybatisGenericDao<DingU8cBillEntity, Str
|
|||
dingU8cBill.setDing_res(dingU8cBillEntityNew.getDing_res());
|
||||
dingU8cBill.setApprove("Y");
|
||||
dingU8cBill.setModify_time(new Date());
|
||||
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||
dingU8cBill.setPush_info(dingU8cBillEntityNew.getPush_info());
|
||||
this.update(dingU8cBill);
|
||||
} else if ("Y".equals(pushStatus) && "N".equals(approveNew)) {
|
||||
//Y->N 钉钉审批拒绝,推送成功,审批拒绝
|
||||
dingU8cBill.setId(dingU8cBillEntity.getId());
|
||||
dingU8cBill.setApprove("N");
|
||||
dingU8cBill.setPushStatus("N");
|
||||
dingU8cBill.setPush_status("N");
|
||||
dingU8cBill.setDing_res(null);
|
||||
dingU8cBill.setDingTalkProcessId(null);
|
||||
dingU8cBill.setPushInfo(dingU8cBillEntityNew.getPushInfo());
|
||||
dingU8cBill.setDing_talk_process_id(null);
|
||||
dingU8cBill.setPush_info(dingU8cBillEntityNew.getPush_info());
|
||||
this.update(dingU8cBill);
|
||||
}
|
||||
|
||||
} else {
|
||||
Assert.state(false, "钉钉回调报错,根据公司:{}、单据号:{}、实例id:{},查询单据不唯一。请检查!", dingU8cBillEntityNew.getU8cCodeCorp(), dingU8cBillEntityNew.getU8cBillCode(), dingU8cBillEntityNew.getDingTalkProcessId());
|
||||
Assert.state(false, "钉钉回调报错,根据公司:{}、单据号:{}、实例id:{},查询单据不唯一。请检查!", dingU8cBillEntityNew.getU8c_code_corp(), dingU8cBillEntityNew.getU8c_bill_code(), dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("钉钉回调报错:{}", e);
|
||||
|
|
|
@ -17,21 +17,22 @@ import lombok.NoArgsConstructor;
|
|||
public class DingU8cBillEntity extends BaseEntity {
|
||||
|
||||
/** 公司主键 */
|
||||
private String u8cPkCorp;
|
||||
private String u8c_pk_corp;
|
||||
/** 公司编码 */
|
||||
private String u8cCodeCorp;
|
||||
private String u8c_code_corp;
|
||||
private String u8c_name_corp;
|
||||
/** u8c单据类型 */
|
||||
private String u8cBillType;
|
||||
private String u8c_bill_type;
|
||||
/** u8c单据号 */
|
||||
private String u8cBillCode;
|
||||
private String u8c_bill_code;
|
||||
/** u8c单据主键 */
|
||||
private String u8cBillId;
|
||||
private String u8c_bill_id;
|
||||
/** 是否推送成功 */
|
||||
private String pushStatus;
|
||||
private String push_status;
|
||||
/** 推送日志 */
|
||||
private String pushInfo;
|
||||
private String push_info;
|
||||
/** 钉钉审批实例id */
|
||||
private String dingTalkProcessId;
|
||||
private String ding_talk_process_id;
|
||||
/** 钉钉返回结果 */
|
||||
private String ding_res;
|
||||
/** 是否审核 Y 、 N */
|
||||
|
@ -44,15 +45,15 @@ public class DingU8cBillEntity extends BaseEntity {
|
|||
/** 历史实例id */
|
||||
private String push_process_ids;
|
||||
|
||||
public DingU8cBillEntity(String u8cPkCorp, String u8cCodeCorp, String u8cBillType, String u8cBillCode, String u8cBillId, String pushStatus, String pushInfo, String dingTalkProcessId, String ding_res) {
|
||||
this.u8cPkCorp = u8cPkCorp;
|
||||
this.u8cCodeCorp = u8cCodeCorp;
|
||||
this.u8cBillType = u8cBillType;
|
||||
this.u8cBillCode = u8cBillCode;
|
||||
this.u8cBillId = u8cBillId;
|
||||
this.pushStatus = pushStatus;
|
||||
this.pushInfo = pushInfo;
|
||||
this.dingTalkProcessId = dingTalkProcessId;
|
||||
public DingU8cBillEntity(String u8c_pk_corp, String u8c_code_corp, String u8c_bill_type, String u8c_bill_code, String u8c_bill_id, String push_status, String push_info, String ding_talk_process_id, String ding_res) {
|
||||
this.u8c_pk_corp = u8c_pk_corp;
|
||||
this.u8c_code_corp = u8c_code_corp;
|
||||
this.u8c_bill_type = u8c_bill_type;
|
||||
this.u8c_bill_code = u8c_bill_code;
|
||||
this.u8c_bill_id = u8c_bill_id;
|
||||
this.push_status = push_status;
|
||||
this.push_info = push_info;
|
||||
this.ding_talk_process_id = ding_talk_process_id;
|
||||
this.ding_res = ding_res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
|
||||
<resultMap id="get-DingU8cBillEntity-result" type="com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity" >
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="u8cPkCorp" column="u8c_pk_corp" jdbcType="VARCHAR"/>
|
||||
<result property="u8cCodeCorp" column="u8c_code_corp" jdbcType="VARCHAR"/>
|
||||
<result property="u8cBillType" column="u8c_bill_type" jdbcType="VARCHAR"/>
|
||||
<result property="u8cBillCode" column="u8c_bill_code" jdbcType="VARCHAR"/>
|
||||
<result property="u8cBillId" column="u8c_bill_id" jdbcType="VARCHAR"/>
|
||||
<result property="pushStatus" column="push_status" jdbcType="VARCHAR"/>
|
||||
<result property="pushInfo" column="push_info" jdbcType="VARCHAR"/>
|
||||
<result property="dingTalkProcessId" column="ding_talk_process_id" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_pk_corp" column="u8c_pk_corp" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_code_corp" column="u8c_code_corp" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_name_corp" column="u8c_name_corp" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_bill_type" column="u8c_bill_type" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_bill_code" column="u8c_bill_code" jdbcType="VARCHAR"/>
|
||||
<result property="u8c_bill_id" column="u8c_bill_id" jdbcType="VARCHAR"/>
|
||||
<result property="push_status" column="push_status" jdbcType="VARCHAR"/>
|
||||
<result property="push_info" column="push_info" jdbcType="VARCHAR"/>
|
||||
<result property="ding_talk_process_id" column="ding_talk_process_id" jdbcType="VARCHAR"/>
|
||||
<result property="ding_res" column="ding_res" jdbcType="VARCHAR"/>
|
||||
<result property="approve" column="approve" jdbcType="VARCHAR"/>
|
||||
<result property="initiate" column="initiate" jdbcType="VARCHAR"/>
|
||||
|
@ -26,6 +27,7 @@
|
|||
id
|
||||
,u8c_pk_corp
|
||||
,u8c_code_corp
|
||||
,u8c_name_corp
|
||||
,u8c_bill_type
|
||||
,u8c_bill_code
|
||||
,u8c_bill_id
|
||||
|
@ -48,14 +50,15 @@
|
|||
from ding_u8c_bill
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null"> and id = #{id} </if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> and u8c_pk_corp = #{u8cPkCorp} </if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> and u8c_code_corp = #{u8cCodeCorp} </if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> and u8c_bill_type = #{u8cBillType} </if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> and u8c_bill_code = #{u8cBillCode} </if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> and u8c_bill_id = #{u8cBillId} </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="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> and u8c_pk_corp = #{u8c_pk_corp} </if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> and u8c_code_corp = #{u8c_code_corp} </if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> and u8c_name_corp = #{u8c_name_corp} </if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> and u8c_bill_type = #{u8c_bill_type} </if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> and u8c_bill_code = #{u8c_bill_code} </if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> and u8c_bill_id = #{u8c_bill_id} </if>
|
||||
<if test="push_status != null and push_status != ''"> and push_status = #{push_status} </if>
|
||||
<if test="push_info != null and push_info != ''"> and push_info = #{push_info} </if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> and ding_talk_process_id = #{ding_talk_process_id} </if>
|
||||
<if test="ding_res != null and ding_res != ''"> and ding_res = #{ding_res} </if>
|
||||
<if test="approve != null and approve != ''"> and approve = #{approve} </if>
|
||||
<if test="initiate != null and initiate != ''"> and initiate = #{initiate} </if>
|
||||
|
@ -63,7 +66,7 @@
|
|||
<if test="push_process_ids != null and push_process_ids != ''"> and push_process_ids = #{push_process_ids} </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="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
@ -72,14 +75,15 @@
|
|||
select count(1) from ding_u8c_bill
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null"> and id = #{id} </if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> and u8c_pk_corp = #{u8cPkCorp} </if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> and u8c_code_corp = #{u8cCodeCorp} </if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> and u8c_bill_type = #{u8cBillType} </if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> and u8c_bill_code = #{u8cBillCode} </if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> and u8c_bill_id = #{u8cBillId} </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="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> and u8c_pk_corp = #{u8c_pk_corp} </if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> and u8c_code_corp = #{u8c_code_corp} </if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> and u8c_name_corp = #{u8c_name_corp} </if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> and u8c_bill_type = #{u8c_bill_type} </if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> and u8c_bill_code = #{u8c_bill_code} </if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> and u8c_bill_id = #{u8c_bill_id} </if>
|
||||
<if test="push_status != null and push_status != ''"> and push_status = #{push_status} </if>
|
||||
<if test="push_info != null and push_info != ''"> and push_info = #{push_info} </if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> and ding_talk_process_id = #{ding_talk_process_id} </if>
|
||||
<if test="ding_res != null and ding_res != ''"> and ding_res = #{ding_res} </if>
|
||||
<if test="approve != null and approve != ''"> and approve = #{approve} </if>
|
||||
<if test="initiate != null and initiate != ''"> and initiate = #{initiate} </if>
|
||||
|
@ -87,7 +91,6 @@
|
|||
<if test="push_process_ids != null and push_process_ids != ''"> and push_process_ids = #{push_process_ids} </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="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
@ -99,14 +102,15 @@
|
|||
from ding_u8c_bill
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> and u8c_pk_corp like concat('%',#{u8cPkCorp},'%') </if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> and u8c_code_corp like concat('%',#{u8cCodeCorp},'%') </if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> and u8c_bill_type like concat('%',#{u8cBillType},'%') </if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> and u8c_bill_code like concat('%',#{u8cBillCode},'%') </if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> and u8c_bill_id like concat('%',#{u8cBillId},'%') </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="dingTalkProcessId != null and dingTalkProcessId != ''"> and ding_talk_process_id like concat('%',#{dingTalkProcessId},'%') </if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> and u8c_pk_corp like concat('%',#{u8c_pk_corp},'%') </if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> and u8c_code_corp like concat('%',#{u8c_code_corp},'%') </if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> and u8c_name_corp like concat('%',#{u8c_name_corp},'%') </if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> and u8c_bill_type like concat('%',#{u8c_bill_type},'%') </if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> and u8c_bill_code like concat('%',#{u8c_bill_code},'%') </if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> and u8c_bill_id like concat('%',#{u8c_bill_id},'%') </if>
|
||||
<if test="push_status != null and push_status != ''"> and push_status like concat('%',#{push_status},'%') </if>
|
||||
<if test="push_info != null and push_info != ''"> and push_info like concat('%',#{push_info},'%') </if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> and ding_talk_process_id like concat('%',#{ding_talk_process_id},'%') </if>
|
||||
<if test="ding_res != null and ding_res != ''"> and ding_res like concat('%',#{ding_res},'%') </if>
|
||||
<if test="approve != null and approve != ''"> and approve like concat('%',#{approve},'%') </if>
|
||||
<if test="initiate != null and initiate != ''"> and initiate like concat('%',#{initiate},'%') </if>
|
||||
|
@ -115,7 +119,6 @@
|
|||
<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="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
@ -126,14 +129,15 @@
|
|||
from ding_u8c_bill
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null"> or id = #{id} </if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> or u8c_pk_corp = #{u8cPkCorp} </if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> or u8c_code_corp = #{u8cCodeCorp} </if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> or u8c_bill_type = #{u8cBillType} </if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> or u8c_bill_code = #{u8cBillCode} </if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> or u8c_bill_id = #{u8cBillId} </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="dingTalkProcessId != null and dingTalkProcessId != ''"> or ding_talk_process_id = #{dingTalkProcessId} </if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> or u8c_pk_corp = #{u8c_pk_corp} </if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> or u8c_code_corp = #{u8c_code_corp} </if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> or u8c_name_corp = #{u8c_name_corp} </if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> or u8c_bill_type = #{u8c_bill_type} </if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> or u8c_bill_code = #{u8c_bill_code} </if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> or u8c_bill_id = #{u8c_bill_id} </if>
|
||||
<if test="push_status != null and push_status != ''"> or push_status = #{push_status} </if>
|
||||
<if test="push_info != null and push_info != ''"> or push_info = #{push_info} </if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> or ding_talk_process_id = #{ding_talk_process_id} </if>
|
||||
<if test="ding_res != null and ding_res != ''"> or ding_res = #{ding_res} </if>
|
||||
<if test="approve != null and approve != ''"> or approve = #{approve} </if>
|
||||
<if test="initiate != null and initiate != ''"> or initiate = #{initiate} </if>
|
||||
|
@ -151,14 +155,15 @@
|
|||
insert into ding_u8c_bill(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null"> id , </if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> u8c_pk_corp , </if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> u8c_code_corp , </if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> u8c_bill_type , </if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> u8c_bill_code , </if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> u8c_bill_id , </if>
|
||||
<if test="pushStatus != null and pushStatus != ''"> push_status , </if>
|
||||
<if test="pushInfo != null and pushInfo != ''"> push_info , </if>
|
||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id , </if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> u8c_pk_corp , </if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> u8c_code_corp , </if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> u8c_name_corp , </if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> u8c_bill_type , </if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> u8c_bill_code , </if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> u8c_bill_id , </if>
|
||||
<if test="push_status != null and push_status != ''"> push_status , </if>
|
||||
<if test="push_info != null and push_info != ''"> push_info , </if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> ding_talk_process_id , </if>
|
||||
<if test="ding_res != null and ding_res != ''"> ding_res , </if>
|
||||
<if test="approve != null and approve != ''"> approve , </if>
|
||||
<if test="initiate != null and initiate != ''"> initiate , </if>
|
||||
|
@ -172,14 +177,15 @@
|
|||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null"> #{id} ,</if>
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> #{u8cPkCorp} ,</if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> #{u8cCodeCorp} ,</if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> #{u8cBillType} ,</if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> #{u8cBillCode} ,</if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> #{u8cBillId} ,</if>
|
||||
<if test="pushStatus != null and pushStatus != ''"> #{pushStatus} ,</if>
|
||||
<if test="pushInfo != null and pushInfo != ''"> #{pushInfo} ,</if>
|
||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> #{dingTalkProcessId} ,</if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> #{u8c_pk_corp} ,</if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> #{u8c_code_corp} ,</if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> #{u8c_name_corp} ,</if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> #{u8c_bill_type} ,</if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> #{u8c_bill_code} ,</if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> #{u8c_bill_id} ,</if>
|
||||
<if test="push_status != null and push_status != ''"> #{push_status} ,</if>
|
||||
<if test="push_info != null and push_info != ''"> #{push_info} ,</if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> #{ding_talk_process_id} ,</if>
|
||||
<if test="ding_res != null and ding_res != ''"> #{ding_res} ,</if>
|
||||
<if test="approve != null and approve != ''"> #{approve} ,</if>
|
||||
<if test="initiate != null and initiate != ''"> #{initiate} ,</if>
|
||||
|
@ -196,14 +202,15 @@
|
|||
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity" >
|
||||
update ding_u8c_bill set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> u8c_pk_corp = #{u8cPkCorp},</if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> u8c_code_corp = #{u8cCodeCorp},</if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> u8c_bill_type = #{u8cBillType},</if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> u8c_bill_code = #{u8cBillCode},</if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> u8c_bill_id = #{u8cBillId},</if>
|
||||
<if test="pushStatus != null and pushStatus != ''"> push_status = #{pushStatus},</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="u8c_pk_corp != null and u8c_pk_corp != ''"> u8c_pk_corp = #{u8c_pk_corp},</if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> u8c_code_corp = #{u8c_code_corp},</if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> u8c_name_corp = #{u8c_name_corp},</if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> u8c_bill_type = #{u8c_bill_type},</if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> u8c_bill_code = #{u8c_bill_code},</if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> u8c_bill_id = #{u8c_bill_id},</if>
|
||||
<if test="push_status != null and push_status != ''"> push_status = #{push_status},</if>
|
||||
<if test="push_info != null and push_info != ''"> push_info = #{push_info},</if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> ding_talk_process_id = #{ding_talk_process_id},</if>
|
||||
<if test="ding_res != null and ding_res != ''"> ding_res = #{ding_res},</if>
|
||||
<if test="approve != null and approve != ''"> approve = #{approve},</if>
|
||||
<if test="initiate != null and initiate != ''"> initiate = #{initiate},</if>
|
||||
|
@ -220,17 +227,18 @@ where id = #{id}
|
|||
<update id="entity_updateV2" parameterType = "com.hzya.frame.plugin.lets.dingtalk.entity.DingU8cBillEntity" >
|
||||
update ding_u8c_bill set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="u8cPkCorp != null and u8cPkCorp != ''"> u8c_pk_corp = #{u8cPkCorp},</if>
|
||||
<if test="u8cCodeCorp != null and u8cCodeCorp != ''"> u8c_code_corp = #{u8cCodeCorp},</if>
|
||||
<if test="u8cBillType != null and u8cBillType != ''"> u8c_bill_type = #{u8cBillType},</if>
|
||||
<if test="u8cBillCode != null and u8cBillCode != ''"> u8c_bill_code = #{u8cBillCode},</if>
|
||||
<if test="u8cBillId != null and u8cBillId != ''"> u8c_bill_id = #{u8cBillId},</if>
|
||||
<if test="pushStatus != null and pushStatus != ''"> push_status = #{pushStatus},</if>
|
||||
<if test="pushStatus == null"> push_status = null,</if>
|
||||
<if test="pushInfo != null and pushInfo != ''"> push_info = #{pushInfo},</if>
|
||||
<if test="pushInfo == null"> push_info = null,</if>
|
||||
<if test="dingTalkProcessId != null and dingTalkProcessId != ''"> ding_talk_process_id = #{dingTalkProcessId},</if>
|
||||
<if test="dingTalkProcessId == null"> ding_talk_process_id = null,</if>
|
||||
<if test="u8c_pk_corp != null and u8c_pk_corp != ''"> u8c_pk_corp = #{u8c_pk_corp},</if>
|
||||
<if test="u8c_code_corp != null and u8c_code_corp != ''"> u8c_code_corp = #{u8c_code_corp},</if>
|
||||
<if test="u8c_name_corp != null and u8c_name_corp != ''"> u8c_name_corp = #{u8c_name_corp},</if>
|
||||
<if test="u8c_bill_type != null and u8c_bill_type != ''"> u8c_bill_type = #{u8c_bill_type},</if>
|
||||
<if test="u8c_bill_code != null and u8c_bill_code != ''"> u8c_bill_code = #{u8c_bill_code},</if>
|
||||
<if test="u8c_bill_id != null and u8c_bill_id != ''"> u8c_bill_id = #{u8c_bill_id},</if>
|
||||
<if test="push_status != null and push_status != ''"> push_status = #{push_status},</if>
|
||||
<if test="push_status == null"> push_status = null,</if>
|
||||
<if test="push_info != null and push_info != ''"> push_info = #{push_info},</if>
|
||||
<if test="push_info == null"> push_info = null,</if>
|
||||
<if test="ding_talk_process_id != null and ding_talk_process_id != ''"> ding_talk_process_id = #{ding_talk_process_id},</if>
|
||||
<if test="ding_talk_process_id == null"> ding_talk_process_id = null,</if>
|
||||
<if test="ding_res != null and ding_res != ''"> ding_res = #{ding_res},</if>
|
||||
<if test="ding_res == null"> ding_res = null,</if>
|
||||
<if test="approve != null and approve != ''"> approve = #{approve},</if>
|
||||
|
|
|
@ -110,6 +110,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
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());
|
||||
dingU8cBillEntity.setU8c_name_corp(djFileVO.getDjzbVO().getParentvo().getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
Assert.state(false,e.getMessage());
|
||||
}
|
||||
|
@ -150,6 +151,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
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());
|
||||
dingU8cBillEntity.setU8c_name_corp(djFileVO.getDjzbVO().getParentvo().getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
Assert.state(false,e.getMessage());
|
||||
}
|
||||
|
@ -188,6 +190,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
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());
|
||||
dingU8cBillEntity.setU8c_name_corp(djFileVO.getDjzbVO().getParentvo().getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
Assert.state(false,e.getMessage());
|
||||
}
|
||||
|
@ -333,6 +336,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), "Y", "success", instanceId,null);
|
||||
// DingU8cBillEntity dingU8cBillEntity = new DingU8cBillEntity(parentvo.getDwbm(), parentvo.getDwbm_code(), parentvo.getBusitypecode(), parentvo.getDjbh(), parentvo.getVouchid(), null, null, null,null);
|
||||
dingU8cBillEntity.setCreate_time(new Date());
|
||||
dingU8cBillEntity.setU8c_name_corp(parentvo.getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
return instanceId;
|
||||
|
||||
|
@ -390,6 +394,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
//记录成功记录
|
||||
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.setU8c_name_corp(parentvo.getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
return instanceId;
|
||||
|
||||
|
@ -442,6 +447,7 @@ public class PushU8CServiceImpl implements PushU8CService {
|
|||
//记录成功记录
|
||||
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.setU8c_name_corp(parentvo.getDwbm_name());
|
||||
dingU8cBillDao.pushSaveOrUpdate(dingU8cBillEntity);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -9,4 +9,7 @@ import com.hzya.frame.basedao.service.IBaseService;
|
|||
* @since 2024-10-28 15:45:32
|
||||
*/
|
||||
public interface IDingU8cBillService extends IBaseService<DingU8cBillEntity, String>{
|
||||
|
||||
public DingU8cBillEntity queryById(DingU8cBillEntity dingU8cBillEntity);
|
||||
public DingU8cBillEntity pushById(DingU8cBillEntity dingU8cBillEntity);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,39 @@
|
|||
package com.hzya.frame.plugin.lets.dingtalk.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.dingtalk.api.response.OapiV2UserGetResponse;
|
||||
import com.hzya.frame.page.PageAttribute;
|
||||
import com.hzya.frame.plugin.lets.constant.OverallConstant;
|
||||
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
|
||||
import com.hzya.frame.plugin.lets.dao.IArapDjzbDao;
|
||||
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.service.IDingU8cBillService;
|
||||
import com.hzya.frame.plugin.lets.dingtalk.utils.DingTalkUtils;
|
||||
import com.hzya.frame.plugin.lets.entity.ArapDjzbEntity;
|
||||
import com.hzya.frame.plugin.lets.util.pushData.Attribute;
|
||||
import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
|
||||
import com.hzya.frame.plugin.lets.util.pushData.ZTResult;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (DingU8cBill)表服务实现类
|
||||
*
|
||||
|
@ -16,6 +43,11 @@ import com.hzya.frame.basedao.service.impl.BaseService;
|
|||
@Service(value = "dingU8cBillServiceImpl")
|
||||
public class DingU8cBillServiceImpl extends BaseService<DingU8cBillEntity, String> implements IDingU8cBillService {
|
||||
|
||||
@Value("${DING.APPKEY}")
|
||||
private String APPKEY;
|
||||
@Value("${DING.AppSecret}")
|
||||
private String AppSecret;
|
||||
|
||||
private IDingU8cBillDao dingU8cBillDao;
|
||||
|
||||
@Autowired
|
||||
|
@ -23,4 +55,214 @@ public class DingU8cBillServiceImpl extends BaseService<DingU8cBillEntity, Strin
|
|||
this.dingU8cBillDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageAttribute<DingU8cBillEntity> queryPaged(DingU8cBillEntity baseEntity) {
|
||||
PageAttribute<DingU8cBillEntity> dingU8cBillEntityPageAttribute = dingU8cBillDao.queryPaged(baseEntity);
|
||||
System.out.println(dingU8cBillEntityPageAttribute);
|
||||
return dingU8cBillEntityPageAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DingU8cBillEntity> query(DingU8cBillEntity o) {
|
||||
List<DingU8cBillEntity> dingU8cBillEntityList = super.query(o);
|
||||
// for (DingU8cBillEntity dingU8cBillEntity : dingU8cBillEntityList) {
|
||||
//
|
||||
// }
|
||||
return dingU8cBillEntityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DingU8cBillEntity queryById(DingU8cBillEntity dingU8cBillEntity) {
|
||||
try{
|
||||
Assert.notNull(dingU8cBillEntity,"dingU8cBillEntity不能未空");
|
||||
Assert.notNull(dingU8cBillEntity.getId(),"ID不能未空");
|
||||
dingU8cBillEntity.setInitiate(null);
|
||||
List<DingU8cBillEntity> query = dingU8cBillDao.query(dingU8cBillEntity);
|
||||
if(query.size()==0){
|
||||
Assert.state(false,"根据id:{},查询失败,未查询到数据。",dingU8cBillEntity.getId());
|
||||
}
|
||||
return query.get(0);
|
||||
}catch (Exception e){
|
||||
Assert.state(false,e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DingU8cBillEntity pushById(DingU8cBillEntity dingU8cBillEntity) {
|
||||
try{
|
||||
Assert.notNull(dingU8cBillEntity,"dingU8cBillEntity不能未空");
|
||||
Assert.notNull(dingU8cBillEntity.getId(),"ID不能未空");
|
||||
dingU8cBillEntity.setInitiate(null);
|
||||
List<DingU8cBillEntity> query = dingU8cBillDao.query(dingU8cBillEntity);
|
||||
if(query.size()==0){
|
||||
Assert.state(false,"根据id:{},查询失败,未查询到数据。",dingU8cBillEntity.getId());
|
||||
}
|
||||
DingU8cBillEntity dingU8cBillEntityNew = query.get(0);
|
||||
|
||||
//获取token
|
||||
String token = getDingTalkToken();
|
||||
|
||||
//查询实例的具体信息
|
||||
GetProcessInstanceResponse processInstanceDetails = DingTalkUtils.getProcessInstanceDetails(token, dingU8cBillEntityNew.getDing_talk_process_id());
|
||||
GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResult processInstanceResponseBodyResult = processInstanceDetails.getBody().getResult();
|
||||
|
||||
String status = null;//审批状态。RUNNING:审批中 TERMINATED:已撤销 COMPLETED:审批完成
|
||||
String result = null;//审批结果。agree:同意 refuse:拒绝
|
||||
String userId = null;//任务处理人。
|
||||
String mobile = null;//处理人手机号
|
||||
|
||||
status = processInstanceResponseBodyResult.getStatus();
|
||||
if ("RUNNING".equals(status) || "TERMINATED".equals(status)) {
|
||||
//审批中、已撤销不处理
|
||||
return null;
|
||||
}
|
||||
//查询u8c的单据状态//spzt:1审核 null 未审核
|
||||
String u8cPkCorp = dingU8cBillEntityNew.getU8c_pk_corp();
|
||||
String u8cBillCode = dingU8cBillEntityNew.getU8c_bill_code();
|
||||
ArapDjzbEntity arapDjzbEntity = queryArapDjzbEntity(u8cPkCorp, u8cBillCode);
|
||||
if(arapDjzbEntity==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
//任务列表,文档地址:https://open-dev.dingtalk.com/apiExplorer?spm=ding_open_doc.document.0.0.33293c33eWKtYM#/?devType=org&api=workflow_1.0%23GetProcessInstance
|
||||
List<GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultTasks> tasks = processInstanceResponseBodyResult.getTasks();
|
||||
for (GetProcessInstanceResponseBody.GetProcessInstanceResponseBodyResultTasks task : tasks) {
|
||||
userId=task.getUserId();
|
||||
}
|
||||
mobile = getMobileByUserId(token, userId);
|
||||
|
||||
result = processInstanceResponseBodyResult.getResult();
|
||||
if("agree".equals(result)){
|
||||
approveArapDjzb(dingU8cBillEntityNew,mobile);
|
||||
}else if("refuse".equals(result)){
|
||||
refuse(dingU8cBillEntityNew,mobile);
|
||||
}
|
||||
return dingU8cBillEntityNew;
|
||||
}catch (Exception e){
|
||||
Assert.state(false,e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PushU8CByApiCode pushU8CByApiCode;
|
||||
public void approveArapDjzb(DingU8cBillEntity dingU8cBillEntity,String mobile) throws Exception {
|
||||
//获取当前时间
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
Map bills = new HashMap();
|
||||
bills.put("djbh", dingU8cBillEntity.getU8c_bill_code());
|
||||
bills.put("dwbm", dingU8cBillEntity.getU8c_code_corp());
|
||||
bills.put("opinion", "同意");
|
||||
// bills.put("operatorid", OverallConstant.getOverAllValue("u8cApiZdrCode"));
|
||||
bills.put("operatorid", mobile);
|
||||
bills.put("operatedate", now.toString());
|
||||
String jsonStr = JSONUtil.toJsonStr(bills);
|
||||
jsonStr = "{\"bills\":[" + jsonStr + "]}";
|
||||
System.out.println(jsonStr);
|
||||
|
||||
//推送
|
||||
String response = "";
|
||||
try {
|
||||
ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("arapFkInsetCode"), jsonStr);
|
||||
//两层判断,一层中台转发,一层u8c返回
|
||||
if ("false".equals(ztResult.getFlag())) {
|
||||
//转发失败
|
||||
response = JSONUtil.toJsonStr(ztResult.getAttribute());
|
||||
Assert.state(false, "丽知:审核付款单审核失败,失败原因:{}", ztResult.getAttribute());
|
||||
}
|
||||
Attribute attribute = ztResult.getAttribute();
|
||||
boolean isSuccess = false;
|
||||
if ("success".equals(attribute.getStatus())) {
|
||||
isSuccess = true;
|
||||
}
|
||||
if (!isSuccess) {
|
||||
Assert.state(false, "推送U8C--> 丽知:审核付款单审核 失败 接口返回结果:{} ", response);
|
||||
}
|
||||
//成功
|
||||
dingU8cBillEntity.setApprove("Y");
|
||||
dingU8cBillDao.callBackSaveOrUpdate(dingU8cBillEntity);
|
||||
} catch (Exception e) {
|
||||
logger.error("推送U8C--> 丽知:审核付款单审核 失败" + e);
|
||||
//失败
|
||||
dingU8cBillEntity.setApprove("N");
|
||||
dingU8cBillEntity.setPush_info(e.getMessage());
|
||||
dingU8cBillDao.callBackSaveOrUpdate(dingU8cBillEntity);
|
||||
Assert.state(false,"审核付款单审核失败,失败原因:{}",e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
public void refuse(DingU8cBillEntity dingU8cBillEntity, String mobile) throws IOException {
|
||||
// 服务器访问地址及端口,例如 http://ip:port
|
||||
String serviceUrl = OverallConstant.getOverAllValue("u8cApiUrl");
|
||||
// 接口地址
|
||||
String serviceName = "/u8cloud/api/dev/define";
|
||||
|
||||
//请求头
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("usercode", OverallConstant.getOverAllValue("u8cApiUsercodeCode")); // 用户
|
||||
map.put("password", OverallConstant.getOverAllValue("u8cApiPasswordCode")); // 密码,需要 MD5 加密后录入
|
||||
map.put("system", OverallConstant.getOverAllValue("u8cApiSystemCode")); // 系统编码
|
||||
map.put("custdevpclass", "nc.bs.ding.process.ProcessDingImpl"); //方法路径
|
||||
|
||||
//请求体
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("instanceId", dingU8cBillEntity.getDing_talk_process_id());
|
||||
fileMap.put("userCode", mobile);//审批人
|
||||
fileMap.put("ckeckResult", "R");
|
||||
fileMap.put("ckeckNote", "无");
|
||||
String jsonFileMap = JSONUtil.toJsonStr(fileMap);
|
||||
|
||||
|
||||
//请求
|
||||
HttpClient httpClient = new HttpClient();
|
||||
PostMethod httpPost = new PostMethod(serviceUrl + serviceName);
|
||||
httpPost.setRequestHeader("content-type", "application/json;charset=utf-8");
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
httpPost.setRequestHeader(entry.getKey(), entry.getValue()
|
||||
.toString());
|
||||
}
|
||||
|
||||
RequestEntity entity = new StringRequestEntity(jsonFileMap, "application/json", "UTF-8");
|
||||
httpPost.setRequestEntity(entity);
|
||||
httpClient.executeMethod(httpPost);
|
||||
String responseBodyAsString = httpPost.getResponseBodyAsString();
|
||||
System.out.println(responseBodyAsString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getDingTalkToken() throws Exception {
|
||||
GetAccessTokenResponseBody tokenBody = DingTalkUtils.getTokenBody(APPKEY, AppSecret);
|
||||
return tokenBody.getAccessToken();
|
||||
}
|
||||
public String getMobileByUserId(String token, String userId) {
|
||||
OapiV2UserGetResponse user = DingTalkUtils.getUserById(token, userId);
|
||||
String mobile = user.getResult().getMobile();
|
||||
return mobile;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IArapDjzbDao arapDjzbDao;
|
||||
/**
|
||||
* 查询u8c付款单主表
|
||||
*/
|
||||
public ArapDjzbEntity queryArapDjzbEntity(String u8cPkCorp, String u8cBillCode){
|
||||
ArapDjzbEntity arapDjzbEntity = new ArapDjzbEntity();
|
||||
arapDjzbEntity.setDr("0");
|
||||
arapDjzbEntity.setDwbm(u8cPkCorp);
|
||||
arapDjzbEntity.setDjbh(u8cBillCode);
|
||||
arapDjzbEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
|
||||
List<ArapDjzbEntity> query = arapDjzbDao.query(arapDjzbEntity);
|
||||
if(query.size()==0){
|
||||
return null;
|
||||
}else {
|
||||
return query.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue