损失和贫化报表新增
This commit is contained in:
parent
8afa943305
commit
101796bff5
@ -14,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;
|
||||
|
||||
/**
|
||||
@ -39,6 +40,25 @@ public class DicekeMininglossController {
|
||||
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){
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -20,4 +21,9 @@ public interface DicekeMininglossMapper extends BaseMapper<DicekeMiningloss> {
|
||||
|
||||
List<DicekeMininglossVo> findAllLoss();
|
||||
|
||||
|
||||
List<DicekeMininglossVo> findLossByMonthRange(int SmonthM, int SmonthY, int endMonthM, int endMonthY);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> findLossByMonth(int monthV,int year);
|
||||
}
|
||||
|
@ -19,4 +19,42 @@
|
||||
LEFT JOIN diceke_platearea dp ON dml.PlateID = dp.PlateID
|
||||
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>
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
|
||||
/**
|
||||
@ -20,4 +21,10 @@ public interface IDicekeMininglossService extends IService<DicekeMiningloss> {
|
||||
List<DicekeMininglossVo> findAllLoss();
|
||||
|
||||
int savedml(DicekeMininglossVo dicekeMininglossVo);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> getLossByMonthRange(LocalDate Month, LocalDate endMonth);
|
||||
|
||||
|
||||
List<DicekeMininglossVo> getLossByMonth(LocalDate Month);
|
||||
}
|
||||
|
@ -13,9 +13,11 @@ 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;
|
||||
|
||||
/**
|
||||
@ -41,6 +43,44 @@ public class DicekeMininglossServiceImpl extends ServiceImpl<DicekeMininglossMap
|
||||
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) {
|
||||
/*
|
||||
@ -84,4 +124,6 @@ public class DicekeMininglossServiceImpl extends ServiceImpl<DicekeMininglossMap
|
||||
return 20000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user