diff --git a/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java b/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java index 1350b88a5..c63e17bec 100644 --- a/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java +++ b/src/main/java/com/glxp/api/controller/sync/SyncDataSetController.java @@ -7,6 +7,7 @@ import com.glxp.api.entity.system.SyncDataBustypeEntity; import com.glxp.api.entity.system.SyncDataSetEntity; import com.glxp.api.res.system.SyncDataSetResponse; import com.glxp.api.service.sync.SyncDataBustypeService; +import com.glxp.api.service.sync.SyncDataChangeBustypeService; import com.glxp.api.service.sync.SyncDataSetService; import com.glxp.api.util.RedisUtil; import com.glxp.api.common.enums.ResultEnum; @@ -31,6 +32,8 @@ public class SyncDataSetController { @Resource private SyncDataBustypeService syncDataBustypeService; @Resource + private SyncDataChangeBustypeService syncDataChangeBustypeService; + @Resource private RedisUtil redisUtil; @@ -60,6 +63,11 @@ public class SyncDataSetController { if (CollUtil.isNotEmpty(busTypes)) syncDataBustypeService.inserts(busTypes); syncDataSetEntity.setBusTypes(null); + + if (CollUtil.isNotEmpty(syncDataSetResponse.getChangeBusTypes())) { + syncDataChangeBustypeService.inserts(syncDataSetResponse.getChangeBusTypes()); + } + boolean b = syncDataSetService.insert(syncDataSetEntity); if (syncDataSetResponse.getDelaySyncTime() != null && syncDataSetResponse.getDelaySyncTime() > 0) { diff --git a/src/main/java/com/glxp/api/dao/system/SyncDataChangeBustypesDao.java b/src/main/java/com/glxp/api/dao/system/SyncDataChangeBustypesDao.java new file mode 100644 index 000000000..e13082124 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/system/SyncDataChangeBustypesDao.java @@ -0,0 +1,7 @@ +package com.glxp.api.dao.system; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.api.entity.system.SyncDataChangeBustypesEntity; + +public interface SyncDataChangeBustypesDao extends BaseMapper { +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/entity/system/SyncDataChangeBustypesEntity.java b/src/main/java/com/glxp/api/entity/system/SyncDataChangeBustypesEntity.java new file mode 100644 index 000000000..6b0a3c830 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/system/SyncDataChangeBustypesEntity.java @@ -0,0 +1,31 @@ +package com.glxp.api.entity.system; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * 单据同步 - 业务单据类型 + */ +@Data +@TableName(value = "sync_data_change_bustypes") +public class SyncDataChangeBustypesEntity { + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @TableField(value = "`action`") + private String action; + + @TableField(value = "`name`") + private String name; + + @TableField(value = "outChange") + private boolean outChange; + + @TableField(value = "orderStatus") + private Integer orderStatus; + +} \ No newline at end of file diff --git a/src/main/java/com/glxp/api/res/system/SyncDataSetResponse.java b/src/main/java/com/glxp/api/res/system/SyncDataSetResponse.java index 6cd4c5662..c347850e3 100644 --- a/src/main/java/com/glxp/api/res/system/SyncDataSetResponse.java +++ b/src/main/java/com/glxp/api/res/system/SyncDataSetResponse.java @@ -1,5 +1,6 @@ package com.glxp.api.res.system; +import com.glxp.api.entity.system.SyncDataChangeBustypesEntity; import com.glxp.api.entity.system.SyncDataBustypeEntity; import com.glxp.api.entity.system.SyncDataPurTypeEntity; import lombok.Data; @@ -29,7 +30,8 @@ public class SyncDataSetResponse { private Integer syncDownloadTime; //定时下载时间 private boolean sysUser; - private List busTypes; + private List busTypes; //扫码单据类型 + private List changeBusTypes; //业务单据类型 private List purTypeEntities; private String orderSyncStart; diff --git a/src/main/java/com/glxp/api/service/inv/impl/DeviceRepairOrderServiceImpl.java b/src/main/java/com/glxp/api/service/inv/impl/DeviceRepairOrderServiceImpl.java index 1595618b9..0fe6fde00 100644 --- a/src/main/java/com/glxp/api/service/inv/impl/DeviceRepairOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inv/impl/DeviceRepairOrderServiceImpl.java @@ -18,6 +18,7 @@ import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.OrderNoTypeBean; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; diff --git a/src/main/java/com/glxp/api/service/sync/SyncDataChangeBustypeService.java b/src/main/java/com/glxp/api/service/sync/SyncDataChangeBustypeService.java new file mode 100644 index 000000000..385ae9bb0 --- /dev/null +++ b/src/main/java/com/glxp/api/service/sync/SyncDataChangeBustypeService.java @@ -0,0 +1,18 @@ +package com.glxp.api.service.sync; + +import com.glxp.api.entity.system.SyncDataChangeBustypesEntity; + +import java.util.List; + +/** + * 单据同步 - 业务单据类型 Service + */ +public interface SyncDataChangeBustypeService { + + List findAll(); + + boolean deleteAll(); + + void inserts(List syncDataChangeBustypesEntities); + +} diff --git a/src/main/java/com/glxp/api/service/sync/impl/SyncDataChangeBustypeServiceImpl.java b/src/main/java/com/glxp/api/service/sync/impl/SyncDataChangeBustypeServiceImpl.java new file mode 100644 index 000000000..d1be070db --- /dev/null +++ b/src/main/java/com/glxp/api/service/sync/impl/SyncDataChangeBustypeServiceImpl.java @@ -0,0 +1,44 @@ +package com.glxp.api.service.sync.impl; + +import cn.hutool.core.collection.CollUtil; +import com.glxp.api.dao.system.SyncDataChangeBustypesDao; +import com.glxp.api.entity.system.SyncDataChangeBustypesEntity; +import com.glxp.api.service.sync.SyncDataChangeBustypeService; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.TransactionIsolationLevel; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +@Service +@Transactional(rollbackFor = Exception.class) +public class SyncDataChangeBustypeServiceImpl implements SyncDataChangeBustypeService { + + @Resource + private SyncDataChangeBustypesDao syncDataChangeBustypesDao; + @Resource + private SqlSessionFactory sqlSessionFactory; + + @Override + public List findAll() { + return syncDataChangeBustypesDao.selectList(null); + } + + @Override + public boolean deleteAll() { + syncDataChangeBustypesDao.delete(null); + return true; + } + + @Override + public void inserts(List syncDataChangeBustypesEntities) { + if (CollUtil.isNotEmpty(syncDataChangeBustypesEntities)) { + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED); + syncDataChangeBustypesEntities.forEach(item -> syncDataChangeBustypesDao.insert(item)); + } + } +} diff --git a/src/main/java/com/glxp/api/service/sync/impl/SyncDataSetServiceImpl.java b/src/main/java/com/glxp/api/service/sync/impl/SyncDataSetServiceImpl.java index 1e1126e84..f922b303a 100644 --- a/src/main/java/com/glxp/api/service/sync/impl/SyncDataSetServiceImpl.java +++ b/src/main/java/com/glxp/api/service/sync/impl/SyncDataSetServiceImpl.java @@ -1,10 +1,12 @@ package com.glxp.api.service.sync.impl; import com.glxp.api.dao.system.SyncDataSetDao; +import com.glxp.api.entity.system.SyncDataChangeBustypesEntity; import com.glxp.api.entity.system.SyncDataBustypeEntity; import com.glxp.api.entity.system.SyncDataSetEntity; import com.glxp.api.res.system.SyncDataSetResponse; import com.glxp.api.service.sync.SyncDataBustypeService; +import com.glxp.api.service.sync.SyncDataChangeBustypeService; import com.glxp.api.service.sync.SyncDataSetService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -21,6 +23,8 @@ public class SyncDataSetServiceImpl implements SyncDataSetService { SyncDataSetDao syncDataSetDao; @Resource SyncDataBustypeService syncDataBustypeService; + @Resource + private SyncDataChangeBustypeService syncDataChangeBustypeService; @Override public SyncDataSetEntity findSet() { @@ -34,7 +38,10 @@ public class SyncDataSetServiceImpl implements SyncDataSetService { SyncDataSetResponse syncDataSetResponse = new SyncDataSetResponse(); BeanUtils.copyProperties(syncDataSetEntity, syncDataSetResponse); List syncDataBustypeEntities = syncDataBustypeService.findAll(); + List changeBustypesEntities = syncDataChangeBustypeService.findAll(); syncDataSetResponse.setBusTypes(syncDataBustypeEntities); + syncDataSetResponse.setChangeBusTypes(changeBustypesEntities); + return syncDataSetResponse; } diff --git a/src/main/resources/mybatis/mapper/system/SyncDataChangeBustypesDao.xml b/src/main/resources/mybatis/mapper/system/SyncDataChangeBustypesDao.xml new file mode 100644 index 000000000..d701a9daf --- /dev/null +++ b/src/main/resources/mybatis/mapper/system/SyncDataChangeBustypesDao.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + id, `action`, `name`, outChange, orderStatus + + \ No newline at end of file