Compare commits
5 Commits
3018fc4494
...
42dc0c37e9
Author | SHA1 | Date | |
---|---|---|---|
42dc0c37e9 | |||
606ce6e3f6 | |||
101796bff5 | |||
8afa943305 | |||
4d2c9a2519 |
@ -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;
|
||||
@ -9,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -28,12 +34,31 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "通过Month查询损失和贫化报表")
|
||||
@GetMapping("findLossByMonth")
|
||||
public Result findLossByMonth(@RequestParam(required = false) LocalDate Month,
|
||||
@RequestParam(required = false) LocalDate endMonth) {
|
||||
|
||||
if(Month != null && endMonth != null){ //两个时间段内查询
|
||||
List<DicekeMininglossVo> LossByMonthRangeVoList = dicekeMininglossService.getLossByMonthRange(Month,endMonth);
|
||||
System.out.println(LossByMonthRangeVoList.toString());
|
||||
return Result.successResult().data("LossMonthRangeList", LossByMonthRangeVoList);
|
||||
} else if (Month != null){ //Month存在 通过获取year年和month月查询此月报表
|
||||
List<DicekeMininglossVo> LossByMonthVoList = dicekeMininglossService.getLossByMonth(Month);
|
||||
System.out.println(LossByMonthVoList.toString());
|
||||
return Result.successResult().data("LossMonthVoList", LossByMonthVoList);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "修改损失和贫化信息")
|
||||
@PostMapping("updatedicekeMiningloss")
|
||||
public Result updateLoss(@RequestBody DicekeMiningloss dicekeMiningloss){
|
||||
@ -47,7 +72,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 +83,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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,4 +66,11 @@ public class DicekePrecipitationController {
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询降水量信息")
|
||||
@GetMapping("findPrecipitationById/{id}")
|
||||
public Result findPrecipitationById(@PathVariable String id) {
|
||||
DicekePrecipitation dicekePrecipitation = dicekePrecipitationService.getById(id);
|
||||
return Result.successResult().data("precipitationById",dicekePrecipitation);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -18,5 +19,11 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface DicekeMininglossMapper extends BaseMapper<DicekeMiningloss> {
|
||||
|
||||
List<DicekeMininglossVo> findAll();
|
||||
List<DicekeMininglossVo> findAllLoss();
|
||||
|
||||
|
||||
List<DicekeMininglossVo> findLossByMonthRange(int SmonthM, int SmonthY, int endMonthM, int endMonthY);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> findLossByMonth(int monthV,int year);
|
||||
}
|
||||
|
@ -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,
|
||||
@ -20,4 +20,41 @@
|
||||
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
|
||||
</select>
|
||||
|
||||
<select id="findLossByMonthRange" resultType="com.jdc.jdcproject.entity.VO.DicekeMininglossVo">
|
||||
select dml.LossID,
|
||||
dp.PlateRange,
|
||||
ds.ShovelCode,
|
||||
dml.StrippingTon,
|
||||
dml.StrippingAndTotalMiningTon,
|
||||
dml.WasteRockTon,
|
||||
dml.DilutionRate,
|
||||
dml.LossRate,
|
||||
dml.AllocationTon,
|
||||
dml.Month,
|
||||
dml.beizhu
|
||||
FROM diceke_miningloss dml
|
||||
LEFT JOIN diceke_platearea dp ON dml.PlateID = dp.PlateID
|
||||
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
|
||||
WHERE (YEAR(dml.Month) > #{SmonthY} OR (YEAR(dml.Month) = #{SmonthY} AND MONTH(dml.Month) >= #{SmonthM}))
|
||||
AND
|
||||
(YEAR(dml.Month) < #{endMonthY} OR (YEAR(dml.Month) = #{endMonthY} AND MONTH(dml.Month) <= #{endMonthM}))
|
||||
</select>
|
||||
|
||||
<select id="findLossByMonth" resultType="com.jdc.jdcproject.entity.VO.DicekeMininglossVo">
|
||||
select dml.LossID,
|
||||
dp.PlateRange,
|
||||
ds.ShovelCode,
|
||||
dml.StrippingTon,
|
||||
dml.StrippingAndTotalMiningTon,
|
||||
dml.WasteRockTon,
|
||||
dml.DilutionRate,
|
||||
dml.LossRate,
|
||||
dml.AllocationTon,
|
||||
dml.Month,
|
||||
dml.beizhu
|
||||
FROM diceke_miningloss dml
|
||||
LEFT JOIN diceke_platearea dp ON dml.PlateID = dp.PlateID
|
||||
LEFT JOIN diceke_shovel ds ON dml.ShovelID = ds.ShovelID
|
||||
WHERE YEAR(dml.Month) = #{year} AND MONTH(dml.Month) = #{monthV}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -3,7 +3,9 @@ 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.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -16,5 +18,13 @@ import java.util.List;
|
||||
*/
|
||||
public interface IDicekeMininglossService extends IService<DicekeMiningloss> {
|
||||
|
||||
List<DicekeMininglossVo> findAll();
|
||||
List<DicekeMininglossVo> findAllLoss();
|
||||
|
||||
int savedml(DicekeMininglossVo dicekeMininglossVo);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> getLossByMonthRange(LocalDate Month, LocalDate endMonth);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> getLossByMonth(LocalDate Month);
|
||||
}
|
||||
|
@ -1,12 +1,23 @@
|
||||
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.apache.commons.lang.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -20,8 +31,99 @@ 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 List<DicekeMininglossVo> getLossByMonthRange(LocalDate month, LocalDate endMonth) {
|
||||
|
||||
boolean isBefore = month.isBefore(endMonth);
|
||||
if (isBefore){
|
||||
|
||||
int SmonthY = month.getYear();
|
||||
int SmonthM = month.getMonthValue();
|
||||
int endMonthY = endMonth.getYear();
|
||||
int endmonthM = endMonth.getMonthValue();
|
||||
return baseMapper.findLossByMonthRange(SmonthM,SmonthY,endmonthM,endMonthY);
|
||||
|
||||
} else {
|
||||
|
||||
LocalDate flagMonth;
|
||||
flagMonth = month;
|
||||
month = endMonth;
|
||||
endMonth = flagMonth;
|
||||
|
||||
int monthY = month.getYear();
|
||||
int monthM = month.getMonthValue();
|
||||
int endMonthY = endMonth.getYear();
|
||||
int endMonthM = endMonth.getMonthValue();
|
||||
|
||||
return baseMapper.findLossByMonthRange(monthM,monthY,endMonthM,endMonthY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DicekeMininglossVo> getLossByMonth(LocalDate month) {
|
||||
int year = month.getYear();
|
||||
int monthV = month.getMonthValue();
|
||||
return baseMapper.findLossByMonth(monthV,year);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user