合同评审超期合同流程终止
This commit is contained in:
parent
29113c35f1
commit
c7472dead7
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.plugin.contract.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.contract.entity.ContractAuditEntity;
|
||||
|
||||
/**
|
||||
* @Description 合同评审
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 14:55
|
||||
**/
|
||||
public interface IContractAuditDao extends IBaseDao<ContractAuditEntity,String> {
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.plugin.contract.dao.impl;
|
||||
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.contract.dao.IContractAuditDao;
|
||||
import com.hzya.frame.plugin.contract.entity.ContractAuditEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Description 合同评审
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 14:56
|
||||
**/
|
||||
@Repository()
|
||||
public class ContractAuditDaoImpl extends MybatisGenericDao<ContractAuditEntity,String> implements IContractAuditDao {
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.hzya.frame.plugin.contract.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 11:22
|
||||
**/
|
||||
public class ContractAuditEntity extends BaseEntity {
|
||||
|
||||
//表单id
|
||||
private String id;
|
||||
//单据号
|
||||
private String field0168;
|
||||
//合同编号
|
||||
private String field0239;
|
||||
//合同名称
|
||||
private String field0005;
|
||||
//流程id
|
||||
private String col_summary_id;
|
||||
//待办id
|
||||
private String affairId;
|
||||
//待办表体
|
||||
private String subject;
|
||||
//节点名称
|
||||
private String node_name;
|
||||
//节点权限
|
||||
private String node_policy;
|
||||
//待办接收时间
|
||||
private String receive_time;
|
||||
//待办完成时间
|
||||
private String complete_time;
|
||||
//待办状态
|
||||
private String state;
|
||||
//待办人登录名
|
||||
private String login_name;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCol_summary_id() {
|
||||
return col_summary_id;
|
||||
}
|
||||
|
||||
public void setCol_summary_id(String col_summary_id) {
|
||||
this.col_summary_id = col_summary_id;
|
||||
}
|
||||
|
||||
public String getAffairId() {
|
||||
return affairId;
|
||||
}
|
||||
|
||||
public void setAffairId(String affairId) {
|
||||
this.affairId = affairId;
|
||||
}
|
||||
|
||||
public String getField0168() {
|
||||
return field0168;
|
||||
}
|
||||
|
||||
public void setField0168(String field0168) {
|
||||
this.field0168 = field0168;
|
||||
}
|
||||
|
||||
public String getField0239() {
|
||||
return field0239;
|
||||
}
|
||||
|
||||
public void setField0239(String field0239) {
|
||||
this.field0239 = field0239;
|
||||
}
|
||||
|
||||
public String getField0005() {
|
||||
return field0005;
|
||||
}
|
||||
|
||||
public void setField0005(String field0005) {
|
||||
this.field0005 = field0005;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getNode_name() {
|
||||
return node_name;
|
||||
}
|
||||
|
||||
public void setNode_name(String node_name) {
|
||||
this.node_name = node_name;
|
||||
}
|
||||
|
||||
public String getNode_policy() {
|
||||
return node_policy;
|
||||
}
|
||||
|
||||
public void setNode_policy(String node_policy) {
|
||||
this.node_policy = node_policy;
|
||||
}
|
||||
|
||||
public String getReceive_time() {
|
||||
return receive_time;
|
||||
}
|
||||
|
||||
public void setReceive_time(String receive_time) {
|
||||
this.receive_time = receive_time;
|
||||
}
|
||||
|
||||
public String getComplete_time() {
|
||||
return complete_time;
|
||||
}
|
||||
|
||||
public void setComplete_time(String complete_time) {
|
||||
this.complete_time = complete_time;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getLogin_name() {
|
||||
return login_name;
|
||||
}
|
||||
|
||||
public void setLogin_name(String login_name) {
|
||||
this.login_name = login_name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.plugin.contract.dao.impl.ContractAuditDaoImpl">
|
||||
<resultMap id="get-ContractAuditEntity-result" type="com.hzya.frame.plugin.contract.entity.ContractAuditEntity">
|
||||
<!--主键 -->
|
||||
<result property="id" column="id"/>
|
||||
<result property="field0168" column="field0168"/>
|
||||
<result property="field0239" column="field0239"/>
|
||||
<result property="field0005" column="field0005"/>
|
||||
<result property="field0005" column="field0005"/>
|
||||
<result property="subject" column="subject"/>
|
||||
<result property="col_summary_id" column="col_summary_id"/>
|
||||
<result property="affairId" column="affairId"/>
|
||||
<result property="node_name" column="node_name"/>
|
||||
<result property="node_policy" column="node_policy"/>
|
||||
<result property="receive_time" column="receive_time"/>
|
||||
<result property="complete_time" column="complete_time"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="login_name" column="login_name"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 查询 超期60天没审批的合同 -->
|
||||
<select id="entity_list_base" resultMap="get-ContractAuditEntity-result" parameterType="com.hzya.frame.plugin.contract.entity.ContractAuditEntity">
|
||||
SELECT
|
||||
formmain_0325.id,
|
||||
formmain_0325.field0168,
|
||||
formmain_0325.field0239,
|
||||
formmain_0325.field0005,
|
||||
COL_SUMMARY.subject,
|
||||
COL_SUMMARY.id as col_summary_id,
|
||||
CTP_AFFAIR.id as affairId,
|
||||
CTP_AFFAIR.node_name,
|
||||
CTP_AFFAIR.node_policy,
|
||||
CTP_AFFAIR.receive_time,
|
||||
CTP_AFFAIR.complete_time,
|
||||
CTP_AFFAIR.state,
|
||||
ORG_PRINCIPAL.login_name
|
||||
FROM
|
||||
formmain_0325
|
||||
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0325.id
|
||||
LEFT JOIN CTP_AFFAIR ON CTP_AFFAIR.OBJECT_ID = COL_SUMMARY.id
|
||||
LEFT JOIN ORG_PRINCIPAL on ORG_PRINCIPAL.member_id = CTP_AFFAIR.MEMBER_ID
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">id = #{id}</if>
|
||||
<if test="field0168 != null and field0168 != ''">and formmain_0325.field0168 = #{field0168}</if>
|
||||
and CTP_AFFAIR.NODE_POLICY = '印章管理员'
|
||||
and CTP_AFFAIR.state = 3
|
||||
and DATEDIFF(DAY, CTP_AFFAIR.RECEIVE_TIME, GETDATE()) > 60
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,160 @@
|
|||
package com.hzya.frame.plugin.contract.plugin;
|
||||
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.contract.entity.ContractAuditEntity;
|
||||
import com.hzya.frame.plugin.contract.service.IContractAuditService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 合同评审,超过60天流程未审批的,把流程终止掉
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 11:07
|
||||
**/
|
||||
public class ContractAuditPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Resource
|
||||
private IContractAuditService contractAuditService;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "ContractAuditPluginInitializer";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "OA合同评审流程检测插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "OA合同评审流程检测插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* 执行业务代码
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
logger.info("======开始执行合同评审流程检测插件定时任务======");
|
||||
//1、查询超期的合同
|
||||
ContractAuditEntity contractAuditEntity = new ContractAuditEntity();
|
||||
contractAuditEntity.setDataSourceCode(requestJson.getString("sourceCode"));
|
||||
//contractAuditEntity.setField0168("PS202503270198");
|
||||
List<ContractAuditEntity> contractAuditList = contractAuditService.queryOverdueList(contractAuditEntity);
|
||||
if (CollectionUtils.isNotEmpty(contractAuditList)){
|
||||
String token = getToken();
|
||||
for (ContractAuditEntity auditEntity : contractAuditList) {
|
||||
//2、更新流程状态为终止状态
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("affairId",auditEntity.getAffairId());//待办id
|
||||
jsonObject.put("member",auditEntity.getLogin_name());//当前待办登录名
|
||||
//jsonObject.put("affairId","9022465059383233743");//待办id
|
||||
//jsonObject.put("member","yonyou");//当前待办登录名
|
||||
String reqParams = jsonObject.toString();
|
||||
logger.info("合同评审流程终止接口请求参数:{}",reqParams);
|
||||
//调用wms接口
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", "8000590002")
|
||||
.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")
|
||||
.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")
|
||||
.put("appId","800059")
|
||||
.put("token",token)
|
||||
.build();
|
||||
String body = HttpRequest.post("http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(reqParams).timeout(60000).execute().body();
|
||||
logger.info("合同评审流程终止接口返回参数:{}",body);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取token
|
||||
private String getToken(){
|
||||
String token = null;
|
||||
JSONObject tokenObj = new JSONObject();
|
||||
tokenObj.put("userName","rest0331");
|
||||
tokenObj.put("password","27db12a6-e09d-488f-90fb-143d9f45938d");
|
||||
tokenObj.put("loginName","yonyou");
|
||||
String tokenReqParams = tokenObj.toString();
|
||||
Map<String, String> tokenHeaderMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", "8000590001")
|
||||
.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")
|
||||
.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")
|
||||
.put("appId","800059")
|
||||
.build();
|
||||
String tokenBody = HttpRequest.post("http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(tokenHeaderMap).body(tokenReqParams).timeout(60000).execute().body();
|
||||
if (StrUtil.isNotEmpty(tokenBody)){
|
||||
JsonResultEntity jsonResultEntity = JSONObject.parseObject(tokenBody, JsonResultEntity.class);
|
||||
JSONObject jsonObject = (JSONObject) jsonResultEntity.getAttribute();
|
||||
token = jsonObject.getString("id");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.hzya.frame.plugin.contract.service;
|
||||
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.contract.entity.ContractAuditEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 合同评审
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 11:15
|
||||
**/
|
||||
public interface IContractAuditService extends IBaseService<ContractAuditEntity,String> {
|
||||
|
||||
/**
|
||||
* 查询超过60天还没审批的逾期合同
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<ContractAuditEntity> queryOverdueList(ContractAuditEntity entity)throws Exception;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.hzya.frame.plugin.contract.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.plugin.contract.dao.IContractAuditDao;
|
||||
import com.hzya.frame.plugin.contract.entity.ContractAuditEntity;
|
||||
import com.hzya.frame.plugin.contract.service.IContractAuditService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 合同评审
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/3/31 11:16
|
||||
**/
|
||||
@Service()
|
||||
public class ContractAuditServiceImpl extends BaseService<ContractAuditEntity,String> implements IContractAuditService {
|
||||
|
||||
Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
private IContractAuditDao contractAuditDao;
|
||||
|
||||
@Autowired
|
||||
public void setContractAuditDao(IContractAuditDao dao) {
|
||||
this.contractAuditDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询超过60天还没审批的逾期合同
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<ContractAuditEntity> queryOverdueList(ContractAuditEntity entity) throws Exception {
|
||||
List<ContractAuditEntity> query = contractAuditDao.query(entity);
|
||||
return query;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>ContractAuditPluginInitializer</id>
|
||||
<name>ContractAuditPluginInitializer插件</name>
|
||||
<category>25033101</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="contractAuditPluginInitializer" class="com.hzya.frame.plugin.contract.plugin.ContractAuditPluginInitializer" />
|
||||
</beans>
|
Loading…
Reference in New Issue