Commit f527c6fe authored by KeYong's avatar KeYong

Merge branch 'develop_dl_3.7.0.8' of http://39.98.45.134:8090/moa/amos-boot-biz…

Merge branch 'develop_dl_3.7.0.8' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_3.7.0.8
parents 37872db0 c8ac8d15
package com.yeejoin.amos.boot.biz.common.utils;
public class SnowFlakeGenerateIdWorker {
/**
* 开始时间截
*/
private final long twepoch = 1420041600000L;
/**
* 机器id所占的位数
*/
private final long workerIdBits = 5L;
/**
* 数据标识id所占的位数
*/
private final long datacenterIdBits = 5L;
/**
* 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数)
*/
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/**
* 支持的最大数据标识id,结果是31
*/
private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
/**
* 序列在id中占的位数
*/
private final long sequenceBits = 12L;
/**
* 机器ID向左移12位
*/
private final long workerIdShift = sequenceBits;
/**
* 数据标识id向左移17位(12+5)
*/
private final long datacenterIdShift = sequenceBits + workerIdBits;
/**
* 时间截向左移22位(5+5+12)
*/
private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
/**
* 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095)
*/
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/**
* 工作机器ID(0~31)
*/
private long workerId;
/**
* 数据中心ID(0~31)
*/
private long datacenterId;
/**
* 毫秒内序列(0~4095)
*/
private long sequence = 0L;
/**
* 上次生成ID的时间截
*/
private long lastTimestamp = -1L;
/**
* 构造函数
*
* @param workerId 工作ID (0~31)
* @param datacenterId 数据中心ID (0~31)
*/
public SnowFlakeGenerateIdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* 获得下一个ID (该方法是线程安全的)
*
* @return long
*/
public synchronized long nextId() {
long timestamp = timeGen();
timestamp = generateId(timestamp);
return ((timestamp - twepoch) << timestampLeftShift) //
| (datacenterId << datacenterIdShift) //
| (workerId << workerIdShift) //
| sequence;
}
private long generateId(long timestamp){
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
if(timestamp < lastTimestamp){
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if(lastTimestamp == timestamp)
{
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if(sequence == 0)
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
else//时间戳改变,毫秒内序列重置
{
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
return timestamp;
}
/**
*获得下一个ID (string)
**/
public synchronized String generateNextId() {
long timestamp = timeGen();
timestamp = generateId(timestamp);
//移位并通过或运算拼到一起组成64位的ID
return String.valueOf(((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift)
| sequence);
}
/**
* 阻塞到下一个毫秒,直到获得新的时间戳
*
* @param lastTimestamp 上次生成ID的时间截
* @return 当前时间戳
*/
protected long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
* 返回以毫秒为单位的当前时间
*
* @return 当前时间(毫秒)
*/
protected long timeGen() {
return System.currentTimeMillis();
}
}
...@@ -221,6 +221,14 @@ public class ExcelUtil { ...@@ -221,6 +221,14 @@ public class ExcelUtil {
return readExcel(reader, rowType, 0); return readExcel(reader, rowType, 0);
} }
public static <T> List<T> readManySheetExcel(MultipartFile excel, Class<T> rowType, int header,int sheetCount) throws Exception {
ExcelReader reader = getReader(excel, header);
if (reader == null) {
return new ArrayList<>();
}
return readExcel(reader, rowType, 0);
}
/** /**
* 读取 Excel(多个 sheet) * 读取 Excel(多个 sheet)
* *
......
...@@ -37,16 +37,18 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler { ...@@ -37,16 +37,18 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler {
selectedMap.forEach((k, v) -> { selectedMap.forEach((k, v) -> {
// 设置下拉列表的行: 首行,末行,首列,末列 // 设置下拉列表的行: 首行,末行,首列,末列
CellRangeAddressList rangeList = new CellRangeAddressList(1, 65536, k, k); CellRangeAddressList rangeList = new CellRangeAddressList(1, 65536, k, k);
// 设置下拉列表的值 if (v.getSource().length > 0){
DataValidationConstraint constraint = helper.createExplicitListConstraint(v.getSource()); // 设置下拉列表的值
// 设置约束 DataValidationConstraint constraint = helper.createExplicitListConstraint(v.getSource());
DataValidation validation = helper.createValidation(constraint, rangeList); // 设置约束
// 阻止输入非下拉选项的值 DataValidation validation = helper.createValidation(constraint, rangeList);
validation.setErrorStyle(DataValidation.ErrorStyle.STOP); // 阻止输入非下拉选项的值
validation.setShowErrorBox(true); validation.setErrorStyle(DataValidation.ErrorStyle.STOP);
validation.setSuppressDropDownArrow(true); validation.setShowErrorBox(true);
validation.createErrorBox("提示", "请输入下拉选项中的内容"); validation.setSuppressDropDownArrow(true);
sheet.addValidationData(validation); validation.createErrorBox("提示", "请输入下拉选项中的内容");
sheet.addValidationData(validation);
}
}); });
} }
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
r.equip_category_name, r.equip_category_name,
r.equip_code, r.equip_code,
r.maintenance_period, r.maintenance_period,
r.resource_type,
(case r.resource_type when 'crane' then rc.height when 'natural' then rn.height end) height, (case r.resource_type when 'crane' then rc.height when 'natural' then rn.height end) height,
(case r.resource_type (case r.resource_type
when 'crane' then rc.status when 'crane' then rc.status
......
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
</select> </select>
<select id="queryStaticForPage" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto"> <select id="queryStaticForPage" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto">
select date,count(name) signNum,bizOrgName,bizOrgCode,personOfDay from ( select date,count(userId) signNum,bizOrgName,bizOrgCode,personOfDay from (
SELECT SELECT
DISTINCT name, DISTINCT sign.user_id userId,
date, date,
biz_org_Name bizOrgName, biz_org_Name bizOrgName,
biz_org_code bizOrgCode, biz_org_code bizOrgCode,
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
group by group by
date, date,
biz_org_code, biz_org_code,
name user_id
order by order by
sign.sign_time desc sign.sign_time desc
) s group by date,bizOrgCode ) s group by date,bizOrgCode
......
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
...@@ -43,11 +44,17 @@ public class DutyShiftController extends BaseController { ...@@ -43,11 +44,17 @@ public class DutyShiftController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增值班班次", notes = "新增值班班次") @ApiOperation(httpMethod = "POST", value = "新增值班班次", notes = "新增值班班次")
public ResponseModel<DutyShiftDto> save(HttpServletRequest request, @RequestBody DutyShiftDto model) { public ResponseModel<Boolean> save(HttpServletRequest request, @RequestBody DutyShiftDto model) {
QueryWrapper<DutyShift> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", model.getName());
List<DutyShift> list = dutyShiftServiceImpl.list(queryWrapper);
if(!list.isEmpty()) {
return ResponseHelper.buildResponse(false);
}
String appKey = request.getHeader("appKey"); String appKey = request.getHeader("appKey");
model.setAppKey(appKey); model.setAppKey(appKey);
model = dutyShiftServiceImpl.createWithModel(model); dutyShiftServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(true);
} }
/** /**
...@@ -79,7 +86,7 @@ public class DutyShiftController extends BaseController { ...@@ -79,7 +86,7 @@ public class DutyShiftController extends BaseController {
if(dutyPersonShiftServiceImpl.checkCurrentDutyIsUser(sequenceNbr)) { if(dutyPersonShiftServiceImpl.checkCurrentDutyIsUser(sequenceNbr)) {
return ResponseHelper.buildResponse(false); return ResponseHelper.buildResponse(false);
}; }
DutyShift dutyShift = dutyShiftServiceImpl.getById(sequenceNbr); DutyShift dutyShift = dutyShiftServiceImpl.getById(sequenceNbr);
if (null != dutyShift) { if (null != dutyShift) {
dutyShift.setIsDelete(true); dutyShift.setIsDelete(true);
......
...@@ -249,6 +249,7 @@ public class OrgPersonController extends BaseController { ...@@ -249,6 +249,7 @@ public class OrgPersonController extends BaseController {
@TycloudOperation( ApiLevel = UserType.AGENCY) @TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET) @RequestMapping(value = "/listAllByCurrentUserALL", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)") @ApiOperation(httpMethod = "GET", value = "列表分页查询(表单用)", notes = "列表分页查询(表单用)")
@PersonIdentify
public ResponseModel<Object> listAllByCurrentUserALL() { public ResponseModel<Object> listAllByCurrentUserALL() {
Map<String, Object> req = new HashMap<>(); Map<String, Object> req = new HashMap<>();
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
......
...@@ -1649,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1649,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return null; return null;
} }
List<CompanyPerson> tempList = new ArrayList<CompanyPerson>(); List<CompanyPerson> tempList = new ArrayList<CompanyPerson>();
for (Long tempId : ids) { //4.24优化 原有方法不断循环查库 接口太慢 将数据一次捞出由java层组装
// BUG 2740 机场单位主键varchar 导致 通过主键搜索返回多条数据 2021 - 09 - 09by kongfm //获取指定单位
OrgUsr org = getById(tempId.toString()); LambdaQueryWrapper<OrgUsr> companyWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isEmpty(org)) { companyWrapper.in(BaseEntity::getSequenceNbr,ids);
continue; List<OrgUsr> companys = this.orgUsrMapper.selectList(companyWrapper);
} //获取指定单位下所有人员
LambdaQueryWrapper<OrgUsr> personWrapper = new LambdaQueryWrapper<>();
personWrapper.in(OrgUsr::getParentId,ids);
personWrapper.eq(OrgUsr::getBizOrgType,OrgPersonEnum.人员.getKey());
personWrapper.eq(BaseEntity::getIsDelete,false);
List<OrgUsr> persons = this.orgUsrMapper.selectList(personWrapper);
//将各单位人员数据组装
companys.stream().forEach(e->{
List<OrgUsr> list = persons.stream().filter(p -> p.getParentId().equals(e.getSequenceNbr().toString())).collect(Collectors.toList());
CompanyPerson company = new CompanyPerson(); CompanyPerson company = new CompanyPerson();
BeanUtils.copyProperties(org, company); BeanUtils.copyProperties(e, company);
company.setPersons(this.queryForListByParentIdAndOrgType(org.getSequenceNbr(), OrgPersonEnum.人员.getKey())); company.setPersons(Bean.toModels(list, this.getModelClass()));
tempList.add(company); tempList.add(company);
} });
return tempList; return tempList;
} }
......
...@@ -11,6 +11,7 @@ import com.google.common.collect.Lists; ...@@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
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.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil; import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.SnowFlakeGenerateIdWorker;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.morphic.Morphic; import com.yeejoin.amos.feign.morphic.Morphic;
...@@ -82,6 +83,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -82,6 +83,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
private IFormGroupService iFormGroupService; private IFormGroupService iFormGroupService;
@Autowired @Autowired
IWarehouseService iWarehouseService;
@Autowired
private IEqSourceFileService iEqSourceFileService; private IEqSourceFileService iEqSourceFileService;
@Autowired @Autowired
...@@ -361,10 +365,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -361,10 +365,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
private void synWarehouse(Map<String, Object> formKeyMap) { private void synWarehouse(Map<String, Object> formKeyMap) {
String parentId = (String) formKeyMap.get("parentId"); String parentId = (String) formKeyMap.get("parentId");
if ("0".equals(parentId)) { String stuctureName = formInstanceMapper.getStuctureName(parentId);
formKeyMap.put("address", formKeyMap.get("name")); if (StringUtils.isEmpty(stuctureName)){
} else { formKeyMap.put("address",formKeyMap.get("name"));
String stuctureName = formInstanceMapper.getStuctureName(parentId); }else {
formKeyMap.put("address", stuctureName + "-" + formKeyMap.get("name")); formKeyMap.put("address", stuctureName + "-" + formKeyMap.get("name"));
} }
formInstanceMapper.saveStucture(formKeyMap); formInstanceMapper.saveStucture(formKeyMap);
...@@ -1668,6 +1672,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1668,6 +1672,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
String orgCode = null; String orgCode = null;
String companyName = null; String companyName = null;
String dutyUser = null; String dutyUser = null;
//代码执行前 需清空数据库原有数据 涉及 wl_warehouse、wl_warehouse_structure、wl_form_instance。
formInstanceMapper.delete(null);
iWarehouseStructureService.getBaseMapper().delete(null);
iWarehouseService.getBaseMapper().delete(null);
if (!ObjectUtils.isEmpty(reginParams) && !ObjectUtils.isEmpty(reginParams.getPersonIdentity())) { if (!ObjectUtils.isEmpty(reginParams) && !ObjectUtils.isEmpty(reginParams.getPersonIdentity())) {
if (!ObjectUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) { if (!ObjectUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) {
companyCode = reginParams.getPersonIdentity().getBizOrgCode(); companyCode = reginParams.getPersonIdentity().getBizOrgCode();
...@@ -1705,11 +1715,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1705,11 +1715,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private void importBuildMessage(List<BuildingImportDto> collect, String orgCode, String bizOrgName, String bizOrgCode, String dutyUser) { private void importBuildMessage(List<BuildingImportDto> collect, String orgCode, String bizOrgName, String bizOrgCode, String dutyUser) {
// 处理建筑数据、入库 // 处理建筑数据、入库 并在wl_warehouse插入跟数据
//避免id重复且sourceId与id保持一致 通过雪花算法生成
SnowFlakeGenerateIdWorker snowFlakeGenerateIdWorker =
new SnowFlakeGenerateIdWorker(0L, 0L);
long id = snowFlakeGenerateIdWorker.nextId();
Warehouse warehouse = new Warehouse();
warehouse.setName(orgCode);
warehouse.setCompanyName(bizOrgName);
warehouse.setSourceCode("10000");
warehouse.setId(id);
warehouse.setSourceId(id);
iWarehouseService.getBaseMapper().insert(warehouse);
collect.forEach(item -> { collect.forEach(item -> {
HashMap<String, Object> buildingData = new HashMap<>(); HashMap<String, Object> buildingData = new HashMap<>();
// 建筑默认父级id 为顶级id // 建筑默认父级id 为顶级id
buildingData.put("parentId", 0); buildingData.put("parentId", id);
// 建筑类型 // 建筑类型
String groupCode = null; String groupCode = null;
if (!ObjectUtils.isEmpty(item.getBuildingType())) { if (!ObjectUtils.isEmpty(item.getBuildingType())) {
......
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IEquipmentHandlerService; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.patrol.business.service.intfc.IEquipmentHandlerService;
import com.yeejoin.amos.patrol.business.util.CommonResponse; import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil; import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
import com.yeejoin.amos.patrol.business.util.Toke; import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.core.common.request.ToJson;
import com.yeejoin.amos.patrol.dao.entity.InputItem; import com.yeejoin.amos.patrol.dao.entity.InputItem;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -70,7 +71,8 @@ public class EquipmentRuleController extends AbstractBaseController{ ...@@ -70,7 +71,8 @@ public class EquipmentRuleController extends AbstractBaseController{
// param.put("classifyId",classifyId); // param.put("classifyId",classifyId);
// param.put("orgCode",orgCode); // param.put("orgCode",orgCode);
List<InputItem> list=equipmentHandlerService.getEquipmnetRulesByName(equipmentName); List<InputItem> list=equipmentHandlerService.getEquipmnetRulesByName(equipmentName);
return CommonResponseUtil.success(list); Object ov= ToJson.tojson(list);
return CommonResponseUtil.success(ov);
} }
} }
...@@ -87,6 +87,8 @@ public class InputItemController extends AbstractBaseController { ...@@ -87,6 +87,8 @@ public class InputItemController extends AbstractBaseController {
*/ */
private static final String EQUIP_AND_FIRE_TREE = "EQUIP_AND_FIRE_TREE:"; private static final String EQUIP_AND_FIRE_TREE = "EQUIP_AND_FIRE_TREE:";
private static final String ITEMTYPE = "选择,文本:";
/** /**
* 新加接口***************************************************************************** * 新加接口*****************************************************************************
...@@ -376,11 +378,11 @@ public class InputItemController extends AbstractBaseController { ...@@ -376,11 +378,11 @@ public class InputItemController extends AbstractBaseController {
//此处对数据做统一处理 拼接为易读内容 //此处对数据做统一处理 拼接为易读内容
for (InputItemExcelVo inputItemExcelDto : content) { for (InputItemExcelVo inputItemExcelDto : content) {
String text = ""; String text = "";
if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")) { if (inputItemExcelDto.getItemType().equals("选择")&& !inputItemExcelDto.getDataJson().equals("[]")&& !inputItemExcelDto.getDataJson().equals("")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class); List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getDataJson(), Map.class);
for (int i = 0; i< maps.size(); i++) { for (int i = 0; i< maps.size(); i++) {
Map jsonObject = maps.get(i); Map jsonObject = maps.get(i);
text = text + jsonObject.get("name")+","+jsonObject.get("score")+","+jsonObject.get("isOk")+","+jsonObject.get("isChecked"); text = text +"名称:"+jsonObject.get("name")+" "+"评分:"+jsonObject.get("score")+" "+"选择是否合格:"+jsonObject.get("isOk")+" "+"默认选中:"+jsonObject.get("isChecked");
if(i < (maps.size()-1) ){ if(i < (maps.size()-1) ){
text = text+"|"; text = text+"|";
inputItemExcelDto.setDataJson(text); inputItemExcelDto.setDataJson(text);
...@@ -389,6 +391,20 @@ public class InputItemController extends AbstractBaseController { ...@@ -389,6 +391,20 @@ public class InputItemController extends AbstractBaseController {
} }
} }
} }
if (ITEMTYPE.contains(inputItemExcelDto.getItemType()) && !inputItemExcelDto.getPictureJson().equals("[]")&& !inputItemExcelDto.getPictureJson().equals("")) {
List<Map> maps = JSONObject.parseArray(inputItemExcelDto.getPictureJson(), Map.class);
text = "";
for (int i = 0; i< maps.size(); i++) {
Map jsonObject = maps.get(i);
text = text +"名称:"+ jsonObject.get("name")+","+ "是否拍照:"+jsonObject.get("isMust");
if(i < (maps.size()-1) ){
text = text+"|";
inputItemExcelDto.setPictureJson(text);
}else {
inputItemExcelDto.setPictureJson(text);
}
}
}
if (inputItemExcelDto.getItemType().equals("数字") || inputItemExcelDto.getItemType().equals("文本")) { if (inputItemExcelDto.getItemType().equals("数字") || inputItemExcelDto.getItemType().equals("文本")) {
//此处为避免大量set方法 将data_json字段中的数据转为对象组装 //此处为避免大量set方法 将data_json字段中的数据转为对象组装
InputItemDataJsonlDto inputItemDataJsonlDto = JSONObject.parseObject(inputItemExcelDto.getDataJson(), InputItemDataJsonlDto.class); InputItemDataJsonlDto inputItemDataJsonlDto = JSONObject.parseObject(inputItemExcelDto.getDataJson(), InputItemDataJsonlDto.class);
......
package com.yeejoin.amos.patrol.business.dto; package com.yeejoin.amos.patrol.business.dto;
import cn.jiguang.common.utils.StringUtils;
import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
...@@ -9,6 +8,7 @@ import com.yeejoin.amos.patrol.common.enums.PointCheckTypeEnum; ...@@ -9,6 +8,7 @@ import com.yeejoin.amos.patrol.common.enums.PointCheckTypeEnum;
import com.yeejoin.amos.patrol.common.enums.PointLevelEnum; import com.yeejoin.amos.patrol.common.enums.PointLevelEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import liquibase.pro.packaged.S;
import lombok.Data; import lombok.Data;
...@@ -66,7 +66,7 @@ public class InputItemExcelVo extends BaseDto { ...@@ -66,7 +66,7 @@ public class InputItemExcelVo extends BaseDto {
@ExcelProperty(value = "拍照项(文本/选择)", index = 14) @ExcelProperty(value = "拍照项(文本/选择)", index = 14)
@ApiModelProperty(value = "拍照项") @ApiModelProperty(value = "拍照项")
private Object pictureJson; private String pictureJson;
@ExplicitConstraint(indexNum=11,source = {"是","否"}) @ExplicitConstraint(indexNum=11,source = {"是","否"})
@ExcelProperty(value = "是否必填", index = 11) @ExcelProperty(value = "是否必填", index = 11)
...@@ -117,19 +117,19 @@ public class InputItemExcelVo extends BaseDto { ...@@ -117,19 +117,19 @@ public class InputItemExcelVo extends BaseDto {
@ExcelProperty(value = "强制校验,输入值不能大于有效值上限(数字)", index = 22) @ExcelProperty(value = "强制校验,输入值不能大于有效值上限(数字)", index = 22)
@ApiModelProperty(value = "强制校验,输入值不能大于有效值上限") @ApiModelProperty(value = "强制校验,输入值不能大于有效值上限")
private String checkValidUp = "false"; private String checkValidUp ;
@ExcelProperty(value = "强制校验,输入值不能小于有效值下限(数字)", index = 23) @ExcelProperty(value = "强制校验,输入值不能小于有效值下限(数字)", index = 23)
@ApiModelProperty(value = "强制校验,输入值不能小于有效值下限") @ApiModelProperty(value = "强制校验,输入值不能小于有效值下限")
private String checkValidDown = "false"; private String checkValidDown ;
@ExcelProperty(value = "合格判断,输入值大于合格值上限时为不合格(数字)", index = 24) @ExcelProperty(value = "合格判断,输入值大于合格值上限时为不合格(数字)", index = 24)
@ApiModelProperty(value = "合格判断,输入值大于合格值上限时为不合格") @ApiModelProperty(value = "合格判断,输入值大于合格值上限时为不合格")
private String checkOkUp = "false"; private String checkOkUp ;
@ExcelProperty(value = "合格判断,输入值小于合格值上限时为不合格(数字)", index = 25) @ExcelProperty(value = "合格判断,输入值小于合格值上限时为不合格(数字)", index = 25)
@ApiModelProperty(value = "合格判断,输入值小于合格值上限时为不合格") @ApiModelProperty(value = "合格判断,输入值小于合格值上限时为不合格")
private String checkOkDown = "false"; private String checkOkDown ;
@ExcelProperty(value = "小数点后位数(数字)", index = 26) @ExcelProperty(value = "小数点后位数(数字)", index = 26)
@ApiModelProperty(value = "小数点后位数") @ApiModelProperty(value = "小数点后位数")
...@@ -446,11 +446,11 @@ public class InputItemExcelVo extends BaseDto { ...@@ -446,11 +446,11 @@ public class InputItemExcelVo extends BaseDto {
this.orgCode = orgCode; this.orgCode = orgCode;
} }
public Object getPictureJson() { public String getPictureJson() {
return pictureJson; return pictureJson;
} }
public void setPictureJson(Object pictureJson) { public void setPictureJson(String pictureJson) {
this.pictureJson = pictureJson; this.pictureJson = pictureJson;
} }
......
...@@ -168,7 +168,10 @@ public class CheckServiceImpl implements ICheckService { ...@@ -168,7 +168,10 @@ public class CheckServiceImpl implements ICheckService {
Check check = checkDao.findById(imgList.get(0).getCheckId()).get(); Check check = checkDao.findById(imgList.get(0).getCheckId()).get();
check.setShotNumber(check.getShotNumber() + imgList.size()); check.setShotNumber(check.getShotNumber() + imgList.size());
checkDao.save(check); checkDao.save(check);
checkShotDao.saveAll(imgList); for (CheckShot cs: imgList
) {
checkShotDao.saveAndFlush(cs);
}
// 巡检站端与中心级数据同步 // 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override @Override
......
...@@ -286,7 +286,10 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement ...@@ -286,7 +286,10 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
}); });
}); });
if(!items.isEmpty()) { if(!items.isEmpty()) {
iRoutePointItemDao.saveAll(items); for (RoutePointItem routePointItem: items
) {
iRoutePointItemDao.saveAndFlush(routePointItem);
}
} }
} }
} }
......
...@@ -4822,101 +4822,91 @@ ...@@ -4822,101 +4822,91 @@
</select> </select>
<select id="getFoamTankBySuper" resultType="java.util.Map"> <select id="getFoamTankBySuper" resultType="java.util.Map">
SELECT
a.`name`,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.id,
IFNULL( a.image, '' ) AS image,
a.unit,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
(
CASE
WHEN a.nowLevel IS NULL select
OR a.minLevel IS NULL THEN *,
'--'
WHEN a.minLevel - a.nowLevel > 0 THEN
'缺水' ELSE '正常'
END
) AS levelStatus,
'foamTank' AS type
FROM
(
SELECT
ed.`name`,
es.iot_code,
es.id,
ec.image,
ei.unit,
max( CASE WHEN ei.equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' THEN ei.`value` END ) AS nowLevel,
max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) AS minLevel,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) AS maxLevel
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_specific_index ei ON es.id = ei.equipment_specific_id
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
LEFT JOIN wl_equipment_category ec ON e.category_id = ec.id
LEFT JOIN wl_form_instance_equip fi ON fi.instance_id = es.id
WHERE
ed.`code` LIKE '92031900%'
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND es.iot_code IS NOT NULL
GROUP BY
es.id
) a UNION ALL
SELECT
a.`name`,
IFNULL( a.nowLevel, '--' ) AS nowLevel,
a.id,
IFNULL( a.image, '' ) AS image,
'M' AS unit,
a.minLevel AS minLevel,
a.maxLevel AS maxLevel,
( (
CASE CASE
WHEN nowLevel IS NOT NULL
WHEN a.nowLevel IS NULL AND maxLevel IS NOT NULL
OR a.minLevel IS NULL THEN AND nowLevel - maxLevel > 0 THEN '1'
'--' WHEN nowLevel IS NOT NULL
WHEN a.minLevel - a.nowLevel > 0 THEN AND minLevel IS NOT NULL
'缺水' ELSE '正常' AND nowLevel != '--'
END AND nowLevel - minLevel >= 0 THEN '2'
) AS levelStatus, WHEN nowLevel IS NOT NULL
a.type AS type AND minLevel IS NOT NULL
FROM AND nowLevel != '--'
AND minLevel - nowLevel > 0 THEN '0'
ELSE '4'
END ) AS `status`
from
( (
SELECT SELECT
r.`name`, a.`name`, IFNULL( a.nowLevel, '--' ) AS nowLevel, a.id, IFNULL( a.image, '' ) AS image, a.unit, a.minLevel AS minLevel, a.maxLevel AS maxLevel, (
IFNULL( rp.min_water_level, 0 ) AS minLevel, CASE
IFNULL( rp.max_water_level, 0 ) AS maxLevel, WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN '--'
WHEN a.minLevel - a.nowLevel > 0 THEN '缺水'
ELSE '正常'
END ) AS levelStatus, 'foamTank' AS type
FROM
( (
SELECT SELECT
FORMAT( avg( IFNULL( ei.`value`, 0 ) ), 2 ) ed.`name`, es.iot_code, es.id, ec.image, ei.unit, max( CASE WHEN ei.equipment_index_key = 'CAFS_FoamTank_FoamTankLevel' THEN ei.`value` END ) AS nowLevel, max( CASE WHEN fi.field_name = 'minLevel' THEN fi.field_value END ) AS minLevel, max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) AS maxLevel
FROM FROM
wl_equipment_specific_index ei wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON
es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment_specific_index ei ON
es.id = ei.equipment_specific_id
LEFT JOIN wl_equipment e ON
e.id = ed.equipment_id
LEFT JOIN wl_equipment_category ec ON
e.category_id = ec.id
LEFT JOIN wl_form_instance_equip fi ON
fi.instance_id = es.id
WHERE WHERE
( ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' OR ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' ) ed.`code` LIKE '92031900%'
AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id ) > 0 AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
) AS nowLevel, AND es.iot_code IS NOT NULL
ec.image, GROUP BY
r.resource_type AS type, es.id ) a
r.sequence_nbr AS id UNION ALL
SELECT
a.`name`, IFNULL( a.nowLevel, '--' ) AS nowLevel, a.id, IFNULL( a.image, '' ) AS image, 'M' AS unit, a.minLevel AS minLevel, a.maxLevel AS maxLevel, (
CASE
WHEN a.nowLevel IS NULL
OR a.minLevel IS NULL THEN '--'
WHEN a.minLevel - a.nowLevel > 0 THEN '缺水'
ELSE '正常'
END ) AS levelStatus, a.type AS type
FROM FROM
cb_water_resource r (
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr SELECT
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id r.`name`, IFNULL( rp.min_water_level, 0 ) AS minLevel, IFNULL( rp.max_water_level, 0 ) AS maxLevel, (
WHERE SELECT
r.resource_type = 'waterTank' FORMAT( avg( IFNULL( ei.`value`, 0 ) ), 2 )
AND r.biz_org_code LIKE concat(#{bizOrgCode}, '%') FROM
wl_equipment_specific_index ei
AND r.is_delete = 1 WHERE
GROUP BY ( ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel'
r.sequence_nbr OR ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' )
) a AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id ) > 0 ) AS nowLevel, ec.image, r.resource_type AS type, r.sequence_nbr AS id
ORDER BY FROM
levelStatus DESC cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON
rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON
ec.id = r.equip_category_id
WHERE
r.resource_type = 'waterTank'
AND r.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND r.is_delete = 1
GROUP BY
r.sequence_nbr ) a
ORDER BY
levelStatus DESC ) as b order by status asc
</select> </select>
<select id="getPipeNetworkBySuper" resultType="java.util.Map"> <select id="getPipeNetworkBySuper" resultType="java.util.Map">
......
...@@ -219,6 +219,7 @@ ...@@ -219,6 +219,7 @@
a.user_name, a.user_name,
a.dep_name department_name, a.dep_name department_name,
a.dep_id departmentId, a.dep_id departmentId,
wws.name address,
date_format( date_format(
`a`.`check_time`, `a`.`check_time`,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
...@@ -249,7 +250,6 @@ ...@@ -249,7 +250,6 @@
) as is_ok, ) as is_ok,
a.score, a.score,
d.`name` AS `route_name`, d.`name` AS `route_name`,
( (
CASE CASE
WHEN a.check_mode = 'QR' WHEN a.check_mode = 'QR'
...@@ -266,9 +266,6 @@ ...@@ -266,9 +266,6 @@
'系统自检' '系统自检'
END END
) as check_mode, ) as check_mode,
e.`name` AS `plan_name`, e.`name` AS `plan_name`,
a.plan_task_id, a.plan_task_id,
a.plan_id, a.plan_id,
...@@ -281,6 +278,7 @@ ...@@ -281,6 +278,7 @@
LEFT JOIN `p_point` `b` ON `a`.`point_id` = `b`.`id` LEFT JOIN `p_point` `b` ON `a`.`point_id` = `b`.`id`
LEFT JOIN `p_route` `d` ON `a`.`route_id` = `d`.`id` LEFT JOIN `p_route` `d` ON `a`.`route_id` = `d`.`id`
LEFT JOIN `p_plan` `e` ON `a`.`plan_id` = `e`.`id` LEFT JOIN `p_plan` `e` ON `a`.`plan_id` = `e`.`id`
LEFT JOIN wl_warehouse_structure wws on wws.id = b.risk_source_id
<if test="dangerId != null and dangerId != ''"> <if test="dangerId != null and dangerId != ''">
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY check_id ) t ON t.check_id = a.id LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY check_id ) t ON t.check_id = a.id
</if> </if>
......
...@@ -398,7 +398,18 @@ ...@@ -398,7 +398,18 @@
IFNULL(a.key_parts_type,1) AS keyPartsType, IFNULL(a.key_parts_type,1) AS keyPartsType,
IFNULL(a.custom_type,1) AS customType, IFNULL(a.custom_type,1) AS customType,
a.risk_desc, a.risk_desc,
(CASE a.data_json
WHEN '[]' THEN
''
ELSE
a.data_json a.data_json
END ) AS dataJson,
(CASE a.picture_json
WHEN '[]' THEN
''
ELSE
a.picture_json
END ) AS pictureJson
from from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0' where a.is_delete = '0'
...@@ -441,10 +452,6 @@ ...@@ -441,10 +452,6 @@
<when test="level!=null and level != '-0'">and a.level = #{level}</when> <when test="level!=null and level != '-0'">and a.level = #{level}</when>
</choose> </choose>
order by a.id desc order by a.id desc
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose>
</select> </select>
<select id="getEquipParentCode" resultType="map"> <select id="getEquipParentCode" resultType="map">
......
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