1.添加同步代码

master
x_z 2 years ago
parent 940c3d2697
commit 7dbd390ff4

@ -31,6 +31,10 @@ public class BasicProcessStatus {
public static final String NEW_ALL_BUS_ORDER = "11";
public static final String NEW_ALL_DI = "10";
public static final String NEW_ALL_THR_DATA = "12"; //所有第三方基础数据
public static final String NEW_ALL_THR_PRODUCTS = "13"; //所有第三方产品数据
public static final String NEW_ALL_SYS_SETTING = "14"; //所有系统设置数据
public static final int SCHEDULE_NORMAL = 1; //常规任务
public static final int SCHEDULE_TRANSFER = 2; //需要传递任务

@ -227,6 +227,9 @@ public class ConstantStatus {
public static final String SYNC_BUS_TYPE = "AutoUploadBusType";
public static final String SYNC_SCAN_ORDER = "AutoUploadOrder";
public static final String SYNC_DI_PRODUCTS = "AutoDownloadDiProducts";
public static final String SYNC_THR_DATA = "AutoUploadThrData";
public static final String SYNC_THR_PRODUCTS = "AutoUploadThrProducts";
public static final String SYNC_SYS_SETTING = "AutoUploadSysSetting";
//自动下载所有数据
public static final String SYNC_DOWNLOAD_BASIC_DATA = "AutoDownloadAllData";

@ -2,34 +2,30 @@ package com.glxp.api.controller.sync;
import cn.hutool.core.collection.CollUtil;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.purchase.PurOrderController;
import com.glxp.api.dao.auth.*;
import com.glxp.api.dao.basic.*;
import com.glxp.api.dao.basic.BasicBusTypeChangeDao;
import com.glxp.api.dao.basic.BasicBussinessTypeDao;
import com.glxp.api.dao.inout.*;
import com.glxp.api.dao.purchase.PurOrderDao;
import com.glxp.api.dao.purchase.PurOrderDetailDao;
import com.glxp.api.dao.thrsys.*;
import com.glxp.api.dao.thrsys.ThrBusTypeOriginDao;
import com.glxp.api.dao.thrsys.ThrDeptDao;
import com.glxp.api.dao.thrsys.ThrInvWarehouseDao;
import com.glxp.api.entity.auth.*;
import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.entity.inout.*;
import com.glxp.api.entity.purchase.PurOrderDetailEntity;
import com.glxp.api.entity.purchase.PurOrderEntity;
import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
import com.glxp.api.entity.sync.BasicExportStatusEntity;
import com.glxp.api.entity.sync.SyncDataBustypeEntity;
import com.glxp.api.entity.sync.SyncDataSetEntity;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.req.basic.UdiInfoRequest;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.entity.thrsys.ThrDeptEntity;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import com.glxp.api.req.sync.SpsSyncDataRequest;
import com.glxp.api.res.sync.*;
import com.glxp.api.res.system.SyncDataSetResponse;
import com.glxp.api.service.auth.AuthAdminService;
import com.glxp.api.service.inout.IoAddInoutService;
import com.glxp.api.service.inout.IoCheckInoutService;
import com.glxp.api.service.inout.IoOrderService;
@ -39,7 +35,6 @@ import com.glxp.api.service.sync.BasicDownloadService;
import com.glxp.api.service.sync.BasicExportService;
import com.glxp.api.service.sync.SpsSyncDownloadService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
@ -52,7 +47,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -483,13 +477,65 @@ public class SpsSyncDownloadController {
//接收中继服务、UDI管理系统上传基础信息
@AuthRuleAnnotation("")
@PostMapping("/sps/sync/thrData/upload")
public BaseResponse uploadThrData(@RequestBody @Valid SpsSyncThrDataResponse spsSyncThrDataResponse) {
if (spsSyncThrDataResponse != null) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
basicDownloadStatusEntity.setId(CustomUtil.getId());
basicDownloadStatusEntity.setTaskId(spsSyncThrDataResponse.getTaskId());
basicDownloadStatusEntity.setStartTime(new Date());
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_BUS_TYPE);
basicDownloadStatusEntity.setStatus(0);
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
basicDownloadStatusEntity.setScheduleType(1);
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
//接收中继服务、UDI管理系统上传系统设置
StringBuilder remark = new StringBuilder();
//第三方部门信息
if (CollUtil.isNotEmpty(spsSyncThrDataResponse.getDeptEntities())) {
List<ThrDeptEntity> deptEntities = spsSyncThrDataResponse.getDeptEntities();
ThrDeptDao mapper = sqlSession.getMapper(ThrDeptDao.class);
deptEntities.forEach(mapper::insertOrUpdate);
}
sqlSession.commit();
remark.append("第三方部门信息:").append(spsSyncThrDataResponse.getDeptEntities().size()).append("条\n");
//第三方仓库信息
if (CollUtil.isNotEmpty(spsSyncThrDataResponse.getInvWarehouseEntities())) {
List<ThrInvWarehouseEntity> invWarehouseEntities = spsSyncThrDataResponse.getInvWarehouseEntities();
ThrInvWarehouseDao mapper = sqlSession.getMapper(ThrInvWarehouseDao.class);
invWarehouseEntities.forEach(mapper::insertOrUpdate);
}
sqlSession.commit();
remark.append("第三方仓库信息:").append(spsSyncThrDataResponse.getInvWarehouseEntities().size()).append("条\n");
//接收中继服务、UDI管理系统上传第三方产品信息
sqlSession.close();
basicDownloadStatusEntity.setStatus(1);
basicDownloadStatusEntity.setUpdateTime(new Date());
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setRemark(remark.toString());
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
}
return ResultVOUtils.success("上传成功");
}
//接收中继服务、UDI管理系统上传系统设置
@AuthRuleAnnotation("")
@PostMapping("/sps/sync/sys/setting")
public BaseResponse uploadSysSetting(@RequestBody @Valid SpsSyncSysSettingResponse spsSyncSysSettingResponse) {
return ResultVOUtils.success();
}
//接收中继服务、UDI管理系统上传第三方产品信息
@AuthRuleAnnotation("")
@PostMapping("/sps/sync/thrData/products/upload")
public BaseResponse uploadThrProducts(@RequestBody @Valid SpsSyncThrProductsResponse spsSyncThrProductsResponse) {
return ResultVOUtils.success();
}
}

@ -30,4 +30,6 @@ public interface ThrDeptDao {
ThrDeptEntity selectByCode(@Param("code") String code);
ThrDeptEntity selectMaxCode(FilterThrDeptRequest filterThrDeptRequest);
boolean insertOrUpdate(ThrDeptEntity thrDeptEntity);
}

@ -33,4 +33,5 @@ public interface ThrInvWarehouseDao {
List<ThrInvWarehouseResponse> filterThrInvWarehouseResponse(FilterThrSubInvWarehouseRequest filterThrSubInvWarehouseRequest);
boolean insertOrUpdate(ThrInvWarehouseEntity thrInvWarehouseEntity);
}

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* PDF
*/
@ -59,4 +61,7 @@ public class SysPdfTemplateRelevanceBizEntity {
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* PDF
*/
@ -60,4 +62,7 @@ public class SysPdfTemplateRelevanceCodeEntity {
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* PDF
*/
@ -59,4 +61,7 @@ public class SysPdfTemplateRelevanceLabelEntity {
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* PDF
*/
@ -62,4 +64,7 @@ public class SysPdfTemplateRelevanceStatemenEntity {
@TableField(value = "`modelKey`")
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -1,5 +1,6 @@
package com.glxp.api.entity.system;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.Date;
@ -21,4 +22,7 @@ public class SystemPDFModuleEntity {
private String remark2;
private String remark3;
private String modelKey;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SystemPDFTemplateEntity {
@ -24,4 +23,7 @@ public class SystemPDFTemplateEntity {
private String jrxmlPath;
private Integer bussinessType;
private String bussinessStatus;
@TableField(value = "updateTime")
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.glxp.api.entity.system;
import lombok.Data;
import java.util.Date;
@Data
public class SystemParamConfigEntity {
@ -13,4 +15,6 @@ public class SystemParamConfigEntity {
private int paramStatus;
private int paramType;
private String paramExplain;
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.glxp.api.entity.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrInvWarehouseEntity {
@ -14,5 +16,6 @@ public class ThrInvWarehouseEntity {
private String thirdSysFk;
private String parentName;
private Date updateTime;
}

@ -0,0 +1,37 @@
package com.glxp.api.res.sync;
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
import com.glxp.api.entity.basic.BasicBusTypePreEntity;
import com.glxp.api.entity.basic.EntrustReceEntity;
import com.glxp.api.entity.system.*;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class SpsSyncSysSettingResponse extends BaseSyncResponse {
private List<SystemParamConfigEntity> systemParamConfigEntities;
private List<EntrustReceEntity> entrustReceEntities;
private List<SystemPDFModuleEntity> systemPDFModuleEntities;
private List<SystemPDFTemplateEntity> systemPDFTemplateEntities;
private List<SysPdfTemplateRelevanceCodeEntity> sysPdfTemplateRelevanceCodeEntities;
private List<SysPdfTemplateRelevanceBizEntity> sysPdfTemplateRelevanceBizEntities;
private List<SysPdfTemplateRelevanceLabelEntity> sysPdfTemplateRelevanceLabelEntities;
private List<SysPdfTemplateRelevanceStatemenEntity> sysPdfTemplateRelevanceStatemenEntities;
private List<BasicBusTypePreEntity> basicBusTypePreEntities;
private List<BasicBusTypeChangeEntity> basicBusTypeChangeEntities;
}

@ -0,0 +1,31 @@
package com.glxp.api.res.sync;
import com.glxp.api.entity.thrsys.ThrCorpEntity;
import com.glxp.api.entity.thrsys.ThrDeptEntity;
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class SpsSyncThrDataResponse extends BaseSyncResponse {
/**
*
*/
private List<ThrDeptEntity> deptEntities;
/**
*
*/
private List<ThrInvWarehouseEntity> invWarehouseEntities;
/**
*
*/
private List<ThrCorpEntity> corpEntities;
}

@ -0,0 +1,19 @@
package com.glxp.api.res.sync;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import lombok.Data;
import java.util.List;
/**
*
*/
@Data
public class SpsSyncThrProductsResponse extends BaseSyncResponse {
/**
*
*/
private List<ThrProductsEntity> productsEntities;
}

@ -53,7 +53,8 @@
<select id="filterThrGroupInvWarehouse" parameterType="com.glxp.api.req.thrsys.FilterThrDeptRequest"
resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
SELECT * FROM thr_dept
SELECT *
FROM thr_dept
<where>
<if test="id != '' and id != null">
AND id = #{id}
@ -77,7 +78,6 @@
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertThrInvWarehouse" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
@ -85,8 +85,7 @@
INTO thr_dept
(pid, code, name, advanceType, isDefault,
status, updateTime, remark, thirdSysFk)
values (
#{pid},
values (#{pid},
#{code},
#{name},
#{advanceType},
@ -94,8 +93,7 @@
#{status},
#{updateTime},
#{remark},
#{thirdSysFk}
)
#{thirdSysFk})
</insert>
<insert id="insertThrInvWarehouses" parameterType="java.util.List">
@ -105,8 +103,7 @@
VALUES
<foreach collection="thrDeptEntities" item="item" index="index"
separator=",">
(
#{item.pid}, #{item.code},
(#{item.pid}, #{item.code},
#{item.name}, #{item.advanceType}, #{item.isDefault},
#{item.status}, #{item.updateTime},
#{item.remark}, #{item.thirdSysFk})
@ -122,15 +119,33 @@
<update id="updateThrInvWarehouse" parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
UPDATE thr_dept
<trim prefix="set" suffixOverrides=",">
<if test="pid != null">pid=#{pid},</if>
<if test="name != null">name=#{name},</if>
<if test="code != null">code=#{code},</if>
<if test="advanceType != null">advanceType=#{advanceType},</if>
<if test="isDefault != null">isDefault=#{isDefault},</if>
<if test="status != null">status=#{status},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="pid != null">
pid=#{pid},
</if>
<if test="name != null">
name=#{name},
</if>
<if test="code != null">
code=#{code},
</if>
<if test="advanceType != null">
advanceType=#{advanceType},
</if>
<if test="isDefault != null">
isDefault=#{isDefault},
</if>
<if test="status != null">
status=#{status},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="remark != null">
remark=#{remark},
</if>
<if test="thirdSysFk != null">
thirdSysFk=#{thirdSysFk},
</if>
</trim>
WHERE id = #{id}
</update>
@ -138,11 +153,13 @@
<select id="selectByCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
select *
from thr_dept
where code = #{code} and thirdSysFk = #{thirdSysFk}
where code = #{code}
and thirdSysFk = #{thirdSysFk}
</select>
<select id="selectMaxCode" resultType="com.glxp.api.entity.thrsys.ThrDeptEntity">
select max(code) as code from thr_dept
select max(code) as code
from thr_dept
<where>
<if test="id != '' and id != null">
AND id = #{id}
@ -156,7 +173,7 @@
<if test="name != '' and name != null">
AND name = #{name}
</if>
<if test=" advanceType != null">
<if test="advanceType != null">
AND advanceType = #{advanceType}
</if>
<if test="isDefault != null">
@ -192,4 +209,33 @@
#{item.thirdSysFk})
</foreach>
</insert>
<update id="insertOrUpdate" parameterType="com.glxp.api.entity.thrsys.ThrDeptEntity">
<selectKey keyProperty="id" resultType="Integer" order="BEFORE">
select id
from thr_dept
where id = #{id}
</selectKey>
<if test="id != null">
update thr_dept
set pId = #{pid},
name = #{name},
code = #{code},
advanceType = #{advanceType},
isDefault = #{isDefault},
status = #{status},
updateTime = #{updateTime},
remark = #{remark},
level = #{level},
pcode = #{pcode},
thirdSysFk = #{thirdSysFk}
where id = #{id};
</if>
<if test="id == null">
insert into thr_dept(id, pId, code, name, advanceType, isDefault, status, updateTime, remark, level, pcode,
thirdSysFk)
values (#{id}, #{pid}, #{code}, #{name}, #{advanceType}, #{isDefault}, #{status}, #{updateTime}, #{remark},
#{level}, #{pcode}, #{thirdSysFk})
</if>
</update>
</mapper>

@ -122,5 +122,12 @@
WHERE id = #{id}
</update>
<update id="insertOrUpdate" parameterType="com.glxp.api.entity.thrsys.ThrInvWarehouseEntity">
<selectKey keyProperty="id" resultType="Integer" order="BEFORE">
select id
from thr_dept
where id = #{id}
</selectKey>
</update>
</mapper>
Loading…
Cancel
Save