开票申请流程回退、提交
This commit is contained in:
parent
726b24021e
commit
ab8aa1aeac
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.plugin.ht.dao;
|
||||
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
||||
|
||||
/**
|
||||
* @Description OA开票申请
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 17:07
|
||||
**/
|
||||
public interface IApplyInvoiceDao extends IBaseDao<ApplyInvoiceEntity,String> {
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.plugin.ht.dao.impl;
|
||||
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
import com.hzya.frame.plugin.ht.dao.IApplyInvoiceDao;
|
||||
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Description OA开票申请
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 17:07
|
||||
**/
|
||||
@Repository(value = "applyInvoiceDaoImpl")
|
||||
public class ApplyInvoiceDaoImpl extends MybatisGenericDao<ApplyInvoiceEntity,String> implements IApplyInvoiceDao {
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.hzya.frame.plugin.ht.entity;
|
||||
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @Description OA开票申请 formmain_0331
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 17:02
|
||||
**/
|
||||
public class ApplyInvoiceEntity extends BaseEntity {
|
||||
private String field0117;//单据号
|
||||
|
||||
|
||||
//查询待办用的字段
|
||||
|
||||
private String col_summary_id;
|
||||
private String ctp_affair_id;
|
||||
private String workitem_id;
|
||||
private String member_id;//用来指定查哪个用户的待办,这里要查固定人员的待办
|
||||
public String getField0117() {
|
||||
return field0117;
|
||||
}
|
||||
|
||||
public void setField0117(String field0117) {
|
||||
this.field0117 = field0117;
|
||||
}
|
||||
|
||||
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 getCtp_affair_id() {
|
||||
return ctp_affair_id;
|
||||
}
|
||||
|
||||
public void setCtp_affair_id(String ctp_affair_id) {
|
||||
this.ctp_affair_id = ctp_affair_id;
|
||||
}
|
||||
|
||||
public String getWorkitem_id() {
|
||||
return workitem_id;
|
||||
}
|
||||
|
||||
public void setWorkitem_id(String workitem_id) {
|
||||
this.workitem_id = workitem_id;
|
||||
}
|
||||
|
||||
public String getMember_id() {
|
||||
return member_id;
|
||||
}
|
||||
|
||||
public void setMember_id(String member_id) {
|
||||
this.member_id = member_id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?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.ApplyInvoiceDaoImpl">
|
||||
<resultMap id="get-ApplyInvoiceEntity-result" type="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
|
||||
<result property="id" column="id" />
|
||||
<result property="field0117" column="field0117" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="get-Affair-subObjectId-result" type="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
|
||||
<result property="id" column="id" />
|
||||
<result property="field0117" column="field0117" />
|
||||
<result property="col_summary_id" column="col_summary_id" />
|
||||
<result property="ctp_affair_id" column="ctp_affair_id" />
|
||||
<result property="workitem_id" column="workitem_id" />
|
||||
</resultMap>
|
||||
|
||||
<select id="entity_list_base" resultMap="get-ApplyInvoiceEntity-result" parameterType="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity">
|
||||
select * from formmain_0331
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="id != null and id != ''">id = #{id}</if>
|
||||
<if test="field0117 != null and field0117 != ''">and field0117 = #{field0117}</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询待办事项id,流程提交和退回要用到 -->
|
||||
<select id="entity_list_affair" parameterType="com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity" resultMap="get-Affair-subObjectId-result">
|
||||
|
||||
SELECT
|
||||
formmain_0331.id,-- 单据id
|
||||
formmain_0331.field0117,--单据编号
|
||||
COL_SUMMARY.id as col_summary_id,--流程id
|
||||
CTP_AFFAIR.id as ctp_affair_id,-- 待办id
|
||||
CTP_AFFAIR.SUB_OBJECT_ID as workitem_id-- 流程处理和回退要用这个id
|
||||
from
|
||||
formmain_0331
|
||||
LEFT JOIN COL_SUMMARY on COL_SUMMARY.FORM_RECORDID = formmain_0331.id
|
||||
LEFT JOIN CTP_AFFAIR on CTP_AFFAIR.OBJECT_ID = COL_SUMMARY.id and CTP_AFFAIR.MEMBER_ID = '' and CTP_AFFAIR.STATE = '3'
|
||||
where
|
||||
formmain_0331.id = #{id}
|
||||
and CTP_AFFAIR.SUB_OBJECT_ID is not null
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,47 @@
|
|||
package com.hzya.frame.plugin.ht.service;
|
||||
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
|
||||
/**
|
||||
* @Description OA开票申请
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 17:56
|
||||
**/
|
||||
public interface IApplyInvoiceService extends IBaseService<ApplyInvoiceEntity,String> {
|
||||
|
||||
/**
|
||||
* 查询待办信息
|
||||
* 这里要指定人员 所以只会查出一条,如果查出多条那就是有问题的
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws BaseSystemException
|
||||
*/
|
||||
ApplyInvoiceEntity queryAffair(ApplyInvoiceEntity entity)throws BaseSystemException;
|
||||
|
||||
/**
|
||||
* 流程回退参数组装
|
||||
* @param workitemId
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
String stepBackValueOf(String workitemId,String content);
|
||||
|
||||
/**
|
||||
* 流程结束参数组装
|
||||
* @param workitemId
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
String finishValueOf(String workitemId,String content);
|
||||
|
||||
/**
|
||||
* 流程处理
|
||||
* @param param 流程参数
|
||||
* @param apiCode 接口编码
|
||||
* @loginName 登录名,获取token用
|
||||
* @return
|
||||
*/
|
||||
String process(String param,String apiCode,String loginName);
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package com.hzya.frame.plugin.ht.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
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.IApplyInvoiceDao;
|
||||
import com.hzya.frame.plugin.ht.entity.ApplyInvoiceEntity;
|
||||
import com.hzya.frame.plugin.ht.service.IApplyInvoiceService;
|
||||
import com.hzya.frame.seeyon.util.OARestUtil;
|
||||
import com.hzya.frame.web.exception.BaseSystemException;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2025/6/21 17:56
|
||||
**/
|
||||
@Service(value = "applyInvoiceServiceImpl")
|
||||
public class ApplyInvoiceServiceImpl extends BaseService<ApplyInvoiceEntity,String> implements IApplyInvoiceService {
|
||||
|
||||
private IApplyInvoiceDao applyInvoiceDao;
|
||||
|
||||
@Autowired
|
||||
public void setApplyInvoiceDao(IApplyInvoiceDao dao) {
|
||||
this.applyInvoiceDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
@Value("${zt.url}")
|
||||
private String interfaceUrl;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询待办信息
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
* @throws BaseSystemException
|
||||
*/
|
||||
@DS("entity.dataSourceCode")
|
||||
@Override
|
||||
public ApplyInvoiceEntity queryAffair(ApplyInvoiceEntity entity) throws BaseSystemException {
|
||||
List<ApplyInvoiceEntity> queryList = applyInvoiceDao.queryList(entity, "com.hzya.frame.plugin.ht.dao.impl.ApplyInvoiceDaoImpl.entity_list_affair");
|
||||
if (CollectionUtils.isNotEmpty(queryList)){
|
||||
if (queryList.size() > 1){
|
||||
throw new BaseSystemException("数据异常,查询到多条待办数据"+entity.getId());
|
||||
}
|
||||
return queryList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程回退参数组装
|
||||
*
|
||||
* @param workitemId
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String stepBackValueOf(String workitemId, String content) {
|
||||
Assert.notEmpty(workitemId,"流程回退时workitemId 必填");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appName", "collaboration");
|
||||
jsonObject.put("workitemId", workitemId);
|
||||
|
||||
JSONObject commentDeal = new JSONObject();
|
||||
commentDeal.put("attitude", "1");//1表示已阅
|
||||
commentDeal.put("content", content);
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("isWFTrace", "0");
|
||||
data.put("comment_deal", commentDeal);
|
||||
|
||||
jsonObject.put("data", data);
|
||||
return jsonObject.toJSONString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程结束参数组装
|
||||
*
|
||||
* @param workitemId
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String finishValueOf(String workitemId, String content) {
|
||||
Assert.notEmpty(workitemId,"流程回退时workitemId 必填");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("appName", "collaboration");
|
||||
json.put("workitemId", workitemId);
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("submitType", "1");
|
||||
|
||||
JSONObject commentDeal = new JSONObject();
|
||||
commentDeal.put("attitude", "2");//2表示同意
|
||||
commentDeal.put("content", content);
|
||||
data.put("comment_deal", commentDeal);
|
||||
json.put("data", data);
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程处理
|
||||
* @param param 流程参数
|
||||
* @param apiCode 接口编码
|
||||
* @loginName 登录名,获取token用
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String process(String param, String apiCode,String loginName) {
|
||||
Assert.notEmpty(param,"流程处理时参数不能为空");
|
||||
Assert.notEmpty(apiCode,"apiCode不能为空");
|
||||
logger.info("准备提交或退回流程:{},{}",apiCode,param);
|
||||
String token = OARestUtil.getToken(loginName, "8000590001");
|
||||
String result = HttpRequest.post(interfaceUrl)
|
||||
.header("appId", "800059")//OA应用
|
||||
.header("apiCode", apiCode)//流程提交/回退接口
|
||||
.header("token", token)//token
|
||||
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//中台公钥
|
||||
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//中台密钥
|
||||
.body(param)//表单内容
|
||||
.timeout(30000)//超时,毫秒
|
||||
.execute().body();
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue