2d603ae0 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 f674f251 c4bdaba0
正在显示 22 个修改的文件 包含 135 行增加452 行删除
......@@ -79,9 +79,13 @@ public class ReportViewUtil {
if(StringUtils.isNotEmpty(departIds)){
sb.append(" and depart_id in ("+inSqlPart+") ");
}
if(!StringUtils.isEmpty(startTime)) {
sb.append(" and data_time>='"+startTime+"' and data_time<='"+endTime+"' ");
if(StringUtils.isNotEmpty(startTime)) {
sb.append(" and data_time>='"+startTime+"' ");
}
if(StringUtils.isNotEmpty(endTime)) {
sb.append(" and data_time<='"+endTime+"' ");
}
sb.append(" and reit_id in ("+itemIds+")) `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)");
return sb.toString();
}
......
package com.skua.tool.util;
import org.apache.commons.lang3.StringUtils;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
......@@ -36,8 +38,13 @@ public class JSUtils {
return executeExpression(expression,"0.00");
}
public static String divide(Object obj1 , Object obj2){
String expression = obj1+ "/" + obj2;
return executeExpression(expression,"0.00");
if(obj1!= null && obj2!=null && StringUtils.isNotEmpty(obj1.toString())){
if(StringUtils.isNotEmpty(obj2.toString()) && Double.parseDouble(obj2.toString())!=0){
String expression = obj1+ "/" + obj2;
return executeExpression(expression,"0.00");
}
}
return "0";
}
/***
......
......@@ -62,8 +62,6 @@ public class AlarmCustomRecordHistoryController {
@Autowired
private AlarmCustomRecordHistoryService alarmCustomRecordHistoryService;
@Autowired
private ISysDepartService sysDepartService;
@Autowired
private RealTimeAlarmJob xtRealTimeAlarmJob;
/**
* <pre>
......
......@@ -93,11 +93,11 @@ public class AjhWasteSolidTransportController {
}*/
String startDate = req.getParameter("startDate");
if(StringUtils.isNotEmpty(startDate)){
queryWrapper.ge("create_time",startDate+" 00:00:00");
queryWrapper.ge("transport_time",startDate+" 00:00:00");
}
String endDate = req.getParameter("endDate");
if(StringUtils.isNotEmpty(startDate)){
queryWrapper.le("create_time",endDate+" 23:59:59");
queryWrapper.le("transport_time",endDate+" 23:59:59");
}
IPage<AjhWasteSolidTransport> pageList = ajhWasteSolidTransportService.page(page, queryWrapper);
result.setSuccess(true);
......
......@@ -58,6 +58,7 @@ public class AjhWasteSolidContract {
/**合同状态:生效、失效*/
@Excel(name = "合同状态:生效、失效", width = 15)
@ApiModelProperty(value = "合同状态:生效、失效")
@Dict(dicCode = "contract_status")
private String contractStatus;
/**联系人*/
@Excel(name = "联系人", width = 15)
......
......@@ -170,8 +170,8 @@
select ri.rec_ord_body,count(*) count
from ajh_rectification_info ri
where rec_ord_report_date between #{startDate} and #{endDate}
group by ri.rec_ord_body
) t
group by ri.rec_ord_body
) t
right join sys_struct_dict dic on t.rec_ord_body = dic.id
where 1=1
<if test="departId!=null and departId!=''">
......
......@@ -2,9 +2,11 @@ package com.skua.modules.algorithm.controller;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.algorithm.service.ICommandCentreService;
import com.skua.modules.algorithm.service.impl.ReportItemvService;
......@@ -22,6 +24,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -44,8 +47,6 @@ public class SysCommandCentreController {
@Autowired
private ICommandCentreService commandCentreService;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private ReportItemvService reportItemvService;
/**
......@@ -177,53 +178,47 @@ public class SysCommandCentreController {
@ApiOperation(value="指挥中心-水量电耗趋势", notes="指挥中心-水量电耗趋势")
@GetMapping(value = "/statisticsBySewage")
public Result<StackedAreaChartDataVO> statisticsBySewage(ReportItemvParam reportItemvParam) throws Exception {
//报表数据项值
String reitId = sysConfigService.queryValueByKey("REIT_ID_DLHJ");
//reportItemvParam.setReportId(reportId);
reportItemvParam.setReitId( reitId );
//电
List<ReportDateTrendVO> electricityMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
//reportItemCode = "CSL";//查询字段
reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
//水集合
reportItemvParam.setReitId( reitId );
List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
List<String > dateList = new ArrayList<>();//日期数据
List<String> electricityList = new ArrayList<>();//电能数据数据;
List<String> waterList = new ArrayList<>();// 水集合
List<String> consumeList = new ArrayList<>();//电小号集合
List<String> consumeList = new ArrayList<>();//电集合
List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null);
Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据;
Map<String,String > waterMap = new HashMap<String,String >();//水
if(electricityMapList != null){
for( ReportDateTrendVO reportDateTrendVO : electricityMapList){
electricityMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() );
}
}
if(waterMapList != null){
for( ReportDateTrendVO reportDateTrendVO : waterMapList){
waterMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() );
}
}
String departIds = BaseContextHandler.getDeparts();
List<ReportDateTrendVO> dlhjDateList = reportItemvService.getDayDateFieldList(ReportConstant.view3a24, "DLHJ", departIds, reportItemvParam.getStartDate(), reportItemvParam.getEndDate());
List<ReportDateTrendVO> cslDateList = reportItemvService.getDayDateFieldList(ReportConstant.view2119, "CSL", departIds, reportItemvParam.getStartDate(), reportItemvParam.getEndDate());
String electricity = null; String water = null; String consume = null;
for(String dateTime : dateTimeList){
electricity = electricityMap.get(dateTime ) ;
water = waterMap.get(dateTime ) ;
consume = "0";
if(electricity == null ) electricity = "0";
if(water == null ){
water = "0";
}else{
consume = DigitalUtils.division( electricity ,water );
List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null);
String dlhj = null; String csl = null; String dh = null;
if(dateTimeList != null){
for(String dateTime : dateTimeList){
csl = null;
dlhj = null;
dateList.add( DateUtil.getInstance().formatDate(dateTime,"MM-dd") ) ;
//水
if( cslDateList != null ){
for(ReportDateTrendVO cslVo : cslDateList){
if(dateTime.equals(cslVo.getTime())){
csl = cslVo.getValue();
break;
}
}
}
waterList.add(JSUtils.divide(csl,10000));
//电
if( dlhjDateList != null ){
for(ReportDateTrendVO dlhjVo : dlhjDateList){
if(dateTime.equals(dlhjVo.getTime())){
dlhj = dlhjVo.getValue();
break;
}
}
}
electricityList.add(JSUtils.divide(dlhj,10000));
//电耗
consumeList.add(JSUtils.divide(JSUtils.divide(dlhj,csl),10000) );
}
electricityList.add( electricity ) ; waterList.add(water) ; consumeList.add( consume);
dateList.add( DateUtil.getInstance().formatDate(dateTime,"MM-dd") ) ;
}
StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO();
stackedAreaChartDataVO.setElectricityList(electricityList);//电集合
stackedAreaChartDataVO.setWaterList(waterList);//水集合
......@@ -244,32 +239,6 @@ public class SysCommandCentreController {
return result;
}
/***
* 整理数据: 月统计数据、日统计数据,添加去年月数据、日数据、年数据
* @param currenteportItemv
* @param lastMonthReportItemv
* @param lastYearReportItemv
* @return
*/
private List<FRportlCommandCenterVO> arrangeFRportlCommandCenterVO(FReportItemv currenteportItemv, FReportItemv lastMonthReportItemv ,FReportItemv lastYearReportItemv ){
List<FRportlCommandCenterVO> commandCenterVOList = new ArrayList<FRportlCommandCenterVO>();
FRportlCommandCenterVO monthData = new FRportlCommandCenterVO();//当月数据
FRportlCommandCenterVO dayData = new FRportlCommandCenterVO();//日数据
//FRportlCommandCenterVO yearData = new FRportlCommandCenterVO();//年数据
monthData.setValue( DigitalUtils.division(currenteportItemv.getSumValue() ,"10000") );
monthData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getSumValue(),"10000"));//上月同期;
monthData.setValueTb( DigitalUtils.division( lastYearReportItemv.getSumValue(),"10000") );//去年同期
dayData.setValue( DigitalUtils.division( currenteportItemv.getAvgValue(),"10000"));
dayData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getAvgValue(),"10000"));//上月同期;
dayData.setValueTb( DigitalUtils.division( lastYearReportItemv.getAvgValue(),"10000") );//去年同期
//dayData.setValue(currenteportItemv.getAvgValue());lastMonthReportItemv.getAvgValue(); lastYearReportItemv.getAvgValue();
// yearData.setValue();yearData.setValueHb(); yearData.setValueTb();
commandCenterVOList.add( monthData ) ;
commandCenterVOList.add( dayData );
return commandCenterVOList;
}
@AutoLog(value = "指挥中心-费用趋势")
@ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势")
......
package com.skua.modules.algorithm.service;
import com.skua.modules.algorithm.vo.WaterTreatmentVO;
import com.skua.modules.report.entity.FReportItemv;
import com.skua.modules.report.vo.*;
import java.util.List;
import java.util.Map;
/**
* <pre>
* 指挥中心实现逻辑
......@@ -16,53 +12,6 @@ import java.util.Map;
*/
public interface ICommandCentreService {
/**
* 指挥中心---运行负荷率分析
* @param reportItemvParam
* @return
*/
public List<DepartLoadRateVO> statisticsByLoadRate(ReportItemvParam reportItemvParam);
/**
* 指挥中心---运行负荷率分析 总数查询
* @param loadRateType
* @return
*/
public int statisticsByLoadRateNum(int loadRateType,String reitId,String startDate, String endDate);
/**
* 根据reitId与时间查询
* @param reportId
* @param startDate
* @param endDate
* @return
*/
public FReportItemv getReportItemvByReitIdAndDate(String reportId, String reportItemCode, String startDate, String endDate);
/**
* 根据reitId查询近几天数据
* @param reportItemvParam
* @return
*/
public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam);
/***
* 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvMonthDataByReitId(ReportItemvParam reportItemvParam);
/***
* 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvDayDataByReitId( ReportItemvParam reportItemvParam);
/**
* 查询费用
* @param reportItemvParam
......@@ -71,19 +20,11 @@ public interface ICommandCentreService {
public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam);
/**
* 查询月度水量
* @param reportItemvParam
* @return
*/
List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam);
/**
* 获取药剂
* @param month
* @return
*/
DepartDrugResult getYhTotal(String month);
/***
* 指挥中心----运行负荷率分析----处理水量详情
* @param
......
......@@ -8,9 +8,6 @@ import com.skua.modules.algorithm.service.ICommandCentreService;
import com.skua.modules.algorithm.vo.WaterTreatmentVO;
import com.skua.modules.common.vo.DateVO;
import com.skua.modules.quartz.util.BaseUtil;
import com.skua.modules.report.entity.FReportItem;
import com.skua.modules.report.entity.FReportItemv;
import com.skua.modules.report.mapper.FReportItemMapper;
import com.skua.modules.report.vo.*;
import com.skua.modules.report.mapper.FReportItemvMapper;
import com.skua.tool.util.DateUtils;
......@@ -37,83 +34,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
@Resource
private FReportItemvMapper fReportItemvMapper;
@Resource
private FReportItemMapper reportItemMapper;
/**
* 指挥中心---运行负荷率分析
* @param reportItemvParam
* @return
*/
public List<DepartLoadRateVO> statisticsByLoadRate(ReportItemvParam reportItemvParam){
return fReportItemvMapper.statisticsByLoadRate(reportItemvParam.getLoadRateType(),reportItemvParam.getReitId(),reportItemvParam.getStartDate(),reportItemvParam.getEndDate());
}
/**
* 指挥中心---运行负荷率分析 总数查询
* @param loadRateType
* @return
*/
public int statisticsByLoadRateNum(int loadRateType, String reitId, String startDate, String endDate){
return fReportItemvMapper.statisticsByLoadRateNum(loadRateType ,reitId ,startDate, endDate );
}
/**
* 根据reitId与时间查询
* @param reportId
* @param startDate
* @param endDate
* @return
*/
public FReportItemv getReportItemvByReitIdAndDate(String reportId, String reportItemCode, String startDate, String endDate){
//根据reportId 与reportItemCode 查询reitId;
//String reitId = reportItemMapper.getReportItemId(reportId,reportItemCode);
FReportItemv reportItemv = null;
List<FReportItem> reportItemList = reportItemMapper.getItemInfoByItemCode(reportItemCode,reportId);
if(reportItemList != null && !reportItemList.isEmpty() ){
reportItemv = fReportItemvMapper.getReportItemvByReitIdAndDate(reportItemList.get(0).getId() , startDate , endDate);
}
return reportItemv;
}
/**
* 根据reitId查询近7天数据
* @param reportItemvParam
* @return
*/
public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam){
List<ReportDateTrendVO> dataList = null;
dataList = fReportItemvMapper.getReportItemvByReitIdAndDate7Day(reportItemvParam);
return dataList;
}
/***
* 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvMonthDataByReitId(ReportItemvParam reportItemvParam){
FRportlCommandCenterVO fRportlCommandCenterVO = null;
fRportlCommandCenterVO = fReportItemvMapper.getReportItemvMonthDataByReitId(reportItemvParam);
return fRportlCommandCenterVO;
}
/***
* 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvDayDataByReitId( ReportItemvParam reportItemvParam){
FRportlCommandCenterVO fRportlCommandCenterVO = null;
//根据reportId 与reportItemCode 查询reitId;
fRportlCommandCenterVO = fReportItemvMapper.getReportItemvDayDataByReitId(reportItemvParam);
return fRportlCommandCenterVO;
}
@Override
public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam) {
List<ReportDateTrendVO> dataList = null;
......@@ -122,13 +42,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
}
@Override
public List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam) {
List<ReportDateTrendVO> dataList = null;
dataList = fReportItemvMapper.getClslData(reportItemvParam);
return dataList;
}
@Override
public DepartDrugResult getYhTotal(String month) {
String monthTb = DateUtils.getTbMonth(month);//同比时间
String monthHb = DateUtils.getHbMonth(month);//环比时间
......@@ -156,19 +69,14 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
return masterDB;
}
/***
* 指挥中心----运行负荷率分析----处理水量详情
* @param time
* @param
* @return
*/
public List<WaterTreatmentVO> statisticsCLSLXQ(String startDate,String endDate, String departIds){
List<WaterTreatmentVO> dateList = null;
DateVO dateVO = new DateVO(startDate);//转换后的时间参数
long differenceDay = DateUtils.differenceDay(startDate, endDate);
String departIdssss = BaseUtil.quoteEach(departIds , ",");
//String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")";
......@@ -229,10 +137,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
}
return cslMap;
}
/**
* 同比
* @param month
......
......@@ -29,7 +29,7 @@ import java.util.Map;
* @auther kangwei
* @create 2024-11-01-10:09
*/
@Service("reportItemvService")
@Service
public class ReportItemvService {
private JdbcTemplate getJdbcTemplate(){
......@@ -262,6 +262,13 @@ public class ReportItemvService {
String sql = "select DATE_FORMAT( aaa.time, '%Y-%m' ) time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from " + dataViewName2119+ "aaa group by DATE_FORMAT( aaa.time, '%Y-%m' ) ";
return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class));
}
public List<ReportDateTrendVO> getDayDateFieldList(String reportId, String field, String departId , String startTime , String endTime){
String dataViewName2119 = ReportViewUtil.buildView(reportId,field, departId, startTime,endTime);
String sql = "select aaa.time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from " + dataViewName2119+ "aaa group by aaa.time order by aaa.time";
return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class));
}
public String getSumCSL(String departId ,String startTime ,String endTime){
String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime);
String sql = "select ROUND( sum( IFNULL( aaa.CSL,0) ),2) from " + dataViewName2119+ "aaa";
......
......@@ -2,20 +2,13 @@ package com.skua.modules.erp.controller;
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.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.erp.entity.DistributContract;
import com.skua.modules.erp.entity.DistributMaterial;
import com.skua.modules.erp.entity.ERPPurchaseContract;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.service.IDistributContractService;
......@@ -26,23 +19,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.erp.service.IDistributMaterialService;
import com.skua.modules.erp.service.IPurchaseMaterialService;
import com.skua.modules.erp.vo.DistributContractVO;
import com.skua.modules.erp.vo.PurchaseContractVO;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.modules.guest.util.DateUtil;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -242,13 +224,13 @@ public class DistributContractController {
@ApiOperation(value="erp分销合同-采购物料列表", notes="erp分销合同-采购物料列表")
@GetMapping(value = "/purchaseMaterialList")
public Result<IPage<PurchaseMaterial>> queryPageByPurchaseMaterialList(
@RequestParam(name="goodCode") String goodCode,
MaterialSearchVO materialSearchVO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
Page<PurchaseMaterial> page = new Page<>(pageNo, pageSize);
IPage<PurchaseMaterial> pageList = purchaseMaterialService.queryByPage(page,goodCode,BaseContextHandler.getRealDepartId());
IPage<PurchaseMaterial> pageList = purchaseMaterialService.queryByPage(page,materialSearchVO.getGoodCode(),BaseContextHandler.getRealDepartId());
result.setSuccess(true);
result.setResult(pageList);
return result;
......@@ -258,9 +240,9 @@ public class DistributContractController {
@AutoLog(value = "erp分销合同-根据货号查询采购合同物料清单")
@ApiOperation(value="erp分销合同-根据货号查询采购合同物料清单", notes="erp分销合同-根据货号查询采购合同物料清单")
@GetMapping(value = "/queryMaterialByGoodCode")
public Result<PurchaseMaterial> queryMaterialByGoodCode(@RequestParam(name="goodCode") String goodCode,@RequestParam(name="departId") String departId) {
public Result<PurchaseMaterial> queryMaterialByGoodCode(MaterialSearchVO materialSearchVO) {
Result<PurchaseMaterial> result = new Result<PurchaseMaterial>();
List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(goodCode,departId);
List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(materialSearchVO.getGoodCode(),materialSearchVO.getDepartId());
if(purchaseMaterialList != null && !purchaseMaterialList.isEmpty()){
result.setSuccess(true);
......
......@@ -292,18 +292,23 @@ public class MaterialINController {
public Result<MaterialIN> queryById(@RequestParam(name="id",required=true) String id) {
Result<MaterialIN> result = new Result<MaterialIN>();
MaterialIN materialIN = materialINService.getById(id);
EquipmentSparepartType sparepartType = sparepartTypeService.getById(materialIN.getSparepartType());
if(sparepartType != null ){
materialIN.setSparepartTypeName( sparepartType.getItemText() );
}
MaterialIN materialIN = materialINService.getById(id);
/**/
if(materialIN==null) {
result.error500("未找到对应实体");
}else {
SupplierManage supplier = supplierManageService.getById(materialIN.getSupplierId());
if(supplier != null ){
materialIN.setSupplierName( supplier.getSuppName() );
}
EquipmentSparepartType sparepartType = sparepartTypeService.getById(materialIN.getSparepartType());
if(sparepartType != null ){
materialIN.setSparepartTypeName( sparepartType.getItemText() );
}
result.setResult(materialIN);
result.setSuccess(true);
}
}*/
return result;
}
......
......@@ -191,17 +191,6 @@ public class MaterialIN {
@ApiModelProperty(value = "删除标识,0:正常,1:删除")
private Integer delFlag;
@TableField(exist = false)
@ApiModelProperty(value = "结束时间")
private String endTime;
@TableField(exist = false)
@ApiModelProperty(value = "开始时间")
private String startTime;
@TableField(exist = false)
@ApiModelProperty(value = "物料类别")
private String sparepartTypeName;
@ApiModelProperty(value = "入库编号")
private String equipmentInId;
......@@ -214,4 +203,19 @@ public class MaterialIN {
@ApiModelProperty(value = "水厂结算,0:未结算,1:已申请,2:已结算")
private Integer waterDepartSettlementFlag;
@TableField(exist = false)
@ApiModelProperty(value = "结束时间")
private String endTime;
@TableField(exist = false)
@ApiModelProperty(value = "开始时间")
private String startTime;
@TableField(exist = false)
@ApiModelProperty(value = "物料类别")
private String sparepartTypeName;
@TableField(exist = false)
@ApiModelProperty(value = "供应商名称")
private String supplierName;
}
......
......@@ -29,4 +29,5 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> {
*/
List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
public MaterialIN queryById(String id);
}
......
......@@ -55,17 +55,16 @@
</select>
<!-- 药剂入库查询结果:物料清单-->
<select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO">
select pc.id 'purchase_contract_id', pc.contract_code 'purchase_contract_code' , st.item_text as 'sparepart_type_name',
(select sum(mi.material_num) from erp_material_in mi where mi.audit_status = 3 and mi.good_code = aaa.good_code) 'storeNum',aaa.*
from (
select dc.contract_code 'distribut_contract_code', dc.id 'distribut_contract_id', dm.distribut_price ,dm.distribut_total_price,dm.material_num ,pm.*
from erp_distribut_contract dc , erp_distribut_material dm , erp_purchase_material pm
where dc.id = dm.contract_id and dc.id = #{param.distributContractId } and dm.good_code = pm.good_code and pm.del_flag = '0' and dc.use_flag = '0' and dm.del_flag = '0'
<if test="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<if test="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<if test="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if>
)aaa
left join erp_purchase_contract pc on pc.id = aaa.contract_id
select dc.contract_code 'distribut_contract_code', st.item_text as 'sparepart_type_name', aaa.* from
(select pc.start_time ,pc.end_time , dm.distribut_price ,dm.distribut_total_price,dm.material_num ,pc.id 'purchase_contract_id', pc.contract_code 'purchase_contract_code' ,dm.contract_id 'distribut_contract_id', pm.*
from erp_distribut_material dm , erp_purchase_material pm ,erp_purchase_contract pc
where dm.good_code = pm.good_code and pm.contract_id = pc.id and pc.use_flag = '0' and dm.del_flag = '0' and pm.del_flag = '0' and pc.start_time &lt;= now() and pc.end_time &gt;= now()
and dm.contract_id = #{param.distributContractId }
<if test="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
<if test="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
<if test="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if>
) aaa
left join erp_distribut_contract dc on dc.id = aaa.distribut_contract_id
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
</select>
<!-- 根据id或code校验合同编号是否唯一-->
......
......@@ -44,4 +44,6 @@ public interface IMaterialINService extends IService<MaterialIN> {
* @param materialIN
*/
String updateMaterialIN(MaterialIN materialIN);
}
......
......@@ -12,7 +12,10 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@ApiModel(value="Material物料查询对象", description="Material物料查询对象")
public class MaterialSearchVO {
@ApiModelProperty(value = "厂站编号")
private String departId;
@ApiModelProperty(value = "货号")
private String goodCode;
@ApiModelProperty(value = "采购合同编号")
private String purchaseContractId;
......@@ -31,8 +34,6 @@ public class MaterialSearchVO {
@ApiModelProperty(value = "物料类型")
private String sparepartType;
@ApiModelProperty(value = "所属厂站")
private String departId;
@ApiModelProperty(value = "是否药剂")
private boolean medicament = false;
......
package com.skua.modules.erp.vo;
import cn.hutool.core.util.RandomUtil;
import com.skua.common.util.ChineseInital;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
......@@ -4,11 +4,9 @@ import com.skua.modules.report.vo.*;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.report.entity.FReportItemv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 报表数据项值
*/
......@@ -22,7 +20,6 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
@Param("dataTime") String dataTime,@Param("departId") String departId,@Param("createTime") Date createTime);
List<FReportItemv> getBean(@Param("dataId") String dataId, @Param("reitId") String reitId);
List<Map<String,Object>> getListByTime(@Param("sql") String sql);
/**
* <pre>
......@@ -33,75 +30,18 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
* @author Li Yuanyuan, 2021年5月25日 上午10:34:37
*/
List<FReportItemv> getReportItemvByDataId(String dataId);
/**
* 据reit_id 查询视图表数据 返回总数,平均数
* @param reportItemvParam
* @return
*/
List<FReportItemv> getReportItemvByReitId(ReportItemvParam reportItemvParam);
/**
* 根据reitId与时间查询
* @param reitId
* @param startDate
* @param endDate
* @return
*/
public FReportItemv getReportItemvByReitIdAndDate(@Param("reitId") String reitId, @Param("startDate") String startDate,@Param("endDate") String endDate);
/**
* 根据类型查询:指挥中心---运行负荷率分析
* @param loadRateType
* @return
*/
public List<DepartLoadRateVO> statisticsByLoadRate(@Param("loadRateType") Integer loadRateType, @Param("reitId") String reitId ,@Param("startDate") String startDate,@Param("endDate") String endDate);
/**
* 指挥中心---运行负荷率分析 总数查询
* @param loadRateType
* @return
*/
public int statisticsByLoadRateNum(@Param("loadRateType") Integer loadRateType, @Param("reitId") String reitId , @Param("startDate") String startDate,@Param("endDate") String endDate);
/**
* 根据reitId查询近7天数据
* @param reportItemvParam
* @return
*/
public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam);
/***
* 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvMonthDataByReitId( ReportItemvParam reportItemvParam);
/***
* 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
* @param reportItemvParam
* @return
*/
public FRportlCommandCenterVO getReportItemvDayDataByReitId(ReportItemvParam reportItemvParam);
/**
* 查询费用
* @param reportItemvParam
* @return
*/
List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam);
/**
* 查询水量信息
* @param reportItemvParam
* @return
*/
List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam);
/**
* 药量信息
* @param month
......
......@@ -51,90 +51,6 @@
</select>
<!-- 根据reit_id 查询视图表数据 返回总数,平均数 -->
<select id="getReportItemvByReitIdAndDate" resultType="com.skua.modules.report.entity.FReportItemv">
SELECT sum(item_value) 'sum_value' , avg(item_value) 'avg_value' FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
</select>
<!-- 根据类型查询:指挥中心-运行负荷率分析 -->
<select id="statisticsByLoadRate" resultType="com.skua.modules.report.vo.DepartLoadRateVO">
SELECT ri.depart_id ,d.depart_name as 'departName',
fi.pro_scale ,
avg(ri.item_value)/(100*fi.pro_scale) as 'loadRate' ,
sum( ri.item_value ) as 'waterYieldMonth'
FROM f_report_itemv ri
left join sys_factory_info fi on ri.depart_id = fi.depart_id
left join sys_depart d on d.id = ri.depart_id
where ri.reit_id=#{reitId} and ri.data_time &gt;= #{startDate} and ri.data_time &lt;= #{endDate}
group by ri.depart_id
<trim prefix="having" prefixOverrides="and">
<if test="loadRateType != null and loadRateType == 1">
avg(ri.item_value)/(100*fi.pro_scale) &gt;= 60 and avg(ri.item_value)/(100*fi.pro_scale) &lt;= 120
</if>
<if test="loadRateType != null and loadRateType == 3">
avg(ri.item_value)/(100*fi.pro_scale) &lt; 60
</if>
<if test="loadRateType != null and loadRateType == 2">
avg(ri.item_value)/(100*fi.pro_scale) &gt; 120
</if>
</trim>
</select>
<!-- 根据类型查询:指挥中心-运行负荷率分析 -->
<select id="statisticsByLoadRateNum" resultType="java.lang.Integer">
select count(1) from (
SELECT ri.depart_id , fi.pro_scale
FROM f_report_itemv ri
left join sys_factory_info fi on ri.depart_id = fi.depart_id
where ri.reit_id=#{reitId} and ri.data_time &gt;= #{startDate} and ri.data_time &lt;= #{endDate}
group by ri.depart_id
<trim prefix="having" prefixOverrides="and">
<if test="loadRateType != null and loadRateType == 1">
avg(ri.item_value)/(100*fi.pro_scale) &gt;= 60 and avg(ri.item_value)/(100*fi.pro_scale) &lt;= 120
</if>
<if test="loadRateType != null and loadRateType == 3">
avg(ri.item_value)/(100*fi.pro_scale) &lt; 60
</if>
<if test="loadRateType != null and loadRateType == 2">
avg(ri.item_value)/(100*fi.pro_scale) &gt; 120
</if>
</trim>
) aaa
</select>
<!-- 根据reitId查询近7天数据-->
<select id="getReportItemvByReitIdAndDate7Day" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
SELECT sum(item_value) as 'value' , data_time as 'date' FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
group by data_time
</select>
<!--查询报表数据,当前月统计、上个月统计、去年当月统计(求和) -->
<select id="getReportItemvMonthDataByReitId" resultType="com.skua.modules.report.vo.FRportlCommandCenterVO">
select
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}),0) as 'value',
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastMonthStartDate} and data_time &lt;= #{lastMonthEndDate}),0) as 'valueTb',
IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastYearStartDate} and data_time &lt;= #{lastYearEndDate} ),0) as 'valueHb'
from dual
</select>
<!--查询报表数据,当日平均、上月同期、去年同期统计(求均值) -->
<select id="getReportItemvDayDataByReitId" resultType="com.skua.modules.report.vo.FRportlCommandCenterVO">
select
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}),0) as 'value',
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastMonthStartDate} and data_time &lt;= #{lastMonthEndDate}),0) as 'valueTb',
IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastYearStartDate} and data_time &lt;= #{lastYearEndDate} ),0) as 'valueHb'
from dual
</select>
<select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
SELECT
t.month AS time,
......@@ -147,11 +63,7 @@
GROUP BY t.month
</select>
<select id="getClslData" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
SELECT sum(item_value) as 'value' , left(data_time,7) as 'date' FROM f_report_itemv
where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
group by left(data_time,7)
</select>
<select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO">
SELECT
......
......@@ -60,7 +60,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
String departId = null;
// ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
String dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water', sum(tc.target_drug ) 'target_drug' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
sql = "select round(sum( aaa.ysfsl ),2) 'ysfsl' , round(sum( aaa.ysjsl ),2) 'ysjsl' , round(sum(tc.target_water ),2) 'target_water', round(sum(tc.target_drug ),2) 'target_drug' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year = '"+year+"')";
List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql);
productDataVO.setDayNum( DateUtils.differenceDay(seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()) );//相差天数
......@@ -91,7 +91,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
// 去年水数据:月收费水量、月实际水量
// ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl", departId, lastSeasonTimeVO.getStartTime(),lastSeasonTimeVO.getEndTime());
sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' from "+dataViewName4411+" aaa";
sql = "select round(sum( aaa.ysfsl ),2) 'ysfsl' , round(sum( aaa.ysjsl ),2) 'ysjsl' from "+dataViewName4411+" aaa";
if(mapList != null ){
for(Map<String,Object> map : mapList){
......@@ -113,7 +113,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
// sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water' , sum(tc.target_power) 'target_power' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
sql = "select round( (aaa.tqysjsl - aaa.ysjsl ) / aaa.tqysjsl ,2 ) 'ratio' , aaa.tqysjsl , aaa.ysjsl , aaa.ysjsldyqntqyy 'causeAnalysis' , d.depart_name from "+dataViewName4411 +" aaa";
sql += " left join sys_depart d on d.id = aaa.depart_id where aaa.tqysjsl > aaa.ysjsl";
sql += " left join sys_depart d on d.id = aaa.depart_id where aaa.tqysjsl > aaa.ysjsl ";
List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
productDataVO.setWaterDeptartList(waterMonthDataList);
......
package com.skua.modules.report.vo;
import com.skua.core.util.ConvertUtils;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
......@@ -30,7 +32,7 @@ public class ProductDataVO {
@ApiModelProperty(value = "收费水量")
private String chargeWaterVolume;//收费水量9854.012552万吨
@ApiModelProperty(value = "收费水量-日均值")
private Double avgDayWaterVolume;//平均108.29万吨/天
private String avgDayWaterVolume;//平均108.29万吨/天
@ApiModelProperty(value = "收费水量-同比增长")
private Double chargeWaterRatio;
@ApiModelProperty(value = "收费水量-完成率")
......@@ -43,7 +45,7 @@ public class ProductDataVO {
@ApiModelProperty(value = "实际处理水量")
private String ysjslWaterVolume;
@ApiModelProperty(value = "实际处理水量-日均值")
private Double avgYsjslWaterVolume;//平均99.76万吨/天
private String avgYsjslWaterVolume;//平均99.76万吨/天
@ApiModelProperty(value = "实际处理水量--同比增长")
private Double ysjslWaterRatio;
......@@ -81,13 +83,14 @@ public class ProductDataVO {
private String dangerDeptNames;
//收费水量-日均值
public Double getAvgDayWaterVolume() {
avgDayWaterVolume = ConvertUtils.getDouble(chargeWaterVolume,0) / dayNum ;
public String getAvgDayWaterVolume() {
avgDayWaterVolume = JSUtils.divide(chargeWaterVolume , dayNum ) ;
return avgDayWaterVolume;
}
//实际处理水量-日均值
public Double getAvgYsjslWaterVolume() {
avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
public String getAvgYsjslWaterVolume() {
// avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
avgYsjslWaterVolume = JSUtils.divide(ysjslWaterVolume , dayNum ) ;
return avgYsjslWaterVolume;
}
......@@ -108,7 +111,10 @@ public class ProductDataVO {
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportWaterMonthDataVO dataVO : deptartList){
if(deptName.length() > 0 ) deptName+="、";
deptName += dataVO.getDeptartName();
if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
deptName += dataVO.getDeptartName();
}
}
}
return deptName;
......@@ -118,7 +124,9 @@ public class ProductDataVO {
if( deptartList != null && !deptartList.isEmpty() ){
for(FReportPowerMonthDataVO dataVO : deptartList){
if(deptName.length() > 0 ) deptName+="、";
deptName += dataVO.getDeptartName();
if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
deptName += dataVO.getDeptartName();
}
}
}
return deptName;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!