土石方运输
This commit is contained in:
parent
abcd3f871e
commit
eaedd9df33
@ -0,0 +1,221 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
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.zhgd.xmgl.modules.basicdata.entity.EarthworkTransportation;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IEarthworkTransportationService;
|
||||
|
||||
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.collections.MapUtils;
|
||||
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 springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 土石方运输记录
|
||||
* @author: pengj
|
||||
* @date: 2024-06-28
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/earthworkTransportation")
|
||||
@Slf4j
|
||||
@Api(tags = "土石方运输记录管理")
|
||||
public class EarthworkTransportationController {
|
||||
@Autowired
|
||||
private IEarthworkTransportationService earthworkTransportationService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "分页查询", operDesc = "分页列表查询土石方运输记录信息")
|
||||
@ApiOperation(value = " 分页列表查询土石方运输记录信息", notes = "分页列表查询土石方运输记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/page")
|
||||
public Result<IPage<EarthworkTransportation>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<EarthworkTransportation> queryWrapper = QueryGenerator.initPageQueryWrapper(EarthworkTransportation.class, map);
|
||||
Page<EarthworkTransportation> page = PageUtil.getPage(map);
|
||||
queryWrapper.lambda().orderByDesc(EarthworkTransportation::getCreateTime);
|
||||
IPage<EarthworkTransportation> pageList = earthworkTransportationService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param earthworkTransportation
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "列表查询", operDesc = "列表查询土石方运输记录信息")
|
||||
@ApiOperation(value = " 列表查询土石方运输记录信息", notes = "列表查询土石方运输记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/list")
|
||||
public Result<List<EarthworkTransportation>> queryList(@RequestBody EarthworkTransportation earthworkTransportation) {
|
||||
QueryWrapper<EarthworkTransportation> queryWrapper = QueryGenerator.initQueryWrapper(earthworkTransportation);
|
||||
queryWrapper.lambda().orderByDesc(EarthworkTransportation::getCreateTime);
|
||||
List<EarthworkTransportation> list = earthworkTransportationService.list(queryWrapper);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param earthworkTransportation
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "新增", operDesc = "添加土石方运输记录信息")
|
||||
@ApiOperation(value = " 添加土石方运输记录信息", notes = "添加土石方运输记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody EarthworkTransportation earthworkTransportation) {
|
||||
earthworkTransportation.setCreateBy(SecurityUtils.getUser().getUserId().toString());
|
||||
earthworkTransportation.setCreateTime(new Date());
|
||||
earthworkTransportationService.save(earthworkTransportation);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param earthworkTransportation
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "修改", operDesc = "编辑土石方运输记录信息")
|
||||
@ApiOperation(value = "编辑土石方运输记录信息", notes = "编辑土石方运输记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<EarthworkTransportation> edit(@RequestBody EarthworkTransportation earthworkTransportation) {
|
||||
Result<EarthworkTransportation> result = new Result<EarthworkTransportation>();
|
||||
EarthworkTransportation earthworkTransportationEntity = earthworkTransportationService.getById(earthworkTransportation.getId());
|
||||
if (earthworkTransportationEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = earthworkTransportationService.updateById(earthworkTransportation);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "删除", operDesc = "删除土石方运输记录信息")
|
||||
@ApiOperation(value = "删除土石方运输记录信息", notes = "删除土石方运输记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "土石方运输记录ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<EarthworkTransportation> delete(@RequestBody EarthworkTransportation earthworkTransportation) {
|
||||
Result<EarthworkTransportation> result = new Result<EarthworkTransportation>();
|
||||
EarthworkTransportation earthworkTransportationEntity = earthworkTransportationService.getById(earthworkTransportation.getId());
|
||||
if (earthworkTransportationEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = earthworkTransportationService.removeById(earthworkTransportation.getId());
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "批量删除", operDesc = "批量删除土石方运输记录信息")
|
||||
@ApiOperation(value = "批量删除土石方运输记录信息", notes = "批量删除土石方运输记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "土石方运输记录ID字符串", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<EarthworkTransportation> deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<EarthworkTransportation> result = new Result<EarthworkTransportation>();
|
||||
String ids = MapUtils.getString(map, "ids");
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.earthworkTransportationService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "查询", operDesc = "通过id查询土石方运输记录信息")
|
||||
@ApiOperation(value = "通过id查询土石方运输记录信息", notes = "通过id查询土石方运输记录信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "土石方运输记录ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<EarthworkTransportation> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<EarthworkTransportation> result = new Result<EarthworkTransportation>();
|
||||
EarthworkTransportation earthworkTransportation = earthworkTransportationService.getById(MapUtils.getString(map, "id"));
|
||||
if (earthworkTransportation == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(earthworkTransportation);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@OperLog(operModul = "土石方运输记录管理", operType = "分页查询", operDesc = "根据日期统计运输的总重量")
|
||||
@ApiOperation(value = " 根据日期统计运输的总重量", notes = "根据日期统计运输的总重量", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "transportDate", value = "日期", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String")
|
||||
})
|
||||
@PostMapping(value = "/getTotalByDate")
|
||||
public Result<Object> getTotalByDate(@ApiIgnore @RequestBody EarthworkTransportation earthworkTransportation) {
|
||||
QueryWrapper<EarthworkTransportation> queryWrapper = QueryGenerator.initQueryWrapper(earthworkTransportation);
|
||||
List<EarthworkTransportation> list = earthworkTransportationService.list(queryWrapper);
|
||||
return Result.success(list.stream().mapToDouble(l -> Double.valueOf(l.getTotalWeight())).sum());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 土石方运输记录
|
||||
* @author: pengj
|
||||
* @date: 2024-06-28
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("earthwork_transportation")
|
||||
@ApiModel(value = "EarthworkTransportation实体类", description = "EarthworkTransportation")
|
||||
public class EarthworkTransportation implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 驾驶员
|
||||
*/
|
||||
@Excel(name = "驾驶员", width = 15)
|
||||
@ApiModelProperty(value = "驾驶员")
|
||||
private String driver;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
@Excel(name = "车牌号", width = 15)
|
||||
@ApiModelProperty(value = "车牌号")
|
||||
private String carNumber;
|
||||
/**
|
||||
* 车辆尺寸(长宽高)
|
||||
*/
|
||||
@Excel(name = "车辆尺寸(长宽高)", width = 15)
|
||||
@ApiModelProperty(value = "车辆尺寸(长宽高)")
|
||||
private String carSize;
|
||||
/**
|
||||
* 总重量
|
||||
*/
|
||||
@Excel(name = "总重量", width = 15)
|
||||
@ApiModelProperty(value = "总重量")
|
||||
private String totalWeight;
|
||||
/**
|
||||
* 运输次数
|
||||
*/
|
||||
@Excel(name = "运输次数", width = 15)
|
||||
@ApiModelProperty(value = "运输次数")
|
||||
private Integer frequency;
|
||||
/**
|
||||
* 运输日期
|
||||
*/
|
||||
@Excel(name = "运输日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "运输日期")
|
||||
private Date transportDate;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号", width = 15)
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phoneNumber;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
/**
|
||||
* 项目SN
|
||||
*/
|
||||
@Excel(name = "项目SN", width = 15)
|
||||
@ApiModelProperty(value = "项目SN")
|
||||
private String projectSn;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "创建人", width = 15)
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "创建时间", width = 20, 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 Date createTime;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.EarthworkTransportation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 土石方运输记录
|
||||
* @author: pengj
|
||||
* @date: 2024-06-28
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EarthworkTransportationMapper extends BaseMapper<EarthworkTransportation> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.basicdata.mapper.EarthworkTransportationMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.EarthworkTransportation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 土石方运输记录
|
||||
* @author: pengj
|
||||
* @date: 2024-06-28
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IEarthworkTransportationService extends IService<EarthworkTransportation> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.EarthworkTransportation;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.EarthworkTransportationMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IEarthworkTransportationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 土石方运输记录
|
||||
* @author: pengj
|
||||
* @date: 2024-06-28
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class EarthworkTransportationServiceImpl extends ServiceImpl<EarthworkTransportationMapper, EarthworkTransportation> implements IEarthworkTransportationService {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user