Commit 54da815c authored by chenzhao's avatar chenzhao

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

parents 0e18f038 8fc2711d
...@@ -87,4 +87,8 @@ public class AlertCallePowerTransferRo implements Serializable{ ...@@ -87,4 +87,8 @@ public class AlertCallePowerTransferRo implements Serializable{
@ApiModelProperty(value = "调派类型队伍") @ApiModelProperty(value = "调派类型队伍")
private String powerTransType; private String powerTransType;
//bug 5973
@Label(value = "类别")
private Integer category;
} }
...@@ -338,7 +338,7 @@ public class MaintenanceCompanyController extends BaseController { ...@@ -338,7 +338,7 @@ public class MaintenanceCompanyController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/get/amosOrgIdsByIds") @GetMapping(value = "/get/amosOrgIdsByIds")
@ApiOperation(httpMethod = "GET", value = "根据主键查orgIds", notes = "根据主键查orgIds") @ApiOperation(httpMethod = "GET", value = "根据主键查orgIds", notes = "根据主键查orgIds")
public ResponseModel<List<String>> getAmosOrgIdsByIds(@RequestParam(value = "list", required = true) List<String> list) { public ResponseModel<List<String>> getAmosOrgIdsByIdsgetAmosOrgIdsByIds(@RequestParam(value = "list", required = true) List<String> list) {
return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.getAmosOrgIdsByIds(list)); return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.getAmosOrgIdsByIds(list));
} }
......
package com.yeejoin.amos.boot.module.jcs.biz.audioToText.entity;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "speech-config")
public class SpeechConfig implements InitializingBean {
public String accessKeyId;
public String accessKeySecret;
public String appKey;
@Override
public void afterPropertiesSet() throws Exception {
com.yeejoin.amos.speech.SpeechConfig.AccessKeyId = accessKeyId;
com.yeejoin.amos.speech.SpeechConfig.AccessKeySecret = accessKeySecret;
com.yeejoin.amos.speech.SpeechConfig.AppKey = appKey;
}
}
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.config.ClazzUtils; import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.feign.rule.Rule; import com.yeejoin.amos.feign.rule.Rule;
import com.yeejoin.amos.feign.rule.client.RuleClient; import com.yeejoin.amos.feign.rule.client.RuleClient;
...@@ -265,6 +266,9 @@ public class RuleAlertCalledService { ...@@ -265,6 +266,9 @@ public class RuleAlertCalledService {
if (alertCalledFormDto == null) { if (alertCalledFormDto == null) {
return false; return false;
} }
//任务型计划 // bug 5973
alertCallePowerTransferRo.setCategory(RuleTypeEnum.任务型计划生成.getCategory());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled(); AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
alertCallePowerTransferRo alertCallePowerTransferRo
.setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN)); .setCallTimeStr(DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
......
...@@ -17,7 +17,7 @@ import java.util.Map; ...@@ -17,7 +17,7 @@ import java.util.Map;
@RuleFact(value = "维保任务",project = "消息规则") @RuleFact(value = "维保任务",project = "消息规则")
public class PlanRo implements Serializable { public class PlanRo implements Serializable {
private static final long serialVersionUID = 1070080521549842475L; private static final long serialVersionUID = 1779427739908876854L;
@Label("任务名称") @Label("任务名称")
private String name; private String name;
......
...@@ -503,6 +503,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -503,6 +503,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
if (CollectionUtils.isNotEmpty(extraUserIds)) { if (CollectionUtils.isNotEmpty(extraUserIds)) {
log.info("接收人ID:{}", extraUserIds);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, extraUserIds); rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, extraUserIds);
} }
} }
......
...@@ -7,6 +7,8 @@ import com.yeejoin.amos.maintenance.business.dto.PlanRo; ...@@ -7,6 +7,8 @@ import com.yeejoin.amos.maintenance.business.dto.PlanRo;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient; import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.business.util.DateUtil; import com.yeejoin.amos.maintenance.business.util.DateUtil;
import com.yeejoin.amos.maintenance.dao.entity.Plan; import com.yeejoin.amos.maintenance.dao.entity.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -18,10 +20,11 @@ import java.util.List; ...@@ -18,10 +20,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
public class RulePlanService { public class RulePlanService {
private final String packageId = "消息/addMaintenance"; private final String packageId = "消息/addMaintenance";
private final String msgType = "maintenance"; private final String msgType = "maintenance";
private final Logger log = LoggerFactory.getLogger(RulePlanService.class);
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired @Autowired
...@@ -30,6 +33,7 @@ public class RulePlanService { ...@@ -30,6 +33,7 @@ public class RulePlanService {
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception { public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds); PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds);
//触发规则 //触发规则
log.info("消防维保推规则触发消息入参:{}, packageId:{} ", planRo, packageId);
ruleTrigger.publish(planRo, packageId, new String[0]); ruleTrigger.publish(planRo, packageId, new String[0]);
return true; return true;
} }
......
package com.yeejoin.amos.patrol.business.service.impl; package com.yeejoin.amos.patrol.business.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*; import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.dto.MsgRo;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo; import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business; import com.yeejoin.amos.patrol.business.feign.Business;
...@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired @Autowired
private EquipFeign equipFeign; private EquipFeign equipFeign;
@Autowired
private RulePlanService rulePlanService;
@Autowired
private RuleTrigger ruleTrigger;
private final String packageId = "消息/addCheckRule";
private final String msgType = "patrolSystem";
private final String APP = "APP";
private final String WEB = "WEB";
private final String APP_WEB = "APP/WEB";
private static final String TAB = "\r\n";
@Override @Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) { public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params); long total = planTaskMapper.countPlanTask(params);
...@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask.setEndTime(endTime); planTask.setEndTime(endTime);
// 1.保存执行数据主表 // 1.保存执行数据主表
iplanTaskDao.saveAndFlush(planTask); iplanTaskDao.saveAndFlush(planTask);
// 发送APP待办消息
sendMessage(plan, planTask);
String executorId = planTask.getUserId(); String executorId = planTask.getUserId();
long planId = planTask.getId(); long planId = planTask.getId();
for (int i1 = 0; i1 < pointIdList.size(); i1++) { for (int i1 = 0; i1 < pointIdList.size(); i1++) {
...@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// return deptMap; // return deptMap;
} }
public void sendMessage(Plan plan, PlanTask planTask) throws Exception {
MsgRo msgRo = new MsgRo();
// 标题
msgRo.setName(plan.getName());
// 内容
String body = "";
body += "待执行巡检任务" + TAB;
body += "巡检任务名称:" + plan.getName() + TAB;
body += "执行时间:" + planTask.getBeginTime() + "-" + planTask.getEndTime();
msgRo.setContent(body);
// 接收人
ArrayList<String> userIdList = new ArrayList<>();
userIdList.add(planTask.getUserId());
msgRo.setRecivers(userIdList);
msgRo.setMsgType(msgType);
msgRo.setTerminal(APP_WEB);
msgRo.setSendTime(DateTime.now().toString());
// 关联id
msgRo.setRelationId(String.valueOf(plan.getId()));
// 扩展参数
HashMap<String, String> extras = new HashMap<>();
extras.put("type", msgType);
extras.put("planId", String.valueOf(plan.getId()));
extras.put("planTaskId", String.valueOf(planTask.getId()));
msgRo.setExtras(extras);
msgRo.setIsSendApp(true);
msgRo.setIsSendWeb(true);
msgRo.setCategory(RuleConstant.TASK);
// PushMsgParam pushMsgParam = new PushMsgParam();
// rulePlanService.sendRule(pushMsgParam);
log.info("巡检待办任务:%s {}", JSON.toJSON(msgRo));
//触发规则
ruleTrigger.publish(msgRo, packageId, new String[0]);
}
@Override @Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) { public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId); List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId);
......
...@@ -113,4 +113,9 @@ auth-key-fire-fighters=fire_fighters_info ...@@ -113,4 +113,9 @@ auth-key-fire-fighters=fire_fighters_info
mybatis.interceptor.enabled = false mybatis.interceptor.enabled = false
## 消防救援保障部ID ## 消防救援保障部ID
fire-rescue=1432549862557130753 fire-rescue=1432549862557130753
\ No newline at end of file
#阿里云实时语音识别参数
speech-config.access-key-id=LTAI5t7mGN6dYoCwMdKiLTgt
speech-config.access-key-secret=0LYdEnvKzQxBg0lpIahDp5rzB2r4Dp
speech-config.app-key=EG5fJBBIqkNMj6bM
\ No newline at end of file
...@@ -85,7 +85,7 @@ class AppNslClientToken { ...@@ -85,7 +85,7 @@ class AppNslClientToken {
* @return token 访问token * @return token 访问token
*/ */
private static AccessToken getAccessToken() { private static AccessToken getAccessToken() {
AccessToken accessToken = new AccessToken(SpeechConfig.AccessKeId, SpeechConfig.AccessKeySecret); AccessToken accessToken = new AccessToken(SpeechConfig.AccessKeyId, SpeechConfig.AccessKeySecret);
try { try {
accessToken.apply(); accessToken.apply();
logger.warn("获取到最新的token: " + accessToken.getToken() + ", 过期时间: " + accessToken.getExpireTime() + "(" + accessToken.getExpireTime() / (1000 * 60 * 60 * 24) + "天)"); logger.warn("获取到最新的token: " + accessToken.getToken() + ", 过期时间: " + accessToken.getExpireTime() + "(" + accessToken.getExpireTime() / (1000 * 60 * 60 * 24) + "天)");
......
...@@ -23,8 +23,8 @@ public class SpeechConfig { ...@@ -23,8 +23,8 @@ public class SpeechConfig {
/** /**
* 测试信息,可在阿里云上配置 * 测试信息,可在阿里云上配置
*/ */
public static final String AccessKeId = "LTAI5t7mGN6dYoCwMdKiLTgt"; public static String AccessKeyId = "";
public static final String AccessKeySecret = "0LYdEnvKzQxBg0lpIahDp5rzB2r4Dp"; public static String AccessKeySecret = "";
public static final String AppKey = "EG5fJBBIqkNMj6bM"; public static String AppKey = "";
} }
...@@ -69,7 +69,7 @@ public class SpeechRecognizer { ...@@ -69,7 +69,7 @@ public class SpeechRecognizer {
e.printStackTrace(); e.printStackTrace();
} }
// 创建DefaultAcsClient实例并初始化 // 创建DefaultAcsClient实例并初始化
DefaultProfile profile = DefaultProfile.getProfile(REGIONID, SpeechConfig.AccessKeId, SpeechConfig.AccessKeySecret); DefaultProfile profile = DefaultProfile.getProfile(REGIONID, SpeechConfig.AccessKeyId, SpeechConfig.AccessKeySecret);
this.client = new DefaultAcsClient(profile); this.client = new DefaultAcsClient(profile);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment