diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/IApplyInvoiceDao.java b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/IApplyInvoiceDao.java new file mode 100644 index 00000000..e75045c0 --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/IApplyInvoiceDao.java @@ -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 { +} diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/impl/ApplyInvoiceDaoImpl.java b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/impl/ApplyInvoiceDaoImpl.java new file mode 100644 index 00000000..a0e7a432 --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/dao/impl/ApplyInvoiceDaoImpl.java @@ -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 implements IApplyInvoiceDao { +} diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.java b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.java new file mode 100644 index 00000000..49e87cd1 --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.java @@ -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; + } +} diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.xml b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.xml new file mode 100644 index 00000000..2f312035 --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/entity/ApplyInvoiceEntity.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/IApplyInvoiceService.java b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/IApplyInvoiceService.java new file mode 100644 index 00000000..55c9a016 --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/IApplyInvoiceService.java @@ -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 { + + /** + * 查询待办信息 + * 这里要指定人员 所以只会查出一条,如果查出多条那就是有问题的 + * @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); +} diff --git a/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/impl/ApplyInvoiceServiceImpl.java b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/impl/ApplyInvoiceServiceImpl.java new file mode 100644 index 00000000..84b8c9ca --- /dev/null +++ b/fw-oa/src/main/java/com/hzya/frame/plugin/ht/service/impl/ApplyInvoiceServiceImpl.java @@ -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 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 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; + } +}