From 232cab080647152de06755fbac3d4170629d5b3c Mon Sep 17 00:00:00 2001 From: 叶松 <2217086471@qq.com> Date: 星期二, 26 九月 2023 10:25:58 +0800 Subject: [PATCH] Merge branch 'master' of http://111.30.93.211:10101/r/supipe --- hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java | 4 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java | 3 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java | 22 hd/pipe/materialsManage/src/main/resources/application-pro.yml | 4 hd/pipe/engineeringManage/src/main/resources/application-pro.yml | 2 hd/pipe/filectrl/src/main/resources/application-pro.yml | 2 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java | 1 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java | 22 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java | 4 hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml | 258 ++++++ hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java | 2 hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml | 113 ++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java | 35 hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java | 6 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java | 18 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java | 40 + hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java | 110 ++ hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/netty/NettyServer.java | 6 hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml | 232 +++++ hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java | 248 ++++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java | 70 + hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml | 2 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java | 96 ++ hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java | 2 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java | 32 hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml | 230 +++++ hd/pipe/screen/src/main/resources/application-pro.yml | 2 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java | 72 + hd/pipe/gateway/src/main/resources/application-pro.yml | 6 hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml | 389 +++++++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java | 68 + hd/pipe/mobile/src/main/resources/application-pro.yml | 4 /dev/null | 16 hd/pipe/secure/src/main/resources/application-pro.yml | 4 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java | 49 + hd/pipe/ProjectManage/src/main/resources/application-pro.yml | 4 hd/pipe/StaffManage/src/main/resources/application-pro.yml | 4 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java | 23 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java | 80 ++ hd/pipe/UserCore/src/main/resources/application-pro.yml | 4 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java | 37 41 files changed, 2,262 insertions(+), 64 deletions(-) diff --git a/hd/pipe/ProjectManage/src/main/resources/application-pro.yml b/hd/pipe/ProjectManage/src/main/resources/application-pro.yml index 51ace43..f1dacbe 100644 --- a/hd/pipe/ProjectManage/src/main/resources/application-pro.yml +++ b/hd/pipe/ProjectManage/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8883 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/netty/NettyServer.java b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/netty/NettyServer.java index 7714221..dd652fa 100644 --- a/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/netty/NettyServer.java +++ b/hd/pipe/StaffManage/src/main/java/com/thhy/staff/modules/biz/netty/NettyServer.java @@ -8,6 +8,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @@ -28,6 +29,9 @@ */ private EventLoopGroup work = new NioEventLoopGroup(); + @Value("${netty.port}") + private String port; + /** * 启动Netty Server * @@ -40,7 +44,7 @@ // 指定Channel .channel(NioServerSocketChannel.class) //使用指定的端口设置套接字地址 - .localAddress(new InetSocketAddress(10001)) + .localAddress(new InetSocketAddress(Integer.parseInt(port))) //服务端可连接队列数,对应TCP/IP协议listen函数中backlog参数 .option(ChannelOption.SO_BACKLOG, 1024) diff --git a/hd/pipe/StaffManage/src/main/resources/application-pro.yml b/hd/pipe/StaffManage/src/main/resources/application-pro.yml index 5ad14c2..180c871 100644 --- a/hd/pipe/StaffManage/src/main/resources/application-pro.yml +++ b/hd/pipe/StaffManage/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8882 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml index 4680268..8ff8540 100644 --- a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml +++ b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml @@ -866,7 +866,7 @@ <select id="groupUserWorking" resultType="com.thhy.staff.modules.biz.platuser.entity.GroupWorking"> select sg.group_id as groupId,sg.group_name as groupName, - (select count(user_id) from sys_group_user where group_id = sg.group_id) as groupUserCount + (select count(user_id) from sys_group_user where and is_use = 1 and group_id = sg.group_id) as groupUserCount from sys_group sg left join sys_com_depart sd on sg.depart_id = sd.depart_id where sg.is_use = 1 and sd.company_id = #{companyId} diff --git a/hd/pipe/UserCore/src/main/resources/application-pro.yml b/hd/pipe/UserCore/src/main/resources/application-pro.yml index ddac89d..a041661 100644 --- a/hd/pipe/UserCore/src/main/resources/application-pro.yml +++ b/hd/pipe/UserCore/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8881 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java index 7c46943..79df4c5 100644 --- a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java +++ b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java @@ -37,7 +37,7 @@ String proId = projectMapper.proNameByOne(proName); if(!StringUtil.isEmpty(proId)){ - BasicResult.faild("11111","error","项目名称被占用"); + BasicResult.faild("11111","项目名称被占用",null); } String proNumber =""; SysProject project = projectMapper.newByProject(); diff --git a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java index 25b7dce..288d8ef 100644 --- a/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java +++ b/hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java @@ -95,10 +95,10 @@ public BasicResult segmentUpdate(Map<String, Object> values) { String segmentId1 = values.get("segmentId").toString(); - String segmentName = values.get("segmentName").toString(); + String unitProjectName = values.get("unitProjectName").toString(); - String segmentId = segmentMapper.segmentNameByOne(segmentName); - if(segmentId!=null && !segmentId.equals(segmentId1)){ + String segmentId = segmentMapper.segmentNameByProjectName(unitProjectName); + if(!segmentId1.equals(segmentId)){ return BasicResult.faild("11111","error","标段名称被占用"); } segmentMapper.segmentUpdate(values); diff --git a/hd/pipe/engineeringManage/src/main/resources/application-pro.yml b/hd/pipe/engineeringManage/src/main/resources/application-pro.yml index 1a1133a..6646890 100644 --- a/hd/pipe/engineeringManage/src/main/resources/application-pro.yml +++ b/hd/pipe/engineeringManage/src/main/resources/application-pro.yml @@ -1,7 +1,7 @@ spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/filectrl/src/main/resources/application-pro.yml b/hd/pipe/filectrl/src/main/resources/application-pro.yml index e8dc5f2..012db33 100644 --- a/hd/pipe/filectrl/src/main/resources/application-pro.yml +++ b/hd/pipe/filectrl/src/main/resources/application-pro.yml @@ -1,7 +1,7 @@ spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/gateway/src/main/resources/application-pro.yml b/hd/pipe/gateway/src/main/resources/application-pro.yml index 0e5e88b..bf4520a 100644 --- a/hd/pipe/gateway/src/main/resources/application-pro.yml +++ b/hd/pipe/gateway/src/main/resources/application-pro.yml @@ -1,5 +1,3 @@ -server: - port: 8880 spring: cloud: nacos: @@ -7,12 +5,12 @@ discovery: heart-beat-interval: 3000 heart-beat-timeout: 15000 - group: pipe + group: supipe config: file-extension: yml group: sunacos config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java index a0827e6..a100dca 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java @@ -5,10 +5,7 @@ import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity; import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @Author QiuYuHao @@ -38,4 +35,22 @@ public BasicResult findAll(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){ return sysEmbedmentGoodsService.findAll(embedmentGoodsDto); } + + //查询库存单条 + @GetMapping("/findEntity") + public BasicResult findEntity(@RequestParam String id){ + return sysEmbedmentGoodsService.findEntity(id); + } + //查询规格 + @GetMapping("/findAllDetails") + public BasicResult findAllDetails(String id){ + return sysEmbedmentGoodsService.findAllDetails(id); + } + + //查询dict类型 + @GetMapping("/getType") + public BasicResult getType(){ + return sysEmbedmentGoodsService.getType(); + } + } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java index f511147..d7073b4 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java @@ -1,7 +1,16 @@ package com.thhy.materials.modules.biz.embedment.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.thhy.general.common.BasicResult; +import com.thhy.materials.modules.biz.concret.entity.SysSteelRecord; +import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto; +import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity; +import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** * @Author QiuYuHao @@ -12,5 +21,102 @@ @RequestMapping(value = "embedmentInsetRecord") public class SysInsetRecordsController { + @Autowired + private SysEmbedmentRecordService sysEmbedmentRecordService; + /** + * 新增记录 + * @param sysEmbedmentRecordEntity + * @return + */ + @PostMapping(value = "insert") + public BasicResult insert (@RequestBody SysEmbedmentRecordEntity sysEmbedmentRecordEntity){ + synchronized (this){ + return sysEmbedmentRecordService.insert(sysEmbedmentRecordEntity); + } + } + + /** + * 记录删除 + * @param id + * @return + */ + @GetMapping(value = "embedmentRecordDel") + public BasicResult embedmentRecordDel (@RequestParam String id){ + return sysEmbedmentRecordService.embedmentRecordDel(id); + } + + /** + * 记录修改 + * @param sysEmbedmentRecordEntity + * @return + */ + @PostMapping(value = "update") + BasicResult update(@RequestBody SysEmbedmentRecordEntity sysEmbedmentRecordEntity){ + synchronized (this){ + return sysEmbedmentRecordService.update(sysEmbedmentRecordEntity); + } + } + + /** + * 入库记录查询 + * @param embedmentRecordDto + * @return + */ + @PostMapping(value = "embedmentRecordList") + BasicResult embedmentRecordList(@RequestBody EmbedmentRecordDto embedmentRecordDto){ + return sysEmbedmentRecordService.embedmentRecordList(embedmentRecordDto); + } + + /** + * 出库记录查询 + * @param embedmentRecordDto + * @return + */ + @PostMapping(value = "embedmentRecordOutList") + BasicResult embedmentRecordOutList(@RequestBody EmbedmentRecordDto embedmentRecordDto){ + return sysEmbedmentRecordService.embedmentRecordOutList(embedmentRecordDto); + } + + /** + * 出入库详情查询 + * @param id + * @return + */ + @GetMapping(value = "embedmentRecordInfo") + public BasicResult embedmentRecordInfo (@RequestParam String id){ + return sysEmbedmentRecordService.embedmentRecordInfo(id); + } + + /** + * 导出 + * @param embedmentRecordDto + * @param response + */ + @PostMapping(value = "export") + void export(@RequestBody EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response){ + this.sysEmbedmentRecordService.export(embedmentRecordDto,response); + } + + /** + * 导出模板 + * @param embedmentRecordDto + * @param response + */ + @PostMapping(value = "recordExportTemplate") + void recordExportTemplate(@RequestBody EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response){ + this.sysEmbedmentRecordService.recordExportTemplate(embedmentRecordDto,response); + } + + /** + * 导入 + * @param file + * @param request + */ + @PostMapping(value = "variateExcel") + BasicResult variateExcel(@RequestParam MultipartFile file, HttpServletRequest request){ + synchronized (this){ + return this.sysEmbedmentRecordService.variateExcel(file,request); + } + } } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java index 6dc2fb1..38b7679 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInventoryManagementController.java @@ -41,7 +41,7 @@ * @return */ @PostMapping("/alarmSet") - public BasicResult alarmSet(EmbedmentGoodsDto embedmentGoodsDto){ + public BasicResult alarmSet(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){ return sysEmbedmentGoodsService.alarmSet(embedmentGoodsDto); } @@ -51,7 +51,7 @@ * @return */ @PostMapping("/inventoryCorrection") - public BasicResult inventoryCorrection(EmbedmentGoodsDto embedmentGoodsDto){ + public BasicResult inventoryCorrection(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){ return sysEmbedmentGoodsService.inventoryCorrection(embedmentGoodsDto); } } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java index ee7b802..aa74884 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentGoodsDto.java @@ -14,7 +14,7 @@ private Integer pageSize; - private String embedmentGoodsName; + private String embedmentName; private String companyId; diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java index 79c35b5..b531dfe 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java @@ -12,6 +12,7 @@ public class EmbedmentRecordDto { private String embedmentName; private String embedmentId; + private String embedmentModel; private String companyId; private String supplierId; private String getDepart; diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java index df012b4..f361673 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java @@ -1,6 +1,8 @@ package com.thhy.materials.modules.biz.embedment.entity; import com.fasterxml.jackson.annotation.JsonFormat; +import com.thhy.general.annotations.Excel; +import com.thhy.general.annotations.Idkey; import lombok.Data; import lombok.Getter; import lombok.Setter; @@ -17,16 +19,24 @@ /** * */ + @Idkey("id") private String id; /** * 预埋件ID */ - private String EmbedmentId; + private String embedmentId; //预埋件名称 - private String EmbedmentName; + private String embedmentName; //预埋件规格 - private String EmbedmentModel; + private String embedmentModel; + + @Excel(sort = 1,title = "预埋件名称") + private String embedmentNameAndModel; + + public String getEmbedmentNameAndModel() { + return embedmentName+"-"+embedmentModel; + } /** * 1入库2出库 @@ -36,6 +46,7 @@ /** * 出库量/入库量 */ + @Excel(sort = 2,title = "数量") private Integer changeStock; /** @@ -48,16 +59,19 @@ /** * 单价 */ + @Excel(sort = 3,title = "单价") private BigDecimal singlePrice; /** * 金额 */ + @Excel(sort = 4,title = "金额") private BigDecimal amount; /** * 备注 */ + @Excel(sort = 5,title = "备注") private String remark; /** @@ -79,6 +93,7 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private String createTime; + private String companyId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table sys_assist_record @@ -86,4 +101,5 @@ * @mbg.generated Tue Apr 11 09:37:48 CST 2023 */ private static final long serialVersionUID = 1L; + } \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java index ad40e29..c568880 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * @Author QiuYuHao @@ -25,8 +26,9 @@ SysEmbedmentGoodsEntity findEntity(String id); - String embedmentNameAndType(@Param("embedmentGoodsName") String embedmentGoodsName, @Param("embedmentType") String embedmentType); + String embedmentNameAndType(@Param("embedmentName") String embedmentGoodsName, @Param("embedmentType") String embedmentType,@Param("embedmentModel")String embedmentModel); void alarmSet(EmbedmentGoodsDto embedmentGoodsDto); + List<Map<String,Object>> getType(); } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java index f638a2c..075ac33 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java @@ -21,6 +21,8 @@ BasicResult findAll(EmbedmentGoodsDto embedmentGoodsDto); + BasicResult findAllDetails(String id); + BasicResult findEntity(String id); void export(EmbedmentGoodsDto embedmentGoodsDto, HttpServletResponse response); @@ -31,4 +33,5 @@ BasicResult inventoryList(EmbedmentGoodsDto embedmentGoodsDto); + BasicResult getType(); } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java new file mode 100644 index 0000000..b197edd --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java @@ -0,0 +1,49 @@ +package com.thhy.materials.modules.biz.embedment.service; + +import com.thhy.general.common.BasicResult; +import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto; +import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Author QiuYuHao + * @CreateDate 2023-09-22 16:27:16 + * 预埋件出入库接口 + */ +public interface SysEmbedmentRecordService { + BasicResult insert(SysEmbedmentRecordEntity sysEmbedmentRecordEntity); + + BasicResult embedmentRecordDel(String id); + + BasicResult update(SysEmbedmentRecordEntity sysEmbedmentRecordEntity); + + /** + * 入库列表 + * @param embedmentRecordDto + * @return + */ + BasicResult embedmentRecordList(EmbedmentRecordDto embedmentRecordDto); + + /** + * 出库列表 + * @param embedmentRecordDto + * @return + */ + BasicResult embedmentRecordOutList(EmbedmentRecordDto embedmentRecordDto); + + /** + * 查询单条 + * @param id + * @return + */ + BasicResult embedmentRecordInfo(String id); + + void export(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response); + + void recordExportTemplate(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response); + + BasicResult variateExcel(MultipartFile file, HttpServletRequest request); +} diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java index 31bada5..fd26613 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java @@ -21,9 +21,9 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; -import java.util.Date; import java.util.List; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * @Author QiuYuHao @@ -43,13 +43,19 @@ private SysEmbedmentCorrectionMapper sysEmbedmentCorrectionMapper; //=======================种类到此开始======================= + + @Override + public BasicResult getType() { + return BasicResult.success(sysEmbedmentGoodsMapper.getType()); + } @Override public BasicResult insert(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity) { SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); sysEmbedmentGoodsEntity.setCompanyId(sysUserInfo.getCompanyId()); String embedmentName = sysEmbedmentGoodsEntity.getEmbedmentName(); String embedmentType = sysEmbedmentGoodsEntity.getEmbedmentType(); - String id = sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType); + String embedmentModel = sysEmbedmentGoodsEntity.getEmbedmentModel(); + String id = sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType, embedmentModel); if(!StringUtil.isEmpty(id)){ return BasicResult.faild("11111","error","名称和规格型号不可重复"); } @@ -69,8 +75,9 @@ sysEmbedmentGoodsEntity.setCompanyId(sysUserInfo.getCompanyId()); String embedmentName = sysEmbedmentGoodsEntity.getEmbedmentName(); String embedmentType = sysEmbedmentGoodsEntity.getEmbedmentType(); - String id = sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType); - if(!StringUtil.isEmpty(id)){ + String embedmentModel = sysEmbedmentGoodsEntity.getEmbedmentModel(); + String id = sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,embedmentType, embedmentModel); + if(!StringUtil.isEmpty(id) && !sysEmbedmentGoodsEntity.getId().equals(id)){ return BasicResult.faild("11111","error","名称和规格型号不可重复"); } sysEmbedmentGoodsMapper.update(sysEmbedmentGoodsEntity); @@ -92,6 +99,12 @@ return BasicResult.success(sysEmbedmentGoodsMapper.findEntity(id)); } + + + @Override + public BasicResult findAllDetails(String id) { + return BasicResult.success(sysEmbedmentGoodsMapper.findEntity(id).getEmbedmentModel()); + } //=======================种类到此结束======================= //=======================库存管理开始======================= @@ -170,6 +183,7 @@ PageInfo<SysEmbedmentCorrectionEntity> pageInfo = new PageInfo<>(sysEmbedmentCorrectionEntities); return BasicResult.success(pageInfo); } + //=======================校正记录结束======================= } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java new file mode 100644 index 0000000..73740a3 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java @@ -0,0 +1,248 @@ +package com.thhy.materials.modules.biz.embedment.service.impl; + +import cn.hutool.core.text.StrBuilder; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.thhy.general.common.BasicMessage; +import com.thhy.general.common.BasicResult; +import com.thhy.general.config.SysUserInfo; +import com.thhy.general.exception.BasicException; +import com.thhy.general.utils.ExcelUtils; +import com.thhy.general.utils.UserInfoUtils; +import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto; +import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity; +import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity; +import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentGoodsMapper; +import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentRecordMapper; +import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentRecordService; +import com.thhy.materials.modules.biz.materials.entity.SysAssistGood; +import com.thhy.materials.modules.biz.utils.ExcelUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.DataValidation; +import org.apache.poi.ss.usermodel.DataValidationConstraint; +import org.apache.poi.ss.usermodel.DataValidationHelper; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.util.IOUtils; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @Author QiuYuHao + * @CreateDate 2023-09-22 16:28:24 + * 预埋件出入库实现 + */ +@Service +public class SysEmbedmentRecordServiceImpl implements SysEmbedmentRecordService{ + + @Autowired + private SysEmbedmentRecordMapper sysEmbedmentRecordMapper; + + @Autowired + private SysEmbedmentGoodsMapper sysEmbedmentGoodsMapper; + + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult insert(SysEmbedmentRecordEntity sysEmbedmentRecordEntity) { + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + sysEmbedmentRecordEntity.setCreateUser(sysUserInfo.getRealName()); + sysEmbedmentRecordEntity.setCompanyId(sysUserInfo.getCompanyId()); + SysEmbedmentGoodsEntity entity = sysEmbedmentGoodsMapper.findEntity(sysEmbedmentRecordEntity.getEmbedmentId()); + if(entity!=null){ + String stockType = sysEmbedmentRecordEntity.getStockType(); + //stockType 1入库 2出库 + int result = entity.getStock(); + if("1".equals(stockType)){ + result= entity.getStock() + sysEmbedmentRecordEntity.getChangeStock(); + }else{ + result= entity.getStock() - sysEmbedmentRecordEntity.getChangeStock(); + } + if(result < 0 ){ + return BasicResult.faild("11111","库存不足","库存不足"); + } + entity.setStock(result); + sysEmbedmentGoodsMapper.update(entity);//更改库存 + }else { + return BasicResult.faild("11111","库存没有该预埋件,请到【预埋件种类】添加","库存没有该预埋件,请到【预埋件种类】添加"); + } + sysEmbedmentRecordMapper.insert(sysEmbedmentRecordEntity); + return BasicResult.success(); + } + + @Override + public BasicResult embedmentRecordDel(String id) { + sysEmbedmentRecordMapper.embedmentRecordDel(id); + return BasicResult.success(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult update(SysEmbedmentRecordEntity sysEmbedmentRecordEntity) { + String id = sysEmbedmentRecordEntity.getId();//记录id + String embedmentId = sysEmbedmentRecordEntity.getEmbedmentId();//库存id + SysEmbedmentRecordEntity queryRecordData = sysEmbedmentRecordMapper.embedmentRecordInfo(id);//查询到的记录 + Integer dataChangeStock = queryRecordData.getChangeStock();//拿到修改前的入库数量 + Integer paramChangeStock = sysEmbedmentRecordEntity.getChangeStock();//当前传输入库数量 + Integer nowChangeStock = paramChangeStock - dataChangeStock;//当前传的和库里的取差值 + SysEmbedmentGoodsEntity entity = sysEmbedmentGoodsMapper.findEntity(embedmentId); + Integer resultStock = entity.getStock() + nowChangeStock; + entity.setStock(resultStock); + sysEmbedmentGoodsMapper.update(entity); + sysEmbedmentRecordMapper.update(sysEmbedmentRecordEntity); + return BasicResult.success(); + } + + @Override + public BasicResult embedmentRecordList(EmbedmentRecordDto embedmentRecordDto) { + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId()); + PageHelper.startPage(embedmentRecordDto.getPageNum(),embedmentRecordDto.getPageSize()); + List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordList(embedmentRecordDto); + PageInfo<SysEmbedmentRecordEntity> info = new PageInfo<>(sysEmbedmentRecordEntities); + return BasicResult.success(info); + } + + @Override + public BasicResult embedmentRecordOutList(EmbedmentRecordDto embedmentRecordDto) { + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId()); + PageHelper.startPage(embedmentRecordDto.getPageNum(),embedmentRecordDto.getPageSize()); + List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordOutList(embedmentRecordDto); + PageInfo<SysEmbedmentRecordEntity> info = new PageInfo<>(sysEmbedmentRecordEntities); + return BasicResult.success(info); + } + + @Override + public BasicResult embedmentRecordInfo(String id) { + return BasicResult.success(sysEmbedmentRecordMapper.embedmentRecordInfo(id)); + } + + @Override + public void export(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response) { + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId()); + List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordList(embedmentRecordDto); + ExcelUtils.downExcel(sysEmbedmentRecordEntities,SysEmbedmentRecordEntity.class,response,"预埋件入库"); + } + + @Override + public void recordExportTemplate(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response) { + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + String companyId = sysUserInfo.getCompanyId(); + XSSFWorkbook book = new XSSFWorkbook(); + XSSFSheet sheet = book.createSheet(); + XSSFRow row = sheet.createRow(0); + row.createCell(0).setCellValue("物品名称-规格型号"); + row.createCell(1).setCellValue("入库数量"); + row.createCell(2).setCellValue("单价"); + row.createCell(3).setCellValue("金额"); + row.createCell(4).setCellValue("备注"); + embedmentRecordDto.setCompanyId(companyId); + List<String> lx = sysEmbedmentRecordMapper.embedmentRecordList(embedmentRecordDto).stream().map(s -> s.getEmbedmentNameAndModel()).collect(Collectors.toList()); + String[] gjlx = lx.toArray(new String[lx.size()]); + + //物品名称-规格型号 + CellRangeAddressList regions1 = new CellRangeAddressList(1, 500, 0, 0); + DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper(); + DataValidationConstraint createExplicitListConstraint1 = dataValidationHelper.createExplicitListConstraint(gjlx); + DataValidation createValidation1 = dataValidationHelper.createValidation(createExplicitListConstraint1, regions1); + sheet.addValidationData(createValidation1); + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + response.setHeader("Content-Disposition", "attachment;filename=test.xls"); + OutputStream out = null; + try { + out = response.getOutputStream(); + book.write(out); + out.close(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + IOUtils.closeQuietly(out); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public BasicResult variateExcel(MultipartFile file, HttpServletRequest request) { + List<List<Object>> lists = null;//去工具类处理,返回excel中的数据 + try { + lists = ExcelUtil.getUserListByExcel(file.getInputStream(), file.getOriginalFilename()); + } catch (Exception e) { + e.printStackTrace(); + } + lists.remove(0); + if (lists.size()>0){ + for (List<Object> list :lists){ + String embedmentNameAndModel = list.get(0).toString(); + String[] split = embedmentNameAndModel.split("-"); + String embedmentName = split[0]; + StringBuilder embedmentModel = new StringBuilder(); + for (int i = 1; i < split.length; i++) { + if (StringUtils.isBlank(embedmentModel)){ + embedmentModel.append(split[i]); + }else { + embedmentModel.append("-"+split[i]); + } + + } + String id = sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,null, embedmentModel.toString()); + if(StringUtils.isBlank(id)) { + throw new BasicException(new BasicMessage("500","库存没有【"+embedmentName+"】,请到预埋件种类新增,新增完可重新导入!")); + } + SysEmbedmentRecordEntity sysEmbedmentRecordEntity = new SysEmbedmentRecordEntity(); + sysEmbedmentRecordEntity.setEmbedmentId(id); + //入库数量 + Integer changeStock = Integer.valueOf(list.get(1).toString()); + sysEmbedmentRecordEntity.setChangeStock(changeStock); + //单价 + String dj = list.get(2).toString(); + BigDecimal singlePrice = new BigDecimal(dj); + sysEmbedmentRecordEntity.setSinglePrice(singlePrice); + //金额 + String je = list.get(3).toString(); + BigDecimal amount = new BigDecimal(je); + sysEmbedmentRecordEntity.setAmount(amount); + //备注 + String remark = list.get(4).toString(); + sysEmbedmentRecordEntity.setRemark(remark); + //入库人 + SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo(); + String companyId = sysUserInfo.getCompanyId(); + sysEmbedmentRecordEntity.setCreateUser(sysUserInfo.getRealName()); + sysEmbedmentRecordEntity.setCompanyId(companyId); + //stockType 1入库 + sysEmbedmentRecordEntity.setStockType("1"); + SysEmbedmentGoodsEntity entity = sysEmbedmentGoodsMapper.findEntity(sysEmbedmentRecordEntity.getEmbedmentId()); + if(entity!=null){ + int result = entity.getStock() + sysEmbedmentRecordEntity.getChangeStock(); + entity.setStock(result); + sysEmbedmentGoodsMapper.update(entity);//更改库存 + }else { + throw new BasicException(new BasicMessage("500","库存没有【"+embedmentName+"】,请到预埋件种类新增,新增完可重新导入!")); + } + sysEmbedmentRecordMapper.insert(sysEmbedmentRecordEntity); + } + return BasicResult.success("导入成功"); + }else { + return BasicResult.faild("11111","error","空文件"); + } + } + + +} diff --git a/hd/pipe/materialsManage/src/main/resources/application-pro.yml b/hd/pipe/materialsManage/src/main/resources/application-pro.yml index 7b7de76..f1dacbe 100644 --- a/hd/pipe/materialsManage/src/main/resources/application-pro.yml +++ b/hd/pipe/materialsManage/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8892 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml new file mode 100644 index 0000000..3ee406b --- /dev/null +++ b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml @@ -0,0 +1,389 @@ +<?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.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentCorrectionMapper"> + + <insert id="insert" > + insert into sys_embedment_correction + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="embedmentId != null"> + embedment_id, + </if> + <if test="correctionBefore != null"> + correction_before, + </if> + <if test="correctionNum != null"> + correction_num, + </if> + <if test="correctionAfter != null"> + correction_after, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="createUser != null"> + create_user, + </if> + <if test="remark != null"> + remark, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="embedmentId != null"> + #{embedmentId,jdbcType=VARCHAR}, + </if> + <if test="correctionBefore != null"> + #{correctionBefore,jdbcType=INTEGER}, + </if> + <if test="correctionNum != null"> + #{correctionNum,jdbcType=INTEGER}, + </if> + <if test="correctionAfter != null"> + #{correctionAfter,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="createUser != null"> + #{createUser,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="inventoryList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentCorrectionEntity"> + select + sac.id, + sac.embedment_id as embedmentId, + sac.correction_before as correctionBefore, + sac.correction_num as correctionNum, + sac.correction_after as correctionAfter, + sac.create_time as createTime, + sac.create_user as createUser, + sac.remark as remark, + sag.embedment_name as embedmentName, + sag.embedment_model as embedmentModel, + sag.unit + from sys_embedment_correction sac + left join sys_embedment_goods sag on sac.embedment_id=sag.id + where 1=1 + <if test="embedmentName!=null and embedmentName!='' "> + and sag.embedment_name like concat('%',#{embedmentName},'%') + </if> + <if test="companyId!=null and companyId!='' "> + and sag.company_id=#{companyId} + </if> + order by sac.create_time desc + + </select> + <select id="assistRecordList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord"> + select sar.id, + sar.assist_id as assistId, + sar.stock_type as stockType, + sar.change_stock as changeStock, + sar.supplier_id as supplierId, + sar.single_price as singlePrice, + sar.amount as amount, + sar.remark as remark, + sar.get_depart as getDepart, + sar.create_user as createUser, + sar.create_time as createTime, + sar.is_use as isUse, + sag.assist_name as assistName, + sag.assist_model as assistModel, + ss.supplier_name as supplierName, + su.real_name as realName + from sys_assist_record sar + left join sys_assist_good sag on sar.assist_id=sag.id + left join sys_supplier ss on sar.supplier_id=ss.id + left join sys_users su on su.user_id=sar.create_user + where sar.is_use=1 and sar.stock_type=1 + <if test="assistName!=null and assistName!='' "> + and sag.assist_name like concat('%',#{assistName},'%') + </if> + <if test="assistId!=null and assistId!='' "> + and sar.assist_id=#{assistId} + </if> + <if test="companyId!=null and companyId!='' "> + and sar.company_id=#{companyId} + </if> + <if test="realName!=null and realName!='' "> + and su.real_name like concat('%',#{realName},'%') + </if> + <if test="supplierId!=null and supplierId!='' "> + and sar.supplier_id=#{supplierId} + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and sar.create_time between #{strTime}and #{endTime} + </if> + order by sar.create_time desc + </select> + <select id="assistRecordOutList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord"> + select + sar.id, + sar.assist_id as assistId, + sar.stock_type as stockType, + sar.change_stock as changeStock, + sar.supplier_id as supplierId, + sar.single_price as singlePrice, + sar.amount as amount, + sar.remark as remark, + sar.get_depart as getDepart, + sar.create_user as createUser, + sar.create_time as createTime, + sar.is_use as isUse, + sag.assist_name as assistName, + sag.assist_model as assistModel, + su.real_name as realName, + sd.depart_name as departName from sys_assist_record sar + left join sys_assist_good sag on sar.assist_id=sag.id + left join sys_users su on su.user_id=sar.create_user + left join sys_depart sd on sd.depart_id=sar.get_depart + where sar.is_use=1 and sar.stock_type=2 + <if test="assistName!=null and assistName!='' "> + and sag.assist_name like concat('%',#{assistName},'%') + </if> + <if test="assistId!=null and assistId!='' "> + and sar.assist_id=#{assistId} + </if> + <if test="companyId!=null and companyId!='' "> + and sar.company_id=#{companyId} + </if> + <if test="realName!=null and realName!='' "> + and su.real_name like concat('%',#{realName},'%') + </if> + <if test="supplierId!=null and supplierId!='' "> + and sar.supplier_id=#{supplierId} + </if> + <if test="getDepart!=null and getDepart!='' "> + and sd.depart_name like concat('%',#{getDepart},'%') + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and sar.create_time between #{strTime} and #{endTime} + </if> + order by sar.create_time desc + </select> + <select id="assistRecordInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord"> + select + sar.id, + sar.assist_id as assistId, + sar.stock_type as stockType, + sar.change_stock as changeStock, + sar.supplier_id as supplierId, + sar.single_price as singlePrice, + sar.amount as amount, + sar.remark as remark, + sar.get_depart as getDepart, + sar.create_user as createUser, + sar.create_time as createTime, + sar.is_use as isUse, + sag.assist_name as assistName, + sag.assist_model as assistModel, + ss.supplier_name as supplierName, + su.real_name as realName from sys_assist_record sar + left join sys_assist_good sag on sar.assist_id=sag.id + left join sys_supplier ss on sar.supplier_id=ss.id + left join sys_users su on su.user_id=sar.create_user + where sar.is_use=1 and sar.id=#{id} + </select> + + <select id="assistIdSelect" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord"> + select + sar.id, + sar.assist_id as assistId, + sar.stock_type as stockType, + sar.change_stock as changeStock, + sar.supplier_id as supplierId, + sar.single_price as singlePrice, + sar.amount as amount, + sar.remark as remark, + sar.get_depart as getDepart, + sar.create_user as createUser, + sar.create_time as createTime, + sar.is_use as isUse + from sys_assist_record sar where sar.id=#{id} + </select> + <update id="assistRecordDel" > + update sys_assist_record set + is_use=2 + where id=#{id} + </update> + <insert id="assistCheckInsert"> + insert into sys_assist_correction + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="assistId != null"> + assist_id, + </if> + <if test="correctionBefore != null"> + correction_before, + </if> + <if test="correctionNum != null"> + correction_num, + </if> + <if test="correctionAfter != null"> + correction_after, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="createUser != null"> + create_user, + </if> + <if test="remark != null"> + remark, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="assistId != null"> + #{assistId,jdbcType=VARCHAR}, + </if> + <if test="correctionBefore != null"> + #{correctionBefore,jdbcType=INTEGER}, + </if> + <if test="correctionNum != null"> + #{correctionNum,jdbcType=INTEGER}, + </if> + <if test="correctionAfter != null"> + #{correctionAfter,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="createUser != null"> + #{createUser,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="assistCorrectionList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistCorrection"> + select sac.id, + sac.assist_id as assistId, + sac.correction_before as correctionBefore, + sac.correction_num as correctionNum, + sac.correction_after as correctionAfter, + sac.create_time as createTime, + sac.create_user as createUser, + sac.remark as remark, + sag.assist_name as assistName, + sag.assist_model as assistModel, + sag.unit, + su.real_name as realName + from sys_assist_correction sac + left join sys_assist_good sag on sac.assist_id=sag.id + left join sys_users su on su.user_id=sac.create_user + where 1=1 + <if test="assistName!=null and assistName!='' "> + and sag.assist_name like concat('%',#{assistName},'%') + </if> + <if test="companyId!=null and companyId!='' "> + and sag.company_id=#{companyId} + </if> + order by sac.create_time desc + </select> + + <select id="assistStatisticsDay" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistStatisticsDto"> + SELECT + sar.assist_id AS assistId, + sag.assist_name AS assistName, + sag.assist_model AS assistModel, + DATE( sar.create_time ) AS getDate, + SUM( sar.change_stock ) AS changeStock +FROM + sys_assist_record sar + LEFT JOIN sys_assist_good sag ON sar.assist_id = sag.id +WHERE + sar.stock_type = 2 + AND sar.is_use = 1 + <if test="assistId!=null and assistId!='' "> + and sar.assist_id=#{assistId} + </if> + <if test="companyId!=null and companyId!='' "> + and sag.company_id=#{companyId} + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and DATE( sar.create_time ) between #{strTime} and #{endTime} + </if> +GROUP BY + DATE( sar.create_time ), + sar.assist_id + </select> + <select id="assistStatisticsMonth" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistStatisticsDto"> + SELECT + sar.assist_id AS assistId, + sag.assist_name AS assistName, + sag.assist_model AS assistModel, + CONCAT( + CONCAT( YEAR ( sar.create_time ), '-' ), + IF + ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )) AS getDate, + SUM( sar.change_stock ) AS changeStock +FROM + sys_assist_record sar + LEFT JOIN sys_assist_good sag ON sar.assist_id = sag.id +WHERE + sar.stock_type = 2 + AND sar.is_use = 1 + <if test="assistId!=null and assistId!='' "> + and sar.assist_id=#{assistId} + </if> + <if test="companyId!=null and companyId!='' "> + and sag.company_id=#{companyId} + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and CONCAT( + CONCAT( YEAR ( sar.create_time ), '-' ), + IF + ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )) between #{strTime} and #{endTime} + </if> +GROUP BY + CONCAT( + CONCAT( YEAR ( sar.create_time ), '-' ), + IF + ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )), + sar.assist_id + + </select> + <select id="assistRecordPull" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistGoodPullDto"> + SELECT + id AS assistId, + assist_name AS assistName, + assist_model AS assistModel + FROM + sys_assist_good + WHERE + is_use =1 + <if test="companyId!=null and companyId!='' "> + and company_id=#{companyId} + </if> + </select> + <select id="assistRecordPullS" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistGoodPullDto"> + SELECT + id AS assistId, + assist_name AS assistName, + assist_model AS assistModel + FROM + sys_assist_good + WHERE + is_use =1 + <if test="companyId!=null and companyId!='' "> + and company_id=#{companyId} + </if> + <if test="assistId!=null and assistId!='' "> + and id=#{assistId} + </if> + </select> +</mapper> \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml new file mode 100644 index 0000000..eeb2776 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml @@ -0,0 +1,232 @@ +<?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.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentGoodsMapper"> + <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity"> + <!-- + WARNING - @mbg.generated + This element is automatically generated by MyBatis Generator, do not modify. + This element was generated on Tue Apr 11 08:58:47 CST 2023. + --> + <id column="id" jdbcType="VARCHAR" property="id" /> + <result column="embedment_name" jdbcType="VARCHAR" property="embedmentName" /> + <result column="embedment_type" jdbcType="VARCHAR" property="embedmentType" /> + <result column="embedment_model" jdbcType="VARCHAR" property="embedmentModel" /> + <result column="unit" jdbcType="VARCHAR" property="unit" /> + <result column="stock" jdbcType="INTEGER" property="stock" /> + <result column="position" jdbcType="VARCHAR" property="position" /> + <result column="alarm_count" jdbcType="INTEGER" property="alarmCount" /> + <result column="is_use" jdbcType="INTEGER" property="isUse" /> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> + <result column="create_user" jdbcType="VARCHAR" property="createUser" /> + </resultMap> + <select id="embedmentNameAndType" resultType="java.lang.String"> + select id from sys_embedment_goods where is_use=1 + <if test="embedmentName != null"> + and embedment_name=#{embedmentName} + </if> + <if test="embedmentType != null"> + and embedment_type=#{embedmentType} + </if> + <if test="embedmentModel != null"> + and embedment_model=#{embedmentModel} + </if> + + + </select> + <insert id="insert" > + insert into sys_embedment_goods + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="embedmentName != null"> + embedment_name, + </if> + <if test="embedmentType != null"> + embedment_type, + </if> + <if test="embedmentModel != null"> + embedment_model, + </if> + <if test="unit != null"> + unit, + </if> + <if test="stock != null"> + stock, + </if> + <if test="position != null"> + `position`, + </if> + <if test="alarmCount != null"> + alarm_count, + </if> + <if test="isUse != null"> + is_use, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="createUser != null"> + create_user, + </if> + <if test="remark != null"> + remark, + </if> + <if test="companyId != null"> + company_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="embedmentName != null"> + #{embedmentName,jdbcType=VARCHAR}, + </if> + <if test="embedmentType != null"> + #{embedmentType,jdbcType=VARCHAR}, + </if> + <if test="embedmentModel != null"> + #{embedmentModel,jdbcType=VARCHAR}, + </if> + <if test="unit != null"> + #{unit,jdbcType=VARCHAR}, + </if> + <if test="stock != null"> + #{stock,jdbcType=INTEGER}, + </if> + <if test="position != null"> + #{position,jdbcType=VARCHAR}, + </if> + <if test="alarmCount != null"> + #{alarmCount,jdbcType=INTEGER}, + </if> + <if test="isUse != null"> + #{isUse,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="createUser != null"> + #{createUser,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + <if test="companyId != null"> + #{companyId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + + <select id="findAll" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity"> + select sag.id, + sag.embedment_name as embedmentName, + sag.embedment_type as embedmentType, + sag.embedment_model as embedmentModel, + sag.unit as unit, + sag.stock as stock, + sag.position as 'position', + sag.alarm_count as alarmCount, + sag.is_use as isUse, + sag.create_time as createTime, + sag.remark as remark, + sd.dict_name as dictName + from sys_embedment_goods sag + left join sys_dict sd on sag.embedment_type=sd.dict_id + where sag.is_use=1 + <if test="embedmentName!=null and embedmentName!='' "> + and sag.embedment_name like concat('%',#{embedmentName},'%') + </if> + <if test="companyId!=null and companyId!='' "> + and sag.company_id=#{companyId} + </if> + <if test="id!=null and id!='' "> + and sag.id=#{id} + </if> + + order by sag.create_time desc + </select> + <select id="findEntity" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity"> + select sag.id, + sag.embedment_name as embedmentName, + sag.embedment_type as embedmentType, + sag.embedment_model as embedmentModel, + sag.unit as unit, + sag.stock as stock, + sag.position as 'position', + sag.alarm_count as alarmCount, + sag.is_use as isUse, + sag.create_time as createTime, + sag.remark as remark, + sd.dict_name as dictName from sys_embedment_goods sag left join sys_dict sd + on sag.embedment_type=sd.dict_id + where sag.is_use=1 and sag.id=#{id} + </select> + <update id="delete" parameterType="java.lang.String" > + update sys_embedment_goods set + is_use=2 + where id=#{id} + </update> + + <update id="alarmSet"> + update sys_embedment_goods set alarm_count = #{alarmCount} + where id=#{id} + </update> + + <select id="getType" resultType="java.util.Map"> + select + sd.dict_id as dictId, + sd.dict_type as dictType, + sd.dict_name as dictName, + sd.dict_value as dictValue, + sd.colors as colors, + sd.create_time as createTime, + sdt.dict_type_name as dictTypeName + from sys_dict sd + left join sys_dict_type sdt on sd.dict_type=sdt.dict_type + where + sd.is_use = 1 + and sd.dict_type='embedment' + </select> + <update id="update" > + update sys_embedment_goods + <set> + <if test="embedmentName != null"> + embedment_name = #{embedmentName,jdbcType=VARCHAR}, + </if> + <if test="embedmentType != null"> + embedment_type = #{embedmentType,jdbcType=VARCHAR}, + </if> + <if test="embedmentModel != null"> + embedment_model = #{embedmentModel,jdbcType=VARCHAR}, + </if> + <if test="unit != null"> + unit = #{unit,jdbcType=VARCHAR}, + </if> + <if test="stock != null"> + stock = #{stock,jdbcType=INTEGER}, + </if> + <if test="position != null"> + position = #{position,jdbcType=VARCHAR}, + </if> + <if test="alarmCount != null"> + alarm_count = #{alarmCount,jdbcType=INTEGER}, + </if> + <if test="isUse != null"> + is_use = #{isUse,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + create_time = #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="createUser != null"> + create_user = #{createUser,jdbcType=VARCHAR}, + </if> + <if test="remark != null"> + remark = #{remark,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=VARCHAR} + </update> + +</mapper> \ No newline at end of file diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml new file mode 100644 index 0000000..481cae8 --- /dev/null +++ b/hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml @@ -0,0 +1,258 @@ +<?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.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentRecordMapper"> + <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity"> + <!-- + WARNING - @mbg.generated + This element is automatically generated by MyBatis Generator, do not modify. + This element was generated on Tue Apr 11 09:37:48 CST 2023. + --> + <id column="id" jdbcType="VARCHAR" property="id" /> + <result column="embedment_id" jdbcType="VARCHAR" property="embedmentId" /> + <result column="stock_type" jdbcType="VARCHAR" property="stockType" /> + <result column="change_stock" jdbcType="INTEGER" property="changeStock" /> + <result column="supplier_id" jdbcType="VARCHAR" property="supplierId" /> + <result column="single_price" jdbcType="DECIMAL" property="singlePrice" /> + <result column="amount" jdbcType="DECIMAL" property="amount" /> + <result column="remark" jdbcType="VARCHAR" property="remark" /> + <result column="get_depart" jdbcType="VARCHAR" property="getDepart" /> + <result column="create_user" jdbcType="VARCHAR" property="createUser" /> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> + </resultMap> + + <update id="update" > + update sys_embedment_record + <set> + <if test="embedmentId != null"> + embedment_id = #{embedmentId,jdbcType=VARCHAR}, + </if> + <if test="stockType != null"> + stock_type = #{stockType,jdbcType=VARCHAR}, + </if> + <if test="changeStock != null"> + change_stock = #{changeStock,jdbcType=INTEGER}, + </if> + <if test="supplierId != null"> + supplier_id = #{supplierId,jdbcType=VARCHAR}, + </if> + <if test="singlePrice != null"> + single_price = #{singlePrice,jdbcType=DECIMAL}, + </if> + <if test="amount != null"> + amount = #{amount,jdbcType=DECIMAL}, + </if> + <if test="remark != null"> + remark = #{remark,jdbcType=VARCHAR}, + </if> + <if test="getDepart != null"> + get_depart = #{getDepart,jdbcType=VARCHAR}, + </if> + <if test="createUser != null"> + create_user = #{createUser,jdbcType=VARCHAR}, + </if> + <if test="createTime != null"> + create_time = #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="companyId != null"> + company_id = #{companyId,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=VARCHAR} + </update> + + <insert id="insert" > + insert into sys_embedment_record + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="embedmentId != null"> + embedment_id, + </if> + <if test="stockType != null"> + stock_type, + </if> + <if test="changeStock != null"> + change_stock, + </if> + <if test="supplierId != null"> + supplier_id, + </if> + <if test="singlePrice != null"> + single_price, + </if> + <if test="amount != null"> + amount, + </if> + <if test="remark != null"> + remark, + </if> + <if test="getDepart != null"> + get_depart, + </if> + <if test="createUser != null"> + create_user, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="companyId != null"> + company_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=VARCHAR}, + </if> + <if test="embedmentId != null"> + #{embedmentId,jdbcType=VARCHAR}, + </if> + <if test="stockType != null"> + #{stockType,jdbcType=VARCHAR}, + </if> + <if test="changeStock != null"> + #{changeStock,jdbcType=INTEGER}, + </if> + <if test="supplierId != null"> + #{supplierId,jdbcType=VARCHAR}, + </if> + <if test="singlePrice != null"> + #{singlePrice,jdbcType=DECIMAL}, + </if> + <if test="amount != null"> + #{amount,jdbcType=DECIMAL}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + <if test="getDepart != null"> + #{getDepart,jdbcType=VARCHAR}, + </if> + <if test="createUser != null"> + #{createUser,jdbcType=VARCHAR}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="companyId != null"> + #{companyId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + + <select id="embedmentRecordList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity"> + select + CONCAT(seg.embedment_name,"-",seg.embedment_model) embedmentNameAndModel, + ser.id, + ser.embedment_id as embedmentId, + ser.stock_type as stockType, + ser.change_stock as changeStock, + ser.supplier_id as supplierId, + ser.single_price as singlePrice, + ser.amount as amount, + ser.remark as remark, + ser.get_depart as getDepart, + ser.create_user as createUser, + ser.create_time as createTime, + ser.is_use as isUse, + seg.embedment_name as embedmentName, + seg.embedment_model as embedmentModel, + sd.depart_name as departName + from sys_embedment_record ser + left join sys_embedment_goods seg on ser.embedment_id=seg.id + left join sys_depart sd on sd.depart_id=ser.get_depart + where ser.is_use=1 and ser.stock_type=1 + <if test="embedmentName!=null and embedmentName!='' "> + and seg.embedment_name like concat('%',#{embedmentName},'%') + </if> + <if test="embedmentId!=null and embedmentId!='' "> + and ser.embedment_id=#{embedmentId} + </if> + <if test="companyId!=null and companyId!='' "> + and ser.company_id=#{companyId} + </if> + <if test="supplierId!=null and supplierId!='' "> + and ser.supplier_id=#{supplierId} + </if> + <if test="getDepart!=null and getDepart!='' "> + and sd.depart_name like concat('%',#{getDepart},'%') + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and ser.create_time between #{strTime} and #{endTime} + </if> + order by ser.create_time desc + </select> + <select id="embedmentRecordOutList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity"> + select + ser.id, + ser.embedment_id as embedmentId, + ser.stock_type as stockType, + ser.change_stock as changeStock, + ser.supplier_id as supplierId, + ser.single_price as singlePrice, + ser.amount as amount, + ser.remark as remark, + ser.get_depart as getDepart, + ser.create_user as createUser, + ser.create_time as createTime, + ser.is_use as isUse, + seg.embedment_name as embedmentName, + seg.embedment_model as embedmentModel, + sd.depart_name as departName + from sys_embedment_record ser + left join sys_embedment_goods seg on ser.embedment_id=seg.id + left join sys_depart sd on sd.depart_id=ser.get_depart + where ser.is_use=1 and ser.stock_type=2 + <if test="embedmentName!=null and embedmentName!='' "> + and seg.embedment_name like concat('%',#{embedmentName},'%') + </if> + <if test="embedmentId!=null and embedmentId!='' "> + and ser.embedment_id=#{embedmentId} + </if> + <if test="companyId!=null and companyId!='' "> + and ser.company_id=#{companyId} + </if> + <if test="supplierId!=null and supplierId!='' "> + and ser.supplier_id=#{supplierId} + </if> + <if test="getDepart!=null and getDepart!='' "> + and sd.depart_name like concat('%',#{getDepart},'%') + </if> + <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' "> + and ser.create_time between #{strTime} and #{endTime} + </if> + order by ser.create_time desc + </select> + <select id="embedmentRecordInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity"> + select + ser.id, + ser.embedment_id as embedmentId, + ser.stock_type as stockType, + ser.change_stock as changeStock, + ser.supplier_id as supplierId, + ser.single_price as singlePrice, + ser.amount as amount, + ser.remark as remark, + ser.get_depart as getDepart, + ser.create_user as createUser, + ser.create_time as createTime, + ser.is_use as isUse, + seg.embedment_name as embedmentName, + seg.embedment_model as embedmentModel, + sd.depart_name as departName + from sys_embedment_record ser + left join sys_embedment_goods seg on ser.embedment_id=seg.id + left join sys_depart sd on sd.depart_id=ser.get_depart + where ser.is_use=1 and ser.id=#{id} + </select> + + <update id="embedmentRecordDel" > + update sys_embedment_record set + is_use=2 + where id=#{id} + </update> + + + + +</mapper> \ No newline at end of file diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java new file mode 100644 index 0000000..81eb2cc --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java @@ -0,0 +1,70 @@ +package com.thhy.mobile.modules.biz.checkdevice.controller; + +import com.github.pagehelper.PageInfo; +import com.thhy.general.common.BasicResult; +import com.thhy.general.utils.PagingUtils; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceAddDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; +import com.thhy.mobile.modules.biz.checkdevice.service.CheckDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; + +/** + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@RestController +@RequestMapping("checkDevice") +public class CheckDeviceController { + + + @Autowired + private CheckDeviceService checkDeviceService; + + @RequestMapping("findList") + public BasicResult findList(@RequestBody(required = false) CheckDeviceDto checkDeviceDto, HttpServletRequest req){ + PagingUtils.setPageParam(req); + List<CheckDeviceListVo> checkDeviceList = checkDeviceService.findList(checkDeviceDto); + PageInfo<CheckDeviceListVo> pageInfo = new PageInfo<>(checkDeviceList); + return BasicResult.success(pageInfo); + } + + @RequestMapping("checkDeviceInfo") + public BasicResult checkDeviceInfo(@RequestBody(required = false) CheckDeviceDto checkDeviceDto){ + CheckDeviceListVo listVo = checkDeviceService.checkDeviceInfo(checkDeviceDto); + return BasicResult.success(listVo); + } + + @RequestMapping("addCheckDevice") + public BasicResult addCheckDevice(@RequestBody CheckDeviceAddDto checkDeviceAddDto){ + checkDeviceService.addCheckDevice(checkDeviceAddDto); + return BasicResult.success(); + } + + /** + @RequestMapping("update") + public BasicResult update(@RequestBody CheckDevice checkDevice){ + checkDeviceService.update(checkDevice); + return BasicResult.success(); + }**/ + + @RequestMapping("delete") + public BasicResult delete(@RequestBody CheckDevice checkDevice){ + checkDeviceService.delete(checkDevice.getId()); + return BasicResult.success(); + } + + @RequestMapping("deviceList") + public BasicResult deviceList(){ + List<HashMap<String,Object>> hashMapList = checkDeviceService.deviceList(); + return BasicResult.success(hashMapList); + } +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java new file mode 100644 index 0000000..463be10 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java @@ -0,0 +1,72 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +/** + * + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Data +@Accessors(chain = true) +public class CheckDevice implements Serializable { + + + /** + * 责任人 + */ + + + private String adminUser; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java new file mode 100644 index 0000000..a6b17c5 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java @@ -0,0 +1,68 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class CheckDeviceAddDto implements Serializable { + + /** + * 责任人 + */ + + + private String adminUser; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; + + private List<CheckDeviceFile> fileList; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java new file mode 100644 index 0000000..b94e719 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java @@ -0,0 +1,18 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class CheckDeviceDto implements Serializable { + + private String bigDeviceName; + + private Date startTime; + + private Date endTime; + + private String id; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java new file mode 100644 index 0000000..ba25aa6 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java @@ -0,0 +1,37 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * @author zhang_xiao_bo + * @since 2023-09-25 16:03:58 + */ +@Data +@Accessors(chain = true) +public class CheckDeviceFile implements Serializable { + + + /** + * 点检ID + */ + + + private String checkId; + + /** + * 图片 + */ + + + private String file; + + + @Idkey + private String id; + +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java new file mode 100644 index 0000000..19b3efd --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java @@ -0,0 +1,80 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class CheckDeviceListVo implements Serializable { + + /** + * 责任人 + */ + + + private String adminUser; + + private String adminUserName; + + private String adminUserPhone; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; + + private String bigDeviceId; + private String bigDeviceName; + private String bigDeviceModel; + private String bigNumber; + private String bigType; + private String bigTypeStr; + + private List<CheckDeviceFile> fileList; + +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java new file mode 100644 index 0000000..15c177e --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java @@ -0,0 +1,35 @@ +package com.thhy.mobile.modules.biz.checkdevice.mapper; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.List; + +/** + * Mapper 接口 + * @author zhang_xiao_bo + * @since 2023-09-25 16:03:58 + */ +@Component +public interface CheckDeviceFileMapper { + + + CheckDeviceFile queryById(Serializable id); + + Integer queryVersionById(Serializable id); + + List<CheckDeviceFile> findList(CheckDeviceFile checkdevicefile); + + List<CheckDeviceFile> findAll(String checkId); + + void insert(CheckDeviceFile checkdevicefile); + + void update(CheckDeviceFile checkdevicefile); + + void deletelogic(Serializable id); + + void deleteById(Serializable id); + + void deleteByCheckId(String checkId); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java new file mode 100644 index 0000000..9786cbf --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java @@ -0,0 +1,40 @@ +package com.thhy.mobile.modules.biz.checkdevice.mapper; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * Mapper 接口 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Component +public interface CheckDeviceMapper { + + + CheckDevice queryById(Serializable id); + + CheckDeviceListVo queryInfoById(String id); + + Integer queryVersionById(Serializable id); + + List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto); + + List<CheckDevice> findAll(); + + void insert(CheckDevice checkdevice); + + void update(CheckDevice checkdevice); + + void deletelogic(Serializable id); + + void deleteById(Serializable id); + + List<HashMap<String,Object>> deviceList(String companyId); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java new file mode 100644 index 0000000..83176e4 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java @@ -0,0 +1,32 @@ +package com.thhy.mobile.modules.biz.checkdevice.service; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceAddDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 服务类 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +public interface CheckDeviceService { + + CheckDevice get(Serializable id); + + List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto); + + CheckDeviceListVo checkDeviceInfo(CheckDeviceDto checkDeviceDto); + + void addCheckDevice(CheckDeviceAddDto checkDeviceAddDto); + + void update(CheckDevice checkDevice); + + void delete(Serializable id); + + List<HashMap<String,Object>> deviceList(); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java new file mode 100644 index 0000000..61f2810 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java @@ -0,0 +1,96 @@ +package com.thhy.mobile.modules.biz.checkdevice.service.impl; + +import com.thhy.general.config.SysUserInfo; +import com.thhy.general.utils.DeepCopyUtils; +import com.thhy.general.utils.UserInfoUtils; +import com.thhy.mobile.modules.biz.checkdevice.entity.*; +import com.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceFileMapper; +import com.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceMapper; +import com.thhy.mobile.modules.biz.checkdevice.service.CheckDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 服务实现类 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Service +public class CheckDeviceServiceImpl implements CheckDeviceService { + + + + @Autowired + private CheckDeviceMapper checkDeviceMapper; + + @Autowired + private CheckDeviceFileMapper fileMapper; + + public CheckDevice get(Serializable id){ + return checkDeviceMapper.queryById(id); + } + + public List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto){ + return checkDeviceMapper.findList(checkDeviceDto); + } + + public CheckDeviceListVo checkDeviceInfo(CheckDeviceDto checkDeviceDto){ + CheckDeviceListVo deviceListVo = checkDeviceMapper.queryInfoById(checkDeviceDto.getId()); + List<CheckDeviceFile> fileList = fileMapper.findAll(deviceListVo.getId()); + deviceListVo.setFileList(fileList); + return deviceListVo; + } + + /** + * 增加和修改 + * @param checkDeviceAddDto + */ + @Transactional + public void addCheckDevice(CheckDeviceAddDto checkDeviceAddDto){ + SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); + List<CheckDeviceFile> fileList = checkDeviceAddDto.getFileList(); + CheckDevice checkDevice = new CheckDevice(); + DeepCopyUtils.copy(checkDeviceAddDto,checkDevice); + if(checkDevice.getId() == null){ + //增加操作 + checkDevice.setAdminUser(userInfo.getUserId()); + checkDeviceMapper.insert(checkDevice); + }else{ + //修改操作 + checkDeviceMapper.update(checkDevice); + fileMapper.deleteByCheckId(checkDevice.getId()); + } + for(CheckDeviceFile deviceFile : fileList){ + deviceFile.setCheckId(checkDevice.getId()); + fileMapper.insert(deviceFile); + } + + } + + /** + * 修改 + * @param checkDevice + */ + public void update(CheckDevice checkDevice){ + checkDeviceMapper.update(checkDevice); + } + + /** + * 删除 + * @param id + */ + public void delete(Serializable id){ + checkDeviceMapper.deletelogic(id); + } + + @Override + public List<HashMap<String, Object>> deviceList() { + SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); + return checkDeviceMapper.deviceList(userInfo.getCompanyId()); + } +} diff --git a/hd/pipe/mobile/src/main/resources/application-pro.yml b/hd/pipe/mobile/src/main/resources/application-pro.yml index 821bb43..f1dacbe 100644 --- a/hd/pipe/mobile/src/main/resources/application-pro.yml +++ b/hd/pipe/mobile/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8884 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml new file mode 100644 index 0000000..3d1ab03 --- /dev/null +++ b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml @@ -0,0 +1,113 @@ +<?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.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceFileMapper"> + + <!-- 通用查询结果列 --> + <sql id="Base_Column_List"> + t.id as id, + t.check_id as checkId, + t.file as file + </sql> + + <sql id="condition_query"> + <where> + <trim suffixOverrides=" AND "> + <if test="checkId!=null and checkId!=''"> + t.check_id = #{checkId} AND + </if> + <if test="file!=null and file!=''"> + t.file = #{file} AND + </if> + </trim> + </where> + </sql> + + <select id="queryById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + select <include refid="Base_Column_List" /> + from t_check_device_file t + where t.id=#{id} + </select> + + <select id="queryVersionById" resultType="integer"> + select version from t_check_device_file + where id=#{id} + </select> + + <!--查询列表--> + <select id="findList" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device_file t + <include refid="condition_query" /> + </select> + + <!--查询列表--> + <select id="findAll" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device_file t + where t.check_id = #{checkId} + </select> + + <!--插入操作--> + <insert id="insert"> + insert into t_check_device_file + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="checkId != null"> + check_id, + </if> + <if test="file != null"> + file, + </if> + <if test="id != null"> + id, + </if> + </trim> + + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="checkId != null"> + #{checkId}, + </if> + <if test="file != null"> + #{file}, + </if> + <if test="id != null"> + #{id}, + </if> + </trim> + </insert> + + + <!--更新操作--> + <update id="update"> + update t_check_device_file + <set> + <if test="checkId != null"> + check_id=#{checkId}, + </if> + <if test="file != null"> + file=#{file}, + </if> + </set> + where id=#{id} + </update> + + <!--逻辑删除--> + <update id="deletelogic"> + update t_check_device_file + SET is_use = 0 + where id=#{id} + </update> + + <!--根据ID删除--> + <delete id="deleteById"> + delete from t_check_device_file + where id=#{id} + </delete> + + <delete id="deleteByCheckId"> + delete from t_check_device_file + where check_id=#{checkId} + </delete> + +</mapper> diff --git a/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml new file mode 100644 index 0000000..172cfdc --- /dev/null +++ b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml @@ -0,0 +1,230 @@ +<?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.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceMapper"> + + <!-- 通用查询结果列 --> + <sql id="Base_Column_List"> + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + t.is_use as isUse + </sql> + + <sql id="condition_query"> + <where> + <trim suffixOverrides=" AND "> + <if test="adminUser!=null and adminUser!=''"> + t.admin_user = #{adminUser} AND + </if> + <if test="checkContent!=null and checkContent!=''"> + t.check_content = #{checkContent} AND + </if> + <if test="checkTime!=null"> + t.check_time = #{checkTime} AND + </if> + <if test="checkType!=null and checkType!=''"> + t.check_type = #{checkType} AND + </if> + <if test="createTime!=null"> + t.create_time = #{createTime} AND + </if> + <if test="deviceId!=null and deviceId!=''"> + t.device_id = #{deviceId} AND + </if> + <if test="isUse!=null"> + t.is_use = #{isUse} AND + </if> + </trim> + </where> + </sql> + + <select id="queryById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice"> + select <include refid="Base_Column_List" /> + from t_check_device t + where t.id=#{id} + </select> + + <select id="queryInfoById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo"> + SELECT + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + bd.big_device_name as bigDeviceName, + bd.big_device_model as bigDeviceModel, + bd.big_number as bigNumber, + bd.big_type as bigType, + sd.dict_name as bigTypeStr, + su.real_name as adminUserName, + su.telphone as adminUserPhone + from t_check_device t + left join t_big_device bd on t.device_id = bd.big_device_id + left join sys_dict sd on sd.dict_id = bd.big_type + left join sys_users su on su.user_id = t.admin_user + where t.id = #{id} + </select> + + + + <select id="queryVersionById" resultType="integer"> + select version from t_check_device + where id=#{id} + </select> + + <!--查询列表--> + <select id="findList" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo"> + SELECT + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + bd.big_device_name as bigDeviceName, + bd.big_device_model as bigDeviceModel, + bd.big_number as bigNumber, + bd.big_type as bigType, + sd.dict_name as bigTypeStr, + su.real_name as adminUserName, + su.telphone as adminUserPhone + from t_check_device t + left join t_big_device bd on t.device_id = bd.big_device_id + left join sys_dict sd on sd.dict_id = bd.big_type + left join sys_users su on su.user_id = t.admin_user + <where> + <trim suffixOverrides=" AND "> + <if test="bigDeviceName !=null and bigDeviceName !=''"> + bd.big_device_name LIKE concat('%',#{bigDeviceName},'%') + </if> + <if test="startTime !=null"> + t.check_time >= #{startTime} + </if> + <if test="endTime !=null"> + t.check_time <= #{endTime} + </if> + </trim> + </where> + </select> + + <!--查询列表--> + <select id="findAll" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device t + </select> + + <!--插入操作--> + <insert id="insert" useGeneratedKeys="true" keyProperty="id"> + insert into t_check_device + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="adminUser != null"> + admin_user, + </if> + <if test="checkContent != null"> + check_content, + </if> + <if test="checkTime != null"> + check_time, + </if> + <if test="checkType != null"> + check_type, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="deviceId != null"> + device_id, + </if> + <if test="id != null"> + id, + </if> + <if test="isUse != null"> + is_use, + </if> + </trim> + + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="adminUser != null"> + #{adminUser}, + </if> + <if test="checkContent != null"> + #{checkContent}, + </if> + <if test="checkTime != null"> + #{checkTime}, + </if> + <if test="checkType != null"> + #{checkType}, + </if> + <if test="createTime != null"> + #{createTime}, + </if> + <if test="deviceId != null"> + #{deviceId}, + </if> + <if test="id != null"> + #{id}, + </if> + <if test="isUse != null"> + #{isUse}, + </if> + </trim> + </insert> + + + <!--更新操作--> + <update id="update"> + update t_check_device + <set> + <if test="adminUser != null"> + admin_user=#{adminUser}, + </if> + <if test="checkContent != null"> + check_content=#{checkContent}, + </if> + <if test="checkTime != null"> + check_time=#{checkTime}, + </if> + <if test="checkType != null"> + check_type=#{checkType}, + </if> + <if test="createTime != null"> + create_time=#{createTime}, + </if> + <if test="deviceId != null"> + device_id=#{deviceId}, + </if> + <if test="isUse != null"> + is_use=#{isUse}, + </if> + </set> + where id=#{id} + </update> + + <!--逻辑删除--> + <update id="deletelogic"> + update t_check_device + SET is_use = 0 + where id=#{id} + </update> + + <!--根据ID删除--> + <delete id="deleteById"> + delete from t_check_device + where id=#{id} + </delete> + + <select id="deviceList" resultType="hashmap"> + select big_device_id as bigDeviceId,big_device_name as bigDeviceName from t_big_device + where is_use = 1 and company_id = #{companyId} + </select> + +</mapper> diff --git a/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttClientConfig.java b/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttClientConfig.java deleted file mode 100644 index 68f26e0..0000000 --- a/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttClientConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.thhy.screen.config; - -import org.eclipse.paho.client.mqttv3.MqttClient; -import org.eclipse.paho.client.mqttv3.MqttConnectOptions; -import org.eclipse.paho.client.mqttv3.MqttException; -import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class MqttClientConfig { - - private Logger logger = LoggerFactory.getLogger("MQTT初始化"); - - @Bean - public MqttClient createClient(MqttConfig mqttConfig){ - MemoryPersistence persistence = new MemoryPersistence(); - MqttClient client = null; - try { - client = new MqttClient(mqttConfig.getBroker(), mqttConfig.getClientId(), persistence); - } catch (MqttException e) { - logger.error("MQTT客户端初始化错误"); - return null; - } - logger.error("MQTT客户端初始化正常"); - MqttConnectOptions connOpts = new MqttConnectOptions(); - connOpts.setUserName(mqttConfig.getUsername()); - connOpts.setPassword(mqttConfig.getPassword().toCharArray()); - // 保留会话 - connOpts.setCleanSession(true); - - // 设置回调 - client.setCallback(new OnMqttCallBack()); - - try { - client.connect(connOpts); - } catch (MqttException e) { - logger.error("MQTT客户端连接出现错误"+e.getMessage()); - return client; - } - logger.error("MQTT客户端连接成功"); - // 订阅 - try { - client.subscribe(mqttConfig.getSubTopic()); - logger.error("MQTT客户端订阅["+mqttConfig.getSubTopic()+"]成功"); - } catch (MqttException e) { - logger.error("MQTT客户端订阅["+mqttConfig.getSubTopic()+"]失败"+e.getMessage()); - return client; - } - return client; - } -} diff --git a/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttConfig.java b/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttConfig.java deleted file mode 100644 index 40e872e..0000000 --- a/hd/pipe/screen/src/main/java/com/thhy/screen/config/MqttConfig.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.thhy.screen.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "mqtt") -@Data -public class MqttConfig { - - private String pubTopic; - - private String subTopic; - - private String broker; - - private String clientId; - - private String username; - - private String password; -} diff --git a/hd/pipe/screen/src/main/java/com/thhy/screen/config/OnMqttCallBack.java b/hd/pipe/screen/src/main/java/com/thhy/screen/config/OnMqttCallBack.java deleted file mode 100644 index 8a68fc4..0000000 --- a/hd/pipe/screen/src/main/java/com/thhy/screen/config/OnMqttCallBack.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.thhy.screen.config; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.thhy.general.common.BasicResult; -import com.thhy.general.common.enums.ProListenType; -import com.thhy.screen.modules.biz.agv.entity.AgvStateHistory; -import com.thhy.screen.modules.biz.agv.mapper.AgvStateHistoryMapper; -import com.thhy.screen.modules.biz.bigscreen.controller.ProListenSocketServer; -import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; -import org.eclipse.paho.client.mqttv3.MqttCallback; -import org.eclipse.paho.client.mqttv3.MqttMessage; -import org.redisson.api.RedissonClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.websocket.Session; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArraySet; - -@Component -public class OnMqttCallBack implements MqttCallback { - - private Logger logger = LoggerFactory.getLogger("Mqtt-jianting"); - - @Autowired - private RedissonClient redissonClient; - - @Autowired - private AgvStateHistoryMapper historyMapper; - - @Override - public void connectionLost(Throwable throwable) { - System.out.println("丢失连接"); - } - - @Override - public void messageArrived(String s, MqttMessage mqttMessage) throws Exception { - System.out.println(s+"================="+mqttMessage.toString()); - System.out.println(s+"================="+mqttMessage.toString()); - logger.info("接收到数据"+mqttMessage.toString()); - /*if("agvmqtt".equals(s)){ - CopyOnWriteArraySet<Session> SESSIONS = ProListenSocketServer.SESSIONS; - SESSIONS.forEach(session ->{ - try { - List<JSONObject> jsonObjectList = new ArrayList<>(); - JSONObject jsonObject = JSON.parseObject(mqttMessage.toString()); - AgvStateHistory agvStateHistory = JSON.parseObject(mqttMessage.toString(),AgvStateHistory.class); - historyMapper.insert(agvStateHistory); - logger.info("保存成功"+mqttMessage.toString()); - jsonObject.put("mod", ProListenType.AGVINFO); - jsonObjectList.add(jsonObject); - if (session.isOpen()) { - session.getBasicRemote().sendText(JSON.toJSONString(BasicResult.success(jsonObjectList))); - logger.info("成功推送AGV消息到生产监控大屏"+session.getId()+"___"+session.getRequestURI().getHost()); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - }*/ - } - - @Override - public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { - System.out.println("sssss"); - } -} diff --git a/hd/pipe/screen/src/main/java/com/thhy/screen/modules/biz/agv/controller/test.java b/hd/pipe/screen/src/main/java/com/thhy/screen/modules/biz/agv/controller/test.java deleted file mode 100644 index 6994d89..0000000 --- a/hd/pipe/screen/src/main/java/com/thhy/screen/modules/biz/agv/controller/test.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.thhy.screen.modules.biz.agv.controller; - -import com.alibaba.fastjson.JSON; -import com.thhy.screen.modules.biz.agv.entity.AgvStateHistory; - -public class test { - public static void main(String[] args) { - String mess = "agv/tcb01/agvState{\"agvBaseAngularVel\": 0.0, \"errorCode\": 0, \"battery1Current\": 2.3, \"accurateStop\": 0, \"agvVelLevel\": \"3\", \"battery1Charge\": 96.5, \"agvModelRFID\": -1, \"agvControlStyle\": \"manu\", \"battery1ErrorCode\": 0, \"agvDestRFID\": -1, \"agvVelDirection\": \"stop\", \"agvBaseLinearVel\": 0.0, \"agvBackLaserSwitch\": 0, \"agvWorkingState\": \"idle\", \"agvLiftupHeavyState\": \"heavyNoExistence\", \"errorContent\": \"\\u624b\\u52a8\\u63a7\\u5236\\uff0c\\u72b6\\u6001\\u826f\\u597d\", \"agvId\": \"tcb01\", \"agvFrontLaserSwitch\": 0, \"agvTaskState\": \"idle\", \"agvCollision\": 0, \"agvEmergencyButton\": 0, \"agvCurrentLandmarkRFID\": -1, \"agvMoveStyle\": \"longtitude\", \"battery1Voltage\": 53.3, \"agvJackingState\": \"jackingDown\"}"; - - mess = mess.substring(mess.indexOf("{"),mess.indexOf("}")+1); - - AgvStateHistory agvStateHistory = JSON.parseObject(mess,AgvStateHistory.class); - - System.out.printf(mess); - } -} diff --git a/hd/pipe/screen/src/main/resources/application-pro.yml b/hd/pipe/screen/src/main/resources/application-pro.yml index f5bd292..f1dacbe 100644 --- a/hd/pipe/screen/src/main/resources/application-pro.yml +++ b/hd/pipe/screen/src/main/resources/application-pro.yml @@ -1,7 +1,7 @@ spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} diff --git a/hd/pipe/secure/src/main/resources/application-pro.yml b/hd/pipe/secure/src/main/resources/application-pro.yml index b8519ec..f1dacbe 100644 --- a/hd/pipe/secure/src/main/resources/application-pro.yml +++ b/hd/pipe/secure/src/main/resources/application-pro.yml @@ -1,9 +1,7 @@ -server: - port: 8886 spring: config: activate: - on-profile: dev + on-profile: pro import: - optional:nacos:${spring.application.name}-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} - optional:nacos:supipe-common-${spring.config.activate.on-profile}.${spring.cloud.nacos.config.file-extension} -- Gitblit v1.9.3