Compare commits
No commits in common. "f9a690a1362d9b94845ba7796802bc0d72ed116e" and "3a03ccbce0ef7da87df3d82c7f820575eff0c836" have entirely different histories.
f9a690a136
...
3a03ccbce0
|
@ -45,9 +45,9 @@
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>jianhui</id><!-- 建辉环境打包用这个-->
|
<id>zqtlocal</id> <!--曾庆拓-->
|
||||||
<properties>
|
<properties>
|
||||||
<profile.active>jianhui</profile.active>
|
<profile.active>zqtlocal</profile.active>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.dao;
|
|
||||||
|
|
||||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description OA请购单
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/8 17:06
|
|
||||||
**/
|
|
||||||
public interface IRequisitionOrderDao extends IBaseDao<RequisitionOrderEntity,String> {
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.dao.impl;
|
|
||||||
|
|
||||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.dao.IRequisitionOrderDao;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description OA请购单
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/8 17:08
|
|
||||||
**/
|
|
||||||
@Repository("requisitionOrderDaoImpl")
|
|
||||||
public class RequisitionOrderDaoImpl extends MybatisGenericDao<RequisitionOrderEntity,String> implements IRequisitionOrderDao {
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.entity;
|
|
||||||
|
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description OA请购单
|
|
||||||
*
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/8 17:04
|
|
||||||
**/
|
|
||||||
public class RequisitionOrderEntity extends BaseEntity {
|
|
||||||
|
|
||||||
private String field0001;//单据号
|
|
||||||
private String field0059;//NCC
|
|
||||||
|
|
||||||
public String getField0001() {
|
|
||||||
return field0001;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setField0001(String field0001) {
|
|
||||||
this.field0001 = field0001;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getField0059() {
|
|
||||||
return field0059;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setField0059(String field0059) {
|
|
||||||
this.field0059 = field0059;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?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.oa.praybill.dao.impl.RequisitionOrderDaoImpl">
|
|
||||||
|
|
||||||
<update id="entity_update" parameterType="com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity">
|
|
||||||
update formmain_0254 set field0059 = #{field0059} where id = #{id}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
|
|
@ -2,12 +2,10 @@ package com.hzya.frame.plugin.oa.praybill.plugin;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.plugin.oa.praybill.service.IRequisitionOrderPluginService;
|
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 请购单传NCC
|
* @Description 请购单传NCC
|
||||||
|
@ -16,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
**/
|
**/
|
||||||
public class RequisitionOrderPluginInitializer extends PluginBaseEntity {
|
public class RequisitionOrderPluginInitializer extends PluginBaseEntity {
|
||||||
Logger logger = LoggerFactory.getLogger(RequisitionOrderPluginInitializer.class);
|
Logger logger = LoggerFactory.getLogger(RequisitionOrderPluginInitializer.class);
|
||||||
@Autowired
|
|
||||||
private IRequisitionOrderPluginService requisitionOrderPluginService;
|
|
||||||
/***
|
/***
|
||||||
* 插件初始化方法
|
* 插件初始化方法
|
||||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
@ -96,10 +92,8 @@ public class RequisitionOrderPluginInitializer extends PluginBaseEntity {
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||||
try {
|
try {
|
||||||
logger.info("======开始执行请购单传NCC插件======{}",JSONObject.toJSONString(requestJson));
|
logger.info("======开始执行请购单传NCC插件======");
|
||||||
requisitionOrderPluginService.sync2ncc(requestJson);
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
|
||||||
logger.info("======执行请购单传NCC插件出错======{}",e.getMessage());
|
logger.info("======执行请购单传NCC插件出错======{}",e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("请购单传NCC插件执行失败",e.getMessage());
|
return BaseResult.getFailureMessageEntity("请购单传NCC插件执行失败",e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.service;
|
|
||||||
|
|
||||||
import com.hzya.frame.basedao.service.IBaseService;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description OA 请购单
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/8 17:10
|
|
||||||
**/
|
|
||||||
public interface IRequisitionOrderService extends IBaseService<RequisitionOrderEntity,String> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新OA单据
|
|
||||||
* @param entity
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int updateOrder(RequisitionOrderEntity entity);
|
|
||||||
}
|
|
|
@ -1,34 +1,15 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.service.impl;
|
package com.hzya.frame.plugin.oa.praybill.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.service.IRequisitionOrderPluginService;
|
import com.hzya.frame.plugin.oa.praybill.service.IRequisitionOrderPluginService;
|
||||||
import com.hzya.frame.plugin.oa.praybill.service.IRequisitionOrderService;
|
|
||||||
import com.hzya.frame.seeyon.entity.CollAttachmentResDTO;
|
|
||||||
import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
|
import com.hzya.frame.seeyon.enums.ColEventTypeEnum;
|
||||||
import com.hzya.frame.seeyon.util.OARestUtil;
|
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
|
||||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
|
||||||
import com.hzya.frame.uuid.UUIDUtils;
|
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -38,14 +19,6 @@ import java.util.List;
|
||||||
* @Date 2025/5/21 17:44
|
* @Date 2025/5/21 17:44
|
||||||
**/
|
**/
|
||||||
public class RequisitionOrderPluginServiceImpl implements IRequisitionOrderPluginService {
|
public class RequisitionOrderPluginServiceImpl implements IRequisitionOrderPluginService {
|
||||||
@Value("${zt.url}")
|
|
||||||
private String baseUrl;
|
|
||||||
@Autowired
|
|
||||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
|
||||||
@Autowired
|
|
||||||
private IRequisitionOrderService requisitionOrderService;
|
|
||||||
@Autowired
|
|
||||||
private OARestUtil oaRestUtil;
|
|
||||||
Logger logger = LoggerFactory.getLogger(IRequisitionOrderPluginService.class);
|
Logger logger = LoggerFactory.getLogger(IRequisitionOrderPluginService.class);
|
||||||
/**
|
/**
|
||||||
* 请购单同步到ncc
|
* 请购单同步到ncc
|
||||||
|
@ -57,243 +30,32 @@ public class RequisitionOrderPluginServiceImpl implements IRequisitionOrderPlugi
|
||||||
public JsonResultEntity sync2ncc(JSONObject requestJson) {
|
public JsonResultEntity sync2ncc(JSONObject requestJson) {
|
||||||
//数据源编码
|
//数据源编码
|
||||||
String datasourceCode = requestJson.getString("sourceCode");
|
String datasourceCode = requestJson.getString("sourceCode");
|
||||||
String task_living_details_id = requestJson.getString("integration_task_living_details_id");
|
|
||||||
String headersStr = requestJson.getString("headers");//请求头
|
String headersStr = requestJson.getString("headers");//请求头
|
||||||
|
String formAppId = requestJson.getString("formApp");
|
||||||
String eventType = requestJson.getString("eventType");
|
String eventType = requestJson.getString("eventType");
|
||||||
String summaryId = requestJson.getString("summaryId");
|
JSONObject formmainData = requestJson.getJSONObject("formmainTableName");
|
||||||
JSONObject headers = requestJson.getJSONObject("headers");
|
JSONArray forsonData = requestJson.getJSONArray("forsonTableName");
|
||||||
|
Assert.notEmpty(formAppId,"formAppId不能为空");
|
||||||
Assert.notEmpty(eventType,"eventType不能为空");
|
Assert.notEmpty(eventType,"eventType不能为空");
|
||||||
Assert.notEmpty(headersStr,"headers不能为空");
|
Assert.notEmpty(headersStr,"headers不能为空");
|
||||||
String formmainTableName = headers.getString("formmainTableName");
|
|
||||||
String forsonTableName = headers.getString("forsonTableName");
|
|
||||||
String fileApiCode = headers.getString("fileApiCode");
|
|
||||||
JSONObject jsonStrObj = requestJson.getJSONObject("jsonStr");
|
|
||||||
JSONObject businessData = jsonStrObj.getJSONObject("businessDataStr");
|
|
||||||
JSONObject formmainData = businessData.getJSONObject(formmainTableName);
|
|
||||||
JSONArray forsonData = businessData.getJSONArray(forsonTableName);
|
|
||||||
//流程结束
|
//流程结束
|
||||||
if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
|
if (ColEventTypeEnum.ONPROCESSFINISHED.getType().equals(eventType)){
|
||||||
//组装请购单报文
|
JSONObject praybill = new JSONObject();
|
||||||
JSONArray reqParams = praybillVaueOf(headers, formmainData, forsonData);
|
praybill.put("pk_org",formmainData.getString("field0005"));//库存组织
|
||||||
String req = JSONObject.toJSONString(reqParams);
|
praybill.put("vbillcode",formmainData.getString("field0001"));//请购单号
|
||||||
logger.info("======OA请购单传NCC请求参数:{}======",req);
|
praybill.put("dbilldate",formmainData.getString("field0004"));//请购日期
|
||||||
String result = HttpRequest.post(baseUrl)
|
praybill.put("bsctype",formmainData.getString("field0009"));//委外
|
||||||
.header("appId", "800065")//NCC请购单接口
|
praybill.put("pk_planpsn",formmainData.getString("field0010"));//计划员
|
||||||
.header("apiCode", "8000650000")//NCC应用
|
praybill.put("pk_plandept_v",formmainData.getString("field0011"));//计划部门
|
||||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
praybill.put("vmemo",formmainData.getString("field0013"));//备注
|
||||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
praybill.put("fbillstatus",formmainData.getString("field0012"));//单据状态
|
||||||
.body(req)//表单内容
|
praybill.put("billmaker", formmainData.getString("field0002"));//制单人
|
||||||
.timeout(30000)//超时,毫秒
|
praybill.put("dmakedate", formmainData.getString(""));//制单日期
|
||||||
.execute().body();
|
praybill.put("ctrantypeid", formmainData.getString("field0006"));//请购类型
|
||||||
logger.info("======OA请购单传NCC响应参数:{}======",result);
|
List<JSONObject> parybillList = new LinkedList<>();
|
||||||
if (StrUtil.isNotEmpty(result)){
|
praybill.put("pk_praybill_b",parybillList);
|
||||||
JSONObject resultJson = JSONObject.parseObject(result);
|
|
||||||
Boolean flag = resultJson.getBoolean("flag");
|
|
||||||
//保存日志
|
|
||||||
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
|
|
||||||
Date now = new Date();
|
|
||||||
taskLivingDetail.setCreate_time(now);
|
|
||||||
taskLivingDetail.setModify_time(now);
|
|
||||||
taskLivingDetail.setRootAppPk(formmainData.getString("id"));
|
|
||||||
taskLivingDetail.setRootAppBill(formmainData.getString("field0001"));
|
|
||||||
taskLivingDetail.setPluginId("RequisitionOrderPlugin");
|
|
||||||
taskLivingDetail.setRootAppNewData(req);
|
|
||||||
taskLivingDetail.setNewTransmitInfo(result);
|
|
||||||
taskLivingDetail.setNewPushDate(now);
|
|
||||||
saveLog(task_living_details_id,flag,taskLivingDetail);
|
|
||||||
//回写NCC单号到OA单据
|
|
||||||
JSONObject attribute = resultJson.getJSONObject("attribute");
|
|
||||||
if (null != attribute){
|
|
||||||
String code = attribute.getString("code");
|
|
||||||
if ("success".equals(code)){
|
|
||||||
JSONObject data = attribute.getJSONObject("data");
|
|
||||||
if (null != data){
|
|
||||||
JSONObject headVO = data.getJSONObject("headVO");
|
|
||||||
if (null != headVO){
|
|
||||||
String vbillcode = headVO.getString("code");
|
|
||||||
String pk_bill = headVO.getString("id");
|
|
||||||
logger.info("======vbillcode======:{}",vbillcode);
|
|
||||||
RequisitionOrderEntity requisitionOrderEntity = new RequisitionOrderEntity();
|
|
||||||
requisitionOrderEntity.setField0059(vbillcode);
|
|
||||||
requisitionOrderEntity.setDataSourceCode(datasourceCode);
|
|
||||||
requisitionOrderEntity.setId(formmainData.getString("id"));
|
|
||||||
requisitionOrderService.updateOrder(requisitionOrderEntity);
|
|
||||||
//下载OA附件上传到NCC
|
|
||||||
try {
|
|
||||||
uploadFile(summaryId, headers, fileApiCode, pk_bill);
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.error("下载OA附件上传到NCC出错:{}",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("请购单推NCC成功");
|
return BaseResult.getSuccessMessageEntity("请购单推NCC成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载OA附件上传到NCC
|
|
||||||
* @param summaryId
|
|
||||||
* @param headers
|
|
||||||
* @param fileApiCode
|
|
||||||
* @param pk_bill
|
|
||||||
*/
|
|
||||||
public void uploadFile(String summaryId, JSONObject headers, String fileApiCode, String pk_bill) {
|
|
||||||
String token = oaRestUtil.getToken(null, fileApiCode);
|
|
||||||
List<CollAttachmentResDTO> collAttachmentList = oaRestUtil.getColAttachments(summaryId, "0", fileApiCode, token);
|
|
||||||
if (CollectionUtils.isNotEmpty(collAttachmentList)){
|
|
||||||
//获取OA token
|
|
||||||
for (CollAttachmentResDTO collAttachment : collAttachmentList) {
|
|
||||||
try {
|
|
||||||
String fileName = URLDecoder.decode(collAttachment.getFilename(), "UTF-8");
|
|
||||||
byte[] bytes = oaRestUtil.downloadFileBytes("hzya", fileApiCode, collAttachment.getFileUrl(), fileName, token);
|
|
||||||
String base64File = Base64.getEncoder().encodeToString(bytes);
|
|
||||||
JSONObject fileParams = new JSONObject();
|
|
||||||
fileParams.put("creator", headers.getString("creator"));
|
|
||||||
fileParams.put("pk_bill", pk_bill);
|
|
||||||
fileParams.put("filename",fileName);
|
|
||||||
fileParams.put("file",base64File);
|
|
||||||
String result = HttpRequest.post(baseUrl)
|
|
||||||
.header("appId", "800065")//NCC应用
|
|
||||||
.header("apiCode", "8000650001")//NCC附件上传接口
|
|
||||||
.header("publicKey", "ZJYAbkr9+XjnDrlfQCRKXtpVvg/BjxqtxzcLgg5TIGagEKJCe7eDIk+3zDUT+v578prj")//OA公钥
|
|
||||||
.header("secretKey", "2GR4+yrcx+Ev+pN0Q6V6wxCdvisPX7wzNKBgc5SsIYGxYI5GTISXT6GvTPfp1u2Rj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA密钥
|
|
||||||
.body(fileParams.toString())//表单内容
|
|
||||||
.timeout(30000)//超时,毫秒
|
|
||||||
.execute().body();
|
|
||||||
logger.info("======OA请购单附件上传到NCC响应参数:{}======",result);
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
logger.error("下载OA附件出错:{}",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 组装请购单报文
|
|
||||||
* @param headers 请求头
|
|
||||||
* @param formmainData 主表数据
|
|
||||||
* @param forsonData 子表数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
private static JSONArray praybillVaueOf(JSONObject headers, JSONObject formmainData, JSONArray forsonData) {
|
|
||||||
JSONObject paramObj = new JSONObject();
|
|
||||||
JSONObject praybill = new JSONObject();
|
|
||||||
paramObj.put("head", praybill);
|
|
||||||
praybill.put("pk_group", formmainData.getString("field0058"));//集团
|
|
||||||
praybill.put("pk_org", formmainData.getString("field0027"));//库存组织
|
|
||||||
praybill.put("pk_org_v", formmainData.getString("field0051"));//库存组织v
|
|
||||||
//praybill.put("vbillcode",formmainData.getString("field0001"));//请购单号
|
|
||||||
praybill.put("dbilldate", formmainData.getString("field0004"));//请购日期
|
|
||||||
boolean bsctype = false;
|
|
||||||
if ("1".equals(formmainData.getString("field0009"))){
|
|
||||||
bsctype = true;
|
|
||||||
}
|
|
||||||
praybill.put("bsctype",bsctype);//委外
|
|
||||||
praybill.put("pk_planpsn", formmainData.getString("field0030"));//计划员
|
|
||||||
praybill.put("pk_plandept", formmainData.getString("field0052"));//计划部门
|
|
||||||
praybill.put("pk_plandept_v", formmainData.getString("field0053"));//计划部门v
|
|
||||||
praybill.put("vmemo", formmainData.getString("field0013"));//备注
|
|
||||||
praybill.put("fbillstatus", headers.getString("fbillstatus"));//单据状态
|
|
||||||
praybill.put("bdirecttransit",false);//zhiyun
|
|
||||||
praybill.put("billmaker", headers.getString("billmaker"));//制单人 yonyou99
|
|
||||||
praybill.put("dmakedate", formmainData.getString("field0004"));//制单日期
|
|
||||||
praybill.put("ctrantypeid", formmainData.getString("field0039"));//请购类型
|
|
||||||
praybill.put("bislatest", true);//最新版本
|
|
||||||
praybill.put("vdef1", formmainData.getString("field0037"));
|
|
||||||
praybill.put("creator", headers.getString("creator"));//
|
|
||||||
praybill.put("fpraysource", headers.getString("fpraysource"));//
|
|
||||||
praybill.put("ccurrencyid", headers.getString("ccurrencyid"));//
|
|
||||||
praybill.put("nversion", headers.getString("nversion"));//
|
|
||||||
praybill.put("nversion", headers.getString("nversion"));//
|
|
||||||
List<JSONObject> parybillList = new LinkedList<>();
|
|
||||||
paramObj.put("body",parybillList);
|
|
||||||
String pk_org = formmainData.getString("field0027");
|
|
||||||
String pk_org_v = formmainData.getString("field0051");
|
|
||||||
for(int i = 0; i< forsonData.size(); i++){
|
|
||||||
JSONObject forson = forsonData.getJSONObject(i);
|
|
||||||
JSONObject praybillB = new JSONObject();
|
|
||||||
praybillB.put("crowno",forson.getString("field0014"));
|
|
||||||
praybillB.put("nnum",forson.getString("field0020"));
|
|
||||||
praybillB.put("pk_org",pk_org);
|
|
||||||
praybillB.put("pk_org_v",pk_org_v);
|
|
||||||
praybillB.put("vchangerate","1");
|
|
||||||
praybillB.put("pk_srcmaterial",forson.getString("field0054"));//物料pk带版本的那个
|
|
||||||
praybillB.put("pk_material",forson.getString("field0031"));//物料pk
|
|
||||||
praybillB.put("castunitid",forson.getString("field0055"));//计量单位pk
|
|
||||||
praybillB.put("cunitid",forson.getString("field0055"));//计量单位pk
|
|
||||||
praybillB.put("nastnum",forson.getString("field0020"));//数量
|
|
||||||
praybillB.put("dreqdate",forson.getString("field0021"));//需求日期
|
|
||||||
praybillB.put("dsuggestdate",forson.getString("field0022"));//建议订货日期
|
|
||||||
praybillB.put("pk_purchaseorg",pk_org);//采购组织
|
|
||||||
praybillB.put("pk_purchaseorg_v",pk_org_v);//采购组织 带版本的那个
|
|
||||||
praybillB.put("pk_suggestsupplier",forson.getString("field0056"));//建议供应商
|
|
||||||
praybillB.put("pk_suggestsupplier_v",forson.getString("field0056"));//建议供应商
|
|
||||||
praybillB.put("pk_reqstoorg",pk_org);
|
|
||||||
praybillB.put("pk_reqstoorg_v",pk_org_v);
|
|
||||||
praybillB.put("pk_group", formmainData.getString("field0058"));
|
|
||||||
praybillB.put("browclose","N");//行关闭
|
|
||||||
praybillB.put("vbdef1",forson.getString("field0032"));//现存量
|
|
||||||
praybillB.put("vbdef2",forson.getString("field0033"));//在途量
|
|
||||||
praybillB.put("vbdef3",forson.getString("field0035"));//月度消耗
|
|
||||||
praybillB.put("vbdef4",forson.getString("field0034"));//安全库存
|
|
||||||
parybillList.add(praybillB);
|
|
||||||
}
|
|
||||||
//调用NCC接口
|
|
||||||
JSONArray reqParams = new JSONArray();
|
|
||||||
reqParams.add(paramObj);
|
|
||||||
return reqParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String result = "{\"msg\":\"转发失败\",\"type\":null,\"flag\":false,\"status\":\"500\",\"attribute\":{\"code\":\"success\",\"data\":{\"bodyVOList\":[{\"rowno\":\"1\",\"pk_material\":\"1001P1100000000IT34Q\",\"id\":\"1001A3100000001B2UOG\"}],\"headVO\":{\"code\":\"QG2025060800000182\",\"id\":\"1001A3100000001B2UOF\",\"vtrantypeid\":\"1001P1100000000IR21W\"}},\"message\":\"提示:========NCC-请购单保存提交《成功》!!!========。单据信息:《id》 = 1001A3100000001B2UOF ,《code》 = QG2025060800000182\"}}";
|
|
||||||
JSONObject resultJson = JSONObject.parseObject(result);
|
|
||||||
JSONObject attribute = resultJson.getJSONObject("attribute");
|
|
||||||
if (null != attribute){
|
|
||||||
String code = attribute.getString("code");
|
|
||||||
if ("success".equals(code)){
|
|
||||||
JSONObject data = attribute.getJSONObject("data");
|
|
||||||
if (null != data){
|
|
||||||
JSONObject headVO = data.getJSONObject("headVO");
|
|
||||||
if (null != headVO){
|
|
||||||
String vbillcode = headVO.getString("code");
|
|
||||||
System.out.println(vbillcode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JSONObject headers =new JSONObject();
|
|
||||||
headers.put("creator","1001P1100000000NUULI");
|
|
||||||
RequisitionOrderPluginServiceImpl service = new RequisitionOrderPluginServiceImpl();
|
|
||||||
service.uploadFile("-333447786976688302",headers,"8000640003","1001A3100000001B4COB");
|
|
||||||
}
|
|
||||||
//保存日志
|
|
||||||
public void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail){
|
|
||||||
try {
|
|
||||||
//判断,成功调用这个方法
|
|
||||||
if (StrUtil.isEmpty(integration_task_living_details_id)){
|
|
||||||
if (flag){
|
|
||||||
taskLivingDetailsService.saveLogToSuccess(taskLivingDetail);
|
|
||||||
}else {
|
|
||||||
//失败 调用这个方法
|
|
||||||
taskLivingDetailsService.saveLogToFail(taskLivingDetail);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
taskLivingDetail.setId(integration_task_living_details_id);
|
|
||||||
if (flag){
|
|
||||||
//如果是重试 成功调这个方法
|
|
||||||
taskLivingDetailsService.saveLogFailToSuccess(taskLivingDetail);
|
|
||||||
}else {
|
|
||||||
//如果是重试 失败调这个方法
|
|
||||||
taskLivingDetailsService.updateLogFailToSuccess(taskLivingDetail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
logger.error("保存日志出错:{}",e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package com.hzya.frame.plugin.oa.praybill.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.dao.IRequisitionOrderDao;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.entity.RequisitionOrderEntity;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.service.IRequisitionOrderService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description OA请购单
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/8 17:11
|
|
||||||
**/
|
|
||||||
@Service(value = "requisitionOrderServiceImpl")
|
|
||||||
public class RequisitionOrderServiceImpl extends BaseService<RequisitionOrderEntity,String> implements IRequisitionOrderService {
|
|
||||||
|
|
||||||
private IRequisitionOrderDao requisitionOrderDao;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setRequisitionOrderDao(IRequisitionOrderDao dao) {
|
|
||||||
this.requisitionOrderDao = dao;
|
|
||||||
this.dao = dao;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新OA单据
|
|
||||||
*
|
|
||||||
* @param entity
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@DS(value = "#entity.dataSourceCode")
|
|
||||||
@Override
|
|
||||||
public int updateOrder(RequisitionOrderEntity entity) {
|
|
||||||
if (null != entity && StrUtil.isNotEmpty(entity.getId())){
|
|
||||||
requisitionOrderDao.update(entity);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
#######################本地环境#######################
|
|
||||||
logging:
|
|
||||||
#日志级别 指定目录级别
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
encodings: UTF-8
|
|
||||||
file:
|
|
||||||
# 日志保存路径
|
|
||||||
path: D:\yongansystem\kangarooDataCenter\v3\logs
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
dynamic:
|
|
||||||
datasource:
|
|
||||||
master:
|
|
||||||
# url: jdbc:mysql://ufidahz.com.cn:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
|
||||||
# username: root
|
|
||||||
# password: bd993088e8a7c3dc5f44441617f9b4bf
|
|
||||||
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
|
||||||
url: jdbc:mysql://127.0.0.1:3307/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
|
||||||
username: root
|
|
||||||
password: bd993088e8a7c3dc5f44441617f9b4bf
|
|
||||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
|
||||||
savefile:
|
|
||||||
# 文件保存路径
|
|
||||||
path: D:\yongansystem\kangarooDataCenter\v3\logs
|
|
||||||
tomcatpath: D:\yongansystem\kangarooDataCenter\v3\tomcat
|
|
||||||
pluginpath: D:\yongansystem\kangarooDataCenter\v3\plugin
|
|
||||||
zt:
|
|
||||||
url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
|
|
|
@ -2,5 +2,5 @@
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||||
<beans default-autowire="byName">
|
<beans default-autowire="byName">
|
||||||
<bean name="requisitionOrderPluginInitializer" class="com.hzya.frame.plugin.oa.praybill.plugin.RequisitionOrderPluginInitializer" />
|
<bean name="requisitionOrderPluginInitializer" class="com.hzya.frame.plugin.oa.praybill.plugin.RequisitionOrderPluginInitializer" />
|
||||||
<bean name="poOrderPluginInitializer" class="com.hzya.frame.plugin.ncc.plugin.PoOrderPluginInitializer" />
|
<bean name="requisitionOrderPluginInitializer" class="com.hzya.frame.plugin.ncc.plugin.PoOrderPluginInitializer" />
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.hzya.frame;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.hzya.frame.plugin.oa.praybill.service.impl.RequisitionOrderPluginServiceImpl;
|
|
||||||
import com.hzya.frame.util.AESUtil;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description
|
|
||||||
* @Author xiangerlin
|
|
||||||
* @Date 2025/6/11 10:20
|
|
||||||
**/
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = {WebappApplication.class})
|
|
||||||
public class Test1 {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RequisitionOrderPluginServiceImpl requisitionOrderPluginService;
|
|
||||||
@Test
|
|
||||||
public void test01() {
|
|
||||||
JSONObject headers =new JSONObject();
|
|
||||||
headers.put("creator","1001P1100000000NUULI");
|
|
||||||
RequisitionOrderPluginServiceImpl service = new RequisitionOrderPluginServiceImpl();
|
|
||||||
requisitionOrderPluginService.uploadFile("-333447786976688302",headers,"8000640001","1001A3100000001B4COB");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -36,7 +36,7 @@ public class temButtom {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01() {
|
public void test01() {
|
||||||
String a = AESUtil.encrypt("hzya1314");
|
String a = AESUtil.encrypt("hzya@1314");
|
||||||
System.out.println(a);
|
System.out.println(a);
|
||||||
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
|
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
|
||||||
System.out.println(b);
|
System.out.println(b);
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
<!--api联查应用表,like查询 -->
|
<!--api联查应用表,like查询 -->
|
||||||
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
|
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
|
||||||
sys_application_api.id,
|
sys_application_api.id,
|
||||||
sys_application.id as app_id,
|
|
||||||
sys_application.app_id as app_code,
|
sys_application.app_id as app_code,
|
||||||
sys_application_api.api_code,
|
sys_application_api.api_code,
|
||||||
sys_application_api.api_name,
|
sys_application_api.api_name,
|
||||||
|
|
|
@ -76,12 +76,12 @@ public class OARestUtil {
|
||||||
* @param summaryId col_summary表id
|
* @param summaryId col_summary表id
|
||||||
* @param attType 0代表附件,2代表关联文档,“0,2”代表附件和关联文档
|
* @param attType 0代表附件,2代表关联文档,“0,2”代表附件和关联文档
|
||||||
* @param apiCode 接口编码
|
* @param apiCode 接口编码
|
||||||
* @param token
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<CollAttachmentResDTO> getColAttachments(String summaryId,String attType,String apiCode,String token){
|
public List<CollAttachmentResDTO> getColAttachments(String summaryId,String attType,String apiCode,String loginName){
|
||||||
if (StrUtil.isNotEmpty(summaryId) && StrUtil.isNotEmpty(apiCode)){
|
if (StrUtil.isNotEmpty(summaryId) && StrUtil.isNotEmpty(apiCode)){
|
||||||
SysApplicationApiEntity sysApp = getByCode(apiCode);
|
SysApplicationApiEntity sysApp = getByCode(apiCode);
|
||||||
|
String token = getToken(loginName,sysApp);
|
||||||
String appUrl = StrUtil.removeSuffix(sysApp.getAppUrl(),"/");
|
String appUrl = StrUtil.removeSuffix(sysApp.getAppUrl(),"/");
|
||||||
if (StrUtil.isEmpty(attType)){
|
if (StrUtil.isEmpty(attType)){
|
||||||
attType = "0";
|
attType = "0";
|
||||||
|
|
28
pom.xml
28
pom.xml
|
@ -471,7 +471,33 @@
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<webResources>
|
<webResources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/../base-service/src/main/webapp/WEB-INF/lib</directory>
|
||||||
|
<targetPath>WEB-INF/lib/</targetPath>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<includes>
|
||||||
|
<!-- 匹配所有jar包 -->
|
||||||
|
<include>**/*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/../fw-bip/src/main/webapp/WEB-INF/lib</directory>
|
||||||
|
<targetPath>WEB-INF/lib/</targetPath>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<includes>
|
||||||
|
<!-- 匹配所有jar包 -->
|
||||||
|
<include>**/*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/../fw-ningbobank/src/main/webapp/WEB-INF/lib</directory>
|
||||||
|
<targetPath>WEB-INF/lib/</targetPath>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<includes>
|
||||||
|
<!-- 匹配所有jar包 -->
|
||||||
|
<include>**/*.jar</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
</webResources>
|
</webResources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
Loading…
Reference in New Issue