地磅代码修改

This commit is contained in:
Administrator 2023-03-22 16:28:44 +08:00
parent 99c3867cf6
commit df90b4f1e6
12 changed files with 152 additions and 86 deletions

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.weight.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -122,9 +123,10 @@ public class GoodsNameController {
* @return
*/
@ApiOperation(value = "删除货名信息", notes = "删除货名信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "货名ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<GoodsName> delete(@RequestParam(name = "id", required = true) String id) {
public Result<GoodsName> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<GoodsName> result = new Result<GoodsName>();
GoodsName goodsName = goodsNameService.getById(id);
if (goodsName == null) {

View File

@ -1,6 +1,8 @@
package com.zhgd.xmgl.modules.weight.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -122,9 +124,10 @@ public class ReceivingForwardingUnitController {
* @return
*/
@ApiOperation(value = "删除收发货单位信息", notes = "删除收发货单位信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "收发货单位ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<ReceivingForwardingUnit> delete(@RequestParam(name = "id", required = true) String id) {
public Result<ReceivingForwardingUnit> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<ReceivingForwardingUnit> result = new Result<ReceivingForwardingUnit>();
ReceivingForwardingUnit receivingForwardingUnit = receivingForwardingUnitService.getById(id);
if (receivingForwardingUnit == null) {

View File

@ -1,43 +1,46 @@
package com.zhgd.xmgl.modules.weight.controller;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.weight.entity.WeighBookVehicleInfo;
import com.zhgd.xmgl.modules.weight.enums.WeighingTypeEnum;
import com.zhgd.xmgl.modules.weight.service.IWeighBookVehicleInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
/**
* @Title: Controller
* @Description: 过磅预约车辆信息
* @author pds
@ -54,20 +57,23 @@ public class WeighBookVehicleInfoController {
/**
* 分页列表查询
*
* @param weighBookVehicleInfo
* @param pageNo
* @param pageSize
* @param lastAdddatetime 现场上次拉取的时间
* @param req
* @return
*/
@ApiOperation(value = " 分页列表查询过磅预约车辆信息信息", notes = "分页列表查询过磅预约车辆信息信息", httpMethod="GET")
@ApiOperation(value = " 分页列表查询过磅预约车辆信息信息", notes = "分页列表查询过磅预约车辆信息信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<IPage<WeighBookVehicleInfo>> queryPageList(WeighBookVehicleInfo weighBookVehicleInfo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
public Result<IPage<WeighBookVehicleInfo>> queryPageList(WeighBookVehicleInfo weighBookVehicleInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, String lastAdddatetime, HttpServletRequest req) {
Result<IPage<WeighBookVehicleInfo>> result = new Result<IPage<WeighBookVehicleInfo>>();
QueryWrapper<WeighBookVehicleInfo> queryWrapper = QueryGenerator.initQueryWrapper(weighBookVehicleInfo, req.getParameterMap());
if (StringUtils.isNotBlank(lastAdddatetime)) {
DateTime dateTime = DateUtil.parse(lastAdddatetime);
queryWrapper.lambda().ge(WeighBookVehicleInfo::getAddDateTime, dateTime);
}
Page<WeighBookVehicleInfo> page = new Page<WeighBookVehicleInfo>(pageNo, pageSize);
IPage<WeighBookVehicleInfo> pageList = weighBookVehicleInfoService.page(page, queryWrapper);
result.setSuccess(true);
@ -105,9 +111,9 @@ public class WeighBookVehicleInfoController {
public Result<WeighBookVehicleInfo> edit(@RequestBody WeighBookVehicleInfo weighBookVehicleInfo) {
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
WeighBookVehicleInfo weighBookVehicleInfoEntity = weighBookVehicleInfoService.getById(weighBookVehicleInfo.getId());
if(weighBookVehicleInfoEntity==null) {
if (weighBookVehicleInfoEntity == null) {
result.error500("未找到对应实体");
}else {
} else {
weighBookVehicleInfoService.updateById(weighBookVehicleInfo);
result.success("修改成功!");
}
@ -117,20 +123,22 @@ public class WeighBookVehicleInfoController {
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "删除过磅预约车辆信息信息", notes = "删除过磅预约车辆信息信息" , httpMethod="POST")
@ApiImplicitParam(name = "id", value = "过磅预约车辆信息ID", paramType = "query", required = true, dataType = "Integer")
@ApiOperation(value = "删除过磅预约车辆信息信息", notes = "删除过磅预约车辆信息信息", httpMethod = "POST")
@PostMapping(value = "/delete")
public Result<WeighBookVehicleInfo> delete(@RequestParam(name="id",required=true) String id) {
public Result<WeighBookVehicleInfo> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
WeighBookVehicleInfo weighBookVehicleInfo = weighBookVehicleInfoService.getById(id);
if(weighBookVehicleInfo==null) {
if (weighBookVehicleInfo == null) {
result.error500("未找到对应实体");
}else {
} else {
boolean ok = weighBookVehicleInfoService.removeById(id);
if(ok) {
if (ok) {
result.success("删除成功!");
}
}
@ -248,4 +256,14 @@ public class WeighBookVehicleInfoController {
return Result.ok("文件导入失败!");
}
/**
* 获取所有过磅类型列表
*
* @return
*/
@GetMapping("/weighingType")
@ApiOperation(value = "获取所有过磅类型列表", notes = "获取所有过磅类型列表", httpMethod = "GET")
public Result<List<WeighingTypeEnum>> getWeighingTypeEnums() {
return Result.success(Arrays.stream(WeighingTypeEnum.values()).collect(Collectors.toList()));
}
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.weight.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@ -120,9 +121,10 @@ public class WeighInfoController {
* @return
*/
@ApiOperation(value = "删除称重记录表信息", notes = "删除称重记录表信息" , httpMethod="POST")
@ApiImplicitParam(name = "id", value = "称重记录表ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<WeighInfo> delete(@RequestParam(name="id",required=true) String id) {
public Result<WeighInfo> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<WeighInfo> result = new Result<WeighInfo>();
WeighInfo weighInfo = weighInfoService.getById(id);
if(weighInfo==null) {

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.weight.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -122,9 +123,10 @@ public class WeighPicController {
* @return
*/
@ApiOperation(value = "删除称重图片信息", notes = "删除称重图片信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "称重图片ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<WeighPic> delete(@RequestParam(name = "id", required = true) String id) {
public Result<WeighPic> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<WeighPic> result = new Result<WeighPic>();
WeighPic weighPic = weighPicService.getById(id);
if (weighPic == null) {

View File

@ -26,7 +26,7 @@ public class GoodsName implements Serializable {
/**主键id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="主键id")
private java.lang.Integer id ;
private java.lang.Long id ;
/**货名*/
@Excel(name = "货名", width = 15)
@ApiModelProperty(value="货名")

View File

@ -26,7 +26,7 @@ public class ReceivingForwardingUnit implements Serializable {
/**主键id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="主键id")
private java.lang.Integer id ;
private java.lang.Long id ;
/**单位名称*/
@Excel(name = "单位名称", width = 15)
@ApiModelProperty(value="单位名称")

View File

@ -26,7 +26,7 @@ public class WeighBookVehicleInfo implements Serializable {
/**主键id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="主键id")
private java.lang.Integer id ;
private java.lang.Long id ;
/**车牌号码*/
@Excel(name = "车牌号码", width = 15)
@ApiModelProperty(value="车牌号码")

View File

@ -26,7 +26,7 @@ public class WeighInfo implements Serializable {
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="id")
private java.lang.Integer id ;
private java.lang.Long id ;
/**流水号*/
@Excel(name = "流水号", width = 15)
@ApiModelProperty(value="流水号")

View File

@ -29,7 +29,7 @@ public class WeighPic implements Serializable {
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键id")
private java.lang.Integer id;
private java.lang.Long id;
/**
* 称重记录ID
*/

View File

@ -0,0 +1,38 @@
package com.zhgd.xmgl.modules.weight.enums;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 过磅类型注解
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum WeighingTypeEnum {
PURCHASED_OVER_THE_SCALE(1, "采购过磅"),
销售过磅SOLD_OVER_POUNDS(2, "销售过磅"),
WEIGHED_INSIDE(3, "内部过磅"),
OTHER_OVERWEIGHS(4, "其他过磅"),
;
private int id;
private String name;
WeighingTypeEnum(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -121,9 +121,10 @@ public class ${entityName}Controller {
* @return
*/
@ApiOperation(value = "删除${tableVo.ftlDescription}信息", notes = "删除${tableVo.ftlDescription}信息" , httpMethod="POST")
@ApiImplicitParam(name = "id", value = "${tableVo.ftlDescription}ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<${entityName}> delete(@RequestParam(name="id",required=true) String id) {
public Result<${entityName}> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<${entityName}> result = new Result<${entityName}>();
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
if(${entityName?uncap_first}==null) {