Commit 726d86f9288198af74c1a0acade7844119042c22

Authored by 王富生
2 parents c590e968 7f297997

Merge remote-tracking branch 'origin/de_wangfs_202511' into de_wangfs_202511

urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/mechanicalcost/vo/MechanicalCostSaveReqVO.java
... ... @@ -75,7 +75,7 @@ public class MechanicalCostSaveReqVO {
75 75 private String companyId;
76 76  
77 77 @Schema(description = "部门id", example = "13645")
78   - private Long deptId;
  78 + private List<Long> deptId;
79 79  
80 80 @Schema(description = "备注", example = "随便")
81 81 private String remark;
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/rentalmechanicalcost/vo/RentalMechanicalCostSaveReqVO.java
... ... @@ -66,7 +66,7 @@ public class RentalMechanicalCostSaveReqVO {
66 66 private String companyId;
67 67  
68 68 @Schema(description = "部门id", example = "25446")
69   - private Long deptId;
  69 + private List<Long> deptId;
70 70  
71 71 @Schema(description = "道路ID数组(多选)")
72 72 private String roadIds;
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/vo/RoadSaveReqVO.java
... ... @@ -90,11 +90,9 @@ public class RoadSaveReqVO {
90 90 private Long deptId;
91 91  
92 92 @Schema(description = "创建者", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
93   - @NotEmpty(message = "创建者不能为空")
94 93 private String creatorName;
95 94  
96 95 @Schema(description = "更新者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
97   - @NotEmpty(message = "更新者不能为空")
98 96 private String updaterName;
99 97  
100   -}
101 98 \ No newline at end of file
  99 +}
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/departmentcost/DepartmentCostServiceImpl.java
... ... @@ -60,16 +60,6 @@ public class DepartmentCostServiceImpl implements DepartmentCostService {
60 60 // 更新
61 61 DepartmentCostDO updateObj = BeanUtils.toBean(updateReqVO, DepartmentCostDO.class);
62 62  
63   - // add bt wq 20251119 插入增加校验
64   - LambdaQueryWrapper<DepartmentCostDO> queryWrapper = Wrappers.lambdaQuery();
65   - queryWrapper.eq(DepartmentCostDO::getSalaryMonth, updateObj.getSalaryMonth());
66   - queryWrapper.eq(DepartmentCostDO::getExpenseName, updateObj.getExpenseName());
67   - queryWrapper.eq(DepartmentCostDO::getCompanyId, updateObj.getCompanyId());
68   - List<DepartmentCostDO> list = departmentCostMapper.selectList(queryWrapper);
69   - if (!CollectionUtils.isEmpty(list)) {
70   - throw exception(COST_FEE_NOT_EXISTS);
71   - }
72   - // add bt wq 20251119 插入增加校验
73 63 departmentCostMapper.updateById(updateObj);
74 64 }
75 65  
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/material/MaterialServiceImpl.java
... ... @@ -36,7 +36,7 @@ public class MaterialServiceImpl implements MaterialService {
36 36 QueryWrapper<MaterialDO> queryWrapper = new QueryWrapper<>();
37 37 queryWrapper.lambda().eq(MaterialDO::getMaterialCode, createReqVO.getMaterialCode())
38 38 .eq(MaterialDO::getSpecCode, createReqVO.getSpecCode())
39   - .eq(MaterialDO::getMaterialTypeId, createReqVO.getTypeDetailId());
  39 + .eq(MaterialDO::getTypeDetailId, createReqVO.getTypeDetailId());
40 40 List<MaterialDO> tdMaterials = materialMapper.selectList(queryWrapper);
41 41 if (null != tdMaterials && tdMaterials.size() > 0) {
42 42 MaterialDO material = tdMaterials.get(0);
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryService.java
... ... @@ -80,7 +80,7 @@ public interface MaterialInventoryService {
80 80 * @Date 2025/11/28 23:36
81 81 * @Param materialId
82 82 */
83   - MaterialInventoryDO selectTdMaterialInventoryByMaterialId(Long materialId);
  83 + MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId, Long companyId);
84 84  
85 85  
86 86 /**
... ... @@ -98,4 +98,13 @@ public interface MaterialInventoryService {
98 98 * @return
99 99 */
100 100 int updateInVentoryAlremNum(Long materialId, Long alermNum);
  101 +
  102 + /**
  103 + * @Author wangqian
  104 + * @Description 查询物料信息根据
  105 + * @Date 2025/11/28 23:36
  106 + * @Param materialId
  107 + */
  108 + MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId);
  109 +
101 110 }
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.zteits.urbanops.module.garden.service.materialinventory;
3 3 import com.baomidou.mybatisplus.core.conditions.Wrapper;
4 4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 5 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  6 +import com.baomidou.mybatisplus.core.toolkit.StringUtils;
6 7 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 8 import com.zteits.urbanops.framework.common.pojo.PageResult;
8 9 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
... ... @@ -92,6 +93,10 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
92 93  
93 94 @Override
94 95 public PageResult<MaterialInventoryDO> getMaterialInventoryPage(MaterialInventoryPageReqVO pageReqVO) {
  96 + //查询自己单位入库的库存
  97 + if(getCompanyId() != 100) {
  98 + pageReqVO.setBelongCompanyId(getCompanyId());
  99 + }
95 100 return materialInventoryMapper.selectPage(pageReqVO);
96 101 }
97 102  
... ... @@ -99,7 +104,7 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
99 104 public int insertMaterialInventory(MaterialInventoryDO materialInventory) {
100 105 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
101 106 queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, materialInventory.getBelongCompanyId());
102   - queryWrapper.eq(MaterialInventoryDO::getTypeDetailId, materialInventory.getTypeDetailId());
  107 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialInventory.getMaterialId());
103 108 MaterialInventoryDO object = materialInventoryMapper.selectOne(queryWrapper);
104 109 if(object != null){
105 110 object.setInventoryTotalNum(object.getInventoryTotalNum()+ materialInventory.getCurrentNum());
... ... @@ -118,25 +123,27 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
118 123 }
119 124  
120 125 @Override
121   - public MaterialInventoryDO selectTdMaterialInventoryByMaterialId(Long materialId) {
  126 + public MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId, Long companyId) {
122 127 if (materialId == null) {
123   - throw exception0(BAD_REQUEST.getCode(),"更新库存失败:materialId为空!");
  128 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:typeDetailId为空!");
124 129 }
125 130 LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
126   - queryWrapper.eq(MaterialInventoryDO::getTypeDetailId, materialId);
  131 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialId);
  132 + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId);
127 133 return materialInventoryMapper.selectOne(queryWrapper);
128 134 }
129 135  
130 136 @Override
131 137 public int updateInVentoryByMaterialId(MaterialInventoryDO materialInventory, Long outNum) {
132 138 // 1. 入参空值校验(避免无效更新或SQL异常)
  139 + if (materialInventory == null || materialInventory.getInventoryId() == null) {
  140 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:InventoryId为空!");
  141 + }
133 142 if (outNum == null) {
134 143 throw exception0(BAD_REQUEST.getCode(),"更新库存失败:outNum为空!");
135 144 }
136   - MaterialInventoryDO out = new MaterialInventoryDO();
137   - out.setInventoryId(materialInventory.getInventoryId());
138   - out.setOutTotalNum(materialInventory.getInventoryTotalNum() + outNum);
139   - out.setCurrentNum(materialInventory.getCurrentNum() - outNum);
  145 + materialInventory.setOutTotalNum(materialInventory.getInventoryTotalNum() + outNum);
  146 + materialInventory.setCurrentNum(materialInventory.getCurrentNum() - outNum);
140 147 return materialInventoryMapper.updateById(materialInventory);
141 148 }
142 149  
... ... @@ -157,4 +164,14 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService {
157 164 // 3. 执行更新(MyBatis-Plus支持直接传wrapper,第一个参数为null即可)
158 165 return materialInventoryMapper.update(null, updateWrapper);
159 166 }
  167 +
  168 + @Override
  169 + public MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId) {
  170 + if (materialId == null) {
  171 + throw exception0(BAD_REQUEST.getCode(),"更新库存失败:materialId为空!");
  172 + }
  173 + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery();
  174 + queryWrapper.eq(MaterialInventoryDO::getMaterialId, materialId);
  175 + return materialInventoryMapper.selectOne(queryWrapper);
  176 + }
160 177 }
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryin/MaterialInventoryInServiceImpl.java
... ... @@ -74,8 +74,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
74 74 in.setTypeDetailId(material.getTypeDetailId());
75 75 in.setTypeDetailName(material.getTypeDetailName());
76 76 in.setSpecifications(material.getSpecifications());
77   -// in.setBelongCompanyId(material.getBelongCompanyId());
78   -// in.setBelongCompanyName(material.getBelongCompanyName());
79 77 in.setBelongCompanyId(deptRespDTO.getId());
80 78 in.setBelongCompanyName(deptRespDTO.getName());
81 79 in.setInInventoryNum(createReqVO.getInInventoryNum());
... ... @@ -103,8 +101,8 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
103 101 inventory.setTypeDetailId(material.getTypeDetailId());
104 102 inventory.setTypeDetailName(material.getTypeDetailName());
105 103 inventory.setSpecifications(in.getSpecifications());
106   - inventory.setBelongCompanyId(in.getBelongCompanyId());
107   - inventory.setBelongCompanyName(in.getBelongCompanyName());
  104 + inventory.setBelongCompanyId(deptRespDTO.getId());
  105 + inventory.setBelongCompanyName(deptRespDTO.getName());
108 106 inventory.setUnitId(in.getUnitId());
109 107 inventory.setUnitName(in.getUnitName());
110 108 inventory.setCurrentNum(in.getInInventoryNum());
... ... @@ -133,8 +131,6 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
133 131 updateObj.setMaterialTypeId(material.getMaterialTypeId());
134 132 updateObj.setMaterialTypeName(material.getMaterialTypeName());
135 133 updateObj.setSpecifications(material.getSpecifications());
136   - updateObj.setBelongCompanyId(material.getBelongCompanyId());
137   - updateObj.setBelongCompanyName(material.getBelongCompanyName());
138 134 updateObj.setUnitId(material.getUnitId());
139 135 updateObj.setUnitName(material.getUnitName());
140 136 materialInventoryInMapper.updateById(updateObj);
... ... @@ -148,20 +144,17 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
148 144 if (null == materialInventoryIn) {
149 145 throw exception(MATERIAL_INVENTORY_IN_NOT_EXISTS);
150 146 }
151   - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(materialInventoryIn.getMaterialId());
152   - if(null == materialInventory){
  147 + MaterialInventoryDO inventory = materialInventoryService.selectMaterialInventoryByMaterialId(materialInventoryIn.getMaterialId(),getCompanyId());
  148 + if(null == inventory){
153 149 throw exception0(BAD_REQUEST.getCode(),"参数错误");
154 150 }
155 151 //库存已使用
156   - if(materialInventory.getCurrentNum() < materialInventoryIn.getInInventoryNum()){
  152 + if(inventory.getCurrentNum() < materialInventoryIn.getInInventoryNum()){
157 153 throw exception0(BAD_REQUEST.getCode(),"库存已使用");
158 154 }
159 155 //入库记录减扣
160   - MaterialInventoryDO inventory = new MaterialInventoryDO();
161   - inventory.setInventoryId(materialInventory.getInventoryId());
162   - inventory.setMaterialId(materialInventory.getMaterialId());
163   - inventory.setCurrentNum(materialInventory.getCurrentNum() - materialInventoryIn.getInInventoryNum());
164   - inventory.setInventoryTotalNum(materialInventory.getInventoryTotalNum() - materialInventoryIn.getInInventoryNum());
  156 + inventory.setCurrentNum(inventory.getCurrentNum() - materialInventoryIn.getInInventoryNum());
  157 + inventory.setInventoryTotalNum(inventory.getInventoryTotalNum() - materialInventoryIn.getInInventoryNum());
165 158 materialInventoryService.updateTdMaterialInventory(inventory);
166 159 // 删除
167 160 materialInventoryInMapper.deleteById(id);
... ... @@ -187,6 +180,10 @@ public class MaterialInventoryInServiceImpl implements MaterialInventoryInServic
187 180  
188 181 @Override
189 182 public PageResult<MaterialInventoryInDO> getMaterialInventoryInPage(MaterialInventoryInPageReqVO pageReqVO) {
  183 + //查询自己单位入库的记录
  184 + if(getCompanyId() != 100) {
  185 + pageReqVO.setBelongCompanyId(getCompanyId());
  186 + }
190 187 return materialInventoryInMapper.selectPage(pageReqVO);
191 188 }
192 189  
... ...
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventoryout/MaterialInventoryOutServiceImpl.java
1 1 package com.zteits.urbanops.module.garden.service.materialinventoryout;
2 2  
  3 +import cn.hutool.core.util.RandomUtil;
3 4 import com.zteits.urbanops.framework.common.pojo.PageResult;
4 5 import com.zteits.urbanops.framework.common.util.object.BeanUtils;
5 6 import com.zteits.urbanops.module.garden.controller.admin.materialinventoryout.vo.MaterialInventoryOutPageReqVO;
... ... @@ -52,7 +53,7 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
52 53 if(null == material){
53 54 throw exception0(BAD_REQUEST.getCode(), "无效参数-materialId");
54 55 }
55   - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(out.getMaterialId());
  56 + MaterialInventoryDO materialInventory = materialInventoryService.selectMaterialInventoryByMaterialId(material.getMaterialId(),getCompanyId());
56 57 if(null == materialInventory){
57 58 throw exception0(BAD_REQUEST.getCode(),createReqVO.getMaterialName()+"没有库存");
58 59 }
... ... @@ -64,6 +65,8 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
64 65 if(null == deptRespDTO){
65 66 throw exception0(BAD_REQUEST.getCode(), "无效参数-登录人所属单位为空");
66 67 }
  68 + out.setInventoryOutNo(System.currentTimeMillis()+ RandomUtil.randomInt(10, 100000)+"");
  69 + out.setMaterialId(createReqVO.getMaterialId());
67 70 out.setMaterialName(material.getMaterialName());
68 71 out.setMaterialTypeId(material.getMaterialTypeId());
69 72 out.setMaterialTypeName(material.getMaterialTypeName());
... ... @@ -76,8 +79,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
76 79 // out.setBelongCompanyName(material.getBelongCompanyName());
77 80 out.setBelongCompanyId(deptRespDTO.getId());
78 81 out.setBelongCompanyName(deptRespDTO.getName());
  82 + out.setOutInventoryNum(createReqVO.getOutInventoryNum());
79 83 out.setUnitId(material.getUnitId());
80 84 out.setUnitName(material.getUnitName());
  85 + out.setOutDate(createReqVO.getOutDate());
81 86 materialInventoryOutMapper.insert(out);
82 87  
83 88 //更新库存
... ... @@ -103,23 +108,19 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
103 108 throw exception(MATERIAL_INVENTORY_OUT_NOT_EXISTS);
104 109 }
105 110  
106   - //查询库存
107   - MaterialInventoryDO materialInventory = materialInventoryService.selectTdMaterialInventoryByMaterialId(materialInventoryOut.getMaterialId());
108   - if(null == materialInventory){
  111 + MaterialInventoryDO inventory = materialInventoryService.selectMaterialInventoryByMaterialId(materialInventoryOut.getMaterialId(),getCompanyId());
  112 + if(null == inventory){
109 113 throw exception0(BAD_REQUEST.getCode(),"参数错误");
110 114 }
111 115 //库存已使用
112   - if(materialInventory.getCurrentNum() < materialInventoryOut.getOutInventoryNum()){
  116 + if(inventory.getCurrentNum() < materialInventoryOut.getOutInventoryNum()){
113 117 throw exception0(BAD_REQUEST.getCode(),"库存已使用");
114 118 }
115 119  
116 120 //入库记录减扣
117   - MaterialInventoryDO inventory = new MaterialInventoryDO();
118   - inventory.setInventoryId(materialInventory.getInventoryId());
119   - inventory.setMaterialId(materialInventory.getMaterialId());
120   - inventory.setCurrentNum(materialInventory.getCurrentNum() + materialInventoryOut.getOutInventoryNum());
121   - inventory.setInventoryTotalNum(materialInventory.getInventoryTotalNum() + materialInventoryOut.getOutInventoryNum());
122   - inventory.setOutTotalNum(materialInventory.getOutTotalNum() - materialInventoryOut.getOutInventoryNum());
  121 + inventory.setCurrentNum(inventory.getCurrentNum() + materialInventoryOut.getOutInventoryNum());
  122 + inventory.setInventoryTotalNum(inventory.getInventoryTotalNum() + materialInventoryOut.getOutInventoryNum());
  123 + inventory.setOutTotalNum(inventory.getOutTotalNum() - materialInventoryOut.getOutInventoryNum());
123 124 materialInventoryService.updateTdMaterialInventory(inventory);
124 125  
125 126 // 删除
... ... @@ -146,6 +147,10 @@ public class MaterialInventoryOutServiceImpl implements MaterialInventoryOutServ
146 147  
147 148 @Override
148 149 public PageResult<MaterialInventoryOutDO> getMaterialInventoryOutPage(MaterialInventoryOutPageReqVO pageReqVO) {
  150 + //查询自己单位出库的记录
  151 + if(getCompanyId() != 100) {
  152 + pageReqVO.setBelongCompanyId(getCompanyId());
  153 + }
149 154 return materialInventoryOutMapper.selectPage(pageReqVO);
150 155 }
151 156  
... ...