Commit 39ff9f72 authored by 韩桐桐's avatar 韩桐桐

fix(jg && 96333):bug修改,维保过后的设备在进行96333应急管理时,带出俩维保负责人信息

parent 3e7cf358
...@@ -8,12 +8,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -8,12 +8,10 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
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.NameUtils; import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.*; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo; import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit; import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.elevator.api.service.IEnterpriseInfoService; import com.yeejoin.amos.boot.module.elevator.api.service.IEnterpriseInfoService;
import com.yeejoin.amos.boot.module.elevator.api.service.IMaintenanceUnitService; import com.yeejoin.amos.boot.module.elevator.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.elevator.api.service.ITzBaseEnterpriseInfoService;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.ElevatorServiceImpl; import com.yeejoin.amos.boot.module.elevator.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
...@@ -30,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -131,6 +128,7 @@ public class MaintenanceUnitController extends BaseController { ...@@ -131,6 +128,7 @@ public class MaintenanceUnitController extends BaseController {
Map<String, Object> objectMap = iMaintenanceUnitService.selectMessage(id); Map<String, Object> objectMap = iMaintenanceUnitService.selectMessage(id);
return ResponseHelper.buildResponse(objectMap); return ResponseHelper.buildResponse(objectMap);
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
...@@ -256,9 +254,9 @@ public class MaintenanceUnitController extends BaseController { ...@@ -256,9 +254,9 @@ public class MaintenanceUnitController extends BaseController {
} }
String orgCode = companyModels.get(0).getOrgCode(); String orgCode = companyModels.get(0).getOrgCode();
if ("50*18667".equals(orgCode)) { if ("50*18667".equals(orgCode)) {
enterpriseInfoQueryWrapper.likeRight("supervise_org_code","50*52").or().likeRight("supervise_org_code","50*73"); enterpriseInfoQueryWrapper.likeRight("supervise_org_code", "50*52").or().likeRight("supervise_org_code", "50*73");
} else { } else {
enterpriseInfoQueryWrapper.likeRight("supervise_org_code",orgCode); enterpriseInfoQueryWrapper.likeRight("supervise_org_code", orgCode);
} }
Class<? extends EnterpriseInfo> aClass = enterpriseInfo.getClass(); Class<? extends EnterpriseInfo> aClass = enterpriseInfo.getClass();
...@@ -268,7 +266,7 @@ public class MaintenanceUnitController extends BaseController { ...@@ -268,7 +266,7 @@ public class MaintenanceUnitController extends BaseController {
Object o = field.get(enterpriseInfo); Object o = field.get(enterpriseInfo);
if (o != null) { if (o != null) {
String name = NameUtils.camel2Underline(field.getName()); String name = NameUtils.camel2Underline(field.getName());
if ("city".equalsIgnoreCase(name) ) { if ("city".equalsIgnoreCase(name)) {
String fileValue = (String) o; String fileValue = (String) o;
enterpriseInfoQueryWrapper.eq(name, fileValue); enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("credit_level".equalsIgnoreCase(name)) { } else if ("credit_level".equalsIgnoreCase(name)) {
...@@ -318,7 +316,7 @@ public class MaintenanceUnitController extends BaseController { ...@@ -318,7 +316,7 @@ public class MaintenanceUnitController extends BaseController {
Object o = field.get(enterpriseInfo); Object o = field.get(enterpriseInfo);
if (o != null) { if (o != null) {
String name = NameUtils.camel2Underline(field.getName()); String name = NameUtils.camel2Underline(field.getName());
if ("city".equalsIgnoreCase(name) ) { if ("city".equalsIgnoreCase(name)) {
String fileValue = (String) o; String fileValue = (String) o;
enterpriseInfoQueryWrapper.eq(name, fileValue); enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("credit_level".equalsIgnoreCase(name)) { } else if ("credit_level".equalsIgnoreCase(name)) {
...@@ -342,18 +340,19 @@ public class MaintenanceUnitController extends BaseController { ...@@ -342,18 +340,19 @@ public class MaintenanceUnitController extends BaseController {
logger.error(e.getMessage()); logger.error(e.getMessage());
} }
}); });
if (!ObjectUtils.isEmpty(enterpriseInfoDto.getIds())){ if (!ObjectUtils.isEmpty(enterpriseInfoDto.getIds())) {
enterpriseInfoQueryWrapper.lambda().in(EnterpriseInfo :: getSequenceNbr, enterpriseInfo.getIds()); enterpriseInfoQueryWrapper.lambda().in(EnterpriseInfo::getSequenceNbr, enterpriseInfo.getIds());
} }
ArrayList<EnterpriseInfoExportDto> list = new ArrayList<>(); ArrayList<EnterpriseInfoExportDto> list = new ArrayList<>();
List<EnterpriseInfo> enterpriseInfos = iEnterpriseInfoService.getBaseMapper().selectList(enterpriseInfoQueryWrapper); List<EnterpriseInfo> enterpriseInfos = iEnterpriseInfoService.getBaseMapper().selectList(enterpriseInfoQueryWrapper);
enterpriseInfos.forEach(item ->{ enterpriseInfos.forEach(item -> {
EnterpriseInfoExportDto dto = new EnterpriseInfoExportDto(); EnterpriseInfoExportDto dto = new EnterpriseInfoExportDto();
BeanUtils.copyProperties(item, dto); BeanUtils.copyProperties(item, dto);
list.add(dto); list.add(dto);
}); });
ExcelUtil.createTemplate(response, "单位信息", "单位信息", list, EnterpriseInfoExportDto.class, null, false); ExcelUtil.createTemplate(response, "单位信息", "单位信息", list, EnterpriseInfoExportDto.class, null, false);
} }
/** /**
* 根据名称查询维保单位列表 * 根据名称查询维保单位列表
* *
...@@ -367,7 +366,7 @@ public class MaintenanceUnitController extends BaseController { ...@@ -367,7 +366,7 @@ public class MaintenanceUnitController extends BaseController {
false) String unitName) { false) String unitName) {
QueryWrapper<EnterpriseInfo> enterpriseInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<EnterpriseInfo> enterpriseInfoQueryWrapper = new QueryWrapper<>();
enterpriseInfoQueryWrapper.select("distinct sequence_nbr,use_unit").like(StringUtils.isNotEmpty(unitName), enterpriseInfoQueryWrapper.select("distinct sequence_nbr,use_unit").like(StringUtils.isNotEmpty(unitName),
"use_unit", unitName).like("unit_type","安装改造维修单位"); "use_unit", unitName).like("unit_type", "安装改造维修单位");
Page<EnterpriseInfo> pageBean = new Page<>(0, Long.MAX_VALUE); Page<EnterpriseInfo> pageBean = new Page<>(0, Long.MAX_VALUE);
IPage<EnterpriseInfo> page = iEnterpriseInfoService.page(pageBean, enterpriseInfoQueryWrapper); IPage<EnterpriseInfo> page = iEnterpriseInfoService.page(pageBean, enterpriseInfoQueryWrapper);
IPage<MaintenanceUnitNameDto> maintenanceUnitVoIPage = BeanDtoVoUtils.iPageVoStream(page, IPage<MaintenanceUnitNameDto> maintenanceUnitVoIPage = BeanDtoVoUtils.iPageVoStream(page,
...@@ -377,6 +376,7 @@ public class MaintenanceUnitController extends BaseController { ...@@ -377,6 +376,7 @@ public class MaintenanceUnitController extends BaseController {
/** /**
* 根据警情id 查找设备维保单位信息 * 根据警情id 查找设备维保单位信息
*
* @param alertId * @param alertId
* @return * @return
*/ */
...@@ -385,32 +385,32 @@ public class MaintenanceUnitController extends BaseController { ...@@ -385,32 +385,32 @@ public class MaintenanceUnitController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备维保单位信息", notes = "根据警情id 查找设备维保单位信息") @ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备维保单位信息", notes = "根据警情id 查找设备维保单位信息")
public ResponseModel<MaintenanceUnitDto> selectByAlertId(@PathVariable Long alertId) { public ResponseModel<MaintenanceUnitDto> selectByAlertId(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息 // 获取根据警情获取电梯信息
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId); Map<String, Object> map = elevatorServiceImpl.selectByAlertId(alertId);
if (ObjectUtils.isEmpty(map)) { if (ObjectUtils.isEmpty(map)) {
throw new BadRequest("设备未找到"); throw new BadRequest("设备未找到");
} }
// 根据设备使用id 获取维保单位信息 // 根据设备使用id 获取维保单位信息
List<Map<String,Object>> list = elevatorServiceImpl.selectMtByAlertId(String.valueOf(map.get("sequenceNbr"))); List<Map<String, Object>> list = elevatorServiceImpl.selectMtByAlertId(String.valueOf(map.get("sequenceNbr")));
if (ObjectUtils.isEmpty(list)) { if (ObjectUtils.isEmpty(list)) {
throw new BadRequest("维保单位未找到"); throw new BadRequest("维保单位未找到");
} }
MaintenanceUnitDto maintenanceUnitVo = new MaintenanceUnitDto(); MaintenanceUnitDto maintenanceUnitVo = new MaintenanceUnitDto();
maintenanceUnitVo.setUnitName(ObjectUtils.isEmpty(list.get(0).get("unitName")) ? null :String.valueOf(list.get(0).get("unitName"))); maintenanceUnitVo.setUnitName(ObjectUtils.isEmpty(list.get(0).get("unitName")) ? null : String.valueOf(list.get(0).get("unitName")));
maintenanceUnitVo.setAddress(ObjectUtils.isEmpty(list.get(0).get("address")) ? null :String.valueOf(list.get(0).get("address"))); maintenanceUnitVo.setAddress(ObjectUtils.isEmpty(list.get(0).get("address")) ? null : String.valueOf(list.get(0).get("address")));
maintenanceUnitVo.setId(ObjectUtils.isEmpty(list.get(0).get("sequenceNbr")) ? null : String.valueOf(list.get(0).get("sequenceNbr"))); maintenanceUnitVo.setId(ObjectUtils.isEmpty(list.get(0).get("sequenceNbr")) ? null : String.valueOf(list.get(0).get("sequenceNbr")));
maintenanceUnitVo.setSocialCreditCode(ObjectUtils.isEmpty(list.get(0).get("useCode")) ? null : String.valueOf(list.get(0).get("useCode"))); maintenanceUnitVo.setSocialCreditCode(ObjectUtils.isEmpty(list.get(0).get("useCode")) ? null : String.valueOf(list.get(0).get("useCode")));
List<DutyPersonDto> dutyPersonList = new ArrayList<DutyPersonDto>(); List<DutyPersonDto> dutyPersonList = new ArrayList<DutyPersonDto>();
DutyPersonDto principal = new DutyPersonDto(); DutyPersonDto principal = new DutyPersonDto();
principal.setDeptName("主要负责人1"); principal.setDeptName("主要负责人1");
principal.setPhone(ObjectUtils.isEmpty(list.get(0).get("phone")) ? null :String.valueOf(list.get(0).get("phone"))); principal.setPhone(ObjectUtils.isEmpty(list.get(0).get("phone")) ? null : String.valueOf(list.get(0).get("phone")));
principal.setUserId(null); principal.setUserId(null);
principal.setUserName(ObjectUtils.isEmpty(list.get(0).get("userName")) ? null : String.valueOf(list.get(0).get("userName"))); principal.setUserName(ObjectUtils.isEmpty(list.get(0).get("userName")) ? null : String.valueOf(list.get(0).get("userName")));
dutyPersonList.add(principal); dutyPersonList.add(principal);
DutyPersonDto manager = new DutyPersonDto(); DutyPersonDto manager = new DutyPersonDto();
manager.setDeptName("主要负责人2"); manager.setDeptName("主要负责人2");
// manager.setPhone(list.size() == 2 ? String.valueOf(list.get(0).get("phone")) : null); manager.setPhone(list.size() == 2 ? String.valueOf(list.get(0).get("phone")) : null);
// manager.setUserId(null); manager.setUserId(null);
// manager.setUserName(list.size() == 2 ? String.valueOf(list.get(0).get("userName")) : null); manager.setUserName(list.size() == 2 ? String.valueOf(list.get(0).get("userName")) : null);
dutyPersonList.add(manager); dutyPersonList.add(manager);
maintenanceUnitVo.setDutyPersonList(dutyPersonList); maintenanceUnitVo.setDutyPersonList(dutyPersonList);
......
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