1.提交代码

master
x_z 2 years ago
parent 422311d7df
commit 02f1ce16c6

@ -220,7 +220,7 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.7.9</version> <version>5.8.18</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.belerweb</groupId> <groupId>com.belerweb</groupId>

@ -59,4 +59,11 @@ public interface IoOrderDao extends BaseMapperPlus<IoOrderDao, IoOrderEntity, Io
* @return * @return
*/ */
String selectActionByBillNo(@Param("billNo") String billNo); String selectActionByBillNo(@Param("billNo") String billNo);
/**
*
*
* @return
*/
List<String> selectWaitSubmitOrder(String thirdSys);
} }

@ -20,6 +20,7 @@ public interface ThrProductsDao {
List<ThrProductsEntity> filterThrProducts(FilterThrProductsRequest filterThrProductsRequest); List<ThrProductsEntity> filterThrProducts(FilterThrProductsRequest filterThrProductsRequest);
List<ThrProductsEntity> filterThrProducts1(FilterThrProductsRequest filterThrProductsRequest); List<ThrProductsEntity> filterThrProducts1(FilterThrProductsRequest filterThrProductsRequest);
List<ThrProductsResponse> filterJoinThrProducts(FilterThrProductsRequest filterThrProductsRequest); List<ThrProductsResponse> filterJoinThrProducts(FilterThrProductsRequest filterThrProductsRequest);
@ -33,4 +34,15 @@ public interface ThrProductsDao {
boolean insertThrProductsList(List<ThrProductsEntity> list); boolean insertThrProductsList(List<ThrProductsEntity> list);
List<ThrProductsEntity> selectByLastTime(@Param("lastUpdateTime") Date lastUpdateTime); List<ThrProductsEntity> selectByLastTime(@Param("lastUpdateTime") Date lastUpdateTime);
/**
*
*
* @param code
* @param thirdSysFk
* @return
*/
ThrProductsEntity selectByCodeAndThird(@Param("code") String code, @Param("thirdSysFk") String thirdSysFk);
boolean updateById(ThrProductsEntity thrProductsEntity);
} }

@ -2,6 +2,7 @@ package com.glxp.api.service.inout;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.inout.IoOrderEntity; import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.inout.FilterOrderRequest; import com.glxp.api.req.inout.FilterOrderRequest;
import com.glxp.api.req.inout.FilterUploadOrderRequest; import com.glxp.api.req.inout.FilterUploadOrderRequest;
import com.glxp.api.req.inout.OrderEditRequest; import com.glxp.api.req.inout.OrderEditRequest;
@ -124,4 +125,12 @@ public interface IoOrderService {
boolean isExitByAction(String action); boolean isExitByAction(String action);
/**
*
*
* @param thrSystemDetailEntity
* @return
*/
BaseResponse submitOrderToThrSys(ThrSystemDetailEntity thrSystemDetailEntity);
} }

@ -26,6 +26,7 @@ import com.glxp.api.entity.inout.*;
import com.glxp.api.entity.inv.*; import com.glxp.api.entity.inv.*;
import com.glxp.api.entity.system.SyncDataBustypeEntity; import com.glxp.api.entity.system.SyncDataBustypeEntity;
import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity; import com.glxp.api.entity.thrsys.ThrSystemBusApiEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.HttpOkClient; import com.glxp.api.http.HttpOkClient;
import com.glxp.api.req.inout.FilterOrderRequest; import com.glxp.api.req.inout.FilterOrderRequest;
@ -745,6 +746,20 @@ public class IoOrderServiceImpl implements IoOrderService {
return orderDao.exists(new QueryWrapper<IoOrderEntity>().eq("action", action)); return orderDao.exists(new QueryWrapper<IoOrderEntity>().eq("action", action));
} }
@Override
public BaseResponse submitOrderToThrSys(ThrSystemDetailEntity thrSystemDetailEntity) {
//查询可以提交到第三方系统的单据
List<String> billNos = orderDao.selectWaitSubmitOrder(thrSystemDetailEntity.getThirdSysFk());
if (CollUtil.isNotEmpty(billNos)) {
log.info("开始提交单据到第三方系统,本次提交单据数量:{}", billNos.size());
for (String billNo : billNos) {
submitToThrSys(billNo);
}
log.info("单据提交完成");
}
return ResultVOUtils.success("单据提交完成");
}
/** /**
* *
* *

@ -28,7 +28,6 @@ import javax.annotation.Resource;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
@Slf4j @Slf4j
@Service @Service
@ -215,18 +214,11 @@ public class ThrBusTypeOriginServiceImpl implements IThrBusTypeOriginService {
* @return * @return
*/ */
private boolean verifyDataChange(ThrBusTypeOriginEntity thrBusTypeOriginEntity, ThrSystemBusApiEntity thrSystemBusApi) { private boolean verifyDataChange(ThrBusTypeOriginEntity thrBusTypeOriginEntity, ThrSystemBusApiEntity thrSystemBusApi) {
if (!StrUtil.equals(thrBusTypeOriginEntity.getName(), thrSystemBusApi.getName())) { ThrBusTypeOriginEntity oldData = new ThrBusTypeOriginEntity();
BeanUtil.copyProperties(thrBusTypeOriginEntity, oldData);
thrBusTypeOriginEntity.setName(thrSystemBusApi.getName()); thrBusTypeOriginEntity.setName(thrSystemBusApi.getName());
return true;
}
if (!Objects.equals(thrBusTypeOriginEntity.getInoutType(), thrSystemBusApi.getInoutType())) {
thrBusTypeOriginEntity.setInoutType(thrSystemBusApi.getInoutType()); thrBusTypeOriginEntity.setInoutType(thrSystemBusApi.getInoutType());
return true;
}
if (!StrUtil.equals(thrBusTypeOriginEntity.getRemark(), thrSystemBusApi.getRemark())) {
thrBusTypeOriginEntity.setRemark(thrSystemBusApi.getRemark()); thrBusTypeOriginEntity.setRemark(thrSystemBusApi.getRemark());
return true; return !thrBusTypeOriginEntity.equals(oldData);
}
return false;
} }
} }

@ -1,7 +1,6 @@
package com.glxp.api.service.thrsys.impl; package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
@ -157,35 +156,16 @@ public class ThrCorpServiceImpl implements ThrCorpService {
* @return * @return
*/ */
private boolean verifyDataChange(ThrCorpEntity thrCorpEntity, ThrCorpsResponse thrCorpsResponse) { private boolean verifyDataChange(ThrCorpEntity thrCorpEntity, ThrCorpsResponse thrCorpsResponse) {
if (!StrUtil.equals(thrCorpEntity.getSpell(), thrCorpsResponse.getSpell())) { ThrCorpEntity oldData = new ThrCorpEntity();
BeanUtil.copyProperties(thrCorpEntity, oldData);
thrCorpEntity.setSpell(thrCorpsResponse.getSpell()); thrCorpEntity.setSpell(thrCorpsResponse.getSpell());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getAddr(), thrCorpsResponse.getAddr())) {
thrCorpEntity.setAddr(thrCorpsResponse.getAddr()); thrCorpEntity.setAddr(thrCorpsResponse.getAddr());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getCreditNo(), thrCorpsResponse.getCreditNo())) {
thrCorpEntity.setContact(thrCorpsResponse.getCreditNo()); thrCorpEntity.setContact(thrCorpsResponse.getCreditNo());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getContact(), thrCorpsResponse.getContact())) {
thrCorpEntity.setContact(thrCorpsResponse.getContact()); thrCorpEntity.setContact(thrCorpsResponse.getContact());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getMobile(), thrCorpsResponse.getMobile())) {
thrCorpEntity.setMobile(thrCorpsResponse.getMobile()); thrCorpEntity.setMobile(thrCorpsResponse.getMobile());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getName(), thrCorpsResponse.getName())) {
thrCorpEntity.setName(thrCorpsResponse.getName()); thrCorpEntity.setName(thrCorpsResponse.getName());
return true;
}
if (!StrUtil.equals(thrCorpEntity.getRemark(), thrCorpsResponse.getRemark())) {
thrCorpEntity.setRemark(thrCorpsResponse.getRemark()); thrCorpEntity.setRemark(thrCorpsResponse.getRemark());
return true; return !thrCorpEntity.equals(oldData);
}
return false;
} }
} }

@ -1,5 +1,6 @@
package com.glxp.api.service.thrsys.impl; package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -184,15 +185,11 @@ public class ThrInvWarehouseServiceImpl implements ThrInvWarehouseService {
* @return * @return
*/ */
private boolean verifyDataChange(ThrInvWarehouseEntity thrInvWarehouseEntity, UdiwmsWarehouseDetail udiwmsWarehouseDetail) { private boolean verifyDataChange(ThrInvWarehouseEntity thrInvWarehouseEntity, UdiwmsWarehouseDetail udiwmsWarehouseDetail) {
if (!StrUtil.equals(thrInvWarehouseEntity.getName(), udiwmsWarehouseDetail.getName())) { ThrInvWarehouseEntity oldData = new ThrInvWarehouseEntity();
BeanUtil.copyProperties(thrInvWarehouseEntity, oldData);
thrInvWarehouseEntity.setName(udiwmsWarehouseDetail.getName()); thrInvWarehouseEntity.setName(udiwmsWarehouseDetail.getName());
return true;
}
if (!StrUtil.equals(thrInvWarehouseEntity.getRemark(), udiwmsWarehouseDetail.getRemark())) {
thrInvWarehouseEntity.setRemark(udiwmsWarehouseDetail.getRemark()); thrInvWarehouseEntity.setRemark(udiwmsWarehouseDetail.getRemark());
return true; return !thrInvWarehouseEntity.equals(oldData);
}
return false;
} }
} }

@ -13,6 +13,7 @@ import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.http.ErpBasicClient; import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.thrsys.FilterThrProductsRequest; import com.glxp.api.req.thrsys.FilterThrProductsRequest;
import com.glxp.api.req.thrsys.PostThrProductsRequest; import com.glxp.api.req.thrsys.PostThrProductsRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrProductsResponse; import com.glxp.api.res.thrsys.ThrProductsResponse;
import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.service.thrsys.ThrProductsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -160,8 +161,86 @@ public class ThrProductsServiceImpl implements ThrProductsService {
@Override @Override
public BaseResponse downloadThrPi(ThrSystemDetailEntity thrSystemDetailEntity) { public BaseResponse downloadThrPi(ThrSystemDetailEntity thrSystemDetailEntity) {
int page = 1;
int limit = 200;
FilterThrProductsRequest request = new FilterThrProductsRequest();
request.setThirdSysFk(thrSystemDetailEntity.getThirdSysFk());
request.setLimit(limit);
while (true) {
request.setPage(page);
BaseResponse<PageSimpleResponse<ThrProductsResponse>> baseResponse = erpBasicClient.getErpProducts(request);
if (baseResponse.getCode() == 20000) {
List<ThrProductsResponse> list = baseResponse.getData().getList();
list.forEach(item -> {
ThrProductsEntity thrProductsEntity = thrProductsDao.selectByCodeAndThird(item.getCode(), item.getThirdSys());
if (null == thrProductsEntity) {
thrProductsEntity = new ThrProductsEntity();
BeanUtil.copyProperties(item, thrProductsEntity);
thrProductsEntity.setCreateTime(new Date());
thrProductsEntity.setUpdateTime(new Date());
} else {
boolean isChange = verifyDataChange(thrProductsEntity, item);
if (isChange) {
thrProductsEntity.setUpdateTime(new Date());
thrProductsDao.updateById(thrProductsEntity);
}
}
});
return null;
if (list.size() >= limit) {
page++;
} else {
break;
}
} else {
return ResultVOUtils.error(500, "下载第三方系统产品信息异常");
}
}
return ResultVOUtils.success("下载成功");
}
/**
*
*
* @param thrProductsEntity
* @param thrProductsResponse
* @return
*/
private boolean verifyDataChange(ThrProductsEntity thrProductsEntity, ThrProductsResponse thrProductsResponse) {
ThrProductsEntity oldData = new ThrProductsEntity();
BeanUtil.copyProperties(thrProductsEntity, oldData);
//将关键字段的值设置为新数据的值
thrProductsEntity.setName(thrProductsResponse.getName());
thrProductsEntity.setMeasname(thrProductsResponse.getMeasname());
thrProductsEntity.setSpec(thrProductsResponse.getSpec());
thrProductsEntity.setRegisterNo(thrProductsResponse.getRegisterNo());
thrProductsEntity.setManufactory(thrProductsResponse.getManufactory());
thrProductsEntity.setCplb(thrProductsResponse.getCplb());
thrProductsEntity.setFlbm(thrProductsResponse.getFlbm());
thrProductsEntity.setQtbm(thrProductsResponse.getQtbm());
thrProductsEntity.setSptm(thrProductsResponse.getSptm());
thrProductsEntity.setYbbm(thrProductsResponse.getYbbm());
thrProductsEntity.setTyshxydm(thrProductsResponse.getTyshxydm());
thrProductsEntity.setZczbhhzbapzbh(thrProductsResponse.getZczbhhzbapzbh());
thrProductsEntity.setYlqxzcrbarmc(thrProductsResponse.getYlqxzcrbarmc());
thrProductsEntity.setYlqxzcrbarywmc(thrProductsResponse.getYlqxzcrbarywmc());
thrProductsEntity.setCpms(thrProductsResponse.getCpms());
thrProductsEntity.setSupName(thrProductsResponse.getSupName());
thrProductsEntity.setModel(thrProductsResponse.getModel());
thrProductsEntity.setStandard(thrProductsResponse.getStandard());
thrProductsEntity.setQtbm(thrProductsResponse.getQtbm());
thrProductsEntity.setZczyxqz(thrProductsResponse.getZczyxqz());
thrProductsEntity.setRemark(thrProductsResponse.getRemark());
thrProductsEntity.setRemark1(thrProductsResponse.getRemark1());
thrProductsEntity.setRemark2(thrProductsResponse.getRemark2());
thrProductsEntity.setRemark3(thrProductsResponse.getRemark3());
thrProductsEntity.setPrice(thrProductsResponse.getPrice());
//比对更新完的对象和原对象是否发生变化,若有变化则说明书有更新
return !thrProductsEntity.equals(oldData);
} }
} }

@ -114,7 +114,15 @@ public class ThirdSysInterfaceTask {
* @param thrSystemDetailEntity * @param thrSystemDetailEntity
*/ */
private void submitOrder(ThrSystemDetailEntity thrSystemDetailEntity) { private void submitOrder(ThrSystemDetailEntity thrSystemDetailEntity) {
//校验任务并更新redis数据执行标识
if (verifyTask(thrSystemDetailEntity)) {
getExecutor().submit(() -> {
log.info("开始提交单据到第三方系统");
orderService.submitOrderToThrSys(thrSystemDetailEntity);
updateTask(getTaskKey(thrSystemDetailEntity));
log.info("提交单据到第三方系统完成");
});
}
} }
/** /**

@ -264,4 +264,8 @@
from io_order from io_order
where billNo = #{billNo} where billNo = #{billNo}
</select> </select>
<select id="selectWaitSubmitOrder" resultType="java.lang.String">
</select>
</mapper> </mapper>

@ -238,4 +238,78 @@
#{item.updateUser} #{item.updateUser}
</foreach> </foreach>
</insert> </insert>
<select id="selectByCodeAndThird" resultType="com.glxp.api.entity.thrsys.ThrProductsEntity">
select id,
code,
name,
measname,
spec,
registerNo,
manufactory,
thirdSysFk,
cplb,
flbm,
qxlb,
ybbm,
sptm,
tyshxydm,
zczbhhzbapzbh,
ylqxzcrbarmc,
ylqxzcrbarywmc,
cpms,
supName,
model,
standard,
qtbm,
zczyxqz,
remark,
remark1,
remark2,
remark3,
price
from thr_products
<where>
<if test="code != null and code != ''">
AND code = #{code}
</if>
<if test="thirdSysFk != null and thirdSysFk != ''">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<update id="updateById" parameterType="com.glxp.api.entity.thrsys.ThrProductsEntity">
update thr_products
<set>
code = #{code,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
measname = #{measname,jdbcType=VARCHAR},
spec = #{spec,jdbcType=VARCHAR},
registerNo = #{registerNo,jdbcType=VARCHAR},
manufactory = #{manufactory,jdbcType=VARCHAR},
cplb = #{cplb,jdbcType=VARCHAR},
flbm = #{flbm,jdbcType=VARCHAR},
qxlb = #{qxlb,jdbcType=VARCHAR},
ybbm = #{ybbm,jdbcType=VARCHAR},
sptm = #{sptm,jdbcType=VARCHAR},
tyshxydm = #{tyshxydm,jdbcType=VARCHAR},
zczbhhzbapzbh = #{zczbhhzbapzbh,jdbcType=VARCHAR},
ylqxzcrbarmc = #{ylqxzcrbarmc,jdbcType=VARCHAR},
ylqxzcrbarywmc = #{ylqxzcrbarywmc,jdbcType=VARCHAR},
cpms = #{cpms,jdbcType=LONGVARCHAR},
updateTime = #{updateTime,jdbcType=TIMESTAMP},
supName = #{supName,jdbcType=VARCHAR},
model = #{model,jdbcType=VARCHAR},
standard = #{standard,jdbcType=VARCHAR},
qtbm = #{qtbm,jdbcType=VARCHAR},
zczyxqz = #{zczyxqz,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
remark1 = #{remark1,jdbcType=VARCHAR},
remark2 = #{remark2,jdbcType=VARCHAR},
remark3 = #{remark3,jdbcType=VARCHAR},
price = #{price,jdbcType=VARCHAR}
</set>
where id = #{id,jdbcType=INTEGER}
</update>
</mapper> </mapper>

Loading…
Cancel
Save