f79698db 康伟

Merge remote-tracking branch 'origin/master'

2 个父辈 1cccf761 5e864231
......@@ -56,5 +56,7 @@ public interface CommonSqlMapper {
String getChildFactorys(@Param(value="departId") String departId);
String getChildDeparts(@Param(value="departId") String departId);
String getChildDepartByUserId(@Param(value="userId") String userId);
}
......
......@@ -94,6 +94,28 @@
</foreach>
))
</select>
<select id="getChildDeparts" resultType="java.lang.String">
SELECT
GROUP_CONCAT( id SEPARATOR ',' ) AS depart_ids
FROM
sys_depart
WHERE
parent_id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
OR id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
OR parent_id IN ( SELECT id FROM sys_depart WHERE parent_id IN
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
)
</select>
<select id="getChildDepartByUserId" resultType="java.lang.String">
select CONCAT(dep_id,',',dep_ids) AS ids
from sys_user_depart
......
......@@ -100,17 +100,18 @@ public class ThreeDController {
return result;
}
@CustomExceptionAnno(description = "三维-厂区在线状态")
@AutoLog(value = "三维-厂区在线状态")
@ApiOperation(value = "三维-厂区在线状态", notes = "三维-厂区在线状态")
@CustomExceptionAnno(description = "厂区在线状态")
@AutoLog(value = "厂区在线状态")
@ApiOperation(value = "厂区在线状态", notes = "厂区在线状态")
@GetMapping(value = "/factoryOnLine")
public Result<SysFactoryInfoVO> factoryOnLine(@RequestParam(name = "departId", defaultValue = "f2df9193c8bc4e7a9cef0e4b98dd9e95") String departId, @RequestParam(name = "departType", defaultValue = "1", required = false) String departType) {
Result result = new Result<>();
result.setSuccess(true);
result.setResult(new HashMap<>());
QueryWrapper<SysDepart> sysDepartQueryWrapper = new QueryWrapper<>();
sysDepartQueryWrapper.eq("depart_type", departType).eq("del_flag", 1);
List<Map<String, Object>> deviceList = sysDepartService.queryFactoryDevice(sysDepartQueryWrapper);
JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
int onlineCount = 0;
if (!CollectionUtils.isEmpty(deviceList)) {
List<Object> list = new ArrayList<>();
......@@ -138,8 +139,6 @@ public class ThreeDController {
resultMaps.put("offlineCount", deviceList.size() - onlineCount > 0 ? deviceList.size() - onlineCount : 0);
result.setSuccess(true);
result.setResult(resultMaps);
} else {
result.error500("500");
}
return result;
......
......@@ -66,6 +66,16 @@ public class FactoryCenterController {
return result;
}
@ApiOperation(value="厂区驾驶舱耗电量分析", notes="厂区驾驶舱耗电量分析")
@GetMapping(value = "/getDhData")
public Result<Map<String, Object>> getDhData(StatisticsParam statisticsParam) {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> map = factoryCenterService.getDhData(statisticsParam);
result.setSuccess(true);
result.setResult(map);
return result;
}
//污水处理水量统计
@ApiOperation(value="厂区驾驶舱污水处理水量统计", notes="厂区驾驶舱污水处理水量统计")
@GetMapping(value = "/getWssltj")
......@@ -77,6 +87,26 @@ public class FactoryCenterController {
return result;
}
@ApiOperation(value="厂区驾驶舱处理水量分析", notes="厂区驾驶舱处理水量分析")
@GetMapping(value = "/getSlData")
public Result<Map<String, Object>> getSlData(StatisticsParam statisticsParam) {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> map = factoryCenterService.getSlData(statisticsParam);
result.setSuccess(true);
result.setResult(map);
return result;
}
@ApiOperation(value="厂区驾驶舱污水电耗统计", notes="厂区驾驶舱污水电耗统计")
@GetMapping(value = "/getWsDhTj")
public Result<Map<String, Object>> getWsDhTj(StatisticsParam statisticsParam) {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> map = factoryCenterService.getWsDhTj(statisticsParam);
result.setSuccess(true);
result.setResult(map);
return result;
}
//厂区驾驶舱药耗统计
@ApiOperation(value="厂区驾驶舱药耗统计", notes="厂区驾驶舱药耗统计")
@GetMapping(value = "/getYhtj")
......@@ -88,6 +118,17 @@ public class FactoryCenterController {
return result;
}
//厂区驾驶舱药耗分析
@ApiOperation(value="厂区驾驶舱药耗分析", notes="厂区驾驶舱药耗分析")
@GetMapping(value = "/getYhData")
public Result<Map<String, Object>> getYhData(StatisticsParam statisticsParam) {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> map = factoryCenterService.getYhData(statisticsParam);
result.setSuccess(true);
result.setResult(map);
return result;
}
//厂区削减量统计
@ApiOperation(value="厂区削减量统计", notes="厂区削减量统计")
@GetMapping(value = "/getXjltj")
......
......@@ -36,4 +36,19 @@ public interface FactoryCenterMapper {
@Param("departId") String departId, @Param("view2119") String view2119);
List<Map<String, Object>> getEquiptj(@Param("departId") String departId);
Map<String, Object> getYhData(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departId") String departId,
@Param("dataView3a24") String dataView3a24, @Param("dataView2119") String dataView2119);
Map<String, Object> getDhData(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departId") String departId,
@Param("dataView3a24") String dataView3a24, @Param("dataView2119") String dataView2119);
Map<String, Object> getSlData(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departId") String departId, @Param("dataView2119") String dataView2119);
List<Map<String, Object>> getDsdhListGroupByDepart(@Param("startDate") String startDate, @Param("endDate") String endDate,
@Param("departId") String departId,
@Param("dataView3a24") String dataView3a24, @Param("dataView2119") String dataView2119);
}
......
......@@ -4,6 +4,7 @@ import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
import com.skua.modules.dataAnalysis.vo.EquipAlarmVO;
import com.skua.modules.dataAnalysis.vo.EquipRunTimeVO;
import com.skua.modules.dataAnalysis.vo.EquipWarnVO;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -27,6 +28,7 @@ public interface FactoryOperateCenterMapper {
List<Map<String, String>> getReportCount(@Param("departId") String departId, @Param("month") String month,
@Param("reportName") String reportName);
@Anonymous
Map<String, Object> getSdyData(@Param("view2119") String view2119, @Param("view3a24") String view3a24,
@Param("departId") String departId, @Param("dateTime") String dateTime);
}
......
......@@ -6,13 +6,16 @@
SELECT
LEFT ( v.time, 7 ) AS time,
round( sum( v.CSL ) / 10000, 2 ) AS clsl,
ifnull(v2.clsl,0) as clsl_tb
ifnull(v2.clsl,0) as clsl_tb,
round( sum( v.JSL ) / 10000, 2 ) AS jsl,
ifnull(v2.jsl,0) as jsl_tb
FROM
${view2119} v
left join (
SELECT
RIGHT( LEFT ( v2119.time, 7 ), 2 ) AS time,
round( sum( v2119.CSL ) / 10000, 2 ) AS clsl
round( sum( v2119.CSL ) / 10000, 2 ) AS clsl,
round( sum( v2119.JSL ) / 10000, 2 ) AS jsl
FROM
${view2119tb} v2119
WHERE
......@@ -293,4 +296,110 @@
</foreach>
</if>
</select>
<select id="getYhData" resultType="java.util.HashMap">
select
v3.zyh,v3.rjyh,ROUND(v3.zyh/v2.clsl,2) AS dsyh
from (select ROUND(SUM(v.CSL),2) as clsl,'yh' as type from ${dataView2119} v
where time &gt;= #{startDate} and time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>) v2
left join (select ROUND(SUM(IFNULL(v.PAMRJ,0)+IFNULL(v.SCLPAMZ,0)+IFNULL(v.SCLPAMF,0)+IFNULL(v.NACLO,0)+IFNULL(v.PACGT,0)+IFNULL(v.PACYT,0)+
IFNULL(v.PFS,0)+IFNULL(v.FHTY,0)+IFNULL(v.RYXNJ,0)+IFNULL(v.YWL,0)+IFNULL(v.GXCLJ,0)+IFNULL(v.CH3COONA,0)+IFNULL(v.HXT,0)+IFNULL(v.FECL3,0)+
IFNULL(v.SH,0)+IFNULL(v.CH3COOH,0)+IFNULL(v.FESO4G,0)+IFNULL(v.FESO4Y,0)+IFNULL(v.H2O2,0)),2) AS zyh,ROUND(AVG(IFNULL(v.PAMRJ,0)+
IFNULL(v.SCLPAMZ,0)+IFNULL(v.SCLPAMF,0)+IFNULL(v.NACLO,0)+IFNULL(v.PACGT,0)+IFNULL(v.PACYT,0)+IFNULL(v.PFS,0)+IFNULL(v.FHTY,0)+
IFNULL(v.RYXNJ,0)+IFNULL(v.YWL,0)+IFNULL(v.GXCLJ,0)+IFNULL(v.CH3COONA,0)+IFNULL(v.HXT,0)+IFNULL(v.FECL3,0)+IFNULL(v.SH,0)+IFNULL(v.CH3COOH,0)+
IFNULL(v.FESO4G,0)+IFNULL(v.FESO4Y,0)+IFNULL(v.H2O2,0)),2) AS rjyh,'yh' as type from ${dataView3a24} v
where v.time &gt;= #{startDate} and v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>) v3 ON v2.type = v3.type
</select>
<select id="getDhData" resultType="java.util.HashMap">
select
v3.zdh,v3.rjdh,ROUND(v3.zdh/v2.clsl,2) AS dsdh
from (select ROUND(SUM(v.CSL),2) as clsl,'dh' as type from ${dataView2119} v
where time &gt;= #{startDate} and time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>) v2
left join (select ROUND(SUM(IFNULL(v.DLHJ,0)),2) AS zdh,
ROUND(AVG(IFNULL(v.DLHJ,0)),2) AS rjdh,'dh' as type from ${dataView3a24} v
where v.time &gt;= #{startDate} and v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>) v3 ON v2.type = v3.type
</select>
<select id="getSlData" resultType="java.util.HashMap">
select
f.sjgm,
v2.clsl,
v2.rjclsl
from (select ROUND(SUM(pro_scale),2) AS sjgm,'sl' AS type from sys_factory_info
<if test="departId!=null and departId!=''">
WHERE depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
) f
left join (
select
ROUND(SUM(v.CSL)/10000,2) as clsl,
ROUND(AVG(v.CSL)/10000,2) as rjclsl,
'sl' AS type
from ${dataView2119} v
where v.time &gt;= #{startDate} and v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
) v2 ON f.type = v2.type
</select>
<select id="getDsdhListGroupByDepart" resultType="java.util.HashMap">
select
d.id AS depart_id,
IFNULL(ROUND(IFNULL(v3.dlhj,0)/IFNULL(v2.clsl,2),2),0) AS dsdh
from sys_depart d
left join (
select SUM(v.DLHJ) AS dlhj,v.depart_id from ${dataView3a24} v
where v.time &gt;= #{startDate} and v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY v.depart_id
) v3 on d.id = v3.depart_id
left join (
select SUM(v.CSL) AS clsl,v.depart_id from ${dataView2119} v
where v.time &gt;= #{startDate} and v.time &lt;= #{endDate}
<if test="departId!=null and departId!=''">
AND v.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY v.depart_id
) v2 on d.id = v2.depart_id
where depart_type = '1'
</select>
</mapper>
......
......@@ -32,5 +32,13 @@ public interface IFactoryCenterService {
List<Map<String, Object>> getSzXjltj(StatisticsParam statisticsParam);
List<Map<String, Object>> getEquiptj(StatisticsParam statisticsParam);
Map<String, Object> getYhData(StatisticsParam statisticsParam);
Map<String, Object> getDhData(StatisticsParam statisticsParam);
Map<String, Object> getSlData(StatisticsParam statisticsParam);
Map<String, Object> getWsDhTj(StatisticsParam statisticsParam);
}
......
......@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
......@@ -41,6 +42,8 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
@Autowired
private ISysMonitorMetricInfoService sysMonitorMetricInfoService;
private static DecimalFormat df = new DecimalFormat("#.##");
@Override
public List<WaterQualityMonitoringDetailVO> queryMonitoringData(String departId) {
List<WaterQualityMonitoringDetailVO> list = new ArrayList<>();
......@@ -404,8 +407,8 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
String endDate = statisticsParam.getEndDate();
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "JSL,CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(ReportConstant.view2119, "JSL,CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
list = factoryCenterMapper.getWssltj(startDate,endDate,startDateTb,endDateTb,statisticsParam.getDepartId(),dataView2119,dataView2119tb);
if(list.size() == 0){
List<String> monthList = getMonthsBetween(startDate,endDate);
......@@ -414,6 +417,8 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
map.put("time",month);
map.put("clsl","0");
map.put("clsl_tb","0");
map.put("jsl","0");
map.put("jsl_tb","0");
list.add(map);
}
}
......@@ -642,6 +647,197 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
return list;
}
@Override
public Map<String, Object> getYhData(StatisticsParam statisticsParam) {
Map<String, Object> resMap = new HashMap<>();
double zyh = 0.00;double zyhTb = 0.00;double zyhHb = 0.00;
double rjyh = 0.00;double rjyhTb = 0.00;double rjyhHb = 0.00;
double dsyh = 0.00;double dsyhTb = 0.00;double dsyhHb = 0.00;
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String startDateHb = DateUtils.getHbDate(startDate);
String endDateHb = DateUtils.getHbDate(endDate);
String yjField = "PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ,YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String dataView3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, yjField, statisticsParam.getDepartId(), startDate,endDate);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDate, endDate);
String dataView3a24tb = ReportViewUtil.buildView(ReportConstant.view3a24, yjField, statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119tb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateTb, endDateTb);
String dataView3a24hb = ReportViewUtil.buildView(ReportConstant.view3a24, yjField, statisticsParam.getDepartId(), startDateHb,endDateHb);
String dataView2119hb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateHb, endDateHb);
Map<String, Object> map = factoryCenterMapper.getYhData(startDate, endDate, statisticsParam.getDepartId(), dataView3a24, dataView2119);
if(map!=null){
zyh = Double.parseDouble(map.get("zyh").toString());
rjyh = Double.parseDouble(map.get("rjyh").toString());
dsyh = Double.parseDouble(map.get("dsyh").toString());
}
resMap.put("zyh", zyh);
resMap.put("rjyh", rjyh);
resMap.put("dsyh", dsyh);
Map<String, Object> maptb = factoryCenterMapper.getYhData(startDateTb, endDateTb, statisticsParam.getDepartId(), dataView3a24tb, dataView2119tb);
if(maptb!=null){
zyhTb = Double.parseDouble(maptb.get("zyh").toString());
rjyhTb = Double.parseDouble(maptb.get("rjyh").toString());
dsyhTb = Double.parseDouble(maptb.get("dsyh").toString());
zyhTb = Double.parseDouble(df.format(100*(zyh - zyhTb)/zyhTb));
rjyhTb = Double.parseDouble(df.format(100*(rjyh - rjyhTb)/rjyhTb));
dsyhTb = Double.parseDouble(df.format(100*(dsyh - dsyhTb)/dsyhTb));
}
resMap.put("zyh_tb", zyhTb);
resMap.put("rjyh_tb", rjyhTb);
resMap.put("dsyh_tb", dsyhTb);
Map<String, Object> maphb = factoryCenterMapper.getYhData(startDateHb, endDateHb, statisticsParam.getDepartId(), dataView3a24hb, dataView2119hb);
if(maphb!=null){
zyhHb = Double.parseDouble(maphb.get("zyh").toString());
rjyhHb = Double.parseDouble(maphb.get("rjyh").toString());
dsyhHb = Double.parseDouble(maphb.get("dsyh").toString());
zyhHb = Double.parseDouble(df.format(100*(zyh - zyhHb)/zyhHb));
rjyhHb = Double.parseDouble(df.format(100*(rjyh - rjyhHb)/rjyhHb));
dsyhHb = Double.parseDouble(df.format(100*(dsyh - dsyhHb)/dsyhHb));
}
resMap.put("zyh_hb", zyhHb);
resMap.put("rjyh_hb", rjyhHb);
resMap.put("dsyh_hb", dsyhHb);
return resMap;
}
@Override
public Map<String, Object> getDhData(StatisticsParam statisticsParam) {
Map<String, Object> resMap = new HashMap<>();
double zdh = 0.00;double zdhTb = 0.00;double zdhHb = 0.00;
double rjdh = 0.00;double rjdhTb = 0.00;double rjdhHb = 0.00;
double dsdh = 0.00;double dsdhTb = 0.00;double dsdhHb = 0.00;
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String startDateHb = DateUtils.getHbDate(startDate);
String endDateHb = DateUtils.getHbDate(endDate);
String dataView3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, "DLHJ", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDate, endDate);
String dataView3a24tb = ReportViewUtil.buildView(ReportConstant.view3a24, "DLHJ", statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119tb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateTb, endDateTb);
String dataView3a24hb = ReportViewUtil.buildView(ReportConstant.view3a24, "DLHJ", statisticsParam.getDepartId(), startDateHb,endDateHb);
String dataView2119hb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateHb, endDateHb);
Map<String, Object> map = factoryCenterMapper.getDhData(startDate, endDate, statisticsParam.getDepartId(), dataView3a24, dataView2119);
if(map!=null){
zdh = Double.parseDouble(map.get("zdh").toString());
rjdh = Double.parseDouble(map.get("rjdh").toString());
dsdh = Double.parseDouble(map.get("dsdh").toString());
}
resMap.put("zdh", zdh);
resMap.put("rjdh", rjdh);
resMap.put("dsdh", dsdh);
Map<String, Object> maptb = factoryCenterMapper.getDhData(startDateTb, endDateTb, statisticsParam.getDepartId(), dataView3a24tb, dataView2119tb);
if(maptb!=null){
zdhTb = Double.parseDouble(maptb.get("zdh").toString());
rjdhTb = Double.parseDouble(maptb.get("rjdh").toString());
dsdhTb = Double.parseDouble(maptb.get("dsdh").toString());
zdhTb = Double.parseDouble(df.format(100*(zdh - zdhTb)/zdhTb));
rjdhTb = Double.parseDouble(df.format(100*(rjdh - rjdhTb)/rjdhTb));
dsdhTb = Double.parseDouble(df.format(100*(dsdh - dsdhTb)/dsdhTb));
}
resMap.put("zdh_tb", zdhTb);
resMap.put("rjdh_tb", rjdhTb);
resMap.put("dsdh_tb", dsdhTb);
Map<String, Object> maphb = factoryCenterMapper.getDhData(startDateHb, endDateHb, statisticsParam.getDepartId(), dataView3a24hb, dataView2119hb);
if(maphb!=null){
zdhHb = Double.parseDouble(maphb.get("zdh").toString());
rjdhHb = Double.parseDouble(maphb.get("rjdh").toString());
dsdhHb = Double.parseDouble(maphb.get("dsdh").toString());
zdhHb = Double.parseDouble(df.format(100*(zdh - zdhHb)/zdhHb));
rjdhHb = Double.parseDouble(df.format(100*(rjdh - rjdhHb)/rjdhHb));
dsdhHb = Double.parseDouble(df.format(100*(dsdh - dsdhHb)/dsdhHb));
}
resMap.put("zdh_hb", zdhHb);
resMap.put("rjdh_hb", rjdhHb);
resMap.put("dsdh_hb", dsdhHb);
return resMap;
}
@Override
public Map<String, Object> getSlData(StatisticsParam statisticsParam) {
Map<String, Object> resMap = new HashMap<>();
double clsl = 0.00;double clslTb = 0.00;double clslHb = 0.00;
double rjclsl = 0.00;double rjclslTb = 0.00;double rjclslHb = 0.00;
double sjgm = 0.00;double sjgmTb = 0.00;double sjgmHb = 0.00;
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String startDateTb = DateUtils.getTbDate(startDate);
String endDateTb = DateUtils.getTbDate(endDate);
String startDateHb = DateUtils.getHbDate(startDate);
String endDateHb = DateUtils.getHbDate(endDate);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119tb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateTb,endDateTb);
String dataView2119hb = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDateHb,endDateHb);
Map<String, Object> map = factoryCenterMapper.getSlData(startDate,endDate,statisticsParam.getDepartId(),dataView2119);
if(map!=null){
clsl = Double.parseDouble(map.get("clsl").toString());
rjclsl = Double.parseDouble(map.get("rjclsl").toString());
sjgm = Double.parseDouble(map.get("sjgm").toString());
}
resMap.put("clsl", clsl);
resMap.put("rjclsl", rjclsl);
resMap.put("sjgm", sjgm);
Map<String, Object> maptb = factoryCenterMapper.getSlData(startDateTb,endDateTb,statisticsParam.getDepartId(),dataView2119tb);
if(maptb!=null){
clslTb = Double.parseDouble(maptb.get("clsl").toString());
rjclslTb = Double.parseDouble(maptb.get("rjclsl").toString());
clslTb = Double.parseDouble(df.format(100*(clsl - clslTb)/clslTb));
rjclslTb = Double.parseDouble(df.format(100*(rjclsl - rjclslTb)/rjclslTb));
}
resMap.put("clsl_tb", clslTb);
resMap.put("rjclsl_tb", rjclslTb);
resMap.put("sjgm_tb", sjgmTb);
Map<String, Object> maphb = factoryCenterMapper.getSlData(startDateHb,endDateHb,statisticsParam.getDepartId(),dataView2119hb);
if(maphb!=null){
clslHb = Double.parseDouble(maphb.get("clsl").toString());
rjclslHb = Double.parseDouble(maphb.get("rjclsl").toString());
clslHb = Double.parseDouble(df.format(100*(clsl - clslHb)/clslHb));
rjclslHb = Double.parseDouble(df.format(100*(rjclsl - rjclslHb)/rjclslHb));
}
resMap.put("clsl_hb", clslHb);
resMap.put("rjclsl_hb", rjclslHb);
resMap.put("sjgm_hb", sjgmHb);
return resMap;
}
@Override
public Map<String, Object> getWsDhTj(StatisticsParam statisticsParam) {
Map<String, Object> resMap = new HashMap<>();
int low = 0;int normal = 0;int up = 0;int upper = 0;
String startDate = statisticsParam.getStartDate();
String endDate = statisticsParam.getEndDate();
String dataView3a24 = ReportViewUtil.buildView(ReportConstant.view3a24, "DLHJ", statisticsParam.getDepartId(), startDate,endDate);
String dataView2119 = ReportViewUtil.buildView(ReportConstant.view2119, "CSL", statisticsParam.getDepartId(), startDate, endDate);
List<Map<String,Object>> list = factoryCenterMapper.getDsdhListGroupByDepart(startDate,endDate,statisticsParam.getDepartId(),dataView3a24,dataView2119);
resMap = getDhData(statisticsParam);
if(list.size()>0){
for (Map<String,Object> dsdhMap : list) {
if(dsdhMap.get("dsdh")!=null){
double dsdh = Double.parseDouble(dsdhMap.get("dsdh").toString());
if(dsdh<0.4){
low++;
}else if(dsdh<0.5 && dsdh>=0.4){
normal++;
}else if(dsdh<0.7 && dsdh>=0.5){
up++;
}else{
upper++;
}
}else{
low++;
}
}
}
resMap.put("low", low);//<0.4
resMap.put("normal", normal);//0.4-0.5
resMap.put("up", up);//0.5-0.7
resMap.put("upper", upper);//>0.7
return resMap;
}
/**
* 获取时间之间的月份
* @param start
......
......@@ -158,6 +158,11 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
nclslMap.put("nmbTb", df.format((yearClslMb-yearTbClslMb)/yearClslMb));
nclslMap.put("nwcd", df.format(100*yearClsl/yearClslMb));
nclslMap.put("nwcdTb", "1");
if(yearClslMb == 0.00){
nclslMap.put("wcbfb", "0");
nclslMap.put("nmbTb", "0");
nclslMap.put("nwcd", "0");
}
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
......@@ -167,6 +172,11 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
yclslMap.put("ymbTb", "0");
yclslMap.put("ywcd", df.format(100*monthClsl/(yearClslMb/12)));
yclslMap.put("ywcdTb", "0");
if(yearClslMb == 0.00){
yclslMap.put("wcbfb", "0");
yclslMap.put("ymb", "0");
yclslMap.put("ywcd", "0");
}
map.put("ndsdh",new HashMap<>());
Map<String, Object> ndsdhMap = new HashMap<>();
......
package com.skua.modules.report.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -46,6 +44,92 @@ public class ReportTargetConfig {
@Excel(name = "药量目标", width = 15)
@ApiModelProperty(value = "药量目标")
private String targetDrug;
/**PAC(液)目标*/
@Excel(name = "PAC(液)目标", width = 15)
@ApiModelProperty(value = "PAC(液)目标")
private String targetPacyt;
/**PAC(固)目标*/
@Excel(name = "PAC(固)目标", width = 15)
@ApiModelProperty(value = "PAC(固)目标")
private String targetPacgt;
/**NaClO目标*/
@Excel(name = "NaClO目标", width = 15)
@ApiModelProperty(value = "NaClO目标")
private String targetNaclo;
/**水处理PAM(-)目标*/
@Excel(name = "水处理PAM(-)目标", width = 15)
@ApiModelProperty(value = "水处理PAM(-)目标")
private String targetSclpamf;
/**水处理PAM(+)目标*/
@Excel(name = "水处理PAM(+)目标", width = 15)
@ApiModelProperty(value = "水处理PAM(+)目标")
private String targetSclpamz;
/**污脱PAM乳剂目标*/
@Excel(name = "污脱PAM乳剂目标", width = 15)
@ApiModelProperty(value = "污脱PAM乳剂目标")
private String targetPamrj;
/**污脱PAM(-)目标*/
@Excel(name = "污脱PAM(-)目标", width = 15)
@ApiModelProperty(value = "污脱PAM(-)目标")
private String targetPamf;
/**污脱PAM(+)目标*/
@Excel(name = "污脱PAM(+)目标", width = 15)
@ApiModelProperty(value = "污脱PAM(+)目标")
private String targetPamz;
/**PFS目标*/
@Excel(name = "PFS目标", width = 15)
@ApiModelProperty(value = "PFS目标")
private String targetPfs;
/**复合铁盐目标*/
@Excel(name = "复合铁盐目标", width = 15)
@ApiModelProperty(value = "复合铁盐目标")
private String targetFhty;
/**乳液絮凝剂目标*/
@Excel(name = "乳液絮凝剂目标", width = 15)
@ApiModelProperty(value = "乳液絮凝剂目标")
private String targetRyxnj;
/**益维磷目标*/
@Excel(name = "益维磷目标", width = 15)
@ApiModelProperty(value = "益维磷目标")
private String targetYwl;
/**高效除磷剂目标*/
@Excel(name = "高效除磷剂目标", width = 15)
@ApiModelProperty(value = "高效除磷剂目标")
private String targetGxclj;
/**CH₃COONa目标*/
@Excel(name = "CH₃COONa目标", width = 15)
@ApiModelProperty(value = "CH₃COONa目标")
private String targetCh3coona;
/**活性炭目标*/
@Excel(name = "活性炭目标", width = 15)
@ApiModelProperty(value = "活性炭目标")
private String targetHxt;
/**FeCl3目标*/
@Excel(name = "FeCl3目标", width = 15)
@ApiModelProperty(value = "FeCl3目标")
private String targetFecl3;
/**石灰目标*/
@Excel(name = "石灰目标", width = 15)
@ApiModelProperty(value = "石灰目标")
private String targetSh;
/**CH3COOH目标*/
@Excel(name = "CH3COOH目标", width = 15)
@ApiModelProperty(value = "CH3COOH目标")
private String targetCh3cooh;
/**FeSO4固目标*/
@Excel(name = "FeSO4固目标", width = 15)
@ApiModelProperty(value = "FeSO4固目标")
private String targetFeso4g;
/**FeSO4液目标*/
@Excel(name = "FeSO4液目标", width = 15)
@ApiModelProperty(value = "FeSO4液目标")
private String targetFeso4y;
/**H2O2目标*/
@Excel(name = "H2O2目标", width = 15)
@ApiModelProperty(value = "H2O2目标")
private String targetH2o2;
/**所属厂区*/
@Excel(name = "所属厂区", width = 15)
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
......
......@@ -159,7 +159,9 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
@Anonymous
SysDepart getById(@Param("pid") String pid);
@Anonymous
List<SysDepart> getChildDepartList(@Param("departIds") String departIds);
@Anonymous
List<SysDepart> queryDepartsByIds(@Param("ids") String ids);
}
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.system.entity.SysUser;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -76,5 +77,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
List<SysUser> operationUserList(@Param("departId") String departId);
@Anonymous
String queryDepartIdsByUserId(@Param("userId") String userId);
}
......
......@@ -520,7 +520,9 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
if(ConvertUtils.isNotEmpty(departTree.getToken())){
SysUser user = sysUserMapper.getUserByName(JwtUtil.getUsername(departTree.getToken()));
if(user!=null){
departIds = sysUserMapper.queryDepartIdsByUserId(user.getId());
String ids = commonSqlMapper.getChildDepartByUserId(user.getId());
//departIds = sysUserMapper.queryDepartIdsByUserId(user.getId());
departIds = commonSqlMapper.getChildDepartId(ids);
}
}
pid = departTree.getPid();
......
......@@ -12,6 +12,7 @@ import com.skua.core.api.vo.SysUserCacheInfo;
import com.skua.core.constant.CommonConstant;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.mapper.CommonSqlMapper;
import com.skua.modules.system.entity.*;
import com.skua.modules.system.mapper.*;
import com.skua.modules.system.service.ISysUserDepartService;
......@@ -48,6 +49,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private ISysBaseAPI sysBaseAPI;
@Autowired
private SysDepartMapper sysDepartMapper;
@Resource
private CommonSqlMapper commonSqlMapper;
@Autowired
WebSocket webSocket;
......@@ -173,7 +176,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 根据角色Id查询
@Override
public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username) {
String departIds = userMapper.queryDepartIdsByUserId(BaseContextHandler.getUserId());
// String departIds = userMapper.queryDepartIdsByUserId(BaseContextHandler.getUserId());
String ids = commonSqlMapper.getChildDepartByUserId(BaseContextHandler.getUserId());
String departIds = commonSqlMapper.getChildDeparts(ids);
return userMapper.getUserByRoleId(page, roleId, username, departIds);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!