损失和贫化报表新增

This commit is contained in:
xvx 2025-05-05 01:01:19 +08:00
parent fe7bc58857
commit 4d2c9a2519
6 changed files with 96 additions and 21 deletions

View File

@ -1,7 +1,12 @@
package com.jdc.jdcproject.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jdc.jdcproject.entity.DicekeMiningloss;
import com.jdc.jdcproject.entity.DicekePlatearea;
import com.jdc.jdcproject.entity.DicekeShovel;
import com.jdc.jdcproject.service.IDicekeMininglossService;
import com.jdc.jdcproject.service.IDicekePlateareaService;
import com.jdc.jdcproject.service.IDicekeShovelService;
import com.jdc.jdcproject.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,8 +33,8 @@ public class DicekeMininglossController {
@Operation(summary = "查询损失和贫化报表")
@GetMapping("findAllMininggloss")
public Result findAll(){
List<DicekeMininglossVo> dicekeMininglossVoList = dicekeMininglossService.findAll();
public Result findAllLoss(){
List<DicekeMininglossVo> dicekeMininglossVoList = dicekeMininglossService.findAllLoss();
System.out.println(dicekeMininglossVoList.toString());
return Result.successResult().data("dicekeMininglossVoList", dicekeMininglossVoList);
}
@ -47,7 +52,7 @@ public class DicekeMininglossController {
@Operation(summary = "删除损失和贫化信息")
@DeleteMapping("deletedicekeMiningloss/{lossID}")
public Result deletedicekeMiningloss(@PathVariable String lossID){
public Result deleteLoss(@PathVariable String lossID){
boolean updateflag = dicekeMininglossService.removeById(lossID);
if(updateflag){
return Result.successResult();
@ -58,9 +63,25 @@ public class DicekeMininglossController {
@Operation(summary = "根据id查询损失和贫化信息")
@GetMapping("finddicekeMininglossById/{lossID}")
public Result finddicekeMininglossByID(@PathVariable String lossID){
public Result findLossByID(@PathVariable String lossID){
DicekeMiningloss lossById = dicekeMininglossService.getById(lossID);
return Result.successResult().data("dicekeMininglossServiceById",lossById);
}
@Operation(summary = "新增损失和贫化信息")
@PostMapping("savedicekeMiningloss")
public Result saveLoss(@RequestBody DicekeMininglossVo dicekeMininglossVo){
int savedml = dicekeMininglossService.savedml(dicekeMininglossVo);
if(savedml == 1) {
return Result.errorResult().data("平盘不存在",savedml);
} else if (savedml == 2) {
return Result.errorResult().data("电铲不存在",savedml);
} else {
return Result.successResult();
}
}
}

View File

@ -8,18 +8,8 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
* 采剥与贫损表;
* </p>
*
* @author haoyanlu
* @since 2025-04-26
*/
@TableName("diceke_miningloss")
@Schema(name = "DicekeMiningloss", description = "采剥与贫损表;")
@Data
public class DicekeMininglossVo implements Serializable {
public class DicekeMininglossVo {
private static final long serialVersionUID = 1L;

View File

@ -18,5 +18,6 @@ import java.util.List;
@Mapper
public interface DicekeMininglossMapper extends BaseMapper<DicekeMiningloss> {
List<DicekeMininglossVo> findAll();
List<DicekeMininglossVo> findAllLoss();
}

View File

@ -3,7 +3,7 @@
<mapper namespace="com.jdc.jdcproject.mapper.DicekeMininglossMapper">
<!-- 表结构 平盘-电铲号-剥离量-采剥总量-采下废石-贫化率-损失率-配矿配矿量-备注-月份 -->
<select id="findAll" resultType="com.jdc.jdcproject.entity.VO.DicekeMininglossVo">
<select id="findAllLoss" resultType="com.jdc.jdcproject.entity.VO.DicekeMininglossVo">
select dml.LossID,
dp.PlateRange,
ds.ShovelCode,
@ -19,5 +19,4 @@
LEFT JOIN diceke_platearea dp ON dml.PlateID = dp.PlateID
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
</select>
</mapper>

View File

@ -3,6 +3,7 @@ package com.jdc.jdcproject.service;
import com.jdc.jdcproject.entity.DicekeMiningloss;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
import com.jdc.jdcproject.utils.Result;
import java.util.List;
@ -16,5 +17,7 @@ import java.util.List;
*/
public interface IDicekeMininglossService extends IService<DicekeMiningloss> {
List<DicekeMininglossVo> findAll();
List<DicekeMininglossVo> findAllLoss();
int savedml(DicekeMininglossVo dicekeMininglossVo);
}

View File

@ -1,10 +1,19 @@
package com.jdc.jdcproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jdc.jdcproject.entity.DicekeMiningloss;
import com.jdc.jdcproject.entity.DicekePlatearea;
import com.jdc.jdcproject.entity.DicekeShovel;
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
import com.jdc.jdcproject.mapper.DicekeMininglossMapper;
import com.jdc.jdcproject.mapper.DicekePlateareaMapper;
import com.jdc.jdcproject.mapper.DicekeShovelMapper;
import com.jdc.jdcproject.service.IDicekeMininglossService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jdc.jdcproject.service.IDicekePlateareaService;
import com.jdc.jdcproject.service.IDicekeShovelService;
import com.jdc.jdcproject.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@ -20,8 +29,60 @@ import java.util.List;
@Service
public class DicekeMininglossServiceImpl extends ServiceImpl<DicekeMininglossMapper, DicekeMiningloss> implements IDicekeMininglossService {
@Autowired
private DicekeMininglossMapper dicekeMininglossMapper;
@Autowired
private DicekeShovelMapper dicekeShovelMapper;
@Autowired
private DicekePlateareaMapper dicekePlateareaMapper;
@Override
public List<DicekeMininglossVo> findAll() {
return baseMapper.findAll();
public List<DicekeMininglossVo> findAllLoss() {
return baseMapper.findAllLoss();
}
@Override
public int savedml(DicekeMininglossVo dicekeMininglossVo) {
/*
QueryWrapper<DicekePlatearea> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("plateRange",dicekeMininglossVo.getPlateRange());
DicekePlatearea dp = dicekePlateareaService.getOne(queryWrapper);
*/
//平盘和电铲查找单独一个工具类使用次数多
DicekePlatearea dp = dicekePlateareaMapper.selectOne(
new QueryWrapper<DicekePlatearea>().eq("plateRange", dicekeMininglossVo.getPlateRange())
);
System.out.println(dp);
if (dp == null){
return 1;
}
//不确定是否是数据库表的问题 报错
DicekeShovel ds = dicekeShovelMapper.selectOne(
new QueryWrapper<DicekeShovel>().eq("shovelCode", dicekeMininglossVo.getShovelCode())
);
System.out.println(ds);
if (ds == null){
// return Result.errorResult().data("电铲不存在",ds);
return 2;
}
//构建报表实体
//Loss的id生成
DicekeMiningloss dml = new DicekeMiningloss();
dml.setShovelID(ds.getShovelID());
dml.setPlateID(dp.getPlateID());
dml.setMonth(dicekeMininglossVo.getMonth());
dml.setStrippingTon(dicekeMininglossVo.getStrippingTon());
dml.setStrippingAndTotalMiningTon(dicekeMininglossVo.getStrippingAndTotalMiningTon());
dml.setWasteRockTon(dicekeMininglossVo.getWasteRockTon());
dml.setDilutionRate(dicekeMininglossVo.getDilutionRate());
dml.setLossRate(dicekeMininglossVo.getLossRate());
dml.setAllocationTon(dicekeMininglossVo.getAllocationTon());
dicekeMininglossMapper.insert(dml);
//时间戳接收前端传还是后端获取
return 20000;
}
}