流程结束
This commit is contained in:
parent
e455db28a7
commit
259120d74a
|
@ -0,0 +1,16 @@
|
|||
package com.hzya.frame.plugin.ht.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||
import com.hzya.frame.plugin.ht.entity.StopAffairEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 14:23
|
||||
**/
|
||||
public interface IStopAffairDao extends IBaseDao<StopAffairEntity,String> {
|
||||
List<StopAffairEntity> getStopAffair(StopAffairEntity entity);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.plugin.ht.dao.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.ht.dao.IBipProjectDao;
|
||||
import com.hzya.frame.plugin.ht.dao.IStopAffairDao;
|
||||
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||
import com.hzya.frame.plugin.ht.entity.StopAffairEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 14:24
|
||||
**/
|
||||
@Repository(value = "stopAffairDaoImpl")
|
||||
public class StopAffairDaoImpl extends MybatisGenericDao<StopAffairEntity,String> implements IStopAffairDao {
|
||||
|
||||
@DS("#entity.dataSourceCode")
|
||||
@Override
|
||||
public List<StopAffairEntity> getStopAffair(StopAffairEntity entity) {
|
||||
return super.query(getSqlIdPrifx() + "getStopAffair",entity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.hzya.frame.plugin.ht.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 14:19
|
||||
**/
|
||||
public class StopAffairEntity extends BaseEntity {
|
||||
|
||||
private String colSummaryId;//流程id
|
||||
private String ctpAffairId;//待办id
|
||||
private String loginName;//登陆人
|
||||
private String workitemId;//流程处理和回退要用这个id
|
||||
private String dataTime;//日期
|
||||
|
||||
public String getColSummaryId() {
|
||||
return colSummaryId;
|
||||
}
|
||||
|
||||
public void setColSummaryId(String colSummaryId) {
|
||||
this.colSummaryId = colSummaryId;
|
||||
}
|
||||
|
||||
public String getCtpAffairId() {
|
||||
return ctpAffairId;
|
||||
}
|
||||
|
||||
public void setCtpAffairId(String ctpAffairId) {
|
||||
this.ctpAffairId = ctpAffairId;
|
||||
}
|
||||
|
||||
public String getLoginName() {
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName) {
|
||||
this.loginName = loginName;
|
||||
}
|
||||
|
||||
public String getWorkitemId() {
|
||||
return workitemId;
|
||||
}
|
||||
|
||||
public void setWorkitemId(String workitemId) {
|
||||
this.workitemId = workitemId;
|
||||
}
|
||||
|
||||
public String getDataTime() {
|
||||
return dataTime;
|
||||
}
|
||||
|
||||
public void setDataTime(String dataTime) {
|
||||
this.dataTime = dataTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?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.ht.dao.impl.StopAffairDaoImpl">
|
||||
|
||||
|
||||
<select id="getStopAffair" resultType="com.hzya.frame.plugin.ht.entity.StopAffairEntity"
|
||||
parameterType="com.hzya.frame.plugin.ht.entity.StopAffairEntity">
|
||||
|
||||
SELECT
|
||||
COL_SUMMARY.id as colSummaryId,-- 流程id
|
||||
CTP_AFFAIR.id as ctpAffairId,-- 待办id
|
||||
v_user_view_all.loginName as loginName,
|
||||
CTP_AFFAIR.SUB_OBJECT_ID as workitemId -- 流程处理和回退要用这个id
|
||||
from
|
||||
formmain_0362
|
||||
LEFT JOIN COL_SUMMARY on COL_SUMMARY.FORM_RECORDID = formmain_0362.id
|
||||
LEFT JOIN CTP_AFFAIR on CTP_AFFAIR.OBJECT_ID = COL_SUMMARY.id
|
||||
LEFT JOIN v_user_view_all on v_user_view_all.id = CTP_AFFAIR.MEMBER_ID
|
||||
where
|
||||
formmain_0362.finishedflag != '1' and formmain_0362.field0062 is not null
|
||||
and CTP_AFFAIR.SUB_OBJECT_ID is not null and CTP_AFFAIR.STATE = '3'
|
||||
and FORMAT(formmain_0362.start_date, 'yyyy-MM-dd') = #{dataTime}
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,105 @@
|
|||
package com.hzya.frame.plugin.ht.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.ht.service.IFundsAllocationPluginService;
|
||||
import com.hzya.frame.plugin.ht.service.IStopAffairService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description 资金归集流程终止
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 14:06
|
||||
**/
|
||||
public class StopAffairPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(StopAffairPluginInitializer.class);
|
||||
|
||||
@Autowired
|
||||
private IStopAffairService stopAffairService;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @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 "StopAffairPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "资金归集流程终止";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "资金归集流程终止";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 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("======开始执行资金归集流程终止========");
|
||||
stopAffairService.sendStopAffair(requestJson);
|
||||
logger.info("======结束资金归集流程终止========");
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.hzya.frame.plugin.ht.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.ht.entity.BipProjectEntity;
|
||||
import com.hzya.frame.plugin.ht.entity.StopAffairEntity;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
|
||||
/**
|
||||
* @Description 资金归集流程终止
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 15:01
|
||||
**/
|
||||
public interface IStopAffairService extends IBaseService<StopAffairEntity,String> {
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 资金归集流程终止
|
||||
* @Date 2:51 下午 2025/8/11
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity sendStopAffair(JSONObject requestJson);
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.hzya.frame.plugin.ht.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.plugin.ht.dao.IFundsAllocationDao;
|
||||
import com.hzya.frame.plugin.ht.dao.IStopAffairDao;
|
||||
import com.hzya.frame.plugin.ht.entity.FundsAllocationEntity;
|
||||
import com.hzya.frame.plugin.ht.entity.StopAffairEntity;
|
||||
import com.hzya.frame.plugin.ht.service.IFundsAllocationService;
|
||||
import com.hzya.frame.plugin.ht.service.IStopAffairService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 资金归集流程终止
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 15:03
|
||||
**/
|
||||
@Service(value = "stopAffairServiceImpl")
|
||||
public class StopAffairServiceImpl extends BaseService<StopAffairEntity,String> implements IStopAffairService {
|
||||
|
||||
private IStopAffairDao stopAffairDao;
|
||||
|
||||
@Value("${zt.url}")
|
||||
private String url;
|
||||
@Autowired
|
||||
public void setStopAffairDao(IStopAffairDao dao) {
|
||||
this.stopAffairDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestJson
|
||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
* @Author lvleigang
|
||||
* @Description 资金归集流程终止
|
||||
* @Date 2:51 下午 2025/8/11
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity sendStopAffair(JSONObject requestJson) {
|
||||
//格式化日期
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String data = sdf.format(new Date());
|
||||
//获取数据
|
||||
StopAffairEntity stopAffairEntity = new StopAffairEntity();
|
||||
stopAffairEntity.setDataSourceCode("HT-OA");
|
||||
stopAffairEntity.setDataTime(data);
|
||||
List<StopAffairEntity> stopAffairEntityList = stopAffairDao.getStopAffair(stopAffairEntity);
|
||||
if(stopAffairEntityList == null || stopAffairEntityList.size() == 0){
|
||||
return BaseResult.getSuccessMessageEntity("处理资金归集流程终止成功");
|
||||
}
|
||||
List<StopAffairEntity> list = filterByColSummaryId(stopAffairEntityList);
|
||||
if(list == null || list.size() == 0){
|
||||
return BaseResult.getSuccessMessageEntity("处理资金归集流程终止成功");
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String token = getTokens("ZZZH");
|
||||
//String senddata = getStopAffair(list.get(i).getWorkitemId(),list.get(i).getLoginName());
|
||||
String senddata = getStopAffair(list.get(i).getWorkitemId(),"ZZZH");
|
||||
String returnData = doSendData("8000590007",token,senddata);
|
||||
logger.error("终止流程返回结果"+returnData);
|
||||
if (StrUtil.isNotEmpty(returnData)){
|
||||
logger.error("终止流程返回结果"+returnData);
|
||||
}
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("处理资金归集流程终止成功");
|
||||
}
|
||||
|
||||
private String getStopAffair(String workitemId,String loginName) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("affairId", workitemId);
|
||||
json.put("repealComment", "");
|
||||
json.put("member", loginName);//当前处理人登录名
|
||||
return json.toJSONString();
|
||||
}
|
||||
private String doSendData(String apiCode,String token,String param) {
|
||||
String result = HttpRequest.post(url)
|
||||
.header("appId", "800059")
|
||||
.header("apiCode", apiCode)
|
||||
.header("token", token)//token
|
||||
.header("publicKey", "ZJYA7f8FzV219otH8zhkReiyyWpXswpbY/+StvC2em0hf59Ce7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "xJ9J1Ev2F0faiJ/nQnCNklskAgtQp3QSm+ihO21uY/H0UADj0tSDPxmIhFfC4v6Fj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.body(param)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.error("Oa返回报文:{}",result);
|
||||
return result;
|
||||
}
|
||||
private String getTokens(String loginName) {
|
||||
String token = null;
|
||||
JSONObject param = new JSONObject();
|
||||
// 向JSON对象中添加键值对
|
||||
param.put("password", "b19afb1a-5a72-43db-84e1-e84aa4c571b5");
|
||||
param.put("userName", "YDRest");
|
||||
param.put("loginName", loginName);
|
||||
|
||||
String result = HttpRequest.post(url)
|
||||
.header("appId", "800059")
|
||||
.header("apiCode", "8000590001")
|
||||
.header("publicKey", "ZJYA7f8FzV219otH8zhkReiyyWpXswpbY/+StvC2em0hf59Ce7eDIk+3zDUT+v578prj")//OA公钥
|
||||
.header("secretKey", "xJ9J1Ev2F0faiJ/nQnCNklskAgtQp3QSm+ihO21uY/H0UADj0tSDPxmIhFfC4v6Fj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
||||
.body(param.toJSONString())//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.error("OaToken返回报文:{}",result);
|
||||
if (StrUtil.isNotEmpty(result)){
|
||||
JSONObject tokenObj = JSONObject.parseObject(result);
|
||||
String code = tokenObj.getString("status");
|
||||
if ("200".equals(code)){
|
||||
JSONObject attribute = tokenObj.getJSONObject("attribute");
|
||||
if (null != attribute){
|
||||
token = attribute.getString("id");
|
||||
}
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
public List<StopAffairEntity> filterByColSummaryId(List<StopAffairEntity> entityList) {
|
||||
// key: colSummaryId 的值,value: 对应的 StopAffairEntity(优先保留 loginName 为 ZZZH 的)
|
||||
Map<String, StopAffairEntity> map = new HashMap<>();
|
||||
for (StopAffairEntity entity : entityList) {
|
||||
String colSummaryId = entity.getColSummaryId();
|
||||
if (map.containsKey(colSummaryId)) {
|
||||
StopAffairEntity existingEntity = map.get(colSummaryId);
|
||||
// 如果当前实体 loginName 是 ZZZH,或者已存在的实体 loginName 不是 ZZZH 时,替换
|
||||
if ("ZZZH".equals(entity.getLoginName())
|
||||
|| !"ZZZH".equals(existingEntity.getLoginName())) {
|
||||
map.put(colSummaryId, entity);
|
||||
}
|
||||
} else {
|
||||
map.put(colSummaryId, entity);
|
||||
}
|
||||
}
|
||||
// 将 Map 的值转换为 List 返回
|
||||
return new ArrayList<>(map.values());
|
||||
}
|
||||
}
|
|
@ -7,5 +7,6 @@
|
|||
<bean name="QueryInputInvoiceResultPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.QueryInputInvoiceResultPluginInitializer" />
|
||||
<bean name="fundsAllocationPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.FundsAllocationPluginInitializer" />
|
||||
<bean name="bipProjectPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.BipProjectPluginInitializer" />
|
||||
<bean name="stopAffairPluginInitializer" class="com.hzya.frame.plugin.ht.plugin.StopAffairPluginInitializer" />
|
||||
|
||||
</beans>
|
||||
|
|
Loading…
Reference in New Issue