|
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse; |
|
@@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse; |
|
13
|
|
13
|
|
|
14
|
import cn.hutool.core.collection.CollectionUtil;
|
14
|
import cn.hutool.core.collection.CollectionUtil;
|
|
15
|
import cn.hutool.core.util.StrUtil;
|
15
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
16
|
+import org.apache.commons.lang3.StringUtils;
|
|
16
|
import org.jeecg.common.api.vo.Result;
|
17
|
import org.jeecg.common.api.vo.Result;
|
|
17
|
import org.jeecg.common.system.query.QueryGenerator;
|
18
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
18
|
import org.jeecg.common.util.oConvertUtils;
|
19
|
import org.jeecg.common.util.oConvertUtils;
|
|
@@ -42,13 +43,13 @@ import io.swagger.annotations.Api; |
|
@@ -42,13 +43,13 @@ import io.swagger.annotations.Api; |
|
42
|
import io.swagger.annotations.ApiOperation;
|
43
|
import io.swagger.annotations.ApiOperation;
|
|
43
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
44
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
44
|
|
45
|
|
|
45
|
- /**
|
46
|
+/**
|
|
46
|
* @Description: 贸易管理物料表
|
47
|
* @Description: 贸易管理物料表
|
|
47
|
* @Author: jeecg-boot
|
48
|
* @Author: jeecg-boot
|
|
48
|
* @Date: 2024-12-21
|
49
|
* @Date: 2024-12-21
|
|
49
|
* @Version: V1.0
|
50
|
* @Version: V1.0
|
|
50
|
*/
|
51
|
*/
|
|
51
|
-@Api(tags="贸易管理物料表")
|
52
|
+@Api(tags = "贸易管理物料表")
|
|
52
|
@RestController
|
53
|
@RestController
|
|
53
|
@RequestMapping("/trade/tblTradeMeterial")
|
54
|
@RequestMapping("/trade/tblTradeMeterial")
|
|
54
|
@Slf4j
|
55
|
@Slf4j
|
|
@@ -61,7 +62,7 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -61,7 +62,7 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
61
|
|
62
|
|
|
62
|
@ApiOperation(value = "根据物料编号查询物料基础信息", notes = "根据物料编号查询物料基础信息")
|
63
|
@ApiOperation(value = "根据物料编号查询物料基础信息", notes = "根据物料编号查询物料基础信息")
|
|
63
|
@GetMapping(value = "/queryByMaterialCode")
|
64
|
@GetMapping(value = "/queryByMaterialCode")
|
|
64
|
- public Result<TblTradeMeterial> queryByMaterialCode(TblTradeMeterial tblTradeMeterial){
|
65
|
+ public Result<TblTradeMeterial> queryByMaterialCode(TblTradeMeterial tblTradeMeterial) {
|
|
65
|
String meterialCode = tblTradeMeterial.getMeterialCode();
|
66
|
String meterialCode = tblTradeMeterial.getMeterialCode();
|
|
66
|
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
|
67
|
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
|
|
67
|
queryWrapper.eq("meterial_code", meterialCode);
|
68
|
queryWrapper.eq("meterial_code", meterialCode);
|
|
@@ -85,13 +86,22 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -85,13 +86,22 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
85
|
* @return
|
86
|
* @return
|
|
86
|
*/
|
87
|
*/
|
|
87
|
//@AutoLog(value = "贸易管理物料表-分页列表查询")
|
88
|
//@AutoLog(value = "贸易管理物料表-分页列表查询")
|
|
88
|
- @ApiOperation(value="贸易管理物料表-分页列表查询", notes="贸易管理物料表-分页列表查询")
|
89
|
+ @ApiOperation(value = "贸易管理物料表-分页列表查询", notes = "贸易管理物料表-分页列表查询")
|
|
89
|
@GetMapping(value = "/list")
|
90
|
@GetMapping(value = "/list")
|
|
90
|
public Result<IPage<TblTradeMeterial>> queryPageList(TblTradeMeterial tblTradeMeterial,
|
91
|
public Result<IPage<TblTradeMeterial>> queryPageList(TblTradeMeterial tblTradeMeterial,
|
|
91
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
92
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
92
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
|
93
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
93
|
HttpServletRequest req) {
|
94
|
HttpServletRequest req) {
|
|
94
|
- QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap());
|
95
|
+ QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
|
|
|
|
96
|
+ if (StringUtils.isNotBlank(tblTradeMeterial.getMeterialReview())) {
|
|
|
|
97
|
+ queryWrapper.like("meterial_review", tblTradeMeterial.getMeterialReview());
|
|
|
|
98
|
+ }
|
|
|
|
99
|
+ if (StringUtils.isNotBlank(tblTradeMeterial.getMeterialCode())) {
|
|
|
|
100
|
+ queryWrapper.eq("meterial_code", tblTradeMeterial.getMeterialCode());
|
|
|
|
101
|
+ }
|
|
|
|
102
|
+ if (StringUtils.isNotBlank(tblTradeMeterial.getBrand())){
|
|
|
|
103
|
+ queryWrapper.eq("brand", tblTradeMeterial.getBrand());
|
|
|
|
104
|
+ }
|
|
95
|
Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize);
|
105
|
Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize);
|
|
96
|
IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper);
|
106
|
IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper);
|
|
97
|
return Result.OK(pageList);
|
107
|
return Result.OK(pageList);
|
|
@@ -104,16 +114,16 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -104,16 +114,16 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
104
|
* @return
|
114
|
* @return
|
|
105
|
*/
|
115
|
*/
|
|
106
|
@AutoLog(value = "贸易管理物料表-添加")
|
116
|
@AutoLog(value = "贸易管理物料表-添加")
|
|
107
|
- @ApiOperation(value="贸易管理物料表-添加", notes="贸易管理物料表-添加")
|
117
|
+ @ApiOperation(value = "贸易管理物料表-添加", notes = "贸易管理物料表-添加")
|
|
108
|
@PostMapping(value = "/add")
|
118
|
@PostMapping(value = "/add")
|
|
109
|
public Result<String> add(@RequestBody TblTradeMeterial tblTradeMeterial) {
|
119
|
public Result<String> add(@RequestBody TblTradeMeterial tblTradeMeterial) {
|
|
110
|
- if (StrUtil.isNotBlank(tblTradeMeterial.getCert())){
|
120
|
+ if (StrUtil.isNotBlank(tblTradeMeterial.getCert())) {
|
|
111
|
tblTradeMeterial.setCertDate(new Date());
|
121
|
tblTradeMeterial.setCertDate(new Date());
|
|
112
|
}
|
122
|
}
|
|
113
|
- if (StrUtil.isNotBlank(tblTradeMeterial.getModelChange())){
|
123
|
+ if (StrUtil.isNotBlank(tblTradeMeterial.getModelChange())) {
|
|
114
|
tblTradeMeterial.setModelChangeDate(new Date());
|
124
|
tblTradeMeterial.setModelChangeDate(new Date());
|
|
115
|
}
|
125
|
}
|
|
116
|
- if (StrUtil.isNotBlank(tblTradeMeterial.getOther())){
|
126
|
+ if (StrUtil.isNotBlank(tblTradeMeterial.getOther())) {
|
|
117
|
tblTradeMeterial.setOtherDate(new Date());
|
127
|
tblTradeMeterial.setOtherDate(new Date());
|
|
118
|
}
|
128
|
}
|
|
119
|
tblTradeMeterialService.save(tblTradeMeterial);
|
129
|
tblTradeMeterialService.save(tblTradeMeterial);
|
|
@@ -129,9 +139,44 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -129,9 +139,44 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
129
|
* @return
|
139
|
* @return
|
|
130
|
*/
|
140
|
*/
|
|
131
|
@AutoLog(value = "贸易管理物料表-编辑")
|
141
|
@AutoLog(value = "贸易管理物料表-编辑")
|
|
132
|
- @ApiOperation(value="贸易管理物料表-编辑", notes="贸易管理物料表-编辑")
|
|
|
|
133
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
142
|
+ @ApiOperation(value = "贸易管理物料表-编辑", notes = "贸易管理物料表-编辑")
|
|
|
|
143
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
134
|
public Result<String> edit(@RequestBody TblTradeMeterial tblTradeMeterial) {
|
144
|
public Result<String> edit(@RequestBody TblTradeMeterial tblTradeMeterial) {
|
|
|
|
145
|
+ if (tblTradeMeterial == null || tblTradeMeterial.getId() == null) {
|
|
|
|
146
|
+ return Result.error("参数不正确");
|
|
|
|
147
|
+ }
|
|
|
|
148
|
+ //数据库记录信息
|
|
|
|
149
|
+ TblTradeMeterial meterial = tblTradeMeterialService.getById(tblTradeMeterial.getId());
|
|
|
|
150
|
+ if (meterial == null) {
|
|
|
|
151
|
+ return Result.error("未找到对应数据");
|
|
|
|
152
|
+ }
|
|
|
|
153
|
+// 比对此次更新型号变更说明、合格证、其他是否进行了更改,若更改了则将其更新时间进行修改
|
|
|
|
154
|
+ String modelChange = meterial.getModelChange();
|
|
|
|
155
|
+ String cert = meterial.getCert();
|
|
|
|
156
|
+ String other = meterial.getOther();
|
|
|
|
157
|
+ if ((StrUtil.isNotBlank(modelChange) && StrUtil.isBlank(tblTradeMeterial.getModelChange()))
|
|
|
|
158
|
+ || (StrUtil.isBlank(modelChange) && StrUtil.isNotBlank(tblTradeMeterial.getModelChange()))) {
|
|
|
|
159
|
+ tblTradeMeterial.setModelChangeDate(new Date());
|
|
|
|
160
|
+ }else if (modelChange != null && !modelChange.equals(tblTradeMeterial.getModelChange())){
|
|
|
|
161
|
+ tblTradeMeterial.setModelChangeDate(new Date());
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+
|
|
|
|
164
|
+ if ((StrUtil.isNotBlank(cert) && StrUtil.isBlank(tblTradeMeterial.getCert()))
|
|
|
|
165
|
+ || (StrUtil.isBlank(cert) && StrUtil.isNotBlank(tblTradeMeterial.getCert()))) {
|
|
|
|
166
|
+
|
|
|
|
167
|
+ tblTradeMeterial.setCertDate(new Date());
|
|
|
|
168
|
+ } else if (cert != null && !cert.equals(tblTradeMeterial.getCert())){
|
|
|
|
169
|
+
|
|
|
|
170
|
+ tblTradeMeterial.setCertDate(new Date());
|
|
|
|
171
|
+ }
|
|
|
|
172
|
+
|
|
|
|
173
|
+ if ((StrUtil.isNotBlank(other) && StrUtil.isBlank(tblTradeMeterial.getOther()))
|
|
|
|
174
|
+ || (StrUtil.isBlank(other) && StrUtil.isNotBlank(tblTradeMeterial.getOther()))) {
|
|
|
|
175
|
+ tblTradeMeterial.setOtherDate(new Date());
|
|
|
|
176
|
+ } else if (other != null && !other.equals(tblTradeMeterial.getOther())){
|
|
|
|
177
|
+ tblTradeMeterial.setOtherDate(new Date());
|
|
|
|
178
|
+ }
|
|
|
|
179
|
+
|
|
135
|
tblTradeMeterialService.updateById(tblTradeMeterial);
|
180
|
tblTradeMeterialService.updateById(tblTradeMeterial);
|
|
136
|
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
|
181
|
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
|
|
137
|
tblTradeInventoryService.updateById(record);
|
182
|
tblTradeInventoryService.updateById(record);
|
|
@@ -145,9 +190,9 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -145,9 +190,9 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
145
|
* @return
|
190
|
* @return
|
|
146
|
*/
|
191
|
*/
|
|
147
|
@AutoLog(value = "贸易管理物料表-通过id删除")
|
192
|
@AutoLog(value = "贸易管理物料表-通过id删除")
|
|
148
|
- @ApiOperation(value="贸易管理物料表-通过id删除", notes="贸易管理物料表-通过id删除")
|
193
|
+ @ApiOperation(value = "贸易管理物料表-通过id删除", notes = "贸易管理物料表-通过id删除")
|
|
149
|
@DeleteMapping(value = "/delete")
|
194
|
@DeleteMapping(value = "/delete")
|
|
150
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
195
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
151
|
tblTradeMeterialService.removeById(id);
|
196
|
tblTradeMeterialService.removeById(id);
|
|
152
|
return Result.OK("删除成功!");
|
197
|
return Result.OK("删除成功!");
|
|
153
|
}
|
198
|
}
|
|
@@ -159,9 +204,9 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -159,9 +204,9 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
159
|
* @return
|
204
|
* @return
|
|
160
|
*/
|
205
|
*/
|
|
161
|
@AutoLog(value = "贸易管理物料表-批量删除")
|
206
|
@AutoLog(value = "贸易管理物料表-批量删除")
|
|
162
|
- @ApiOperation(value="贸易管理物料表-批量删除", notes="贸易管理物料表-批量删除")
|
207
|
+ @ApiOperation(value = "贸易管理物料表-批量删除", notes = "贸易管理物料表-批量删除")
|
|
163
|
@DeleteMapping(value = "/deleteBatch")
|
208
|
@DeleteMapping(value = "/deleteBatch")
|
|
164
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
209
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
165
|
this.tblTradeMeterialService.removeByIds(Arrays.asList(ids.split(",")));
|
210
|
this.tblTradeMeterialService.removeByIds(Arrays.asList(ids.split(",")));
|
|
166
|
return Result.OK("批量删除成功!");
|
211
|
return Result.OK("批量删除成功!");
|
|
167
|
}
|
212
|
}
|
|
@@ -173,11 +218,11 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
@@ -173,11 +218,11 @@ public class TblTradeMeterialController extends JeecgController<TblTradeMeterial |
|
173
|
* @return
|
218
|
* @return
|
|
174
|
*/
|
219
|
*/
|
|
175
|
//@AutoLog(value = "贸易管理物料表-通过id查询")
|
220
|
//@AutoLog(value = "贸易管理物料表-通过id查询")
|
|
176
|
- @ApiOperation(value="贸易管理物料表-通过id查询", notes="贸易管理物料表-通过id查询")
|
221
|
+ @ApiOperation(value = "贸易管理物料表-通过id查询", notes = "贸易管理物料表-通过id查询")
|
|
177
|
@GetMapping(value = "/queryById")
|
222
|
@GetMapping(value = "/queryById")
|
|
178
|
- public Result<TblTradeMeterial> queryById(@RequestParam(name="id",required=true) String id) {
|
223
|
+ public Result<TblTradeMeterial> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
179
|
TblTradeMeterial tblTradeMeterial = tblTradeMeterialService.getById(id);
|
224
|
TblTradeMeterial tblTradeMeterial = tblTradeMeterialService.getById(id);
|
|
180
|
- if(tblTradeMeterial==null) {
|
225
|
+ if (tblTradeMeterial == null) {
|
|
181
|
return Result.error("未找到对应数据");
|
226
|
return Result.error("未找到对应数据");
|
|
182
|
}
|
227
|
}
|
|
183
|
return Result.OK(tblTradeMeterial);
|
228
|
return Result.OK(tblTradeMeterial);
|