Merge branch '2.0.0-release' of http://nonxin.cn:8090/r/product/product-server/V2.0.0
# Conflicts:
# pom.xml
| | |
| | | <mapping directory="$PROJECT_DIR$/product-server-data-export-import" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-data-sync" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-datasource" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-device" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-email" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-file" vcs="Git" /> |
| | | <mapping directory="$PROJECT_DIR$/product-server-lucene" vcs="Git" /> |
| | |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.lx</groupId> |
| | | <artifactId>product-server-org-admin</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.lx</groupId> |
| | | <artifactId>product-server-util</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>com.lx</groupId> |
| | | <artifactId>product-server-task</artifactId> |
| | | <version>2.1.0-release</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
| | |
| | | package com.product.device.config; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.Format; |
| | | |
| | | import com.product.common.enums.IEnum; |
| | | import com.product.common.enums.ModuleEnum; |
| | | import com.product.core.config.Global; |
| | | import com.product.util.BaseUtil; |
| | | |
| | | /** |
| | | * Copyright © 2019. |
| | |
| | | */ |
| | | public enum DeviceCode implements IEnum { |
| | | |
| | | SYSTEM_OPERATION_SUCCESS("成功", "200"), |
| | | SYSTEM_FORM_NODATA("请求参数为空", ModuleEnum.DEVICE.getValue() + "001"), |
| | | DEVICE_CREATE_INSPECTION_ERROR("创建设备点检错误", ModuleEnum.DEVICE.getValue() + "002"), |
| | | DEVICE_CREATE_FAILURE_ERROR("创建设备故障错误", ModuleEnum.DEVICE.getValue() + "003"), |
| | | SYSTEM_OPERATION_SUCCESS("成功", 200), |
| | | SYSTEM_FORM_NODATA("请求参数为空", 999), |
| | | SYSTEM_FORM_COUNT("请求参数有误", 998), |
| | | SYSTEM_TABLE_NODATA("请求表名有误", 997), |
| | | SYSTEM_CPAGES_NOT_NULL("分页参数不能为空", 996), |
| | | SYSTEM_LOGIN_USER_FAIL("获取当前登录人失败", 995), |
| | | |
| | | |
| | | COMMON_GET_WAREHOUSE_KEEPER_FAIL("获取库管员失败", 1), |
| | | COMMON_UNKNOWN_ERROR("未知异常", 2), |
| | | COMMON_DATA_ERROR("数据异常", 3), |
| | | |
| | | ARCHIVES_SAVE_FAIL("设备档案保存", 4), |
| | | ARCHIVES_DELETE_FAIL("设备档案删除", 5), |
| | | |
| | | DEVICE_CREATE_INSPECTION_ERROR("创建设备点检错误", 4), |
| | | DEL_PRINT_CONFIG_DATA_FAIL("删除配置数据失败", 6), |
| | | DEVICE_ARCHIVES_OPERATE_FAIL("电梯档案操作失败:", 7), |
| | | SAVE_PATROL_CONFIG_ERROR("电梯设备巡检项目操作失败", 8), |
| | | DEVICE_MAINTENANCE_REVIEW_FAIL("设备维保复核失败", 9), |
| | | DEVICE_MAINTENANCE_YEAR_FAIL("获取维保单位年度维保统计失败", 10), |
| | | DEVICE_MAINTENANCE_YEAR_FINISH_FAIL("获取维保单位年度维保任务完成情况失败", 11), |
| | | |
| | | |
| | | //设备点检 |
| | | DEVICE_INSPECTION_ITEM_OPERATE_FAIL("点检项目操作错误:", 12), |
| | | DEVICE_INSPECTION_ITEM_DELETE_FAIL("点检项目删除失败", 13), |
| | | DEVICE_INSPECTION_ITEM_HAS_REFERENCED("点检项目已被引用,不能删除", 14), |
| | | DEVICE_INSPECTION_CONFIG_OPERATE_FIAL("点检配置操作错误:", 15), |
| | | DEVICE_INSPECTION_CONFIG_SAVE_FIAL("点检配置保存错误", 16), |
| | | DEVICE_INSPECTION_RECORD_OPERATE_FIAL("点检记录操作错误:", 17), |
| | | DEVICE_INSPECTION_RECORD_SAVEE_FIAL("点检记录保存失败", 18), |
| | | |
| | | //设备保养 |
| | | DEVICE_MAINTENANCE_CONTENT_OPERATE_FAIL("保养项目操作错误:", 19), |
| | | DEVICE_MAINTENANCE_CONTENT_DEL_FAIL("保养内容删除失败", 20), |
| | | DEVICE_MAINTENANCE_CONTENT_HAS_REFERENCED("保养内容已被引用,不能删除", 21), |
| | | DEVICE_MAINTENANCE_CONFIG_OPERATE_FAIL("保养配置操作错误:", 22), |
| | | DEVICE_MAINTENANCE_CONFIG_SAVE_FAIL("保养配置保存失败", 23), |
| | | DEVICE_MAINTENANCE_PLAN_OPERATE_FAIL("保养计划操作错误:", 24), |
| | | DEVICE_MAINTENANCE_PLAN_SAVE_FAIL("保养计划保存失败", 25), |
| | | DEVICE_MAINTENANCE_PLAN_HAS_BEGIN("保养计划已经开始", 26), |
| | | DEVICE_MAINTENANCE_PLAN_HAS_COMMON_PLAN("同年度同保养类型计划已经创建", 27), |
| | | DEVICE_MAINTENANCE_PLAN_HAS_NO_CONFIG("没有配置对应类型的保养设备", 28), |
| | | DEVICE_MAINTENANCE_RECORD_OPERATE_FAIL("保养记录操作错误:", 29), |
| | | DEVICE_MAINTENANCE_TAK_COMPLETE_FAIL("保养任务完成失败", 30), |
| | | |
| | | //设备任务 |
| | | DEVICE_TASK_TYPE_NO_EXIST("任务类型数据不存在", 31), |
| | | DEVICE_TASK_DATA_NO_EXIST("设备任务数据不存在", 32), |
| | | DEVICE_TASK_CREATE_FAIL_PARAM_ERROR("参数异常,发起任务失败,", 33), |
| | | DEVICE_TASK_COMPLETE_FAIL_TASK_NO_EXIST("任务完成失败,任务数据不存在!", 34), |
| | | DEVICE_TASK_COMPLETE_FAIL_TASK_OWNER_MISMATCH("当前办理人与串行任务节点办理人不匹配", 35), |
| | | DEVICE_TASK_HAS_FINISH("任务已经结束,无需再次办理", 36), |
| | | DEVICE_TASK_WAREHOUSE_KEPPER_NO_EXIST("库管员不存在", 37), |
| | | |
| | | //备件档案 |
| | | SPARE_PART_ARCHIVE_OPERATE_FIAL("备件档案操作错误:", 38), |
| | | SPARE_PART_ARCHIVE_DELETE_FIAL("备件档案删除失败", 39), |
| | | SPARE_PART_ARCHIVE_DELETE_FIAL_DATA_REFERENCED("备件档案删除失败,数据已被引用", 40), |
| | | SPARE_PART_ARCHIVE_NEED_BAECODE_UNIT("需要指定且仅能指定一个单位为条码单位,请联系管理员在备件档案进行设置!", 41), |
| | | SPARE_PART_ARCHIVE_GET_BASE_UNIT_FAIL("基本单位获取失败", 42), |
| | | |
| | | //备件采购申请 |
| | | SPARE_PART_PURCHASE_APPLY_OPERATE_FIAL("备件采购申请操作失败:", 43), |
| | | SPARE_PART_PURCHASE_APPLY_DELETE_FIAL("备件采购申请操作失败:", 44), |
| | | SPARE_PART_PURCHASE_APPLY_DELETE_FIAL_DATA_REFERENCED("备件档案删除失败,数据已被引用", 45), |
| | | SPARE_PART_PURCHASE_APPLY_CONFIRM("该采购申请单已经被库管确认,无法更改!", 46), |
| | | SPARE_PART_PURCHASE_APPLY_SUB_LIST_FAIL("未生成订单的采购申请单明细获取失败:", 47), |
| | | |
| | | //备件采购订单 |
| | | SPARE_PART_PURCHASE_ORDER_OPERATE_FIAL("备件采购申请操作失败:", 48), |
| | | SPARE_PART_PURCHASE_ORDER_PARTIAL_WAREHOUSING("已存在部分子表数据入库,无法删除", 49), |
| | | SPARE_PART_PURCHASE_ORDER_SELECT_ONE_SUPPLIER_ORDER("只能选择一家供应商的订单", 50), |
| | | |
| | | //备件入库 |
| | | SPARE_PART_WAREHOUSE_IN_OPERATE_FIAL("备件入库操作失败:", 51), |
| | | SPARE_PART_WAREHOUSE_IN_SAVE_FIAL("备件入库保存失败", 52), |
| | | SPARE_PART_WAREHOUSE_IN_SUB_OPERATE_FIAL("备件采购申请子表操作失败:", 53), |
| | | |
| | | //备件领用 |
| | | SPARE_PART_RECEIVE_OPERATE_FAIL("备件领用操作失败:", 54), |
| | | SPARE_PART_RECEIVE_SUB_LIST_BY_REPAIR_FAIL("维修备件领用明细获取失败", 55), |
| | | SPARE_PART_RECEIVE_SUB_LIST_BY_MAINTENANCE_FAIL("维修备件领用明细获取失败", 56), |
| | | SPARE_PART_RECEIVE_SUB_DETAIL_OPERATE_FAIL("备件领用明细操作失败:", 57), |
| | | SPARE_PART_RECEIVE_SUB_SPLIT_OPERATE_FAIL("备件领用拆件操作失败:", 58), |
| | | SPARE_PART_RECEIVE_TASK_HAS_SEND("任务已发起或已结束,请勿重复发起任务", 59), |
| | | |
| | | //备件归还 |
| | | SPARE_PART_RETURN_OPERATE_FAIL("备件归还操作失败:", 60), |
| | | SPARE_PART_RETURN_DELETE_FIAL("备件归还删除失败", 61), |
| | | SPARE_PART_RETURN_DELETE_FIAL_DATA_REFERENCED("备件归还删除失败,数据已被引用", 62), |
| | | |
| | | //备件库存 |
| | | SPARE_PART_STOCK_OPERATE_FAIL("备件库存操作失败:", 63), |
| | | SPARE_PART_STOCK_ARCHIVE_PARAM_NO_UPLOAD("备件档案参数未上传,无法进行计算", 64), |
| | | SPARE_PART_SROCK_SPECIFY_BARCODE_SPLIT("请指定一个条码进行拆件", 65), |
| | | SPARE_PART_SROCK_SPLIT_METHOD_UNREASONABLE("拆件方式不合理,请重新选择", 66), |
| | | SPARE_PART_STOCK_DISABLED_OR_NO_EXIST_UNIT("禁用或者未录入到系统的单位,无法进行计算,单位uuid:%s", 67), |
| | | SPARE_PART_STOCK_CANNOT_GET_ARCHIVE_UNIT("未获取到备件档案id为【%s】的单位", 68), |
| | | |
| | | //备件报废 |
| | | SPARE_PART_SCRAPE_OPERATE_FAIL("备件报废操作失败:", 69), |
| | | SPARE_PART_SCRAPE_DELETE_FIAL("备件报废删除失败", 70), |
| | | SPARE_PART_SCRAPE_DELETE_FIAL_DATA_REFERENCED("备件报废删除失败,数据已被引用", 71), |
| | | |
| | | //库存盘点 |
| | | SPARE_PART_INVENTORY_OPERATE_FAIL("备件库存操作失败:", 72), |
| | | SPARE_PART_INVENTORY_PARSE_ERROR("错误的参数,解析失败", 73), |
| | | |
| | | |
| | | DEVICE_RECORD_SAVE_FAIL("{&device.name(设备)&}台账保存失败", 74), |
| | | |
| | | DEVICE_RECORD_FIND_FAIL("{&device.name(设备)&)台账详情查询失败", 75), |
| | | DEVICE_RECORD_FIND_ALL_FAIL("{&device.name(设备)&}台账查询失败", 76), |
| | | TASK_FIELDSET_NOT_FIND_ERROR("未找到设备保养信息", 77), |
| | | |
| | | INSPECTION_PLAN_CONFIG_LIST_FIND_FAIL("设备点检计划配置查询失败", 78), |
| | | |
| | | GET_INSPECTION_PLAN_DETAIL_LIST_FAIL("获取点检计划明细失败", 79), |
| | | ; |
| | | |
| | | private String text; |
| | | private String value; |
| | | private int value; |
| | | |
| | | private DeviceCode(String text, String value) { |
| | | private DeviceCode(String text, int value) { |
| | | this.text = text; |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getText() { |
| | | try { |
| | | //使用正则匹配text中的特殊表达式以{&开头,&}结尾,获取到其中的内容 |
| | | String regex = "\\{&(.+?)&\\}"; |
| | | String result = this.text; |
| | | if (this.text.matches(regex)) { |
| | | result = this.text.replaceAll(regex, "$1"); |
| | | } |
| | | String defaultValue = null; |
| | | //截取result中以(开头,)结尾的内容 |
| | | if (result.contains("(") && result.contains(")")) { |
| | | defaultValue = result.substring(0, result.indexOf("(")); |
| | | } |
| | | //去掉result中 (开头,)结尾的内容 包含括号 |
| | | result = result.replaceAll("\\(.*?\\)", ""); |
| | | //获取系统配置中的值 |
| | | return BaseUtil.ifNull(Global.getSystemConfig(result, defaultValue),text); |
| | | } catch (Exception e) { |
| | | return text; |
| | | } |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | Format format = new DecimalFormat("000"); |
| | | return ModuleEnum.DEVICE.getValue() + format.format(this.value); |
| | | } |
| | | } |
| | |
| | | package com.product.device.config; |
| | | |
| | | |
| | | import com.product.core.config.CoreConst; |
| | | |
| | | /** |
| | | * Copyright LX-BASE |
| | | * |
| | |
| | | * @Author: LiuChao |
| | | * @Description: |
| | | */ |
| | | public class DeviceConst { |
| | | public class DeviceConst extends CoreConst { |
| | | |
| | | //特殊变量 |
| | | public static final int DEVICE_DATA_SOCKET_PORT=8899; |
| | | public static final String STANDARD_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String STANDARD_YEAR_FORMAT = "yyyy"; |
| | | public static final String CPAGE="cpage"; |
| | | public static final String PAGESIZE="pagesize"; |
| | | public static final String DAYS="DAYS"; |
| | | public static final String WEEKS="WEEKS"; |
| | | public static final String MONTHS="MONTHS"; |
| | | public static final String TASK_STATUS_START = "0"; |
| | | public static final String TASK_STATUS_FINAL = "99"; |
| | | |
| | | // 任务类型 |
| | | public static final String TASK_TYPE_SPOT_CHECK = "0"; |
| | | public static final String TASK_TYPE_MAINTENANCE = "1";//保养任务 |
| | | public static final String TASK_TYPE_REPAIR = "2"; |
| | | public static final String TASK_TYPE_IDENTIFY = "3"; |
| | | public static final String TASK_TYPE_SPOT_CHECK_REVIEW = "4"; |
| | | public static final String TASK_TYPE_MAINTENANCE_REVIEW = "5"; |
| | | public static final String TASK_TYPE_REPAIR_REVIEW = "6"; |
| | | public static final String TASK_TYPE_DISPATCH = "7"; |
| | | public static final String TASK_TYPE_MOLD_RECEIVE = "8"; |
| | | public static final String TASK_TYPE_MOLD_RETURN = "9"; |
| | | public static final String TASK_TYPE_PURCHASE_APPLY = "10"; |
| | | public static final String TASK_TYPE_PURCHASE_INBOUND = "11"; |
| | | public static final String TASK_TYPE_COMPONENT_RECEIVE = "12"; |
| | | public static final String TASK_TYPE_COMPONENT_RETURN = "13"; |
| | | public static final String TASK_TYPE_COMPONENT_SCRAP = "14"; |
| | | |
| | | // 任务标题 |
| | | public static final String TASK_TITLE_FORMAT_SPOT_CHECK = "设备点检-%s"; |
| | | public static final String TASK_TITLE_FORMAT_MAINTENANCE = "设备保养-%s-%s"; |
| | | public static final String TASK_TITLE_FORMAT_REPAIR = "设备维修-%s-%s"; |
| | | public static final String TASK_TITLE_FORMAT_IDENTIFY = "设备鉴定-%s"; |
| | | public static final String TASK_TITLE_FORMAT_SPOT_CHECK_REVIEW = "设备点检复核-%s"; |
| | | public static final String TASK_TITLE_FORMAT_MAINTENANCE_REVIEW = "设备保养复核-%s-%s"; |
| | | public static final String TASK_TITLE_FORMAT_REPAIR_REVIEW = "设备维修复核-%s-%s"; |
| | | public static final String TASK_TITLE_FORMAT_DISPATCH = "派单任务-%s"; |
| | | public static final String TASK_TITLE_FORMAT_MOLD_RECEIVE = "模具领用-%s"; |
| | | public static final String TASK_TITLE_FORMAT_MOLD_RETURN = "模具归还-%s"; |
| | | public static final String TASK_TITLE_FORMAT_PURCHASE_APPLY = "采购申请-%s"; |
| | | public static final String TASK_TITLE_FORMAT_PURCHASE_INBOUND = "采购入库-%s"; |
| | | public static final String TASK_TITLE_FORMAT_COMPONENT_RECEIVE = "备件领用-%s"; |
| | | public static final String TASK_TITLE_FORMAT_COMPONENT_RETURN = "备件归还-%s"; |
| | | public static final String TASK_TITLE_FORMAT_COMPONENT_SCRAP = "备件报废-%s"; |
| | | |
| | | |
| | | // 表名 |
| | | public static final String TABLE_PRODUCT_DEVICE_TASK="product_device_task"; |
| | | public static final String TABLE_PRODUCT_DEVICE_ARCHIVE="product_device_archives"; |
| | | public static final String TABLE_PRODUCT_INSPECT_CONFIG="product_device_inspection_config"; |
| | | public static final String TABLE_PRODUCT_DEVICE_INSPECT_ITEM_CONFIG="product_device_inspection_item_config"; |
| | | public static final String TABLE_PRODUCT_INSPECT_SETTING="product_device_inspection_setting"; |
| | | public static final String TABLE_PRODUCT_INSPECT_SETTING_SUB="product_device_inspection_setting_sub"; |
| | | public static final String TABLE_PRODUCT_REPAIR_FAILURE="product_device_repair_failure_record"; |
| | | public static final int DEVICE_DATA_SOCKET_PORT=8899; |
| | | public static final String TABLE_PRODUCT_INSPECTION_SETTING="product_device_inspection_setting"; |
| | | public static final String TABLE_PRODUCT_MAINTENANCE_SETTING="product_device_maintenance_setting"; |
| | | public static final String TABLE_PRODUCT_PATROL_RECORD="product_device_patrol_record"; |
| | | public static final String TABLE_PRODUCT_PATROL_SETTING="product_device_patrol_setting"; |
| | | public static final String TABLE_PRODUCT_PATROL_RECORD_SUB="product_device_patrol_record_sub"; |
| | | public static final String PRODUCT_DEVICE_ARCHIVES = "product_device_archives";// 设备管理 |
| | | public static final String PRODUCT_DEVICE_INFO="product_device_info"; |
| | | public static final String PRODUCT_DEVICE_TASK="product_device_task"; |
| | | public static final String PRODUCT_DEVICE_TASK_TYPE="product_device_task_type"; |
| | | public static final String PRODUCT_DEVICE_UNIT="product_device_unit"; |
| | | public static final String PRODUCT_DEVICE_UNIT_SUB="product_device_unit_sub"; |
| | | public static final String PRODUCT_DEVICE_INSPECTION_RECORD="product_device_inspection_record";//设备点检记录 |
| | | public static final String PRODUCT_DEVICE_INSPECTION_RECORD_SUB="product_device_inspection_record_sub";//点检记录明细 |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_ITEM_CONFIG = "product_device_maintenance_item_config"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_ITEM_DETAIL = "product_device_maintenance_item_detail"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_PLAN = "product_device_maintenance_plan"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_PLAN_SUB = "product_device_maintenance_plan_sub"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_PLAN_CHANGE = "product_device_maintenance_plan_change"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_PLAN_CHANGE_SUB = "product_device_maintenance_plan_change_sub"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_RECORD = "product_device_maintenance_record"; |
| | | public static final String PRODUCT_DEVICE_MAINTENANCE_RECORD_SUB = "product_device_maintenance_record_sub"; |
| | | public static final String PRODUCT_DEVICE_REPAIR_RECORD = "product_device_repair_record"; |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_ARCHIVES = "product_device_spare_part_archives"; //设备备件档案 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RECEIVE = "product_device_spare_part_receive"; //设备备件领用明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_SCRAP = "product_device_spare_part_scrap"; //设备备件报废明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_ARCHIVES_PARAM = "product_device_spare_part_archives_param"; //备件档案-参数 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_ARCHIVES_UNIT = "product_device_spare_part_archives_unit"; //备件档案-单位 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_INVENTORY = "product_device_spare_part_inventory"; //盘点记录 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_INVENTORY_DETAIL = "product_device_spare_part_inventory_detail"; //盘点记录-明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_INVENTORY_PROFIT = "product_device_spare_part_inventory_profit"; //盘点记录-匿名盘盈 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_INVENTORY_PROFIT_DETAIL = "product_device_spare_part_inventory_profit_detail"; //盘点记录-匿名盘盈-明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_PURCHASE_APPLY = "product_device_spare_part_purchase_apply"; //采购申请单 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_PURCHASE_APPLY_SUB = "product_device_spare_part_purchase_apply_sub"; //采购申请单-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_PURCHASE_ORDER = "product_device_spare_part_purchase_order"; //采购订单 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_PURCHASE_ORDER_SUB = "product_device_spare_part_purchase_order_sub"; //采购订单-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RECEIVE_SUB = "product_device_spare_part_receive_sub"; //领用记录-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RECEIVE_SUB_DETAIL = "product_device_spare_part_receive_sub_detail"; //领用记录-子表-领用明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RECEIVE_SUB_SPLIT = "product_device_spare_part_receive_sub_split"; //领用记录-子表-拆件入库明细 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RETURN = "product_device_spare_part_return"; //退还记录 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_RETURN_SUB = "product_device_spare_part_return_sub"; //退还记录-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_SCRAP_SUB = "product_device_spare_part_scrap_sub"; //报废记录-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_STOCK = "product_device_spare_part_stock"; //库存 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_WAREHOUSE_IN = "product_device_spare_part_warehouse_in"; //入库单 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_WAREHOUSE_IN_SUB = "product_device_spare_part_warehouse_in_sub"; //入库单-子表 |
| | | public static final String PRODUCT_DEVICE_SPARE_PART_WAREHOUSE_IN_SUB_DETAIL = "product_device_spare_part_warehouse_in_sub_detail"; //入库单-子表-明细 |
| | | public static final String PRODUCT_DEVICE_INSPECTION_PLAN_SETTING = "product_device_inspection_plan_setting"; //点检计划配置表 |
| | | public static final String PRODUCT_DEVICE_INSPECTION_SETTING = "product_device_inspection_setting"; //点检配置表 |
| | | |
| | | //字段 |
| | | public static final String DEVICE_QR_CODE= "device_qr_code"; |
| | | public static final String DEVICE_CODE="device_code"; |
| | | public static final String CREATED_BY="created_by"; |
| | | public static final String DICT_VALUE="dict_value"; |
| | | public static final String DICT_LABEL="dict_label"; |
| | | public static final String TYPE="type"; |
| | | public static final String NAME="name"; |
| | | public static final String YEAR="year"; |
| | | public static final String CYCLE="cycle"; |
| | | public static final String DEVICE_NUMBER="device_number"; |
| | | public static final String TASK_TITLE="task_title"; |
| | | public static final String TASK_TYPE="task_type"; |
| | | public static final String TASK_HANDLING_RULE="task_handling_rule"; |
| | | public static final String TASK_OWNER="task_owner"; |
| | | public static final String START_TIME="start_time"; |
| | | public static final String END_TIME="end_time"; |
| | | public static final String LINK_UUID="link_uuid"; |
| | | public static final String WRITE_BACK_UUID="write_back_uuid"; |
| | | public static final String MAINTENANCE_PERSONNEL="maintenance_personnel"; |
| | | public static final String DEVICE_UUID="device_uuid"; |
| | | public static final String DEVICE_NAME="device_name"; |
| | | public static final String DEVICE_MANAGER="manager"; |
| | | public static final String DEVICE_TYPE="device_type"; |
| | | public static final String ELEVATOR_VARIETY="elevator_variety"; |
| | | public static final String PLAN_MAINTENANCE_TIME="plan_maintenance_time"; |
| | | public static final String MAINTENANCE_USER="maintenance_user"; |
| | | public static final String MAINTENANCE_TIME="maintenance_time"; |
| | | public static final String TECHNICIAN="technician"; |
| | | public static final String PLAN_START_TIME="plan_start_time"; |
| | | public static final String PLAN_FINISH_TIME="plan_finish_time"; |
| | | public static final String TASK_STATUS="task_status"; |
| | | public static final String TABLE_NAME="table_name"; |
| | | public static final String ACTUAL_COMPLETION_TIME="actual_completion_time"; |
| | | public static final String ACTUAL_COMPLETION_USER="actual_completion_user"; |
| | | public static final String RESPONSIBLE_PERSON="responsible_person"; |
| | | public static final String IS_FINISH="is_finish"; |
| | | public static final String IS_REVOKE="is_revoke"; |
| | | public static final String IS_TIMEOUT="is_timeout"; |
| | | public static final String IS_ADD_RECORD="is_add_record"; |
| | | public static final String TRANSFER_REASON = "transfer_reason"; |
| | | public static final String APPLY_REPAIR_USER = "apply_repair_user"; |
| | | public static final String APPLY_REPAIR_TIME = "apply_repair_time"; |
| | | public static final String PLAN_SUB_UUID = "plan_sub_uuid"; |
| | | public static final String ITEM_UUID = "item_uuid"; |
| | | public static final String MAINTENANCE_STATUS = "maintenance_status"; |
| | | public static final String MAINTENANCE_TYPE = "maintenance_type"; |
| | | public static final String SEND_USER = "send_user"; |
| | | public static final String MAINTENANCE_CYCLE = "maintenance_cycle"; |
| | | public static final String INSPECTION_CYCLE="inspection_cycle"; |
| | | public static final String CYCLE_UNIT = "cycle_unit"; |
| | | public static final String MAINTENANCE_ITEM = "maintenance_item"; |
| | | public static final String INSPECTION_ITEM = "inspection_item"; |
| | | public static final String BACK_TYPE = "back_type"; |
| | | public static final String REMARK = "remark"; |
| | | public static final String CONFIRM_WAY = "confirm_way"; |
| | | public static final String AHEAD_NOTICE_DAY = "ahead_notice_day"; |
| | | public static final String INSPECT_FINAL_TIME="inspect_final_time"; |
| | | public static final String PARENT_KEY= "parent_key"; |
| | | } |
| | |
| | | package com.product.device.controller; |
| | | |
| | | import com.product.device.config.DeviceCode; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.druid.util.StringUtils; |
| | | import com.product.core.config.CoreConst; |
| | | import com.product.core.controller.support.AbstractBaseController; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.entity.RequestParameterEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.device.config.DeviceConst; |
| | | import com.product.device.service.CommonInspectionService; |
| | | import com.product.device.service.DeviceManagerService; |
| | | import com.product.device.service.QuickResponseService; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 设备点检 |
| | | */ |
| | |
| | | CommonInspectionService commonInspectionService; |
| | | |
| | | /** |
| | | * 创建设备点检 |
| | | * @param content |
| | | * @param servletResponse |
| | | * 设备巡检月度展示 |
| | | * |
| | | * @throws IOException |
| | | */ |
| | | @RequestMapping(value = "/init/{version}", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/getPatrolMonthlViewy/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String createInspection(HttpServletRequest request) throws IOException { |
| | | public String getPatrolMonthlViewy(HttpServletRequest request) { |
| | | |
| | | try { |
| | | FieldSetEntity fse = null; |
| | |
| | | fse = reqp.getFormData(); |
| | | } |
| | | if (bean == null || fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); |
| | | return this.error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | } |
| | | if (StringUtils.isEmpty(fse.getString("uuid")) && StringUtils.isEmpty(fse.getString("device_sn")) ) { |
| | | SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | return this.error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | } |
| | | String result=OK_List(commonInspectionService.createInspection(fse.getString("device_sn"))); |
| | | System.out.println(result); |
| | | String result = OK_List(commonInspectionService.getPatrolMonthlView(fse)); |
| | | return result; |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return error(DeviceCode.DEVICE_CREATE_INSPECTION_ERROR); |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设备点检或者巡检配置保存 |
| | | * |
| | | * @throws IOException |
| | | */ |
| | | @RequestMapping(value = "/saveSetting/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String saveSetting(HttpServletRequest request) { |
| | | |
| | | try { |
| | | FieldSetEntity fse = null; |
| | | Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); |
| | | if (bean != null) { |
| | | RequestParameterEntity reqp = (RequestParameterEntity) bean; |
| | | fse = reqp.getFormData(); |
| | | } |
| | | if (bean == null || fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); |
| | | return this.error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | } |
| | | |
| | | boolean succ = commonInspectionService.saveSetting(fse); |
| | | if (succ) { |
| | | return OK(); |
| | | } |
| | | SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SAVE_PATROL_CONFIG_ERROR.getValue(), |
| | | DeviceCode.SAVE_PATROL_CONFIG_ERROR.getText()); |
| | | return this.error(DeviceCode.SAVE_PATROL_CONFIG_ERROR); |
| | | } catch (BaseException e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(DeviceCode.SAVE_PATROL_CONFIG_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设备点检或者巡检复核 |
| | | * |
| | | * @throws IOException |
| | | */ |
| | | @RequestMapping(value = "/batchReview/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String batchReview(HttpServletRequest request) { |
| | | |
| | | try { |
| | | FieldSetEntity fse = null; |
| | | Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); |
| | | if (bean != null) { |
| | | RequestParameterEntity reqp = (RequestParameterEntity) bean; |
| | | fse = reqp.getFormData(); |
| | | } |
| | | if (bean == null || fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); |
| | | return this.error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | } |
| | | |
| | | boolean succ = commonInspectionService.batchReview(fse); |
| | | if (succ) { |
| | | return OK(); |
| | | } |
| | | SpringMVCContextHolder.getSystemLogger().error(DeviceCode.SAVE_PATROL_CONFIG_ERROR.getValue(), |
| | | DeviceCode.SAVE_PATROL_CONFIG_ERROR.getText()); |
| | | return error(DeviceCode.SAVE_PATROL_CONFIG_ERROR.getValue(), DeviceCode.SAVE_PATROL_CONFIG_ERROR.getText()); |
| | | } catch (BaseException e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(e); |
| | | } catch (Exception e) { |
| | | SpringMVCContextHolder.getSystemLogger().error(e); |
| | | return this.error(DeviceCode.SAVE_PATROL_CONFIG_ERROR.getValue(), |
| | | DeviceCode.SAVE_PATROL_CONFIG_ERROR.getText()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设备巡检配置详情 |
| | | * |
| | | * @throws IOException |
| | | */ |
| | | @RequestMapping(value = "/findPatrolSetting/{version}", method = RequestMethod.POST) |
| | | @ApiVersion(1) |
| | | public String findPatrolSetting(HttpServletRequest request) { |
| | | |
| | | try { |
| | | FieldSetEntity fse = null; |
| | | Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); |
| | | if (bean != null) { |
| | | RequestParameterEntity reqp = (RequestParameterEntity) bean; |
| | | fse = reqp.getFormData(); |
| | | } |
| | | if (bean == null || fse == null) { |
| | | SpringMVCContextHolder.getSystemLogger().error(String.valueOf(DeviceCode.SYSTEM_FORM_NODATA)); |
| | | return this.error(DeviceCode.SYSTEM_FORM_NODATA); |
| | | } |
| | | |
| | | String result = OK_List(commonInspectionService.findPatrolSetting()); |
| | | return result; |
| | | } catch (BaseException e) { |
| | | e.printStackTrace(); |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.product.device.controller; |
| | | |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | import com.product.util.BaseUtil; |
| | | import com.product.util.support.AbstractBaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import net.bytebuddy.asm.Advice.This; |
| | | |
| | | import com.product.device.service.DeviceMainenanceService; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.druid.util.StringUtils; |
| | | import com.product.admin.service.idel.ISystemMenusService; |
| | | import com.product.core.config.CoreConst; |
| | | import com.product.core.controller.support.AbstractBaseController; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.entity.RequestParameterEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.device.config.DeviceConst; |
| | | import com.product.device.service.CommonInspectionService; |
| | | import com.product.device.service.DeviceMainenanceService; |
| | | import com.product.device.service.DeviceManagerService; |
| | | import com.product.device.service.QuickResponseService; |
| | | import com.product.device.service.ide.IDeviceMainenanceService; |
| | | import com.product.module.sys.version.ApiVersion; |
| | | |
| | | import java.io.IOException; |
| | | /** |
| | | * 设备维修 |
| | | * 设备保养 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/device/maintenance") |
| | |
| | | DeviceMainenanceService deviceMainenanceService; |
| | | |
| | | |
| | | @PostMapping("/{version}") |
| | | @ApiVersion(1) |
| | | public String getMaintainByCurrentYear(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.getMaintainByCurrentYear(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/month/{version}") |
| | | @ApiVersion(1) |
| | | public String getMaintainMonth(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.getMaintainMonth(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复核维保记录 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/review/{version}") |
| | | @ApiVersion(1) |
| | | public String reviewRecord(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | if (!deviceMainenanceService.maintenanceReview(fse)) { |
| | | //更新失败 |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_REVIEW_FAIL); |
| | | } |
| | | return OK(); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.COMMON_DATA_ERROR, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保统计 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/year-maintenance/{version}") |
| | | @ApiVersion(1) |
| | | public String yearMaintenance(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.yearMaintenance(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_YEAR_FAIL, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保任务完成情况 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/year-maintenance-finish/{version}") |
| | | @ApiVersion(1) |
| | | public String yearMaintenanceFinish(HttpServletRequest request) { |
| | | try { |
| | | FieldSetEntity fse = BaseUtil.getFieldSetEntity(request); |
| | | return OK_List(deviceMainenanceService.yearMaintenanceFinish(fse)); |
| | | } catch (BaseException e) { |
| | | return error(e); |
| | | } catch (Exception e) { |
| | | return error(DeviceCode.DEVICE_MAINTENANCE_YEAR_FINISH_FAIL, e); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.product.device.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.product.admin.service.PublicService; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.core.transfer.Transactional; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.device.config.DeviceConst; |
| | | import com.product.device.service.idel.IDeviceInspectionService; |
| | | import com.product.module.sys.entity.SystemUser; |
| | | import com.product.util.BaseUtil; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.thymeleaf.util.StringUtils; |
| | | |
| | | |
| | | /** |
| | | * 设备点检 |
| | | * |
| | | * @Author |
| | | * @Date 2022/3/8 16:33 |
| | | * @Desc 功能相关 service |
| | | */ |
| | | @Service |
| | | public class CommonInspectionService extends AbstractBaseService { |
| | | public class CommonInspectionService extends AbstractBaseService implements IDeviceInspectionService { |
| | | |
| | | @Autowired |
| | | public BaseDao baseDao; |
| | | @Autowired |
| | | DeviceManagerService deviceManagerService; |
| | | @Autowired |
| | | PublicService publicService; |
| | | @Autowired |
| | | DeviceTaskService deviceTaskService; |
| | | /** |
| | | * 获取设备信息 包括子设备 |
| | | * @param uuid |
| | | * |
| | | * @param device_sn |
| | | * @return |
| | | */ |
| | | public FieldSetEntity createInspection(String device_sn) { |
| | | FieldSetEntity dev=deviceManagerService.findDevice(null,device_sn); |
| | | FieldSetEntity dev = deviceManagerService.findDevice( device_sn); |
| | | baseDao.loadPromptData(dev); |
| | | if(dev !=null) { |
| | | DataTableEntity dt=baseDao.listTable(DeviceConst.TABLE_PRODUCT_INSPECT_CONFIG," uuid in( select config_uuid from"+DeviceConst.TABLE_PRODUCT_INSPECT_SETTING_SUB+" where main_uuid=(select uuid from "+DeviceConst.TABLE_PRODUCT_INSPECT_SETTING+" where device_type=? )", new String[] {dev.getString("device_type")}); |
| | | DataTableEntity dt = baseDao.listTable(DeviceConst.TABLE_PRODUCT_DEVICE_INSPECT_ITEM_CONFIG, " uuid in( select config_uuid from" + DeviceConst.TABLE_PRODUCT_INSPECT_SETTING_SUB + " where main_uuid=(select uuid from " + DeviceConst.TABLE_PRODUCT_INSPECT_SETTING + " where device_type=? )", new String[]{dev.getString("device_type")}); |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | Map <String,DataTableEntity> sub=new HashMap<>(); |
| | | sub.put("sub", dt); |
| | |
| | | return dev; |
| | | } |
| | | |
| | | public DataTableEntity getPatrolMonthlView(FieldSetEntity fliter) throws BaseException{ |
| | | StringBuffer sb = new StringBuffer(); |
| | | ArrayList<String> parme = new ArrayList<>(); |
| | | sb.append(" SELECT a.name obName,GROUP_CONCAT( CONCAT(check_time,'&',result) ) check_time FROM("); |
| | | sb.append(" SELECT c.name,b.result,DATE_FORMAT( a.check_time, '%d' ) check_time FROM "); |
| | | |
| | | sb.append(" "+fliter.getTableName()+" a LEFT JOIN "+fliter.getTableName()+"_sub b on a.uuid =b.record_uuid "); |
| | | |
| | | sb.append(" LEFT JOIN product_device_patrol_config c on b.patrol_uuid=c.uuid where 1=1"); |
| | | |
| | | |
| | | if (!StringUtils.isEmpty(fliter.getString("device_number"))) { |
| | | sb.append(" and a.device_number=?"); |
| | | parme.add(fliter.getString("device_number")); |
| | | } |
| | | if (!StringUtils.isEmpty(fliter.getString("patrol_user"))) { |
| | | sb.append(" and a.patrol_user=?"); |
| | | parme.add(fliter.getString("patrol_user")); |
| | | } |
| | | if (!StringUtils.isEmpty(fliter.getString("check_time"))) { |
| | | sb.append(" and DATE_FORMAT( a.check_time, '%Y-%m' )=?"); |
| | | parme.add(fliter.getString("check_time").substring(0, 7)); |
| | | } else { |
| | | throw new BaseException("0","年月不能为空"); |
| | | } |
| | | sb.append(" GROUP BY c.name,b.result,DATE_FORMAT( a.check_time, '%d' ) "); |
| | | sb.append(") a GROUP BY a.name "); |
| | | String[] pArr = parme.toArray(new String[parme.size()]); |
| | | DataTableEntity dt = baseDao.listTable(sb.toString(), pArr); |
| | | for (int i = 0; i <dt.getRows() ; i++) { |
| | | FieldSetEntity fs = dt.getFieldSetEntity(i); |
| | | String check_time = fs.getString("check_time"); |
| | | if (!StringUtils.isEmpty(check_time)){ |
| | | String[] check_time_arr = check_time.split(","); |
| | | for (int j = 0; j <check_time_arr.length ; j++) { |
| | | String[] v = check_time_arr[j].split("&"); |
| | | fs.setValue("m"+v[0],v[1]); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return dt; |
| | | } |
| | | |
| | | public FieldSetEntity getInspectionSetting(String device_type) { |
| | | FieldSetEntity fs = baseDao.getFieldSetByFilter(DeviceConst.TABLE_PRODUCT_INSPECTION_SETTING, " device_type=? ", new String[]{device_type}, false); |
| | | return fs; |
| | | } |
| | | |
| | | public DataTableEntity getTreeArchives() { |
| | | DataTableEntity dt = baseDao.listTable(DeviceConst.TABLE_PRODUCT_DEVICE_ARCHIVE, new String[]{}); |
| | | return dt; |
| | | } |
| | | |
| | | /** |
| | | * 保持设备配置(点检、巡检、保养) |
| | | * @param fs |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | public boolean saveSetting(FieldSetEntity fs) { |
| | | DataTableEntity subTable = fs.getSubDataTable("subTable"); |
| | | boolean re = true; |
| | | for (int i = 0; i < subTable.getRows(); i++) { |
| | | FieldSetEntity sub = subTable.getFieldSetEntity(i); |
| | | sub.setTableName(fs.getTableName()); |
| | | if (!StringUtils.isEmpty(sub.getString("~type~"))) { |
| | | publicService.delete(sub); |
| | | continue; |
| | | } |
| | | sub.setValue("device_number", fs.getString("device_number")); |
| | | sub.setValue("cycle", fs.getString("cycle")); |
| | | baseDao.executeUpdate("update product_device_maintenance_setting set device_number=? ",new String[] {fs.getString("device_number")}); |
| | | |
| | | if ("product_device_maintenance_setting".equals(fs.getTableName())){ |
| | | sub.setValue("type", fs.getString("type")); |
| | | sub.setValue("ahead_notice_day", fs.getString("ahead_notice_day")); |
| | | } |
| | | if ("product_device_inspection_setting".equals(fs.getTableName())){ |
| | | sub.setValue("start_time", fs.getDate("start_time")); |
| | | sub.setValue("warn_time", fs.getDate("warn_time")); |
| | | } |
| | | String uuid = publicService.saveFieldSetEntity(sub); |
| | | if (StringUtils.isEmpty(uuid)) { |
| | | re = false; |
| | | } |
| | | } |
| | | return re; |
| | | } |
| | | |
| | | @Transactional |
| | | public boolean batchReview(FieldSetEntity fs) { |
| | | String uuid = fs.getString("uuid"); |
| | | if (StringUtils.isEmpty(uuid)) { |
| | | return false; |
| | | } |
| | | String[] split = uuid.split(","); |
| | | boolean re = true; |
| | | for (int i = 0; i < split.length; i++) { |
| | | FieldSetEntity recordFs = new FieldSetEntity(); |
| | | recordFs.setTableName(fs.getTableName()); |
| | | recordFs.setValue("uuid", split[i]); |
| | | recordFs.setValue("check_user", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | recordFs.setValue("check_time", new Date()); |
| | | String uuids = publicService.saveFieldSetEntity(recordFs); |
| | | if (StringUtils.isEmpty(uuids)) { |
| | | re = false; |
| | | } |
| | | |
| | | } |
| | | return re; |
| | | } |
| | | |
| | | public FieldSetEntity findPatrolSetting() { |
| | | DataTableEntity dataTableEntity = baseDao.listTable(DeviceConst.TABLE_PRODUCT_PATROL_SETTING, ""); |
| | | FieldSetEntity fs = new FieldSetEntity(); |
| | | fs.setTableName(DeviceConst.TABLE_PRODUCT_PATROL_SETTING); |
| | | |
| | | DataTableEntity dt = new DataTableEntity(); |
| | | |
| | | for (int i = 0; i < dataTableEntity.getRows(); i++) { |
| | | FieldSetEntity sub = dataTableEntity.getFieldSetEntity(i); |
| | | FieldSetEntity fsSub = new FieldSetEntity(); |
| | | fsSub.setTableName(DeviceConst.TABLE_PRODUCT_PATROL_SETTING); |
| | | fsSub.setValue("patrol_config_uuid", sub.getString("patrol_config_uuid")); |
| | | fsSub.setValue("remark", sub.getString("remark")); |
| | | fsSub.setValue("uuid", sub.getString("uuid")); |
| | | dt.addFieldSetEntity(fsSub); |
| | | fs.setValue("device_number", sub.getString("device_number")); |
| | | fs.setValue("cycle", sub.getString("cycle")); |
| | | |
| | | } |
| | | Map<String, DataTableEntity> sub = new HashMap<>(); |
| | | sub.put("subTable", dt); |
| | | fs.setSubData(sub); |
| | | return fs; |
| | | } |
| | | public FieldSetEntity findInspectionSetting() { |
| | | DataTableEntity dataTableEntity = baseDao.listTable(DeviceConst.TABLE_PRODUCT_INSPECTION_SETTING, ""); |
| | | FieldSetEntity fs = new FieldSetEntity(); |
| | | fs.setTableName(DeviceConst.TABLE_PRODUCT_INSPECTION_SETTING); |
| | | |
| | | DataTableEntity dt = new DataTableEntity(); |
| | | |
| | | for (int i = 0; i < dataTableEntity.getRows(); i++) { |
| | | FieldSetEntity sub = dataTableEntity.getFieldSetEntity(i); |
| | | FieldSetEntity fsSub = new FieldSetEntity(); |
| | | fsSub.setTableName(DeviceConst.TABLE_PRODUCT_INSPECTION_SETTING); |
| | | fsSub.setValue("inspection_uuid", sub.getString("inspection_uuid")); |
| | | fsSub.setValue("remark", sub.getString("remark")); |
| | | fsSub.setValue("uuid", sub.getString("uuid")); |
| | | fsSub.setValue("back_type", sub.getString("back_type")); |
| | | |
| | | dt.addFieldSetEntity(fsSub); |
| | | fs.setValue("device_number", sub.getString("device_number")); |
| | | fs.setValue("cycle", sub.getString("cycle")); |
| | | fs.setValue("start_time", sub.getString("start_time")); |
| | | fs.setValue("warn_time", sub.getString("warn_time")); |
| | | |
| | | } |
| | | Map<String, DataTableEntity> sub = new HashMap<>(); |
| | | sub.put("subTable", dt); |
| | | fs.setSubData(sub); |
| | | return fs; |
| | | } |
| | | /** |
| | | * 设备的点检配置 |
| | | * @param asset_code |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findDeviceSetting(String device_uuid) { |
| | | FieldSetEntity device=deviceManagerService.findDevice(device_uuid); |
| | | String sql="select c.* from product_device_inspection_setting a join product_device_inspection_setting_sub b on a.uuid=b.main_uuid left join product_device_inspection_item_config c on b.config_uuid=c.uuid and c.is_used=1 where status=1 and a.device_uuid=? "; |
| | | DataTableEntity dataTableEntity = baseDao.listTable(sql,new String[] {device_uuid}); |
| | | device.addSubDataTable(dataTableEntity); |
| | | return device; |
| | | } |
| | | /** |
| | | * 设备的点检记录 |
| | | * @param asset_code |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findInspectionRecord(String uuid) { |
| | | FieldSetEntity record=baseDao.getFieldSetEntity("product_device_inspection_record", |
| | | new String[]{"device_uuid","inspect_user","inspect_final_time","check_user","check_time","is_finish"},uuid, false); |
| | | |
| | | if(!FieldSetEntity.isEmpty(record)) { |
| | | |
| | | FieldSetEntity device=deviceManagerService.findDevice(record.getString("device_uuid")); |
| | | record.setValue("device_uuid", device.getString("device_name")); |
| | | record.setValue("device_uuid_save_value", device.getString("uuid")); |
| | | |
| | | String sql="select s.*,c.* from product_device_inspection_setting a left join product_device_inspection_item_config c on a.inspection_item=c.uuid and c.is_used=1 left join product_device_inspection_record_sub s on s.inspect_item=c.uuid and record_uuid=? where a.device_uuid=? "; |
| | | DataTableEntity dt = baseDao.listTable(sql,new String[] {uuid,record.getString("device_uuid_save_value")}); |
| | | record.addSubDataTable(dt); //点检项 |
| | | // record.removeSubData("product_device_inspection_record_sub"); |
| | | } |
| | | return record; |
| | | } |
| | | /** |
| | | * 保存点检信息 |
| | | * @param fs |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | public String saveInspection(FieldSetEntity fs) throws BaseException{ |
| | | if(!FieldSetEntity.isEmpty(fs) ) { |
| | | FieldSetEntity rfs=new FieldSetEntity(DeviceConst.PRODUCT_DEVICE_INSPECTION_RECORD); |
| | | SystemUser user = SpringMVCContextHolder.getCurrentUser(); |
| | | rfs.setValue("org_level_uuid", user.getOrg_level_uuid()); |
| | | // rfs.setValue("device_uuid", fs.getValue("device_number")); |
| | | rfs.setValue("device_uuid", fs.getValue("uuid")); |
| | | rfs.setValue("is_finish", 0); |
| | | rfs.setValue("use_dept", user.getOrg_level_uuid()); |
| | | rfs.setValue("inspect_user", user.getUser_id()); |
| | | rfs.setValue("inspect_final_time",new Date()); |
| | | // rfs.setValue("task_uuid", fieldValue); |
| | | DataTableEntity dt=fs.getSubDataTable(DeviceConst.PRODUCT_DEVICE_INSPECTION_RECORD_SUB); |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | rfs.addSubDataTable(dt); |
| | | if(baseDao.saveFieldSetEntity(rfs)) {//创建任务 |
| | | deviceTaskService.automaticCreateTask( |
| | | String.format(DeviceConst.TASK_TITLE_FORMAT_SPOT_CHECK, fs.getString(DeviceConst.DEVICE_NAME)) |
| | | ,DeviceConst.TASK_TYPE_SPOT_CHECK |
| | | ,rfs.getUUID() |
| | | ,fs.getString(DeviceConst.DEVICE_MANAGER) |
| | | ); |
| | | |
| | | } |
| | | } |
| | | return rfs.getUUID(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.product.device.service; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.beust.jcommander.internal.Lists; |
| | | import com.product.core.config.CoreConst; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.core.transfer.Transactional; |
| | | import com.product.device.config.DeviceCode; |
| | | import com.product.device.config.DeviceConst; |
| | | import com.product.device.service.ide.IDeviceMainenanceService; |
| | | import com.product.device.service.idel.IDeviceMainenanceService; |
| | | import com.product.module.sys.entity.SystemUser; |
| | | import com.product.task.device.service.DeviceManagerTaskService; |
| | | |
| | | import com.product.util.BaseUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 设备维修 |
| | | * |
| | | * @Author |
| | | * @Date 2022/3/8 16:33 |
| | | * @Desc 功能相关 service |
| | |
| | | |
| | | /** |
| | | * 获取设备信息 包括子设备 |
| | | * @param uuid |
| | | * @param device_sn |
| | | * |
| | | * @return |
| | | */ |
| | | @Transactional |
| | |
| | | |
| | | return fs.getString(CoreConst.UUID); |
| | | } |
| | | |
| | | /** |
| | | * 创建维修任务,第一次可能选中的是调度人,也可能是维修人员 |
| | | * |
| | | * @param fs |
| | | */ |
| | | public void createMaintainTask(FieldSetEntity fs) { |
| | | |
| | | deviceManagerTaskService.createTask(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取本年已完成的保养记录 |
| | | */ |
| | | public DataTableEntity getMaintainByCurrentYear(FieldSetEntity fse) { |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append("\nSELECT b.*,a.plan_maintenance_time,a.maintenance_user,a.maintenance_time,a.check_user,a.check_time FROM `product_device_maintenance_record` a "); |
| | | sql.append("\nINNER JOIN `product_device_info` b ON a. device_uuid=b.uuid "); |
| | | sql.append("\nwhere length(a.check_user)>0 "); |
| | | String elevatorVariety = fse.getString("elevator_variety"); |
| | | String maintenanceUnit = fse.getString("maintenance_unit"); |
| | | List<Object> params = StringUtils.isAnyEmpty(elevatorVariety, maintenanceUnit) ? new ArrayList<>() : null; |
| | | if (!StringUtils.isEmpty(elevatorVariety)) { |
| | | String[] split = elevatorVariety.split(","); |
| | | sql.append("\nAND ").append(BaseUtil.buildQuestionMarkFilter("b.elevator_variety", split.length, true)); |
| | | params.addAll(CollectionUtil.toList(split)); |
| | | } |
| | | if (!StringUtils.isEmpty(maintenanceUnit)) { |
| | | sql.append("\nAND b.maintenance_unit=? "); |
| | | params.add(elevatorVariety); |
| | | } |
| | | Integer cpage = fse.getInteger(DeviceConst.CPAGE); |
| | | Integer pageSize = fse.getInteger(DeviceConst.PAGESIZE); |
| | | //查询已复核过的记录 |
| | | sql.append(" order by a.maintenance_time desc "); |
| | | DataTableEntity result = baseDao.listTable(sql.toString(), params.toArray(), pageSize, cpage); |
| | | result.getMeta().addAliasTable("product_device_info", "b"); |
| | | result.getMeta().addAliasTable("product_device_maintenance_record", "a"); |
| | | baseDao.loadPromptData(result); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public DataTableEntity getMaintainMonth(FieldSetEntity fse) { |
| | | Integer cpage = fse.getInteger(DeviceConst.CPAGE); |
| | | Integer pageSize = fse.getInteger(DeviceConst.PAGESIZE); |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append("\nSELECT b.*,a.maintenance_user, a.plan_finish_time FROM `product_device_maintenance_plan_sub`a "); |
| | | sql.append("\nINNER JOIN `product_device_info`b ON a.device_uuid = b.uuid "); |
| | | //sql查询plan_finish_time时间是否属于当月 |
| | | sql.append("\nWHERE MONTH(a.plan_finish_time) = MONTH(NOW()) AND a.is_finish=1"); |
| | | String elevatorVariety = fse.getString("elevator_variety"); |
| | | String maintenanceUnit = fse.getString("maintenance_unit"); |
| | | List<Object> params = StringUtils.isAnyEmpty(elevatorVariety, maintenanceUnit) ? new ArrayList<>() : null; |
| | | if (!StringUtils.isEmpty(elevatorVariety)) { |
| | | String[] split = elevatorVariety.split(","); |
| | | sql.append("\nAND ").append(BaseUtil.buildQuestionMarkFilter("b.elevator_variety", split.length, true)); |
| | | params.addAll(CollectionUtil.toList(split)); |
| | | } |
| | | if (!StringUtils.isEmpty(maintenanceUnit)) { |
| | | sql.append("\nAND b.maintenance_unit=? "); |
| | | params.add(elevatorVariety); |
| | | } |
| | | DataTableEntity result = baseDao.listTable(sql.toString(), params.toArray(), pageSize, cpage); |
| | | result.getMeta().addAliasTable("product_device_info", "b"); |
| | | result.getMeta().addAliasTable("product_device_maintenance_plan_sub", "a"); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 维保记录复核 |
| | | */ |
| | | public boolean maintenanceReview(FieldSetEntity fse) { |
| | | String uuids = fse.getString("uuids"); |
| | | if (StringUtils.isBlank(uuids)) { |
| | | throw new BaseException(DeviceCode.SYSTEM_FORM_COUNT); |
| | | } |
| | | |
| | | String[] split = (SpringMVCContextHolder.getCurrentUserId() + "," + uuids).split(","); |
| | | return baseDao.executeUpdate("update `product_device_maintenance_record` set check_time=now(),check_user=? where is_finish=1 and " + BaseUtil.buildQuestionMarkFilter("uuid", split.length - 1, true), split); |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保统计 |
| | | * |
| | | * @param fse |
| | | * @return |
| | | */ |
| | | public DataTableEntity yearMaintenance(FieldSetEntity fse) { |
| | | // 电梯品种 |
| | | String elevatorVariety = null; |
| | | // 维保单位 |
| | | String maintenanceUnit = null; |
| | | if (fse != null) { |
| | | elevatorVariety = fse.getString("elevator_variety"); |
| | | maintenanceUnit = fse.getString("maintenance_unit"); |
| | | } |
| | | StringBuilder sql = new StringBuilder(128); |
| | | sql.append("\nSELECT u.`name`,count(r.uuid) record_count"); |
| | | sql.append("\nFROM product_device_maintenance_unit u"); |
| | | sql.append("\nLEFT JOIN product_device_info a on a.maintenance_unit=u.uuid"); |
| | | sql.append("\nLEFT JOIN product_device_maintenance_record r on r.device_uuid=a.uuid"); |
| | | StringBuilder filterSql = new StringBuilder(32); |
| | | List<String> param = Lists.newArrayList(); |
| | | if (!StringUtils.isEmpty(elevatorVariety)) { |
| | | String[] arr = elevatorVariety.split(","); |
| | | filterSql.append(BaseUtil.buildQuestionMarkFilter("elevator_variety", arr.length, true)); |
| | | param.addAll(Arrays.asList(arr)); |
| | | } |
| | | if (!StringUtils.isEmpty(maintenanceUnit)) { |
| | | if (filterSql.length() > 0) { |
| | | filterSql.append(" AND "); |
| | | } |
| | | String[] arr = maintenanceUnit.split(","); |
| | | filterSql.append(BaseUtil.buildQuestionMarkFilter("maintenance_unit", arr.length, true)); |
| | | param.addAll(Arrays.asList(arr)); |
| | | } |
| | | if (filterSql.length() > 0) { |
| | | sql.append("\nWHERE ").append(filterSql); |
| | | } |
| | | sql.append("\nGROUP BY u.uuid"); |
| | | return baseDao.listTable(sql.toString(), param.toArray()); |
| | | } |
| | | |
| | | /** |
| | | * 维保单位年度维保任务完成情况 |
| | | * |
| | | * @param fse |
| | | * @return |
| | | */ |
| | | public DataTableEntity yearMaintenanceFinish(FieldSetEntity fse) { |
| | | // 电梯品种 |
| | | String elevatorVariety = null; |
| | | // 维保单位 |
| | | String maintenanceUnit = null; |
| | | if (fse != null) { |
| | | elevatorVariety = fse.getString("elevator_variety"); |
| | | maintenanceUnit = fse.getString("maintenance_unit"); |
| | | } |
| | | StringBuilder sql = new StringBuilder(128); |
| | | sql.append("\nSELECT T.*,CASE WHEN record_count = 0 THEN 0 ELSE ROUND(finish_count / record_count, 4) END finish_rate"); |
| | | sql.append("\nFROM ("); |
| | | sql.append("\n SELECT u.name,a.device_number,a.device_unit,a.device_code,d.manufacture_company,count(r.uuid) record_count, count(r.is_finish) + 1 finish_count"); |
| | | sql.append("\n FROM product_device_maintenance_unit u"); |
| | | sql.append("\n JOIN product_device_info a on a.maintenance_unit=u.uuid"); |
| | | sql.append("\n JOIN product_device_archives d on a.archives_uuid=d.uuid"); |
| | | sql.append("\n JOIN product_device_maintenance_record r on r.device_uuid=a.uuid"); |
| | | StringBuilder filterSql = new StringBuilder(32); |
| | | List<String> param = Lists.newArrayList(); |
| | | if (!StringUtils.isEmpty(elevatorVariety)) { |
| | | String[] arr = elevatorVariety.split(","); |
| | | filterSql.append(BaseUtil.buildQuestionMarkFilter("elevator_variety", arr.length, true)); |
| | | param.addAll(Arrays.asList(arr)); |
| | | } |
| | | if (!StringUtils.isEmpty(maintenanceUnit)) { |
| | | if (filterSql.length() > 0) { |
| | | filterSql.append(" AND "); |
| | | } |
| | | String[] arr = maintenanceUnit.split(","); |
| | | filterSql.append(BaseUtil.buildQuestionMarkFilter("maintenance_unit", arr.length, true)); |
| | | param.addAll(Arrays.asList(arr)); |
| | | } |
| | | if (filterSql.length() > 0) { |
| | | sql.append("\n WHERE ").append(filterSql); |
| | | } |
| | | sql.append("\n GROUP BY 1,2,3,4,5"); |
| | | sql.append("\n) T"); |
| | | return baseDao.listTable(sql.toString(), param.toArray()); |
| | | } |
| | | |
| | | /** |
| | | * 设备的保养配置 |
| | | * |
| | | * @param asset_code 设备编号 |
| | | * @param manceType 保养类型 |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findDeviceMaintenanceSetting(String uuid, String manceType) { |
| | | |
| | | FieldSetEntity device = deviceManagerService.findDevice(uuid); |
| | | |
| | | FieldSetEntity record = new FieldSetEntity("product_device_maintenance_record"); |
| | | record.setValue("device_uuid", device.getString("device_name")); |
| | | record.setValue("device_number", device.getString("device_number")); |
| | | record.setValue("device_uuid_save_value", device.getString("uuid")); |
| | | String sql = "select c.item_uuid,c.content ,c.criterion from product_device_maintenance_setting a left join product_device_maintenance_item_config b on\r\n" |
| | | + "a.maintenance_item=b.uuid join \r\n" |
| | | + "product_device_maintenance_item_detail c on b.uuid= c.item_uuid\r\n" |
| | | + "where device_uuid=? and maintenance_type=? and c.is_used=1 \r\n" |
| | | + "order by item_uuid"; |
| | | DataTableEntity dataTableEntity = baseDao.listTable(sql, new String[]{uuid, manceType}); |
| | | record.addSubDataTable(dataTableEntity); |
| | | |
| | | return record; |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.product.admin.config.CmnConst; |
| | | import com.product.core.config.Global; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.service.support.AbstractBaseService; |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.device.config.DeviceConst; |
| | | import com.product.module.sys.service.UserService; |
| | | |
| | |
| | | /** |
| | | * 获取设备信息 包括子设备 |
| | | * @param uuid |
| | | * @param device_sn |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findDeviceAndSub(String uuid,String asset_code) { |
| | | FieldSetEntity dev=findDevice(uuid,asset_code); |
| | | if(dev !=null) { |
| | | DataTableEntity dt=baseDao.listTable(DeviceConst.TABLE_PRODUCT_DEVICE_ARCHIVE,"parent_sn=?", new String[] {asset_code},new String[]{"uuid","device_name","asset_code","device_version","device_status"}); |
| | | public FieldSetEntity findDeviceAndSub(String uuid,String device_number) { |
| | | FieldSetEntity dev=findDevice(uuid); |
| | | if(dev !=null && "device".equals(Global.getSystemConfig("system_platform_type", "")) ) { |
| | | DataTableEntity dt=baseDao.listTable(DeviceConst.PRODUCT_DEVICE_INFO,"uuid=?", new String[] {uuid},new String[]{}); |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | baseDao.loadPromptData(dt); |
| | | Map <String,DataTableEntity> sub=new HashMap<>(); |
| | |
| | | /** |
| | | * 获取设备信息 包括子设备 |
| | | * @param uuid |
| | | * @param device_sn |
| | | * @param asset_code |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findDevice(String uuid,String asset_code) { |
| | | public FieldSetEntity findDevice(String uuid) { |
| | | StringBuilder st=new StringBuilder(); |
| | | List<String> pa=new ArrayList<String>(); |
| | | if(!StringUtils.isEmpty(asset_code)) { |
| | | st.append("asset_code=?"); |
| | | pa.add(asset_code); |
| | | } |
| | | if(!StringUtils.isEmpty(uuid)) { |
| | | if(st.length()>0) { |
| | | st.append(" and "); |
| | | } |
| | | st.append("uuid=?"); |
| | | pa.add(uuid); |
| | | }else { |
| | | return null; |
| | | } |
| | | |
| | | FieldSetEntity dev=baseDao.getFieldSetEntityByFilter(DeviceConst.TABLE_PRODUCT_DEVICE_ARCHIVE, new String[]{"uuid","device_name","asset_code","device_version","device_status"}, st.toString(), pa.toArray(), false, null); |
| | | FieldSetEntity dev=baseDao.getFieldSetEntityByFilter(DeviceConst.PRODUCT_DEVICE_INFO, new String[]{}, st.toString(), pa.toArray(), false, null); |
| | | baseDao.loadPromptData(dev); |
| | | return dev; |
| | | } |
| | |
| | | * 如果有子设备,需要把子设备状态一起变更 |
| | | * @return |
| | | */ |
| | | public boolean deviceStatusChange(String asset_code,String status) { |
| | | return baseDao.executeUpdate("update product_device_archives set device_status=? where asset_code=? or parent_sn=?",new String[] {status,asset_code,asset_code}); |
| | | public boolean deviceStatusChange(String device_number,String status) { |
| | | return baseDao.executeUpdate("update product_device_info set device_status=? where device_number=?",new String[] {status,device_number}); |
| | | } |
| | | /** |
| | | * 添加设备运行记录 |
| | |
| | | |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import cn.hutool.extra.qrcode.QrConfig; |
| | | import com.product.device.utils.QuickResponseCode; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.product.common.lang.StringUtils; |
| | | import com.product.device.config.QuickResponseCode; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |