feat: u9c同步到oa接口开发

This commit is contained in:
xiang2lin 2024-09-27 14:32:03 +08:00
parent f6dc71c3d6
commit be5f91fd11
14 changed files with 705 additions and 36 deletions

View File

@ -1,6 +1,8 @@
package com.hzya.frame.plugin.dgx.u9c.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hzya.frame.web.entity.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description 德广信U9C预付单
@ -10,7 +12,11 @@ import com.hzya.frame.web.entity.BaseEntity;
public class PrepaymentEntity extends BaseEntity {
//开始时间 查询用
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//结束时间 查询用
private String endTime;

View File

@ -8,4 +8,196 @@ import com.hzya.frame.web.entity.BaseEntity;
* @Date 2024/9/18 17:11
**/
public class RequisitionDetailEntity extends BaseEntity {
//主表id
private String pr;
//行号
private String docLineNo;
//需求分类
private String demandCode;
//厂区编码
private String factoryCode;
//厂区名字
private String factoryName;
//项目id
private String projectId;
//项目编码
private String projectCode;
//项目名字
private String projectName;
//料品id
private String materialId;
//料品编码
private String materialCode;
//料品名字
private String materialName;
//规格型号
private String specs;
//需求数量1
private String reqQtyTU;
//库存单位
private String storeUOM;
//备注
private String memo;
//要求交货日期
private String requiredDeliveryDate;
//来源单据号
private String srcDocNo;
//库存可用量
private String pRInvQty;
//状态
private String status;
public String getPr() {
return pr;
}
public void setPr(String pr) {
this.pr = pr;
}
public String getDocLineNo() {
return docLineNo;
}
public void setDocLineNo(String docLineNo) {
this.docLineNo = docLineNo;
}
public String getDemandCode() {
return demandCode;
}
public void setDemandCode(String demandCode) {
this.demandCode = demandCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getMaterialId() {
return materialId;
}
public void setMaterialId(String materialId) {
this.materialId = materialId;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getSpecs() {
return specs;
}
public void setSpecs(String specs) {
this.specs = specs;
}
public String getReqQtyTU() {
return reqQtyTU;
}
public void setReqQtyTU(String reqQtyTU) {
this.reqQtyTU = reqQtyTU;
}
public String getStoreUOM() {
return storeUOM;
}
public void setStoreUOM(String storeUOM) {
this.storeUOM = storeUOM;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getRequiredDeliveryDate() {
return requiredDeliveryDate;
}
public void setRequiredDeliveryDate(String requiredDeliveryDate) {
this.requiredDeliveryDate = requiredDeliveryDate;
}
public String getSrcDocNo() {
return srcDocNo;
}
public void setSrcDocNo(String srcDocNo) {
this.srcDocNo = srcDocNo;
}
public String getpRInvQty() {
return pRInvQty;
}
public void setpRInvQty(String pRInvQty) {
this.pRInvQty = pRInvQty;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View File

@ -0,0 +1,108 @@
<?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.dgx.u9c.dao.impl.RequisitionDetailDaoImpl">
<resultMap id="get-RequisitionDetailEntity-result" type="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionDetailEntity" >
<result property="id" column="id" />
<result property="pr" column="pr" />
<result property="docLineNo" column="docLineNo" />
<result property="demandCode" column="demandCode"/>
<result property="factoryCode" column="factoryCode"/>
<result property="factoryName" column="factoryName"/>
<result property="projectId" column="projectId"/>
<result property="projectCode" column="projectCode"/>
<result property="projectName" column="projectName"/>
<result property="materialId" column="materialId"/>
<result property="materialCode" column="materialCode"/>
<result property="materialName" column="materialName"/>
<result property="specs" column="specs"/>
<result property="reqQtyTU" column="reqQtyTU"/>
<result property="storeUOM" column="storeUOM"/>
<result property="memo" column="memo"/>
<result property="requiredDeliveryDate" column="requiredDeliveryDate"/>
<result property="srcDocNo" column="srcDocNo"/>
<result property="pRInvQty" column="pRInvQty"/>
<result property="status" column="status"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "RequisitionDetailEntity_Base_Column_List">
id,
pr,
docLineNo,
demandCode,
factoryCode,
factoryName,
projectId,
projectCode,
projectName,
materialId,
materialCode,
materialName,
specs,
reqQtyTU,
storeUOM,
memo,
requiredDeliveryDate,
srcDocNo,
pRInvQty,
status
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-RequisitionDetailEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionDetailEntity">
select
<include refid="RequisitionDetailEntity_Base_Column_List" />
from v_hzya_u9c_pr_prline
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="pr != null and pr != ''"> and pr = #{pr} </if>
<if test="docLineNo != null and docLineNo != ''"> and docLineNo = #{docLineNo} </if>
<if test="demandCode != null and demandCode != ''"> and demandCode = #{demandCode} </if>
<if test="factoryCode != null and factoryCode != ''"> and factoryCode = #{factoryCode} </if>
<if test="factoryName != null and factoryName != ''"> and factoryName = #{factoryName} </if>
<if test="projectId != null and projectId != ''"> and projectId = #{projectId} </if>
<if test="projectCode != null and projectCode != ''"> and projectCode = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> and projectName = #{projectName} </if>
<if test="materialId != null and materialId != ''"> and materialId = #{materialId} </if>
<if test="materialCode != null and materialCode != ''"> and materialCode = #{materialCode} </if>
<if test="materialName != null and materialName != ''"> and materialName = #{materialName} </if>
<if test="specs != null and specs != ''"> and specs = #{specs} </if>
<if test="reqQtyTU != null and reqQtyTU != ''"> and reqQtyTU = #{reqQtyTU} </if>
<if test="storeUOM != null and storeUOM != ''"> and storeUOM = #{storeUOM} </if>
<if test="memo != null and memo != ''"> and memo = #{memo} </if>
<if test="requiredDeliveryDate != null and requiredDeliveryDate != ''"> and requiredDeliveryDate = #{requiredDeliveryDate} </if>
<if test="srcDocNo != null and srcDocNo != ''"> and srcDocNo = #{srcDocNo} </if>
<if test="pRInvQty != null and pRInvQty != ''"> and pRInvQty = #{pRInvQty} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
</trim>
order by v_hzya_u9c_pr_prline.pr,v_hzya_u9c_pr_prline.docLineNo
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionDetailEntity">
select count(1) from v_hzya_u9c_pr_prline
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="pr != null and pr != ''"> and pr = #{pr} </if>
<if test="docLineNo != null and docLineNo != ''"> and docLineNo = #{docLineNo} </if>
<if test="demandCode != null and demandCode != ''"> and demandCode = #{demandCode} </if>
<if test="factoryCode != null and factoryCode != ''"> and factoryCode = #{factoryCode} </if>
<if test="factoryName != null and factoryName != ''"> and factoryName = #{factoryName} </if>
<if test="projectId != null and projectId != ''"> and projectId = #{projectId} </if>
<if test="projectCode != null and projectCode != ''"> and projectCode = #{projectCode} </if>
<if test="projectName != null and projectName != ''"> and projectName = #{projectName} </if>
<if test="materialId != null and materialId != ''"> and materialId = #{materialId} </if>
<if test="materialCode != null and materialCode != ''"> and materialCode = #{materialCode} </if>
<if test="materialName != null and materialName != ''"> and materialName = #{materialName} </if>
<if test="specs != null and specs != ''"> and specs = #{specs} </if>
<if test="reqQtyTU != null and reqQtyTU != ''"> and reqQtyTU = #{reqQtyTU} </if>
<if test="storeUOM != null and storeUOM != ''"> and storeUOM = #{storeUOM} </if>
<if test="memo != null and memo != ''"> and memo = #{memo} </if>
<if test="requiredDeliveryDate != null and requiredDeliveryDate != ''"> and requiredDeliveryDate = #{requiredDeliveryDate} </if>
<if test="srcDocNo != null and srcDocNo != ''"> and srcDocNo = #{srcDocNo} </if>
<if test="pRInvQty != null and pRInvQty != ''"> and pRInvQty = #{pRInvQty} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
</trim>
</select>
</mapper>

View File

@ -1,6 +1,8 @@
package com.hzya.frame.plugin.dgx.u9c.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hzya.frame.web.entity.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description 德广信U9C请购单
@ -9,8 +11,46 @@ import com.hzya.frame.web.entity.BaseEntity;
**/
public class RequisitionEntity extends BaseEntity {
//单号
private String docNo;
//业务日期
private String businessDate;
//单据类型id
private String pRDocTypeId;
//单据类型编码
private String pRDocTypeCode;
//单据类型名字
private String pRDocTypeName;
//需求人员id
private String reqEmployeeId;
//需求人员编码
private String reqEmployeeCode;
//需求人员名称
private String reqEmployeeName;
//需求部门id
private String reqDepartmentId;
//需求部门编码
private String reqDepartmentCode;
//需求部门名字
private String reqDepartmentName;
//来源类型code
private String sourceTypeCode;
//来源类型名字
private String sourceTypeName;
//单据状态code
private String status;
//单据状态name
private String statusName;
//修改时间
private String modifiedOn;
//创建时间
private String createdOn;
//开始时间 查询用
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//结束时间 查询用
private String endTime;
@ -30,4 +70,139 @@ public class RequisitionEntity extends BaseEntity {
this.endTime = endTime;
}
public String getDocNo() {
return docNo;
}
public void setDocNo(String docNo) {
this.docNo = docNo;
}
public String getBusinessDate() {
return businessDate;
}
public void setBusinessDate(String businessDate) {
this.businessDate = businessDate;
}
public String getpRDocTypeId() {
return pRDocTypeId;
}
public void setpRDocTypeId(String pRDocTypeId) {
this.pRDocTypeId = pRDocTypeId;
}
public String getpRDocTypeCode() {
return pRDocTypeCode;
}
public void setpRDocTypeCode(String pRDocTypeCode) {
this.pRDocTypeCode = pRDocTypeCode;
}
public String getpRDocTypeName() {
return pRDocTypeName;
}
public void setpRDocTypeName(String pRDocTypeName) {
this.pRDocTypeName = pRDocTypeName;
}
public String getReqEmployeeId() {
return reqEmployeeId;
}
public void setReqEmployeeId(String reqEmployeeId) {
this.reqEmployeeId = reqEmployeeId;
}
public String getReqEmployeeCode() {
return reqEmployeeCode;
}
public void setReqEmployeeCode(String reqEmployeeCode) {
this.reqEmployeeCode = reqEmployeeCode;
}
public String getReqEmployeeName() {
return reqEmployeeName;
}
public void setReqEmployeeName(String reqEmployeeName) {
this.reqEmployeeName = reqEmployeeName;
}
public String getReqDepartmentId() {
return reqDepartmentId;
}
public void setReqDepartmentId(String reqDepartmentId) {
this.reqDepartmentId = reqDepartmentId;
}
public String getReqDepartmentCode() {
return reqDepartmentCode;
}
public void setReqDepartmentCode(String reqDepartmentCode) {
this.reqDepartmentCode = reqDepartmentCode;
}
public String getReqDepartmentName() {
return reqDepartmentName;
}
public void setReqDepartmentName(String reqDepartmentName) {
this.reqDepartmentName = reqDepartmentName;
}
public String getSourceTypeCode() {
return sourceTypeCode;
}
public void setSourceTypeCode(String sourceTypeCode) {
this.sourceTypeCode = sourceTypeCode;
}
public String getSourceTypeName() {
return sourceTypeName;
}
public void setSourceTypeName(String sourceTypeName) {
this.sourceTypeName = sourceTypeName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatusName() {
return statusName;
}
public void setStatusName(String statusName) {
this.statusName = statusName;
}
public String getModifiedOn() {
return modifiedOn;
}
public void setModifiedOn(String modifiedOn) {
this.modifiedOn = modifiedOn;
}
public String getCreatedOn() {
return createdOn;
}
public void setCreatedOn(String createdOn) {
this.createdOn = createdOn;
}
}

View File

@ -0,0 +1,110 @@
<?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.dgx.u9c.dao.impl.RequisitionDaoImpl">
<resultMap id="get-RequisitionEntity-result" type="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity" >
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="docNo" column="docNo" jdbcType="VARCHAR"/>
<result property="businessDate" column="businessDate"/>
<result property="pRDocTypeId" column="pRDocTypeId"/>
<result property="pRDocTypeCode" column="pRDocTypeCode"/>
<result property="pRDocTypeName" column="pRDocTypeName"/>
<result property="reqEmployeeId" column="reqEmployeeId"/>
<result property="reqEmployeeCode" column="reqEmployeeCode"/>
<result property="reqEmployeeName" column="reqEmployeeName"/>
<result property="reqDepartmentId" column="reqDepartmentId"/>
<result property="reqDepartmentCode" column="reqDepartmentCode"/>
<result property="reqDepartmentName" column="reqDepartmentName"/>
<result property="sourceTypeCode" column="sourceTypeCode"/>
<result property="sourceTypeName" column="sourceTypeName"/>
<result property="status" column="status"/>
<result property="statusName" column="statusName"/>
<result property="modifiedOn" column="modifiedOn"/>
<result property="createdOn" column="createdOn"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "RequisitionEntity_Base_Column_List">
id,
docNo,
businessDate,
pRDocTypeId,
pRDocTypeCode,
pRDocTypeName,
reqEmployeeId,
reqEmployeeCode,
reqEmployeeName,
reqDepartmentId,
reqDepartmentCode,
reqDepartmentName,
sourceTypeCode,
sourceTypeName,
status,
statusName,
modifiedOn,
createdOn
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-RequisitionEntity-result" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">
select
<include refid="RequisitionEntity_Base_Column_List" />
from v_hzya_u9c_pr_pr
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="docNo != null and docNo != ''"> and docNo = #{docNo} </if>
<if test="businessDate != null and businessDate != ''"> and businessDate = #{businessDate} </if>
<if test="pRDocTypeId != null and pRDocTypeId != ''"> and pRDocTypeId = #{pRDocTypeId} </if>
<if test="pRDocTypeCode != null and pRDocTypeCode != ''"> and pRDocTypeCode = #{pRDocTypeCode} </if>
<if test="pRDocTypeName != null and pRDocTypeName != ''"> and pRDocTypeName = #{pRDocTypeName} </if>
<if test="reqEmployeeId != null and reqEmployeeId != ''"> and reqEmployeeId = #{reqEmployeeId} </if>
<if test="reqEmployeeId != null and reqEmployeeId != ''"> and reqEmployeeId = #{reqEmployeeId} </if>
<if test="reqEmployeeCode != null and reqEmployeeCode != ''"> and reqEmployeeCode = #{reqEmployeeCode} </if>
<if test="reqEmployeeName != null and reqEmployeeName != ''"> and reqEmployeeName = #{reqEmployeeName} </if>
<if test="reqDepartmentCode != null and reqDepartmentCode != ''"> and reqDepartmentCode = #{reqDepartmentCode} </if>
<if test="reqDepartmentName != null and reqDepartmentName != ''"> and reqDepartmentName = #{reqDepartmentName} </if>
<if test="sourceTypeCode != null and sourceTypeCode != ''"> and sourceTypeCode = #{sourceTypeCode} </if>
<if test="sourceTypeName != null and sourceTypeName != ''"> and sourceTypeName = #{sourceTypeName} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="statusName != null and statusName != ''"> and statusName = #{statusName} </if>
<if test="modifiedOn != null and modifiedOn != ''"> and modifiedOn = #{modifiedOn} </if>
<if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
<if test="startTime != null and startTime != ''"> and modifiedOn >= #{startTime} </if>
<if test="endTime != null and endTime != ''"> <![CDATA[ and modifiedOn <= #{endTime} ]]> </if>
</trim>
order by v_hzya_u9c_pr_pr.modifiedOn desc
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">
select count(1) from v_hzya_u9c_pr_pr
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="docNo != null and docNo != ''"> and docNo = #{docNo} </if>
<if test="businessDate != null and businessDate != ''"> and businessDate = #{businessDate} </if>
<if test="pRDocTypeId != null and pRDocTypeId != ''"> and pRDocTypeId = #{pRDocTypeId} </if>
<if test="pRDocTypeCode != null and pRDocTypeCode != ''"> and pRDocTypeCode = #{pRDocTypeCode} </if>
<if test="pRDocTypeName != null and pRDocTypeName != ''"> and pRDocTypeName = #{pRDocTypeName} </if>
<if test="reqEmployeeId != null and reqEmployeeId != ''"> and reqEmployeeId = #{reqEmployeeId} </if>
<if test="reqEmployeeId != null and reqEmployeeId != ''"> and reqEmployeeId = #{reqEmployeeId} </if>
<if test="reqEmployeeCode != null and reqEmployeeCode != ''"> and reqEmployeeCode = #{reqEmployeeCode} </if>
<if test="reqEmployeeName != null and reqEmployeeName != ''"> and reqEmployeeName = #{reqEmployeeName} </if>
<if test="reqDepartmentCode != null and reqDepartmentCode != ''"> and reqDepartmentCode = #{reqDepartmentCode} </if>
<if test="reqDepartmentName != null and reqDepartmentName != ''"> and reqDepartmentName = #{reqDepartmentName} </if>
<if test="sourceTypeCode != null and sourceTypeCode != ''"> and sourceTypeCode = #{sourceTypeCode} </if>
<if test="sourceTypeName != null and sourceTypeName != ''"> and sourceTypeName = #{sourceTypeName} </if>
<if test="status != null and status != ''"> and status = #{status} </if>
<if test="statusName != null and statusName != ''"> and statusName = #{statusName} </if>
<if test="modifiedOn != null and modifiedOn != ''"> and modifiedOn = #{modifiedOn} </if>
<if test="createdOn != null and createdOn != ''"> and createdOn = #{createdOn} </if>
</trim>
</select>
<update id="entity_update" parameterType="com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity">
update PR_PR set
<trim suffix="" suffixOverrides=",">
<if test="businessDate != null and businessDate != ''"> businessDate = #{businessDate},</if>
<if test="status != null"> status = #{status},</if>
</trim>
where id = #{id}
</update>
</mapper>

View File

@ -62,7 +62,7 @@ public class PrepaymentPluginInitializer extends PluginBaseEntity {
**/
@Override
public String getPluginName() {
return "U9C预付单推到OA插件";
return "德广信U9C预付单推到OA插件";
}
/****

View File

@ -57,7 +57,7 @@ public class RequisitionPluginInitializer extends PluginBaseEntity {
**/
@Override
public String getPluginName() {
return "U9C预付单推到OA插件";
return "德广信U9C请购单推送OA插件";
}
/****

View File

@ -26,5 +26,5 @@ public interface IRequisitionService extends IBaseService<RequisitionEntity,Stri
* @param entity
* @return
*/
int updateStatus(RequisitionEntity entity);
void updateStatus(RequisitionEntity entity);
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.dgx.u9c.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
@ -23,4 +24,12 @@ public interface IU9CPluginService {
* @return
*/
JsonResultEntity requisitionStartFlow(JSONObject requestJson);
/**
* 保存日志
* @param integration_task_living_details_id 日志表id
* @param flag 成功失败
* @param taskLivingDetail 日志表对象
*/
void saveLog(String integration_task_living_details_id, Boolean flag, IntegrationTaskLivingDetailsEntity taskLivingDetail);
}

View File

@ -33,6 +33,7 @@ public class RequisitionDetailServiceImpl extends BaseService<RequisitionDetailE
@DS("#entity.dataSourceCode")
@Override
public List<RequisitionDetailEntity> queryDetails(RequisitionDetailEntity entity) {
return null;
List<RequisitionDetailEntity> list = requisitionDetailDao.queryList(entity, "com.hzya.frame.plugin.dgx.u9c.dao.impl.RequisitionDetailDaoImpl.entity_list_base");
return list;
}
}

View File

@ -34,7 +34,8 @@ public class RequisitionServiceImpl extends BaseService<RequisitionEntity,String
@DS("#entity.dataSourceCode")
@Override
public List<RequisitionEntity> queryList(RequisitionEntity entity) {
return null;
List<RequisitionEntity> list = requisitionDao.queryList(entity, "com.hzya.frame.plugin.dgx.u9c.dao.impl.RequisitionDaoImpl.entity_list_base");
return list;
}
/**
@ -45,7 +46,7 @@ public class RequisitionServiceImpl extends BaseService<RequisitionEntity,String
*/
@DS("#entity.dataSourceCode")
@Override
public int updateStatus(RequisitionEntity entity) {
return 0;
public void updateStatus(RequisitionEntity entity) {
requisitionDao.update(entity);
}
}

View File

@ -9,13 +9,17 @@ import com.hzya.frame.plugin.dgx.u9c.entity.PrepaymentEntity;
import com.hzya.frame.plugin.dgx.u9c.entity.RequisitionDetailEntity;
import com.hzya.frame.plugin.dgx.u9c.entity.RequisitionEntity;
import com.hzya.frame.plugin.dgx.u9c.service.*;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@ -34,7 +38,10 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
private IRequisitionService requisitionService;
@Resource
private IRequisitionDetailService requisitionDetailServiceImpl;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Value("${zt.url}")
private String url;
/**
* u9c预付单发起OA请款单流程
*
@ -268,36 +275,38 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
for (RequisitionEntity requisition : requisitionList) {
//查询u9c请购单明细
RequisitionDetailEntity requisitionDetail = new RequisitionDetailEntity();
requisitionDetail.setPr(requisition.getId());
requisitionDetail.setDataSourceCode(datasourceCode);
List<RequisitionDetailEntity> requisitionDetailList = requisitionDetailServiceImpl.queryDetails(requisitionDetail);
if (CollectionUtils.isNotEmpty(requisitionDetailList)){
//主表
JSONObject formmain_0652 = new JSONObject();
//单据类型
formmain_0652.put("field0001","");
formmain_0652.put("field0001",requisition.getpRDocTypeName());
//发起人
formmain_0652.put("field0002","");
//发起部门
formmain_0652.put("field0003","");
//发起时间
formmain_0652.put("field0004","");
formmain_0652.put("field0004",DateUtil.now());
//需求人员
formmain_0652.put("field0005","");
formmain_0652.put("field0005",requisition.getReqEmployeeName());
//来源类型
formmain_0652.put("field0006","");
formmain_0652.put("field0006",requisition.getSourceTypeName());
//单号
formmain_0652.put("field0007","");
formmain_0652.put("field0007",requisition.getDocNo());
//需求部门
formmain_0652.put("field0008","");
formmain_0652.put("field0008",requisition.getReqDepartmentName());
//来源单号
formmain_0652.put("field0009","");
formmain_0652.put("field0009",requisitionDetailList.get(0).getSrcDocNo());
//日期
formmain_0652.put("field0010","");
formmain_0652.put("field0010",requisition.getBusinessDate());
//项目
formmain_0652.put("field0011","");
formmain_0652.put("field0011",requisitionDetailList.get(0).getProjectName());
//厂区
formmain_0652.put("field0012","");
formmain_0652.put("field0012",requisitionDetailList.get(0).getFactoryName());
//状态
formmain_0652.put("field0013","");
formmain_0652.put("field0013",requisition.getStatusName());
//请购数量合计
formmain_0652.put("field0030","");
//子表
@ -305,33 +314,33 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
for (RequisitionDetailEntity detail : requisitionDetailList) {
JSONObject formson_0653 = new JSONObject();
//行号
formson_0653.put("field0014","");
formson_0653.put("field0014",detail.getDocLineNo());
//需求分类
formson_0653.put("field0015","");
formson_0653.put("field0015",detail.getDemandCode());
//厂区明细
formson_0653.put("field0016","");
formson_0653.put("field0016",detail.getFactoryName());
//项目明细
formson_0653.put("field0017","");
formson_0653.put("field0017",detail.getProjectName());
//料号
formson_0653.put("field0018","");
formson_0653.put("field0018",detail.getMaterialCode());
//品名
formson_0653.put("field0021","");
formson_0653.put("field0021",detail.getMaterialName());
//规格
formson_0653.put("field0022","");
formson_0653.put("field0022",detail.getSpecs());
//请购数量
formson_0653.put("field0023","");
formson_0653.put("field0023",detail.getReqQtyTU());
//单位
formson_0653.put("field0024","");
formson_0653.put("field0024",detail.getStoreUOM());
//单据备注
formson_0653.put("field0025","");
formson_0653.put("field0025",detail.getMemo());
//需求交货日期
formson_0653.put("field0026","");
formson_0653.put("field0026",detail.getRequiredDeliveryDate());
//来源单号明细
formson_0653.put("field0027","");
formson_0653.put("field0027",detail.getSrcDocNo());
//库存可用量
formson_0653.put("field0028","");
formson_0653.put("field0028",detail.getpRInvQty());
//状态明细
formson_0653.put("field0029","");
formson_0653.put("field0029",detail.getStatus());
formsonList.add(formson_0653);
}
JSONObject formData = new JSONObject();
@ -344,18 +353,75 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
JSONObject param = new JSONObject();
param.put("appName","collaboration");
param.put("data",data);
String s = invokeEsb(param, "800045", "8000450002");
String paramStr = param.toString();
logger.info("u9c请购单发起OA流程请求参数:{}",paramStr);
String res = null;
Boolean flag = false;
try {
res = invokeEsb(param, "800045", "8000450002");
JSONObject jsonObject = JSONObject.parseObject(res);
flag = jsonObject.getBoolean("flag");
}catch (Exception e){
logger.error("调用oa接口出错:{}",e);
res = e.getMessage();
}
//保存日志
IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity();
taskLivingDetail.setCreate_time(new Date());
taskLivingDetail.setModify_time(new Date());
taskLivingDetail.setRootAppPk(requisition.getId());
taskLivingDetail.setRootAppBill(requisition.getDocNo());
taskLivingDetail.setPluginId("U9CPrepaymentPlugin");
taskLivingDetail.setRootAppNewData(paramStr);
taskLivingDetail.setNewTransmitInfo(res);
taskLivingDetail.setNewPushDate(new Date());
saveLog(taskId,flag,taskLivingDetail);
logger.info("u9c请购单发起OA流程返回结果:{}",res);
}
}
}
return BaseResult.getSuccessMessageEntity("德广信U9C请购单推送OA插件执行成功");
}
/**
* 保存日志
*
* @param integration_task_living_details_id 日志表id
* @param flag 成功失败
* @param taskLivingDetail 日志表对象
*/
@Override
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);
}
}
//调用注册好的esb接口
private String invokeEsb(JSONObject jsonObject,String appId,String apiCode){
String param = jsonObject.toString();
logger.info("调用:{},请求参数:{}",apiCode,param);
String result = HttpRequest.post("")
String result = HttpRequest.post(url)
.header("appId",appId)//目标应用
.header("apiCode",apiCode)//目标api
.header("publicKey","ZJYAh1QkjBK/pIrl8+vYvw190Jg/Oh84xuvDYe8sPbEtO65Ce7eDIk+3zDUT+v578prj")//调用方key

View File

@ -19,6 +19,8 @@ spring:
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/file/dev
tomcatpath: /Users/xiangerlin/work/app/file/dev
pluginpath: /Users/xiangerlin/work/app/file/dev
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a

View File

@ -3,5 +3,4 @@
<beans default-autowire="byName">
<bean name="prepaymentPluginInitializer" class="com.hzya.frame.plugin.dgx.u9c.plugin.PrepaymentPluginInitializer" />
<bean name="requisitionPluginInitializer" class="com.hzya.frame.plugin.dgx.u9c.plugin.RequisitionPluginInitializer" />
<bean name="prepaymentPluginInitializer" class="com.hzya.frame.plugin.dgx.u9c.plugin.PrepaymentPluginInitializer" />
</beans>