提交代理品牌采购业务逻辑

This commit is contained in:
liuy 2024-08-21 00:08:52 +08:00
parent d7f0d1dddc
commit e292217bed
24 changed files with 2163 additions and 125 deletions

View File

@ -0,0 +1,15 @@
package com.hzya.frame.plugin.lets.dao;
import com.hzya.frame.plugin.lets.entity.BdPurorgEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* (BD_PURORG: table)表数据库访问层
*
* @author makejava
* @since 2024-08-20 14:20:10
*/
public interface IBdPurorgDao extends IBaseDao<BdPurorgEntity, String> {
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.plugin.lets.dao.impl;
import com.hzya.frame.plugin.lets.entity.BdPurorgEntity;
import com.hzya.frame.plugin.lets.dao.IBdPurorgDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* (BdPurorg)表数据库访问层
*
* @author makejava
* @since 2024-08-20 14:20:11
*/
public class BdPurorgDaoImpl extends MybatisGenericDao<BdPurorgEntity, String> implements IBdPurorgDao{
}

View File

@ -0,0 +1,178 @@
package com.hzya.frame.plugin.lets.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (BdPurorg)实体类
*
* @author makejava
* @since 2024-08-20 14:20:11
*/
public class BdPurorgEntity extends BaseEntity {
private String code;
private String createdate;
private String def1;
private String def2;
private String def3;
private String def4;
private String def5;
private String dr;
private String memo;
private String mobile;
private String name;
private String officeaddr;
private String ownercorp;
private String pkPurorg;
private String pkResppsn;
private String sealdate;
private String settlestockorg;
private String ts;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getCreatedate() {
return createdate;
}
public void setCreatedate(String createdate) {
this.createdate = createdate;
}
public String getDef1() {
return def1;
}
public void setDef1(String def1) {
this.def1 = def1;
}
public String getDef2() {
return def2;
}
public void setDef2(String def2) {
this.def2 = def2;
}
public String getDef3() {
return def3;
}
public void setDef3(String def3) {
this.def3 = def3;
}
public String getDef4() {
return def4;
}
public void setDef4(String def4) {
this.def4 = def4;
}
public String getDef5() {
return def5;
}
public void setDef5(String def5) {
this.def5 = def5;
}
public String getDr() {
return dr;
}
public void setDr(String dr) {
this.dr = dr;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOfficeaddr() {
return officeaddr;
}
public void setOfficeaddr(String officeaddr) {
this.officeaddr = officeaddr;
}
public String getOwnercorp() {
return ownercorp;
}
public void setOwnercorp(String ownercorp) {
this.ownercorp = ownercorp;
}
public String getPkPurorg() {
return pkPurorg;
}
public void setPkPurorg(String pkPurorg) {
this.pkPurorg = pkPurorg;
}
public String getPkResppsn() {
return pkResppsn;
}
public void setPkResppsn(String pkResppsn) {
this.pkResppsn = pkResppsn;
}
public String getSealdate() {
return sealdate;
}
public void setSealdate(String sealdate) {
this.sealdate = sealdate;
}
public String getSettlestockorg() {
return settlestockorg;
}
public void setSettlestockorg(String settlestockorg) {
this.settlestockorg = settlestockorg;
}
public String getTs() {
return ts;
}
public void setTs(String ts) {
this.ts = ts;
}
}

View File

@ -0,0 +1,307 @@
<?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.lets.dao.impl.BdPurorgDaoImpl">
<resultMap id="get-BdPurorgEntity-result" type="com.hzya.frame.plugin.lets.entity.BdPurorgEntity" >
<result property="code" column="CODE" jdbcType="VARCHAR"/>
<result property="createdate" column="CREATEDATE" jdbcType="VARCHAR"/>
<result property="def1" column="DEF1" jdbcType="VARCHAR"/>
<result property="def2" column="DEF2" jdbcType="VARCHAR"/>
<result property="def3" column="DEF3" jdbcType="VARCHAR"/>
<result property="def4" column="DEF4" jdbcType="VARCHAR"/>
<result property="def5" column="DEF5" jdbcType="VARCHAR"/>
<result property="dr" column="DR" jdbcType="VARCHAR"/>
<result property="memo" column="MEMO" jdbcType="VARCHAR"/>
<result property="mobile" column="MOBILE" jdbcType="VARCHAR"/>
<result property="name" column="NAME" jdbcType="VARCHAR"/>
<result property="officeaddr" column="OFFICEADDR" jdbcType="VARCHAR"/>
<result property="ownercorp" column="OWNERCORP" jdbcType="VARCHAR"/>
<result property="pkPurorg" column="PK_PURORG" jdbcType="VARCHAR"/>
<result property="pkResppsn" column="PK_RESPPSN" jdbcType="VARCHAR"/>
<result property="sealdate" column="SEALDATE" jdbcType="VARCHAR"/>
<result property="settlestockorg" column="SETTLESTOCKORG" jdbcType="VARCHAR"/>
<result property="ts" column="TS" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "BdPurorgEntity_Base_Column_List">
CODE
,CREATEDATE
,DEF1
,DEF2
,DEF3
,DEF4
,DEF5
,DR
,MEMO
,MOBILE
,NAME
,OFFICEADDR
,OWNERCORP
,PK_PURORG
,PK_RESPPSN
,SEALDATE
,SETTLESTOCKORG
,TS
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-BdPurorgEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity">
select
<include refid="BdPurorgEntity_Base_Column_List" />
from BD_PURORG
<trim prefix="where" prefixOverrides="and">
<if test="code != null and code != ''"> and CODE = #{code} </if>
<if test="createdate != null and createdate != ''"> and CREATEDATE = #{createdate} </if>
<if test="def1 != null and def1 != ''"> and DEF1 = #{def1} </if>
<if test="def2 != null and def2 != ''"> and DEF2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> and DEF3 = #{def3} </if>
<if test="def4 != null and def4 != ''"> and DEF4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> and DEF5 = #{def5} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="memo != null and memo != ''"> and MEMO = #{memo} </if>
<if test="mobile != null and mobile != ''"> and MOBILE = #{mobile} </if>
<if test="name != null and name != ''"> and NAME = #{name} </if>
<if test="officeaddr != null and officeaddr != ''"> and OFFICEADDR = #{officeaddr} </if>
<if test="ownercorp != null and ownercorp != ''"> and OWNERCORP = #{ownercorp} </if>
<if test="pkPurorg != null and pkPurorg != ''"> and PK_PURORG = #{pkPurorg} </if>
<if test="pkResppsn != null and pkResppsn != ''"> and PK_RESPPSN = #{pkResppsn} </if>
<if test="sealdate != null and sealdate != ''"> and SEALDATE = #{sealdate} </if>
<if test="settlestockorg != null and settlestockorg != ''"> and SETTLESTOCKORG = #{settlestockorg} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity">
select count(1) from BD_PURORG
<trim prefix="where" prefixOverrides="and">
<if test="code != null and code != ''"> and CODE = #{code} </if>
<if test="createdate != null and createdate != ''"> and CREATEDATE = #{createdate} </if>
<if test="def1 != null and def1 != ''"> and DEF1 = #{def1} </if>
<if test="def2 != null and def2 != ''"> and DEF2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> and DEF3 = #{def3} </if>
<if test="def4 != null and def4 != ''"> and DEF4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> and DEF5 = #{def5} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="memo != null and memo != ''"> and MEMO = #{memo} </if>
<if test="mobile != null and mobile != ''"> and MOBILE = #{mobile} </if>
<if test="name != null and name != ''"> and NAME = #{name} </if>
<if test="officeaddr != null and officeaddr != ''"> and OFFICEADDR = #{officeaddr} </if>
<if test="ownercorp != null and ownercorp != ''"> and OWNERCORP = #{ownercorp} </if>
<if test="pkPurorg != null and pkPurorg != ''"> and PK_PURORG = #{pkPurorg} </if>
<if test="pkResppsn != null and pkResppsn != ''"> and PK_RESPPSN = #{pkResppsn} </if>
<if test="sealdate != null and sealdate != ''"> and SEALDATE = #{sealdate} </if>
<if test="settlestockorg != null and settlestockorg != ''"> and SETTLESTOCKORG = #{settlestockorg} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-BdPurorgEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity">
select
<include refid="BdPurorgEntity_Base_Column_List" />
from BD_PURORG
<trim prefix="where" prefixOverrides="and">
<if test="code != null and code != ''"> and CODE like concat('%',#{code},'%') </if>
<if test="createdate != null and createdate != ''"> and CREATEDATE like concat('%',#{createdate},'%') </if>
<if test="def1 != null and def1 != ''"> and DEF1 like concat('%',#{def1},'%') </if>
<if test="def2 != null and def2 != ''"> and DEF2 like concat('%',#{def2},'%') </if>
<if test="def3 != null and def3 != ''"> and DEF3 like concat('%',#{def3},'%') </if>
<if test="def4 != null and def4 != ''"> and DEF4 like concat('%',#{def4},'%') </if>
<if test="def5 != null and def5 != ''"> and DEF5 like concat('%',#{def5},'%') </if>
<if test="dr != null and dr != ''"> and DR like concat('%',#{dr},'%') </if>
<if test="memo != null and memo != ''"> and MEMO like concat('%',#{memo},'%') </if>
<if test="mobile != null and mobile != ''"> and MOBILE like concat('%',#{mobile},'%') </if>
<if test="name != null and name != ''"> and NAME like concat('%',#{name},'%') </if>
<if test="officeaddr != null and officeaddr != ''"> and OFFICEADDR like concat('%',#{officeaddr},'%') </if>
<if test="ownercorp != null and ownercorp != ''"> and OWNERCORP like concat('%',#{ownercorp},'%') </if>
<if test="pkPurorg != null and pkPurorg != ''"> and PK_PURORG like concat('%',#{pkPurorg},'%') </if>
<if test="pkResppsn != null and pkResppsn != ''"> and PK_RESPPSN like concat('%',#{pkResppsn},'%') </if>
<if test="sealdate != null and sealdate != ''"> and SEALDATE like concat('%',#{sealdate},'%') </if>
<if test="settlestockorg != null and settlestockorg != ''"> and SETTLESTOCKORG like concat('%',#{settlestockorg},'%') </if>
<if test="ts != null and ts != ''"> and TS like concat('%',#{ts},'%') </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="BdPurorgentity_list_or" resultMap="get-BdPurorgEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity">
select
<include refid="BdPurorgEntity_Base_Column_List" />
from BD_PURORG
<trim prefix="where" prefixOverrides="and">
<if test="code != null and code != ''"> or CODE = #{code} </if>
<if test="createdate != null and createdate != ''"> or CREATEDATE = #{createdate} </if>
<if test="def1 != null and def1 != ''"> or DEF1 = #{def1} </if>
<if test="def2 != null and def2 != ''"> or DEF2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> or DEF3 = #{def3} </if>
<if test="def4 != null and def4 != ''"> or DEF4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> or DEF5 = #{def5} </if>
<if test="dr != null and dr != ''"> or DR = #{dr} </if>
<if test="memo != null and memo != ''"> or MEMO = #{memo} </if>
<if test="mobile != null and mobile != ''"> or MOBILE = #{mobile} </if>
<if test="name != null and name != ''"> or NAME = #{name} </if>
<if test="officeaddr != null and officeaddr != ''"> or OFFICEADDR = #{officeaddr} </if>
<if test="ownercorp != null and ownercorp != ''"> or OWNERCORP = #{ownercorp} </if>
<if test="pkPurorg != null and pkPurorg != ''"> or PK_PURORG = #{pkPurorg} </if>
<if test="pkResppsn != null and pkResppsn != ''"> or PK_RESPPSN = #{pkResppsn} </if>
<if test="sealdate != null and sealdate != ''"> or SEALDATE = #{sealdate} </if>
<if test="settlestockorg != null and settlestockorg != ''"> or SETTLESTOCKORG = #{settlestockorg} </if>
<if test="ts != null and ts != ''"> or TS = #{ts} </if>
-- and sts='Y'
</trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity" keyProperty="pkPurorg" useGeneratedKeys="true">
insert into BD_PURORG(
<trim suffix="" suffixOverrides=",">
<if test="code != null and code != ''"> CODE , </if>
<if test="createdate != null and createdate != ''"> CREATEDATE , </if>
<if test="def1 != null and def1 != ''"> DEF1 , </if>
<if test="def2 != null and def2 != ''"> DEF2 , </if>
<if test="def3 != null and def3 != ''"> DEF3 , </if>
<if test="def4 != null and def4 != ''"> DEF4 , </if>
<if test="def5 != null and def5 != ''"> DEF5 , </if>
<if test="dr != null and dr != ''"> DR , </if>
<if test="memo != null and memo != ''"> MEMO , </if>
<if test="mobile != null and mobile != ''"> MOBILE , </if>
<if test="name != null and name != ''"> NAME , </if>
<if test="officeaddr != null and officeaddr != ''"> OFFICEADDR , </if>
<if test="ownercorp != null and ownercorp != ''"> OWNERCORP , </if>
<if test="pkPurorg != null and pkPurorg != ''"> PK_PURORG , </if>
<if test="pkResppsn != null and pkResppsn != ''"> PK_RESPPSN , </if>
<if test="sealdate != null and sealdate != ''"> SEALDATE , </if>
<if test="settlestockorg != null and settlestockorg != ''"> SETTLESTOCKORG , </if>
<if test="ts != null and ts != ''"> TS , </if>
<if test="sorts == null ">sorts,</if>
<!-- <if test="sts == null ">sts,</if>-->
</trim>
)values(
<trim suffix="" suffixOverrides=",">
<if test="code != null and code != ''"> #{code} ,</if>
<if test="createdate != null and createdate != ''"> #{createdate} ,</if>
<if test="def1 != null and def1 != ''"> #{def1} ,</if>
<if test="def2 != null and def2 != ''"> #{def2} ,</if>
<if test="def3 != null and def3 != ''"> #{def3} ,</if>
<if test="def4 != null and def4 != ''"> #{def4} ,</if>
<if test="def5 != null and def5 != ''"> #{def5} ,</if>
<if test="dr != null and dr != ''"> #{dr} ,</if>
<if test="memo != null and memo != ''"> #{memo} ,</if>
<if test="mobile != null and mobile != ''"> #{mobile} ,</if>
<if test="name != null and name != ''"> #{name} ,</if>
<if test="officeaddr != null and officeaddr != ''"> #{officeaddr} ,</if>
<if test="ownercorp != null and ownercorp != ''"> #{ownercorp} ,</if>
<if test="pkPurorg != null and pkPurorg != ''"> #{pkPurorg} ,</if>
<if test="pkResppsn != null and pkResppsn != ''"> #{pkResppsn} ,</if>
<if test="sealdate != null and sealdate != ''"> #{sealdate} ,</if>
<if test="settlestockorg != null and settlestockorg != ''"> #{settlestockorg} ,</if>
<if test="ts != null and ts != ''"> #{ts} ,</if>
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from BD_PURORG a WHERE a.sts = 'Y' ),</if>
-- <if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="pkPurorg" useGeneratedKeys="true">
insert into BD_PURORG(CODE, CREATEDATE, DEF1, DEF2, DEF3, DEF4, DEF5, DR, MEMO, MOBILE, NAME, OFFICEADDR, OWNERCORP, PK_RESPPSN, SEALDATE, SETTLESTOCKORG, TS)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.code},#{entity.createdate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.dr},#{entity.memo},#{entity.mobile},#{entity.name},#{entity.officeaddr},#{entity.ownercorp},#{entity.pkResppsn},#{entity.sealdate},#{entity.settlestockorg},#{entity.ts})
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="pkPurorg" useGeneratedKeys="true">
insert into BD_PURORG(CODE, CREATEDATE, DEF1, DEF2, DEF3, DEF4, DEF5, DR, MEMO, MOBILE, NAME, OFFICEADDR, OWNERCORP, PK_RESPPSN, SEALDATE, SETTLESTOCKORG, TS)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.code},#{entity.createdate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.dr},#{entity.memo},#{entity.mobile},#{entity.name},#{entity.officeaddr},#{entity.ownercorp},#{entity.pkResppsn},#{entity.sealdate},#{entity.settlestockorg},#{entity.ts})
</foreach>
on duplicate key update
CODE = values(CODE),
CREATEDATE = values(CREATEDATE),
DEF1 = values(DEF1),
DEF2 = values(DEF2),
DEF3 = values(DEF3),
DEF4 = values(DEF4),
DEF5 = values(DEF5),
DR = values(DR),
MEMO = values(MEMO),
MOBILE = values(MOBILE),
NAME = values(NAME),
OFFICEADDR = values(OFFICEADDR),
OWNERCORP = values(OWNERCORP),
PK_RESPPSN = values(PK_RESPPSN),
SEALDATE = values(SEALDATE),
SETTLESTOCKORG = values(SETTLESTOCKORG),
TS = values(TS)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity" >
update BD_PURORG set
<trim suffix="" suffixOverrides=",">
<if test="code != null and code != ''"> CODE = #{code},</if>
<if test="createdate != null and createdate != ''"> CREATEDATE = #{createdate},</if>
<if test="def1 != null and def1 != ''"> DEF1 = #{def1},</if>
<if test="def2 != null and def2 != ''"> DEF2 = #{def2},</if>
<if test="def3 != null and def3 != ''"> DEF3 = #{def3},</if>
<if test="def4 != null and def4 != ''"> DEF4 = #{def4},</if>
<if test="def5 != null and def5 != ''"> DEF5 = #{def5},</if>
<if test="dr != null and dr != ''"> DR = #{dr},</if>
<if test="memo != null and memo != ''"> MEMO = #{memo},</if>
<if test="mobile != null and mobile != ''"> MOBILE = #{mobile},</if>
<if test="name != null and name != ''"> NAME = #{name},</if>
<if test="officeaddr != null and officeaddr != ''"> OFFICEADDR = #{officeaddr},</if>
<if test="ownercorp != null and ownercorp != ''"> OWNERCORP = #{ownercorp},</if>
<if test="pkResppsn != null and pkResppsn != ''"> PK_RESPPSN = #{pkResppsn},</if>
<if test="sealdate != null and sealdate != ''"> SEALDATE = #{sealdate},</if>
<if test="settlestockorg != null and settlestockorg != ''"> SETTLESTOCKORG = #{settlestockorg},</if>
<if test="ts != null and ts != ''"> TS = #{ts},</if>
</trim>
where PK_PURORG = #{pkPurorg}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity" >
update BD_PURORG set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where PK_PURORG = #{pkPurorg}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.BdPurorgEntity" >
update BD_PURORG set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="code != null and code != ''"> and CODE = #{code} </if>
<if test="createdate != null and createdate != ''"> and CREATEDATE = #{createdate} </if>
<if test="def1 != null and def1 != ''"> and DEF1 = #{def1} </if>
<if test="def2 != null and def2 != ''"> and DEF2 = #{def2} </if>
<if test="def3 != null and def3 != ''"> and DEF3 = #{def3} </if>
<if test="def4 != null and def4 != ''"> and DEF4 = #{def4} </if>
<if test="def5 != null and def5 != ''"> and DEF5 = #{def5} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="memo != null and memo != ''"> and MEMO = #{memo} </if>
<if test="mobile != null and mobile != ''"> and MOBILE = #{mobile} </if>
<if test="name != null and name != ''"> and NAME = #{name} </if>
<if test="officeaddr != null and officeaddr != ''"> and OFFICEADDR = #{officeaddr} </if>
<if test="ownercorp != null and ownercorp != ''"> and OWNERCORP = #{ownercorp} </if>
<if test="pkPurorg != null and pkPurorg != ''"> and PK_PURORG = #{pkPurorg} </if>
<if test="pkResppsn != null and pkResppsn != ''"> and PK_RESPPSN = #{pkResppsn} </if>
<if test="sealdate != null and sealdate != ''"> and SEALDATE = #{sealdate} </if>
<if test="settlestockorg != null and settlestockorg != ''"> and SETTLESTOCKORG = #{settlestockorg} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
and sts='Y'
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from BD_PURORG where PK_PURORG = #{pkPurorg}
</delete>
</mapper>

View File

@ -0,0 +1,505 @@
package com.hzya.frame.plugin.lets.plugin.purchase;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.beanutil.BeanUtil;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderChildrenDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderParentChildrenDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderParentDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderSonDto;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 代理品牌采购退货业务代理品牌采购退货OFS销退出库单生成U8C红字采购订单
*
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
* @ProjectkangarooDataCenterV3
* @nameProxyPurchase
* @Date2024/8/19 18:01
* @FilenameProxyPurchase
*/
public class ProxyPurchaseReturn extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ProxyPurchaseReturn.class);
@Autowired
private OfsUnifiedService ofsUnifiedService;
@Autowired
private QueryBdBusitypeUtil queryBdBusitypeUtil;
@Autowired
private IBdCorpDao iBdCorpDao;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
@Autowired
private IBdPurorgDao iBdPurorgDao;
@Autowired
private IBdCubasdocDao iBdCubasdocDao;
@Autowired
private IBdCumandocDao iBdCumandocDao;
@Autowired
private IBdInvmandocDao iBdInvmandocDao;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseReturn";
}
@Override
public String getPluginName() {
return "OFS销退出库单生成U8C红字采购订单(代理品牌采购退货)";
}
@Override
public String getPluginLabel() {
return "OFS销退出库单生成U8C红字采购订单(代理品牌采购退货)";
}
@Override
public String getPluginType() {
return "3";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
return null;
}
/**
* 根据单号查询
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
/**
* 查询OFS售后退货入库单
*
* @param queryOfsSoSaleOutVo 查询参数
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.shipment.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
ofsUnifiedService.unified(interfaceParamDto);
}
/**
* 环境预配置
*
* @param returnGoodHeaderDetailsDataDtoArrayList 采购入库单
* @author liuyang
*/
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implement(stockinOrderList);
}
/**
* 过滤掉成功的数据
*
* @author liuyang
*/
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求
headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList);
}
return headerDetailsDtoList1;
}
/**
* 执行主逻辑
*
* @author liuyang
*/
private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try {
// 查询基本档案
List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList);
// 代理品牌采购业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) {
for (int i = 0; i < poOrderSonDtos.size(); i++) {
PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i);
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = poOrderSonDto.getDetails();
//生成业务日期
String generateBusinessDate = createGenerateBusinessDate(poOrderSonDto);
BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司收货公司
BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门
BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织
BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();
BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商档案-供应商
OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单
OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader();
List<OfsPoOrderDetails> ofsPoOrderDataDetails = ofsPoOrderData.getDetails();
//采购订单表头
PoOrderParentDto poOrderParentDto = new PoOrderParentDto();
poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程
poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人
poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织
poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司
poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案
poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期
poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期
poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期
//采购订单明细行
List<PoOrderChildrenDto> poOrderChildrenDtoList = new ArrayList<>();
for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
//2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp());
String receivedQty = stockinB.getReceivedQty();//实收数量
//原币含税单价
try {
// noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
logger.error("计算采购入库单原币含税单价失败", e);
Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage());
}
PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto();
poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id
poOrderChildrenDto.setNordernum(receivedQty);//订货数量
// poOrderChildrenDto.setNorgtaxprice();//原币含税单价
// poOrderChildrenDto.setPk_arrvcorp();//收货公司
// poOrderChildrenDto.setPk_arrvstoorg();//收货库存组织
// poOrderChildrenDto.setCwarehouseid();//收货仓库
poOrderChildrenDtoList.add(poOrderChildrenDto);
//2024年8月20日 16:00:03 已经和佳妮总确认计划到货日期不用进行传递
}
PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto();
poOrderParentChildrenDto.setParentvo(poOrderParentDto);
poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList);
}
} else {
logger.info("poOrderSonDto.size为0");
}
} catch (Exception e) {
logger.error("implement方法抛出异常", e);
}
}
}
/**
* 档案转换
*
* @author liuyang
*/
private List<PoOrderSonDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) {
List<PoOrderSonDto> poOrderSonDtoArrayList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try {
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
//采购公司
String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O表头公司不能为空");
BdCorpEntity bdCorpEntity = new BdCorpEntity();
bdCorpEntity.setDr(0);
bdCorpEntity.setDataSourceCode("lets_u8c");
bdCorpEntity.setUnitcode(companyCode);
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
if (bdCorpEntityList.size() == 0) {
Assert.state(false, "根据O货主编码{}无法匹配到U8C销售公司", companyCode);
} else if (bdCorpEntityList.size() >= 2) {
Assert.state(false, "根据O货主编码{}匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size());
}
//采购部门其他
String deptName = "其他部门";
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c");
bdDeptdocEntity.setDr(0);
bdDeptdocEntity.setDeptname(deptName);
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdDeptdocEntity> bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
if (bdDeptdocEntityList.size() == 0) {
Assert.state(false, "根据部门名称:{} 公司id{}无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp());
} else if (bdDeptdocEntityList.size() >= 2) {
Assert.state(false, "根据部门名称:{} 公司id{}匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp());
}
//采购组织
BdPurorgEntity bdPurorgEntity = new BdPurorgEntity();
bdPurorgEntity.setDr("0");
bdPurorgEntity.setDataSourceCode("lets_u8c");
bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp());
List<BdPurorgEntity> bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity);
if (bdPurorgEntityList.size() == 0) {
Assert.state(false, "根据采购公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp());
} else if (bdPurorgEntityList.size() >= 2) {
Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp());
}
//客商基本档案(供应商类型)
//2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商
//其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝
String shipFromCode = header.getShipFromCode();
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
bdCubasdocEntity.setDataSourceCode("lets_u8c");
bdCubasdocEntity.setDr(0L);
bdCubasdocEntity.setDef1(shipFromCode);
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
Assert.state(false, "根据OFS供应商业务编码{}无法查询到U8C客商档案信息(供应商)", shipFromCode);
} else if (bdCubasdocEntityList.size() >= 2) {
Assert.state(false, "根据OFS供应商业务编码{}查询到多个U8C客商档案信息(供应商)", shipFromCode);
}
//客商管理档案
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
bdCumandocEntity1.setDataSourceCode("lets_u8c");
bdCumandocEntity1.setDr(0L);
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER);
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
} else if (bdCumandocEntityList.size() >= 2) {
Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
}
//查询OFS采购订单
OfsPoOrderData ofsPoOrderData = queryOfsPoOrder(header.getRefOrderCode());
PoOrderSonDto poOrderSonDto = new PoOrderSonDto();
poOrderSonDto.setBdCorpEntity(bdCorpEntityList.get(0));
poOrderSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
poOrderSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0));
poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
poOrderSonDto.setOfsPoOrderData(ofsPoOrderData);
BeanUtil.copyPropertiesV2(poOrderSonDto, header);
poOrderSonDtoArrayList.add(poOrderSonDto);
}
//成功
} catch (Exception e) {
logger.error("代理品牌采购入库单档案转换失败", e);
//失败
}
} else {
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
}
return poOrderSonDtoArrayList;
}
/**
* 2024年8月6日 10:59:03 查询U8C业务流程
*
* @author liuyang
*/
private BdBusitypeEntity u8cOperationFlow() throws Exception {
//查询业务流程
//2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供
String processName = "代理品牌采购";
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
return bdBusitypeEntity;
}
/**
* 2024年8月20日 15:46:10
* 生成业务日期以发货时间作为业务日期
*
* @author liuyang
*/
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) {
String shipAt = poOrderSonDto.getShipAt();
String businessFormat = null;
try {
Date dbill = DateUtil.parse(shipAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("业务日期生成失败", e);
}
return businessFormat;
} else {
logger.error("生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(poOrderSonDto));
Assert.state(false, "生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(poOrderSonDto));
return null;
}
}
/**
* 查询存货管理档案
*
* @param pkCorp 发货公司主键
* @param stockinB 采购入库单明细行
* @author liuyang
*/
private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception {
Assert.notNull(stockinB, "sonDetailsDto不能为空");
Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空");
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
bdInvmandocEntity.setInvcode(stockinB.getSkuCode());
bdInvmandocEntity.setPkCorp(pkCorp);
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
if (bdInvmandocEntity2.size() == 0) {
Assert.state(false, "根据O商家编码{} U8C发货公司主键{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp);
} else if (bdInvmandocEntity2.size() >= 2) {
Assert.state(false, "根据O商家编码{} U8C发货公司主键{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp);
}
return bdInvmandocEntity2.get(0);
}
/**
* 2024年8月20日 16:11:46
*
* @author liuyang
*/
public OfsPoOrderData queryOfsPoOrder(String code) throws Exception {
if (code != null && !"".equals(code)) {
Long pageSize = 200L;
Long pageNo = 1L;
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
queryOfsSoSaleOutVo.setCode(code);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.purchaseOrder.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
OfsPoOrderBean ofsPoOrderBean = (OfsPoOrderBean) ofsUnifiedService.unified(interfaceParamDto);
if (ofsPoOrderBean != null) {
if ("false".equals(ofsPoOrderBean.getError()) && "0".equals(ofsPoOrderBean.getCode()) && "Success".equals(ofsPoOrderBean.getMsg())) {
List<OfsPoOrderData> data = ofsPoOrderBean.getData();
if (data != null && data.size() > 0) {
return data.get(0);
}
} else {
logger.error("查询采购订单失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("ofsPoOrderBean为空interfaceParamDto接口入参{}", JSON.toJSON(interfaceParamDto));
}
} else {
Assert.state(false, "采购订单编码不能为空!");
}
return null;
}
/**
* 2024年8月20日 16:42:14
* 查找对应的采购订单明细行
* 2024年8月20日 17:42:15
* 应该通过明细行主键匹配但是只能根据sku匹配目前的实现逻辑
*
* @param ofsPoOrderDataDetails OFS采购订单明细行所有对象
* @param stockinB OFS采购入库单明细行对象
* @author liuyang
*/
private void findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) {
if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) {
}
}
}

View File

@ -1,115 +1,631 @@
//package com.hzya.frame.plugin.lets.plugin.purchase;
//
//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.hzya.frame.base.PluginBaseEntity;
//import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
//import com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB;
//import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
//import com.hzya.frame.plugin.lets.util.DateStrUtil;
//import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
//import com.hzya.frame.web.entity.JsonResultEntity;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购订单
// *
// * @Authorliuyang
// * @Packagecom.hzya.frame.plugin.lets.plugin.purchase
// * @ProjectkangarooDataCenterV3
// * @nameProxyPurchase
// * @Date2024/8/19 18:01
// * @FilenameProxyPurchase
// */
//public class ProxyPurchaseWarehous extends PluginBaseEntity {
//
// Logger logger = LoggerFactory.getLogger(ProxyPurchaseWarehous.class);
//
// @Override
// public void initialize() {
// logger.info(getPluginLabel() + "執行初始化方法initialize()");
// }
//
// @Override
// public void destroy() {
// logger.info(getPluginLabel() + "執行銷毀方法destroy()");
// }
//
// @Override
// public String getPluginId() {
// return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous";
// }
//
// @Override
// public String getPluginName() {
// return "OFS采购入库单生成U8C采购订单(代理品牌)";
// }
//
// @Override
// public String getPluginLabel() {
// return "OFS采购入库单生成U8C采购订单(代理品牌)";
// }
//
// @Override
// public String getPluginType() {
// return "3";
// }
//
// @Override
// public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
// return null;
// }
//
// /**
// * 根据指定时间范围拉取
// *
// * @author liuyang
// */
// public void startImplement(String startTime, String endTime) {
// String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", dateStr, summaryOrderNumber);
// logger.info(threadNameStr);
//
// Thread thread = new Thread(new Runnable() {
// @Override
// public void run() {
// try {
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
// String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
//
// List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
// queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
// queryOfsSoSaleOutVo.setClientCode("LETS");
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
// queryOfsSoSaleOutVo.setStatus(900L);
// queryOfsSoSaleOutVo.setPageNo(1L);
// queryOfsSoSaleOutVo.setPageSize(50L);
// queryOfsSoSaleOutVo.setStoreCode(tobShop);
//// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
// queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
// logger.info("数据返回行数:{}", headerDetailsDtoList.size());
// if (headerDetailsDtoList.size() > 0) {
// getSet(headerDetailsDtoList);
// } else {
// logger.info("没有查询到任何数据!不需要同步");
// }
// } catch (Exception e) {
// logger.error("startImplement方法抛出异常", e);
// }
// }
// }, threadNameStr);
// thread.start();
// try {
// thread.join();
// } catch (Exception e) {
// logger.error("thread.join()异常", e);
// }
// }
//
//}
package com.hzya.frame.plugin.lets.plugin.purchase;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.beanutil.BeanUtil;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.*;
/**
* 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购订单
*
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
* @ProjectkangarooDataCenterV3
* @nameProxyPurchase
* @Date2024/8/19 18:01
* @FilenameProxyPurchase
*/
public class ProxyPurchaseWarehous extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ProxyPurchaseWarehous.class);
@Autowired
private OfsUnifiedService ofsUnifiedService;
@Autowired
private QueryBdBusitypeUtil queryBdBusitypeUtil;
@Autowired
private IBdCorpDao iBdCorpDao;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
@Autowired
private IBdPurorgDao iBdPurorgDao;
@Autowired
private IBdCubasdocDao iBdCubasdocDao;
@Autowired
private IBdCumandocDao iBdCumandocDao;
@Autowired
private IBdInvmandocDao iBdInvmandocDao;
@Autowired
private IBdCalbodyDao iBdCalbodyDao;
@Autowired
private IBdStordocDao iBdStordocDao;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous";
}
@Override
public String getPluginName() {
return "OFS采购入库单生成U8C采购订单(代理品牌)";
}
@Override
public String getPluginLabel() {
return "OFS采购入库单生成U8C采购订单(代理品牌)";
}
@Override
public String getPluginType() {
return "3";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
return null;
}
/**
* 根据单号查询
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
/**
* 查询OFS售后退货入库单
*
* @param queryOfsSoSaleOutVo 查询参数
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = rertunGoodsRootBean.getData();
if (stockinOrderList != null && stockinOrderList.size() > 0) {
headerDetailsDtoList.addAll(stockinOrderList);
//TODO OFS没有提供分页字段等待开发
}
} else {
logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
}
}
/**
* 环境预配置
*
* @param returnGoodHeaderDetailsDataDtoArrayList 采购入库单
* @author liuyang
*/
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implement(stockinOrderList);
}
/**
* 过滤掉成功的数据
*
* @author liuyang
*/
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求
headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList);
}
return headerDetailsDtoList1;
}
/**
* 执行主逻辑
*
* @author liuyang
*/
private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try {
// 查询基本档案
List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList);
// 代理品牌采购业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) {
for (int i = 0; i < poOrderSonDtos.size(); i++) {
PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i);
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = poOrderSonDto.getDetails();
//生成业务日期
String generateBusinessDate = createGenerateBusinessDate(poOrderSonDto);
BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司收货公司
BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门
BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织
BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();
BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商档案-供应商
BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织
BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库
OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单
OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader();
List<OfsPoOrderDetails> ofsPoOrderDataDetails = ofsPoOrderData.getDetails();
//采购订单表头
PoOrderParentDto poOrderParentDto = new PoOrderParentDto();
poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程
poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门
poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人
poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织
poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司
poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案
poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期
poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期
poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期
//采购订单明细行
List<PoOrderChildrenDto> poOrderChildrenDtoList = new ArrayList<>();
for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB);
//2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp());
String receivedQty = stockinB.getReceivedQty();//实收数量
String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实收累计总金额
//原币含税单价
BigDecimal noriginalcurprice = null;
try {
noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
logger.error("计算采购入库单原币含税单价失败", e);
Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage());
}
PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto();
poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id
poOrderChildrenDto.setNordernum(receivedQty);//订货数量
poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价
poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司
poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织
poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库
poOrderChildrenDtoList.add(poOrderChildrenDto);
//2024年8月20日 16:00:03 已经和佳妮总确认计划到货日期不用进行传递
}
List<PoOrderParentChildrenDto> poOrderParentChildrenDtoList = new ArrayList<>();
PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto();
poOrderParentChildrenDto.setParentvo(poOrderParentDto);
poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList);
poOrderParentChildrenDtoList.add(poOrderParentChildrenDto);
Map<String, List<PoOrderParentChildrenDto>> stringStringMap = new HashMap<>();
stringStringMap.put("puordervo", poOrderParentChildrenDtoList);
sendU8CPoOrder(JSON.toJSONString(stringStringMap));
logger.info("推送U8C代理品牌采购订单采购采购订单主键{} 采购订单编码:{}", null, null);
}
} else {
logger.info("poOrderSonDto.size为0");
}
} catch (Exception e) {
logger.error("implement方法抛出异常", e);
}
}
}
/**
* 档案转换
*
* @author liuyang
*/
private List<PoOrderSonDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) {
List<PoOrderSonDto> poOrderSonDtoArrayList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try {
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
//采购公司
String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O表头公司不能为空");
BdCorpEntity bdCorpEntity = new BdCorpEntity();
bdCorpEntity.setDr(0);
bdCorpEntity.setDataSourceCode("lets_u8c");
bdCorpEntity.setUnitcode(companyCode);
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
if (bdCorpEntityList.size() == 0) {
Assert.state(false, "根据O货主编码{}无法匹配到U8C销售公司", companyCode);
} else if (bdCorpEntityList.size() >= 2) {
Assert.state(false, "根据O货主编码{}匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size());
}
//采购部门其他
String deptName = "其他部门";
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
bdDeptdocEntity.setDataSourceCode("lets_u8c");
bdDeptdocEntity.setDr(0);
bdDeptdocEntity.setDeptname(deptName);
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdDeptdocEntity> bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
if (bdDeptdocEntityList.size() == 0) {
Assert.state(false, "根据部门名称:{} 公司id{}无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp());
} else if (bdDeptdocEntityList.size() >= 2) {
Assert.state(false, "根据部门名称:{} 公司id{}匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp());
}
//采购组织
BdPurorgEntity bdPurorgEntity = new BdPurorgEntity();
bdPurorgEntity.setDr("0");
bdPurorgEntity.setDataSourceCode("lets_u8c");
bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp());
List<BdPurorgEntity> bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity);
if (bdPurorgEntityList.size() == 0) {
Assert.state(false, "根据采购公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp());
} else if (bdPurorgEntityList.size() >= 2) {
Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp());
}
//客商基本档案(供应商类型)
//2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商
//其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝
String shipFromCode = header.getShipFromCode();
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
bdCubasdocEntity.setDataSourceCode("lets_u8c");
bdCubasdocEntity.setDr(0L);
bdCubasdocEntity.setDef1(shipFromCode);
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
Assert.state(false, "根据OFS供应商业务编码{}无法查询到U8C客商档案信息(供应商)", shipFromCode);
} else if (bdCubasdocEntityList.size() >= 2) {
Assert.state(false, "根据OFS供应商业务编码{}查询到多个U8C客商档案信息(供应商)", shipFromCode);
}
//客商管理档案
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
bdCumandocEntity1.setDataSourceCode("lets_u8c");
bdCumandocEntity1.setDr(0L);
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER);
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
} else if (bdCumandocEntityList.size() >= 2) {
Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
}
// 2024年8月20日 23:51:56 收货库存组织应该是通过收货公司查询得出收货库存组织目前收货公司和采购公司保持一致那么就以采购公司带出这个逻辑已经和佳妮确认
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
bdCalbodyEntity.setDr(0);
bdCalbodyEntity.setDataSourceCode("lets_u8c");
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
if (bdCalbodyEntities.size() == 0) {
Assert.state(false, "根据U8C采购公司{}无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
} else if (bdCalbodyEntities.size() >= 2) {
Assert.state(false, "根据U8C采购公司{}匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
}
//收货仓库
String facilityCode = header.getFacilityCode();
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
BdStordocEntity bdStordocEntity = new BdStordocEntity();
bdStordocEntity.setDr(0L);
bdStordocEntity.setDataSourceCode("lets_u8c");
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
bdStordocEntity.setStorcode(facilityCode);
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
if (bdStordocEntityList.size() == 0) {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
} else if (bdStordocEntityList.size() >= 2) {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
}
//查询OFS采购订单
OfsPoOrderData ofsPoOrderData = queryOfsPoOrder(header.getRefOrderCode());
PoOrderSonDto poOrderSonDto = new PoOrderSonDto();
poOrderSonDto.setBdCorpEntity(bdCorpEntityList.get(0));
poOrderSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0));
poOrderSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0));
poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
poOrderSonDto.setOfsPoOrderData(ofsPoOrderData);
poOrderSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
poOrderSonDto.setBdStordocEntity(bdStordocEntityList.get(0));
BeanUtil.copyPropertiesV2(poOrderSonDto, header);
poOrderSonDtoArrayList.add(poOrderSonDto);
}
//成功
} catch (Exception e) {
logger.error("代理品牌采购入库单档案转换失败", e);
//失败
}
} else {
logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0");
}
return poOrderSonDtoArrayList;
}
/**
* 2024年8月6日 10:59:03 查询U8C业务流程
*
* @author liuyang
*/
private BdBusitypeEntity u8cOperationFlow() throws Exception {
//查询业务流程
//2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供
String processName = "代理品牌采购";
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
return bdBusitypeEntity;
}
/**
* 2024年8月20日 15:46:10
* 生成业务日期以发货时间作为业务日期
*
* @author liuyang
*/
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) {
String shipAt = poOrderSonDto.getShipAt();
String businessFormat = null;
try {
Date dbill = DateUtil.parse(shipAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("业务日期生成失败", e);
}
return businessFormat;
} else {
logger.error("生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(poOrderSonDto));
Assert.state(false, "生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(poOrderSonDto));
return null;
}
}
/**
* 查询存货管理档案
*
* @param pkCorp 发货公司主键
* @param stockinB 采购入库单明细行
* @author liuyang
*/
private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception {
Assert.notNull(stockinB, "sonDetailsDto不能为空");
Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空");
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
bdInvmandocEntity.setInvcode(stockinB.getSkuCode());
bdInvmandocEntity.setPkCorp(pkCorp);
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
if (bdInvmandocEntity2.size() == 0) {
Assert.state(false, "根据O商家编码{} U8C发货公司主键{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp);
} else if (bdInvmandocEntity2.size() >= 2) {
Assert.state(false, "根据O商家编码{} U8C发货公司主键{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp);
}
return bdInvmandocEntity2.get(0);
}
/**
* 2024年8月20日 16:11:46
*
* @author liuyang
*/
public OfsPoOrderData queryOfsPoOrder(String code) throws Exception {
if (code != null && !"".equals(code)) {
Long pageSize = 200L;
Long pageNo = 1L;
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
queryOfsSoSaleOutVo.setCode(code);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.purchaseOrder.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
OfsPoOrderBean ofsPoOrderBean = (OfsPoOrderBean) ofsUnifiedService.unified(interfaceParamDto);
if (ofsPoOrderBean != null) {
if ("false".equals(ofsPoOrderBean.getError()) && "0".equals(ofsPoOrderBean.getCode()) && "Success".equals(ofsPoOrderBean.getMsg())) {
List<OfsPoOrderData> data = ofsPoOrderBean.getData();
if (data != null && data.size() > 0) {
return data.get(0);
}
} else {
logger.error("查询采购订单失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("ofsPoOrderBean为空interfaceParamDto接口入参{}", JSON.toJSON(interfaceParamDto));
}
} else {
Assert.state(false, "采购订单编码不能为空!");
}
return null;
}
/**
* 2024年8月20日 16:42:14
* 查找对应的采购订单明细行
* 2024年8月20日 17:42:15
* 应该通过明细行主键匹配但是只能根据sku匹配目前的实现逻辑
* 查找OFS采购订单明细行主要是为了带出实付金额通过实付金额/实收数量=含税单价
*
* @param ofsPoOrderDataDetails OFS采购订单明细行所有对象
* @param stockinB OFS采购入库单明细行对象
* @author liuyang
*/
private OfsPoOrderDetails findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) {
if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) {
//TODO 2024年8月20日 23:33:11 先使用sku验证然后O接口更新明细id使用明细id匹配
// 2024年8月20日 23:36:04 使用sku匹配在某种角度来说是错误的
for (int i = 0; i < ofsPoOrderDataDetails.size(); i++) {
if (ofsPoOrderDataDetails.get(i).getSkuCode().equals(stockinB.getSkuCode())) {
return ofsPoOrderDataDetails.get(0);
}
}
} else {
logger.error("findOfsPoOrderDetail方法对应的ofsPoOrderDataDetails不能为空否则业务目标无法完成");
}
Assert.state(false, "无法匹配到采购订单明细行业务逻辑无法完成根据sku编码{}查找,但是在采购订单中无法匹配!", stockinB.getSkuCode());
return null;
}
/**
* 2024年8月20日 23:58:13
* 推送U8C采购订单
*
* @author liuyang
*/
public SoSaleResultRootDto sendU8CPoOrder(String param) throws Exception {
long startLong = System.currentTimeMillis();
logger.info("代理品牌采购推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL);
String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息多个头信息多次调用此方法即可
.header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370004")//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(param)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
logger.info("代理品牌采购推送结束,返回参数:" + result);
long endLong = System.currentTimeMillis();
logger.info("U8C采购订单接口请求耗时" + (endLong - startLong));
JSONObject jsonObject = JSON.parseObject(result);
result = String.valueOf(jsonObject.get("attribute"));
boolean isSuccess = false;
SoSaleResultRootDto soSaleResultRootDto = null;
if (result != null && !"".equals(result)) {
ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
soSaleResultRootDto = resultDataHandle(reusltStrDto.getData());
isSuccess = true;
}
}
if (!isSuccess) {
Assert.state(false, "代理品牌采购业务推送U8C采购订单失败 接口返回结果:{}", result);
}
return soSaleResultRootDto;
}
/**
* 返回结果解析处理在确认了success后调用
*
* @author liuyang
*/
private SoSaleResultRootDto resultDataHandle(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
resultData = resultData.substring(1, resultData.length() - 1);
}
return JSON.parseObject(resultData, SoSaleResultRootDto.class);
}
} catch (Exception e) {
e.printStackTrace();
logger.error("解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}
return null;
}
}

View File

@ -113,10 +113,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private IBdSalestruDao iBdSalestruDao;
@Autowired
private IBdCumandocDao iBdCumandocDao;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
@ -189,8 +189,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
*
* @author liuyang
*/
public void startImplement(String date) {
String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", date);
public void startImplement(String code) {
String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@ -203,11 +203,11 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setStatus(900L);
// queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(date);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
logger.info("根据根据号拉群:数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
@ -670,6 +670,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
bdCumandocEntity1.setDr(0L);
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());

View File

@ -160,6 +160,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
@ -208,6 +209,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {

View File

@ -136,6 +136,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
@ -189,6 +190,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) {

View File

@ -0,0 +1,103 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @namePoOrderHaderDto
* @Date2024/8/20 15:17
* @FilenamePoOrderHaderDto
*/
@Data
public class PoOrderChildrenDto {
private String blargess;
private String cassistunit;
private String cbaseid;
private String ccurrencytypeid;
private String cmangid;
private String coperator;
private String corder_bid;
private String corderid;
private String cprojectid;
private String crowno;
private String csourcebillid;
private String csourcebilltype;
private String csourcerowid;
private String cupsourcebillid;
private String cupsourcebillrowid;
private String cupsourcebilltype;
private String cusedeptid;
private String cwarehouseid;
private String dplanarrvdate;
private String forderrowstatus;
private String idiscounttaxtype;
private String nassistnum;
private String ndiscountrate;
private String nexchangeotobrate;
private String nmoney;
private String nordernum;
private String norgnettaxprice;
private String norgtaxprice;
private String noriginalcurmny;
private String noriginalcurprice;
private String noriginalnetprice;
private String noriginaltaxmny;
private String noriginaltaxpricemny;
private String ntaxmny;
private String ntaxpricemny;
private String ntaxrate;
private String pk_arrvcorp;
private String pk_arrvstoorg;
private String pk_corp;
private String pk_defdoc1;
private String pk_defdoc10;
private String pk_defdoc11;
private String pk_defdoc12;
private String pk_defdoc13;
private String pk_defdoc14;
private String pk_defdoc15;
private String pk_defdoc16;
private String pk_defdoc17;
private String pk_defdoc18;
private String pk_defdoc19;
private String pk_defdoc2;
private String pk_defdoc20;
private String pk_defdoc3;
private String pk_defdoc4;
private String pk_defdoc5;
private String pk_defdoc6;
private String pk_defdoc7;
private String pk_defdoc8;
private String pk_defdoc9;
private String pk_invoicecorp;
private String vdef1;
private String vdef10;
private String vdef11;
private String vdef12;
private String vdef13;
private String vdef14;
private String vdef15;
private String vdef16;
private String vdef17;
private String vdef18;
private String vdef19;
private String vdef2;
private String vdef20;
private String vdef3;
private String vdef4;
private String vdef5;
private String vdef6;
private String vdef7;
private String vdef8;
private String vdef9;
private String vfree1;
private String vfree2;
private String vfree3;
private String vfree4;
private String vfree5;
private String vmemo;
private String vostatus;
private String vproducenum;
}

View File

@ -0,0 +1,21 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
import java.util.List;
/**
* U8C采购订单保存接口入参实体类
*
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @namePoOrderHaderDto
* @Date2024/8/20 15:17
* @FilenamePoOrderHaderDto
*/
@Data
public class PoOrderParentChildrenDto {
private PoOrderParentDto parentvo;
private List<PoOrderChildrenDto> childrenvo;
}

View File

@ -0,0 +1,94 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @namePoOrderHaderDto
* @Date2024/8/20 15:17
* @FilenamePoOrderHaderDto
*/
@Data
public class PoOrderParentDto {
private String bcooptoso;
private String bislatest;
private String bisreplenish;
private String bpubtoec;
private String breturn;
private String bsocooptome;
private String caccountbankid;
private String caccountyear;
private String cauditpsn;
private String cbiztype;
private String ccontracttextpath;
private String ccurrencytypeid;
private String cdeliveraddress;
private String cdeptid;
private String cemployeeid;
private String cfreecustid;
private String cgiveinvoicevendo;
private String coperator;
private String corderid;
private String cpubpsn;
private String cpurorganization;
private String creciever;
private String cresppsn;
private String crevisepsn;
private String ctermprotocolid;
private String ctransmodeid;
private String cunfreeze;
private String cvendormangid;
private String dauditdate;
private String dorderdate;
private String drevisiondate;
private String forderstatus;
private String isSaveWhenOverSto;
private String nexchangeotobrate;
private String pk_corp;
private String pk_defdoc1;
private String pk_defdoc10;
private String pk_defdoc11;
private String pk_defdoc12;
private String pk_defdoc13;
private String pk_defdoc14;
private String pk_defdoc15;
private String pk_defdoc16;
private String pk_defdoc17;
private String pk_defdoc18;
private String pk_defdoc19;
private String pk_defdoc2;
private String pk_defdoc20;
private String pk_defdoc3;
private String pk_defdoc4;
private String pk_defdoc5;
private String pk_defdoc6;
private String pk_defdoc7;
private String pk_defdoc8;
private String pk_defdoc9;
private String tlastmaketime;
private String tmaketime;
private String vdef1;
private String vdef10;
private String vdef11;
private String vdef12;
private String vdef13;
private String vdef14;
private String vdef15;
private String vdef16;
private String vdef17;
private String vdef18;
private String vdef19;
private String vdef2;
private String vdef20;
private String vdef3;
private String vdef4;
private String vdef5;
private String vdef6;
private String vdef7;
private String vdef8;
private String vdef9;
private String vmemo;
private String vordercode;
}

View File

@ -0,0 +1,64 @@
package com.hzya.frame.plugin.lets.u8cdto;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @namePoOrderSonDto
* @Date2024/8/20 14:51
* @FilenamePoOrderSonDto
*/
@Data
public class PoOrderSonDto extends StockinOrderSearchResponse.StockinOrder.StockinH {
/**
* 采购公司
*/
private BdCorpEntity bdCorpEntity;
/**
* 采购部门
*/
private BdDeptdocEntity bdDeptdocEntity;
/**
* 采购组织
*/
private BdPurorgEntity bdPurorgEntity;
/**
* 客商基本档案-供应商
*/
private BdCubasdocEntity bdCubasdocEntity;
/**
* 客商管理档案-供应商
*/
private BdCumandocEntity bdCumandocEntity;
/**
* 明细行
*/
private List<StockinOrderSearchResponse.StockinOrder.StockinB> details;
/**
* OFS采购订单
*/
private OfsPoOrderData ofsPoOrderData;
/**
* 收货库存组织
*/
private BdCalbodyEntity bdCalbodyEntity;
/**
* 收货仓库
*/
private BdStordocEntity bdStordocEntity;
}

View File

@ -47,4 +47,5 @@
<bean name="iTocofsReturngoodsDetailedDaoImpl" class="com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl"/>
<bean name="tocofsSaleoutDao" class="com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDaoImpl"/>
<bean name="tocofsSaleoutDetailedDaoImpl" class="com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsSaleoutDetailedDaoImpl"/>
<bean name="bdPurorgDao" class="com.hzya.frame.plugin.lets.dao.impl.BdPurorgDaoImpl"/>
</beans>

View File

@ -23,4 +23,7 @@
<bean name="soSaleOutPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB"/>
<bean name="soSaleReturnPluginInitializerToB" class="com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB"/>
<bean name="proxyPurchaseWarehous" class="com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous"/>
<bean name="proxyPurchaseReturn" class="com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseReturn"/>
</beans>

View File

@ -0,0 +1,35 @@
package com.hzya.frame.plugin.lets.plugin.purchase;
import com.hzya.frame.WebappApplication;
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;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
* @ProjectkangarooDataCenterV3
* @nameProxyPurchaseReturnTest
* @Date2024/8/20 18:19
* @FilenameProxyPurchaseReturnTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class ProxyPurchaseReturnTest {
@Autowired
private ProxyPurchaseReturn proxyPurchaseReturn;
@Test
public void startImplement() {
try {
proxyPurchaseReturn.startImplement("LETS-SH2024082000000006");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,45 @@
package com.hzya.frame.plugin.lets.plugin.purchase;
import com.hzya.frame.WebappApplication;
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;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase
* @ProjectkangarooDataCenterV3
* @nameProxyPurchaseWarehousTest
* @Date2024/8/20 11:05
* @FilenameProxyPurchaseWarehousTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class ProxyPurchaseWarehousTest {
@Autowired
private ProxyPurchaseWarehous proxyPurchaseWarehous;
@Test
public void startImplement() {
try {
proxyPurchaseWarehous.startImplement("LETS-RE2024010200000001");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void startImplement2() {
try {
//2024年8月20日 16:17:24 测试查询OFS采购订单
proxyPurchaseWarehous.queryOfsPoOrder("LETS-PO2024010200000001");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -1,6 +1,8 @@
package com.hzya.frame.plugin.lets.plugin.sales;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.util.AfterSalesOrderUtil;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,8 +26,19 @@ public class SoSaleOutPluginInitializerToBTest {
@Autowired
private SoSaleOutPluginInitializerToB soSaleOutPluginInitializerToB;
@Autowired
private AfterSalesOrderUtil afterSalesOrderUtil;
@Test
public void startImplement() {
soSaleOutPluginInitializerToB.startImplement(null, null);
// soSaleOutPluginInitializerToB.startImplement(null, null);
soSaleOutPluginInitializerToB.startImplement("LETS-SH2024010900000008");
// try {
// SaleOrderMessageDto ofsOrder = afterSalesOrderUtil.getOfsOrder("LETS-SO2024081600000050");
// System.out.println(ofsOrder);
// } catch (Exception e) {
// e.printStackTrace();
// }
}
}

View File

@ -5,6 +5,7 @@ import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OFSSKUSearchResponse;
import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSTranseferOrderSearchResponse;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchJsonRootBean;
@ -40,5 +41,7 @@ public class ApiDtoCacheMap {
apiDtoCacheMap.put("ofs.inventory.class.search", new OFSSKUClassSearchResponse());//OFS存货分类查询接口
apiDtoCacheMap.put("ofs.returnOrder.search", new RerturnGoodsOrderSearchJsonRootBean());//售后订单
apiDtoCacheMap.put("ofs.purchaseOrder.search", new OfsPoOrderBean());//采购订单
}
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.ttxofs.dto.ofspoorder;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import lombok.Data;
import java.util.List;
@Data
public class OfsPoOrderBean extends ReturnMessageBasics {
private List<OfsPoOrderData> data;
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.ttxofs.dto.ofspoorder;
import lombok.Data;
import java.util.List;
@Data
public class OfsPoOrderData {
private OfsPoOrderHeader header;
private List<OfsPoOrderDetails> details;
}

View File

@ -0,0 +1,37 @@
package com.hzya.frame.ttxofs.dto.ofspoorder;
import lombok.Data;
@Data
public class OfsPoOrderDetails {
private String clientCode;
private String id;
private String purchaseOrderId;
private String purchaseOrderCode;
private String skuCode;
private String skuName;
private String requestQty;
private String openQty;
private String fulfillQty;
private String asnPendingQty;
private String returnableQty;
private String quantityUM;
private String buyPrice;
private String discountPrice;
private String discount;
private String totalAmount;
private String totalWeight;
private String totalVolume;
private String totalVolumeWeight;
private String fulfillAmount;
private String fulfillWeight;
private String fulfillVolume;
private String weightUM;
private String volumeUM;
private String inventorySts;
private String created;
private String createdBy;
private String lastUpdated;
private String lastUpdatedBy;
}

View File

@ -0,0 +1,52 @@
package com.hzya.frame.ttxofs.dto.ofspoorder;
import lombok.Data;
@Data
public class OfsPoOrderHeader {
private String id;
private String clientCode;
private String companyCode;
private String facilityCode;
private String code;
private String internalOrderType;
private String bizChannel;
private String sourceAsnCode;
private String status;
private String vendorName;
private String shipFromAttentionTo;
private String shipFromCountry;
private String shipFromAddress;
private String shipFromPostalCode;
private String shipFromPhone;
private String shipFromMobile;
private String shipFromFax;
private String shipFromEmail;
private String totalAmount;
private String totalLines;
private String totalQty;
private String totalWeight;
private String totalVolume;
private String totalVolumeWeight;
private String totalFulfillQty;
private String totalFulfillAmount;
private String totalFulfillWeight;
private String totalFulfillVolume;
private String totalFulfillVolumeWeight;
private String weightUM;
private String volumeUM;
private String sourcePlatformCode;
private String sourceOrderId;
private String sourceOrderCode;
private String auditBy;
private String auditAt;
private String closedBy;
private String closedAt;
private String errorCode;
private String errorDesc;
private String note;
private String created;
private String createdBy;
private String lastUpdated;
private String lastUpdatedBy;
}

View File

@ -10,15 +10,15 @@ import java.util.List;
*/
@Data
public class StockinOrderSearchResponse extends ReturnMessageBasics {
private List<StockinOrder> data;
public List<StockinOrder> data;
@Data
public class StockinOrder {
public static class StockinOrder {
private StockinH header;
private List<StockinB> details;
@Data
public class StockinH {
public static class StockinH {
private String id;
private String clientCode;
@ -62,10 +62,13 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics {
private String lastUpdatedBy;
private String sourcePlatformCode;
private String storeCode;
private String shipFromCode;
private String shipFromAddressCode;
private String shipAt;
}
@Data
public class StockinB {
public static class StockinB {
private String id;
private String receiptId;