作者 Win10-2023FDZSZ\Administrator

Merge branch 'dev' of http://39.105.222.208:1024/leihd/factory-java into dev

... ... @@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
... ... @@ -82,9 +83,21 @@ public class TblTradeInventoryController extends JeecgController<TblTradeInvento
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
TblTradeMeterial tblTradeMeterial = new TblTradeMeterial();
tblTradeMeterial.setMeterialReview(tblTradeInventory.getMaterialDescription());
QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap());
// TblTradeMeterial tblTradeMeterial = new TblTradeMeterial();
// tblTradeMeterial.setMeterialReview(tblTradeInventory.getMaterialDescription());
// QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap());
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank( tblTradeInventory.getMaterialDescription())){
queryWrapper.like("meterial_review", tblTradeInventory.getMaterialDescription());
}
if (StringUtils.isNotBlank(tblTradeInventory.getMaterialCode())){
queryWrapper.eq("meterial_code", tblTradeInventory.getMaterialCode());
}
if (StringUtils.isNotBlank(tblTradeInventory.getBrand())){
queryWrapper.like("brand", tblTradeInventory.getBrand());
}
Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize);
IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper);
List<TblTradeMeterial> records = pageList.getRecords();
... ...
... ... @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
... ... @@ -42,165 +43,209 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
/**
* @Description: 贸易管理物料表
* @Author: jeecg-boot
* @Date: 2024-12-21
* @Date: 2024-12-21
* @Version: V1.0
*/
@Api(tags="贸易管理物料表")
@Api(tags = "贸易管理物料表")
@RestController
@RequestMapping("/trade/tblTradeMeterial")
@Slf4j
public class TblTradeMeterialController extends JeecgController<TblTradeMeterial, ITblTradeMeterialService> {
@Autowired
private ITblTradeMeterialService tblTradeMeterialService;
@Autowired
private ITblTradeInventoryService tblTradeInventoryService;
@ApiOperation(value = "根据物料编号查询物料基础信息", notes = "根据物料编号查询物料基础信息")
@GetMapping(value = "/queryByMaterialCode")
public Result<TblTradeMeterial> queryByMaterialCode(TblTradeMeterial tblTradeMeterial){
String meterialCode = tblTradeMeterial.getMeterialCode();
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("meterial_code", meterialCode);
List<TblTradeMeterial> list = tblTradeMeterialService.list(queryWrapper);
if (CollectionUtil.isEmpty(list)) {
return Result.error("未找到对应物料信息");
}
if (list.size() > 1) {
return Result.error("物料编码重复,请联系管理员");
}
return Result.OK(list.get(0));
}
/**
* 分页列表查询
*
* @param tblTradeMeterial
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "贸易管理物料表-分页列表查询")
@ApiOperation(value="贸易管理物料表-分页列表查询", notes="贸易管理物料表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<TblTradeMeterial>> queryPageList(TblTradeMeterial tblTradeMeterial,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<TblTradeMeterial> queryWrapper = QueryGenerator.initQueryWrapper(tblTradeMeterial, req.getParameterMap());
Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize);
IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param tblTradeMeterial
* @return
*/
@AutoLog(value = "贸易管理物料表-添加")
@ApiOperation(value="贸易管理物料表-添加", notes="贸易管理物料表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TblTradeMeterial tblTradeMeterial) {
if (StrUtil.isNotBlank(tblTradeMeterial.getCert())){
tblTradeMeterial.setCertDate(new Date());
}
if (StrUtil.isNotBlank(tblTradeMeterial.getModelChange())){
tblTradeMeterial.setModelChangeDate(new Date());
}
if (StrUtil.isNotBlank(tblTradeMeterial.getOther())){
tblTradeMeterial.setOtherDate(new Date());
}
tblTradeMeterialService.save(tblTradeMeterial);
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
tblTradeInventoryService.save(record);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param tblTradeMeterial
* @return
*/
@AutoLog(value = "贸易管理物料表-编辑")
@ApiOperation(value="贸易管理物料表-编辑", notes="贸易管理物料表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody TblTradeMeterial tblTradeMeterial) {
tblTradeMeterialService.updateById(tblTradeMeterial);
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
tblTradeInventoryService.updateById(record);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "贸易管理物料表-通过id删除")
@ApiOperation(value="贸易管理物料表-通过id删除", notes="贸易管理物料表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
tblTradeMeterialService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "贸易管理物料表-批量删除")
@ApiOperation(value="贸易管理物料表-批量删除", notes="贸易管理物料表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.tblTradeMeterialService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "贸易管理物料表-通过id查询")
@ApiOperation(value="贸易管理物料表-通过id查询", notes="贸易管理物料表-通过id查询")
@GetMapping(value = "/queryById")
public Result<TblTradeMeterial> queryById(@RequestParam(name="id",required=true) String id) {
TblTradeMeterial tblTradeMeterial = tblTradeMeterialService.getById(id);
if(tblTradeMeterial==null) {
return Result.error("未找到对应数据");
}
return Result.OK(tblTradeMeterial);
}
@Autowired
private ITblTradeMeterialService tblTradeMeterialService;
@Autowired
private ITblTradeInventoryService tblTradeInventoryService;
@ApiOperation(value = "根据物料编号查询物料基础信息", notes = "根据物料编号查询物料基础信息")
@GetMapping(value = "/queryByMaterialCode")
public Result<TblTradeMeterial> queryByMaterialCode(TblTradeMeterial tblTradeMeterial) {
String meterialCode = tblTradeMeterial.getMeterialCode();
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("meterial_code", meterialCode);
List<TblTradeMeterial> list = tblTradeMeterialService.list(queryWrapper);
if (CollectionUtil.isEmpty(list)) {
return Result.error("未找到对应物料信息");
}
if (list.size() > 1) {
return Result.error("物料编码重复,请联系管理员");
}
return Result.OK(list.get(0));
}
/**
* 分页列表查询
*
* @param tblTradeMeterial
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "贸易管理物料表-分页列表查询")
@ApiOperation(value = "贸易管理物料表-分页列表查询", notes = "贸易管理物料表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<TblTradeMeterial>> queryPageList(TblTradeMeterial tblTradeMeterial,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<TblTradeMeterial> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(tblTradeMeterial.getMeterialReview())) {
queryWrapper.like("meterial_review", tblTradeMeterial.getMeterialReview());
}
if (StringUtils.isNotBlank(tblTradeMeterial.getMeterialCode())) {
queryWrapper.eq("meterial_code", tblTradeMeterial.getMeterialCode());
}
if (StringUtils.isNotBlank(tblTradeMeterial.getBrand())){
queryWrapper.eq("brand", tblTradeMeterial.getBrand());
}
Page<TblTradeMeterial> page = new Page<TblTradeMeterial>(pageNo, pageSize);
IPage<TblTradeMeterial> pageList = tblTradeMeterialService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param tblTradeMeterial
* @return
*/
@AutoLog(value = "贸易管理物料表-添加")
@ApiOperation(value = "贸易管理物料表-添加", notes = "贸易管理物料表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody TblTradeMeterial tblTradeMeterial) {
if (StrUtil.isNotBlank(tblTradeMeterial.getCert())) {
tblTradeMeterial.setCertDate(new Date());
}
if (StrUtil.isNotBlank(tblTradeMeterial.getModelChange())) {
tblTradeMeterial.setModelChangeDate(new Date());
}
if (StrUtil.isNotBlank(tblTradeMeterial.getOther())) {
tblTradeMeterial.setOtherDate(new Date());
}
tblTradeMeterialService.save(tblTradeMeterial);
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
tblTradeInventoryService.save(record);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param tblTradeMeterial
* @return
*/
@AutoLog(value = "贸易管理物料表-编辑")
@ApiOperation(value = "贸易管理物料表-编辑", notes = "贸易管理物料表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody TblTradeMeterial tblTradeMeterial) {
if (tblTradeMeterial == null || tblTradeMeterial.getId() == null) {
return Result.error("参数不正确");
}
//数据库记录信息
TblTradeMeterial meterial = tblTradeMeterialService.getById(tblTradeMeterial.getId());
if (meterial == null) {
return Result.error("未找到对应数据");
}
// 比对此次更新型号变更说明、合格证、其他是否进行了更改,若更改了则将其更新时间进行修改
String modelChange = meterial.getModelChange();
String cert = meterial.getCert();
String other = meterial.getOther();
if ((StrUtil.isNotBlank(modelChange) && StrUtil.isBlank(tblTradeMeterial.getModelChange()))
|| (StrUtil.isBlank(modelChange) && StrUtil.isNotBlank(tblTradeMeterial.getModelChange()))) {
tblTradeMeterial.setModelChangeDate(new Date());
}else if (modelChange != null && !modelChange.equals(tblTradeMeterial.getModelChange())){
tblTradeMeterial.setModelChangeDate(new Date());
}
if ((StrUtil.isNotBlank(cert) && StrUtil.isBlank(tblTradeMeterial.getCert()))
|| (StrUtil.isBlank(cert) && StrUtil.isNotBlank(tblTradeMeterial.getCert()))) {
tblTradeMeterial.setCertDate(new Date());
} else if (cert != null && !cert.equals(tblTradeMeterial.getCert())){
tblTradeMeterial.setCertDate(new Date());
}
if ((StrUtil.isNotBlank(other) && StrUtil.isBlank(tblTradeMeterial.getOther()))
|| (StrUtil.isBlank(other) && StrUtil.isNotBlank(tblTradeMeterial.getOther()))) {
tblTradeMeterial.setOtherDate(new Date());
} else if (other != null && !other.equals(tblTradeMeterial.getOther())){
tblTradeMeterial.setOtherDate(new Date());
}
tblTradeMeterialService.updateById(tblTradeMeterial);
TblTradeInventory record = new TblTradeInventory(tblTradeMeterial);
tblTradeInventoryService.updateById(record);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "贸易管理物料表-通过id删除")
@ApiOperation(value = "贸易管理物料表-通过id删除", notes = "贸易管理物料表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
tblTradeMeterialService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "贸易管理物料表-批量删除")
@ApiOperation(value = "贸易管理物料表-批量删除", notes = "贸易管理物料表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.tblTradeMeterialService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "贸易管理物料表-通过id查询")
@ApiOperation(value = "贸易管理物料表-通过id查询", notes = "贸易管理物料表-通过id查询")
@GetMapping(value = "/queryById")
public Result<TblTradeMeterial> queryById(@RequestParam(name = "id", required = true) String id) {
TblTradeMeterial tblTradeMeterial = tblTradeMeterialService.getById(id);
if (tblTradeMeterial == null) {
return Result.error("未找到对应数据");
}
return Result.OK(tblTradeMeterial);
}
/**
* 导出excel
*
* @param request
* @param tblTradeMeterial
*/
* 导出excel
*
* @param request
* @param tblTradeMeterial
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, TblTradeMeterial tblTradeMeterial) {
return super.exportXls(request, tblTradeMeterial, TblTradeMeterial.class, "贸易管理物料表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, TblTradeMeterial.class);
... ...
... ... @@ -78,9 +78,9 @@ public class TblTradeMeterial implements Serializable {
@ApiModelProperty(value = "型号变更说明")
private java.lang.String modelChange;
/**日期时间*/
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "日期时间")
private java.util.Date modelChangeDate;
/**合格证*/
... ... @@ -88,9 +88,9 @@ public class TblTradeMeterial implements Serializable {
@ApiModelProperty(value = "合格证")
private java.lang.String cert;
/**日期时间*/
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "日期时间")
private java.util.Date certDate;
/**其他*/
... ... @@ -98,9 +98,9 @@ public class TblTradeMeterial implements Serializable {
@ApiModelProperty(value = "其他")
private java.lang.String other;
/**日期时间*/
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@Excel(name = "日期时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "日期时间")
private java.util.Date otherDate;
... ...