From 6884b7b96a1b4031ee6eca95726b86d626af6e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=B4=E7=82=B3=E6=9E=97?= <15237758276@163.com> Date: Fri, 7 Jun 2024 09:44:49 +0800 Subject: [PATCH] no message --- .../java/com/youchain/RequestData/Yclbl.java | 2 + .../basicdata/repository/ItemRepository.java | 5 + .../com/youchain/businessdata/domain/Gd.java | 85 ++++++++++++ .../businessdata/domain/GdDetail.java | 88 ++++++++++++ .../repository/GdDetailRepository.java | 28 ++++ .../businessdata/repository/GdRepository.java | 34 +++++ .../businessdata/rest/GdController.java | 87 ++++++++++++ .../businessdata/rest/GdDetailController.java | 87 ++++++++++++ .../businessdata/rest/MesController.java | 56 +++++++- .../businessdata/service/GdDetailService.java | 83 ++++++++++++ .../businessdata/service/GdService.java | 85 ++++++++++++ .../businessdata/service/dto/GdDetailDto.java | 63 +++++++++ .../service/dto/GdDetailQueryCriteria.java | 33 +++++ .../businessdata/service/dto/GdDto.java | 57 ++++++++ .../service/dto/GdQueryCriteria.java | 45 ++++++ .../service/impl/GdDetailServiceImpl.java | 113 ++++++++++++++++ .../service/impl/GdServiceImpl.java | 128 ++++++++++++++++++ .../service/mapstruct/GdDetailMapper.java | 32 +++++ .../service/mapstruct/GdMapper.java | 32 +++++ .../modules/system/service/DeptService.java | 2 + .../system/service/impl/DeptServiceImpl.java | 8 +- .../java/com/youchain/utils/BaseStatus.java | 4 + .../java/com/youchain/utils/UserUtils.java | 4 + 23 files changed, 1158 insertions(+), 3 deletions(-) create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/domain/Gd.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/domain/GdDetail.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/repository/GdDetailRepository.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/repository/GdRepository.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/rest/GdController.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/rest/GdDetailController.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/GdDetailService.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/GdService.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailDto.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailQueryCriteria.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDto.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdQueryCriteria.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdDetailServiceImpl.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdServiceImpl.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdDetailMapper.java create mode 100644 youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdMapper.java diff --git a/youchain-system/src/main/java/com/youchain/RequestData/Yclbl.java b/youchain-system/src/main/java/com/youchain/RequestData/Yclbl.java index ddd11d3..0c7725c 100644 --- a/youchain-system/src/main/java/com/youchain/RequestData/Yclbl.java +++ b/youchain-system/src/main/java/com/youchain/RequestData/Yclbl.java @@ -20,4 +20,6 @@ public class Yclbl { String createTime; @ApiModelProperty(value ="总成明细",required = true) Set blzc; + @ApiModelProperty(value ="单品明细",required = true) + Set blzcmx; } diff --git a/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java index 40ced6d..1acfd71 100644 --- a/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java +++ b/youchain-system/src/main/java/com/youchain/basicdata/repository/ItemRepository.java @@ -18,6 +18,9 @@ package com.youchain.basicdata.repository; import com.youchain.basicdata.domain.Item; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; /** * @website https://eladmin.vip @@ -25,4 +28,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; * @date 2023-08-16 **/ public interface ItemRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT i FROM Item i WHERE i.code = ?1 and i.name=?2", nativeQuery = false) + List findRepeat(String code, String name); } \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/Gd.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/Gd.java new file mode 100644 index 0000000..3b3aa55 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/Gd.java @@ -0,0 +1,85 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import com.youchain.basicdata.domain.Item; +import com.youchain.modules.system.domain.Dept; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2024-06-06 +**/ +@Entity +@Data +@Table(name="data_gd") +public class Gd extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`create_by`") + @ApiModelProperty(value = "创建人") + private String createBy; + + @Column(name = "`update_by`") + @ApiModelProperty(value = "修改人") + private String updateBy; + + @Column(name = "`create_time`") + @ApiModelProperty(value = "创建时间") + private Timestamp createTime; + + @Column(name = "`update_time`") + @ApiModelProperty(value = "修改时间") + private Timestamp updateTime; + + @Column(name = "`code`") + @ApiModelProperty(value = "工单编号") + private String code; + + @Column(name = "`name`") + @ApiModelProperty(value = "任务编号") + private String name; + + @Column(name = "`status`") + @ApiModelProperty(value = "工单状态") + private String status; + + @Column(name = "`station`") + @ApiModelProperty(value = "需求工位") + private String station; + @OneToOne + @JoinColumn(name = "`dept_id`",nullable = false) + @ApiModelProperty(value = "仓库") + private Dept dept; + public void copy(Gd source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/domain/GdDetail.java b/youchain-system/src/main/java/com/youchain/businessdata/domain/GdDetail.java new file mode 100644 index 0000000..4554064 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/domain/GdDetail.java @@ -0,0 +1,88 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.domain; + +import com.youchain.base.BaseEntity; +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import javax.validation.constraints.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2024-06-06 +**/ +@Entity +@Data +@Table(name="data_gd_detail") +public class GdDetail extends BaseEntity implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "`id`") + @ApiModelProperty(value = "ID") + private Long id; + + @Column(name = "`create_by`") + @ApiModelProperty(value = "创建人") + private String createBy; + + @Column(name = "`update_by`") + @ApiModelProperty(value = "修改人") + private String updateBy; + + @Column(name = "`create_time`") + @ApiModelProperty(value = "创建时间") + private Timestamp createTime; + + @Column(name = "`update_time`") + @ApiModelProperty(value = "修改时间") + private Timestamp updateTime; + + @Column(name = "`line_no`") + @ApiModelProperty(value = "行号") + private Long lineNo; + + @Column(name = "`item_id`") + @ApiModelProperty(value = "关联物料") + private Long itemId; + + @Column(name = "`item_qty`") + @ApiModelProperty(value = "订单数量") + private Long itemQty; + + @Column(name = "`big_item_id`") + @ApiModelProperty(value = "总成代码") + private Long bigItemId; + + @Column(name = "`big_item_qty`") + @ApiModelProperty(value = "总成套数") + private Long bigItemQty; + + @Column(name = "`order_type`") + @ApiModelProperty(value = "单据类型") + private Long orderType; + + public void copy(GdDetail source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/GdDetailRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/GdDetailRepository.java new file mode 100644 index 0000000..f7cdb05 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/GdDetailRepository.java @@ -0,0 +1,28 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.GdDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +public interface GdDetailRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/repository/GdRepository.java b/youchain-system/src/main/java/com/youchain/businessdata/repository/GdRepository.java new file mode 100644 index 0000000..eca9172 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/repository/GdRepository.java @@ -0,0 +1,34 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.repository; + +import com.youchain.businessdata.domain.Gd; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +public interface GdRepository extends JpaRepository, JpaSpecificationExecutor { + /** 查询重复数据*/ + @Query(value = "SELECT g FROM Gd g WHERE g.code=?1 and g.name=?2 and g.station=?3 ", nativeQuery = false) + List findRepeat(String code, String name, String station); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/GdController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/GdController.java new file mode 100644 index 0000000..c6ae09f --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/GdController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.Gd; +import com.youchain.businessdata.service.GdService; +import com.youchain.businessdata.service.dto.GdQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "gd管理") +@RequestMapping("/api/gd") +public class GdController { + + private final GdService gdService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('gd:list')") + public void exportGd(HttpServletResponse response, GdQueryCriteria criteria) throws IOException { + gdService.download(gdService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询gd") + @ApiOperation("查询gd") + @PreAuthorize("@el.check('gd:list')") + public ResponseEntity queryGd(GdQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(gdService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增gd") + @ApiOperation("新增gd") + @PreAuthorize("@el.check('gd:add')") + public ResponseEntity createGd(@Validated @RequestBody Gd resources){ + return new ResponseEntity<>(gdService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改gd") + @ApiOperation("修改gd") + @PreAuthorize("@el.check('gd:edit')") + public ResponseEntity updateGd(@Validated @RequestBody Gd resources){ + gdService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除gd") + @ApiOperation("删除gd") + @PreAuthorize("@el.check('gd:del')") + public ResponseEntity deleteGd(@RequestBody Long[] ids) { + gdService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/GdDetailController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/GdDetailController.java new file mode 100644 index 0000000..e647c86 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/GdDetailController.java @@ -0,0 +1,87 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.rest; + +import com.youchain.annotation.Log; +import com.youchain.businessdata.domain.GdDetail; +import com.youchain.businessdata.service.GdDetailService; +import com.youchain.businessdata.service.dto.GdDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "gdDetail管理") +@RequestMapping("/api/gdDetail") +public class GdDetailController { + + private final GdDetailService gdDetailService; + + @Log("导出数据") + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('gdDetail:list')") + public void exportGdDetail(HttpServletResponse response, GdDetailQueryCriteria criteria) throws IOException { + gdDetailService.download(gdDetailService.queryAll(criteria), response); + } + + @GetMapping + @Log("查询gdDetail") + @ApiOperation("查询gdDetail") + @PreAuthorize("@el.check('gdDetail:list')") + public ResponseEntity queryGdDetail(GdDetailQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity<>(gdDetailService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @PostMapping + @Log("新增gdDetail") + @ApiOperation("新增gdDetail") + @PreAuthorize("@el.check('gdDetail:add')") + public ResponseEntity createGdDetail(@Validated @RequestBody GdDetail resources){ + return new ResponseEntity<>(gdDetailService.create(resources),HttpStatus.CREATED); + } + + @PutMapping + @Log("修改gdDetail") + @ApiOperation("修改gdDetail") + @PreAuthorize("@el.check('gdDetail:edit')") + public ResponseEntity updateGdDetail(@Validated @RequestBody GdDetail resources){ + gdDetailService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除gdDetail") + @ApiOperation("删除gdDetail") + @PreAuthorize("@el.check('gdDetail:del')") + public ResponseEntity deleteGdDetail(@RequestBody Long[] ids) { + gdDetailService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/rest/MesController.java b/youchain-system/src/main/java/com/youchain/businessdata/rest/MesController.java index 250e18a..a9246a4 100644 --- a/youchain-system/src/main/java/com/youchain/businessdata/rest/MesController.java +++ b/youchain-system/src/main/java/com/youchain/businessdata/rest/MesController.java @@ -3,8 +3,17 @@ package com.youchain.businessdata.rest; import com.youchain.RequestData.*; import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.Log; +import com.youchain.basicdata.domain.Item; +import com.youchain.basicdata.repository.ItemRepository; +import com.youchain.businessdata.domain.Gd; +import com.youchain.businessdata.domain.GdDetail; +import com.youchain.businessdata.service.GdDetailService; +import com.youchain.businessdata.service.GdService; import com.youchain.businessdata.service.dto.TaskQueryCriteria; +import com.youchain.exception.BadRequestException; import com.youchain.exception.handler.ApiResult; +import com.youchain.utils.BaseStatus; +import com.youchain.utils.BizStatus; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; @@ -15,21 +24,46 @@ import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; +import java.util.Set; + @RestController @RequiredArgsConstructor @Api(tags = "mes接口管理") @RequestMapping("/api/mes") @Slf4j public class MesController { + private final GdService gdService; + private final ItemRepository itemRepository; @PostMapping("/yclbl") @Log("mes-原材料备料") @ApiOperation("mes-原材料备料") @AnonymousAccess public ResponseEntity yclbl(@Validated @RequestBody Yclbl yclbl){ - log.info(ApiResult.result(200,"成功",null).toString()); - return new ResponseEntity<>(HttpStatus.OK); + /* 添加工单单头*/ + Gd gd = gdService.save(yclbl.getOrderNo(),yclbl.getTaskCode(),yclbl.getStation()); + if (yclbl.getBlzc()!=null){ + /*String orderType = BaseStatus.GD_TYPE_CT; + Set blzc = yclbl.getBlzc(); + for (ZcData zcData : blzc) { + *//* 验证成套 物料*//* + Item bigItem=verifiedBigItem(zcData.getCompleteCode(),zcData.getCompleteName()); + Set itemDates=zcData.getBlzcmx(); + for (ItemDate itemDate : itemDates) { + *//* 验证单品 物料*//* + Item item=verifiedItem(itemDate.getItemCode(),itemDate.getItemName()); + *//* 添加工单明细*//* +// GdDetail gdDetail = gdDetailService.save(gd.getId(),yc(),yclbl.getStation()); + } + }*/ + }else if (yclbl.getBlzcmx()!=null){ + String orderType = BaseStatus.GD_TYPE_DP; + } + ApiResult apiResult=ApiResult.result(200,"成功",null); + return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus())); } + @PostMapping("/sjBom") @Log("mes-散件BOM同步") @ApiOperation("mes-散件BOM同步") @@ -70,4 +104,22 @@ public class MesController { return new ResponseEntity<>(ApiResult.result(200,"成功",null), HttpStatus.OK); } + + /** 验证成套物料*/ + private Item verifiedBigItem(String completeCode, String completeName) { + List itemList = itemRepository.findRepeat(completeCode,completeName); + if (itemList.size()>0){ + return itemList.get(0); + }else { + throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护成套物料"+completeCode); + } + } + private Item verifiedItem(String itemCode, String itemName) { + List itemList = itemRepository.findRepeat(itemCode,itemName); + if (itemList.size()>0){ + return itemList.get(0); + }else { + throw new BadRequestException(HttpStatus.INTERNAL_SERVER_ERROR, "未维护单品物料"+itemCode); + } + } } diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/GdDetailService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/GdDetailService.java new file mode 100644 index 0000000..14917af --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/GdDetailService.java @@ -0,0 +1,83 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.GdDetail; +import com.youchain.businessdata.service.dto.GdDetailDto; +import com.youchain.businessdata.service.dto.GdDetailQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author huojin +* @date 2024-06-06 +**/ +public interface GdDetailService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(GdDetailQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(GdDetailQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return GdDetailDto + */ + GdDetailDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return GdDetailDto + */ + GdDetailDto create(GdDetail resources); + + /** + * 编辑 + * @param resources / + */ + void update(GdDetail resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/GdService.java b/youchain-system/src/main/java/com/youchain/businessdata/service/GdService.java new file mode 100644 index 0000000..894f82e --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/GdService.java @@ -0,0 +1,85 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service; + +import com.youchain.businessdata.domain.Gd; +import com.youchain.businessdata.service.dto.GdDto; +import com.youchain.businessdata.service.dto.GdQueryCriteria; +import org.springframework.data.domain.Pageable; +import java.util.Map; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +/** +* @website https://eladmin.vip +* @description 服务接口 +* @author huojin +* @date 2024-06-06 +**/ +public interface GdService { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param pageable 分页参数 + * @return Map + */ + Map queryAll(GdQueryCriteria criteria, Pageable pageable); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List + */ + List queryAll(GdQueryCriteria criteria); + + /** + * 根据ID查询 + * @param id ID + * @return GdDto + */ + GdDto findById(Long id); + + /** + * 创建 + * @param resources / + * @return GdDto + */ + GdDto create(Gd resources); + + /** + * 编辑 + * @param resources / + */ + void update(Gd resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Long[] ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List all, HttpServletResponse response) throws IOException; + + Gd save(String orderNo, String taskCode, String station); +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailDto.java new file mode 100644 index 0000000..9114248 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailDto.java @@ -0,0 +1,63 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2024-06-06 +**/ +@Data +public class GdDetailDto implements Serializable { + + /** ID */ + private Long id; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 行号 */ + private Long lineNo; + + /** 关联物料 */ + private Long itemId; + + /** 订单数量 */ + private Long itemQty; + + /** 总成代码 */ + private Long bigItemId; + + /** 总成套数 */ + private Long bigItemQty; + + /** 单据类型 */ + private Long orderType; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailQueryCriteria.java new file mode 100644 index 0000000..9db9c3b --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDetailQueryCriteria.java @@ -0,0 +1,33 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@Data +public class GdDetailQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private Long itemId; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDto.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDto.java new file mode 100644 index 0000000..2553332 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdDto.java @@ -0,0 +1,57 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @website https://eladmin.vip +* @description / +* @author huojin +* @date 2024-06-06 +**/ +@Data +public class GdDto implements Serializable { + + /** ID */ + private Long id; + + /** 创建人 */ + private String createBy; + + /** 修改人 */ + private String updateBy; + + /** 创建时间 */ + private Timestamp createTime; + + /** 修改时间 */ + private Timestamp updateTime; + + /** 工单编号 */ + private String code; + + /** 任务编号 */ + private String name; + + /** 工单状态 */ + private String status; + + /** 需求工位 */ + private String station; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdQueryCriteria.java b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdQueryCriteria.java new file mode 100644 index 0000000..8e84b3a --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/dto/GdQueryCriteria.java @@ -0,0 +1,45 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.dto; + +import lombok.Data; +import java.util.List; +import com.youchain.annotation.Query; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@Data +public class GdQueryCriteria{ + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String code; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String name; + + /** 精确 */ + @Query + private String status; + + /** 模糊 */ + @Query(type = Query.Type.INNER_LIKE) + private String station; +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdDetailServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdDetailServiceImpl.java new file mode 100644 index 0000000..64dfd23 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdDetailServiceImpl.java @@ -0,0 +1,113 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.GdDetail; +import com.youchain.utils.FileUtil; +import com.youchain.utils.PageUtil; +import com.youchain.utils.QueryHelp; +import com.youchain.utils.ValidationUtil; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.GdDetailRepository; +import com.youchain.businessdata.service.GdDetailService; +import com.youchain.businessdata.service.dto.GdDetailDto; +import com.youchain.businessdata.service.dto.GdDetailQueryCriteria; +import com.youchain.businessdata.service.mapstruct.GdDetailMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author huojin +* @date 2024-06-06 +**/ +@Service +@RequiredArgsConstructor +public class GdDetailServiceImpl implements GdDetailService { + + private final GdDetailRepository gdDetailRepository; + private final GdDetailMapper gdDetailMapper; + + @Override + public Map queryAll(GdDetailQueryCriteria criteria, Pageable pageable){ + Page page = gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(gdDetailMapper::toDto)); + } + + @Override + public List queryAll(GdDetailQueryCriteria criteria){ + return gdDetailMapper.toDto(gdDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public GdDetailDto findById(Long id) { + GdDetail gdDetail = gdDetailRepository.findById(id).orElseGet(GdDetail::new); + ValidationUtil.isNull(gdDetail.getId(),"GdDetail","id",id); + return gdDetailMapper.toDto(gdDetail); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public GdDetailDto create(GdDetail resources) { + return gdDetailMapper.toDto(gdDetailRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GdDetail resources) { + GdDetail gdDetail = gdDetailRepository.findById(resources.getId()).orElseGet(GdDetail::new); + ValidationUtil.isNull( gdDetail.getId(),"GdDetail","id",resources.getId()); + gdDetail.copy(resources); + gdDetailRepository.save(gdDetail); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + gdDetailRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (GdDetailDto gdDetail : all) { + Map map = new LinkedHashMap<>(); + map.put("创建人", gdDetail.getCreateBy()); + map.put("修改人", gdDetail.getUpdateBy()); + map.put("创建时间", gdDetail.getCreateTime()); + map.put("修改时间", gdDetail.getUpdateTime()); + map.put("行号", gdDetail.getLineNo()); + map.put("关联物料", gdDetail.getItemId()); + map.put("订单数量", gdDetail.getItemQty()); + map.put("总成代码", gdDetail.getBigItemId()); + map.put("总成套数", gdDetail.getBigItemQty()); + map.put("单据类型", gdDetail.getOrderType()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdServiceImpl.java b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdServiceImpl.java new file mode 100644 index 0000000..11ed6e2 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/impl/GdServiceImpl.java @@ -0,0 +1,128 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.impl; + +import com.youchain.businessdata.domain.Gd; +import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.service.DeptService; +import com.youchain.utils.*; +import lombok.RequiredArgsConstructor; +import com.youchain.businessdata.repository.GdRepository; +import com.youchain.businessdata.service.GdService; +import com.youchain.businessdata.service.dto.GdDto; +import com.youchain.businessdata.service.dto.GdQueryCriteria; +import com.youchain.businessdata.service.mapstruct.GdMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** +* @website https://eladmin.vip +* @description 服务实现 +* @author huojin +* @date 2024-06-06 +**/ +@Service +@RequiredArgsConstructor +public class GdServiceImpl implements GdService { + + private final GdRepository gdRepository; + private final DeptService deptService; + private final GdMapper gdMapper; + + @Override + public Map queryAll(GdQueryCriteria criteria, Pageable pageable){ + Page page = gdRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(gdMapper::toDto)); + } + + @Override + public List queryAll(GdQueryCriteria criteria){ + return gdMapper.toDto(gdRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + @Transactional + public GdDto findById(Long id) { + Gd gd = gdRepository.findById(id).orElseGet(Gd::new); + ValidationUtil.isNull(gd.getId(),"Gd","id",id); + return gdMapper.toDto(gd); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public GdDto create(Gd resources) { + return gdMapper.toDto(gdRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Gd resources) { + Gd gd = gdRepository.findById(resources.getId()).orElseGet(Gd::new); + ValidationUtil.isNull( gd.getId(),"Gd","id",resources.getId()); + gd.copy(resources); + gdRepository.save(gd); + } + + @Override + public void deleteAll(Long[] ids) { + for (Long id : ids) { + gdRepository.deleteById(id); + } + } + + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (GdDto gd : all) { + Map map = new LinkedHashMap<>(); + map.put("创建人", gd.getCreateBy()); + map.put("修改人", gd.getUpdateBy()); + map.put("创建时间", gd.getCreateTime()); + map.put("修改时间", gd.getUpdateTime()); + map.put("工单编号", gd.getCode()); + map.put("任务编号", gd.getName()); + map.put("工单状态", gd.getStatus()); + map.put("需求工位", gd.getStation()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } + + @Override + public Gd save(String orderNo, String taskCode, String station) { + List gdList=gdRepository.findRepeat(orderNo,taskCode,station); + if (gdList.size()>0){ + return gdList.get(0); + }else { + Gd gd=new Gd(); + gd.setCode(orderNo); + gd.setName(taskCode); + gd.setStation(station); + gd.setStatus(BizStatus.OPEN); + gd.setDept(deptService.isDept()); + gdRepository.save(gd); + return gd; + } + } +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdDetailMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdDetailMapper.java new file mode 100644 index 0000000..045b0ef --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdDetailMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.GdDetail; +import com.youchain.businessdata.service.dto.GdDetailDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface GdDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdMapper.java b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdMapper.java new file mode 100644 index 0000000..d509a18 --- /dev/null +++ b/youchain-system/src/main/java/com/youchain/businessdata/service/mapstruct/GdMapper.java @@ -0,0 +1,32 @@ +/* +* Copyright 2019-2020 Zheng Jie +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package com.youchain.businessdata.service.mapstruct; + +import com.youchain.base.BaseMapper; +import com.youchain.businessdata.domain.Gd; +import com.youchain.businessdata.service.dto.GdDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @website https://eladmin.vip +* @author huojin +* @date 2024-06-06 +**/ +@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface GdMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java b/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java index 9c9c10a..2945c6f 100644 --- a/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/DeptService.java @@ -121,4 +121,6 @@ public interface DeptService { * @param deptDtos / */ void verification(Set deptDtos); + /** 获取默认仓库*/ + Dept isDept(); } \ No newline at end of file diff --git a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java index 2729c5a..d8b268f 100644 --- a/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java +++ b/youchain-system/src/main/java/com/youchain/modules/system/service/impl/DeptServiceImpl.java @@ -49,7 +49,7 @@ import java.util.stream.Collectors; @RequiredArgsConstructor @CacheConfig(cacheNames = "dept") public class DeptServiceImpl implements DeptService { - + private final RedisObjectUtils redisObjectUtils; private final DeptRepository deptRepository; private final DeptMapper deptMapper; private final UserRepository userRepository; @@ -246,6 +246,12 @@ public class DeptServiceImpl implements DeptService { } } + @Override + public Dept isDept() { + Dept dept = redisObjectUtils.getObjectFromCache("dept", () -> deptMapper.toEntity(findById(7L)), "系统无此仓库!"); + return dept; + } + private void updateSubCnt(Long deptId){ if(deptId != null){ int count = deptRepository.countByPid(deptId); diff --git a/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java b/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java index 1207002..fabf420 100644 --- a/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java +++ b/youchain-system/src/main/java/com/youchain/utils/BaseStatus.java @@ -37,4 +37,8 @@ public interface BaseStatus { */ public static String EMPTY = "EMPTY"; + /** 工单类型 成套*/ + public static String GD_TYPE_CT = "成套"; + /** 工单类型 单品*/ + public static String GD_TYPE_DP = "单品"; } diff --git a/youchain-system/src/main/java/com/youchain/utils/UserUtils.java b/youchain-system/src/main/java/com/youchain/utils/UserUtils.java index b9a7a1b..b0e8665 100644 --- a/youchain-system/src/main/java/com/youchain/utils/UserUtils.java +++ b/youchain-system/src/main/java/com/youchain/utils/UserUtils.java @@ -1,8 +1,12 @@ package com.youchain.utils; import cn.hutool.json.JSONUtil; +import com.youchain.businessdata.service.GdDetailService; import com.youchain.modules.system.domain.Dept; +import com.youchain.modules.system.repository.DeptRepository; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; import java.util.List; @Slf4j