dc76ad09 张雷

feat(report): 新增运营周报展示功能

- 新增 reportWeekShowNew 方法,用于运营周报的展示
- 在 IFCustomReportDatasetService 接口中添加 reportWeekShowNew 方法
- 在 ReportDataController 中添加 reportWeekShowNew 接口
- 新增 DepartEquipRemarkVO 类用于维修情况备注
- 在 WeekReportRemarkMapper 中添加 getWxList 和 getGxList 方法
- 在 WeekReportRemarkServiceImpl 中实现 getWxList 和 getGxList 方法
- 修改 FCustomReportDatasetMapper 中的 getWeekReportData 方法,增加 departIds 参数
- 更新 FCustomReportDatasetMapper.xml 中的 SQL 查询,支持按部门 ID 查询
1 个父辈 8a8794c0
......@@ -106,7 +106,7 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate,
@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="dataViewName2119") String dataViewName2119);
@Param(value="dataViewName2119") String dataViewName2119, @Param(value="departIds") String departIds);
List<JnhbReportData> getJnhbReport(@Param(value="dataViewName2") String dataViewName2, @Param(value="dataViewName3") String dataViewName3,
@Param(value="dataViewName4") String dataViewName4,
......
......@@ -255,6 +255,12 @@
where v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} GROUP BY v.depart_id) v2 on v2.depart_id = d.id
WHERE
d.depart_type = 1
<if test="departIds != null and departIds !=''">
and d.id in
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
ORDER BY
d.depart_order
</select>
......
......@@ -162,4 +162,6 @@ public interface IFCustomReportDatasetService extends IService<FCustomReportData
String startTime, String endTime, String departId);
List<ResultNumberVO> statisticsByXjl(String departIds, String startDate, String endDate);
Map<String, Object> reportWeekShowNew(String departId, String dataTime, String week);
}
......
package com.skua.modules.custom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.mapper.CommonSqlMapper;
......@@ -9,6 +11,7 @@ import com.skua.modules.common.vo.DateVO;
import com.skua.modules.custom.entity.FCustomReportDataset;
import com.skua.modules.custom.mapper.FCustomReportDatasetMapper;
import com.skua.modules.custom.service.IFCustomReportDatasetService;
import com.skua.modules.custom.vo.DepartEquipRemarkVO;
import com.skua.modules.custom.vo.DepartWeekReportVO;
import com.skua.modules.custom.vo.FCustomReportDatasetVO;
import java.text.DecimalFormat;
......@@ -17,12 +20,18 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.WeekFields;
import java.util.*;
import com.skua.modules.report.entity.WeekReportRemark;
import com.skua.modules.report.service.IWeekReportRemarkService;
import com.skua.modules.report.vo.*;
import com.skua.modules.report.vo.largeScreen.*;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.service.ISysDepartService;
import com.skua.tool.util.DateUtils;
import com.skua.tool.util.JSUtils;
import io.micrometer.core.instrument.util.TimeUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -39,6 +48,10 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
private FCustomReportDatasetMapper mapper;
@Resource
private CommonSqlMapper commonSqlMapper;
@Autowired
private ISysDepartService departService;
@Autowired
private IWeekReportRemarkService weekReportRemarkService;
private static DecimalFormat df = new DecimalFormat("#.##");
/* (non-Javadoc)
......@@ -538,6 +551,135 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
return reduceStatisticsList;
}
@Override
public Map<String, Object> reportWeekShowNew(String departId, String dataTime, String week) {
String yearMonthWeek = dataTime+"-"+week;
String jtCode = "af880d6a13404a67825e94bc0f2f3808";
String qyCode = "1818215543140909056,1892199890272477184,1892199062790823936";
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> areaList = new ArrayList<>();
Map<String,String> weekMap = getWeekDate(dataTime,week);
String startDate = weekMap.get("start");
String endDate = weekMap.get("end");
map.put("start",startDate);
map.put("end",endDate);
String departs = "";
if(jtCode.equals(departId)){
departs = qyCode;
}else{
departs = departId;
}
SysDepart dataDepart = departService.getById(departId);
map.put("departId", departId);
map.put("departName", dataDepart.getDepartName());
QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", Arrays.asList(departs.split(",")));
queryWrapper.orderByAsc("depart_order");
List<SysDepart> departList = departService.list(queryWrapper);
for (SysDepart depart : departList) {
Map<String, Object> departMap = new HashMap<>();
departMap.put("departId", depart.getId());
departMap.put("departName", depart.getDepartName());
List<DepartWeekReportVO> list = new ArrayList<>();
List<DepartWeekReportVO> hbList = new ArrayList<>();
String departIds = departService.getChildDepartId(depart.getId());
String startDateHb = getBeforeDate(startDate,7);
String endDateHb = getBeforeDate(endDate,7);
String field3a24 = ReportConstant.fieldDl + "," + ReportConstant.fieldYj + "," + ReportConstant.fieldWnl;
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, departIds, startDate, endDate);
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, departIds, startDate, endDate);
list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119, departIds);
String dataViewName3a24Hb = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, departIds, startDateHb, endDateHb);
String dataViewName2119Hb = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, departIds, startDateHb, endDateHb);
hbList = mapper.getWeekReportData(startDateHb, endDateHb, dataViewName3a24Hb, dataViewName2119Hb, departIds);
Map<String, Object> totalMap = getTotalData(list);
Map<String, Object> totalMapHb = getTotalData(hbList);
departMap.put("start", startDate);//开始时间
departMap.put("end", endDate);//结束时间
String zclsl = totalMap.getOrDefault("zclsl","0").toString();
departMap.put("zclsl", zclsl);//处理水量合计
String rjclsl = totalMap.getOrDefault("rjclsl","0").toString();
departMap.put("rjclsl", rjclsl);//日均处理水量
String rjclslHb = totalMapHb.getOrDefault("rjclsl","0").toString();
String rjclslStr = "";//文字描述
String dsdhStr = "";//文字描述
//较上周增减量 rjclsl - rjclslHb
if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) > 0){
rjclslStr = "+"+df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
}else if(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb) < 0){
rjclslStr = df.format(Double.parseDouble(rjclsl)-Double.parseDouble(rjclslHb))+"万吨/日";
}else{
rjclslStr = "持平";
}
departMap.put("rjclsl_hb", rjclslStr);
String dsdh = totalMap.getOrDefault("dsdh","0").toString();
departMap.put("dsdh", dsdh);//吨水电耗
String dsdhHb = totalMapHb.getOrDefault("dsdh","0").toString();
//吨水电耗较上周增减量 dsdh - dsdhHb
if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) > 0){
dsdhStr = "+"+df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
}else if(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb) < 0){
dsdhStr = df.format(Double.parseDouble(dsdh)-Double.parseDouble(dsdhHb))+"Kwh/吨";
}else{
dsdhStr = "持平";
}
departMap.put("dsdh_hb", dsdhStr);
String cnl = totalMap.getOrDefault("cnl","0").toString();
departMap.put("cnl", cnl);//产泥量
departMap.put("list", list);
WeekReportRemark weekReportRemark = weekReportRemarkService.getInfoByDepartId(yearMonthWeek,depart.getId());
if(weekReportRemark != null){
departMap.put("scqk", weekReportRemark.getCraftRemark());//生产情况
departMap.put("aqgz", weekReportRemark.getSafeRemark());//安全工作
}else{
departMap.put("scqk", "本周暂无情况");//生产情况
departMap.put("aqgz", "本周暂无情况");//安全工作
}
departMap.put("wxqk", getWxAndGxRemark(startDate,endDate,departIds));//
areaList.add(departMap);
}
map.put("list",areaList);
map.put("data","");
if(jtCode.equals(departId)){
WeekReportRemark weekReportRemark = weekReportRemarkService.getInfoByDepartId(yearMonthWeek,departId);
if(weekReportRemark != null){
map.put("data",weekReportRemark.getManageRemark());
}
}
return map;
}
//更新维护备注
private String getWxAndGxRemark(String startDate, String endDate, String departIds) {
String conclusion = "";
//维保记录(大修和基建)
List<DepartEquipRemarkVO> wxList = weekReportRemarkService.getWxList(startDate, endDate, departIds);
if(wxList.size()>0){
for (int i = 0; i < wxList.size(); i++) {
DepartEquipRemarkVO wxVO = wxList.get(i);
if("jjwx".equals(wxVO.getMaintenanceType())){
conclusion += "("+(i+1)+")"+wxVO.getDepartName() + wxVO.getRecordTime() + "进行"+wxVO.getPlanName()+"基建维修,";
}else{
conclusion += "("+(i+1)+")"+wxVO.getDepartName() + wxVO.getRecordTime() + "对"+wxVO.getEquipmentName()+"设备进行大修技改,";
}
}
}
int numStart = wxList.size();
//设备购置记录(更新)
List<DepartEquipRemarkVO> gxList = weekReportRemarkService.getGxList(startDate, endDate, departIds);
if(gxList.size()>0){
for (int i = 0; i < gxList.size(); i++) {
DepartEquipRemarkVO gxVO = gxList.get(i);
int num = numStart + i;
conclusion += "("+num+")"+gxVO.getDepartName() + gxVO.getRecordTime() + "购置"+gxVO.getEquipmentName()+",";
}
}
if(ConvertUtils.isEmpty(conclusion)){conclusion = "本周暂无情况";}
return conclusion;
}
/**转换为Map<部门编号,JnhbReportData> */
private Map<String,JnhbReportData> convertJnhbReportDataMap(List<JnhbReportData> dataList){// Map<部门编号,JnhbReportData>
Map<String,JnhbReportData> dataMap = new HashMap<>();
......@@ -649,10 +791,10 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
String field3a24 = ReportConstant.fieldDl + "," + ReportConstant.fieldYj + "," + ReportConstant.fieldWnl;
String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDate, endDate);
String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDate, endDate);
list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119);
list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119,null);
String dataViewName3a24Hb = ReportViewUtil.buildView(ReportConstant.view3a24, field3a24, "", startDateHb, endDateHb);
String dataViewName2119Hb = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.fieldClsl, "", startDateHb, endDateHb);
hbList = mapper.getWeekReportData(startDateHb, endDateHb, dataViewName3a24Hb, dataViewName2119Hb);
hbList = mapper.getWeekReportData(startDateHb, endDateHb, dataViewName3a24Hb, dataViewName2119Hb,null);
Map<String, Object> totalMap = getTotalData(list);
Map<String, Object> totalMapHb = getTotalData(hbList);
map.put("start", startDate);//开始时间
......
package com.skua.modules.custom.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 维修情况备注
*/
@Data
@ApiModel(value="维修情况备注", description="维修情况备注")
public class DepartEquipRemarkVO {
/**厂区名称*/
@ApiModelProperty(value = "厂区名称")
private String departName;
/**设计规模*/
@ApiModelProperty(value = "记录时间")
private String recordTime;
/**实际水量*/
@ApiModelProperty(value = "设备名称")
private String equipmentName;
/**污泥量*/
@ApiModelProperty(value = "计划名称")
private String planName;
/**吨水电耗*/
@ApiModelProperty(value = "计划类型")
private String maintenanceType;
}
......@@ -5,6 +5,7 @@ import com.skua.common.report.ReportViewUtil;
import com.skua.core.api.vo.Result;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.dataAnalysis.vo.ProcessProgressVO;
import com.skua.modules.dataAnalysis.vo.SafeProgressVO;
import com.skua.modules.dataAnalysis.vo.WorkProgressVO;
......@@ -361,7 +362,11 @@ public class WorkAnalysisController {
sql += " left join( select ec.depart_id , count(1) 'count' from report_electric_cost ec where ec.month = '"+month+"' and ec.cost is not null and ec.cost <> '' group by ec.depart_id ) ddd on ddd.depart_id = d.id ";
//生产运营月报表:月收费水量、月药费
String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime);
String yyTime = "2000-01";
if(ConvertUtils.isNotEmpty(startTime)){
yyTime = startTime.substring(0,7);
}
String view4411Sql = ReportViewUtil.buildViewLike(ReportConstant.view4411,"yyf,ysfsl", departIds, yyTime);
sql += " left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+ " ee where 1=1 and ee.yyf is not null and ee.yyf <> '' and ee.ysfsl is not null and ee.ysfsl <> '' group by ee.depart_id ,left(ee.time,7) )eee group by eee.depart_id )fff on fff.depart_id = d.id ";
sql += " ";
//目标年报 :年度目标报表改成生产经营报表的统计
......
......@@ -175,6 +175,16 @@ public class ReportDataController {
return result;
}
@AutoLog(value = "运营周报word展示_NEW")
@ApiOperation(value = "运营周报word展示_NEW", notes = "运营周报word展示_NEW")
@GetMapping(value = "/reportWeekShowNew")
public Result<Map<String,Object>> reportWeekShowNew(String time,String week,String departId) {
Result<Map<String,Object>> result = new Result<>();
Map<String,Object> map = fCustomReportDatasetService.reportWeekShowNew(departId, time, week);
result.setResult(map);
return result;
}
@AutoLog(value = "能源节约与生态环境保护统计表展示")
@ApiOperation(value = "能源节约与生态环境保护统计表展示", notes = "能源节约与生态环境保护统计表展示")
@GetMapping(value = "/jnhbReportShow")
......
......@@ -84,7 +84,7 @@ public class WeekReportRemarkController {
@GetMapping(value = "/getInfo")
public Result<WeekReportRemark> getInfo(WeekReportRemark weekReportRemark) {
Result<WeekReportRemark> result = new Result<WeekReportRemark>();
WeekReportRemark remark = weekReportRemarkService.getInfo(weekReportRemark);
WeekReportRemark remark = weekReportRemarkService.getInfoByDepartId(weekReportRemark.getMonthWeek(),weekReportRemark.getDepartId());
result.setSuccess(true);
result.setResult(remark);
return result;
......@@ -95,7 +95,7 @@ public class WeekReportRemarkController {
@PostMapping(value = "/save")
public Result<WeekReportRemark> save(@RequestBody WeekReportRemark weekReportRemark) {
Result<WeekReportRemark> result = new Result<WeekReportRemark>();
WeekReportRemark remark = weekReportRemarkService.getInfo(weekReportRemark);
WeekReportRemark remark = weekReportRemarkService.getInfoByDepartId(weekReportRemark.getMonthWeek(),weekReportRemark.getDepartId());
if(remark!=null){
weekReportRemark.setId(remark.getId());
weekReportRemarkService.updateById(weekReportRemark);
......
......@@ -2,6 +2,7 @@ package com.skua.modules.report.mapper;
import java.util.List;
import com.skua.modules.custom.vo.DepartEquipRemarkVO;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.report.entity.WeekReportRemark;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -12,4 +13,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface WeekReportRemarkMapper extends BaseMapper<WeekReportRemark> {
WeekReportRemark getInfo(@Param("monthWeek") String monthWeek);
WeekReportRemark getInfoByDepartId(@Param("yearMonthWeek") String yearMonthWeek, @Param("departId") String departId);
List<DepartEquipRemarkVO> getWxList(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departIds") String departIds);
List<DepartEquipRemarkVO> getGxList(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departIds") String departIds);
}
......
......@@ -6,4 +6,39 @@
select * from week_report_remark where month_week = #{monthWeek} limit 1
</select>
<select id="getInfoByDepartId" resultType="com.skua.modules.report.entity.WeekReportRemark">
select * from week_report_remark where month_week = #{yearMonthWeek} and depart_id = #{departId} limit 1
</select>
<select id="getWxList" resultType="com.skua.modules.custom.vo.DepartEquipRemarkVO">
select d.depart_name,t.real_start_time as record_time,e.equipment_name,p.plan_name,p.maintenance_type from sys_depart d
left join equipment_maintain_task t on t.depart_id = d.id
left join equipment_info e on t.equipment_id = e.id
left join equipment_maintain_plan p on t.plan_id = p.id
where t.results_enforcement = '4'
<if test="departIds != null and departIds !=''">
and d.id in
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
and p.maintenance_type in('jjwx','dxjg')
and t.real_start_time BETWEEN #{startDate} and #{endDate}
ORDER BY d.id,t.real_start_time
</select>
<select id="getGxList" resultType="com.skua.modules.custom.vo.DepartEquipRemarkVO">
select d.depart_name,e.intake_date as record_time,e.equipment_name from equipment_info e
left join sys_depart d on e.depart_id = d.id
where 1=1
<if test="departIds != null and departIds !=''">
and d.id in
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
and e.intake_date between #{startDate} and #{endDate}
</select>
</mapper>
......
package com.skua.modules.report.service;
import com.skua.modules.custom.vo.DepartEquipRemarkVO;
import com.skua.modules.report.entity.WeekReportRemark;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 运营周报补充填报
*/
public interface IWeekReportRemarkService extends IService<WeekReportRemark> {
WeekReportRemark getInfo(WeekReportRemark weekReportRemark);
WeekReportRemark getInfoByDepartId(String yearMonthWeek, String departId);
List<DepartEquipRemarkVO> getWxList(String startDate, String endDate, String departIds);
List<DepartEquipRemarkVO> getGxList(String startDate, String endDate, String departIds);
}
......
package com.skua.modules.report.service.impl;
import com.skua.modules.custom.vo.DepartEquipRemarkVO;
import com.skua.modules.report.entity.WeekReportRemark;
import com.skua.modules.report.mapper.ReportTargetConfigSubMapper;
import com.skua.modules.report.mapper.WeekReportRemarkMapper;
......@@ -9,6 +10,10 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 运营周报补充填报
*/
......@@ -26,4 +31,25 @@ public class WeekReportRemarkServiceImpl extends ServiceImpl<WeekReportRemarkMap
}
return remark;
}
@Override
public WeekReportRemark getInfoByDepartId(String yearMonthWeek, String departId) {
WeekReportRemark remark = new WeekReportRemark();
remark = weekReportRemarkMapper.getInfoByDepartId(yearMonthWeek, departId);
return remark;
}
@Override
public List<DepartEquipRemarkVO> getWxList(String startDate, String endDate, String departIds) {
List<DepartEquipRemarkVO> list = new ArrayList<>();
list = weekReportRemarkMapper.getWxList(startDate+" 00:00:00", endDate+" 23:59:59", departIds);
return list;
}
@Override
public List<DepartEquipRemarkVO> getGxList(String startDate, String endDate, String departIds) {
List<DepartEquipRemarkVO> list = new ArrayList<>();
list = weekReportRemarkMapper.getGxList(startDate, endDate, departIds);
return list;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!