Commit 79e38e34 authored by 李成龙's avatar 李成龙

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

parents 3e0bac6f 7575c6d4
package com.yeejoin.amos.boot.biz.common.aop; package com.yeejoin.amos.boot.biz.common.aop;
import java.util.Arrays; import com.alibaba.fastjson.JSONObject;
import java.util.List; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import java.util.Map; import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import javax.servlet.http.HttpServletRequest; import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
...@@ -17,20 +24,14 @@ import org.springframework.core.annotation.Order; ...@@ -17,20 +24,14 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.auth.exception.AuthException;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import com.alibaba.fastjson.JSONObject; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import java.util.Arrays;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo; import java.util.List;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
/** /**
* controller层切面 用于用户数据缓存 供 sql自动填充使用 * controller层切面 用于用户数据缓存 供 sql自动填充使用
...@@ -56,52 +57,43 @@ public class ControllerAop { ...@@ -56,52 +57,43 @@ public class ControllerAop {
} }
@Before("userCache()") @Before("userCache()")
public void doBefore(JoinPoint joinPoint) throws Throwable { public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest(); HttpServletRequest request = attributes.getRequest();
String token = request.getHeader("token"); //TODO tyboot 框架拦截器已缓存数据
if (token == null) { String token = RequestContext.getToken();
token = request.getHeader("X-Access-Token"); // 不需要添加请求头的接口
} String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText"};
String authProduct = request.getHeader("product"); // 获取请求路径
if (authProduct == null) { if (Arrays.asList(url).contains(request.getRequestURI())) {
authProduct = request.getParameter("product"); return;
} }
String authAppKey = request.getHeader("appKey");
if (authAppKey == null) {
authAppKey = request.getParameter("appKey");
}
String authToken = buildKey(token);
if (token != null) { if (token != null) {
//验证token有效性,防止token失效 String pattern = RedisKey.buildPatternKey(token);
AgencyUserModel userModel; //验证token有效性,防止token失效
try { AgencyUserModel userModel;
FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme(); try {
userModel = agencyUserModel.getResult(); FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
if (userModel == null) { userModel = agencyUserModel.getResult();
throw new Exception("无法获取用户信息"); if (userModel == null) {
} throw new Exception("无法获取用户信息");
} catch (Exception e) {
//删除失效token缓存
redisUtils.del(authToken);
throw new RuntimeException(e.getMessage());
}
// 不需要添加请求头的接口
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText"};
// 获取请求路径
if (Arrays.asList(url).contains(request.getRequestURI())) {
// 暂无需要
} else {
if (!redisUtils.hasKey(authToken)) {
saveUserRedis(userModel, token);
} }
} } catch (Exception e) {
//删除失效token缓存
redisUtils.getAndDeletePatternKeys(pattern);
throw new RuntimeException(e.getMessage());
}
saveUserRedis(userModel, token);
} else {
throw new AuthException("请求未包含认证信息.");
} }
// buildRequestCxt(authToken,authProduct,authAppKey);
System.out.println(redisUtils.get(authToken));
} }
public void saveUserRedis(AgencyUserModel user, String token) { private void saveUserRedis(AgencyUserModel user, String token) {
String authToken = RedisKey.buildReginKey(user.getUserId(), token);
if (redisUtils.hasKey(authToken)) {
return;
}
CompanyBo company = new CompanyBo(); CompanyBo company = new CompanyBo();
DepartmentBo department = new DepartmentBo(); DepartmentBo department = new DepartmentBo();
RoleBo role = new RoleBo(); RoleBo role = new RoleBo();
...@@ -129,18 +121,12 @@ public class ControllerAop { ...@@ -129,18 +121,12 @@ public class ControllerAop {
reginParams.setRole(role); reginParams.setRole(role);
reginParams.setDepartment(department); reginParams.setDepartment(department);
reginParams.setUserModel(user); reginParams.setUserModel(user);
String authToken = buildKey(token);
redisUtils.set(authToken, JSONObject.toJSONString(reginParams), redisRegionTimeSecond); redisUtils.set(authToken, JSONObject.toJSONString(reginParams), redisRegionTimeSecond);
} }
public String buildKey(String token) {
//由于用户id 不是接口携带参数,为了避免,公共字段填充时频繁访问平台,缓存用户信息时,
//return "region_" + userId + "_" + token;
return "region_"+ token;
}
@AfterReturning(returning = "ret", pointcut = "userCache()") @AfterReturning(returning = "ret", pointcut = "userCache()")
public void doAfterReturning(Object ret) throws Throwable { public void doAfterReturning(Object ret) throws Throwable {
//统一redis管理 //统一redis管理
// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); // ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// HttpServletRequest request = attributes.getRequest(); // HttpServletRequest request = attributes.getRequest();
// String token = request.getHeader("token"); // String token = request.getHeader("token");
...@@ -148,9 +134,4 @@ public class ControllerAop { ...@@ -148,9 +134,4 @@ public class ControllerAop {
// GlobalCache.paramMap.remove(token); // GlobalCache.paramMap.remove(token);
// } // }
} }
// public void buildRequestCxt(String token,String product,String appKey){
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
//}
} }
package com.yeejoin.amos.boot.biz.common.controller; package com.yeejoin.amos.boot.biz.common.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
/** /**
* 基础控制器 * 基础控制器
* *
...@@ -24,112 +23,108 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -24,112 +23,108 @@ import springfox.documentation.annotations.ApiIgnore;
@RequestMapping("/base") @RequestMapping("/base")
public class BaseController { public class BaseController {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
protected HttpServletRequest request; protected HttpServletRequest request;
/** /**
* 获取token * 获取token
**/ **/
protected String getToken() { protected String getToken() {
return RequestContext.getToken(); return RequestContext.getToken();
} }
public String buildKey(String token) {
//由于用户id 不是接口携带参数,为了避免,公共字段填充时频繁访问平台,缓存用户信息时, /**
//return "region_" + userId + "_" + token; * 用户选择信心redis获取
return "region_"+ token; **/
protected ReginParams getSelectedOrgInfo() {
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
}
protected String getOrgCode(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getOrgCode();
}
return null;
}
/**
* 当前登录用户信息
*/
protected AgencyUserModel getUserInfo() {
ReginParams reginParams = getSelectedOrgInfo();
return reginParams.getUserModel();
}
protected String getProduct() {
return RequestContext.getProduct();
}
protected String getAppKey() {
return RequestContext.getAppKey();
}
protected String getUserId() {
String userId = null;
if (getUserInfo() != null) {
userId = getUserInfo().getUserId();
}
return userId;
}
protected String getRoleTypeName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getRole() != null) {
return reginParams.getRole().getRoleType();
}
return null;
}
protected String getDepartmentId(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getDepartment().getSequenceNbr() != null) {
return reginParams.getDepartment().getSequenceNbr().toString();
}
return null;
}
protected String getDepartmentName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getDepartment().getDepartmentName() != null) {
return reginParams.getDepartment().getDepartmentName();
}
return null;
}
protected String getCompanyId(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getSequenceNbr().toString();
}
return null;
}
protected String getCompanyName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getCompanyName();
}
return null;
} }
/**
* 用户选择信心redis获取
**/
protected ReginParams getSelectedOrgInfo() {
return JSONObject.parseObject(redisUtils.get(buildKey(RequestContext.getToken())).toString(), ReginParams.class);
}
protected String getOrgCode(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getOrgCode();
}
return null;
}
/**
* 当前登录用户信息
*/
protected AgencyUserModel getUserInfo() {
ReginParams reginParams = getSelectedOrgInfo();
return reginParams.getUserModel();
}
protected String getProduct() {
return RequestContext.getProduct();
}
protected String getAppKey() {
return RequestContext.getAppKey();
}
protected String getUserId() {
String userId = null;
if (getUserInfo() != null) {
userId = getUserInfo().getUserId();
}
return userId;
}
protected String getRoleTypeName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getRole() != null) {
return reginParams.getRole().getRoleType();
}
return null;
}
protected String getDepartmentId(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getDepartment().getSequenceNbr() != null) {
return reginParams.getDepartment().getSequenceNbr().toString();
}
return null;
}
protected String getDepartmentName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getDepartment().getDepartmentName() != null) {
return reginParams.getDepartment().getDepartmentName();
}
return null;
}
protected String getCompanyId(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getSequenceNbr().toString();
}
return null;
}
protected String getCompanyName(ReginParams reginParams) {
if (reginParams == null) {
return null;
}
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getCompanyName();
}
return null;
}
} }
...@@ -155,7 +155,7 @@ public class DateUtils { ...@@ -155,7 +155,7 @@ public class DateUtils {
* @throws ParseException * @throws ParseException
*/ */
public static String dateFormat(Date date, String pattern) throws ParseException { public static String dateFormat(Date date, String pattern) throws ParseException {
if (StringUtils.isNotEmpty(pattern)) { if (StringUtils.isEmpty(pattern)) {
pattern = DateUtils.DATE_PATTERN; pattern = DateUtils.DATE_PATTERN;
} }
SimpleDateFormat sdf = new SimpleDateFormat(pattern); SimpleDateFormat sdf = new SimpleDateFormat(pattern);
...@@ -203,7 +203,7 @@ public class DateUtils { ...@@ -203,7 +203,7 @@ public class DateUtils {
* @throws ParseException * @throws ParseException
*/ */
public static Date dateParse(String dateTimeString, String pattern) throws ParseException { public static Date dateParse(String dateTimeString, String pattern) throws ParseException {
if (StringUtils.isNotEmpty(pattern)) { if (StringUtils.isEmpty(pattern)) {
pattern = DateUtils.DATE_PATTERN; pattern = DateUtils.DATE_PATTERN;
} }
SimpleDateFormat sdf = new SimpleDateFormat(pattern); SimpleDateFormat sdf = new SimpleDateFormat(pattern);
......
...@@ -31,19 +31,31 @@ public class RedisKey { ...@@ -31,19 +31,31 @@ public class RedisKey {
/**联通CTI token */ /**联通CTI token */
public static final String CTI_TOKEN = "cti_token"; public static final String CTI_TOKEN = "cti_token";
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */ /** 驼峰转下划线(简单写法,效率低于 ) */
public static String humpToLine(String str) { public static String humpToLine(String str) {
return str.replaceAll("[A-Z]", "_$0").toLowerCase(); return str.replaceAll("[A-Z]", "_$0").toLowerCase();
} }
/** /**
* 创建redis key * 用户新缓存前缀
*
* @param token
* @return
*/ */
public static String buildKey(String token) { public static final String REGION_REDIS_PREFIX = "biz_";
return "region_" + token; /**
* 创建区域key
* @param token 权限
* @return String
*/
public static String buildReginKey(String userId, String token) {
return REGION_REDIS_PREFIX + userId + "_" + token;
}
/**
* 模糊重新区域key
* @param token 权限
* @return String
*/
public static String buildPatternKey(String token) {
return REGION_REDIS_PREFIX + "*" + "_" + token;
} }
/** /**
......
...@@ -442,4 +442,12 @@ public class RedisUtils { ...@@ -442,4 +442,12 @@ public class RedisUtils {
redisTemplate.opsForList().set(key, index, value); redisTemplate.opsForList().set(key, index, value);
return true; return true;
} }
public Long getAndDeletePatternKeys(String pattern) {
Set<String> keys = redisTemplate.keys(pattern);
if (!CollectionUtils.isEmpty(keys)) {
return redisTemplate.delete(keys);
}
return null;
}
} }
...@@ -22,90 +22,85 @@ import java.util.Map; ...@@ -22,90 +22,85 @@ import java.util.Map;
@Component @Component
public class MetaHandler implements MetaObjectHandler { public class MetaHandler implements MetaObjectHandler {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
protected String getToken() { protected String getToken() {
String authToken = RequestContext.getToken(); String authToken = RequestContext.getToken();
// if (authToken == null) { // if (authToken == null) {
// authToken = request.getHeader("X-Access-Token"); // authToken = request.getHeader("X-Access-Token");
// } // }
return authToken; return authToken;
} }
/**
* 新增数据拦截
*
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
autoFillUser(metaObject, metaObject.getOriginalObject());
}
private void autoFillUser(MetaObject metaObject, Object entity) {
//获取用户信息 以及当前用户登录公司部门,角色
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(RedisKey.buildKey(getToken())) ?
redisUtils.get(RedisKey.buildKey(getToken())).toString() : null, ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return;
}
AgencyUserModel agencyUserModel = reginParams.getUserModel();
if(ObjectUtils.isEmpty(reginParams) || ObjectUtils.isEmpty(agencyUserModel)){
return;
}
// Object entity = metaObject.getOriginalObject();
if (isExistField("recUserId", entity)) {
this.setFieldValByName("recUserId", agencyUserModel.getUserId(), metaObject);
}
if (isExistField("recUserName", entity)) { /**
this.setFieldValByName("recUserName", agencyUserModel.getUserName(), metaObject); * 新增数据拦截
} *
if (isExistField("recDate", entity)) { * @param metaObject
Date currentDate = new Date(); */
this.setFieldValByName("recDate", currentDate, metaObject); @Override
} public void insertFill(MetaObject metaObject) {
if (isExistField("allotmentTime", entity)) { autoFillUser(metaObject, metaObject.getOriginalObject());
Date currentDate = new Date(); }
this.setFieldValByName("recDate", currentDate, metaObject);
}
private void autoFillUser(MetaObject metaObject, Object entity) {
//获取用户信息 以及当前用户登录公司部门,角色
String userId = RequestContext.getExeUserId();
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(RedisKey.buildReginKey(userId, getToken())) ?
redisUtils.get(RedisKey.buildReginKey(userId, getToken())).toString() : null, ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) {
return;
}
AgencyUserModel agencyUserModel = reginParams.getUserModel();
if (ObjectUtils.isEmpty(reginParams) || ObjectUtils.isEmpty(agencyUserModel)) {
return;
}
if (isExistField("recUserId", entity)) {
this.setFieldValByName("recUserId", agencyUserModel.getUserId(), metaObject);
}
if (isExistField("recUserName", entity)) {
this.setFieldValByName("recUserName", agencyUserModel.getUserName(), metaObject);
}
if (isExistField("recDate", entity)) {
Date currentDate = new Date();
this.setFieldValByName("recDate", currentDate, metaObject);
}
if (isExistField("allotmentTime", entity)) {
Date currentDate = new Date();
this.setFieldValByName("recDate", currentDate, metaObject);
}
// if (isExistField("companyCode", entity)) { // if (isExistField("companyCode", entity)) {
// this.setFieldValByName("companyCode", reginParams.getDepartment().getOrgCode(), metaObject); // this.setFieldValByName("companyCode", reginParams.getDepartment().getOrgCode(), metaObject);
// } // }
// if (isExistField("companyName", entity)) { // if (isExistField("companyName", entity)) {
// this.setFieldValByName("companyName", reginParams.getDepartment().getDepartmentName(), metaObject); // this.setFieldValByName("companyName", reginParams.getDepartment().getDepartmentName(), metaObject);
// } // }
}
}
private Boolean isExistField(String field, Object obj) { private Boolean isExistField(String field, Object obj) {
if (obj == null || StringUtils.isEmpty(field)) { if (obj == null || StringUtils.isEmpty(field)) {
return null; return null;
} }
Object o = JSONObject.toJSON(obj); Object o = JSONObject.toJSON(obj);
JSONObject jsonObj = new JSONObject(); JSONObject jsonObj = new JSONObject();
if (o instanceof JSONObject) { if (o instanceof JSONObject) {
jsonObj = (JSONObject) o; jsonObj = (JSONObject) o;
} }
return jsonObj.containsKey(field); return jsonObj.containsKey(field);
} }
/** /**
* 更新拦截 * 更新拦截
* *
* @param metaObject * @param metaObject
*/ */
@Override @Override
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
Object updateEntity = ((Map)metaObject.getOriginalObject()).get("et"); Object updateEntity = ((Map) metaObject.getOriginalObject()).get("et");
autoFillUser(metaObject, updateEntity); autoFillUser(metaObject, updateEntity);
Date currentDate = new Date(); Date currentDate = new Date();
this.setFieldValByName("updateTime", currentDate, metaObject); this.setFieldValByName("updateTime", currentDate, metaObject);
} }
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.api.dto; package com.yeejoin.amos.boot.module.common.api.dto;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 消防员合同 * 消防员合同
* *
...@@ -62,4 +61,7 @@ public class FirefightersContractDto extends BaseDto { ...@@ -62,4 +61,7 @@ public class FirefightersContractDto extends BaseDto {
@ApiModelProperty(value = "附件") @ApiModelProperty(value = "附件")
private Map<String, List<AttachmentDto>> attachments; private Map<String, List<AttachmentDto>> attachments;
@ApiModelProperty(value = "合同类型字典code")
private String contractTypeCode;
} }
...@@ -83,10 +83,14 @@ public class FirefightersExcelDto extends BaseDto { ...@@ -83,10 +83,14 @@ public class FirefightersExcelDto extends BaseDto {
@ApiModelProperty(value = "婚姻状况") @ApiModelProperty(value = "婚姻状况")
private String maritalStatus; private String maritalStatus;
@ExcelProperty(value = "户籍所在地", index = 10) @ExcelIgnore
@ApiModelProperty(value = "籍贯/户口所在地") @ApiModelProperty(value = "籍贯/户口所在地")
private String nativePlace; private String nativePlace;
@ExcelProperty(value = "户籍所在地", index = 10)
@ApiModelProperty(value = "籍贯/户口所在地的值")
private String nativePlaceValue;
@ExplicitConstraint(indexNum = 11, sourceClass = RoleNameExplicitConstraint.class, method = "getPoliticalOutlook") //固定下拉内容 @ExplicitConstraint(indexNum = 11, sourceClass = RoleNameExplicitConstraint.class, method = "getPoliticalOutlook") //固定下拉内容
@ExcelProperty(value = "政治面貌", index = 11) @ExcelProperty(value = "政治面貌", index = 11)
@ApiModelProperty(value = "政治面貌代码") @ApiModelProperty(value = "政治面貌代码")
......
...@@ -46,5 +46,6 @@ public class OrgUsrzhDto { ...@@ -46,5 +46,6 @@ public class OrgUsrzhDto {
private String companyPhoto; private String companyPhoto;
@ApiModelProperty(value = "管理类别") @ApiModelProperty(value = "管理类别")
private String managementType; private String managementType;
@ApiModelProperty(value = "重点单位数量")
private Integer keySiteCount;
} }
...@@ -119,4 +119,7 @@ public class Firefighters extends BaseEntity { ...@@ -119,4 +119,7 @@ public class Firefighters extends BaseEntity {
@ApiModelProperty(value = "机构名称") @ApiModelProperty(value = "机构名称")
private String companyName; private String companyName;
@ApiModelProperty(value = "籍贯/户口所在地的值")
private String nativePlaceValue;
} }
...@@ -21,7 +21,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -21,7 +21,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
int selectPersonListCount(Map<String, Object> map); int selectPersonListCount(Map<String, Object> map);
List<Map<String, Object>> selectPersonList(Map<String, Object> map); List<Map<String, Object>> selectPersonList(@Param("map")Map<String, Object> map);
List<OrgUsr> selectCompanyDepartmentMsg(); List<OrgUsr> selectCompanyDepartmentMsg();
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code areasExpertiseCode from cb_firefighters a LEFT JOIN cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where a.is_delete=0 a.sequence_nbr=b.firefighters_id where a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}"</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name= #{par.name}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0 a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if> <if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}"</if> <if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name= #{par.name}</if> <if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if> <if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if> <if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if> <if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
...@@ -68,10 +68,12 @@ ...@@ -68,10 +68,12 @@
and a.sequence_nbr=#{id} and a.sequence_nbr=#{id}
</select> </select>
<!-- BUG3553 BY kongfm 人员关系显示汉字-->
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto"> <select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto">
select f.*, select f.*,
(select cb_fire_team.name from cb_fire_team where cb_fire_team.sequence_nbr=f.fire_team_id) fireTeam, (select cb_fire_team.name from cb_fire_team where cb_fire_team.sequence_nbr=f.fire_team_id) fireTeam,
emergency_contact, relationship, emergency_contact_phone emergency_contact, (select da.name from cb_data_dictionary da where da.code = fc.relationship) as relationship , emergency_contact_phone
from cb_firefighters f from cb_firefighters f
left join cb_firefighters_contacts fc on f.sequence_nbr = fc.firefighters_id left join cb_firefighters_contacts fc on f.sequence_nbr = fc.firefighters_id
where f.is_delete = #{isDelete} where f.is_delete = #{isDelete}
......
...@@ -60,33 +60,37 @@ ...@@ -60,33 +60,37 @@
u.sequence_nbr sequenceNbr, u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName, u.biz_org_name bizOrgName,
u.biz_org_code bizOrgCode, u.biz_org_code bizOrgCode,
<if test="fields != null"> <if test="map.fields != null">
<foreach collection="fields" item="item" separator=",">MAX(case f.field_code when #{item} then IFNULL(v.field_value_label, v.field_value) <foreach collection="map.fields" item="item" separator=",">MAX(case f.field_code when #{item} then IFNULL(v.field_value_label, v.field_value)
end) ${item} end) ${item}
</foreach> </foreach>
</if> </if>
FROM FROM
cb_org_usr u LEFT JOIN cb_org_usr u
LEFT JOIN
cb_dynamic_form_instance v on u.sequence_nbr = v.instance_id cb_dynamic_form_instance v on u.sequence_nbr = v.instance_id
LEFT JOIN cb_dynamic_form_column f ON f.sequence_nbr = v.form_column_id LEFT JOIN cb_dynamic_form_column f ON f.sequence_nbr = v.form_column_id
where where
u.biz_org_type = #{bizOrgType} u.biz_org_type = #{map.bizOrgType}
AND u.is_delete = 0 AND u.is_delete = 0
<if test="bizOrgName != null"> <if test="map.bizOrgName != null">
AND u.biz_org_name = #{bizOrgName} AND u.biz_org_name like concat('%',#{map.bizOrgName},'%')
</if> </if>
<if test="bizOrgCode != null and bizOrgCode != '-1'"> <if test="map.personNumber!= null">
AND u.biz_org_code like concat(#{bizOrgCode}, '%') AND v.field_value like concat('%',#{map.personNumber},'%')
</if>
<if test="map.bizOrgCode != null and map.bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{map.bizOrgCode}, '%')
</if> </if>
GROUP BY GROUP BY
u.sequence_nbr , u.sequence_nbr ,
u.biz_org_name , u.biz_org_name ,
u.biz_org_code u.biz_org_code
)a where a.sequenceNbr is not null )a where a.sequenceNbr is not null
<if test="fieldsValue != null"> <if test="map.fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item">AND a.${item} = #{fieldsValue[${item}]}</foreach> <foreach collection="map.fieldsValue.keys" item="item">AND a.${item} = #{map.fieldsValue[${item}]}</foreach>
</if> </if>
LIMIT #{pageNum}, #{pageSize} LIMIT #{map.pageNum}, #{map.pageSize}
</select> </select>
...@@ -250,6 +254,7 @@ ...@@ -250,6 +254,7 @@
a.biz_org_name bizOrgName, a.biz_org_name bizOrgName,
a.build_name buildName, a.build_name buildName,
a.build_id buildId, a.build_id buildId,
c.keySiteCount,
( SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id ) parentName, ( SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id ) parentName,
max( CASE b.field_code WHEN 'businessCategory' THEN b.field_value_label ELSE "" END ) AS 'businessCategory', max( CASE b.field_code WHEN 'businessCategory' THEN b.field_value_label ELSE "" END ) AS 'businessCategory',
max( CASE b.field_code WHEN 'companyFemaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyFemaleEmployees', max( CASE b.field_code WHEN 'companyFemaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyFemaleEmployees',
...@@ -262,44 +267,109 @@ ...@@ -262,44 +267,109 @@
FROM FROM
cb_org_usr a cb_org_usr a
LEFT JOIN cb_dynamic_form_instance b ON a.sequence_nbr = b.instance_id LEFT JOIN cb_dynamic_form_instance b ON a.sequence_nbr = b.instance_id
LEFT JOIN (select belong_id, count(*) keySiteCount from cb_key_site group by belong_id) c on c.belong_id = a.sequence_nbr
WHERE WHERE
a.biz_org_name = #{bizOrgName} a.biz_org_name = #{bizOrgName}
</select> </select>
<select id="getCompanyAndCountDepartment" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto"> <select id="getCompanyAndCountDepartment" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto">
SELECT SELECT
company_sur.sequence_nbr as sequenceNbr, result_main.sequenceNbr AS sequenceNbr,
company_sur.biz_org_name as bizOrgName , result_main.bizOrgName AS bizOrgName,
company_sur.parent_id as parentId, result_main.parentId AS parentId,
CASE result_main.num1 + result_main.num2 AS num
WHEN keysite_sur.num IS NULL THEN FROM
(
SELECT
CASE
WHEN result1.num IS NULL THEN
0
ELSE
result1.num
END AS num1,
CASE
WHEN result2.num IS NULL THEN
0 0
ELSE ELSE
keysite_sur.num result2.num
END AS num END AS num2,
result1.sequenceNbr,
result1.bizOrgName,
result1.parentId
FROM FROM
( (
SELECT SELECT
company.sequence_nbr, company_sur.sequence_nbr AS sequenceNbr,
company.parent_id, company_sur.biz_org_name AS bizOrgName,
company.biz_org_name company_sur.parent_id AS parentId,
CASE
WHEN keysite_sur.num IS NULL THEN
0
ELSE
keysite_sur.num
END AS num
FROM FROM
cb_org_usr company (
WHERE SELECT
company.biz_org_type = 'COMPANY' company.sequence_nbr,
AND company.is_delete = FALSE company.parent_id,
) company_sur company.biz_org_name
FROM
cb_org_usr company
WHERE
company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE
) company_sur
LEFT JOIN (
SELECT
keysite.belong_id,
COUNT(keysite.belong_id) AS num
FROM
cb_key_site keysite
WHERE
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
) result1
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
keysite.belong_id, company_sur.sequence_nbr AS sequenceNbr,
COUNT(keysite.belong_id) as num company_sur.biz_org_name AS bizOrgName,
FROM company_sur.parent_id AS parentId,
cb_key_site keysite CASE
WHERE WHEN keysite_sur.num IS NULL THEN
keysite.is_delete = FALSE 0
GROUP BY ELSE
keysite.belong_id keysite_sur.num
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id END AS num
FROM
(
SELECT
company.sequence_nbr,
company.parent_id,
company.biz_org_name
FROM
cb_org_usr company
WHERE
company.biz_org_type = 'COMPANY'
AND company.is_delete = FALSE
) company_sur
LEFT JOIN (
SELECT
keysite.belong_id,
COUNT(keysite.belong_id) AS num
FROM
cb_key_site keysite
WHERE
keysite.is_delete = FALSE
GROUP BY
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
) result2 ON result1.sequenceNbr = result2.parentId
) result_main
GROUP BY
result_main.sequenceNbr
</select> </select>
......
...@@ -64,5 +64,15 @@ public enum AlertStageEnums { ...@@ -64,5 +64,15 @@ public enum AlertStageEnums {
this.value = value; this.value = value;
} }
public static AlertStageEnums getEnum(String code)
{
for (AlertStageEnums stage : AlertStageEnums.values())
{
if (stage.getCode().equals(code))
{
return stage;
}
}
return null;
}
} }
...@@ -41,5 +41,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -41,5 +41,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
String alertTypeCode , String alertTypeCode ,
String alertSourceCode, String alertSourceCode,
String startTime, String startTime,
String endTime); String endTime,
String data,
String lift);
} }
...@@ -19,5 +19,20 @@ public interface IAircraftService { ...@@ -19,5 +19,20 @@ public interface IAircraftService {
Aircraft queryByaircraftModel(String seq); Aircraft queryByaircraftModel(String seq);
List<AircraftListTreeDto> getAircraft(); List<AircraftListTreeDto> getAircraft();
/**
* 根据警情id查询航班信息
*
* @param alertId
* @return
*/
Map<String, Object> queryAircraftInfo(Long alertId);
/**
* 根据航空器型号查询航空器信息
*
* @param aircraftModel
* @return
*/
Aircraft queryAircraftInfoByModel(String aircraftModel);
} }
package com.yeejoin.amos.boot.module.jcs.api.service; package com.yeejoin.amos.boot.module.jcs.api.service;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledTodyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto; import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel; import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData; import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -55,4 +55,20 @@ public interface IAlertCalledService { ...@@ -55,4 +55,20 @@ public interface IAlertCalledService {
Integer AlertCalledcountTime(int type); Integer AlertCalledcountTime(int type);
List<AlertCalledTodyDto> getTodayAlertCalled(); List<AlertCalledTodyDto> getTodayAlertCalled();
/**
* app-根据警情id获取处置对象
*
* @param alertId
* @return
*/
List<JSONObject> queryDisposalObjectList(String alertId);
/**
* app-根据警情id查询警情详情
*
* @param id
* @return
*/
Map<String, Object> queryAlertCalledById(Long id);
} }
...@@ -126,8 +126,16 @@ ...@@ -126,8 +126,16 @@
<if test="alertSourceCode!= null "> <if test="alertSourceCode!= null ">
and alert_source_code = #{alertSourceCode} and alert_source_code = #{alertSourceCode}
</if> </if>
<if test="data != null and lift == 'ascend'">
order by #{data} ASC limit #{current},#{size}
</if>
<if test="data != null and lift == 'descend'">
order by #{data} DESC limit #{current},#{size}
</if>
<if test="data == null ">
order by call_time DESC limit #{current},#{size}
</if>
</where> </where>
order by call_time DESC limit #{current},#{size}
</select> </select>
......
...@@ -499,7 +499,7 @@ public class Check extends BasicEntity { ...@@ -499,7 +499,7 @@ public class Check extends BasicEntity {
this.errorClassify = errorClassify; this.errorClassify = errorClassify;
} }
@OneToMany(mappedBy = "check", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}) @Transient
public List<CheckShot> getCheckShot() { public List<CheckShot> getCheckShot() {
return checkShot; return checkShot;
} }
......
package com.yeejoin.amos.maintenance.dao.entity; package com.yeejoin.amos.maintenance.dao.entity;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/** /**
* The persistent class for the p_check_shot database table. * The persistent class for the p_check_shot database table.
*
*/ */
@Entity @Entity
@Table(name="p_check_shot") @Table(name = "p_check_shot")
@NamedQuery(name="CheckShot.findAll", query="SELECT c FROM CheckShot c") @NamedQuery(name = "CheckShot.findAll", query = "SELECT c FROM CheckShot c")
public class CheckShot extends BasicEntity { public class CheckShot extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 巡检记录id * 巡检记录id
*/ */
@Column(name="check_id") @Column(name = "check_id")
private long checkId; private long checkId;
/** /**
* 权限系统org code * 权限系统org code
*/ */
@Column(name="org_code") @Column(name = "org_code")
private String orgCode; private String orgCode;
/** /**
* 照片内容 * 照片内容
*/ */
@Lob @Lob
@Column(name="photo_data") @Column(name = "photo_data")
private String photoData; private String photoData;
/** /**
* 拍照点名称 * 拍照点名称
*/ */
@Column(name="point_name") @Column(name = "point_name")
private String pointName; private String pointName;
/** /**
* 拍照类型:1-检查项照片;2-不合格照片 * 拍照类型:1-检查项照片;2-不合格照片
* 点现场照片) * 点现场照片)
*/ */
@Column(name="shot_type") @Column(name = "shot_type")
private String shotType; private String shotType;
/** /**
* 检查项id * 检查项id
*/ */
@Column(name="check_input_id") @Column(name = "check_input_id")
private long checkInputId; private long checkInputId;
/** /**
* 照片配置key(关联照片和拍照设置),来源picture_json * 照片配置key(关联照片和拍照设置),来源picture_json
*/ */
private String photoConfKey; private String photoConfKey;
/** /**
* 扩展分类id * 扩展分类id
*/ */
@Column(name="classify_id") @Column(name = "classify_id")
private long classifyId; private long classifyId;
public long getClassifyId() { public long getClassifyId() {
return classifyId; return classifyId;
} }
public void setClassifyId(long classifyId) { public void setClassifyId(long classifyId) {
this.classifyId = classifyId; this.classifyId = classifyId;
} }
public long getCheckInputId() { public long getCheckInputId() {
return checkInputId; return checkInputId;
} }
public void setCheckInputId(long checkInputId) { public void setCheckInputId(long checkInputId) {
this.checkInputId = checkInputId; this.checkInputId = checkInputId;
} }
public CheckShot() { public CheckShot() {
} }
private Check check; public long getCheckId() {
return this.checkId;
public long getCheckId() { }
return this.checkId;
} public void setCheckId(long checkId) {
this.checkId = checkId;
public void setCheckId(long checkId) { }
this.checkId = checkId;
} public String getOrgCode() {
return this.orgCode;
public String getOrgCode() { }
return this.orgCode;
} public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
public void setOrgCode(String orgCode) { }
this.orgCode = orgCode;
} public String getPhotoData() {
return this.photoData;
public String getPhotoData() { }
return this.photoData;
} public void setPhotoData(String photoData) {
this.photoData = photoData;
public void setPhotoData(String photoData) { }
this.photoData = photoData;
} public String getPhotoConfKey() {
return photoConfKey;
public String getPhotoConfKey() { }
return photoConfKey;
} public void setPhotoConfKey(String photoConfKey) {
this.photoConfKey = photoConfKey;
public void setPhotoConfKey(String photoConfKey) { }
this.photoConfKey = photoConfKey;
} public String getPointName() {
return this.pointName;
public String getPointName() { }
return this.pointName;
} public void setPointName(String pointName) {
this.pointName = pointName;
public void setPointName(String pointName) { }
this.pointName = pointName;
} public String getShotType() {
return this.shotType;
public String getShotType() { }
return this.shotType;
} public void setShotType(String shotType) {
this.shotType = shotType;
public void setShotType(String shotType) { }
this.shotType = shotType;
}
@ManyToOne
@JoinColumn(name = "checkId", referencedColumnName = "id", updatable = false, insertable = false)
public Check getCheck() {
return check;
}
public void setCheck(Check check) {
this.check = check;
}
} }
\ No newline at end of file
...@@ -781,35 +781,32 @@ public class CommandController extends BaseController { ...@@ -781,35 +781,32 @@ public class CommandController extends BaseController {
@GetMapping(value = "/getOrgUsrzhDto/{id}") @GetMapping(value = "/getOrgUsrzhDto/{id}")
@ApiOperation(httpMethod = "GET", value = "根据灾情id处置对象单位详情", notes = "根据灾情id处置对象单位详情") @ApiOperation(httpMethod = "GET", value = "根据灾情id处置对象单位详情", notes = "根据灾情id处置对象单位详情")
public ResponseModel<OrgusrDataxDto> getOrgUsrzhDto(@PathVariable Long id) { public ResponseModel<OrgusrDataxDto> getOrgUsrzhDto(@PathVariable Long id) {
AlertCalled AlertCalled=iAlertCalledService.getAlertCalledById(id); AlertCalled AlertCalled = iAlertCalledService.getAlertCalledById(id);
String buildId=null; String buildId = null;
OrgusrDataxDto orgusrDataxDto=new OrgusrDataxDto(); OrgusrDataxDto orgusrDataxDto = new OrgusrDataxDto();
if(AlertCalled.getUnitInvolved()!=null&&!"".equals(AlertCalled.getUnitInvolved())) { if (AlertCalled.getUnitInvolved() != null && !"".equals(AlertCalled.getUnitInvolved())) {
List<OrgUsrzhDto> orgUsrzhDto= iOrgUsrService.getOrgUsrzhDto( AlertCalled.getUnitInvolved()); List<OrgUsrzhDto> orgUsrzhDto = iOrgUsrService.getOrgUsrzhDto(AlertCalled.getUnitInvolved());
orgusrDataxDto.setOrgUsrzhDto(orgUsrzhDto!=null&&orgUsrzhDto.size()>0?orgUsrzhDto.get(0):null); orgusrDataxDto.setOrgUsrzhDto(orgUsrzhDto != null && orgUsrzhDto.size() > 0 ? orgUsrzhDto.get(0) : null);
// buildId=orgUsrzhDto!=null&&orgUsrzhDto.size()>0?orgUsrzhDto.get(0).getBuildId():null; if (orgUsrzhDto != null && orgUsrzhDto.size() > 0 && orgUsrzhDto.get(0) != null) {
if(orgUsrzhDto!=null&&orgUsrzhDto.size()>0&&orgUsrzhDto.get(0)!=null){ buildId = orgUsrzhDto.get(0).getBuildId();
buildId=orgUsrzhDto.get(0).getBuildId()==null?null:orgUsrzhDto.get(0).getBuildId();
} }
} }
//现场照片 待完成, //现场照片 待完成,
//平面图。待完成orgUsrzhDto.getBuildId() //平面图。待完成orgUsrzhDto.getBuildId()
if(buildId!=null) { if (buildId != null) {
List<Map<String,Object>> list= equipFeignClient.findImgByFileCategory(buildId,"fourImg").getResult(); List<Map<String, Object>> list = equipFeignClient.findImgByFileCategory(buildId, "fourImg").getResult();
List<String> url=new ArrayList<>(); List<String> url = new ArrayList<>();
if(list!=null&&list.size()>0) { if (list != null && list.size() > 0) {
list.stream().forEach(map->{ list.stream().forEach(map -> {
url.add(map.get("filePath").toString()); url.add(map.get("filePath").toString());
}); });
} }
orgusrDataxDto.setPlanePicture(url); orgusrDataxDto.setPlanePicture(url);
} }
return ResponseHelper.buildResponse(orgusrDataxDto); return ResponseHelper.buildResponse(orgusrDataxDto);
} }
...@@ -999,7 +996,7 @@ public class CommandController extends BaseController { ...@@ -999,7 +996,7 @@ public class CommandController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "app-更新车辆状态", notes = "app-更新车辆状态") @ApiOperation(httpMethod = "PUT", value = "app-更新车辆状态", notes = "app-更新车辆状态")
@PutMapping(value = "/app/carStatus") @PutMapping(value = "/app/carStatus")
public ResponseModel<Boolean> updateCarStatus(CarStatusInfoDto carStatusInfoDto) { public ResponseModel<Boolean> updateCarStatus(@RequestParam CarStatusInfoDto carStatusInfoDto) {
try { try {
equipFeignClient.updateCarStatus(Lists.newArrayList(carStatusInfoDto)); equipFeignClient.updateCarStatus(Lists.newArrayList(carStatusInfoDto));
} catch (Exception e) { } catch (Exception e) {
...@@ -1008,4 +1005,27 @@ public class CommandController extends BaseController { ...@@ -1008,4 +1005,27 @@ public class CommandController extends BaseController {
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "app-警情详情-处置对象", notes = "app-警情详情-处置对象")
@GetMapping(value = "/app/disposalObject")
public ResponseModel<List<JSONObject>> queryDisposalObject(@RequestParam String alertId) {
List<JSONObject> resultList;
try {
resultList = iAlertCalledService.queryDisposalObjectList(alertId);
} catch (Exception e) {
throw new BaseException("获取处置对象异常", "", e.getMessage());
}
return ResponseHelper.buildResponse(resultList);
}
/**
* app-根据id查询警情详情
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "alertCalled/{id}")
@ApiOperation(httpMethod = "GET", value = "app-根据id查询灾情详情", notes = "app-根据id查询灾情详情")
public ResponseModel<Object> selectByAlertCalledId(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.queryAlertCalledById(id));
}
} }
\ No newline at end of file
...@@ -163,7 +163,13 @@ public class FirefightersContractController extends BaseController { ...@@ -163,7 +163,13 @@ public class FirefightersContractController extends BaseController {
firefightersContractQueryWrapper.eq(name, fileValue); firefightersContractQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) { } else if (type.equals(String.class)) {
String fileValue = (String) field.get(firefightersContract); String fileValue = (String) field.get(firefightersContract);
firefightersContractQueryWrapper.eq(name, fileValue); /* BUG 2193 合同名称模糊匹配 start*/
if ("NAME".equals(name)) {
firefightersContractQueryWrapper.like(name, fileValue);
} else {
firefightersContractQueryWrapper.eq(name, fileValue);
}
/* BUG 2193 合同名称模糊匹配 end*/
}else if (type.equals(Date.class)) { }else if (type.equals(Date.class)) {
Date fileValue = (Date) field.get(firefightersContract); Date fileValue = (Date) field.get(firefightersContract);
firefightersContractQueryWrapper.eq(name, fileValue); firefightersContractQueryWrapper.eq(name, fileValue);
......
...@@ -66,6 +66,7 @@ public class FirefightersPostController extends BaseController { ...@@ -66,6 +66,7 @@ public class FirefightersPostController extends BaseController {
* *
* @return * @return
*/ */
@SuppressWarnings("unchecked")
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/save", method = RequestMethod.POST) @RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增岗位信息", notes = "新增岗位信息") @ApiOperation(httpMethod = "POST", value = "新增岗位信息", notes = "新增岗位信息")
...@@ -73,8 +74,11 @@ public class FirefightersPostController extends BaseController { ...@@ -73,8 +74,11 @@ public class FirefightersPostController extends BaseController {
public ResponseModel<Object> saveFirefightersPost(@RequestBody FirefightersDataDto firefightersDataDto) { public ResponseModel<Object> saveFirefightersPost(@RequestBody FirefightersDataDto firefightersDataDto) {
try { try {
/*---------修改bug:2179 解決崗位与学历可以重复添加导致的列表页展示消防人员信息呈现多条的情况 on 2021-08-21 陈浩---start*/ /*---------修改bug:2179 解決崗位与学历可以重复添加导致的列表页展示消防人员信息呈现多条的情况 on 2021-08-21 陈浩---start*/
LambdaQueryWrapper<FirefightersPost> queryWrapper = new LambdaQueryWrapper<FirefightersPost>(); //LambdaQueryWrapper<FirefightersPost> queryWrapper = new LambdaQueryWrapper<FirefightersPost>();
queryWrapper.eq(FirefightersPost::getFirefightersId, firefightersDataDto.getFirefightersPost().getFirefightersId()); //.eq(FirefightersPost::getFirefightersId, firefightersDataDto.getFirefightersPost().getFirefightersId());
@SuppressWarnings("rawtypes")
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("firefighters_id", firefightersDataDto.getFirefightersPost().getFirefightersId());
FirefightersPost firefightersPost = iFirefightersPostService.getOne(queryWrapper); FirefightersPost firefightersPost = iFirefightersPostService.getOne(queryWrapper);
if (firefightersPost == null) { if (firefightersPost == null) {
...@@ -82,10 +86,21 @@ public class FirefightersPostController extends BaseController { ...@@ -82,10 +86,21 @@ public class FirefightersPostController extends BaseController {
} else { } else {
iFirefightersPostService.update(firefightersDataDto.getFirefightersPost(), queryWrapper); iFirefightersPostService.update(firefightersDataDto.getFirefightersPost(), queryWrapper);
} }
// iFirefightersPostService.save(firefightersDataDto.getFirefightersPost());
FirefightersEducation firefightersEducation= ifirefightersEducationService.getOne(queryWrapper);
if(firefightersEducation==null) {
ifirefightersEducationService.save(firefightersDataDto.getFirefightersEducation());
}else {
ifirefightersEducationService.update(firefightersDataDto.getFirefightersEducation(),queryWrapper);
}
FirefightersWorkexperience firefightersWorkexperience = ifirefightersWorkexperienceService.getOne(queryWrapper);
if(firefightersWorkexperience==null) {
ifirefightersWorkexperienceService.save(firefightersDataDto.getFirefightersWorkexperience());
}else {
ifirefightersWorkexperienceService.update(firefightersDataDto.getFirefightersWorkexperience(),queryWrapper);
}
/*---------修改bug:2179 解決崗位与学历可以重复添加导致的列表页展示消防人员信息呈现多条的情况 on 2021-08-21 陈浩---end*/ /*---------修改bug:2179 解決崗位与学历可以重复添加导致的列表页展示消防人员信息呈现多条的情况 on 2021-08-21 陈浩---end*/
ifirefightersWorkexperienceService.save(firefightersDataDto.getFirefightersWorkexperience());
ifirefightersEducationService.save(firefightersDataDto.getFirefightersEducation());
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; ...@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
...@@ -163,7 +164,7 @@ public class FirefightersThoughtController extends BaseController { ...@@ -163,7 +164,7 @@ public class FirefightersThoughtController extends BaseController {
} }
}else if (type.equals(Date.class)) { }else if (type.equals(Date.class)) {
Date fileValue = (Date) field.get(firefightersThought); Date fileValue = (Date) field.get(firefightersThought);
firefightersThoughtQueryWrapper.eq(name, fileValue); firefightersThoughtQueryWrapper.likeRight(name,DateUtils.dateFormat(fileValue,null));
} else { } else {
if(!name.equals(NameUtils.camel2Underline("serialVersionUID"))) { if(!name.equals(NameUtils.camel2Underline("serialVersionUID"))) {
String fileValue = (String) field.get(firefightersThought); String fileValue = (String) field.get(firefightersThought);
......
...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -91,7 +92,15 @@ public class KeySiteController extends BaseController { ...@@ -91,7 +92,15 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "delete") @DeleteMapping(value = "delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "ids") String ids){
List<Long> sequenceNbrList = new ArrayList<>();
/* BUG 2670 litw start*/
String [] idsArr = ids.split(",") ;
for (String str:idsArr
) {
sequenceNbrList.add(Long.valueOf(str));
}
/* BUG 2670 end*/
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList)); return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
} }
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract; import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract;
...@@ -21,6 +11,17 @@ import com.yeejoin.amos.boot.module.common.api.entity.SourceFile; ...@@ -21,6 +11,17 @@ import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersContractMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersContractMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService; import com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 消防员合同 服务实现类 * 消防员合同 服务实现类
...@@ -36,12 +37,22 @@ public class FirefightersContractServiceImpl extends BaseService<FirefightersCon ...@@ -36,12 +37,22 @@ public class FirefightersContractServiceImpl extends BaseService<FirefightersCon
SourceFileServiceImpl sourceFileService; SourceFileServiceImpl sourceFileService;
@Autowired @Autowired
private Sequence sequence; private Sequence sequence;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public FirefightersContractDto save(FirefightersContractDto firefightersContract) { public FirefightersContractDto save(FirefightersContractDto firefightersContract) {
long sequenceId = sequence.nextId(); long sequenceId = sequence.nextId();
FirefightersContract detail=new FirefightersContract(); FirefightersContract detail=new FirefightersContract();
/* BUG 2193 LITW start*/
DataDictionary dataDictionary = iDataDictionaryService.getById(firefightersContract.getContractTypeCode());
if(null !=dataDictionary ) {
detail.setContractType(dataDictionary.getName());
}
/* BUG 2193 LITW end*/
Bean.copyExistPropertis(firefightersContract, detail); Bean.copyExistPropertis(firefightersContract, detail);
firefightersContract.setSequenceNbr(sequenceId); firefightersContract.setSequenceNbr(sequenceId);
detail.setSequenceNbr(sequenceId); detail.setSequenceNbr(sequenceId);
......
...@@ -8,6 +8,9 @@ import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto; ...@@ -8,6 +8,9 @@ import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto; import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts; import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.annotation.Condition; import org.typroject.tyboot.core.rdbms.annotation.Condition;
...@@ -61,6 +64,11 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi ...@@ -61,6 +64,11 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
@Override @Override
public void saveFirefighters(FirefightersInfoDto firefighters) { public void saveFirefighters(FirefightersInfoDto firefighters) {
Firefighters firefighter = firefighters.getFirefighters(); Firefighters firefighter = firefighters.getFirefighters();
// 现居住地保存地址信息 户籍所在地信息 BUG3553 bykongfm
FeignClientResult<RegionModel> region = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getResidenceDetails()));
firefighter.setResidence(region.getResult().getRegionName());
FeignClientResult<RegionModel> nativePlace = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getResidenceDetails()));
firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName());
save(firefighter); save(firefighter);
FirefightersContacts firefightersContact = firefighters.getFirefightersContacts(); FirefightersContacts firefightersContact = firefighters.getFirefightersContacts();
firefightersContact.setFirefightersId(firefighter.getSequenceNbr()); firefightersContact.setFirefightersId(firefighter.getSequenceNbr());
......
...@@ -328,16 +328,23 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -328,16 +328,23 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
/*Bug2652 根据名字和工号模糊查询失效 已添加模糊匹配 2021-09-01 陈召 开始*/
map.put("bizOrgType", OrgPersonEnum.人员.getKey()); map.put("bizOrgType", OrgPersonEnum.人员.getKey());
if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) { if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) {
map.put("bizOrgName", req.get("bizOrgName")); map.put("bizOrgName", req.get("bizOrgName"));
} }
if (!ObjectUtils.isEmpty(req.get("personNumber"))) {
map.put("personNumber", req.get("personNumber"));
}
OrgUsr parent = this.getById(Long.valueOf(req.get("parentId").toString())); OrgUsr parent = this.getById(Long.valueOf(req.get("parentId").toString()));
map.put("bizOrgCode", ObjectUtils.isEmpty(parent) ? null : parent.getBizOrgCode()); map.put("bizOrgCode", ObjectUtils.isEmpty(parent) ? null : parent.getBizOrgCode());
req.remove("bizOrgName"); req.remove("bizOrgName");
req.remove("pageSize"); req.remove("pageSize");
req.remove("pageNum"); req.remove("pageNum");
req.remove("parentId"); req.remove("parentId");
map.put("fieldsValue", req); map.put("fieldsValue", req);
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode())); map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
pageBean.setTotal(this.baseMapper.selectPersonListCount(map)); pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
...@@ -346,6 +353,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -346,6 +353,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<Map<String, Object>> list = this.baseMapper.selectPersonList(map); List<Map<String, Object>> list = this.baseMapper.selectPersonList(map);
/*Bug2652 根据名字和工号模糊查询失效 已添加模糊匹配 2021-09-01 陈召 结束*/
pageBean.setRecords(list); pageBean.setRecords(list);
return pageBean; return pageBean;
} }
......
...@@ -5,6 +5,7 @@ import java.util.Map; ...@@ -5,6 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -80,7 +81,7 @@ public class LoginController { ...@@ -80,7 +81,7 @@ public class LoginController {
.getRequestAttributes()).getRequest(); .getRequestAttributes()).getRequest();
String token = (String) request.getHeader("token"); String token = (String) request.getHeader("token");
ReginParams reginParams; ReginParams reginParams;
reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userId, token)), ReginParams.class); reginParams = JSON.parseObject(redisTemplate.opsForValue().get(RedisKey.buildReginKey(userId, token)), ReginParams.class);
if(reginParams == null){ if(reginParams == null){
reginParams = new ReginParams(); reginParams = new ReginParams();
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel(); IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
...@@ -109,8 +110,8 @@ public class LoginController { ...@@ -109,8 +110,8 @@ public class LoginController {
} }
reginParams.setToken(amosToken); reginParams.setToken(amosToken);
reginParams.setUserModel(userModel); reginParams.setUserModel(userModel);
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(reginParams)); redisTemplate.opsForValue().set(RedisKey.buildReginKey(userId, token), JSONObject.toJSONString(reginParams));
redisTemplate.opsForValue().set(buildKey(userId, amosToken), JSONObject.toJSONString(reginParams)); redisTemplate.opsForValue().set(RedisKey.buildReginKey(userId, amosToken), JSONObject.toJSONString(reginParams));
} }
return reginParams; return reginParams;
} }
...@@ -159,9 +160,4 @@ public class LoginController { ...@@ -159,9 +160,4 @@ public class LoginController {
} }
return roleBo; return roleBo;
} }
private String buildKey(String userId, String token) {
return "region_" + userId + "_" + token;
}
} }
...@@ -210,6 +210,10 @@ public class AircraftController extends BaseController { ...@@ -210,6 +210,10 @@ public class AircraftController extends BaseController {
map1.put("aircraftModel", map.get("aircraftType")); map1.put("aircraftModel", map.get("aircraftType"));
map1.put("dynamicFlightId", map.get("dynamicFlightId")); map1.put("dynamicFlightId", map.get("dynamicFlightId"));
map1.put("landingTime", map.get("sta")); map1.put("landingTime", map.get("sta"));
/* 任务 3488 根据航班号查询航班信息回填 增加跑道,机位字段 start*/
map1.put("runway", map.get("runway"));
map1.put("stand", map.get("stand"));
/* 任务 3488 根据航班号查询航班信息回填 end*/
// map1.put("fuelQuantity", map.get("")); // map1.put("fuelQuantity", map.get(""));
map1.put("passengerCapacity", map.get("psgNumTotal")); map1.put("passengerCapacity", map.get("psgNumTotal"));
} }
...@@ -224,27 +228,7 @@ public class AircraftController extends BaseController { ...@@ -224,27 +228,7 @@ public class AircraftController extends BaseController {
@GetMapping(value = "/getAircraftDetailsByAlertId/{id}") @GetMapping(value = "/getAircraftDetailsByAlertId/{id}")
@ApiOperation(httpMethod = "GET", value = "根据灾情id 查询最新的航班信息", notes = "根据灾情id 查询最新的航班信息") @ApiOperation(httpMethod = "GET", value = "根据灾情id 查询最新的航班信息", notes = "根据灾情id 查询最新的航班信息")
public ResponseModel<Map<String, Object>> getAircraftDetailsByAlertId(@PathVariable Long id) { public ResponseModel<Map<String, Object>> getAircraftDetailsByAlertId(@PathVariable Long id) {
return ResponseHelper.buildResponse(aircraftServiceImpl.queryAircraftInfo(id));
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
String num = null;
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
if ("flightNumber".equals(alertFormValue.getFieldCode())) {
num = alertFormValue.getFieldValue();
}
}
}
Map<String, Object> map = new HashedMap();
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.findImgByDynamicFlightId(num);
if (dataModel != null) {
map = dataModel.getResult();
}
return ResponseHelper.buildResponse(map);
} }
/** /**
......
...@@ -141,29 +141,30 @@ public class AlertCalledController extends BaseController { ...@@ -141,29 +141,30 @@ public class AlertCalledController extends BaseController {
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel<IPage<AlertCalled>> listPage(String pageNum, String pageSize, String sort, AlertCalled alertCalled, Integer alertStatus, public ResponseModel<IPage<AlertCalled>> listPage(String pageNum, String pageSize, String sort, AlertCalled alertCalled, Integer alertStatus,
String alertTypeCode , String alertTypeCode,
String alertSourceCode, String alertSourceCode,
String startTime, String startTime,
String endTime){ String endTime){
Page<AlertCalled> pageBean; Page<AlertCalled> pageBean;
/* IPage<AlertCalled> page; IPage<AlertCalled> page;
String sort, AlertCalled alertCalled,
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>(); QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
/* page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return ResponseHelper.buildResponse(page);*/
setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort); setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort);
*/
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 开始*/
/* bug2408 筛选参数解析异常 修改筛选条件方法 修改入参分离筛选条件 /* bug2408 筛选参数解析异常 修改筛选条件方法 修改入参分离筛选条件
alertStatus 警情状态 alertTypeCode 报警类型code alertSourceCode 警情来源code alertStatus 警情状态 alertTypeCode 报警类型code alertSourceCode 警情来源code
陈召 2021-08-21 开始*/ 陈召 2021-08-21 开始*/
IPage<AlertCalled> alertCalledIPage = iAlertCalledService.queryForCalledList(pageBean, alertStatus, alertTypeCode, alertSourceCode, startTime, endTime); IPage<AlertCalled> alertCalledIPage = iAlertCalledService.queryForCalledList(pageBean, alertStatus, alertTypeCode, alertSourceCode, startTime, endTime,sort);
/* bug2408 筛选参数解析异常 修改筛选条件方法 陈召 2021-08-21 结束*/
return ResponseHelper.buildResponse(alertCalledIPage); return ResponseHelper.buildResponse(alertCalledIPage);
/* bug2408 筛选参数解析异常 修改筛选条件方法 陈召 2021-08-21 结束*/
/* bug2407 表头筛选失效 补充条件方法 XML中添加了排序条件判断 data代表排序条件 lift 升降序 陈召 2021-09-03 结束*/
} }
/** /**
......
...@@ -6,6 +6,9 @@ import java.util.Map; ...@@ -6,6 +6,9 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -156,6 +159,10 @@ public class FirefightersController extends BaseController { ...@@ -156,6 +159,10 @@ public class FirefightersController extends BaseController {
@RequestBody FirefightersInfoDto firefighters) { @RequestBody FirefightersInfoDto firefighters) {
try { try {
Firefighters firefighter = firefighters.getFirefighters(); Firefighters firefighter = firefighters.getFirefighters();
FeignClientResult<RegionModel> region = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getResidenceDetails()));
firefighter.setResidence(region.getResult().getRegionName());
FeignClientResult<RegionModel> nativePlace = Systemctl.regionClient.getRegion(Long.parseLong(firefighter.getResidenceDetails()));
firefighter.setNativePlaceValue(nativePlace.getResult().getRegionName());
iFirefightersService.updateById(firefighter); iFirefightersService.updateById(firefighter);
ifirefightersContactsService.updateById(firefighters.getFirefightersContacts()); ifirefightersContactsService.updateById(firefighters.getFirefightersContacts());
// 删除缓存 // 删除缓存
......
...@@ -6,6 +6,9 @@ import java.util.List; ...@@ -6,6 +6,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -31,6 +34,7 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService; ...@@ -31,6 +34,7 @@ import com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel; import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/** /**
...@@ -45,6 +49,13 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc ...@@ -45,6 +49,13 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Autowired @Autowired
AircraftMapper aircraftMapper; AircraftMapper aircraftMapper;
@Autowired
IotFeignClient iotFeignClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
/** /**
* <pre> * <pre>
* 保存 * 保存
...@@ -265,4 +276,34 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc ...@@ -265,4 +276,34 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
return aircraftMapper.getAircraft(); return aircraftMapper.getAircraft();
} }
@Override
public Map<String, Object> queryAircraftInfo(Long alertId) {
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", alertId);
// 警情动态表单数据
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
String num = null;
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
if ("flightNumber".equals(alertFormValue.getFieldCode())) {
num = alertFormValue.getFieldValue();
break;
}
}
}
Map<String, Object> map = new HashedMap();
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.findImgByDynamicFlightId(num);
if (dataModel != null) {
map = dataModel.getResult();
}
return map;
}
@Override
public Aircraft queryAircraftInfoByModel(String aircraftModel) {
return this.baseMapper.selectOne(new LambdaQueryWrapper<Aircraft>().eq(Aircraft::getAircraftModel, aircraftModel));
}
} }
...@@ -55,15 +55,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -55,15 +55,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -177,7 +169,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -177,7 +169,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 //通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) { } catch (MqttException e) {
throw new RuntimeException(); throw new RuntimeException();
} }
return true; return true;
} }
...@@ -216,7 +208,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -216,7 +208,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName()); alertSubmitted.setSchedulingType(alertSchedulingTypeEnum.get().getName());
alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo))); alertSubmitted.setSubmissionContent(JSONObject.toJSONString(objectToMap(calledRo)));
String token = RequestContext.getToken(); String token = RequestContext.getToken();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildKey(token)).toString(), ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),token)).toString(),
ReginParams.class); ReginParams.class);
alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName()); alertSubmitted.setRecUserName(reginParams.getUserModel().getUserName());
alertSubmitted.setSender(reginParams.getUserModel().getUserName()); alertSubmitted.setSender(reginParams.getUserModel().getUserName());
...@@ -227,7 +219,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -227,7 +219,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedId = alertSubmitted.getSequenceNbr().toString(); alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum = Optional<AlertBusinessTypeEnum> alertBusinessTypeEnum =
EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class, EnumsUtils.getEnumObject(AlertBusinessTypeEnum.class,
e -> e.getCode().equals(calledRo.getAlertTypeCode())); e -> e.getCode().equals(calledRo.getAlertTypeCode()));
smsCode = alertBusinessTypeEnum.get().getSms_code(); smsCode = alertBusinessTypeEnum.get().getSms_code();
} }
// 组装人员信息 // 组装人员信息
...@@ -443,50 +435,49 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -443,50 +435,49 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override @Override
public List<InstructionsZHDto> getInstructionsZHDtoList(Long id) { public List<InstructionsZHDto> getInstructionsZHDtoList(Long id) {
List<InstructionsZHDto> listInstructionsZHDto=new ArrayList<>(); List<InstructionsZHDto> listInstructionsZHDto = new ArrayList<>();
//获取调派记录 //获取调派记录
List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto=powerTransferCompanyMapper.listPowerTransferCompanyZHDto(id); List<PowerTransferCompanyZHDto> listPowerTransferCompanyZHDto = powerTransferCompanyMapper.listPowerTransferCompanyZHDto(id);
listPowerTransferCompanyZHDto.stream().forEach(PowerTransferCompanyZHDto->{ listPowerTransferCompanyZHDto.stream().forEach(PowerTransferCompanyZHDto -> {
String content=""; String content = "";
if(PowerTransferCompanyZHDto.getIsDistributionAgencies()){ if (PowerTransferCompanyZHDto.getIsDistributionAgencies()) {
content="调派"+PowerTransferCompanyZHDto.getCompanyName()+"前往"+PowerTransferCompanyZHDto.getAddress(); content = "调派" + PowerTransferCompanyZHDto.getCompanyName() + "前往" + PowerTransferCompanyZHDto.getAddress();
}else{ } else {
content="调派"+PowerTransferCompanyZHDto.getCompanyName()+PowerTransferCompanyZHDto.getSubmissionContent()+"前往"+PowerTransferCompanyZHDto.getAddress(); content = "调派" + PowerTransferCompanyZHDto.getCompanyName() + PowerTransferCompanyZHDto.getSubmissionContent() + "前往" + PowerTransferCompanyZHDto.getAddress();
} }
InstructionsZHDto instruct = new InstructionsZHDto(PowerTransferCompanyZHDto.getSequenceNbr(),PowerTransferCompanyZHDto.getDispatchType(), PowerTransferCompanyZHDto.getRecDate(), content); InstructionsZHDto instruct = new InstructionsZHDto(PowerTransferCompanyZHDto.getSequenceNbr(), PowerTransferCompanyZHDto.getDispatchType(), PowerTransferCompanyZHDto.getRecDate(), content);
listInstructionsZHDto.add(instruct); listInstructionsZHDto.add(instruct);
}); });
//获取融合调度信息 //获取融合调度信息
List<AlertSubmittedZHDto> listAlertSubmittedZHDto= alertSubmittedMapper.listAlertSubmittedZHDto(id); List<AlertSubmittedZHDto> listAlertSubmittedZHDto = alertSubmittedMapper.listAlertSubmittedZHDto(id);
listAlertSubmittedZHDto.stream().forEach(AlertSubmittedZHDto->{ listAlertSubmittedZHDto.stream().forEach(AlertSubmittedZHDto -> {
JSONObject js= JSONObject.parseObject(AlertSubmittedZHDto.getSubmissionContent()); JSONObject js = JSONObject.parseObject(AlertSubmittedZHDto.getSubmissionContent());
String content=""; String content = "";
switch(AlertSubmittedZHDto.getBusinessType()){ switch (AlertSubmittedZHDto.getBusinessType()) {
case "警情初报": case "警情初报":
content="通知"+ AlertSubmittedZHDto.getCompanyName()+":"+AlertSubmittedZHDto.getUserName()+","+js.getString("address")+"发生"+js.getString("alertType"); content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + js.getString("address") + "发生" + js.getString("alertType");
break; break;
case "警情续报": case "警情续报":
content="通知"+ AlertSubmittedZHDto.getCompanyName()+":"+AlertSubmittedZHDto.getUserName()+","+"现场被困人数:"+js.getString("trappedNum")+"人伤亡人数:"+js.getString("casualtiesNum")+"人。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "现场被困人数:" + js.getString("trappedNum") + "人伤亡人数:" + js.getString("casualtiesNum") + "人。";
break; break;
case "非警情确认": case "非警情确认":
content="通知"+ AlertSubmittedZHDto.getCompanyName()+":"+AlertSubmittedZHDto.getUserName()+","+"此警情现场确认为假警情。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "此警情现场确认为假警情。";
break; break;
case "警情结案": case "警情结案":
content="通知"+ AlertSubmittedZHDto.getCompanyName()+":"+AlertSubmittedZHDto.getUserName()+","+"此警情已完场警情处置,警情已结案。"; content = "通知" + AlertSubmittedZHDto.getCompanyName() + ":" + AlertSubmittedZHDto.getUserName() + "," + "此警情已完场警情处置,警情已结案。";
break; break;
default: default:
...@@ -494,17 +485,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -494,17 +485,26 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
break; break;
} }
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(),AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content); InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content);
listInstructionsZHDto.add(instruct); listInstructionsZHDto.add(instruct);
}); });
//排序时间倒序 //排序时间倒序
/* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 开始*/
Collections.sort(listInstructionsZHDto, new Comparator<InstructionsZHDto>() {
@Override
public int compare(InstructionsZHDto o1, InstructionsZHDto o2) {
long i = o2.getSubmissionTime().getTime() - o1.getSubmissionTime().getTime();
if (i == 0) {
return (int) (o2.getSubmissionTime().getTime() - o1.getSubmissionTime().getTime());
}
return (int) i;
}
});
/* Bug 2613 修改排序 按照发送时间排序 2021-09-01 陈召 结束*/
return listInstructionsZHDto;
List<InstructionsZHDto> listA=listInstructionsZHDto.stream().sorted(Comparator.comparing(InstructionsZHDto::getSubmissionTime).reversed()).collect(Collectors.toList());
return listA;
} }
/** /**
......
...@@ -208,7 +208,7 @@ public class ESAlertCalledService { ...@@ -208,7 +208,7 @@ public class ESAlertCalledService {
/** /**
* 通用匹配规则,条件构建 * 通用匹配规则,条件构建
*/ */
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
//警情状态 //警情状态
BoolQueryBuilder qb0 = QueryBuilders.boolQuery(); BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
for (String status : alertStatus) for (String status : alertStatus)
...@@ -219,7 +219,9 @@ public class ESAlertCalledService { ...@@ -219,7 +219,9 @@ public class ESAlertCalledService {
qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode())); qb0.should(QueryBuilders.termQuery("alertStatusStr.keyword", alertStatusEnum.getCode()));
} }
} }
boolMust.must(qb0); boolMustAll.must(qb0);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//接警时间,距离当前时间不超过半小时的 //接警时间,距离当前时间不超过半小时的
long currentTime = System.currentTimeMillis() ; long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 30*60*1000; currentTime = currentTime - 30*60*1000;
...@@ -258,7 +260,8 @@ public class ESAlertCalledService { ...@@ -258,7 +260,8 @@ public class ESAlertCalledService {
*/ */
boolMust.minimumShouldMatch(1);//至少满足一个
boolMustAll.must(boolMust);
// 创建查询构造器 // 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页 // 分页
...@@ -266,7 +269,7 @@ public class ESAlertCalledService { ...@@ -266,7 +269,7 @@ public class ESAlertCalledService {
// 排序 // 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC)) // .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件 //过滤条件
.withQuery(boolMust); .withQuery(boolMustAll);
List<ESAlertCalledDto> list = new LinkedList<>(); List<ESAlertCalledDto> list = new LinkedList<>();
long totle = 0; long totle = 0;
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
...@@ -24,6 +27,7 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; ...@@ -24,6 +27,7 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService; import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.aspectj.weaver.ast.Var; import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -32,7 +36,7 @@ import org.typroject.tyboot.core.foundation.exception.BaseException; ...@@ -32,7 +36,7 @@ import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -102,11 +106,21 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -102,11 +106,21 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords(); List<FireTeamCardDto> fireTeamList = fireTeamListPage.getRecords();
Map<Object, Long> finalTeamCarCountMap = teamCarCountMap; Map<Object, Long> finalTeamCarCountMap = teamCarCountMap;
fireTeamList.forEach(t -> { fireTeamList.forEach(t -> {
if (!ValidationUtil.isEmpty(finalTeamCarCountMap.get(t.getSequenceNbr().toString()))) { //递归返回teamId bug2684 bykongfm
t.setCarNum(finalTeamCarCountMap.get(t.getSequenceNbr().toString()).intValue()); List<Long> teamIds = new ArrayList<Long>();
//递归查找全部战备人数 BUG2217 bykongfm getAllTeamId(teamIds,t.getSequenceNbr());
t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr())); int carNum = 0;
int fighterNum = 0;
for(Long tempId : teamIds ) {
if(finalTeamCarCountMap.get(tempId.toString()) != null) {
carNum += finalTeamCarCountMap.get(tempId.toString()).intValue();
}
fighterNum += fireTeamMapper.getFighterNumByTeamId(tempId);
} }
t.setCarNum(carNum);
t.setFighterNum(fighterNum);
/*//递归查找全部战备人数 BUG2217 bykongfm
t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr()));*/
}); });
fireTeamListPage.setRecords(fireTeamList); fireTeamListPage.setRecords(fireTeamList);
return fireTeamListPage; return fireTeamListPage;
...@@ -181,6 +195,14 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -181,6 +195,14 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
} }
public FireTeam saveFireTeam(FireTeam fireTeam) { public FireTeam saveFireTeam(FireTeam fireTeam) {
if(fireTeam.getAddress()!=null){
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(fireTeam.getAddress());
fireTeam.setAddress(address.getString(BizConstant.ADDRESS));
fireTeam.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
fireTeam.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
if (ValidationUtil.isEmpty(fireTeam.getParent())) { if (ValidationUtil.isEmpty(fireTeam.getParent())) {
fireTeam.setTreeCode(TreeParser.genTreeCode()); fireTeam.setTreeCode(TreeParser.genTreeCode());
} else { } else {
...@@ -200,6 +222,33 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -200,6 +222,33 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
return fireTeam; return fireTeam;
} }
public static JSONObject getLongLatFromAddress(String address) {
JSONObject result = new JSONObject();
result.put(BizConstant.ADDRESS, "");
result.put(BizConstant.LONGITUDE, "0");
result.put(BizConstant.LATITUDE, "0");
if (StringUtils.isNotEmpty(address)) {
String[] addressData = address.split("@address@");
if (addressData.length > 1) {
result.put(BizConstant.ADDRESS, addressData[0]);
JSONObject langLatObj = JSON.parseObject(addressData[1]);
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LONGITUDE))) {
result.put(BizConstant.LONGITUDE, langLatObj.getString(BizConstant.LONGITUDE));
} else {
result.put(BizConstant.LONGITUDE, "0");
}
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LATITUDE))) {
result.put(BizConstant.LATITUDE, langLatObj.getString(BizConstant.LATITUDE));
} else {
result.put(BizConstant.LATITUDE, "0");
}
} else {
result.put(BizConstant.ADDRESS, addressData[0]);
}
}
return result;
}
/** /**
* 根据id删除队伍 * 根据id删除队伍
* *
...@@ -316,4 +365,18 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -316,4 +365,18 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
} }
public void getAllTeamId(List<Long> teamIds, Long teamId) {
teamIds.add(teamId);
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FireTeam::getParent, teamId).eq(FireTeam::getIsDelete, false);
List<FireTeam> fireTeamList = this.list(queryWrapper);
if (fireTeamList.size() == 0) {
// 没有下级单位
} else {
for (FireTeam t : fireTeamList) {
getAllTeamId(teamIds, t.getSequenceNbr());
}
}
}
} }
...@@ -106,7 +106,7 @@ public class CheckController extends AbstractBaseController { ...@@ -106,7 +106,7 @@ public class CheckController extends AbstractBaseController {
if (ObjectUtils.isEmpty(param.getOrderBy())) { if (ObjectUtils.isEmpty(param.getOrderBy())) {
param.setOrderBy("checkDate desc"); param.setOrderBy("checkDate desc");
} }
Page<CheckInfoVo> list = checkService.getCheckInfo(getToken(), getProduct(), getAppKey(), param); Page<CheckInfoVo> list = checkService.getCheckInfo(param);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
...@@ -114,7 +114,7 @@ public class CheckController extends AbstractBaseController { ...@@ -114,7 +114,7 @@ public class CheckController extends AbstractBaseController {
@ApiOperation(value = "导出巡检记录", notes = "导出巡检记录") @ApiOperation(value = "导出巡检记录", notes = "导出巡检记录")
@PostMapping(value = "/export", produces = "application/vnd.ms-excel;charset=UTF-8") @PostMapping(value = "/export", produces = "application/vnd.ms-excel;charset=UTF-8")
public void exportCheck( public void exportCheck(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
HttpServletResponse response) { HttpServletResponse response) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
String orgCode = getOrgCode(reginParams); String orgCode = getOrgCode(reginParams);
...@@ -136,7 +136,7 @@ public class CheckController extends AbstractBaseController { ...@@ -136,7 +136,7 @@ public class CheckController extends AbstractBaseController {
CheckInfoPageParam param = CheckPageParamUtil.fillCheckInfoParam(queryRequests, null, paramMap); CheckInfoPageParam param = CheckPageParamUtil.fillCheckInfoParam(queryRequests, null, paramMap);
param.setPageSize(-1); param.setPageSize(-1);
param.setOrderBy("checkDate DESC"); param.setOrderBy("checkDate DESC");
List<CheckInfoVo> list = checkService.getCheckInfoList(getToken(), getProduct(), getAppKey(), param); List<CheckInfoVo> list = checkService.getCheckInfoListNoPage(param);
String fileName = "巡检记录" + new Date().getTime(); String fileName = "巡检记录" + new Date().getTime();
FileHelper.exportExcel(list, "维保记录", "维保记录", CheckInfoVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "维保记录", "维保记录", CheckInfoVo.class, fileName + ".xls", response);
} }
...@@ -147,7 +147,7 @@ public class CheckController extends AbstractBaseController { ...@@ -147,7 +147,7 @@ public class CheckController extends AbstractBaseController {
public void exportSelectCheckRecord( public void exportSelectCheckRecord(
@ApiParam(value = "查询条件") @RequestParam(required = false) Long[] ids, @ApiParam(value = "查询条件") @RequestParam(required = false) Long[] ids,
HttpServletResponse response) { HttpServletResponse response) {
List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(getToken(), getProduct(), getAppKey(), ids); List<CheckInfoVo> list = checkService.getSelectedCheckInfoList(ids);
String fileName = "巡检记录" + new Date().getTime(); String fileName = "巡检记录" + new Date().getTime();
FileHelper.exportExcel(list, "巡检记录", "巡检记录", CheckInfoVo.class, fileName + ".xls", response); FileHelper.exportExcel(list, "巡检记录", "巡检记录", CheckInfoVo.class, fileName + ".xls", response);
} }
...@@ -168,7 +168,6 @@ public class CheckController extends AbstractBaseController { ...@@ -168,7 +168,6 @@ public class CheckController extends AbstractBaseController {
hasOrgCode = Boolean.FALSE; hasOrgCode = Boolean.FALSE;
} }
} }
;
} }
HashMap<String, Object> paramMap; HashMap<String, Object> paramMap;
if (hasOrgCode) { if (hasOrgCode) {
...@@ -521,7 +520,7 @@ public class CheckController extends AbstractBaseController { ...@@ -521,7 +520,7 @@ public class CheckController extends AbstractBaseController {
@ApiOperation(value = "维保记录详情", notes = "维保记录详情") @ApiOperation(value = "维保记录详情", notes = "维保记录详情")
@GetMapping(value = "/{id}/detail") @GetMapping(value = "/{id}/detail")
public CommonResponse getCheckDetail( public CommonResponse getCheckDetail(
@ApiParam(value = "记录Id",required = true) @PathVariable(value = "id") String id) { @ApiParam(value = "记录Id", required = true) @PathVariable(value = "id") String id) {
return CommonResponseUtil.success(checkService.getCheckDetail(id)); return CommonResponseUtil.success(checkService.getCheckDetail(id));
} }
...@@ -532,6 +531,7 @@ public class CheckController extends AbstractBaseController { ...@@ -532,6 +531,7 @@ public class CheckController extends AbstractBaseController {
return ResponseHelper.buildResponse(CheckRecordOrderByEnum.getEnumList()); return ResponseHelper.buildResponse(CheckRecordOrderByEnum.getEnumList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "/设备设施维保记录分页列表", notes = "外部接口装备和者水源使用") @ApiOperation(value = "/设备设施维保记录分页列表", notes = "外部接口装备和者水源使用")
@GetMapping(value = "page/{originalId}/list") @GetMapping(value = "page/{originalId}/list")
public ResponseModel getCheckListByOriginalId( public ResponseModel getCheckListByOriginalId(
......
...@@ -19,6 +19,10 @@ public class CheckInputDto { ...@@ -19,6 +19,10 @@ public class CheckInputDto {
private String isOk; private String isOk;
private String isOkDesc; private String isOkDesc;
/** /**
* 检查项类型:文本,选择,数字
*/
private String itemType;
/**
* 拍照配置 * 拍照配置
*/ */
private String pictureJson; private String pictureJson;
......
...@@ -119,7 +119,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -119,7 +119,7 @@ public class CheckServiceImpl implements ICheckService {
@Override @Override
public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) { public Page<CheckInfoVo> getCheckInfo(CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param); long total = checkMapper.countCheckInfoData(param);
List<CheckInfoVo> content = Lists.newArrayList(); List<CheckInfoVo> content = Lists.newArrayList();
if (total == 0) { if (total == 0) {
...@@ -347,7 +347,6 @@ public class CheckServiceImpl implements ICheckService { ...@@ -347,7 +347,6 @@ public class CheckServiceImpl implements ICheckService {
public static CheckInput paraseNumber(CheckInput checkInput, String json, CheckInputParam item, String isScore) { public static CheckInput paraseNumber(CheckInput checkInput, String json, CheckInputParam item, String isScore) {
JSONObject jsonObject = JSONObject.parseObject(json); JSONObject jsonObject = JSONObject.parseObject(json);
String OkUpStr = jsonObject.get("OkUp").toString(); String OkUpStr = jsonObject.get("OkUp").toString();
;
String OkDownStr = jsonObject.get("OkDown").toString(); String OkDownStr = jsonObject.get("OkDown").toString();
Double OkUp = StringUtil.isNotEmpty(OkUpStr) ? Double.valueOf(OkUpStr) : null; Double OkUp = StringUtil.isNotEmpty(OkUpStr) ? Double.valueOf(OkUpStr) : null;
Double OkDown = StringUtil.isNotEmpty(OkDownStr) ? Double.valueOf(OkDownStr) : null; Double OkDown = StringUtil.isNotEmpty(OkDownStr) ? Double.valueOf(OkDownStr) : null;
...@@ -429,7 +428,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -429,7 +428,7 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public Page<Check> getCheckListByOriginalId(String originalId, CommonPageable pageable) { public Page<Map<String, Object>> getCheckListByOriginalId(String originalId, CommonPageable pageable) {
Point point = iPointDao.findByOriginalId(originalId); Point point = iPointDao.findByOriginalId(originalId);
if (point == null) { if (point == null) {
throw new RuntimeException("不存在该设备设施"); throw new RuntimeException("不存在该设备设施");
...@@ -437,8 +436,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -437,8 +436,8 @@ public class CheckServiceImpl implements ICheckService {
List<DaoCriteria> criterias = new ArrayList<>(); List<DaoCriteria> criterias = new ArrayList<>();
DaoCriteria daoCriteria = new DaoCriteria(); DaoCriteria daoCriteria = new DaoCriteria();
daoCriteria.setOperator(QueryOperatorEnum.EQUAL.getName()); daoCriteria.setOperator(QueryOperatorEnum.EQUAL.getName());
daoCriteria.setPropertyName("originalId"); daoCriteria.setPropertyName("pointId");
daoCriteria.setValue(originalId); daoCriteria.setValue(point.getId());
criterias.add(daoCriteria); criterias.add(daoCriteria);
BaseQuerySpecification<Check> spec = new BaseQuerySpecification<>(criterias); BaseQuerySpecification<Check> spec = new BaseQuerySpecification<>(criterias);
Sort.Order idOrder = new Sort.Order(Sort.Direction.DESC, "id"); Sort.Order idOrder = new Sort.Order(Sort.Direction.DESC, "id");
...@@ -446,7 +445,20 @@ public class CheckServiceImpl implements ICheckService { ...@@ -446,7 +445,20 @@ public class CheckServiceImpl implements ICheckService {
orders.add(idOrder); orders.add(idOrder);
Sort sort = Sort.by(orders); Sort sort = Sort.by(orders);
pageable.setSort(sort); pageable.setSort(sort);
return checkDao.findAll(spec, pageable); Page<Check> page = checkDao.findAll(spec, pageable);
List<Map<String, Object>> content = page.getContent().stream().map(r -> {
Map<String, Object> target = Bean.BeantoMap(r);
if (StringUtil.isNotEmpty(r.getPlanType())) {
PlanTypeEnum planTypeEnum = PlanTypeEnum.getEnumByCode(r.getPlanType());
target.put("planTypeDesc", planTypeEnum != null ? planTypeEnum.getName() : "");
}
if (StringUtil.isNotEmpty(r.getIsOk())) {
CheckStatusEnum checkStatusEnum = CheckStatusEnum.getEnum(r.getIsOk());
target.put("isOkDesc", checkStatusEnum != null ? checkStatusEnum.getName() : "");
}
return target;
}).collect(Collectors.toList());
return new PageImpl<>(content, pageable, page.getTotalElements());
} }
@Override @Override
...@@ -715,43 +727,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -715,43 +727,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public List<CheckInfoVo> getCheckInfoList(String toke, String product, String appKey, CheckInfoPageParam param) { public List<CheckInfoVo> getCheckInfoListNoPage(CheckInfoPageParam param) {
List<CheckInfoVo> list = checkMapper.getCheckInfo(param); return checkMapper.getCheckInfo(param);
Set<String> userIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getUserId));
Set<String> deptIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
String joinUserId = "";
for (String userId : userIds) {
if (userId != null && !userId.trim().equals("")) {
joinUserId = joinUserId + userId + ",";
}
}
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, joinUserId);
Map<String, String> deptMap = new HashMap<String, String>();
if (!CollectionUtils.isEmpty(deptIds)) {
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
// deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
}
Map<String, String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
Map<String, String> deptMapNew = deptMap;
List<String> userNames = new ArrayList<>();
list.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
e.setUserName(Joiner.on(",").join(userNames));
e.setDepartmentName(deptMapNew.get(e.getDepId()));
});
return list;
} }
@Override @Override
...@@ -765,36 +742,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -765,36 +742,8 @@ public class CheckServiceImpl implements ICheckService {
} }
@Override @Override
public List<CheckInfoVo> getSelectedCheckInfoList(String toke, String product, String appKey, Long[] ids) { public List<CheckInfoVo> getSelectedCheckInfoList(Long[] ids) {
List<CheckInfoVo> list = checkMapper.getSelectedCheckInfoList(ids); return checkMapper.getSelectedCheckInfoList(ids);
Set<String> userIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getUserId));
Set<String> deptIds = Sets.newHashSet(Lists.transform(list, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
Map<String, String> deptMap = new HashMap<String, String>();
// if(!CollectionUtils.isEmpty(deptIds)){
// List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
// //deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
// for (int i = 0; i < deptList.size(); i++) {
// deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
// }
// }
Map<String, String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName, (k1, k2) -> k2));
Map<String, String> deptMapNew = deptMap;
List<String> userNames = new ArrayList<>();
list.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for (String userId : userIds1) {
userNames.add(userModelMap.get(userId));
}
userNames.remove(null);
e.setUserName(Joiner.on(",").join(userNames));
// e.setDepartmentName(deptMapNew.get(e.getDepId()));
});
return list;
} }
@Override @Override
......
...@@ -1106,7 +1106,7 @@ public class PointServiceImpl implements IPointService { ...@@ -1106,7 +1106,7 @@ public class PointServiceImpl implements IPointService {
point.setOwnerName(x.getOwnerUnitName()); point.setOwnerName(x.getOwnerUnitName());
point.setBuildingId(x.getBuildingId() != null ? x.getBuildingId().toString() : ""); point.setBuildingId(x.getBuildingId() != null ? x.getBuildingId().toString() : "");
point.setBuildingName(x.getBuildingName()); point.setBuildingName(x.getBuildingName());
point.setAddress(x.getArea()); point.setAddress(x.getLocation());
point.setLevel(""); point.setLevel("");
point.setCreatorId(RequestContext.getExeUserId()); point.setCreatorId(RequestContext.getExeUserId());
//TODO BUG orgCode 取值 没值来源 //TODO BUG orgCode 取值 没值来源
......
...@@ -14,7 +14,6 @@ import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone; ...@@ -14,7 +14,6 @@ import com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.maintenance.core.common.response.CommonPage; import com.yeejoin.amos.maintenance.core.common.response.CommonPage;
import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse; import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.maintenance.core.common.response.QueryCriteriaRespone; import com.yeejoin.amos.maintenance.core.common.response.QueryCriteriaRespone;
import com.yeejoin.amos.maintenance.dao.entity.Check;
import com.yeejoin.amos.maintenance.exception.YeeException; import com.yeejoin.amos.maintenance.exception.YeeException;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -31,10 +30,11 @@ public interface ICheckService { ...@@ -31,10 +30,11 @@ public interface ICheckService {
* @param param * @param param
* @return * @return
*/ */
Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param); Page<CheckInfoVo> getCheckInfo(CheckInfoPageParam param);
/** /**
* 保存检查记录 * 保存检查记录
*
* @param recordParam 填写记录 * @param recordParam 填写记录
* @param reginParams 权限信息 * @param reginParams 权限信息
* @return CheckDto * @return CheckDto
...@@ -58,9 +58,9 @@ public interface ICheckService { ...@@ -58,9 +58,9 @@ public interface ICheckService {
List<Map> queryUnqualifiedInputItem(int checkId); List<Map> queryUnqualifiedInputItem(int checkId);
AppPointCheckRespone queryCheckPointDetail(String toke,String product,String appKey,long checkId); AppPointCheckRespone queryCheckPointDetail(String toke, String product, String appKey, long checkId);
AppPointCheckRespone queryCheckPointDetailInVersion2(String toke,String product,String appKey,long checkId); AppPointCheckRespone queryCheckPointDetailInVersion2(String toke, String product, String appKey, long checkId);
/** /**
* 巡检统计 * 巡检统计
...@@ -86,7 +86,7 @@ public interface ICheckService { ...@@ -86,7 +86,7 @@ public interface ICheckService {
*/ */
Map<String, Object> queryRecordById(int checkId); Map<String, Object> queryRecordById(int checkId);
List<CheckInfoVo> getCheckInfoList(String toke,String product,String appKey,CheckInfoPageParam param); List<CheckInfoVo> getCheckInfoListNoPage(CheckInfoPageParam param);
/** /**
* 查询巡检记录所有图片 * 查询巡检记录所有图片
...@@ -110,7 +110,7 @@ public interface ICheckService { ...@@ -110,7 +110,7 @@ public interface ICheckService {
* @param ids * @param ids
* @return * @return
*/ */
List<CheckInfoVo> getSelectedCheckInfoList(String toke,String product,String appKey,Long[] ids); List<CheckInfoVo> getSelectedCheckInfoList(Long[] ids);
/** /**
* 本月隐患治理趋势统计 * 本月隐患治理趋势统计
...@@ -128,7 +128,7 @@ public interface ICheckService { ...@@ -128,7 +128,7 @@ public interface ICheckService {
* @param userInfo * @param userInfo
* @return * @return
*/ */
QueryCriteriaRespone getQueryCriteriaInit(String toke,String product,String appKey,String loginOrgCode, String roleTypeName, String departmentId, String companyId); QueryCriteriaRespone getQueryCriteriaInit(String toke, String product, String appKey, String loginOrgCode, String roleTypeName, String departmentId, String companyId);
List<HashMap<String, String>> getCalCountChkInfo(HashMap<String, Object> paramMap); List<HashMap<String, String>> getCalCountChkInfo(HashMap<String, Object> paramMap);
...@@ -154,7 +154,8 @@ public interface ICheckService { ...@@ -154,7 +154,8 @@ public interface ICheckService {
* @param param * @param param
* @return * @return
*/ */
List<HashMap<String,Object>> getEquipInputByCheckId(CheckDetailInputPageParam param); List<HashMap<String, Object>> getEquipInputByCheckId(CheckDetailInputPageParam param);
/** /**
* 根据巡检记录ID和巡检点ID获取巡检记录详情 * 根据巡检记录ID和巡检点ID获取巡检记录详情
* *
...@@ -195,7 +196,7 @@ public interface ICheckService { ...@@ -195,7 +196,7 @@ public interface ICheckService {
* @param user * @param user
* @return * @return
*/ */
QueryCriteriaRespone findCheckSystemInit(String toke,String product,String appKey,String type, String orgCode, String roleTypeName, String departmentId, String companyId); QueryCriteriaRespone findCheckSystemInit(String toke, String product, String appKey, String type, String orgCode, String roleTypeName, String departmentId, String companyId);
/** /**
* 巡检记录查询 * 巡检记录查询
...@@ -205,7 +206,7 @@ public interface ICheckService { ...@@ -205,7 +206,7 @@ public interface ICheckService {
*/ */
Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params); Page<CheckInfoBo> getCheckInfoList(CheckInfoListPageParam params);
Page<Map<String, Object>> getCheckInfoList1(String toke,String product,String appKey,CheckInfoListPageParam params); Page<Map<String, Object>> getCheckInfoList1(String toke, String product, String appKey, CheckInfoListPageParam params);
/** /**
* 视图模块初始化数据 * 视图模块初始化数据
...@@ -238,41 +239,54 @@ public interface ICheckService { ...@@ -238,41 +239,54 @@ public interface ICheckService {
*/ */
List<Long> getCheckDataCount(HashMap<String, Object> param); List<Long> getCheckDataCount(HashMap<String, Object> param);
List<String> getCheckPhotosByCheckAndInputId(int checkId, int checkInputId,int classifyId); List<String> getCheckPhotosByCheckAndInputId(int checkId, int checkInputId, int classifyId);
List<String> getLivePhotos(Long checkID); List<String> getLivePhotos(Long checkID);
List<Long> getPlanCheckDataCount(HashMap<String, Object> param); List<Long> getPlanCheckDataCount(HashMap<String, Object> param);
/** /**
* 查询巡检装备 * 查询巡检装备
* *
* @param param * @param param
* @return * @return
*/ */
List<HashMap<String,Object>> getEquipByCheckId(CheckDetailInputPageParam param); List<HashMap<String, Object>> getEquipByCheckId(CheckDetailInputPageParam param);
/** /**
* 最近一次漏检记录 * 最近一次漏检记录
*
* @param relationId 关系id * @param relationId 关系id
* @return CheckRecordDto * @return CheckRecordDto
*/ */
Map<String,CheckRecordDto> obtainLastCheckRecord(String[] relationId); Map<String, CheckRecordDto> obtainLastCheckRecord(String[] relationId);
Page<Map<String, Object>> getCheckPage(HashMap<String, Object> map, CommonPageable pageable); Page<Map<String, Object>> getCheckPage(HashMap<String, Object> map, CommonPageable pageable);
Map<String, Object> getCheckDetail(String id); Map<String, Object> getCheckDetail(String id);
/** /**
* 校验是否已经填写过 * 校验是否已经填写过
*
* @param planTaskId * @param planTaskId
* @param pointId * @param pointId
* @return * @return
*/ */
int checkHasRecord(Long planTaskId, Long pointId); int checkHasRecord(Long planTaskId, Long pointId);
Page<Check> getCheckListByOriginalId(String originalId, CommonPageable pageable);
/**
* 维保记录-按照管理id查询
*
* @param originalId 关联id
* @param pageable 分页信息 0页开始
* @return Page<Map < String, Object>>
*/
Page<Map<String, Object>> getCheckListByOriginalId(String originalId, CommonPageable pageable);
/** /**
* 维保检查项详情 * 维保检查项详情
*
* @param checkId 记录ID * @param checkId 记录ID
* @return List<CheckInputDto> * @return List<CheckInputDto>
*/ */
......
package com.yeejoin.amos.maintenance.business.vo; package com.yeejoin.amos.maintenance.business.vo;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
@Data
public class CheckInfoVo { public class CheckInfoVo {
private String id; private String id;
private String orgCode; private String orgCode;
private String pointId; private String pointId;
@Excel(name = "点名称", orderNum = "0") @Excel(name = "点名称")
private String pointName; private String pointName;
@Excel(name = "点编号", orderNum = "1") @Excel(name = "点编号", orderNum = "1")
private String pointNo; private String pointNo;
...@@ -15,6 +18,10 @@ public class CheckInfoVo { ...@@ -15,6 +18,10 @@ public class CheckInfoVo {
private String depId; private String depId;
@Excel(name = "维保人员", orderNum = "2") @Excel(name = "维保人员", orderNum = "2")
private String userName; private String userName;
/**
* 维保公司名称
*/
private String companyName;
@Excel(name = "维保部门", orderNum = "3") @Excel(name = "维保部门", orderNum = "3")
private String departmentName; private String departmentName;
@Excel(name = "维保时间", orderNum = "4") @Excel(name = "维保时间", orderNum = "4")
...@@ -43,135 +50,4 @@ public class CheckInfoVo { ...@@ -43,135 +50,4 @@ public class CheckInfoVo {
private String error; private String error;
@Excel(name = "备注说明", orderNum = "14") @Excel(name = "备注说明", orderNum = "14")
private String remark; private String remark;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDepId() {
return depId;
}
public void setDepId(String depId) {
this.depId = depId;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getPointId() {
return pointId;
}
public void setPointId(String pointId) {
this.pointId = pointId;
}
public String getPointName() {
return pointName;
}
public void setPointName(String pointName) {
this.pointName = pointName;
}
public String getPointNo() {
return pointNo;
}
public void setPointNo(String pointNo) {
this.pointNo = pointNo;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCheckTime() {
return checkTime;
}
public void setCheckTime(String checkTime) {
this.checkTime = checkTime;
}
public String getUploadTime() {
return uploadTime;
}
public void setUploadTime(String uploadTime) {
this.uploadTime = uploadTime;
}
public String getFinishStatus() {
return finishStatus;
}
public void setFinishStatus(String finishStatus) {
this.finishStatus = finishStatus;
}
public String getIsOk() {
return isOk;
}
public void setIsOk(String isOk) {
this.isOk = isOk;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public String getRouteName() {
return routeName;
}
public void setRouteName(String routeName) {
this.routeName = routeName;
}
public String getCheckMode() {
return checkMode;
}
public void setCheckMode(String checkMode) {
this.checkMode = checkMode;
}
public String getPlanName() {
return planName;
}
public void setPlanName(String planName) {
this.planName = planName;
}
public String getPlanTaskId() {
return planTaskId;
}
public void setPlanTaskId(String planTaskId) {
this.planTaskId = planTaskId;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getCatalogId() {
return CatalogId;
}
public void setCatalogId(String catalogId) {
CatalogId = catalogId;
}
} }
...@@ -4,6 +4,7 @@ package com.yeejoin.amos.maintenance.core.framework; ...@@ -4,6 +4,7 @@ package com.yeejoin.amos.maintenance.core.framework;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient; import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
...@@ -39,7 +40,7 @@ public class PersonIdentifyAspect { ...@@ -39,7 +40,7 @@ public class PersonIdentifyAspect {
@Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)") @Before(value = "@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)")
public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException { public void personIdentity(JoinPoint joinPoint, PersonIdentify permission) throws PermissionException {
ReginParams reginParam = JSON.parseObject(redisUtils.get(buildKey(RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (permission.isNeedIdentity() && reginParam != null) { if (permission.isNeedIdentity() && reginParam != null) {
//调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员 //调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员
String userId = reginParam.getUserModel().getUserId(); String userId = reginParam.getUserModel().getUserId();
...@@ -49,12 +50,8 @@ public class PersonIdentifyAspect { ...@@ -49,12 +50,8 @@ public class PersonIdentifyAspect {
} }
ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class); ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
reginParam.setPersonIdentity(personIdentity); reginParam.setPersonIdentity(personIdentity);
redisUtils.set(buildKey(RequestContext.getToken()), JSONObject.toJSONString(reginParam)); redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
} }
} }
public String buildKey(String token) {
return "region_" + token;
}
} }
...@@ -99,6 +99,15 @@ ...@@ -99,6 +99,15 @@
<groupId>cn.jpush.api</groupId> <groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId> <artifactId>jpush-client</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -386,7 +386,7 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -386,7 +386,7 @@ public class PlanTaskController extends AbstractBaseController {
@RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/v2/initPlanTask", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse qryPlanTaskDetailByIdInVersion2( public CommonResponse qryPlanTaskDetailByIdInVersion2(
@ApiParam(value = "巡检计划任务ID") @RequestParam(required = false) Long planTaskId, @ApiParam(value = "巡检计划任务ID") @RequestParam(required = false) Long planTaskId,
@ApiParam(value = "巡检点id", required = true) @RequestParam(required = true) Long pointId) { @ApiParam(value = "巡检点id", required = true) @RequestParam Long pointId) {
try { try {
Map<String, Object> response = new HashMap<String, Object>(); Map<String, Object> response = new HashMap<String, Object>();
if (planTaskId != null && planTaskId > 0) { if (planTaskId != null && planTaskId > 0) {
......
...@@ -253,11 +253,12 @@ public class CheckServiceImpl implements ICheckService { ...@@ -253,11 +253,12 @@ public class CheckServiceImpl implements ICheckService {
check.setCheckTime(DateUtil.getLongDate(requestParam.getCheckTime())); check.setCheckTime(DateUtil.getLongDate(requestParam.getCheckTime()));
check.setUploadTime(new Date()); check.setUploadTime(new Date());
check.setOrgCode(requestParam.getOrgCode()); check.setOrgCode(requestParam.getOrgCode());
check.setUserId(user.getUserId().toString()); check.setUserId(user.getUserId());
check.setUserName(user.getRealName()); check.setUserName(user.getRealName());
// Department dep = user.getDepartment(); if (departmentModel != null && departmentModel.getSequenceNbr() != null) {
if (departmentModel != null) {
check.setDepId(departmentModel.getSequenceNbr().toString()); check.setDepId(departmentModel.getSequenceNbr().toString());
}
if (departmentModel != null) {
check.setDepName(departmentModel.getDepartmentName()); check.setDepName(departmentModel.getDepartmentName());
} }
check.setCheckMode(requestParam.getCheckMode()); check.setCheckMode(requestParam.getCheckMode());
......
...@@ -72,7 +72,7 @@ public interface IPlanTaskService { ...@@ -72,7 +72,7 @@ public interface IPlanTaskService {
* @param id * @param id
* @return * @return
*/ */
public Map findPlanTaskByTaskIdAndPointId(long id, long pointId); Map findPlanTaskByTaskIdAndPointId(long id, long pointId);
/** /**
* 天剑查询假话任务信息 * 天剑查询假话任务信息
......
package com.yeejoin.amos.patrol.config;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
/**
* @author DELL
*/
@Configuration
public class JacksonCustomizerConfig {
/**
* description:适配自定义序列化和反序列化策略,返回前端指定数据类型的数据
*/
@Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
return builder -> {
builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer());
builder.deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer());
};
}
/**
* description:序列化
* LocalDateTime序列化为毫秒级时间戳
*/
public static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> {
@Override
public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers)
throws IOException {
if (value != null) {
long timestamp = LocalDateTimeUtil.toEpochMilli(value);
gen.writeNumber(timestamp);
}
}
}
/**
* description:反序列化
* 毫秒级时间戳序列化为LocalDateTime
*/
public static class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
@Override
public LocalDateTime deserialize(JsonParser p, DeserializationContext deserializationContext)
throws IOException {
long timestamp = p.getValueAsLong();
if (timestamp > 0) {
return LocalDateTimeUtil.of(timestamp, ZoneOffset.of("+8"));
} else {
return null;
}
}
}
}
...@@ -162,6 +162,13 @@ ...@@ -162,6 +162,13 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-1"> <changeSet author="litengwei" id="2021-09-01-litengwei-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>add data cb_data_dictionary</comment> <comment>add data cb_data_dictionary</comment>
<sql> <sql>
INSERT INTO `cb_data_dictionary` VALUES(1152, '1152', '大面积航班延误保障', 'QTZL', NULL, NULL, NULL, NULL, NULL, 0, 1); INSERT INTO `cb_data_dictionary` VALUES(1152, '1152', '大面积航班延误保障', 'QTZL', NULL, NULL, NULL, NULL, NULL, 0, 1);
...@@ -182,6 +189,13 @@ ...@@ -182,6 +189,13 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-2"> <changeSet author="litengwei" id="2021-09-01-litengwei-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_form" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>add data jc_alert_form</comment> <comment>add data jc_alert_form</comment>
<sql> <sql>
INSERT INTO `jc_alert_form` VALUES(127, '230', 'HKQJYZL', '航空器救援子类', 'aircraftRescueSub', 'radio', NULL, NULL, NULL, 0, 1, 1, NULL); INSERT INTO `jc_alert_form` VALUES(127, '230', 'HKQJYZL', '航空器救援子类', 'aircraftRescueSub', 'radio', NULL, NULL, NULL, 0, 1, 1, NULL);
...@@ -191,6 +205,13 @@ ...@@ -191,6 +205,13 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-3"> <changeSet author="litengwei" id="2021-09-01-litengwei-3">
<preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_form" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions>
<comment>update data jc_alert_form</comment> <comment>update data jc_alert_form</comment>
<sql> <sql>
UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='航班号', field_code='flightNumber', field_type='selectDelay', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=2, url='aircraft/getAircraftNum' WHERE sequence_nbr=103; UPDATE `jc_alert_form` SET alert_type_code='230', field_value_code=NULL, field_name='航班号', field_code='flightNumber', field_type='selectDelay', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=0, sort_num=2, url='aircraft/getAircraftNum' WHERE sequence_nbr=103;
...@@ -208,4 +229,54 @@ ...@@ -208,4 +229,54 @@
UPDATE `jc_alert_form` SET alert_type_code='242', field_value_code=NULL, field_name='备注', field_code='remarks', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=4, url=NULL WHERE sequence_nbr=126; UPDATE `jc_alert_form` SET alert_type_code='242', field_value_code=NULL, field_name='备注', field_code='remarks', field_type='textarea', rec_user_name=NULL, rec_user_id=NULL, rec_date=NULL, is_delete=0, block=1, sort_num=4, url=NULL WHERE sequence_nbr=126;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-1">
<comment>update data cb_data_dictionary</comment>
<sql>
update cb_data_dictionary set name ='无固定期合同' where name ='无固定器合同' and type='HTLB';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-2">
<comment>update data jc_alert_form</comment>
<sql>
update jc_alert_form set field_name ='燃油量(吨)' where alert_type_code ='230' and field_code='fuelQuantity';
update jc_alert_form set field_name ='载客量(人)' where alert_type_code ='230' and field_code='passengerCapacity';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-3">
<comment>update data cb_fire_team</comment>
<sql>
ALTER TABLE `cb_fire_team` modify longitude double(18,14) COMMENT '经度';
ALTER TABLE `cb_fire_team` modify latitude double(18,14) COMMENT '纬度';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-4">
<comment>update data cb_fire_station</comment>
<sql>
ALTER TABLE `cb_fire_station` modify longitude double(18,14) COMMENT '经度';
ALTER TABLE `cb_fire_station` modify latitude double(18,14) COMMENT '纬度';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-5">
<comment>update data cb_linkage_unit</comment>
<sql>
ALTER TABLE `cb_linkage_unit` modify longitude double(18,14) COMMENT '经度';
ALTER TABLE `cb_linkage_unit` modify latitude double(18,14) COMMENT '纬度';
</sql>
</changeSet>
<changeSet author="chenhao" id="2021-09-02-chenhao-6">
<comment>update data cb_water_resource</comment>
<sql>
ALTER TABLE `cb_water_resource` modify longitude double(18,14) COMMENT '经度';
ALTER TABLE `cb_water_resource` modify latitude double(18,14) COMMENT '纬度';
</sql>
</changeSet>
<changeSet author="kongfm" id="2021-09-03-kongfm-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_firefighters"/>
</preConditions>
<comment>modify table cb_firefighters add several columns</comment>
<sql>
ALTER TABLE `cb_firefighters` add native_place_value varchar(255) COMMENT '户籍所在地的值';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
...@@ -190,6 +190,17 @@ ...@@ -190,6 +190,17 @@
ALTER TABLE p_plan_task add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称'; ALTER TABLE p_plan_task add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1630291249901-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="point_no"/>
</not>
</preConditions>
<comment>p_check add COLUMN point_no '设备编号'</comment>
<sql>
ALTER TABLE p_check add COLUMN `point_no` bigint(20) DEFAULT NULL COMMENT '设备编号' after `point_name`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1630291249911-1"> <changeSet author="suhuiguang" id="1630291249911-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -201,6 +212,50 @@ ...@@ -201,6 +212,50 @@
ALTER TABLE p_check add COLUMN `risk_and_manage` varchar(255) DEFAULT NULL COMMENT '风险辨识与管控措施' after `point_no`; ALTER TABLE p_check add COLUMN `risk_and_manage` varchar(255) DEFAULT NULL COMMENT '风险辨识与管控措施' after `point_no`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1630291249901-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="building_name"/>
</not>
</preConditions>
<comment>p_check add COLUMN building_name '安装位置'</comment>
<sql>
ALTER TABLE p_check add COLUMN `building_name` varchar(255) DEFAULT NULL COMMENT '安装位置' after `risk_and_manage`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1630291249901-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="equipment_name"/>
</not>
</preConditions>
<comment>p_check add COLUMN equipment_name '设备分类(装备定义名称)'</comment>
<sql>
ALTER TABLE p_check add COLUMN `equipment_name` varchar(255) DEFAULT NULL COMMENT '设备分类(装备定义名称)' after `building_name`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1630291249901-4">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="owner_id"/>
</not>
</preConditions>
<comment>p_check add COLUMN owner_id '业主单位'</comment>
<sql>
ALTER TABLE p_check add COLUMN `owner_id` varchar(50) DEFAULT NULL COMMENT '业主单位' after `route_name`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1630291249901-5">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="plan_type"/>
</not>
</preConditions>
<comment>p_check add COLUMN plan_type '计划类型:1-日,2-周,3-月,4-年'</comment>
<sql>
ALTER TABLE p_check add COLUMN `plan_type` varchar(255) DEFAULT NULL COMMENT '计划类型:1-日,2-周,3-月,4-年';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1630291249911-2"> <changeSet author="suhuiguang" id="1630291249911-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
</choose> </choose>
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if> <if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if> <if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if>
...@@ -74,6 +73,7 @@ ...@@ -74,6 +73,7 @@
a.user_name, a.user_name,
a.dep_name department_name, a.dep_name department_name,
a.dep_id departmentId, a.dep_id departmentId,
a.company_name,
date_format( date_format(
`a`.`check_time`, `a`.`check_time`,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
...@@ -456,7 +456,6 @@ ...@@ -456,7 +456,6 @@
</choose> </choose>
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if> <if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if> <if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and a.point_name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null">and a.point_name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no = #{pointNo}</if> <if test="pointNo!=null">and b.point_no = #{pointNo}</if>
...@@ -2068,7 +2067,8 @@ ...@@ -2068,7 +2067,8 @@
ii.data_json, ii.data_json,
ii.test_requirement as testRequirement, ii.test_requirement as testRequirement,
ii.basis_json as basisJson, ii.basis_json as basisJson,
ii.is_must as isMust ii.is_must as isMust,
ii.item_type as itemType
from p_check_input ci from p_check_input ci
left join p_input_item ii on ci.input_id = ii.id left join p_input_item ii on ci.input_id = ii.id
where ci.check_id=#{checkId} where ci.check_id=#{checkId}
......
...@@ -544,12 +544,58 @@ ...@@ -544,12 +544,58 @@
END END
</createProcedure> </createProcedure>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="1630567666-1" runAlways="true">
<comment>创建函数func_split_TotalLength</comment>
<sql endDelimiter="#">
DROP function IF EXISTS `func_split_TotalLength`#
CREATE FUNCTION `func_split_TotalLength`(f_string varchar(1000),f_delimiter varchar(5)) RETURNS int(11)
BEGIN
return 1+(length(f_string) - length(replace(f_string,f_delimiter,'')));
END
#
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1630567666-2" runAlways="true">
<comment>创建函数func_split</comment>
<sql endDelimiter="#">
DROP function IF EXISTS `func_split`#
CREATE DEFINER=`root`@`%` FUNCTION `func_split`
(f_string varchar(1000),f_delimiter varchar(5),f_order int) RETURNS varchar(255) CHARSET utf8
BEGIN
declare result varchar(255) default '';
set result = reverse(substring_index(reverse(substring_index(f_string,f_delimiter,f_order)),f_delimiter,1));
return result;
END#
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1630567666-3" runAlways="true">
<createProcedure procedureName="splitString" >
DROP PROCEDURE IF EXISTS `splitString`;
</createProcedure>
</changeSet>
<changeSet author="gaojianqiang" id="1630567666-4" runAlways="true">
<createProcedure procedureName="splitString">
CREATE PROCEDURE `splitString` (IN f_string varchar(1000),IN f_delimiter varchar(5))
BEGIN
declare cnt int default 0;
declare i int default 0;
set cnt = func_split_TotalLength(f_string,f_delimiter);
DROP TABLE IF EXISTS `tmp_split`;
create table `tmp_split` (`status` varchar(128) not null) DEFAULT CHARSET=utf8;
while cnt > i
do
set i = i + 1;
insert into tmp_split(`status`) values (func_split(f_string,f_delimiter,i));
end while;
END
</createProcedure>
</changeSet>
<changeSet author="gaodongdong" id="1610421278000-24" runAlways="true"> <changeSet author="gaodongdong" id="1610421278000-24" runAlways="true">
<createProcedure procedureName="everyDayInitPlanTaskStatistics" > <createProcedure procedureName="everyDayInitPlanTaskStatistics" >
DROP PROCEDURE IF EXISTS `everyDayInitPlanTaskStatistics`; DROP PROCEDURE IF EXISTS `everyDayInitPlanTaskStatistics`;
</createProcedure> </createProcedure>
</changeSet> </changeSet>
<changeSet author="gaodongdong" id="1610421278000-25" runAlways="true"> <changeSet author="gaodongdong" id="1610421278000-26" runAlways="true">
<createProcedure procedureName="everyDayInitPlanTaskStatistics" > <createProcedure procedureName="everyDayInitPlanTaskStatistics" >
CREATE PROCEDURE `everyDayInitPlanTaskStatistics`() CREATE PROCEDURE `everyDayInitPlanTaskStatistics`()
BEGIN BEGIN
...@@ -560,7 +606,7 @@ ...@@ -560,7 +606,7 @@
declare planTaskFinishNum BIGINT ; declare planTaskFinishNum BIGINT ;
declare personNum BIGINT ; declare personNum BIGINT ;
DECLARE done BOOLEAN DEFAULT 0; DECLARE done BOOLEAN DEFAULT 0;
DECLARE p_p_conf CURSOR FOR select id from s_user u where u.enabled = 1 AND u.is_delete = 0; DECLARE p_p_conf CURSOR FOR select DISTINCT `status` AS id from tmp_split;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
set currentDate = SYSDATE(); set currentDate = SYSDATE();
open p_p_conf; open p_p_conf;
...@@ -602,6 +648,29 @@ ...@@ -602,6 +648,29 @@
END END
</createProcedure> </createProcedure>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="1630567666-5" runAlways="true">
<comment>创建事件planTaskStatisticsaEvent</comment>
<sql endDelimiter="#">
DROP EVENT IF EXISTS `planTaskStatisticsaEvent`#
CREATE EVENT `planTaskStatisticsaEvent`
ON SCHEDULE
EVERY '1' DAY STARTS '2021-04-14 00:02:00'
ON COMPLETION PRESERVE
DO CALL everyDayInitPlanTaskStatistics()
#
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="1630567666-6" runAlways="true">
<comment>创建事件splitStringEvent</comment>
<sql endDelimiter="#">
DROP EVENT IF EXISTS `splitStringEvent`#
CREATE EVENT `splitStringEvent`
ON SCHEDULE
EVERY '1' DAY STARTS '2021-09-02 00:00:00'
DO CALL splitString((SELECT group_concat(distinct nullif(p.user_id, '')) AS id FROM p_plan_task p),",")
#
</sql>
</changeSet>
<changeSet author="gaodongdong" id="15640410855000-5" runAlways="true"> <changeSet author="gaodongdong" id="15640410855000-5" runAlways="true">
<sql> <sql>
CREATE EVENT IF NOT EXISTS `planTaskStatisticsaEvent` ON SCHEDULE EVERY 1 DAY STARTS date_add( CREATE EVENT IF NOT EXISTS `planTaskStatisticsaEvent` ON SCHEDULE EVERY 1 DAY STARTS date_add(
......
...@@ -261,29 +261,15 @@ ...@@ -261,29 +261,15 @@
</dependencyManagement> </dependencyManagement>
<repositories> <repositories>
<repository> <repository>
<id>spring-snapshots</id> <id>Releases</id>
<url>http://172.16.1.6:8081/nexus/content/repositories/spring.io/</url> <name>Releases</name>
<url>http://172.16.1.6:8081/nexus/content/repositories/releases/</url>
</repository> </repository>
<repository> <repository>
<id>nexus</id> <id>Snapshots</id>
<name>Team Nexus Repository</name> <name>Snapshots</name>
<url>http://172.16.1.6:8081/nexus/content/groups/public</url> <url>http://172.16.1.6:8081/nexus/content/repositories/snapshots/</url>
</repository> </repository>
<repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://172.16.1.6:8081/nexus/content/repositories/maven-public/</url>
</repository>
<!-- <repository> -->
<!-- <id>maven-public1</id> -->
<!-- <name>maven-public</name> -->
<!-- <url>http://repo.typroject.org:8081/repository/maven-public/</url> -->
<!-- </repository> -->
<!-- <repository> -->
<!-- <id>maven-snapshot</id> -->
<!-- <name>maven-snapshot</name> -->
<!-- <url>http://repo.typroject.org:8081/repository/maven-snapshots/</url> -->
<!-- </repository> -->
</repositories> </repositories>
<modules> <modules>
......
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