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);
}
......
......@@ -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!