Commit 34dfb7ce authored by suhuiguang's avatar suhuiguang

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/WaterResourceDto.java
parents a2c65bbd cce69247
......@@ -64,7 +64,7 @@ public class ControllerAop {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText", "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/wechat-relation/save","/tzs/alert-called/saveMobile"};
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText", "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/wechat-relation/save","/tzs/alert-called/saveMobile","/tzs/elevator/getElevatorInfo"};
// 获取请求路径
for(String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) {
......
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.biz.common.service;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
public interface IWorkflowExcuteService{
/**
......@@ -16,14 +18,14 @@ public interface IWorkflowExcuteService{
* @param processInstanceId 流程定义的ID
* @return true 可以执行,false 无执行权限
*/
boolean checkTaskAuth(String processInstanceId);
boolean checkTaskAuth(String processInstanceId, ReginParams userInfo);
/**
* 检查当前登录人有没有流程操作权限
* @param processInstanceId 流程定义的ID
* @return 包含是否执行的角色权限flag,以及当前任务的id
*/
Map<String, Object> checkTaskAuthMap(String processInstanceId);
Map<String, Object> checkTaskAuthMap(String processInstanceId, ReginParams userInfo);
/**
* 设置当前任务的执行人,只支持当前节点流程拥有单个可执行任务的情况,不支持并行网关产生的多条任务设置人的任务情况
* @param processInstanceId
......@@ -37,7 +39,7 @@ public interface IWorkflowExcuteService{
* @param userInfo
* @return
*/
boolean CompleteTask(String processInstanceId,String condition);
boolean CompleteTask(String processInstanceId,String condition, ReginParams userInfo);
}
......@@ -7,15 +7,19 @@ import java.util.Map;
import java.util.Random;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import ch.qos.logback.core.joran.conditional.IfAction;
@Service
public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
......@@ -43,49 +47,60 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
}
@Override
public boolean checkTaskAuth(String processInstanceId) {
Map<String, Object> map = checkTaskAuthMap(processInstanceId);
public boolean checkTaskAuth(String processInstanceId, ReginParams userInfo) {
Map<String, Object> map = checkTaskAuthMap(processInstanceId, userInfo);
return Boolean.parseBoolean(map.get("checkFlag").toString());
}
@Override
public Map<String, Object> checkTaskAuthMap(String processInstanceId) {
public Map<String, Object> checkTaskAuthMap(String processInstanceId, ReginParams userInfo) {
// 获取当前登录用户的角色
String currentLoginUserRole = userInfo.getRole().getRoleName();
String currentLoginUserId = userInfo.getUserModel().getUserId();
Map<String, Object> map = new HashMap<String, Object>();
map.put("checkFlag", false);
JSONObject teskObject = workflowFeignService.getTask(processInstanceId);
if (ObjectUtils.isNotEmpty(teskObject.getJSONObject("data"))) {
map.put("taskId", teskObject.getJSONObject("data").getString("id"));
map.put("checkFlag", true);
map.put("name", teskObject.getJSONObject("data").getString("name"));
JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId);
if (ObjectUtils.isNotEmpty(teskObject)) {
JSONArray taskDetailArray = teskObject.getJSONArray("data");
for (Object obj : taskDetailArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
if ("制定计划+内容".equals(detail.getString("name")) || "现场确认".equals(detail.getString("name")) ) {
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
map.put("name", detail.getString("name"));
return map;
}
JSONObject taskGroupNameObject = workflowFeignService.getTaskGroupName(detail.getString("id"));
// 获取流程中原本设置的当前节点的执行权限
JSONArray taskGroupNameDetail = taskGroupNameObject.getJSONArray("data");
// 如果拿不到当前任务的执行角色,再去获取当前任务有没有默认的执行人,如果都没有则返回校验失败
if (ObjectUtils.isEmpty(taskGroupNameDetail)) {
JSONObject taskAssignObject = workflowFeignService.getTaskAssign(detail.getString("id"));
String assignUser = taskAssignObject.getJSONObject("data").getString("assignee");
if (StringUtils.isNotBlank(assignUser)) {
// 如果当前登录人与当前任务的设定人不一定,则直接返回权限校验失败
if (!currentLoginUserId.equals(assignUser)) {
return map;
}
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
map.put("name", detail.getString("name"));
map.put("assign", assignUser);
return map;
}
continue;
}
String defaultExecutionRoleProcess = taskGroupNameDetail.getJSONObject(0).getString("groupId");
// 判断当前登录人的角色是不是与流程中设置的当前任务节点权限一致,一致则执行,不一致则退出
if (!defaultExecutionRoleProcess.equals(currentLoginUserRole)) {
continue;
}
map.put("taskId", detail.getString("id"));
map.put("checkFlag", true);
map.put("name", detail.getString("name"));
map.put("groupName", currentLoginUserRole);
}
}
/*
* JSONObject teskObject = workflowFeignService.getTaskList(processInstanceId);
* if (ObjectUtils.isNotEmpty(teskObject)) { JSONArray taskDetailArray =
* teskObject.getJSONArray("data"); for (Object obj : taskDetailArray) {
* JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(obj));
* JSONObject taskGroupNameObject =
* workflowFeignService.getTaskGroupName(detail.getString("id")); //
* 获取流程中原本设置的当前节点的执行权限 JSONArray taskGroupNameDetail =
* taskGroupNameObject.getJSONArray("data"); //
* 如果拿不到当前任务的执行角色,再去获取当前任务有没有默认的执行人,如果都没有则返回校验失败 if
* (ObjectUtils.isEmpty(taskGroupNameDetail)) { JSONObject taskAssignObject =
* workflowFeignService.getTaskAssign(detail.getString("id")); String assignUser
* = taskAssignObject.getJSONObject("data").getString("assignee"); if
* (StringUtils.isNotBlank(assignUser)) { // 如果当前登录人与当前任务的设定人不一定,则直接返回权限校验失败 if
* (!currentLoginUserId.equals(assignUser)) { return map; } else {
* map.put("taskId", detail.getString("id")); map.put("checkFlag", true);
* map.put("name", detail.getString("name")); map.put("assign", assignUser);
* return map; } } continue; } String defaultExecutionRoleProcess =
* taskGroupNameDetail.getJSONObject(0).getString("groupId"); //
* 判断当前登录人的角色是不是与流程中设置的当前任务节点权限一致,一致则执行,不一致则退出 if
* (!defaultExecutionRoleProcess.equals(currentLoginUserRole)) { continue; }
* map.put("taskId", detail.getString("id")); map.put("checkFlag", true);
* map.put("name", detail.getString("name"));
* map.put("groupName",currentLoginUserRole); } }
*/
return map;
}
......@@ -126,8 +141,8 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
}
@Override
public boolean CompleteTask(String processInstanceId, String condition) {
Map<String, Object> map = checkTaskAuthMap(processInstanceId);
public boolean CompleteTask(String processInstanceId, String condition, ReginParams userInfo) {
Map<String, Object> map = checkTaskAuthMap(processInstanceId, userInfo);
if (Boolean.parseBoolean(map.get("checkFlag").toString())) {
HashMap<String, Object> conditionMap = new HashMap<String, Object>();
conditionMap.put("condition", condition);
......
......@@ -81,8 +81,8 @@ public class FireStationDto extends BaseDto {
@ExcelProperty(value = "装备简要情况", index = 9)
@ApiModelProperty(value = "装备简要情况")
private String equipmentBrief;
@ExcelProperty(value = "微型消防站照片", index = 10)
/*bug 2963 微型消防站,导入模板里面不应该有照片字段 2021-09-24 CEHNZHAO*/
@ExcelIgnore
@ApiModelProperty(value = "图片信息")
private String img;
......
......@@ -108,4 +108,9 @@ public class AlertCalledDto extends BaseDto{
@ApiModelProperty(value = "警情状态str")
private String alertStatusStr;
@ApiModelProperty(value = "来源系统")
private String systemSource;
@ApiModelProperty(value = "系统来源code")
private String systemSourceCode;
}
......@@ -127,4 +127,11 @@ public class AlertCalled extends BaseEntity {
@TableField(exist=false)
@ApiModelProperty(value = "警情状态str")
private String alertStatusStr;
@ApiModelProperty(value = "来源系统")
private String systemSource;
@ApiModelProperty(value = "系统来源code")
private String systemSourceCode;
}
......@@ -7,7 +7,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 警情接警填报记录
......@@ -150,7 +149,7 @@ public class AlertCalledDto extends BaseDto {
private String describe;
@ApiModelProperty(value = "图片")
private List<String> images;
private String images;
@ApiModelProperty(value = "设备id")
private Long equipmentId;
......
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 微信公众号维修反馈dto 类
*/
@Data
@ApiModel(value="DispatchSaveFeedbackDto", description="救援回访DTO")
public class WechatDispatchFeedbackDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "任务id")
private Long taskId;
@ApiModelProperty(value = "维修结果")
private String fixResult;
@ApiModelProperty(value = "电梯故障原因分类")
private String errorResult;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "现场照片")
private List<AttachmentDto> imgs;
}
......@@ -225,4 +225,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "设备id")
private Long equipmentId;
@TableField("images")
@ApiModelProperty(value = "图片")
private String images;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -31,4 +32,6 @@ public interface IDispatchTaskService {
Boolean saveFinish(Long taskId);
List<WechatMyTaskListDto> getTaskListByPhonePager(String phone,String typeCode,Long current);
WechatMyTaskDto saveWechatFeedBack(WechatDispatchFeedbackDto wechatDispatchFeedbackDto);
}
......@@ -36,7 +36,7 @@
<select id="getTaskInfoByTaskId" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto">
select
t.sequence_nbr
t.sequence_nbr,
t.alert_id as alertId,
p.sequence_nbr as paperId,
a.alert_stage as taskStatus,
......
......@@ -10,6 +10,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
......@@ -37,6 +38,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository;
* @version $Id: ESAlertCalledService.java, v 0.1 2021年6月19日 下午5:12:01 gwb Exp $
*/
@Service
@DependsOn("liquibase")
public class ESAlertCalledService {
@Autowired
......@@ -73,7 +75,7 @@ public class ESAlertCalledService {
if (ValidationUtil.isEmpty(time)) //默认为同步48小时
{
currentTime = currentTime - 48*60*60*1000;
}else
}else
{
currentTime = currentTime - time*60*60*1000;
}
......
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatDispatchFeedbackDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -84,4 +86,16 @@ public class DispatchTaskController extends BaseController {
List<DispatchTask> list = dispatchTaskServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
/**
* 微信公众号维修反馈接口
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveWechatFeed")
@ApiOperation(httpMethod = "POST", value = "微信公众号维修反馈接口", notes = "微信公众号维修反馈接口")
public ResponseModel<WechatMyTaskDto> saveWechatFeedBack(@RequestBody WechatDispatchFeedbackDto model) {
return ResponseHelper.buildResponse(dispatchTaskServiceImpl.saveWechatFeedBack(model));
}
}
......@@ -294,7 +294,7 @@ public class ElevatorController extends BaseController {
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getElevatorInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取电梯使用单位", notes = "获取电梯使用单位")
@ApiOperation(httpMethod = "GET", value = "根据电梯id或电梯救援识别码获取电梯信息", notes = "根据电梯id或电梯救援识别码获取电梯信息")
public ResponseModel<ElevatorInfoDto> getElevatorInfo(Long sequenceNbr,String rescueCode) {
if(StringUtils.isBlank(rescueCode) && sequenceNbr == null) {
......
......@@ -4,28 +4,27 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatAccessDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyTaskListDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.service.IDispatchTaskService;
import com.yeejoin.amos.boot.module.tzs.api.service.IWechatService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.SmsRecordModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -33,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -49,8 +49,8 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
......@@ -67,6 +67,8 @@ public class WechatController extends BaseController {
private final String token = "yeejoin_2021";
private final String WeUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=";
@Autowired
RedisUtils redisUtils;
......@@ -111,6 +113,41 @@ public class WechatController extends BaseController {
}
/**
* 获取微信签名
* @param timestamp
* @param noncestr
* @param url
* @return
*/
@TycloudOperation(ApiLevel = UserType.ANONYMOUS , needAuth = false)
@GetMapping(value = "/getSignature")
@ApiOperation(httpMethod = "GET", value = "获取微信签名", notes = "获取微信签名")
public String getSignature(@RequestParam String timestamp,@RequestParam String noncestr,@RequestParam String url) {
List<String> params = new ArrayList<String>();
try {
if(!redisUtils.hasKey(RedisKey.WECHAT_TOKEN)){
throw new BadRequest("token不存在或已失效");
}
String token = redisUtils.get(RedisKey.WECHAT_TOKEN).toString();
String result = HttpUtils.doGet(WeUrl+token+"&type=jsapi");
JSONObject jsonObject = JSONObject.parseObject(result);
String ticket = jsonObject.get("ticket").toString();
params.add("jsapi_ticket="+ticket);
params.add(noncestr);
params.add(timestamp);
params.add(url);
Collections.sort(params);
String tokenStr = StringUtils.join(params,"&");
tokenStr = DigestUtils.sha1Hex(tokenStr);
return tokenStr;
} catch (Exception e) {
throw new BadRequest(e.getMessage());
}
}
/**
* 获取微信推送的操作通知
* @param xml
* @param resp
......@@ -618,4 +655,29 @@ public class WechatController extends BaseController {
return ResponseHelper.buildResponse(dispatchTaskService.getTaskListByPhonePager(phone, taskType, currentPage));
}
/**
* 微信端图片上传
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/uploadImage")
@ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片")
public ResponseModel<String> uploadImage(@ApiParam(value = "图片", required = true)@RequestParam MultipartFile file
) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString="";
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
}
}
return ResponseHelper.buildResponse(urlString);
}
}
......@@ -1481,6 +1481,30 @@
</sql>
</changeSet>
<changeSet author="tw" id="2021-09-24-0001">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_called"/>
</preConditions>
<comment>警情来源系统</comment>
<sql>
ALTER TABLE `jc_alert_called` add system_source varchar(255) COMMENT '来源系统';
ALTER TABLE `jc_alert_called` add system_source_code varchar(255) COMMENT '系统来源code';
</sql>
</changeSet>
<changeSet author="tw" id="2021-09-24-0002">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>add data jc_alert_form</comment>
<sql>
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1242, '1242', '融合调度系统', 'SOURCE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1243, '1243', '消防物联系统', 'SOURCE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1244, '1244', '119接处警系统', 'SOURCE', NULL, NULL, NULL, NULL, NULL, b'0', 1);
</sql>
</changeSet>
</databaseChangeLog>
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