丽知:成套件插件修改。

This commit is contained in:
zhengyf 2024-09-11 17:17:10 +08:00
parent e1fa2074c3
commit 3000fecb14
7 changed files with 368 additions and 10 deletions

View File

@ -0,0 +1,15 @@
package com.hzya.frame.plugin.lets.dao;
import com.hzya.frame.plugin.lets.entity.BdSetpartEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
/**
* (BD_SETPART: table)表数据库访问层
*
* @author makejava
* @since 2024-09-11 15:34:13
*/
public interface IBdSetpartDao extends IBaseDao<BdSetpartEntity, String> {
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.plugin.lets.dao.impl;
import com.hzya.frame.plugin.lets.entity.BdSetpartEntity;
import com.hzya.frame.plugin.lets.dao.IBdSetpartDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
/**
* (BdSetpart)表数据库访问层
*
* @author makejava
* @since 2024-09-11 15:34:13
*/
public class BdSetpartDaoImpl extends MybatisGenericDao<BdSetpartEntity, String> implements IBdSetpartDao{
}

View File

@ -0,0 +1,87 @@
package com.hzya.frame.plugin.lets.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (BdSetpart)实体类
*
* @author makejava
* @since 2024-09-11 15:34:13
*/
public class BdSetpartEntity extends BaseEntity {
private String bdSetpart;
private String childsnum;
private String dr;
private String partpercent;
private String pkCorp;
private String pkInvmandocpart;
private String pkInvmandocset;
private String ts;
public String getBdSetpart() {
return bdSetpart;
}
public void setBdSetpart(String bdSetpart) {
this.bdSetpart = bdSetpart;
}
public String getChildsnum() {
return childsnum;
}
public void setChildsnum(String childsnum) {
this.childsnum = childsnum;
}
public String getDr() {
return dr;
}
public void setDr(String dr) {
this.dr = dr;
}
public String getPartpercent() {
return partpercent;
}
public void setPartpercent(String partpercent) {
this.partpercent = partpercent;
}
public String getPkCorp() {
return pkCorp;
}
public void setPkCorp(String pkCorp) {
this.pkCorp = pkCorp;
}
public String getPkInvmandocpart() {
return pkInvmandocpart;
}
public void setPkInvmandocpart(String pkInvmandocpart) {
this.pkInvmandocpart = pkInvmandocpart;
}
public String getPkInvmandocset() {
return pkInvmandocset;
}
public void setPkInvmandocset(String pkInvmandocset) {
this.pkInvmandocset = pkInvmandocset;
}
public String getTs() {
return ts;
}
public void setTs(String ts) {
this.ts = ts;
}
}

View File

@ -0,0 +1,189 @@
<?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.BdSetpartDaoImpl">
<resultMap id="get-BdSetpartEntity-result" type="com.hzya.frame.plugin.lets.entity.BdSetpartEntity" >
<result property="bdSetpart" column="BD_SETPART" jdbcType="VARCHAR"/>
<result property="childsnum" column="CHILDSNUM" jdbcType="VARCHAR"/>
<result property="dr" column="DR" jdbcType="VARCHAR"/>
<result property="partpercent" column="PARTPERCENT" jdbcType="VARCHAR"/>
<result property="pkCorp" column="PK_CORP" jdbcType="VARCHAR"/>
<result property="pkInvmandocpart" column="PK_INVMANDOCPART" jdbcType="VARCHAR"/>
<result property="pkInvmandocset" column="PK_INVMANDOCSET" jdbcType="VARCHAR"/>
<result property="ts" column="TS" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id = "BdSetpartEntity_Base_Column_List">
BD_SETPART
,CHILDSNUM
,DR
,PARTPERCENT
,PK_CORP
,PK_INVMANDOCPART
,PK_INVMANDOCSET
,TS
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-BdSetpartEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity">
select
<include refid="BdSetpartEntity_Base_Column_List" />
from BD_SETPART
<trim prefix="where" prefixOverrides="and">
<if test="bdSetpart != null and bdSetpart != ''"> and BD_SETPART = #{bdSetpart} </if>
<if test="childsnum != null and childsnum != ''"> and CHILDSNUM = #{childsnum} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="partpercent != null and partpercent != ''"> and PARTPERCENT = #{partpercent} </if>
<if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> and PK_INVMANDOCPART = #{pkInvmandocpart} </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> and PK_INVMANDOCSET = #{pkInvmandocset} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
and dr=0
</trim>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity">
select count(1) from BD_SETPART
<trim prefix="where" prefixOverrides="and">
<if test="bdSetpart != null and bdSetpart != ''"> and BD_SETPART = #{bdSetpart} </if>
<if test="childsnum != null and childsnum != ''"> and CHILDSNUM = #{childsnum} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="partpercent != null and partpercent != ''"> and PARTPERCENT = #{partpercent} </if>
<if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> and PK_INVMANDOCPART = #{pkInvmandocpart} </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> and PK_INVMANDOCSET = #{pkInvmandocset} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
and dr=0
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-BdSetpartEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity">
select
<include refid="BdSetpartEntity_Base_Column_List" />
from BD_SETPART
<trim prefix="where" prefixOverrides="and">
<if test="bdSetpart != null and bdSetpart != ''"> and BD_SETPART like concat('%',#{bdSetpart},'%') </if>
<if test="childsnum != null and childsnum != ''"> and CHILDSNUM like concat('%',#{childsnum},'%') </if>
<if test="dr != null and dr != ''"> and DR like concat('%',#{dr},'%') </if>
<if test="partpercent != null and partpercent != ''"> and PARTPERCENT like concat('%',#{partpercent},'%') </if>
<if test="pkCorp != null and pkCorp != ''"> and PK_CORP like concat('%',#{pkCorp},'%') </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> and PK_INVMANDOCPART like concat('%',#{pkInvmandocpart},'%') </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> and PK_INVMANDOCSET like concat('%',#{pkInvmandocset},'%') </if>
<if test="ts != null and ts != ''"> and TS like concat('%',#{ts},'%') </if>
and dr=0
</trim>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="BdSetpartentity_list_or" resultMap="get-BdSetpartEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity">
select
<include refid="BdSetpartEntity_Base_Column_List" />
from BD_SETPART
<trim prefix="where" prefixOverrides="and">
<if test="bdSetpart != null and bdSetpart != ''"> or BD_SETPART = #{bdSetpart} </if>
<if test="childsnum != null and childsnum != ''"> or CHILDSNUM = #{childsnum} </if>
<if test="dr != null and dr != ''"> or DR = #{dr} </if>
<if test="partpercent != null and partpercent != ''"> or PARTPERCENT = #{partpercent} </if>
<if test="pkCorp != null and pkCorp != ''"> or PK_CORP = #{pkCorp} </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> or PK_INVMANDOCPART = #{pkInvmandocpart} </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> or PK_INVMANDOCSET = #{pkInvmandocset} </if>
<if test="ts != null and ts != ''"> or TS = #{ts} </if>
and dr=0
</trim>
</select>
<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity" keyProperty="bdSetpart" useGeneratedKeys="true">
insert into BD_SETPART(
<trim suffix="" suffixOverrides=",">
<if test="bdSetpart != null and bdSetpart != ''"> BD_SETPART , </if>
<if test="childsnum != null and childsnum != ''"> CHILDSNUM , </if>
<if test="dr != null and dr != ''"> DR , </if>
<if test="partpercent != null and partpercent != ''"> PARTPERCENT , </if>
<if test="pkCorp != null and pkCorp != ''"> PK_CORP , </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> PK_INVMANDOCPART , </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> PK_INVMANDOCSET , </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="bdSetpart != null and bdSetpart != ''"> #{bdSetpart} ,</if>
<if test="childsnum != null and childsnum != ''"> #{childsnum} ,</if>
<if test="dr != null and dr != ''"> #{dr} ,</if>
<if test="partpercent != null and partpercent != ''"> #{partpercent} ,</if>
<if test="pkCorp != null and pkCorp != ''"> #{pkCorp} ,</if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> #{pkInvmandocpart} ,</if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> #{pkInvmandocset} ,</if>
<if test="ts != null and ts != ''"> #{ts} ,</if>
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from BD_SETPART a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if>
</trim>
)
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="bdSetpart" useGeneratedKeys="true">
insert into BD_SETPART(CHILDSNUM, DR, PARTPERCENT, PK_CORP, PK_INVMANDOCPART, PK_INVMANDOCSET, TS, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.childsnum},#{entity.dr},#{entity.partpercent},#{entity.pkCorp},#{entity.pkInvmandocpart},#{entity.pkInvmandocset},#{entity.ts}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="bdSetpart" useGeneratedKeys="true">
insert into BD_SETPART(CHILDSNUM, DR, PARTPERCENT, PK_CORP, PK_INVMANDOCPART, PK_INVMANDOCSET, TS)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.childsnum},#{entity.dr},#{entity.partpercent},#{entity.pkCorp},#{entity.pkInvmandocpart},#{entity.pkInvmandocset},#{entity.ts})
</foreach>
on duplicate key update
CHILDSNUM = values(CHILDSNUM),
DR = values(DR),
PARTPERCENT = values(PARTPERCENT),
PK_CORP = values(PK_CORP),
PK_INVMANDOCPART = values(PK_INVMANDOCPART),
PK_INVMANDOCSET = values(PK_INVMANDOCSET),
TS = values(TS)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity" >
update BD_SETPART set
<trim suffix="" suffixOverrides=",">
<if test="childsnum != null and childsnum != ''"> CHILDSNUM = #{childsnum},</if>
<if test="dr != null and dr != ''"> DR = #{dr},</if>
<if test="partpercent != null and partpercent != ''"> PARTPERCENT = #{partpercent},</if>
<if test="pkCorp != null and pkCorp != ''"> PK_CORP = #{pkCorp},</if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> PK_INVMANDOCPART = #{pkInvmandocpart},</if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> PK_INVMANDOCSET = #{pkInvmandocset},</if>
<if test="ts != null and ts != ''"> TS = #{ts},</if>
</trim>
where BD_SETPART = #{bdSetpart}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity" >
update BD_SETPART set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where BD_SETPART = #{bdSetpart}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.BdSetpartEntity" >
update BD_SETPART set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="bdSetpart != null and bdSetpart != ''"> and BD_SETPART = #{bdSetpart} </if>
<if test="childsnum != null and childsnum != ''"> and CHILDSNUM = #{childsnum} </if>
<if test="dr != null and dr != ''"> and DR = #{dr} </if>
<if test="partpercent != null and partpercent != ''"> and PARTPERCENT = #{partpercent} </if>
<if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
<if test="pkInvmandocpart != null and pkInvmandocpart != ''"> and PK_INVMANDOCPART = #{pkInvmandocpart} </if>
<if test="pkInvmandocset != null and pkInvmandocset != ''"> and PK_INVMANDOCSET = #{pkInvmandocset} </if>
<if test="ts != null and ts != ''"> and TS = #{ts} </if>
and dr=0
</trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
delete from BD_SETPART where BD_SETPART = #{bdSetpart}
</delete>
</mapper>

View File

@ -9,8 +9,9 @@ import com.hzya.frame.plugin.lets.constant.OverallConstant;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.IBdInvbasdocDao;
import com.hzya.frame.plugin.lets.entity.BdCorpEntity;
import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity;
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsKitRequestVO;
import com.hzya.frame.plugin.lets.u8cdto.InvBasDocVO;
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
import com.hzya.frame.plugin.lets.u8cdto.SetpartVO;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
@ -21,7 +22,6 @@ import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
import com.hzya.frame.plugin.lets.util.pushData.ZTResult;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto;
import com.hzya.frame.ttxofs.dto.kit.OfsKitOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
@ -39,6 +39,7 @@ import java.util.concurrent.locks.ReentrantLock;
* OFS实物组套同步U8C成套件档案
* <p>
* U8C成套件没有修改只有删除和新增
* 真的是日了狗了这个接口千万不要使用code模式单个公司没问题多个公司生成的管理档案有问题
*/
public class KitPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(KitPluginInitializer.class);
@ -215,27 +216,72 @@ public class KitPluginInitializer extends PluginBaseEntity {
String response="";
String format=ofsKit.getHeader().getLastUpdated();
//套件编码
String setKkuCode = ofsKit.getHeader().getSkuCode();
//套件 存货基本档案
BdInvbasdocEntity bdInvbasdocSet = queryU8CEntityUtil.queryBdInvbasdocByCode(setKkuCode);
if (bdInvbasdocSet == null) {
Assert.state(false,"套件编码:{}没有查询到U8C存货基本档案请维护。",setKkuCode);
}
List<SetpartVO> setpartVOS=new ArrayList<>();
try {
//ofsKit表体
for (OfsKitOrderSearchResponse.OfsKit.KitDetail detail : ofsKit.getDetails()) {
//配件
String partSkuCode = detail.getSkuCode();
BdInvbasdocEntity bdInvbasdocPart = queryU8CEntityUtil.queryBdInvbasdocByCode(partSkuCode);
if (bdInvbasdocPart == null) {
Assert.state(false,"配件编码:{}没有查询到U8C存货基本档案请维护。",partSkuCode);
}
//每个物料给每个公司一份
for (BdCorpEntity bdCorpEntity : bdCorpEntities) {
SetpartVO setpart = new SetpartVO();
//pk_invmandocset 成套件编码
setpart.setPk_invmandocset(ofsKit.getHeader().getSkuCode());
//pk_invmandocpart 配件编码
setpart.setPk_invmandocpart(detail.getSkuCode());
//childsnum 父含子数
setpart.setChildsnum(detail.getQuantity());
//partpercent 单件单价权数,妮妮姐说的全传1
setpart.setPartpercent("1");
//pk_corp 公司
setpart.setPk_corp(bdCorpEntity.getUnitcode());
setpart.setPk_corp(bdCorpEntity.getPkCorp());
//套件 存货管理档案
BdInvmandocEntity bdInvmandocSet = queryU8CEntityUtil.queryBdInvmandocByPkInvbasdocAndPkCorp(bdInvbasdocSet.getPkInvbasdoc(), bdCorpEntity.getPkCorp());
if(bdInvmandocSet==null){
Assert.state(false,"套件编码:{},公司:{}没有查询到U8C存货管理档案请维护。",setKkuCode,bdCorpEntity.getPkCorp());
}
//配件 存货管理档案
BdInvmandocEntity bdInvmandocPart = queryU8CEntityUtil.queryBdInvmandocByPkInvbasdocAndPkCorp(bdInvbasdocPart.getPkInvbasdoc(), bdCorpEntity.getPkCorp());
if(bdInvmandocPart==null){
Assert.state(false,"套件编码:{},公司:{}没有查询到U8C存货管理档案请维护。",partSkuCode,bdCorpEntity.getPkCorp());
}
//pk_invmandocset 成套件编码
setpart.setPk_invmandocset(bdInvmandocSet.getPkInvmandoc());
//pk_invmandocpart 配件编码
setpart.setPk_invmandocpart(bdInvmandocPart.getPkInvmandoc());
setpartVOS.add(setpart);
}
// SetpartVO setpart = new SetpartVO();
// //pk_invmandocset 成套件编码
// setpart.setPk_invmandocset(ofsKit.getHeader().getSkuCode());
// //pk_invmandocpart 配件编码
// setpart.setPk_invmandocpart(detail.getSkuCode());
// //childsnum 父含子数
// setpart.setChildsnum(detail.getQuantity());
// System.out.println(detail.getQuantity());
// //partpercent 单件单价权数,妮妮姐说的全传1
// setpart.setPartpercent("1");
// //pk_corp 公司
// setpart.setPk_corp("SHXM");
// setpartVOS.add(setpart);
}
System.out.println(setpartVOS);
@ -243,7 +289,8 @@ public class KitPluginInitializer extends PluginBaseEntity {
String jsonStr = JSONUtil.toJsonStr(setpartVOS);
mapStr= "{\"setpartvo\":" + jsonStr + "}";
ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("setpartInsertCode"), mapStr);
// ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("setpartInsertCode"), mapStr);
ZTResult ztResult = pushU8CByApiCode.pushByPK(OverallConstant.getOverAllValue("setpartInsertCode"), mapStr);
//两层判断,一层中台转发,一层u8c返回
Attribute attribute = ztResult.getAttribute();
if ("false".equals(ztResult.getFlag())) {

View File

@ -115,7 +115,11 @@ public class QueryU8CEntityUtil {
entity.setDr(0L);
entity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
List<BdInvmandocEntity> query = iBdInvmandocDao.query(entity);
return query.get(0);
if (query.size() >= 1) {
return query.get(0);
} else {
return null;
}
}
////////////////////////////////////////////////////////////////////////////////////////存货管理档案

View File

@ -44,7 +44,7 @@ public class BaseTest {
////////////////////////////////////////////////////////////////////////////////////SKU自动分配
@Test
public void t10(){
goodsAutoAllotPluginInitializer.start("test0717001");
goodsAutoAllotPluginInitializer.start("6938582374025");
}
@Test
public void t11(){