Commit 32e7af7c authored by tianbo's avatar tianbo

防火监督-隐患修改

parent 2c98629f
package com.yeejoin.amos.boot.biz.common.utils;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public enum CodeInfoEnum {
LOCK(1L, 1L, "LOCK_TYPE", "LOCK"), UNLOCK(1L, 2L, "LOCK_TYPE", "LOCK");
public Long classId;
public Long infoId;
public String classCode;
public String infoCode;
CodeInfoEnum(Long classId, Long infoId, String classCode, String infoCode) {
this.classId = classId;
this.infoId = infoId;
this.classCode = classCode;
this.infoCode = infoCode;
}
public static CodeInfoEnum getByInfoId(Long infoId) {
return CodeInfoEnum.valueOf(infoId + "");
}
public static List getByClassId(Long classId) {
return Arrays.stream(CodeInfoEnum.values()).filter(item -> item.classId.equals(classId)).collect(Collectors.toList());
}
public static CodeInfoEnum getByClassCodeAndInfoCode(String classCode, String infoCode) {
Optional opt = Arrays.stream(CodeInfoEnum.values()).filter(item -> item.classCode.equals(classCode) && item.infoCode.equals(infoCode)).findFirst();
return (CodeInfoEnum) opt.orElse(null);
}
@Override
public String toString() {
return "CodeInfoEnum{" +
"classId=" + classId +
", infoId=" + infoId +
", classCode='" + classCode + '\'' +
", infoCode='" + infoCode + '\'' +
'}';
}
}
...@@ -12,7 +12,12 @@ import java.util.ArrayList; ...@@ -12,7 +12,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class DynamicEnumUtils { /**
* 动态枚举工具类
*
* @author DELL
*/
public class DynamicEnumUtil {
private static ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory(); private static ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
private static void setFailsafeFieldValue(Field field, Object target, Object value) throws NoSuchFieldException, private static void setFailsafeFieldValue(Field field, Object target, Object value) throws NoSuchFieldException,
...@@ -49,8 +54,10 @@ public class DynamicEnumUtils { ...@@ -49,8 +54,10 @@ public class DynamicEnumUtils {
} }
private static void cleanEnumCache(Class<?> enumClass) throws NoSuchFieldException, IllegalAccessException { private static void cleanEnumCache(Class<?> enumClass) throws NoSuchFieldException, IllegalAccessException {
blankField(enumClass, "enumConstantDirectory"); // Sun (Oracle?!?) JDK 1.5/6 // Sun (Oracle?!?) JDK 1.5/6
blankField(enumClass, "enumConstants"); // IBM JDK blankField(enumClass, "enumConstantDirectory");
// IBM JDK
blankField(enumClass, "enumConstants");
} }
private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes) private static ConstructorAccessor getConstructorAccessor(Class<?> enumClass, Class<?>[] additionalParameterTypes)
...@@ -64,24 +71,25 @@ public class DynamicEnumUtils { ...@@ -64,24 +71,25 @@ public class DynamicEnumUtils {
private static Object makeEnum(Class<?> enumClass, String value, int ordinal, Class<?>[] additionalTypes, private static Object makeEnum(Class<?> enumClass, String value, int ordinal, Class<?>[] additionalTypes,
Object[] additionalValues) throws Exception { Object[] additionalValues) throws Exception {
Object[] parms = new Object[additionalValues.length + 2]; Object[] params = new Object[additionalValues.length + 2];
parms[0] = value; params[0] = value;
parms[1] = Integer.valueOf(ordinal); params[1] = Integer.valueOf(ordinal);
System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length); System.arraycopy(additionalValues, 0, params, 2, additionalValues.length);
return enumClass.cast(getConstructorAccessor(enumClass, additionalTypes).newInstance(parms)); return enumClass.cast(getConstructorAccessor(enumClass, additionalTypes).newInstance(params));
} }
/** /**
* 将枚举实例添加到作为参数提供的枚举类中 * 将枚举实例添加到作为参数提供的枚举类中
* *
* @param <T>
* @param enumType 要修改的枚举类型 * @param enumType 要修改的枚举类型
* @param enumName 添加的枚举类型名字 * @param enumName 添加的枚举类型名字
* @param additionalTypes 枚举类型参数类型列表 * @param additionalTypes 枚举类型参数类型列表
* @param additionalValues 枚举类型参数值列表 * @param additionalValues 枚举类型参数值列表
* @param <T> * @return
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T extends Enum<?>> void addEnum(Class<T> enumType, String enumName, Class<?>[] additionalTypes, Object[] additionalValues) { public static <T extends Enum<?>> T addEnum(Class<T> enumType, String enumName, Class<?>[] additionalTypes, Object[] additionalValues) {
// 0. 检查类型 // 0. 检查类型
if (!Enum.class.isAssignableFrom(enumType)) { if (!Enum.class.isAssignableFrom(enumType)) {
...@@ -115,70 +123,9 @@ public class DynamicEnumUtils { ...@@ -115,70 +123,9 @@ public class DynamicEnumUtils {
// 6. 清楚枚举的缓存 // 6. 清楚枚举的缓存
cleanEnumCache(enumType); cleanEnumCache(enumType);
return newValue;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e);
} }
} }
public static void main(String[] args) {
//
synchronized (CodeInfoEnum.class) {
addEnum(CodeInfoEnum.class, "3", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{2L, 3L, "ActiveStatus", "Active"});
addEnum(CodeInfoEnum.class, "4", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{2L, 4L, "ActiveStatus", "Inactive"});
addEnum(CodeInfoEnum.class, "5", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{3L, 5L, "Optype", "OP1"});
addEnum(CodeInfoEnum.class, "6", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{3L, 6L, "Optype", "OP2"});
addEnum(CodeInfoEnum.class, "7", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{3L, 7L, "Optype", "OP3"});
addEnum(CodeInfoEnum.class, "8", new Class[]{Long.class, Long.class, String.class, String.class}, new Object[]{3L, 8L, "Optype", "OP4"});
}
CodeInfoEnum codeInfoEnum = CodeInfoEnum.valueOf("5");
System.out.println(codeInfoEnum);
// Run a few tests just to show it works OK.
System.out.println(Arrays.deepToString(CodeInfoEnum.values()));
System.out.println("============================打印所有枚举(包括固定的和动态的),可以将数据库中保存的CIC以枚举的形式加载到JVM");
for (CodeInfoEnum codeInfo : CodeInfoEnum.values()) {
System.out.println(codeInfo.toString());
}
System.out.println("============================通过codeId找到的枚举,用于PO转VO的处理");
CodeInfoEnum activeStatus_Active = CodeInfoEnum.getByInfoId(3L);
System.out.println(activeStatus_Active);
System.out.println("============================通过ClassId找到的枚举列表");
List<CodeInfoEnum> activeStatusEnumList = CodeInfoEnum.getByClassId(3L);
for (CodeInfoEnum codeInfo : activeStatusEnumList) {
System.out.println(codeInfo);
}
System.out.println("============================通过ClassCode和InfoCode获取枚举,用于导入验证CIC合法性");
CodeInfoEnum toGetActiveStatus_Active = CodeInfoEnum.getByClassCodeAndInfoCode("ActiveStatus", "Active");
System.out.println(toGetActiveStatus_Active);
System.out.println("============================通过ClassCode和InfoCode获取枚举,输入不存在的Code,则返回NULL");
CodeInfoEnum toGetActiveStatus_miss = CodeInfoEnum.getByClassCodeAndInfoCode("ActiveStatus", "MISS");
System.out.println(toGetActiveStatus_miss);
}
} }
\ No newline at end of file
...@@ -168,20 +168,25 @@ public interface EquipFeignClient { ...@@ -168,20 +168,25 @@ public interface EquipFeignClient {
@RequestMapping(value = "/car/simple/{id}", method = RequestMethod.GET) @RequestMapping(value = "/car/simple/{id}", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> queryCarSimpleInfoById(@PathVariable Long id); ResponseModel<Map<String, Object>> queryCarSimpleInfoById(@PathVariable Long id);
/** /**
* 统计 * 统计
**/ **/
@RequestMapping(value = "/equipSpecificAlarm/getCountAlarm/{type}", method = RequestMethod.GET) @RequestMapping(value = "/equipSpecificAlarm/getCountAlarm/{type}", method = RequestMethod.GET)
ResponseModel<Integer> getCountAlarm(@PathVariable String type); ResponseModel<Integer> getCountAlarm(@PathVariable String type);
/** /**
* 统计 * 统计
**/ **/
@RequestMapping(value = "/equipSpecificAlarm/getcountAlarmHandle/{type}", method = RequestMethod.GET) @RequestMapping(value = "/equipSpecificAlarm/getcountAlarmHandle/{type}", method = RequestMethod.GET)
ResponseModel<Integer> getcountAlarmHandle(@PathVariable String type); ResponseModel<Integer> getcountAlarmHandle(@PathVariable String type);
/**
* 获取装备全路径
*
* @return Map<String, Object>
**/
@RequestMapping(value = "/building/getBuildingAbsolutePosition", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getBuildingAbsolutePosition();
} }
package com.yeejoin.amos.boot.module.common.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* 防火监督服务feign
*
* @author Dell
*/
@FeignClient(name = "${supervision.feign.name}", path = "equip", configuration = {MultipartSupportConfig.class})
public interface SupervisionFeignClient {
/**
* 获取巡检隐患相关数据
*
* @param param
* @return
*/
@RequestMapping(value = "/patrol/danger/info", method = RequestMethod.GET)
ResponseModel<Object> getPatrolDangerInfo(@RequestBody Object param);
}
...@@ -24,5 +24,6 @@ ...@@ -24,5 +24,6 @@
<module>amos-boot-module-maintenance-api</module> <module>amos-boot-module-maintenance-api</module>
<module>amos-boot-module-supervision-api</module> <module>amos-boot-module-supervision-api</module>
<module>amos-boot-module-knowledgebase-api</module> <module>amos-boot-module-knowledgebase-api</module>
<module>amos-boot-module-latentdanger-api</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-supervision-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions> <exclusions>
...@@ -102,6 +97,12 @@ ...@@ -102,6 +97,12 @@
<groupId>cn.jpush.api</groupId> <groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId> <artifactId>jpush-client</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-supervision-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -39,6 +39,8 @@ import com.yeejoin.amos.supervision.core.common.response.DangerListResponse; ...@@ -39,6 +39,8 @@ import com.yeejoin.amos.supervision.core.common.response.DangerListResponse;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
@RestController @RestController
@RequestMapping(value = "/api/latent/danger") @RequestMapping(value = "/api/latent/danger")
...@@ -298,4 +300,11 @@ public class LatentDangerController extends AbstractBaseController { ...@@ -298,4 +300,11 @@ public class LatentDangerController extends AbstractBaseController {
return CommonResponseUtil.failure(e.getMessage()); return CommonResponseUtil.failure(e.getMessage());
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检隐患信息", notes = "查询巡检隐患信息")
@GetMapping(value = "/patrol/danger/info")
public CommonResponse getPatrolDangerInfo(@RequestParam JSONObject param) {
return CommonResponseUtil.success(iLatentDangerService.getPatrolDangerInfo(param));
}
} }
...@@ -106,6 +106,7 @@ import com.yeejoin.amos.supervision.dao.entity.Check; ...@@ -106,6 +106,7 @@ import com.yeejoin.amos.supervision.dao.entity.Check;
import com.yeejoin.amos.supervision.dao.entity.CheckShot; import com.yeejoin.amos.supervision.dao.entity.CheckShot;
import com.yeejoin.amos.supervision.dao.entity.InputItem; import com.yeejoin.amos.supervision.dao.entity.InputItem;
import com.yeejoin.amos.supervision.dao.entity.PointClassify; import com.yeejoin.amos.supervision.dao.entity.PointClassify;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
@Service("latentDangerService") @Service("latentDangerService")
public class LatentDangerServiceImpl implements ILatentDangerService { public class LatentDangerServiceImpl implements ILatentDangerService {
...@@ -204,8 +205,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -204,8 +205,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
userId, departmentId, businessKey, orgCode, latentDangerParam.getDangerName(), latentDangerParam.getDangerLevel() userId, departmentId, businessKey, orgCode, latentDangerParam.getDangerName(), latentDangerParam.getDangerLevel()
, latentDangerParam.getDangerPosition(), LatentDangerTypeEnum.随手拍, , latentDangerParam.getDangerPosition(), LatentDangerTypeEnum.随手拍,
latentDangerParam.getPhotoUrls(), 0L, latentDangerParam.getStructureId(), latentDangerParam.getStructureName(), InstanceKeyEnum.NORMAL.getCode()); latentDangerParam.getPhotoUrls(), 0L, latentDangerParam.getStructureId(), latentDangerParam.getStructureName(), InstanceKeyEnum.NORMAL.getCode());
// 更新p_check_input表state字段 // 更新p_check_input表state字段(非巡检隐患不需要更新该表)
updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode()); // updateCheckInputDangerState(latentDangerBo.getCheckInputId(), DangerHandleStateEnum.HANDLE.getCode());
Long dangerId = latentDangerBo.getId(); Long dangerId = latentDangerBo.getId();
Date startDate = new Date(); Date startDate = new Date();
JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey); JSONObject jsonObject = remoteWorkFlowService.startNew(dangerId, businessKey, processDefinitionKey);
...@@ -1654,4 +1655,22 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1654,4 +1655,22 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
} }
return informerList; return informerList;
} }
@Override
public JSONObject getPatrolDangerInfo(JSONObject param) {
if (ValidationUtil.isEmpty(param)) {
return null;
}
JSONObject result = new JSONObject();
String checkId = (String) param.get("checkId");
String itemId = (String) param.get("itemId");
String routePointItemId = (String) param.get("routePointItemId");
result.put("inputCheck", null);
result.put("inputItemName", null);
result.put("photos", null);
result.put("checkMode", null);
result.put("checkType", null);
return result;
}
} }
...@@ -81,4 +81,12 @@ public interface ILatentDangerService { ...@@ -81,4 +81,12 @@ public interface ILatentDangerService {
List<DangerListResponse> export(PageParam pageParam); List<DangerListResponse> export(PageParam pageParam);
List<DangerTimeAxisVo> queryExecuteLog(Integer dateTime); List<DangerTimeAxisVo> queryExecuteLog(Integer dateTime);
/**
* 根据参数获取巡检隐患信息
*
* @param param
* @return
*/
JSONObject getPatrolDangerInfo(JSONObject param);
} }
...@@ -51,5 +51,6 @@ ...@@ -51,5 +51,6 @@
<module>amos-boot-module-fas-biz</module> <module>amos-boot-module-fas-biz</module>
<module>amos-boot-module-maintenance-biz</module> <module>amos-boot-module-maintenance-biz</module>
<module>amos-boot-module-supervision-biz</module> <module>amos-boot-module-supervision-biz</module>
<module>amos-boot-module-latentdanger-biz</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -294,5 +294,6 @@ ...@@ -294,5 +294,6 @@
<module>amos-boot-system-supervision</module> <module>amos-boot-system-supervision</module>
<module>amos-boot-core</module> <module>amos-boot-core</module>
<module>amos-boot-utils</module> <module>amos-boot-utils</module>
<module>amos-boot-system-latentdanger</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
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