Commit cd064445 authored by chenhao's avatar chenhao

Merge branch 'developer' into chenhao

parents 53f127a7 07c87669
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,47 @@ public class ControllerAop { ...@@ -56,52 +57,47 @@ 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 = 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 String buildPatternKey(String token) {
return "region_" + "*" + "_" + 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 +125,12 @@ public class ControllerAop { ...@@ -129,18 +125,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 +138,4 @@ public class ControllerAop { ...@@ -148,9 +138,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;
}
} }
...@@ -31,19 +31,18 @@ public class RedisKey { ...@@ -31,19 +31,18 @@ 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 * 创建redis key
*
* @param token * @param token
* @return * @return String
*/ */
public static String buildKey(String token) { public static String buildReginKey(String userId, String token) {
return "region_" + token; return "biz_" + userId + "_" + 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
...@@ -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);
......
...@@ -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));
} }
......
...@@ -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"));
} }
......
...@@ -208,7 +208,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -208,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());
......
...@@ -267,7 +267,7 @@ public class DataSourcesImpl implements DataSources { ...@@ -267,7 +267,7 @@ public class DataSourcesImpl implements DataSources {
for (Object orgMenuDto : menus) { for (Object orgMenuDto : menus) {
JSONObject detailObject = JSONObject.parseObject(orgMenuDto.toString()); JSONObject detailObject = JSONObject.parseObject(orgMenuDto.toString());
if (detailObject.containsKey("id")) { if (detailObject.containsKey("id")) {
stringList.add(detailObject.getString("id") + "@" + detailObject.getString("name")); stringList.add(detailObject.getString("name") + "@" + detailObject.getString("id")); // 任务3527 重点部位导出模板 id name 未正常配置 by kongfm
} }
JSONArray children = detailObject.getJSONArray("children"); JSONArray children = detailObject.getJSONArray("children");
if (children != null && children.size() > 0) { if (children != null && children.size() > 0) {
......
...@@ -102,11 +102,21 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -102,11 +102,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;
...@@ -316,4 +326,18 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire ...@@ -316,4 +326,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());
}
}
}
} }
...@@ -532,6 +532,7 @@ public class CheckController extends AbstractBaseController { ...@@ -532,6 +532,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;
......
...@@ -429,7 +429,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -429,7 +429,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 +437,8 @@ public class CheckServiceImpl implements ICheckService { ...@@ -437,8 +437,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 +446,20 @@ public class CheckServiceImpl implements ICheckService { ...@@ -446,7 +446,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.getPlanType());
target.put("isOkDesc", checkStatusEnum != null ? checkStatusEnum.getName() : "");
}
return target;
}).collect(Collectors.toList());
return new PageImpl<>(content, pageable, page.getTotalElements());
} }
@Override @Override
......
...@@ -269,7 +269,14 @@ public interface ICheckService { ...@@ -269,7 +269,14 @@ public interface ICheckService {
*/ */
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);
/** /**
* 维保检查项详情 * 维保检查项详情
......
...@@ -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;
}
}
}
}
...@@ -163,7 +163,11 @@ ...@@ -163,7 +163,11 @@
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-1"> <changeSet author="litengwei" id="2021-09-01-litengwei-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" /> <tableExists tableName="cb_data_dictionary" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions> </preConditions>
<comment>add data cb_data_dictionary</comment> <comment>add data cb_data_dictionary</comment>
<sql> <sql>
...@@ -186,7 +190,11 @@ ...@@ -186,7 +190,11 @@
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-2"> <changeSet author="litengwei" id="2021-09-01-litengwei-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_form" /> <tableExists tableName="jc_alert_form" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions> </preConditions>
<comment>add data jc_alert_form</comment> <comment>add data jc_alert_form</comment>
<sql> <sql>
...@@ -198,7 +206,11 @@ ...@@ -198,7 +206,11 @@
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-09-01-litengwei-3"> <changeSet author="litengwei" id="2021-09-01-litengwei-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="jc_alert_form" /> <tableExists tableName="jc_alert_form" />
<primaryKeyExists primaryKeyName="sequence_nbr" tableName="cb_data_dictionary"/>
</preConditions> </preConditions>
<comment>update data jc_alert_form</comment> <comment>update data jc_alert_form</comment>
<sql> <sql>
...@@ -217,4 +229,45 @@ ...@@ -217,4 +229,45 @@
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>
</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>
......
...@@ -2068,7 +2068,8 @@ ...@@ -2068,7 +2068,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(
......
...@@ -256,29 +256,15 @@ ...@@ -256,29 +256,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