1893b72a 张雷

运营考核问题修改

1 个父辈 1aa71f8e
......@@ -24,11 +24,17 @@ public class AliAlarm {
@ApiModelProperty(value = "指标限值")
private String limitValue;
@ApiModelProperty(value = "超标原因:大于上限,小于下限")
@ApiModelProperty(value = "超标原因:大于上限,小于下限,故障")
private String alarmParamReason;
@ApiModelProperty(value = "报警地点")
private String alarmLoction;
@ApiModelProperty(value = "接收手机号,多个手机号逗号隔开")
private String phone;
@ApiModelProperty(value = "报警类型:0模拟量、1数字量、2其他")
private String alarmType;
}
......
......@@ -36,9 +36,10 @@ public class AliSmsUtil {
* @param template 短信模板id
* @param message 短信内容 模板内容与模板参数必须完全匹配
*/
public static void sendMsg(String phoneNumbers, String template, Map<String, Object> message){
public static boolean sendMsg(String phoneNumbers, String template, Map<String, Object> message){
RequestEntity<Map> requestEntity = null;
ResponseEntity<Map> responseEntity = null;
boolean ok = true;//发送结果标识
try {
Map requestBody = new HashMap();
requestBody.put("phone_numbers", phoneNumbers);
......@@ -53,21 +54,26 @@ public class AliSmsUtil {
.body(requestBody, Map.class);
responseEntity = restTemplate.exchange(requestEntity, Map.class);
Integer code = (Integer) responseEntity.getBody().get("code");
ok = true;
if (code != 200) {
ok = false;
log.error(String.format("阿里短信发送失败 请求=%s 响应=%s", requestBody.toString(), responseEntity.toString()));
}
} catch (Exception e) {
ok = false;
log.error(String.format("阿里短信发送失败 请求=%s 响应=%s",
requestEntity == null ? "" : requestEntity.toString() ,
responseEntity == null ? "" : responseEntity.toString()), e);
throw new JeecgBootException("阿里短信发送失败");
}
return ok;
}
/**
* 发送阈值报警短信
* 在${time}时${factory}采集数据${alarmParamName}值:${actualAvgValue},标准要求${limit},当前${alarmParamUnit},请注意!
*/
public static void sendLimitAlarmMsg(AliAlarm aliAlarm) {
public static boolean sendLimitAlarmMsg(AliAlarm aliAlarm) {
boolean ok = true;//发送结果标识
if(StringUtils.isNotEmpty(aliAlarm.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("time", aliAlarm.getTime());
......@@ -76,51 +82,55 @@ public class AliSmsUtil {
message.put("actualAvgValue", aliAlarm.getAlarmParamValue() + aliAlarm.getAlarmParamUnit());
message.put("limit", aliAlarm.getLimitValue() + aliAlarm.getAlarmParamUnit());
message.put("alarmParamUnit", aliAlarm.getAlarmParamReason());
AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_LIMIT, message);
ok = AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_LIMIT, message);
}else{
log.info("=======>>>>>>>>>>【阈值报警】接收人手机号未设定!");
}
return ok;
}
/**
* 发送设备报警短信
* ${factory}于${date},${equip}信号为:${level},该设备位于${part},请及时处理。
*/
public static void sendEquipAlarmMsg(AliAlarm aliAlarm) {
public static boolean sendEquipAlarmMsg(AliAlarm aliAlarm) {
boolean ok = true;//发送结果标识
if(StringUtils.isNotEmpty(aliAlarm.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("time", aliAlarm.getTime());
message.put("date", aliAlarm.getTime());
message.put("factory", aliAlarm.getFactory());
message.put("alarmParamName", aliAlarm.getAlarmParamName());
message.put("actualAvgValue", aliAlarm.getAlarmParamValue() + aliAlarm.getAlarmParamUnit());
message.put("limit", aliAlarm.getLimitValue() + aliAlarm.getAlarmParamUnit());
message.put("alarmParamUnit", aliAlarm.getAlarmParamReason());
AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_EQUIP, message);
message.put("equip", aliAlarm.getAlarmParamName());
message.put("limit", aliAlarm.getLimitValue());
message.put("part", aliAlarm.getAlarmLoction());
ok = AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_EQUIP, message);
}else{
log.info("=======>>>>>>>>>>【设备报警】接收人手机号未设定!");
}
return ok;
}
/**
* 发送验证码短信
*/
public static void sendCodeMsg(AliCode aliCode) {
public static boolean sendCodeMsg(AliCode aliCode) {
boolean ok = true;//发送结果标识
if(StringUtils.isNotEmpty(aliCode.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("code", aliCode.getCode());
message.put("product", aliCode.getProduct());
if("update".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_UPDATE, message);
ok = AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_UPDATE, message);
}else if("login".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_LOGIN, message);
ok = AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_LOGIN, message);
}else if("register".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_REGISTER, message);
ok = AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_REGISTER, message);
}else{
log.info("=======>>>>>>>>>>短信验证码缺少对应模版");
}
}else{
log.info("=======>>>>>>>>>>【验证码】接收人手机号未设定!");
}
return ok;
}
public static void main(String[] args) {
......
......@@ -52,6 +52,17 @@ public class DateUtils {
return dayNUm;
}
/**
* 根据月份获取天数
* @param month
* @return
*/
public static int getDayCountByMonth(String month){
YearMonth yearMonth = YearMonth.parse(month);
return yearMonth.lengthOfMonth();
}
/**
* 根据(开始时间, 结束时间)获取每一个时间间隔的数据, 主要用于eCharts图标xData
*
......
......@@ -23,4 +23,7 @@ public interface FactoryOperateCenterMapper {
List<ArchivesWarnVO> getArchivesWarn(@Param("departId") String departId);
List<Map<String, Object>> getFlowData(@Param("departId") String departId, @Param("month") String month);
List<Map<String, String>> getReportCount(@Param("departId") String departId, @Param("month") String month,
@Param("reportName") String reportName);
}
......
......@@ -35,7 +35,6 @@
#{item}
</foreach>
AND a.record_time LIKE CONCAT(#{month},'%')
AND a.alarm_rule_type IN ( 'B001B001', 'B001B002', 'B001B003', 'B001B004' )
ORDER BY
a.record_time
</select>
......@@ -112,12 +111,21 @@
LEFT JOIN sys_user u ON a.ASSIGNEE_ = CONCAT( 'taskUser_', u.id )
LEFT JOIN sys_user_depart d ON u.id = d.user_id
WHERE
a.ASSIGNEE_ IS NOT NULL
AND d.dep_id in
d.dep_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
AND CREATE_TIME_ LIKE CONCAT(#{month},'%')
GROUP BY a.REV_
</select>
<select id="getReportCount" resultType="java.util.HashMap">
SELECT
time
FROM
${reportName}
WHERE
depart_id = #{departId}
AND time LIKE CONCAT(#{month},'%')
</select>
</mapper>
......
......@@ -3,6 +3,7 @@ package com.skua.modules.dataAnalysis.service.impl;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.DoubleOperaUtils;
import com.skua.modules.dataAnalysis.mapper.FactoryOperateCenterMapper;
import com.skua.modules.dataAnalysis.service.IFactoryOperateCenterService;
import com.skua.modules.dataAnalysis.vo.ArchivesWarnVO;
......@@ -24,8 +25,6 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
@Resource
private FactoryOperateCenterMapper factoryOperateCenterMapper;
@Autowired
private FlowForThirdBusinessService flowForThirdBusinessService;
@Override
public Map<String, Object> getData(String departId, String month) {
......@@ -35,9 +34,9 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
nclslMap.put("nsjsl","1267");
nclslMap.put("wcbfb","80");
nclslMap.put("nmb","1678");
nclslMap.put("nmbTb","5");
nclslMap.put("nmbTb","1");
nclslMap.put("nwcd","1234");
nclslMap.put("nwcdTb","5");
nclslMap.put("nwcdTb","3");
map.put("yclsl",new HashMap<>());
Map<String, Object> yclslMap = new HashMap<>();
......@@ -46,23 +45,23 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
yclslMap.put("ymb","161");
yclslMap.put("ymbTb","5");
yclslMap.put("ywcd","161");
yclslMap.put("ywcdTb","5");
yclslMap.put("ywcdTb","2");
map.put("ndsdh",new HashMap<>());
Map<String, Object> ndsdhMap = new HashMap<>();
ndsdhMap.put("ndsdh","0.5");
ndsdhMap.put("nmb","0.45");
ndsdhMap.put("nmbTb","5");
ndsdhMap.put("ydsdh","1234");
ndsdhMap.put("ydsdhTb","5");
ndsdhMap.put("nmbTb","1");
ndsdhMap.put("ydsdh","0.32");
ndsdhMap.put("ydsdhTb","0");
map.put("ndsyf",new HashMap<>());
Map<String, Object> ndsyfMap = new HashMap<>();
ndsyfMap.put("ndsyf","0.8");
ndsyfMap.put("nmb","0.65");
ndsyfMap.put("nmbTb","4");
ndsyfMap.put("nmbTb","2");
ndsyfMap.put("ydsyf","0.68");
ndsyfMap.put("ydsyfTb","5");
ndsyfMap.put("ydsyfTb","1");
map.put("zhpf",new HashMap<>());
Map<String, Object> zhpfMap = new HashMap<>();
......@@ -93,54 +92,72 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
@Override
public Map<String, Object> getReportData(String departId, String month) {
int dayCount = DateUtils.getDayCountByMonth(month);
Map<String, Object> map = new HashMap<>();
int nh = 100;
int hy = 100;
int df = 100;
int yyzb = 100;
int ndmb = 100;
int scyb = 100;
int zhf = 100;
double nh = 100;int nhd = 30;
double hy = 100;int hyd = 30;
double df = 100;int dfd = 1;int dfs = 1;
double yyzb = 100;int yyzbd = 4;int yyzbs = 4;
double ndmb = 100;int ndmbd = 1;int ndmbs = 1;
double scyb = 100;int scybd = 1;int scybs = 1;
double zhf = 100;
List<Map<String,String>> nhList = factoryOperateCenterMapper.getReportCount(departId,month,"view_3a24");//能耗日报表
List<Map<String,String>> yyzbList = factoryOperateCenterMapper.getReportCount(departId,month,"view_30a8");//运营周报表
List<Map<String,String>> scybList = factoryOperateCenterMapper.getReportCount(departId,month,"view_4411");//月度生产数据报表
List<Map<String,String>> hyList = factoryOperateCenterMapper.getReportCount(departId,month,"view_9bff");//化验数据日报表
//能耗报表
nhd = nhList.size();
nh = DoubleOperaUtils.bigDecimalRound((100*nhd)/dayCount,0);
map.put("nh",new HashMap<>());
Map<String, Object> nhMap = new HashMap<>();
nhMap.put("bfb",98);
nhMap.put("done",29);
nhMap.put("should",30);
nhMap.put("bfb",nh);
nhMap.put("done",nhd);
nhMap.put("should",dayCount);
//化验报表
hyd = hyList.size();
hy = DoubleOperaUtils.bigDecimalRound((100*hyd)/dayCount,0);
map.put("hy",new HashMap<>());
Map<String, Object> hyMap = new HashMap<>();
hyMap.put("bfb",98);
hyMap.put("done",29);
hyMap.put("should",30);
hyMap.put("bfb",hy);
hyMap.put("done",hyd);
hyMap.put("should",dayCount);
//电费报表
map.put("df",new HashMap<>());
Map<String, Object> dfMap = new HashMap<>();
dfMap.put("bfb",98);
dfMap.put("done",29);
dfMap.put("should",30);
dfMap.put("bfb",df);
dfMap.put("done",dfd);
dfMap.put("should",dfs);
//运营报表
yyzbd = yyzbList.size();
yyzb = DoubleOperaUtils.bigDecimalRound((100*yyzbd)/dayCount,0);
map.put("yyzb",new HashMap<>());
Map<String, Object> yyzbMap = new HashMap<>();
yyzbMap.put("bfb",75);
yyzbMap.put("done",3);
yyzbMap.put("should",4);
yyzbMap.put("bfb",yyzb);
yyzbMap.put("done",yyzbd);
yyzbMap.put("should",yyzbs);
//年度目标报表
map.put("ndmb",new HashMap<>());
Map<String, Object> ndmbMap = new HashMap<>();
ndmbMap.put("bfb",100);
ndmbMap.put("done",1);
ndmbMap.put("should",1);
ndmbMap.put("bfb",ndmb);
ndmbMap.put("done",ndmbd);
ndmbMap.put("should",ndmbs);
//生产报表
if(scybList.size()>0){
scyb = 100;scybd = 1;scybs = 1;
}else{
scyb = 0;scybd = 0;scybs = 1;
}
map.put("scyb",new HashMap<>());
Map<String, Object> scybMap = new HashMap<>();
scybMap.put("bfb",100);
scybMap.put("done",1);
scybMap.put("should",1);
scybMap.put("bfb",scyb);
scybMap.put("done",scybd);
scybMap.put("should",scybs);
//综合报表
map.put("zhf",new HashMap<>());
Map<String, Object> zhfMap = new HashMap<>();
zhfMap.put("zhf",98);
zhfMap.put("zhfHb",3);
zhf = DoubleOperaUtils.bigDecimalRound((nh + hy + df + yyzb + ndmb + scyb)/6,0);
zhfMap.put("zhf", zhf);
zhfMap.put("zhfHb", 1);
//汇总
map.put("nh", nhMap);
map.put("hy", hyMap);
......@@ -170,6 +187,10 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
public List<EquipRunTimeVO> getEquipRunTime(String departId, String month) {
List<EquipRunTimeVO> list = new ArrayList<>();
list = factoryOperateCenterMapper.getEquipRunTime(departId, month);
for (EquipRunTimeVO equipRunTime : list) {
String monitorId = equipRunTime.getRunTime();
equipRunTime.setRunTime("0");
}
return list;
}
......@@ -185,19 +206,24 @@ public class FactoryOperateCenterServiceImpl implements IFactoryOperateCenterSer
Map<String, Object> map = new HashMap<>();
int no = 0;//未完成工单
int yes = 0;//完成工单
int ing = 0;//完成工单
List<Map<String, Object>> list = factoryOperateCenterMapper.getFlowData(departId,month);
if(list.size() > 0){
for (Map<String, Object> flowMap : list) {
if(flowMap.get("status") == null){
no++;
}else{
if("2".equals(flowMap.get("status").toString())){
yes = Integer.parseInt(flowMap.get("status").toString());
}else{
no = no + Integer.parseInt(flowMap.get("status").toString());
ing = ing + Integer.parseInt(flowMap.get("status").toString());
}
}
}
}
map.put("total", yes + no);
map.put("total", yes + no + ing);
map.put("no", no);
map.put("ing", no);
map.put("ing", ing);
map.put("yes", yes);
return map;
}
......
......@@ -12,7 +12,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.util.encryption.MD5Util;
import com.skua.modules.common.vo.AliCode;
import com.skua.modules.system.vo.SsoLogin;
import com.skua.tool.util.AliSmsUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -476,9 +478,11 @@ public class LoginController {
result.setSuccess(false);
return result;
}
//随机数
String captcha = RandomUtil.randomNumbers(6);
AliCode aliCode = new AliCode();
aliCode.setProduct("数字化企业大脑");
aliCode.setCode(captcha);
try {
boolean b = false;
//注册模板
......@@ -489,7 +493,8 @@ public class LoginController {
sysBaseAPI.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
return result;
}
b = HttpSenderMsg.sendMsg("注册验证码为:" + captcha, mobile);
aliCode.setType("register");
// b = HttpSenderMsg.sendMsg("注册验证码为:" + captcha, mobile);
} else {
//登录模式,校验用户有效性
SysUser sysUser = sysUserService.getUserByPhone(mobile);
......@@ -503,13 +508,15 @@ public class LoginController {
*/
if (CommonConstant.SMS_TPL_TYPE_0.equals(smsmode)) {
//登录模板
b = HttpSenderMsg.sendMsg("登录验证码为:" + captcha, mobile);
aliCode.setType("login");
// b = HttpSenderMsg.sendMsg("登录验证码为:" + captcha, mobile);
} else if (CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
aliCode.setType("update");
//忘记密码模板
b = HttpSenderMsg.sendMsg("验证码为:" + captcha, mobile);
// b = HttpSenderMsg.sendMsg("验证码为:" + captcha, mobile);
}
}
b = AliSmsUtil.sendCodeMsg(aliCode);
if (b == false) {
result.setMessage("短信验证码发送失败,请稍后重试");
result.setSuccess(false);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!