Commit 5209a24b authored by KeYong's avatar KeYong

Merge branch 'develop_ccs' of 172.16.10.76:moa/amos-boot-biz into develop_ccs

parents dd1401f4 ba8f34c9
...@@ -30,4 +30,6 @@ public class BuildSearchDTO { ...@@ -30,4 +30,6 @@ public class BuildSearchDTO {
* 分组类型 * 分组类型
*/ */
private String groupType; private String groupType;
private String bizOrgCode;
} }
...@@ -15,4 +15,6 @@ public class VideoDTO extends BaseDTO<Video> { ...@@ -15,4 +15,6 @@ public class VideoDTO extends BaseDTO<Video> {
* 监控 * 监控
*/ */
Video video; Video video;
String orgTypes;
} }
...@@ -281,4 +281,12 @@ public class BuildingController extends AbstractBaseController { ...@@ -281,4 +281,12 @@ public class BuildingController extends AbstractBaseController {
public Map<String, String> getBuildingToLongitudeAndLatitude(@RequestParam String instanceId){ public Map<String, String> getBuildingToLongitudeAndLatitude(@RequestParam String instanceId){
return buildService.getBuildingToLongitudeAndLatitude(instanceId); return buildService.getBuildingToLongitudeAndLatitude(instanceId);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("公司消防建筑树")
@GetMapping(value = "/companyBuildingTree")
public List<BuildingTreeVo> getCompanyBuildingTree() {
return buildService.getCompanyBuildingTree();
}
} }
...@@ -21,6 +21,7 @@ import org.springframework.http.HttpHeaders; ...@@ -21,6 +21,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -100,6 +101,7 @@ import com.yeejoin.equipmanage.service.ISyncDataService; ...@@ -100,6 +101,7 @@ import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.ISystemDicService; import com.yeejoin.equipmanage.service.ISystemDicService;
import com.yeejoin.equipmanage.service.ProductionQRCode; import com.yeejoin.equipmanage.service.ProductionQRCode;
import com.yeejoin.equipmanage.service.impl.EquipmentSpecificSerivceImpl; import com.yeejoin.equipmanage.service.impl.EquipmentSpecificSerivceImpl;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -118,90 +120,94 @@ import lombok.extern.slf4j.Slf4j; ...@@ -118,90 +120,94 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class CarController extends AbstractBaseController { public class CarController extends AbstractBaseController {
@Autowired @Autowired
@Lazy @Lazy
ICarService iCarService; ICarService iCarService;
@Autowired @Autowired
private EquipmentMapper equipmentMapper; private EquipmentMapper equipmentMapper;
@Autowired @Autowired
ISystemDicService iSystemDicService; ISystemDicService iSystemDicService;
@Autowired @Autowired
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired @Autowired
ICarInfoService iCarInfoService; ICarInfoService iCarInfoService;
@Autowired @Autowired
ICarPropertyService iCarPropertyService; ICarPropertyService iCarPropertyService;
@Autowired @Autowired
CarInfoMapper carInfoMapper; CarInfoMapper carInfoMapper;
@Autowired @Autowired
private ManufacturerInfoMapper manufacturerInfoMapper; private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired @Autowired
private CarPropertyMapper carPropertyMapper; private CarPropertyMapper carPropertyMapper;
@Autowired @Autowired
IEquipmentOnCarService iEquipmentOnCarService; IEquipmentOnCarService iEquipmentOnCarService;
@Autowired @Autowired
ExtinguishantOnCarMapper extinguishantOnCarMapper; ExtinguishantOnCarMapper extinguishantOnCarMapper;
@Autowired @Autowired
SystemDicMapper systemDicMapper; SystemDicMapper systemDicMapper;
@Autowired @Autowired
CarMapper carMapper; CarMapper carMapper;
@Autowired @Autowired
private EquipmentIndexMapper equipmentIndexMapper; private EquipmentIndexMapper equipmentIndexMapper;
@Autowired @Autowired
EquipmentDetailMapper equipmentDetailMapper; EquipmentDetailMapper equipmentDetailMapper;
@Autowired @Autowired
EquipmentQrcodeMapper equipmentQrcodeMapper; EquipmentQrcodeMapper equipmentQrcodeMapper;
@Resource(name = "productionQRCodeFactoryMap") @Resource(name = "productionQRCodeFactoryMap")
private Map<String, ProductionQRCode> messageHandMap; private Map<String, ProductionQRCode> messageHandMap;
@Autowired @Autowired
EquipmentIotMqttReceiveConfig equipmentIotMqttReceiveConfig; EquipmentIotMqttReceiveConfig equipmentIotMqttReceiveConfig;
@Autowired @Autowired
ICarLonAndLatDataService iCarLonAndLatDataService; ICarLonAndLatDataService iCarLonAndLatDataService;
@Autowired @Autowired
IEquipmentService iEquipmentService; IEquipmentService iEquipmentService;
@Autowired @Autowired
IEquipmentDetailService iEquipmentDetailService; IEquipmentDetailService iEquipmentDetailService;
@Autowired @Autowired
IEquipmentQrcodeService iEquipmentQrcodeService; IEquipmentQrcodeService iEquipmentQrcodeService;
@Autowired @Autowired
IEquipmentIndexService iEquipmentIndexService; IEquipmentIndexService iEquipmentIndexService;
@Autowired @Autowired
private ISyncDataService syncDataService; private ISyncDataService syncDataService;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Value("${security.productApp}") @Value("${security.productApp}")
private String productApp; private String productApp;
@Value("${security.appKeyApp}") @Value("${security.appKeyApp}")
private String appKeyApp; private String appKeyApp;
@Value("${iot.vehicle.track}") @Value("${iot.vehicle.track}")
private String iotServerName; private String iotServerName;
@Value("${fileserver_domain}") @Value("${fileserver_domain}")
private String fileServer; private String fileServer;
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
private Boolean syncSwitch; private Boolean syncSwitch;
@Value("${auth-key-fire-car}") @Value("${auth-key-fire-car}")
private String carAuthKey; private String carAuthKey;
@Autowired @Autowired
JcsFeign jcsFeign; JcsFeign jcsFeign;
/** @Autowired
* 新增消防车信息 FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
*
* @return /**
*/ * 新增消防车信息
@RequestMapping(value = "/save", method = RequestMethod.POST) *
@TycloudOperation(ApiLevel = UserType.AGENCY) * @return
@ApiOperation(httpMethod = "POST", value = "新增消防车信息", notes = "新增消防车信息") * @throws Exception
public Car saveCar(HttpServletRequest request, @RequestBody Car car) { */
@RequestMapping(value = "/save", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增消防车信息", notes = "新增消防车信息")
public Car saveCar(HttpServletRequest request, @RequestBody Car car) {
// Car car = carRequest.getCar(); // Car car = carRequest.getCar();
// if (carRequest == null || carRequest.getCar() == null) { // if (carRequest == null || carRequest.getCar() == null) {
// return new CommonResponse(FAILED, "参数有误"); // return new CommonResponse(FAILED, "参数有误");
...@@ -211,73 +217,85 @@ public class CarController extends AbstractBaseController { ...@@ -211,73 +217,85 @@ public class CarController extends AbstractBaseController {
// Set<CarProperty> carpList = carRequest.getCarPropertyList(); // Set<CarProperty> carpList = carRequest.getCarPropertyList();
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList); // Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理 // saveFile(carInstance); 图片视频后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig); EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
car.setQrCode(QRCodeUtil.generateQRCode()); car.setQrCode(QRCodeUtil.generateQRCode());
List<CarProperty> carPropertyList = car.getCarPropertyList(); List<CarProperty> carPropertyList = car.getCarPropertyList();
if (carPropertyList.size() > 0) { if (carPropertyList.size() > 0) {
carPropertyList.forEach(x -> { carPropertyList.forEach(x -> {
QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", x.getEquipmentIndexId()); queryWrapper.eq("id", x.getEquipmentIndexId());
EquipmentIndex equipmentIndex = iEquipmentIndexService.getOne(queryWrapper); EquipmentIndex equipmentIndex = iEquipmentIndexService.getOne(queryWrapper);
String state = equipmentIndex.getPerfQuotaDefinitionId(); String state = equipmentIndex.getPerfQuotaDefinitionId();
if ("state".equals(state)) { if ("state".equals(state)) {
if ("是".equals(x.getValue())) { if ("是".equals(x.getValue())) {
x.setValue(TrueOrFalseEnum.real.value); x.setValue(TrueOrFalseEnum.real.value);
} else { } else {
x.setValue(TrueOrFalseEnum.fake.value); x.setValue(TrueOrFalseEnum.fake.value);
} }
} }
}); });
} }
iCarService.refreshStaData();
return iCarService.saveOne(car); refreshCount(car.getBizOrgCode());
} return iCarService.saveOne(car);
}
/**
* 根据iotCode查询 @Async
* public void refreshCount(String bizOrgCode) {
* @param iotCode iCarService.refreshStaData();
* @return try {
*/ fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
@RequestMapping(value = "/checkIotCode/{iotCode}/{id}", method = RequestMethod.GET) } catch (Exception e) {
@TycloudOperation(ApiLevel = UserType.AGENCY) }
@ApiOperation(httpMethod = "GET", value = "根据iotCode查询", notes = "根据iotCode查询")
public ResponseModel selectByIotCode(HttpServletRequest request, @PathVariable String iotCode, @PathVariable String id) { }
Map map1 = new HashMap();
map1.put("state", "FAILED"); /**
map1.put("message", "若您设置物联编码,请至少输入9位字符!"); * 根据iotCode查询
Map map2 = new HashMap(); *
map2.put("state", "DUPLICATE"); * @param iotCode
map2.put("message", "物联编码重复,请重新设置!"); * @return
Map map3 = new HashMap(); */
map3.put("state", "SUCCESS"); @RequestMapping(value = "/checkIotCode/{iotCode}/{id}", method = RequestMethod.GET)
map3.put("message", "成功!"); @TycloudOperation(ApiLevel = UserType.AGENCY)
if (iotCode.trim().length() < 9) { @ApiOperation(httpMethod = "GET", value = "根据iotCode查询", notes = "根据iotCode查询")
return CommonResponseUtil.success(map1); public ResponseModel selectByIotCode(HttpServletRequest request, @PathVariable String iotCode,
} @PathVariable String id) {
List<String> list = carMapper.getIotCodeList(id); Map map1 = new HashMap();
List<String> iotCodeList = new ArrayList<String>(); map1.put("state", "FAILED");
if (list != null && !list.isEmpty()) { map1.put("message", "若您设置物联编码,请至少输入9位字符!");
iotCodeList = list.stream().filter(x -> x.equals(iotCode)).collect(Collectors.toList()); Map map2 = new HashMap();
} map2.put("state", "DUPLICATE");
if (iotCodeList.size() == 0) { map2.put("message", "物联编码重复,请重新设置!");
return CommonResponseUtil.success(map3); Map map3 = new HashMap();
} else { map3.put("state", "SUCCESS");
return CommonResponseUtil.success(map2); map3.put("message", "成功!");
} if (iotCode.trim().length() < 9) {
} return CommonResponseUtil.success(map1);
}
/** List<String> list = carMapper.getIotCodeList(id);
* 编辑消防车 List<String> iotCodeList = new ArrayList<String>();
* if (list != null && !list.isEmpty()) {
* @return iotCodeList = list.stream().filter(x -> x.equals(iotCode)).collect(Collectors.toList());
*/ }
@TycloudOperation(ApiLevel = UserType.AGENCY) if (iotCodeList.size() == 0) {
@ApiOperation(httpMethod = "PUT", value = "编辑车辆信息(<font color='blue'>release</font>)", notes = "编辑车辆信息") return CommonResponseUtil.success(map3);
@PostMapping(value = "/update", produces = "application/json;charset=UTF-8") } else {
public Car updateCar(@ApiParam(value = "车辆对象", required = true) @RequestBody Car car) { return CommonResponseUtil.success(map2);
}
}
/**
* 编辑消防车
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "编辑车辆信息(<font color='blue'>release</font>)", notes = "编辑车辆信息")
@PostMapping(value = "/update", produces = "application/json;charset=UTF-8")
public Car updateCar(@ApiParam(value = "车辆对象", required = true) @RequestBody Car car) {
// Car car = iCarService.getById(carRequest.getCar().getId()); // Car car = iCarService.getById(carRequest.getCar().getId());
// if (null == car) { // if (null == car) {
// return new CommonResponse(FAILED, "未查询到该车辆!"); // return new CommonResponse(FAILED, "未查询到该车辆!");
...@@ -290,870 +308,867 @@ public class CarController extends AbstractBaseController { ...@@ -290,870 +308,867 @@ public class CarController extends AbstractBaseController {
// carInstance.setImPassword(car.getImPassword()); // carInstance.setImPassword(car.getImPassword());
// Set<CarProperty> carpList = carRequest.getCarPropertyList(); // Set<CarProperty> carpList = carRequest.getCarPropertyList();
// carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList); // carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList);
// saveFile(carInstance);视频图片文件后期统一处理 // saveFile(carInstance);视频图片文件后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig); EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
iCarService.refreshStaData(); refreshCount(car.getBizOrgCode());
return iCarService.updateOneById(car); return iCarService.updateOneById(car);
} }
/** /**
* 根据id删除 * 根据id删除
* *
* @param * @param
* @return * @return
*/ */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public CommonResponse deleteById(@ApiParam(value = "车辆管理id", required = true) @RequestParam("ids") String... ids) { public CommonResponse deleteById(@ApiParam(value = "车辆管理id", required = true) @RequestParam("ids") String... ids) {
List<String> idStrings = Arrays.asList(ids); List<String> idStrings = Arrays.asList(ids);
QueryWrapper<EquipmentOnCar> queryWrapper = new QueryWrapper<EquipmentOnCar>(); QueryWrapper<EquipmentOnCar> queryWrapper = new QueryWrapper<EquipmentOnCar>();
queryWrapper.lambda().in(EquipmentOnCar::getCarId, idStrings); queryWrapper.lambda().in(EquipmentOnCar::getCarId, idStrings);
List<EquipmentOnCar> result = iEquipmentOnCarService.list(queryWrapper); List<EquipmentOnCar> result = iEquipmentOnCarService.list(queryWrapper);
if (!result.isEmpty()) { if (!result.isEmpty()) {
return new CommonResponse(FAILED, "无法删除已有车载装备的数据!"); return new CommonResponse(FAILED, "无法删除已有车载装备的数据!");
} else { } else {
boolean b = iCarService.removeByIds(idStrings); boolean b = iCarService.removeByIds(idStrings);
// AST数据同步 // AST数据同步
if (b && syncSwitch) { if (b && syncSwitch) {
List<Long> carIds = idStrings.stream().map(id -> Long.parseLong(id.trim())).collect(Collectors.toList()); List<Long> carIds = idStrings.stream().map(id -> Long.parseLong(id.trim()))
syncDataService.syncDeletedFireVehicle(carIds); .collect(Collectors.toList());
iCarService.dataSyncDeletedIds(carIds); syncDataService.syncDeletedFireVehicle(carIds);
} iCarService.dataSyncDeletedIds(carIds);
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic(); }
boolean flag = false; String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
for (String id : idStrings) { boolean flag = false;
String iotCode = iCarService.getById(id).getIotCode(); for (String id : idStrings) {
if (StringUtil.isNotEmpty(iotCode)) { String iotCode = iCarService.getById(id).getIotCode();
String prefix = iotCode.substring(0, 8); if (StringUtil.isNotEmpty(iotCode)) {
String suffix = iotCode.substring(8); String prefix = iotCode.substring(0, 8);
String oldTopic = prefix + "/" + suffix + "/property"; String suffix = iotCode.substring(8);
for (String topic : topics) { String oldTopic = prefix + "/" + suffix + "/property";
if (topic.equals(oldTopic)) { for (String topic : topics) {
flag = true; if (topic.equals(oldTopic)) {
break; flag = true;
} break;
} }
if (flag) { }
try { if (flag) {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property"); try {
} catch (Exception e) { equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
e.printStackTrace(); } catch (Exception e) {
} e.printStackTrace();
} }
} }
} }
iCarService.refreshStaData(); }
return new CommonResponse(SUCCESS); return new CommonResponse(SUCCESS);
} }
} }
/** /**
* 根据id查询 * 根据id查询
* *
* @param id * @param id
* @return * @return
*/ */
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car selectById(HttpServletRequest request, @PathVariable Long id) { public Car selectById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.selectOneById(id); return iCarService.selectOneById(id);
} }
/** /**
* 根据id查询车辆详情信息 * 根据id查询车辆详情信息
* *
* @param id * @param id
* @return * @return
*/ */
@RequestMapping(value = "/getCarDetailById/{id}", method = RequestMethod.GET) @RequestMapping(value = "/getCarDetailById/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询") @ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car getCarDetailById(HttpServletRequest request, @PathVariable Long id) { public Car getCarDetailById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.getCarDetailById(id); return iCarService.getCarDetailById(id);
} }
/** /**
* 根据车辆id查询车辆详情信息,供iot_tree展示 * 根据车辆id查询车辆详情信息,供iot_tree展示
* *
* @param carNum * @param carNum
* @return * @return
*/ */
@RequestMapping(value = "/threeDimensional/getCarDetailById/{id}", method = RequestMethod.GET) @RequestMapping(value = "/threeDimensional/getCarDetailById/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车辆id查询", notes = "根据车辆id查询") @ApiOperation(httpMethod = "GET", value = "根据车辆id查询", notes = "根据车辆id查询")
public CarForUE4VO getCarDetailByCarNumToThreeDimensional (HttpServletRequest request, @PathVariable Long id) { public CarForUE4VO getCarDetailByCarNumToThreeDimensional(HttpServletRequest request, @PathVariable Long id) {
String orgCode = getOrgCode(); String orgCode = getOrgCode();
return iCarService.getCarDetailByCarNumToThreeDimensional(id, orgCode); return iCarService.getCarDetailByCarNumToThreeDimensional(id, orgCode);
} }
/**
/** * 根据车牌号查询车辆详情信息
* 根据车牌号查询车辆详情信息 *
* * @param carNum
* @param carNum * @return
* @return */
*/ @RequestMapping(value = "/getCarDetailByCarNum/{carNum}", method = RequestMethod.GET)
@RequestMapping(value = "/getCarDetailByCarNum/{carNum}", method = RequestMethod.GET) @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "根据车牌号查询", notes = "根据车牌号查询")
@ApiOperation(httpMethod = "GET", value = "根据车牌号查询", notes = "根据车牌号查询") public Car getCarDetailByCarNum(HttpServletRequest request, @PathVariable String carNum) {
public Car getCarDetailByCarNum(HttpServletRequest request, @PathVariable String carNum) { String orgCode = getOrgCode();
String orgCode = getOrgCode(); return iCarService.getCarDetailByCarNum(carNum, orgCode);
return iCarService.getCarDetailByCarNum(carNum, orgCode); }
}
/**
/** * 列表分页查询
* 列表分页查询 *
* * @return
* @return */
*/ @RequestMapping(value = "/list", method = RequestMethod.GET)
@RequestMapping(value = "/list", method = RequestMethod.GET) @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") public IPage<Car> listPage(String pageNum, String pageSize, Car car) {
public IPage<Car> listPage(String pageNum, String pageSize, Car car) {
Page<Car> pageBean;
Page<Car> pageBean; QueryWrapper<Car> carQueryWrapper = new QueryWrapper<>();
QueryWrapper<Car> carQueryWrapper = new QueryWrapper<>(); Class<? extends Car> aClass = car.getClass();
Class<? extends Car> aClass = car.getClass(); Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> { try {
try { field.setAccessible(true);
field.setAccessible(true); Object o = field.get(car);
Object o = field.get(car); if (o != null) {
if (o != null) { Class<?> type = field.getType();
Class<?> type = field.getType(); String name = NameUtils.camel2Underline(field.getName());
String name = NameUtils.camel2Underline(field.getName()); if (type.equals(Integer.class)) {
if (type.equals(Integer.class)) { Integer fileValue = (Integer) field.get(car);
Integer fileValue = (Integer) field.get(car); carQueryWrapper.eq(name, fileValue);
carQueryWrapper.eq(name, fileValue); } else if (type.equals(Long.class)) {
} else if (type.equals(Long.class)) { Long fileValue = (Long) field.get(car);
Long fileValue = (Long) field.get(car); carQueryWrapper.eq(name, fileValue);
carQueryWrapper.eq(name, fileValue); } else if (type.equals(String.class)) {
} else if (type.equals(String.class)) { String fileValue = (String) field.get(car);
String fileValue = (String) field.get(car); carQueryWrapper.eq(name, fileValue);
carQueryWrapper.eq(name, fileValue); } else {
} else { String fileValue = (String) field.get(car);
String fileValue = (String) field.get(car); carQueryWrapper.eq(name, fileValue);
carQueryWrapper.eq(name, fileValue); }
} }
} } catch (Exception e) {
} catch (Exception e) { }
} });
}); IPage<Car> page;
IPage<Car> page; if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { pageBean = new Page<>(0, Long.MAX_VALUE);
pageBean = new Page<>(0, Long.MAX_VALUE); } else {
} else { pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); }
} page = iCarService.page(pageBean, car);
page = iCarService.page(pageBean, car); return page;
return page; }
}
/**
/** * http://172.16.11.15:8080/carmanager/create
* http://172.16.11.15:8080/carmanager/create *
* * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "创建车辆初始化(<font color='blue'>release</font>)", notes = "创建车辆初始化")
@ApiOperation(httpMethod = "GET", value = "创建车辆初始化(<font color='blue'>release</font>)", notes = "创建车辆初始化") @GetMapping(value = "/init", produces = "application/json;charset=UTF-8")
@GetMapping(value = "/init", produces = "application/json;charset=UTF-8") public CommonResponse createInit() {
public CommonResponse createInit() { List<SystemDic> carStatusList = iSystemDicService.findAllByType(SystemDicTypeEum.carState.getType());
List<SystemDic> carStatusList = iSystemDicService.findAllByType(SystemDicTypeEum.carState.getType()); List<SystemDic> dropDownPerformance = iSystemDicService.findAllByType(SystemDicTypeEum.perfQuotaType.getType());
List<SystemDic> dropDownPerformance = iSystemDicService.findAllByType(SystemDicTypeEum.perfQuotaType.getType()); Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(); result.put("performances", dropDownPerformance);
result.put("performances", dropDownPerformance); result.put("carStatus", carStatusList);
result.put("carStatus", carStatusList); return new CommonResponse(SUCCESS, result);
return new CommonResponse(SUCCESS, result);
}
}
/**
/** * <pre>
* <pre> * 获取车辆国别数据
* 获取车辆国别数据 * </pre>
* </pre> *
* * @return CommonResponse
* @return CommonResponse * @throws @version: 1.0
* @throws @version: 1.0 */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "获取车辆国别数据(<font color='blue'>release</font>)", notes = "获取车辆国别数据")
@ApiOperation(httpMethod = "GET", value = "获取车辆国别数据(<font color='blue'>release</font>)", notes = "获取车辆国别数据") @RequestMapping(value = "/countrys", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@RequestMapping(value = "/countrys", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") public CommonResponse getCountrys() {
public CommonResponse getCountrys() { List<SystemDic> countryList = iSystemDicService.findAllByType(SystemDicTypeEum.country.getType());
List<SystemDic> countryList = iSystemDicService.findAllByType(SystemDicTypeEum.country.getType()); return new CommonResponse(SUCCESS, countryList);
return new CommonResponse(SUCCESS, countryList); }
}
/**
/** * <pre>
* <pre> * 车辆分类列表
* 车辆分类列表 * </pre>
* </pre> *
* * @return CommonResponse
* @return CommonResponse * @throws @version: 1.0
* @throws @version: 1.0 */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "车辆分类列表(<font color='blue'>release</font>)", notes = "按装备分类,获取该分类下级树")
@ApiOperation(httpMethod = "GET", value = "车辆分类列表(<font color='blue'>release</font>)", notes = "按装备分类,获取该分类下级树") @RequestMapping(value = "/query/carCategory", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@RequestMapping(value = "/query/carCategory", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") public CommonResponse queryCarCategory() {
public CommonResponse queryCarCategory() {
List<EquipmentCategory> results = iCarService.getCarCategory();
List<EquipmentCategory> results = iCarService.getCarCategory(); List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> list = new ArrayList<>(); for (EquipmentCategory instance : results) {
for (EquipmentCategory instance : results) { if (instance.getParentId() == null || instance.getLevel().equals("1")) {
if (instance.getParentId() == null || instance.getLevel().equals("1")) { list.add(instance);
list.add(instance); } else {
} else { getChildren(list, instance.getParentId().toString()).add(instance);
getChildren(list, instance.getParentId().toString()).add(instance); }
} }
} return new CommonResponse(SUCCESS, list);
return new CommonResponse(SUCCESS, list);
}
}
/**
/** * 根据装备分类list,递归找到对应的分类子集。
* 根据装备分类list,递归找到对应的分类子集。 *
* * @param list
* @param list * @param id
* @param id * @return
* @return */
*/ private List<EquipmentCategory> getChildren(List<EquipmentCategory> list, String id) {
private List<EquipmentCategory> getChildren(List<EquipmentCategory> list, String id) { List<EquipmentCategory> temp = null;
List<EquipmentCategory> temp = null; for (EquipmentCategory instance : list) {
for (EquipmentCategory instance : list) { if (instance.getId() != null && !instance.getId().toString().equals(id)) {
if (instance.getId() != null && !instance.getId().toString().equals(id)) { temp = getChildren(instance.getChildren(), id);
temp = getChildren(instance.getChildren(), id); if (null != temp) {
if (null != temp) { break;
break; }
} } else {
} else { instance.setHasLowerClassification(true);
instance.setHasLowerClassification(true); temp = instance.getChildren();
temp = instance.getChildren(); break;
break; }
} }
} return temp;
return temp;
}
}
/**
/** * 获取损耗车辆列表
* 获取损耗车辆列表 *
* * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "装备药剂的车辆列表-APP", notes = "装备药剂的车辆列表")
@ApiOperation(httpMethod = "GET", value = "装备药剂的车辆列表-APP", notes = "装备药剂的车辆列表") @RequestMapping(value = "/queryExtinguishantOnCarlist", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@RequestMapping(value = "/queryExtinguishantOnCarlist", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") public List<Map<String, Object>> queryExtinguishantOnCarlist() {
public List<Map<String, Object>> queryExtinguishantOnCarlist() { try {
try { ArrayList<String> strings = new ArrayList<>();
ArrayList<String> strings = new ArrayList<>(); strings.add(CarStatusEnum.WX.getCode());
strings.add(CarStatusEnum.WX.getCode()); strings.add(CarStatusEnum.TY.getCode());
strings.add(CarStatusEnum.TY.getCode()); strings.add(CarStatusEnum.BF.getCode());
strings.add(CarStatusEnum.BF.getCode()); List<Map<String, Object>> list = extinguishantOnCarMapper.queryExtinguishantOnCarlist(strings);
List<Map<String, Object>> list = extinguishantOnCarMapper.queryExtinguishantOnCarlist(strings); return list;
return list; } catch (Exception e) {
} catch (Exception e) { throw new RuntimeException("查询异常!");
throw new RuntimeException("查询异常!"); }
} }
}
/**
/** * 获取车辆车载
* 获取车辆车载 *
* * @param carId
* @param carId * @param pageNum
* @param pageNum * @param pageSize
* @param pageSize * @param code
* @param code * @return
* @return */
*/ @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "GET", value = "获取车辆装载灭火药剂(<font color='blue'>release</font>)", notes = "获取车辆装载")
@ApiOperation(httpMethod = "GET", value = "获取车辆装载灭火药剂(<font color='blue'>release</font>)", notes = "获取车辆装载") @RequestMapping(value = "/car/extinguishants", method = RequestMethod.GET)
@RequestMapping(value = "/car/extinguishants", method = RequestMethod.GET) public Page getCarExtinguishants(Long carId, String pageNum, String pageSize, String code) {
public Page getCarExtinguishants(Long carId, String pageNum, String pageSize, String code) { try {
try {
if (code != null && !"".equals(code)) {
if (code != null && !"".equals(code)) { code = code.substring(0, 2);
code = code.substring(0, 2); }
} Page pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
Page pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); List<Map<String, Object>> list = extinguishantOnCarMapper.getCarExtinguishants(null, carId,
List<Map<String, Object>> list = extinguishantOnCarMapper.getCarExtinguishants(null, carId, pageBean.offset(), pageBean.getSize(), code);
pageBean.offset(), pageBean.getSize(), code); int count = extinguishantOnCarMapper.getCarExtinguishantscount(null, carId, code);
int count = extinguishantOnCarMapper.getCarExtinguishantscount(null, carId, code); if (list != null && list.size() > 0) {
if (list != null && list.size() > 0) { for (Map<String, Object> map : list) {
for (Map<String, Object> map : list) { String img = (String) map.get("img");
String img = (String) map.get("img"); if (img != null && !"".equals(img)) {
if (img != null && !"".equals(img)) { map.put("img", fileServer + img);
map.put("img", fileServer + img); }
} }
} }
} pageBean.setTotal(count);
pageBean.setTotal(count); pageBean.setRecords(list);
pageBean.setRecords(list); return pageBean;
return pageBean;
} catch (Exception e) {
} catch (Exception e) { throw new RuntimeException("查询异常!");
throw new RuntimeException("查询异常!"); }
} }
}
// 车辆灭火药剂损耗
// 车辆灭火药剂损耗 @TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY) @ApiOperation(httpMethod = "POST", value = "损耗车载灭火剂(<font color='blue'>release</font>)", notes = "损耗车载灭火剂")
@ApiOperation(httpMethod = "POST", value = "损耗车载灭火剂(<font color='blue'>release</font>)", notes = "损耗车载灭火剂") @RequestMapping(value = "/{carId}/loss-extinguishants", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
@RequestMapping(value = "/{carId}/loss-extinguishants", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") public Map<String, String> lossCarExtinguishants(
public Map<String, String> lossCarExtinguishants( @ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") String carId,
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") String carId, @ApiParam(value = "灭火剂损耗请求条件", required = false) @RequestBody(required = false) List<ExtinguishantLossRequest> requests) {
@ApiParam(value = "灭火剂损耗请求条件", required = false) @RequestBody(required = false) List<ExtinguishantLossRequest> requests) { try {
try { return iCarService.lossExtinguishants(Long.valueOf(carId), requests);
iCarService.refreshStaData();
return iCarService.lossExtinguishants(Long.valueOf(carId), requests); } catch (Exception e) {
e.printStackTrace();
} catch (Exception e) { throw new RuntimeException("车载灭火药剂损耗失败,请联系管理员!");
e.printStackTrace(); }
throw new RuntimeException("车载灭火药剂损耗失败,请联系管理员!"); }
}
} /**
* 根据车辆id,查询车辆信息
/** **/
* 根据车辆id,查询车辆信息 @TycloudOperation(ApiLevel = UserType.AGENCY)
**/ @ApiOperation(httpMethod = "GET", value = "根据车辆id,查询车辆信息(<font color='blue'>release</font>)", notes = "根据车辆id,查询车辆信息")
@TycloudOperation(ApiLevel = UserType.AGENCY) @RequestMapping(value = "/cars/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ApiOperation(httpMethod = "GET", value = "根据车辆id,查询车辆信息(<font color='blue'>release</font>)", notes = "根据车辆id,查询车辆信息") public CarInfosResponse show(@ApiParam(value = "车辆管理id", required = true) @PathVariable Long id) {
@RequestMapping(value = "/cars/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") try {
public CarInfosResponse show(@ApiParam(value = "车辆管理id", required = true) @PathVariable Long id) { Car car = iCarService.getById(id);
try { if (null == car) {
Car car = iCarService.getById(id); throw new RuntimeException("该车辆不存在!");
if (null == car) { }
throw new RuntimeException("该车辆不存在!"); Map<String, Object> columnMap = new HashMap<>();
} columnMap.put("car_id", car.getId());
Map<String, Object> columnMap = new HashMap<>(); List<CarProperty> carPropertyList = carPropertyMapper.selectByMap(columnMap);
columnMap.put("car_id", car.getId()); return this.createCarInfosResponse(car, carPropertyList);
List<CarProperty> carPropertyList = carPropertyMapper.selectByMap(columnMap); } catch (Exception e) {
return this.createCarInfosResponse(car, carPropertyList); throw new RuntimeException("查询异常!");
} catch (Exception e) { }
throw new RuntimeException("查询异常!"); }
}
} public CarInfosResponse createCarInfosResponse(Car car, List<CarProperty> carPropertyList) {
public CarInfosResponse createCarInfosResponse(Car car, List<CarProperty> carPropertyList) { CarInfosResponse response = new CarInfosResponse();
// 根据车辆获取装备信息
CarInfosResponse response = new CarInfosResponse(); Equipment equipment = equipmentMapper.selectById(car.getEquipmentId());
// 根据车辆获取装备信息 // 分类
Equipment equipment = equipmentMapper.selectById(car.getEquipmentId()); EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectById(equipment.getCategoryId());
// 分类 // 生产商
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectById(equipment.getCategoryId()); ManufacturerInfo manufacturerInfo = manufacturerInfoMapper.selectById(car.getManufacturerId());
// 生产商 ParsePropertyUtil.setting(response::setManufacturerInfo, () -> manufacturerInfo);
ManufacturerInfo manufacturerInfo = manufacturerInfoMapper.selectById(car.getManufacturerId()); // 等级
ParsePropertyUtil.setting(response::setManufacturerInfo, () -> manufacturerInfo); // 国别
// 等级 SystemDic systemDic1 = systemDicMapper.selectById(car.getCountry());
// 国别 // 车牌类型
SystemDic systemDic1 = systemDicMapper.selectById(car.getCountry()); // 车辆状态
// 车牌类型 SystemDic systemDic3 = systemDicMapper.selectById(car.getCarState());
// 车辆状态
SystemDic systemDic3 = systemDicMapper.selectById(car.getCarState()); ParsePropertyUtil.setting(response::setCarPropertyList, () -> createCarPropertyList(carPropertyList));
ParsePropertyUtil.setting(response::setId, () -> car.getId().toString());
ParsePropertyUtil.setting(response::setCarPropertyList, () -> createCarPropertyList(carPropertyList)); ParsePropertyUtil.setting(response::setCarNum, car::getCarNum);
ParsePropertyUtil.setting(response::setId, () -> car.getId().toString()); ParsePropertyUtil.setting(response::setCarState, () -> systemDic3.getName());
ParsePropertyUtil.setting(response::setCarNum, car::getCarNum); ParsePropertyUtil.setting(response::setEquipType, () -> equipmentCategory.getCode());
ParsePropertyUtil.setting(response::setCarState, () -> systemDic3.getName()); ParsePropertyUtil.setting(response::setEquipTypeName, () -> equipmentCategory.getName());
ParsePropertyUtil.setting(response::setEquipType, () -> equipmentCategory.getCode()); ParsePropertyUtil.setting(response::setEquipName, () -> equipment.getName());
ParsePropertyUtil.setting(response::setEquipTypeName, () -> equipmentCategory.getName()); ParsePropertyUtil.setting(response::setEquipCode, () -> equipment.getCode());
ParsePropertyUtil.setting(response::setEquipName, () -> equipment.getName()); ParsePropertyUtil.setting(response::setEquipmentId, () -> car.getEquipmentId());
ParsePropertyUtil.setting(response::setEquipCode, () -> equipment.getCode()); // ParsePropertyUtil.setting(response::setStandard, car::getStandard);
ParsePropertyUtil.setting(response::setEquipmentId, () -> car.getEquipmentId()); ParsePropertyUtil.setting(response::setOrgCode, car::getOrgCode);
// ParsePropertyUtil.setting(response::setStandard, car::getStandard); ParsePropertyUtil.setting(response::setManufacturer, () -> manufacturerInfo.getName());
ParsePropertyUtil.setting(response::setOrgCode, car::getOrgCode); ParsePropertyUtil.setting(response::setManufacturerId, () -> manufacturerInfo.getId());
ParsePropertyUtil.setting(response::setManufacturer, () -> manufacturerInfo.getName()); ParsePropertyUtil.setting(response::setRemark, car::getRemark);
ParsePropertyUtil.setting(response::setManufacturerId, () -> manufacturerInfo.getId()); ParsePropertyUtil.setting(response::setCompanyName, () -> car.getCompanyName());
ParsePropertyUtil.setting(response::setRemark, car::getRemark); ParsePropertyUtil.setting(response::setCountry, () -> systemDic1.getName());
ParsePropertyUtil.setting(response::setCompanyName, () -> car.getCompanyName()); ParsePropertyUtil.setting(response::setBrand, car::getBrand);
ParsePropertyUtil.setting(response::setCountry, () -> systemDic1.getName()); ParsePropertyUtil.setting(response::setChassisBrand, car::getChassisBrand);
ParsePropertyUtil.setting(response::setBrand, car::getBrand); // 车牌类型
ParsePropertyUtil.setting(response::setChassisBrand, car::getChassisBrand); ParsePropertyUtil.setting(response::setQrCode, car::getQrCode);
// 车牌类型 ParsePropertyUtil.setting(response::setImg, () -> car.getImg().get(0).getUrl());
ParsePropertyUtil.setting(response::setQrCode, car::getQrCode); ParsePropertyUtil.setting(response::setFilm, () -> car.getVideo().get(0).getUrl());
ParsePropertyUtil.setting(response::setImg, () -> car.getImg().get(0).getUrl()); ParsePropertyUtil.setting(response::setDefaultImg, () -> equipment.getImg());
ParsePropertyUtil.setting(response::setFilm, () -> car.getVideo().get(0).getUrl()); // ParsePropertyUtil.setting(response::setChassisType, car::getChassisType);
ParsePropertyUtil.setting(response::setDefaultImg, () -> equipment.getImg()); // ParsePropertyUtil.setting(response::setChassisCountry,
// ParsePropertyUtil.setting(response::setChassisType, car::getChassisType); // car::getChassisCountry);
// ParsePropertyUtil.setting(response::setChassisCountry, return response;
// car::getChassisCountry); }
return response;
} private List<CarProperty> createCarPropertyList(List<CarProperty> carPropertyList) {
List<CarProperty> carProList = new ArrayList<CarProperty>();
if (!carPropertyList.isEmpty()) {
private List<CarProperty> createCarPropertyList(List<CarProperty> carPropertyList) { carPropertyList.forEach(action -> {
List<CarProperty> carProList = new ArrayList<CarProperty>();
if (!carPropertyList.isEmpty()) {
carPropertyList.forEach(action -> {
// PerfQuotaDefinition perfQuotaDefinition = perfQuotaDefinitionMapper // PerfQuotaDefinition perfQuotaDefinition = perfQuotaDefinitionMapper
// .selectById(action.getPerfQuotaDefinitionId()); // .selectById(action.getPerfQuotaDefinitionId());
CarProperty carProperty = new CarProperty(); CarProperty carProperty = new CarProperty();
carProperty.setId(action.getId()); carProperty.setId(action.getId());
carProperty.setCarId(action.getCarId()); carProperty.setCarId(action.getCarId());
// carProperty.setPerfQuotaDefinitionId(action.getPerfQuotaDefinitionId()); // carProperty.setPerfQuotaDefinitionId(action.getPerfQuotaDefinitionId());
// carProperty.setPerfQuotaDefinitionName(perfQuotaDefinition.getName()); // carProperty.setPerfQuotaDefinitionName(perfQuotaDefinition.getName());
carProperty.setRemark(action.getRemark()); carProperty.setRemark(action.getRemark());
carProperty.setValue(action.getValue()); carProperty.setValue(action.getValue());
EquipmentIndex equipmentIndex = equipmentIndexMapper.selectById(action.getEquipmentIndexId()); EquipmentIndex equipmentIndex = equipmentIndexMapper.selectById(action.getEquipmentIndexId());
if (equipmentIndex.getUnitName() != null) { if (equipmentIndex.getUnitName() != null) {
carProperty.setUnitName(equipmentIndex.getUnitName()); carProperty.setUnitName(equipmentIndex.getUnitName());
} }
carProList.add(carProperty); carProList.add(carProperty);
}); });
} }
return carProList; return carProList;
} }
/* /*
* 向车辆上装载灭火药剂 * 向车辆上装载灭火药剂
* *
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "向车辆上装载灭火药剂(<font color='blue'>release</font>)", notes = "向车辆上装载灭火药剂") @ApiOperation(httpMethod = "POST", value = "向车辆上装载灭火药剂(<font color='blue'>release</font>)", notes = "向车辆上装载灭火药剂")
@RequestMapping(value = "/{carId}/loading-extinguishant", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/{carId}/loading-extinguishant", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, String> loadingExtinguishant( public Map<String, String> loadingExtinguishant(
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") Long carId, @ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") Long carId,
@ApiParam(value = "灭火药剂明细账列表", required = true) @RequestBody List<ExtinguishantRequeset> extinguishants) { @ApiParam(value = "灭火药剂明细账列表", required = true) @RequestBody List<ExtinguishantRequeset> extinguishants) {
try { try {
return iCarService.loadingExtinguishants(carId, extinguishants); return iCarService.loadingExtinguishants(carId, extinguishants);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
/** /**
* 装卸载装备 * 装卸载装备
**/ **/
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备") @ApiOperation(httpMethod = "POST", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/loading-equipments", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/loading-equipments", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, Object> loadingEquipment( public Map<String, Object> loadingEquipment(
@ApiParam(value = "提交的装备", required = true) @RequestBody(required = true) OnBoardEquipment params) { @ApiParam(value = "提交的装备", required = true) @RequestBody(required = true) OnBoardEquipment params) {
try { try {
if (OnBoardEquipmentEnum.LOAD == OnBoardEquipmentEnum.getEnum(params.getType())) { if (OnBoardEquipmentEnum.LOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.loadingEquipment(params, getUserInfo()); iCarService.loadingEquipment(params, getUserInfo());
} else if (OnBoardEquipmentEnum.UNLOAD == OnBoardEquipmentEnum.getEnum(params.getType())) { } else if (OnBoardEquipmentEnum.UNLOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.unloadEquipment(params, getUserInfo()); iCarService.unloadEquipment(params, getUserInfo());
} else { } else {
throw new RuntimeException("参数传入失败!无法进行装备装卸车!"); throw new RuntimeException("参数传入失败!无法进行装备装卸车!");
} }
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("person", getUserInfo().getRealName()); map.put("person", getUserInfo().getRealName());
map.put("time", DateUtils.getNowStrLong()); map.put("time", DateUtils.getNowStrLong());
return map; return map;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
// 获取九大类 // 获取九大类
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备") @ApiOperation(httpMethod = "GET", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/getEquipmentType", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getEquipmentType", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<EquipmentCategory> getEquipmentType() { public List<EquipmentCategory> getEquipmentType() {
try { try {
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.isNull("parent_id"); queryWrapper.isNull("parent_id");
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode()); queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper); List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
return list; return list;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
// 获取九大类二级统计 // 获取九大类二级统计
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计") @ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentTypeCount/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getEquipmentTypeCount/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentTypeCount(@PathVariable(value = "id") Long id, public List<Map<String, Object>> getEquipmentTypeCount(@PathVariable(value = "id") Long id,
String warehouseStructureId, String standard, String StateName, String brand) { String warehouseStructureId, String standard, String StateName, String brand) {
try { try {
QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", id); queryWrapper.eq("parent_id", id);
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode()); queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper); List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
String type = list.get(0).getCode().substring(0, 1); String type = list.get(0).getCode().substring(0, 1);
// 获取二级code前两位 // 获取二级code前两位
List<String> listd = new ArrayList<>(); List<String> listd = new ArrayList<>();
List<Map<String, Object>> listr = new ArrayList<>(); List<Map<String, Object>> listr = new ArrayList<>();
for (EquipmentCategory equipmentCategory : list) { for (EquipmentCategory equipmentCategory : list) {
listd.add(equipmentCategory.getCode().substring(0, 2)); listd.add(equipmentCategory.getCode().substring(0, 2));
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name", equipmentCategory.getName()); map.put("name", equipmentCategory.getName());
map.put("ercode", equipmentCategory.getCode().substring(0, 2)); map.put("ercode", equipmentCategory.getCode().substring(0, 2));
map.put("amount", 0); map.put("amount", 0);
if ("21".equals(equipmentCategory.getCode().substring(0, 2))) { if ("21".equals(equipmentCategory.getCode().substring(0, 2))) {
map.put("type", "car"); map.put("type", "car");
} else { } else {
map.put("type", "equipment"); map.put("type", "equipment");
} }
listr.add(map); listr.add(map);
} }
Map<String, Object> mape = new HashMap<>(); Map<String, Object> mape = new HashMap<>();
mape.put("ids", listd); mape.put("ids", listd);
mape.put("id", id); mape.put("id", id);
mape.put("warehouseStructureId", warehouseStructureId); mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard); mape.put("standard", standard);
mape.put("StateName", StateName); mape.put("StateName", StateName);
mape.put("brand", brand); mape.put("brand", brand);
// 根据二级分类查询统计 // 根据二级分类查询统计
List<Map<String, Object>> listdate = equipmentCategoryMapper.getEquipCategoryListcount(mape); List<Map<String, Object>> listdate = equipmentCategoryMapper.getEquipCategoryListcount(mape);
mape.clear(); mape.clear();
for (Map<String, Object> map : listr) { for (Map<String, Object> map : listr) {
mape.putAll(map); mape.putAll(map);
for (Map<String, Object> map1 : listdate) { for (Map<String, Object> map1 : listdate) {
if (map.get("ercode").toString().equals(map1.get("ercode").toString())) { if (map.get("ercode").toString().equals(map1.get("ercode").toString())) {
if (type.equals("4")) { if (type.equals("4")) {
map.put("amount", map1.get("amount")); map.put("amount", map1.get("amount"));
} else { } else {
double dou = Double.parseDouble(map1.get("amount").toString()); double dou = Double.parseDouble(map1.get("amount").toString());
int i = new Double(dou).intValue(); int i = new Double(dou).intValue();
map.put("amount", i); map.put("amount", i);
} }
map.put("type", map1.get("type")); map.put("type", map1.get("type"));
} }
} }
} }
return listr; return listr;
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
// 三级按模板名称统计 // 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计") @ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentCount/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getEquipmentCount/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentCount(@PathVariable(value = "ercode") String ercode, public List<Map<String, Object>> getEquipmentCount(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand) { String warehouseStructureId, String standard, String StateName, String brand) {
try { try {
List<Map<String, Object>> listdate = null; List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap(); Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode); mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId); mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard); mape.put("standard", standard);
mape.put("StateName", StateName); mape.put("StateName", StateName);
mape.put("brand", brand); mape.put("brand", brand);
listdate = equipmentCategoryMapper.getEquipmentCount(mape); listdate = equipmentCategoryMapper.getEquipmentCount(mape);
for (Map<String, Object> map : listdate) { for (Map<String, Object> map : listdate) {
map.put("img", fileServer + map.get("img")); map.put("img", fileServer + map.get("img"));
Object amount = map.get("amount"); Object amount = map.get("amount");
String unit = map.get("unit").toString(); String unit = map.get("unit").toString();
if (ercode.substring(0, 1).equals("4")) { if (ercode.substring(0, 1).equals("4")) {
map.put("amount", map.get("amount").toString() + " " + map.get("unit").toString()); map.put("amount", map.get("amount").toString() + " " + map.get("unit").toString());
} else { } else {
double dou = Double.parseDouble(map.get("amount").toString()); double dou = Double.parseDouble(map.get("amount").toString());
int i = new Double(dou).intValue(); int i = new Double(dou).intValue();
map.put("amount", i + " " + map.get("unit").toString()); map.put("amount", i + " " + map.get("unit").toString());
} }
} }
return listdate; return listdate;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
// 九大类详情列表 // 九大类详情列表
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "详情列表") @ApiOperation(httpMethod = "GET", value = "详情列表")
@RequestMapping(value = "/getEquipmentlist/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getEquipmentlist/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentlist(@PathVariable(value = "ercode") String ercode, public List<Map<String, Object>> getEquipmentlist(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand, String name) { String warehouseStructureId, String standard, String StateName, String brand, String name) {
try { try {
List<Map<String, Object>> listdate = null; List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap(); Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode); mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId); mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard); mape.put("standard", standard);
mape.put("StateName", StateName); mape.put("StateName", StateName);
mape.put("brand", brand); mape.put("brand", brand);
mape.put("name", name); mape.put("name", name);
listdate = equipmentCategoryMapper.getDetailed(mape); listdate = equipmentCategoryMapper.getDetailed(mape);
for (Map<String, Object> map : listdate) { for (Map<String, Object> map : listdate) {
String utname = map.get("utname").toString(); String utname = map.get("utname").toString();
String eqCode = map.get("ercode").toString(); String eqCode = map.get("ercode").toString();
String amount = map.get("amount").toString(); String amount = map.get("amount").toString();
if (StringUtil.isNotEmpty(eqCode) && !eqCode.startsWith("4")) { if (StringUtil.isNotEmpty(eqCode) && !eqCode.startsWith("4")) {
amount = amount.split("\\.")[0] + utname; amount = amount.split("\\.")[0] + utname;
} else { } else {
amount = amount + utname; amount = amount + utname;
} }
map.put("amount", amount); map.put("amount", amount);
map.put("img", fileServer + map.get("img")); map.put("img", fileServer + map.get("img"));
} }
return listdate; return listdate;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
// 三级按模板名称统计 // 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计") @ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getCarList/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getCarList/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public IPage<Car> getCarList(@PathVariable(value = "ercode") String ercode, String orgcode, Car car, String pageNum, public IPage<Car> getCarList(@PathVariable(value = "ercode") String ercode, String orgcode, Car car, String pageNum,
String pageSize) { String pageSize) {
Page<Car> pageBean; Page<Car> pageBean;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
return iCarService.getCarList(ercode, orgcode, car, pageBean); return iCarService.getCarList(ercode, orgcode, car, pageBean);
} }
/** /**
* 车辆装备品牌 下拉框 * 车辆装备品牌 下拉框
**/ **/
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备品牌 下拉框") @ApiOperation(httpMethod = "GET", value = "车辆装备品牌 下拉框")
@RequestMapping(value = "/getbrandlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getbrandlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getbrandlist(@PathVariable(value = "type") String type, String name) { public List<String> getbrandlist(@PathVariable(value = "type") String type, String name) {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
if ("car".equals(type)) { if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>(); QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("brand", ""); queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand"); queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name); queryWrapper.like("brand", name);
} }
List<Car> list = carMapper.selectList(queryWrapper.groupBy("brand")); List<Car> list = carMapper.selectList(queryWrapper.groupBy("brand"));
for (Car car : list) { for (Car car : list) {
result.add(car.getBrand()); result.add(car.getBrand());
} }
return result; return result;
} else { } else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>(); QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("brand", ""); queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand"); queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name); queryWrapper.like("brand", name);
} }
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("brand")); List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("brand"));
for (EquipmentDetail equipmentDetail : list) { for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getBrand()); result.add(equipmentDetail.getBrand());
} }
return result; return result;
} }
} }
/** /**
* 车辆装备状态 * 车辆装备状态
**/ **/
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备状态") @ApiOperation(httpMethod = "GET", value = "车辆装备状态")
@RequestMapping(value = "/getStatuslist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getStatuslist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<SystemDic> getStatuslist(@PathVariable(value = "type") String type) { public List<SystemDic> getStatuslist(@PathVariable(value = "type") String type) {
try { try {
Map<String, Object> columnMap = new HashMap<String, Object>(); Map<String, Object> columnMap = new HashMap<String, Object>();
if ("car".equals(type)) { if ("car".equals(type)) {
columnMap.put("type", SystemDicTypeEum.carState.getType()); columnMap.put("type", SystemDicTypeEum.carState.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap); List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd; return listd;
} else { } else {
columnMap.put("type", SystemDicTypeEum.equipStatus.getType()); columnMap.put("type", SystemDicTypeEum.equipStatus.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap); List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd; return listd;
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
/** /**
* 规格型号 * 规格型号
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "规格型号") @ApiOperation(httpMethod = "GET", value = "规格型号")
@RequestMapping(value = "/getstandardlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getstandardlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getstandardlist(@PathVariable(value = "type") String type, String name) { public List<String> getstandardlist(@PathVariable(value = "type") String type, String name) {
try { try {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
if ("car".equals(type)) { if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>(); QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("model", ""); queryWrapper.ne("model", "");
queryWrapper.isNotNull("model"); queryWrapper.isNotNull("model");
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
queryWrapper.like("model", name); queryWrapper.like("model", name);
} }
List<Car> list = carMapper.selectList(queryWrapper.groupBy("model")); List<Car> list = carMapper.selectList(queryWrapper.groupBy("model"));
for (Car car : list) { for (Car car : list) {
result.add(car.getStandard()); result.add(car.getStandard());
} }
return result; return result;
} else { } else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>(); QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("standard", ""); queryWrapper.ne("standard", "");
queryWrapper.isNotNull("standard"); queryWrapper.isNotNull("standard");
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
queryWrapper.like("standard", name); queryWrapper.like("standard", name);
} }
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("standard")); List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("standard"));
for (EquipmentDetail equipmentDetail : list) { for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getStandard()); result.add(equipmentDetail.getStandard());
} }
return result; return result;
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
/** /**
* <pre> * <pre>
* 打印车辆二维码 * 打印车辆二维码
* </pre> * </pre>
* *
* @param id 车辆ID * @param id 车辆ID
* @param amount 打印数量 * @param amount 打印数量
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "打印车辆二维码(<font color='blue'>release</font>)", notes = "打印车辆二维码") @ApiOperation(httpMethod = "GET", value = "打印车辆二维码(<font color='blue'>release</font>)", notes = "打印车辆二维码")
@RequestMapping(value = "/generate/qrCode/{type}/{id}/{amount}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/generate/qrCode/{type}/{id}/{amount}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<EquipmentQrcode> printQRCode(@PathVariable("id") Long id, @PathVariable("amount") Integer amount, public List<EquipmentQrcode> printQRCode(@PathVariable("id") Long id, @PathVariable("amount") Integer amount,
@PathVariable("type") String type, @DateTimeFormat(pattern = "yyyy-MM-dd") Date productDate) { @PathVariable("type") String type, @DateTimeFormat(pattern = "yyyy-MM-dd") Date productDate) {
try { try {
ProductionQRCode productionQRCode = messageHandMap.get(type); ProductionQRCode productionQRCode = messageHandMap.get(type);
List<EquipmentQrcode> list = productionQRCode.getProductionQRCode(id, amount, productDate); List<EquipmentQrcode> list = productionQRCode.getProductionQRCode(id, amount, productDate);
return list; return list;
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("系统异常!"); throw new RuntimeException("系统异常!");
} }
} }
/** /**
* 批量删除 * 批量删除
* *
* @param idList * @param idList
* @return * @return
* @throws Exception * @throws Exception
*/ */
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean delete(HttpServletRequest request, @RequestBody List<Long> idList) throws Exception { public boolean delete(HttpServletRequest request, @RequestBody List<Long> idList) throws Exception {
List<Car> cars = iCarService.list(new QueryWrapper<Car>().in("id", idList)); List<Car> cars = iCarService.list(new QueryWrapper<Car>().in("id", idList));
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic(); String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
cars.forEach(car -> { cars.forEach(car -> {
List<EquipmentOnCarAppVO> equipmentOnCarAppVOS = carMapper.selectEquipmentOnCarAppList(car.getId()); List<EquipmentOnCarAppVO> equipmentOnCarAppVOS = carMapper.selectEquipmentOnCarAppList(car.getId());
if (equipmentOnCarAppVOS.size() > 0) { if (equipmentOnCarAppVOS.size() > 0) {
throw new BadRequest("有车载装备的车辆不能删除,请先卸载装备!"); throw new BadRequest("有车载装备的车辆不能删除,请先卸载装备!");
} }
boolean flag = false; boolean flag = false;
String iotCode = car.getIotCode(); String iotCode = car.getIotCode();
if (StringUtil.isNotEmpty(car.getIotCode()) && iotCode.length() > 8) { if (StringUtil.isNotEmpty(car.getIotCode()) && iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8); String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8); String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property"; String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) { for (String topic : topics) {
if (topic.equals(oldTopic)) { if (topic.equals(oldTopic)) {
flag = true; flag = true;
break; break;
} }
} }
if (flag) { if (flag) {
try { try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property"); equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
}); });
return iCarService.removeOneByIds(idList); return iCarService.removeOneByIds(idList);
} }
/** /**
* 获取车辆物联信息 * 获取车辆物联信息
* *
* @return * @return
*/ */
@RequestMapping(value = "/getCarsIotInfo", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getCarsIotInfo", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆物联信息", notes = "获取车辆物联信息") @ApiOperation(httpMethod = "GET", value = "获取车辆物联信息", notes = "获取车辆物联信息")
public Map<Long, List<CarIndexVo>> getCarsIotInfo() { public Map<Long, List<CarIndexVo>> getCarsIotInfo() {
Map<Long, List<CarIndexVo>> map = null; Map<Long, List<CarIndexVo>> map = null;
String orgCode = getOrgCode(); String orgCode = getOrgCode();
List<CarIndexVo> carVoList = iCarService.getCarsIotInfo(orgCode); List<CarIndexVo> carVoList = iCarService.getCarsIotInfo(orgCode);
if (!carVoList.isEmpty()) { if (!carVoList.isEmpty()) {
map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getId())); map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getId()));
} }
return map; return map;
} }
/** /**
* 根据车辆ID,获取车载装备及状态 * 根据车辆ID,获取车载装备及状态
* *
* @param id * @param id
* @return * @return
*/ */
@RequestMapping(value = "/getCarEquipmentsById/{id}/state", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getCarEquipmentsById/{id}/state", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆车载装备状态", notes = "获取车辆车载装备状态") @ApiOperation(httpMethod = "GET", value = "获取车辆车载装备状态", notes = "获取车辆车载装备状态")
public List<EquipStateOnCarVo> getCarEquipmentsById(@PathVariable(value = "id") Long id) { public List<EquipStateOnCarVo> getCarEquipmentsById(@PathVariable(value = "id") Long id) {
return iCarService.getCarEquipmentsById(id); return iCarService.getCarEquipmentsById(id);
} }
/** /**
* <pre> * <pre>
* 车辆历史轨迹数据 * 车辆历史轨迹数据
* </pre> * </pre>
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "模拟车辆历史轨迹数据(<font color='blue'>release</font>)", notes = "模拟车辆历史轨迹数据") @ApiOperation(httpMethod = "GET", value = "模拟车辆历史轨迹数据(<font color='blue'>release</font>)", notes = "模拟车辆历史轨迹数据")
@RequestMapping(value = "/history/{iotCode}/{timeStart}/{timeEnd}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/history/{iotCode}/{timeStart}/{timeEnd}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public ResponseModel getCarHistoryTrackAndTrendById(@PathVariable("iotCode") String iotCode, @PathVariable("timeStart") String timeStart, public ResponseModel getCarHistoryTrackAndTrendById(@PathVariable("iotCode") String iotCode,
@PathVariable("timeEnd") String timeEnd) { @PathVariable("timeStart") String timeStart, @PathVariable("timeEnd") String timeEnd) {
String prefix = null; String prefix = null;
String suffix = null; String suffix = null;
if (iotCode.length() > 8) { if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8); prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8); suffix = iotCode.substring(8);
} else { } else {
return CommonResponseUtil.failure("车辆物联编码错误,请确认!"); return CommonResponseUtil.failure("车辆物联编码错误,请确认!");
} }
LonAndLatEntityVo lonAndLatEntityVo = new LonAndLatEntityVo(); LonAndLatEntityVo lonAndLatEntityVo = new LonAndLatEntityVo();
String url = iotServerName; String url = iotServerName;
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json"); headers.set("Content-Type", "application/json");
headers.set("product", getProduct()); headers.set("product", getProduct());
headers.set("token", getToken()); headers.set("token", getToken());
headers.set("appKey", getAppKey()); headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(lonAndLatEntityVo, headers); HttpEntity httpEntity = new HttpEntity<>(lonAndLatEntityVo, headers);
ResponseEntity<FeignClientResult> feignClientResult = null; ResponseEntity<FeignClientResult> feignClientResult = null;
try { try {
feignClientResult = restTemplate.exchange("http://" + url feignClientResult = restTemplate.exchange(
+ "/iot/v1/livedata/list?timeStart=" + timeStart + "&timeEnd=" + timeEnd + "&productKey=" + prefix + "&deviceName=" + suffix, "http://" + url + "/iot/v1/livedata/list?timeStart=" + timeStart + "&timeEnd=" + timeEnd
HttpMethod.GET, httpEntity, FeignClientResult.class); + "&productKey=" + prefix + "&deviceName=" + suffix,
} catch (Exception e) { HttpMethod.GET, httpEntity, FeignClientResult.class);
e.printStackTrace(); } catch (Exception e) {
} e.printStackTrace();
if (null != feignClientResult && feignClientResult.getBody().getStatus() == 200) { }
return CommonResponseUtil.success(feignClientResult.getBody().getResult()); if (null != feignClientResult && feignClientResult.getBody().getStatus() == 200) {
} return CommonResponseUtil.success(feignClientResult.getBody().getResult());
else { } else {
log.error("注:iotCode为 (" + iotCode + ") 的车辆不存在于物联系统或物联系统车辆历史轨迹接口出错!"); log.error("注:iotCode为 (" + iotCode + ") 的车辆不存在于物联系统或物联系统车辆历史轨迹接口出错!");
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
} }
/** /**
* <pre> * <pre>
* 模拟车辆历史运动趋势数据 * 模拟车辆历史运动趋势数据
* </pre> * </pre>
*/ */
// @TycloudOperation(ApiLevel = UserType.AGENCY) // @TycloudOperation(ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/history/trend/{iotCode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") // @RequestMapping(value = "/history/trend/{iotCode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
// public List<SpeedAndTimeEntityVo> getCarHistoryTrendById(@PathVariable("iotCode") String iotCode) { // public List<SpeedAndTimeEntityVo> getCarHistoryTrendById(@PathVariable("iotCode") String iotCode) {
...@@ -1165,134 +1180,123 @@ public class CarController extends AbstractBaseController { ...@@ -1165,134 +1180,123 @@ public class CarController extends AbstractBaseController {
// } // }
// } // }
/** /**
* 查询车辆-共共接口 * 查询车辆-共共接口
* *
* @param teamId 队伍id * @param teamId 队伍id
* @param name 车辆名称 * @param name 车辆名称
* @return List<CarInfoVo> * @return List<CarInfoVo>
*/ */
@GetMapping(value = "/list-all") @GetMapping(value = "/list-all")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表") @ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public List<CarInfoDto> equipmentList( public List<CarInfoDto> equipmentList(@RequestParam(required = false) Long teamId,
@RequestParam(required = false) Long teamId, @RequestParam(required = false) String name) {
@RequestParam(required = false) String name) { return iCarService.carInfoList(teamId, name);
return iCarService.carInfoList(teamId, name); }
}
/**
* 查询车辆-共共接口
*
* @param teamId 队伍id
* @param name 车辆名称
/** * @return List<CarInfoVo>
* 查询车辆-共共接口 */
* @GetMapping(value = "/list-allpag")
* @param teamId 队伍id @TycloudOperation(ApiLevel = UserType.AGENCY)
* @param name 车辆名称 @ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
* @return List<CarInfoVo> public Page<CarInfoDto> equipmentCarList(@RequestParam(required = false) Long teamId,
*/ @RequestParam(required = false) String name, @RequestParam(required = false) String code,
@GetMapping(value = "/list-allpag") @RequestParam(required = false) String pageNum, @RequestParam(required = false) String pageSize,
@TycloudOperation(ApiLevel = UserType.AGENCY) @RequestParam(required = false) Long id, @RequestParam(required = false) Boolean isNo
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public Page<CarInfoDto> equipmentCarList( ) {
@RequestParam(required = false) Long teamId, Page<CarInfoDto> pageBean;
@RequestParam(required = false) String name, if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
@RequestParam(required = false) String code , pageBean = new Page<>(0, Long.MAX_VALUE);
@RequestParam(required = false) String pageNum, } else {
@RequestParam(required = false) String pageSize, pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
@RequestParam(required = false) Long id, }
@RequestParam(required = false) Boolean isNo
return iCarService.equipmentCarList(pageBean, teamId, name, code, id, isNo);
) { }
Page<CarInfoDto> pageBean;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { /**
pageBean = new Page<>(0, Long.MAX_VALUE); * 机场查询队伍与车辆数量
} else { *
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); * @return List<Map < String, Object>>
} */
@GetMapping(value = "/list-info")
return iCarService.equipmentCarList(pageBean,teamId, name,code,id,isNo); @TycloudOperation(ApiLevel = UserType.AGENCY)
} @ApiOperation(httpMethod = "GET", value = "队伍与车辆数量", notes = "队伍与车辆数量")
public List<Map<String, Object>> carList() {
return iCarService.teamCarList();
/** }
* 机场查询队伍与车辆数量
* @PostMapping(value = "/status")
* @return List<Map < String, Object>> @TycloudOperation(ApiLevel = UserType.AGENCY)
*/ @ApiOperation(httpMethod = "POST", value = "更新车辆状态", notes = "更新车辆状态")
@GetMapping(value = "/list-info") public ResponseModel updateCarStatus(@RequestBody List<CarStatusInfoDto> cars) {
@TycloudOperation(ApiLevel = UserType.AGENCY) return ResponseHelper.buildResponse(iCarService.updateCarStatus(cars));
@ApiOperation(httpMethod = "GET", value = "队伍与车辆数量", notes = "队伍与车辆数量") }
public List<Map<String, Object>> carList() {
return iCarService.teamCarList(); /**
} * 获取消防队伍的消防车辆
*
@PostMapping(value = "/status") * @param id 队伍ID,非必填
@TycloudOperation(ApiLevel = UserType.AGENCY) * @return
@ApiOperation(httpMethod = "POST", value = "更新车辆状态", notes = "更新车辆状态") */
public ResponseModel updateCarStatus(@RequestBody List<CarStatusInfoDto> cars) { @GetMapping(value = "/getTeamCarList")
return ResponseHelper.buildResponse(iCarService.updateCarStatus(cars)); @TycloudOperation(ApiLevel = UserType.AGENCY)
} @ApiOperation(httpMethod = "GET", value = "获取消防队伍的消防车辆", notes = "获取消防队伍的消防车辆")
public ResponseModel getTeamCarList(@RequestParam(required = false) Long id,
/** @RequestParam(required = false) Double longitude, @RequestParam(required = false) Double latitude) {
* 获取消防队伍的消防车辆 return CommonResponseUtil.success(iCarService.getTeamCarList(id, longitude, latitude));
* }
* @param id 队伍ID,非必填
* @return /**
*/ * 根据id查询车辆简要信息
@GetMapping(value = "/getTeamCarList") *
@TycloudOperation(ApiLevel = UserType.AGENCY) * @param id
@ApiOperation(httpMethod = "GET", value = "获取消防队伍的消防车辆", notes = "获取消防队伍的消防车辆") * @return
public ResponseModel getTeamCarList(@RequestParam(required = false) Long id, */
@RequestParam(required = false) Double longitude, @RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
@RequestParam(required = false) Double latitude) { @TycloudOperation(ApiLevel = UserType.AGENCY)
return CommonResponseUtil.success(iCarService.getTeamCarList(id, longitude, latitude)); @ApiOperation(httpMethod = "GET", value = "根据id查询车辆简要信息", notes = "根据id查询车辆简要信息")
} public Car selectById(@PathVariable Long id) {
return iCarService.querySimpleInfoById(id);
/** }
* 根据id查询车辆简要信息
* /**
* @param id * 根据查询车辆简要信息
* @return *
*/ * @param id
@RequestMapping(value = "/simple/{id}", method = RequestMethod.GET) * @return
@TycloudOperation(ApiLevel = UserType.AGENCY) */
@ApiOperation(httpMethod = "GET", value = "根据id查询车辆简要信息", notes = "根据id查询车辆简要信息") @RequestMapping(value = "/state/info", method = RequestMethod.GET)
public Car selectById(@PathVariable Long id) { @TycloudOperation(ApiLevel = UserType.AGENCY)
return iCarService.querySimpleInfoById(id); @ApiOperation(value = "根据车牌号查询车辆信息", notes = "根据车牌号查询车辆信息")
} public ResponseModel getCarStateInfoByCarNum(@RequestParam(required = false) String carNum) {
return CommonResponseUtil.success(iCarService.getCarStateInfoByCarNum(carNum));
/** }
* 根据查询车辆简要信息
* /**
* @param id * 查询所有融合终端车辆
* @return *
*/ * @return
@RequestMapping(value = "/state/info", method = RequestMethod.GET) */
@TycloudOperation(ApiLevel = UserType.AGENCY) @RequestMapping(value = "/all/fusion", method = RequestMethod.GET)
@ApiOperation(value = "根据车牌号查询车辆信息", notes = "根据车牌号查询车辆信息") @TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getCarStateInfoByCarNum(@RequestParam(required = false) String carNum) { @ApiOperation(value = "查询所有融合终端车辆", notes = "查询所有融合终端车辆")
return CommonResponseUtil.success(iCarService.getCarStateInfoByCarNum(carNum)); public ResponseModel<List> getCarFusionList() {
} return CommonResponseUtil.success(iCarService.getCarFusionList());
}
/**
* 查询所有融合终端车辆 @TycloudOperation(ApiLevel = UserType.AGENCY)
* @RequestMapping(value = "/companyTreeByUserAndType", method = RequestMethod.GET)
* @return @ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司部门树", notes = "根据登录人及类型获取公司部门树")
*/ public ResponseModel<Object> companyTreeByUserAndType() throws Exception {
@RequestMapping(value = "/all/fusion", method = RequestMethod.GET) FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(carAuthKey, null);
@TycloudOperation(ApiLevel = UserType.AGENCY) return ResponseHelper.buildResponse(menusList.getResult());
@ApiOperation(value = "查询所有融合终端车辆", notes = "查询所有融合终端车辆") }
public ResponseModel<List> getCarFusionList() {
return CommonResponseUtil.success(iCarService.getCarFusionList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeByUserAndType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司部门树", notes = "根据登录人及类型获取公司部门树")
public ResponseModel<Object> companyTreeByUserAndType() throws Exception {
FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(carAuthKey, null);
return ResponseHelper.buildResponse(menusList.getResult());
}
} }
...@@ -18,6 +18,7 @@ import com.yeejoin.equipmanage.mapper.EquipmentDetailMapper; ...@@ -18,6 +18,7 @@ import com.yeejoin.equipmanage.mapper.EquipmentDetailMapper;
import com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper; import com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper;
import com.yeejoin.equipmanage.mapper.StockDetailMapper; import com.yeejoin.equipmanage.mapper.StockDetailMapper;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import com.yeejoin.equipmanage.utils.ExcelUtil; import com.yeejoin.equipmanage.utils.ExcelUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -82,7 +84,9 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -82,7 +84,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
private Boolean syncSwitch; private Boolean syncSwitch;
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
/** /**
* 新增 * 新增
* *
...@@ -92,9 +96,18 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -92,9 +96,18 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public EquipmentDetail saveEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDetail equipmentDetail) { public EquipmentDetail saveEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDetail equipmentDetail) {
equipmentSpecificSerivce.refreshStaData();
return iEquipmentDetailService.saveOne(equipmentDetail); return iEquipmentDetailService.saveOne(equipmentDetail);
} }
@Async
public void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData();
try {
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
} catch (Exception e) {
}
}
/** /**
* 设备新增带打码入库 * 设备新增带打码入库
***/ ***/
...@@ -102,6 +115,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -102,6 +115,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public EquipmentDate saveEquipmentDetail(@RequestBody EquipmentDate equipmentDate) { public EquipmentDate saveEquipmentDetail(@RequestBody EquipmentDate equipmentDate) {
equipmentSpecificSerivce.refreshStaData();
if (equipmentDate.getEquipmentSpecific().getSingle() == null) { if (equipmentDate.getEquipmentSpecific().getSingle() == null) {
throw new BadRequest("管理方式未输入"); throw new BadRequest("管理方式未输入");
} }
...@@ -202,6 +216,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -202,6 +216,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改") @ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public EquipmentDate updateByIdEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDate equipmentDate) { public EquipmentDate updateByIdEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDate equipmentDate) {
equipmentSpecificSerivce.refreshStaData();
EquipmentSpecific vo = equipmentDate.getEquipmentSpecific(); EquipmentSpecific vo = equipmentDate.getEquipmentSpecific();
String sysCode = vo.getCode(); String sysCode = vo.getCode();
if (StringUtils.isNotEmpty(sysCode) && StringUtils.isNotEmpty(sysCode.trim())) { if (StringUtils.isNotEmpty(sysCode) && StringUtils.isNotEmpty(sysCode.trim())) {
...@@ -258,6 +273,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -258,6 +273,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除") @ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) { public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
equipmentSpecificSerivce.refreshStaData();
return iEquipmentDetailService.removeOneById(id); return iEquipmentDetailService.removeOneById(id);
} }
...@@ -265,6 +281,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -265,6 +281,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改") @ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean quotaUpdate(HttpServletRequest request, @RequestBody List<EquProperty> e) { public boolean quotaUpdate(HttpServletRequest request, @RequestBody List<EquProperty> e) {
equipmentSpecificSerivce.refreshStaData();
return iEquipmentDetailService.quotaUpdate(e); return iEquipmentDetailService.quotaUpdate(e);
} }
......
...@@ -8,6 +8,7 @@ import java.util.stream.Collectors; ...@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -29,13 +30,13 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecific; ...@@ -29,13 +30,13 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO; import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.dto.SourceNameListDTO; import com.yeejoin.equipmanage.common.entity.dto.SourceNameListDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO; import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.DetailPaneVO;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO; import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil; import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo; import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper; import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentDetailService; import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -71,11 +72,9 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -71,11 +72,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "补码列表接口,废弃未用到") @ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "补码列表接口,废弃未用到")
public IPage<ComplementCodeVO> saveEquipmentPoint(@RequestBody EquipmentSpecificDTO equipmentSpecific) { public IPage<ComplementCodeVO> saveEquipmentPoint(@RequestBody EquipmentSpecificDTO equipmentSpecific) {
equipmentSpecificSerivce.refreshStaData();
return equipmentSpecificSerivce.selectEquipmentSpecific(equipmentSpecific); return equipmentSpecificSerivce.selectEquipmentSpecific(equipmentSpecific);
} }
/** /**
* 通过id获取设备区域建筑等信息 * 通过id获取设备区域建筑等信息
* *
...@@ -107,9 +106,8 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -107,9 +106,8 @@ public class EquipmentSpecificController extends AbstractBaseController {
*/ */
@RequestMapping(value = "/exit", method = RequestMethod.POST) @RequestMapping(value = "/exit", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "修改", notes = "修改") @ApiOperation(httpMethod = "POST", value = "修改" , notes = "修改")
public EquipmentSpecific updateEquipmentSpecific(@RequestBody EquipmentSpecific equipmentSpecific) { public EquipmentSpecific updateEquipmentSpecific(@RequestBody EquipmentSpecific equipmentSpecific) {
equipmentSpecificSerivce.refreshStaData();
EquipmentSpecific updateEquipmentSpecific = equipmentSpecificSerivce.updateEquipmentSpecific(equipmentSpecific, getSelectedOrgInfo(), getUserInfo()); EquipmentSpecific updateEquipmentSpecific = equipmentSpecificSerivce.updateEquipmentSpecific(equipmentSpecific, getSelectedOrgInfo(), getUserInfo());
if (syncSwitch) { if (syncSwitch) {
// TODO 后续判断成功,执行同步 // TODO 后续判断成功,执行同步
...@@ -249,7 +247,6 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -249,7 +247,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "删除装备相关所有数据", notes = "删除装备相关所有数据") @ApiOperation( value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) { public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) {
equipmentSpecificSerivce.refreshStaData();
return CommonResponseUtil.success(equipmentSpecificSerivce.delEquipmentBySpecificId(specificId)); return CommonResponseUtil.success(equipmentSpecificSerivce.delEquipmentBySpecificId(specificId));
} }
...@@ -262,7 +259,6 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -262,7 +259,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "批量删除装备相关所有数据", notes = "批量删除装备相关所有数据") @ApiOperation( value = "批量删除装备相关所有数据", notes = "批量删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestBody List<Long> specificIds) { public ResponseModel delEquipmentBySpecificId(@RequestBody List<Long> specificIds) {
equipmentSpecificSerivce.refreshStaData();
if(ObjectUtils.isEmpty(specificIds)){ if(ObjectUtils.isEmpty(specificIds)){
return CommonResponseUtil.failure("参数为空"); return CommonResponseUtil.failure("参数为空");
} }
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface VideoMapper extends BaseMapper<Video> { public interface VideoMapper extends BaseMapper<Video> {
Page<PageVideoVO> pageVideo(@Param("page")IPage<Video> page, @Param("video")Video video); Page<PageVideoVO> pageVideo(@Param("page") IPage<Video> page, @Param("video") Video video, @Param("list") List<String> bizOrgCodeList);
Page<BuildingVideoVO> pageBuildingVideo(@Param("page") Page page, @Param("dto") BuildingVideoListVO dto); Page<BuildingVideoVO> pageBuildingVideo(@Param("page") Page page, @Param("dto") BuildingVideoListVO dto);
......
...@@ -308,4 +308,11 @@ public interface IBuilldService extends IService<Building> { ...@@ -308,4 +308,11 @@ public interface IBuilldService extends IService<Building> {
*/ */
Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId); Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId);
/**
* 根据登陆人获取公司部门树
* @return list
*/
List<BuildingTreeVo> getCompanyBuildingTree();
} }
...@@ -50,6 +50,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -50,6 +50,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -1195,4 +1196,47 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1195,4 +1196,47 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
// TODO Auto-generated method stub // TODO Auto-generated method stub
return formInstanceMapper.getBuildingToLongitudeAndLatitude(instanceId); return formInstanceMapper.getBuildingToLongitudeAndLatitude(instanceId);
} }
@Override
public List<BuildingTreeVo> getCompanyBuildingTree() {
List<BuildingTreeVo> allListVo = getBuildingTreeVos();
// 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY");
AtomicReference<Boolean> flag = new AtomicReference<>(false);
List<BuildingTreeVo> collect = orgUsrLists.stream().map(orgUsrDto -> {
BuildingTreeVo vo = new BuildingTreeVo();
vo.setGroupType("allBuilding");
vo.setGroupCode("allBuilding");
vo.setInstanceName(orgUsrDto.getBizOrgName());
vo.setBizOrgCode(orgUsrDto.getBizOrgCode());
vo.setInstanceId(orgUsrDto.getSequenceNbr());
vo.setParentId(orgUsrDto.getParentId());
vo.setName(orgUsrDto.getBizOrgName());
vo.setId(orgUsrDto.getSequenceNbr());
if ("".equals(orgUsrDto.getParentId()) || "-1".equals(orgUsrDto.getParentId()) || null == orgUsrDto.getParentId()) {
flag.set(true);
}
return vo;
}).collect(Collectors.toList());
allListVo.addAll(collect);
return allListVo.stream().filter(s -> flag.get() ? "allBuilding".equals(s.getGroupType()) && s.getBizOrgCode() != null && ("".equals(s.getParentId()) || "-1".equals(s.getParentId()) || null == s.getParentId())
: "allBuilding".equals(s.getGroupType()) && s.getBizOrgCode() != null)
.peek(m -> m.setChildren(this.getCompanyBuildingChildrenTree(m, allListVo)))
.collect(Collectors.toList());
}
private List<BuildingTreeVo> getCompanyBuildingChildrenTree(BuildingTreeVo root , List<BuildingTreeVo> all) {
return all.stream().filter(b ->
(root.getId() != null && StringUtil.isNotEmpty(b.getParentId()) && b.getParentId().equals(root.getId().toString())) ||
("allBuilding".equals(root.getGroupType())
&& "building".equals(b.getGroupType())
&& StringUtil.isNotEmpty(root.getBizOrgCode())
&& root.getBizOrgCode().equals(b.getBizOrgCode())
&& !b.getId().equals(root.getId())))
.peek(m -> {m.setChildren(getCompanyBuildingChildrenTree(m, all));
m.setDetailPaneApi(address);
m.setApiUrl(apiUrl);})
.collect(Collectors.toList());
}
} }
...@@ -93,331 +93,336 @@ import com.yeejoin.equipmanage.service.ISourceStatistics; ...@@ -93,331 +93,336 @@ import com.yeejoin.equipmanage.service.ISourceStatistics;
import com.yeejoin.equipmanage.service.ISyncDataService; import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.MqttSendGateway; import com.yeejoin.equipmanage.service.MqttSendGateway;
@Service @Service
public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity> implements IFireFightingSystemService { public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity>
implements IFireFightingSystemService {
@Autowired
FireFightingSystemMapper fireFightingSystemMapper; @Autowired
@Autowired FireFightingSystemMapper fireFightingSystemMapper;
IRiskSourceSceneService iRiskSourceSceneService; @Autowired
@Autowired IRiskSourceSceneService iRiskSourceSceneService;
private RemoteSecurityService remoteSecurityService; @Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipmentManageMapper equipmentManageMapper; @Autowired
@Autowired private EquipmentManageMapper equipmentManageMapper;
private EquipmentManageService equipmentManageService; @Autowired
@Autowired private EquipmentManageService equipmentManageService;
private BuildingMapper buildingMapper; @Autowired
@Autowired private BuildingMapper buildingMapper;
private FormInstanceMapper formInstanceMapper; @Autowired
@Autowired private FormInstanceMapper formInstanceMapper;
private SourceSceneMapper sourceSceneMapper; @Autowired
@Value("${equipment.fire.systemid}") private SourceSceneMapper sourceSceneMapper;
private String fireSystemId; @Value("${equipment.fire.systemid}")
@Value("${morphic.projectSeq}") private String fireSystemId;
private Long projectSeq; @Value("${morphic.projectSeq}")
@Value("${mqtt.scene.host}") private Long projectSeq;
private String sceneUrl; @Value("${mqtt.scene.host}")
@Value("${equip.point.equipmentdata.topic}") private String sceneUrl;
private String wsTopic; @Value("${equip.point.equipmentdata.topic}")
private String wsTopic;
@Value("${equip.point.speindex.url}")
private String speindexUrl; @Value("${equip.point.speindex.url}")
@Value("${equip.point.equipmentDetail.url}") private String speindexUrl;
private String equipmentDetailUrl; @Value("${equip.point.equipmentDetail.url}")
private String equipmentDetailUrl;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam; @Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Autowired
private IEqDynamicFormGroupService iEqDynamicFormGroupService; @Autowired
private IEqDynamicFormGroupService iEqDynamicFormGroupService;
@Autowired
private IEqDynamicFormInstanceService instanceService; @Autowired
private IEqDynamicFormInstanceService instanceService;
@Autowired
@Lazy @Autowired
private IEquipmentSpecificSerivce equipmentSpecificSerivce; @Lazy
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired
private ISourceSceneService iSourceSceneService; @Autowired
private ISourceSceneService iSourceSceneService;
@Autowired
private ISyncDataService syncDataService; @Autowired
private ISyncDataService syncDataService;
@Autowired
private RedisUtils redisUtils; @Autowired
private RedisUtils redisUtils;
@Autowired
MqttSendGateway mqttSendGateway; @Autowired
MqttSendGateway mqttSendGateway;
@Autowired
private JCSRemoteService jcsRemoteService; @Autowired
private JCSRemoteService jcsRemoteService;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch; @Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-system:fire_system_info}")
private String authKey; @Value("${auth-key-fire-system:fire_system_info}")
private String authKey;
@Value("${equipment.type}") @Value("${equipment.type}")
String equipmentCategoryLeftTypeCode; String equipmentCategoryLeftTypeCode;
@Autowired @Autowired
IEquipmentCategoryService iEquipmentCategoryService; IEquipmentCategoryService iEquipmentCategoryService;
@Autowired @Autowired
ISourceStatistics sourceStatistics; ISourceStatistics sourceStatistics;
@Value("${redis_car_type_count}") @Value("${redis_car_type_count}")
private String carTypeAndCount; private String carTypeAndCount;
@Value("${redis_equip_type_count}") @Value("${redis_equip_type_count}")
private String equipTypeAndCount; private String equipTypeAndCount;
@Override @Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) { public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId); return this.baseMapper.getEquipCountBySystemId(systemId);
} }
@Override
@Override public List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId) {
public List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId) { return this.baseMapper.getEquiplistBySystemId(systemId);
return this.baseMapper.getEquiplistBySystemId(systemId); }
}
@Override
@Override public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction,
public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize) { String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize) {
Map<String, Object> map = equipmentManageService.queryEquipmenInfoAndCount(equimentName, equimentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize); Map<String, Object> map = equipmentManageService.queryEquipmenInfoAndCount(equimentName, equimentCode,
List<EquipmentManageVo> dataList = (List<EquipmentManageVo>) map.get("dataList"); construction, maintenance, bizOrgCode, formGroupId, current, pageSize);
StringBuilder stb = new StringBuilder(); List<EquipmentManageVo> dataList = (List<EquipmentManageVo>) map.get("dataList");
dataList.forEach(y -> { StringBuilder stb = new StringBuilder();
if (StringUtil.isNotEmpty(String.valueOf(stb))) { dataList.forEach(y -> {
stb.append("," + y.getChargePerson()); if (StringUtil.isNotEmpty(String.valueOf(stb))) {
} else { stb.append("," + y.getChargePerson());
stb.append(y.getChargePerson()); } else {
} stb.append(y.getChargePerson());
}); }
Map<String, String> userMap = new HashMap<>(); });
if (StringUtil.isNotEmpty(stb)) { Map<String, String> userMap = new HashMap<>();
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString()); if (StringUtil.isNotEmpty(stb)) {
agencyUserModels.forEach(z -> { List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString());
userMap.put(z.getUserId(), z.getRealName()); agencyUserModels.forEach(z -> {
}); userMap.put(z.getUserId(), z.getRealName());
} });
}
dataList.forEach(x -> {
x.setChargePerson(userMap.get(x.getChargePerson())); dataList.forEach(x -> {
x.setSystemimg(equipmentManageMapper.getFiles(String.valueOf(x.getId()), "face")); x.setChargePerson(userMap.get(x.getChargePerson()));
}); x.setSystemimg(equipmentManageMapper.getFiles(String.valueOf(x.getId()), "face"));
map.put("dataList", dataList); });
return map; map.put("dataList", dataList);
} return map;
}
@Override
public FireFightingSystemEntity getOneById(Long id) { @Override
FireFightingSystemEntity fireFightingSystemEntity = this.baseMapper.selectById(id); public FireFightingSystemEntity getOneById(Long id) {
return fireFightingSystemEntity; FireFightingSystemEntity fireFightingSystemEntity = this.baseMapper.selectById(id);
} return fireFightingSystemEntity;
}
@Override
public String save(FireFightingSystemVo vo) { @Override
if (!systemCodeCheck(vo)) { public String save(FireFightingSystemVo vo) {
throw new BadRequest("系统编号已存在,请重新输入"); if (!systemCodeCheck(vo)) {
} throw new BadRequest("系统编号已存在,请重新输入");
List<DynamicFormInstance> formInstance = vo.getFormInstances(); }
// 验证必填项 BUG 2725 by kongfm 2021-09-09 List<DynamicFormInstance> formInstance = vo.getFormInstances();
formInstance.stream().forEach(item -> { // 验证必填项 BUG 2725 by kongfm 2021-09-09
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) { formInstance.stream().forEach(item -> {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认"); if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
} throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
}); }
String userId = remoteSecurityService.getAgencyUser().getUserId(); });
//冗余名称,数据同步使用 String userId = remoteSecurityService.getAgencyUser().getUserId();
this.setChargePersonName(vo); // 冗余名称,数据同步使用
String s = String.valueOf(System.currentTimeMillis()); this.setChargePersonName(vo);
vo.setId(s); String s = String.valueOf(System.currentTimeMillis());
vo.setRecUserId(userId); vo.setId(s);
vo.setSort(s); vo.setRecUserId(userId);
DynamicFormGroup dynamicFormGroup = iEqDynamicFormGroupService.getById(vo.getFormGroupId()); vo.setSort(s);
vo.setSystemType(dynamicFormGroup.getRelationId() != null ? dynamicFormGroup.getRelationId().toString() : ""); DynamicFormGroup dynamicFormGroup = iEqDynamicFormGroupService.getById(vo.getFormGroupId());
// fireSystemId 为字典表火灾系统id 以此确保第一个生成的火灾报警系统排序为1 vo.setSystemType(dynamicFormGroup.getRelationId() != null ? dynamicFormGroup.getRelationId().toString() : "");
if (vo.getSystemType().equals(fireSystemId)) { // fireSystemId 为字典表火灾系统id 以此确保第一个生成的火灾报警系统排序为1
vo.setSort("1"); if (vo.getSystemType().equals(fireSystemId)) {
} vo.setSort("1");
if ("".equals(vo.getInstallDate())) { }
vo.setInstallDate(null); if ("".equals(vo.getInstallDate())) {
} vo.setInstallDate(null);
if ("".equals(vo.getFirstMaintenanceDate())) { }
vo.setFirstMaintenanceDate(null); if ("".equals(vo.getFirstMaintenanceDate())) {
} vo.setFirstMaintenanceDate(null);
//1.保存动态表单数据 }
if (vo.getFormInstances() != null && vo.getFormInstances().size() > 0) { // 1.保存动态表单数据
Long instanceId = instanceService.saveInstanceBatch(vo.getFormInstances()); if (vo.getFormInstances() != null && vo.getFormInstances().size() > 0) {
vo.setInstanceId(instanceId); Long instanceId = instanceService.saveInstanceBatch(vo.getFormInstances());
s = s + "," + instanceId; vo.setInstanceId(instanceId);
} s = s + "," + instanceId;
//2.保存消防系统数据 }
int save = fireFightingSystemMapper.save(vo); // 2.保存消防系统数据
if (save > 0 && syncSwitch) { int save = fireFightingSystemMapper.save(vo);
// AST数据同步 if (save > 0 && syncSwitch) {
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo); // AST数据同步
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail); List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
} else { syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
return s; } else {
} return s;
//3.保存图片数据 }
this.insertFiles(vo); // 3.保存图片数据
return s; this.insertFiles(vo);
} return s;
}
@Override @Override
public String update(FireFightingSystemVo vo) { public String update(FireFightingSystemVo vo) {
if (!systemCodeCheck(vo)) { if (!systemCodeCheck(vo)) {
throw new BadRequest("系统编号已存在,请重新输入"); throw new BadRequest("系统编号已存在,请重新输入");
} }
// 验证必填项 BUG 2725 by kongfm 2021-09-09 // 验证必填项 BUG 2725 by kongfm 2021-09-09
List<DynamicFormInstance> formInstance = vo.getFormInstances(); List<DynamicFormInstance> formInstance = vo.getFormInstances();
formInstance.stream().forEach(item -> { formInstance.stream().forEach(item -> {
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) { if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认"); throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
} }
}); });
String userId = remoteSecurityService.getAgencyUser().getUserId(); String userId = remoteSecurityService.getAgencyUser().getUserId();
vo.setRecUserId(userId); vo.setRecUserId(userId);
//冗余名称,数据同步使用 // 冗余名称,数据同步使用
this.setChargePersonName(vo); this.setChargePersonName(vo);
if ("".equals(vo.getInstallDate())) { if ("".equals(vo.getInstallDate())) {
vo.setInstallDate(null); vo.setInstallDate(null);
} }
if ("".equals(vo.getFirstMaintenanceDate())) { if ("".equals(vo.getFirstMaintenanceDate())) {
vo.setFirstMaintenanceDate(null); vo.setFirstMaintenanceDate(null);
} }
int update = fireFightingSystemMapper.update(vo); int update = fireFightingSystemMapper.update(vo);
if (update > 0 && syncSwitch) { if (update > 0 && syncSwitch) {
// AST数据同步 // AST数据同步
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo); List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail); syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
} else { } else {
return null; return null;
} }
//1.更新消防系统数据 // 1.更新消防系统数据
String sequenceNbr = vo.getId(); String sequenceNbr = vo.getId();
fireFightingSystemMapper.deleteFilre(sequenceNbr); fireFightingSystemMapper.deleteFilre(sequenceNbr);
//2.更新动态表单数据 // 2.更新动态表单数据
if (vo.getInstanceId() != null && vo.getFormInstances().size() > 0) { if (vo.getInstanceId() != null && vo.getFormInstances().size() > 0) {
instanceService.updateInstanceBatch(vo.getInstanceId(), vo.getFormInstances()); instanceService.updateInstanceBatch(vo.getInstanceId(), vo.getFormInstances());
} }
//3.更新图片数据 // 3.更新图片数据
this.insertFiles(vo); this.insertFiles(vo);
return vo.getId(); return vo.getId();
} }
private void setChargePersonName(FireFightingSystemVo vo) { private void setChargePersonName(FireFightingSystemVo vo) {
if (StringUtil.isNotEmpty(vo.getChargePerson())) { if (StringUtil.isNotEmpty(vo.getChargePerson())) {
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson()); FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult(); AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
vo.setChargePersonName(userModel.getRealName()); vo.setChargePersonName(userModel.getRealName());
} }
} }
private boolean systemCodeCheck(FireFightingSystemVo systemVo) { private boolean systemCodeCheck(FireFightingSystemVo systemVo) {
if (StringUtils.isEmpty(systemVo.getId())) { if (StringUtils.isEmpty(systemVo.getId())) {
// 新建系统时 // 新建系统时
int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>().eq(FireFightingSystemEntity::getCode, systemVo.getCode())); int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>()
return count < 1; .eq(FireFightingSystemEntity::getCode, systemVo.getCode()));
} else { return count < 1;
int count = } else {
this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>().eq(FireFightingSystemEntity::getCode, systemVo.getCode()).ne(FireFightingSystemEntity::getId, systemVo.getId())); int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>()
return count < 1; .eq(FireFightingSystemEntity::getCode, systemVo.getCode())
} .ne(FireFightingSystemEntity::getId, systemVo.getId()));
} return count < 1;
}
@Override }
public FireFightingSystemVo createMorphic(FireFightingSystemVo model) {
ResourceDTO resourceDTO = new ResourceDTO(); @Override
resourceDTO.setSubjectId(projectSeq); public FireFightingSystemVo createMorphic(FireFightingSystemVo model) {
resourceDTO.setSubjectid(projectSeq); ResourceDTO resourceDTO = new ResourceDTO();
resourceDTO.setName(model.getName()); resourceDTO.setSubjectId(projectSeq);
// 为首次 添加的画布添加mqtt 相关数据 resourceDTO.setSubjectid(projectSeq);
String content = "{\"layout\":\"\",\"boardConfig\":{\"modeType\":\"custom\",\"orientation\":\"lengthways\",\"autoRefresh\":true,\"name\":\"1\",\"showMode\":\"actual\",\"paperSize\":\"1280X900\"},\"boardStyle\":{\"backgroundImage\":\"\"},\"dataConfig\":{}}"; resourceDTO.setName(model.getName());
Map parse = (Map) JSON.parse(content); // 为首次 添加的画布添加mqtt 相关数据
Map<String, Object> dataConfig = new HashMap<>(); String content = "{\"layout\":\"\",\"boardConfig\":{\"modeType\":\"custom\",\"orientation\":\"lengthways\",\"autoRefresh\":true,\"name\":\"1\",\"showMode\":\"actual\",\"paperSize\":\"1280X900\"},\"boardStyle\":{\"backgroundImage\":\"\"},\"dataConfig\":{}}";
dataConfig.put("msgType", "mqtt"); Map parse = (Map) JSON.parse(content);
dataConfig.put("wsUrl", sceneUrl); Map<String, Object> dataConfig = new HashMap<>();
parse.put("dataConfig", dataConfig); dataConfig.put("msgType", "mqtt");
content = JSONObject.toJSONString(parse); dataConfig.put("wsUrl", sceneUrl);
dataConfig.put("wsTopic", wsTopic); parse.put("dataConfig", dataConfig);
resourceDTO.setContent(content); content = JSONObject.toJSONString(parse);
ResourceDTO morphic = Morphic.morphicSubjectClient.create(resourceDTO).getResult(); dataConfig.put("wsTopic", wsTopic);
model.setSceneId(morphic.getId()); resourceDTO.setContent(content);
ResourceDTO morphic = Morphic.morphicSubjectClient.create(resourceDTO).getResult();
model.setSceneId(morphic.getId());
// fireFightingSystemMapper.setSceneId(model); // fireFightingSystemMapper.setSceneId(model);
return model; return model;
} }
@Override @Override
@Transactional @Transactional
public ResourceDTO updateMorphic(ResourceDTO resourceDTO) { public ResourceDTO updateMorphic(ResourceDTO resourceDTO) {
try { try {
//1.更新画布信息 // 1.更新画布信息
resourceDTO.setSubjectId(projectSeq); resourceDTO.setSubjectId(projectSeq);
resourceDTO.setSubjectid(projectSeq); resourceDTO.setSubjectid(projectSeq);
String content = resourceDTO.getContent(); String content = resourceDTO.getContent();
Map parse = (Map) JSON.parse(content); Map parse = (Map) JSON.parse(content);
Map<String, Object> dataConfig = new HashMap<>(); Map<String, Object> dataConfig = new HashMap<>();
dataConfig.put("msgType", "mqtt"); dataConfig.put("msgType", "mqtt");
dataConfig.put("wsUrl", sceneUrl); dataConfig.put("wsUrl", sceneUrl);
dataConfig.put("wsTopic", wsTopic); dataConfig.put("wsTopic", wsTopic);
parse.put("dataConfig", dataConfig); parse.put("dataConfig", dataConfig);
content = JSONObject.toJSONString(parse); content = JSONObject.toJSONString(parse);
resourceDTO.setContent(content); resourceDTO.setContent(content);
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO)); FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
//2.更新业务关联的画布id // 2.更新业务关联的画布id
Long systemId = Long.valueOf(resourceDTO.getCode()); Long systemId = Long.valueOf(resourceDTO.getCode());
FireFightingSystemVo systemVo = new FireFightingSystemVo(); FireFightingSystemVo systemVo = new FireFightingSystemVo();
systemVo.setId(String.valueOf(systemId)); systemVo.setId(String.valueOf(systemId));
systemVo.setSceneId(resourceDTO.getId()); systemVo.setSceneId(resourceDTO.getId());
fireFightingSystemMapper.setSceneId(systemVo); fireFightingSystemMapper.setSceneId(systemVo);
//3.保存场景关联信息表 // 3.保存场景关联信息表
SourceScene sourceScene = sourceSceneMapper.selectOne(new LambdaQueryWrapper<SourceScene>().eq(SourceScene::getSceneId, resourceDTO.getId())); SourceScene sourceScene = sourceSceneMapper
if (sourceScene == null) { .selectOne(new LambdaQueryWrapper<SourceScene>().eq(SourceScene::getSceneId, resourceDTO.getId()));
sourceScene = new SourceScene(); if (sourceScene == null) {
sourceScene.setProjectId(String.valueOf(projectSeq)); sourceScene = new SourceScene();
sourceScene.setSourceId(systemId); sourceScene.setProjectId(String.valueOf(projectSeq));
sourceScene.setSourceName(resourceDTO.getName()); sourceScene.setSourceId(systemId);
sourceScene.setSceneId(resourceDTO.getId()); sourceScene.setSourceName(resourceDTO.getName());
} sourceScene.setSceneId(resourceDTO.getId());
//TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头) }
List<Map> children = (List<Map>) parse.get("children"); // TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头)
String pointInScene = ""; List<Map> children = (List<Map>) parse.get("children");
String videoInScene = ""; String pointInScene = "";
if (!CollectionUtils.isEmpty(children)) { String videoInScene = "";
for (Map<String, String> map : children) { if (!CollectionUtils.isEmpty(children)) {
String key = map.get("key"); for (Map<String, String> map : children) {
if (!"".equals(key) && "equipment".equals(key)) { String key = map.get("key");
pointInScene = "".equals(pointInScene) ? map.get("sequenceNbr") : pointInScene + "," + map.get("sequenceNbr"); if (!"".equals(key) && "equipment".equals(key)) {
} pointInScene = "".equals(pointInScene) ? map.get("sequenceNbr")
if (!"".equals(key) && "video".equals(key)) { : pointInScene + "," + map.get("sequenceNbr");
videoInScene = "".equals(videoInScene) ? map.get("sequenceNbr") : videoInScene + "," + map.get("sequenceNbr"); }
} if (!"".equals(key) && "video".equals(key)) {
} videoInScene = "".equals(videoInScene) ? map.get("sequenceNbr")
} : videoInScene + "," + map.get("sequenceNbr");
sourceScene.setPointInScene(pointInScene); }
sourceScene.setVideoInScene(videoInScene); }
iSourceSceneService.saveOrUpdate(sourceScene); }
} catch (Exception e) { sourceScene.setPointInScene(pointInScene);
log.error(e.getMessage(), e); sourceScene.setVideoInScene(videoInScene);
throw new BadRequest("保存画布失败"); iSourceSceneService.saveOrUpdate(sourceScene);
} } catch (Exception e) {
return resourceDTO; log.error(e.getMessage(), e);
} throw new BadRequest("保存画布失败");
}
@Override return resourceDTO;
public List<PointTreeVo> getPointTree(String id, String orgCode) { }
@Override
public List<PointTreeVo> getPointTree(String id, String orgCode) {
// CommonResponse se = riskModelFeign.getRiskSourceList(orgCode); // CommonResponse se = riskModelFeign.getRiskSourceList(orgCode);
// List<Map<String, Object>> list = (List<Map<String, Object>>) se.getDataList(); // List<Map<String, Object>> list = (List<Map<String, Object>>) se.getDataList();
// List<PointTreeVo> responses = new ArrayList<>(); // List<PointTreeVo> responses = new ArrayList<>();
...@@ -432,233 +437,234 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -432,233 +437,234 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p); // responses.add(p);
// }); // });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList()); // List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode); List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode);
return transferListToPointTree(buildList, id); return transferListToPointTree(buildList, id);
} }
@Override @Override
public List<SpeIndexVo> getSpeIndex(Long id) { public List<SpeIndexVo> getSpeIndex(Long id) {
return makeStatus(fireFightingSystemMapper.getSpeIndex(id)); return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
} }
private void insertFiles(FireFightingSystemVo vo) { private void insertFiles(FireFightingSystemVo vo) {
List<FileUploadVo> video = vo.getVideo(); List<FileUploadVo> video = vo.getVideo();
if (video.size() > 0) { if (video.size() > 0) {
for (FileUploadVo f : video) { for (FileUploadVo f : video) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("video"); f.setFileType("video");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
List<FileUploadVo> faceimg = vo.getFaceimg(); List<FileUploadVo> faceimg = vo.getFaceimg();
if (faceimg.size() > 0) { if (faceimg.size() > 0) {
for (FileUploadVo f : faceimg) { for (FileUploadVo f : faceimg) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("face"); f.setFileType("face");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
List<FileUploadVo> instruction = vo.getInstruction(); List<FileUploadVo> instruction = vo.getInstruction();
if (instruction.size() > 0) { if (instruction.size() > 0) {
for (FileUploadVo f : instruction) { for (FileUploadVo f : instruction) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("instruction"); f.setFileType("instruction");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
List<FileUploadVo> asser = vo.getAsser(); List<FileUploadVo> asser = vo.getAsser();
if (asser.size() > 0) { if (asser.size() > 0) {
for (FileUploadVo f : asser) { for (FileUploadVo f : asser) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("certificate"); f.setFileType("certificate");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
List<FileUploadVo> spotimg = vo.getSpotimg(); List<FileUploadVo> spotimg = vo.getSpotimg();
if (spotimg.size() > 0) { if (spotimg.size() > 0) {
for (FileUploadVo f : spotimg) { for (FileUploadVo f : spotimg) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("spotimg"); f.setFileType("spotimg");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
List<FileUploadVo> tdmod = vo.getTdmod(); List<FileUploadVo> tdmod = vo.getTdmod();
if (tdmod.size() > 0) { if (tdmod.size() > 0) {
for (FileUploadVo f : tdmod) { for (FileUploadVo f : tdmod) {
f.setId(String.valueOf(System.currentTimeMillis())); f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId()); f.setUserId(vo.getRecUserId());
f.setFileType("tdmod"); f.setFileType("tdmod");
f.setObjectId(vo.getId()); f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f); fireFightingSystemMapper.insertFile(f);
} }
} }
} }
/** /**
* 生成树结构 * 生成树结构
* *
* @param allRiskSource * @param allRiskSource
* @param id * @param id
* @return * @return
*/ */
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) { public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) {
List<PointTreeVo> treeList = new ArrayList<>(); List<PointTreeVo> treeList = new ArrayList<>();
//TODO id为空,为消防建筑使用;id不为空,为点位图使用 // TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id); List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) { if (!CollectionUtils.isEmpty(pointData)) {
List<Long> idList = pointData.stream().map(PointTreeVo::getSequenceNbr).collect(Collectors.toList()); List<Long> idList = pointData.stream().map(PointTreeVo::getSequenceNbr).collect(Collectors.toList());
List<SpeIndexVo> indexVoList = fireFightingSystemMapper.getSpeIndexIn(idList); List<SpeIndexVo> indexVoList = fireFightingSystemMapper.getSpeIndexIn(idList);
if (!CollectionUtils.isEmpty(indexVoList)) { if (!CollectionUtils.isEmpty(indexVoList)) {
Map<Long, List<SpeIndexVo>> indexMap = indexVoList.stream().collect(Collectors.groupingBy(SpeIndexVo::getEquipmentSpecificId)); Map<Long, List<SpeIndexVo>> indexMap = indexVoList.stream()
pointData.stream().forEach(p -> { .collect(Collectors.groupingBy(SpeIndexVo::getEquipmentSpecificId));
Map map = new HashMap(); pointData.stream().forEach(p -> {
map.put("imgPath", p.getImgPath()); Map map = new HashMap();
map.put("equipCode", p.getEquipCode()); map.put("imgPath", p.getImgPath());
map.put("equipSyetemId", p.getEquipSyetemId()); map.put("equipCode", p.getEquipCode());
map.put("equipTypeId", p.getEquipId()); map.put("equipSyetemId", p.getEquipSyetemId());
map.put("speindexList", makeStatus(indexMap.get(p.getSequenceNbr()))); map.put("equipTypeId", p.getEquipId());
map.put("speindexApi", speindexUrl + p.getSequenceNbr()); map.put("speindexList", makeStatus(indexMap.get(p.getSequenceNbr())));
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr()); map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr()); map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map); map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
}); p.setDataConfig(map);
} });
} }
allRiskSource.addAll(pointData); }
for (PointTreeVo tree : allRiskSource) { allRiskSource.addAll(pointData);
if (tree.getParentId() == null || tree.getParentId() == -1) { for (PointTreeVo tree : allRiskSource) {
treeList.add(tree); if (tree.getParentId() == null || tree.getParentId() == -1) {
} treeList.add(tree);
for (PointTreeVo treeNode : allRiskSource) { }
if (tree.getSequenceNbr().equals(treeNode.getParentId())) { for (PointTreeVo treeNode : allRiskSource) {
if (tree.getChildren() == null) { if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
tree.setChildren(new ArrayList<>()); if (tree.getChildren() == null) {
} tree.setChildren(new ArrayList<>());
tree.getChildren().add(treeNode); }
} tree.getChildren().add(treeNode);
} }
} }
return treeList; }
} return treeList;
}
/**
* 生成树结构 /**
* * 生成树结构
* @param allRiskSource *
* @return * @param allRiskSource
*/ * @return
public List<PointTreeVo> transferListTo3dPointTree(List<PointTreeVo> allRiskSource) { */
List<PointTreeVo> treeList = new ArrayList<>(); public List<PointTreeVo> transferListTo3dPointTree(List<PointTreeVo> allRiskSource) {
List<PointTreeVo> pointData = fireFightingSystemMapper.get3dPointData(); List<PointTreeVo> treeList = new ArrayList<>();
if (!CollectionUtils.isEmpty(pointData)) { List<PointTreeVo> pointData = fireFightingSystemMapper.get3dPointData();
allRiskSource.addAll(pointData); if (!CollectionUtils.isEmpty(pointData)) {
for (PointTreeVo tree : allRiskSource) { allRiskSource.addAll(pointData);
if (tree.getParentId() == null || tree.getParentId() == -1) { for (PointTreeVo tree : allRiskSource) {
treeList.add(tree); if (tree.getParentId() == null || tree.getParentId() == -1) {
} treeList.add(tree);
for (PointTreeVo treeNode : allRiskSource) { }
if (tree.getSequenceNbr().equals(treeNode.getParentId())) { for (PointTreeVo treeNode : allRiskSource) {
if (tree.getChildren() == null) { if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
tree.setChildren(new ArrayList<>()); if (tree.getChildren() == null) {
} tree.setChildren(new ArrayList<>());
tree.getChildren().add(treeNode); }
} tree.getChildren().add(treeNode);
} }
} }
return treeList; }
} return treeList;
return Lists.newArrayList(); }
} return Lists.newArrayList();
}
private static <T> void mapToBean(Map<String, Object> map, T bean) { private static <T> void mapToBean(Map<String, Object> map, T bean) {
try { try {
BeanUtils.populate(bean, map); BeanUtils.populate(bean, map);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
Set<?> set = new HashSet<>(); Set<?> set = new HashSet<>();
} }
/**
/** * 生成 性能指标数据
* 生成 性能指标数据 *
* * @param list
* @param list * @return
* @return */
*/ private List<SpeIndexVo> makeStatus(List<SpeIndexVo> list) {
private List<SpeIndexVo> makeStatus(List<SpeIndexVo> list) { if (list == null || list.size() == 0) {
if (list == null || list.size() == 0) { return new ArrayList<>();
return new ArrayList<>(); }
} List<SpeIndexVo> newList = new ArrayList<>();
List<SpeIndexVo> newList = new ArrayList<>(); List<SpeIndexVo> statusList = new ArrayList<>();
List<SpeIndexVo> statusList = new ArrayList<>(); for (SpeIndexVo vo : list) {
for (SpeIndexVo vo : list) { String k = vo.getTypeCode();
String k = vo.getTypeCode(); if (EquipmentRiskTypeEnum.GZ.getCode().equals(k) || EquipmentRiskTypeEnum.HZGJ.getCode().equals(k)
if (EquipmentRiskTypeEnum.GZ.getCode().equals(k) || || EquipmentRiskTypeEnum.YXZT.getCode().equals(k) || EquipmentRiskTypeEnum.PB.getCode().equals(k)) {
EquipmentRiskTypeEnum.HZGJ.getCode().equals(k) || statusList.add(vo);
EquipmentRiskTypeEnum.YXZT.getCode().equals(k) || }
EquipmentRiskTypeEnum.PB.getCode().equals(k)) { newList.add(vo);
statusList.add(vo); }
} if (statusList.size() == 0) {
newList.add(vo); return newList;
} }
if (statusList.size() == 0) { SpeIndexVo spe = new SpeIndexVo();
return newList; spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode());
} spe.setName("当前状态");
SpeIndexVo spe = new SpeIndexVo(); spe.setValue(getStatus(statusList));
spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode()); statusList.clear();
spe.setName("当前状态"); statusList.add(spe);
spe.setValue(getStatus(statusList)); statusList.addAll(newList);
statusList.clear(); return statusList;
statusList.add(spe); }
statusList.addAll(newList);
return statusList; /**
} * 判断 装备状态
*
/** * @param statusList
* 判断 装备状态 * @return
* */
* @param statusList private String getStatus(List<SpeIndexVo> statusList) {
* @return SpeIndexVo indexVo = statusList.get(0);
*/ if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(indexVo.getTypeCode())
private String getStatus(List<SpeIndexVo> statusList) { && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
SpeIndexVo indexVo = statusList.get(0); return "报警";
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) { }
return "报警"; if (EquipmentRiskTypeEnum.GZ.getCode().equals(indexVo.getTypeCode())
} && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
if (EquipmentRiskTypeEnum.GZ.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) { return "故障";
return "故障"; }
} if (EquipmentRiskTypeEnum.PB.getCode().equals(indexVo.getTypeCode())
if (EquipmentRiskTypeEnum.PB.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) { && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "屏蔽"; return "屏蔽";
} }
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.fake.value.equals(indexVo.getValue())) { if (EquipmentRiskTypeEnum.YXZT.getCode().equals(indexVo.getTypeCode())
return "停运"; && TrueOrFalseEnum.fake.value.equals(indexVo.getValue())) {
} return "停运";
return "运行"; }
} return "运行";
}
@Override
public List<FireFightingSystemEntity> getList() { @Override
return this.list(); public List<FireFightingSystemEntity> getList() {
} return this.list();
}
@Override
public Boolean deleteSystem(Long id) { @Override
public Boolean deleteSystem(Long id) {
// QueryWrapper<FormInstance> fqw = new QueryWrapper<>(); // QueryWrapper<FormInstance> fqw = new QueryWrapper<>();
// fqw.eq("field_value",id); // fqw.eq("field_value",id);
// fqw.groupBy("instance_id"); // fqw.groupBy("instance_id");
...@@ -672,372 +678,391 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -672,372 +678,391 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// String name = formInstance.getFieldValue(); // String name = formInstance.getFieldValue();
// throw new BadRequest(name+"建筑与该系统存在绑定关系,请清除后再进行删除!"); // throw new BadRequest(name+"建筑与该系统存在绑定关系,请清除后再进行删除!");
// } // }
FireFightingSystemEntity entity = baseMapper.selectById(id); FireFightingSystemEntity entity = baseMapper.selectById(id);
if (entity.getSceneId() != null) { if (entity.getSceneId() != null) {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId())); FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
} }
formInstanceMapper.clearSystemId(id); formInstanceMapper.clearSystemId(id);
//解除装备与消防系统关系 // 解除装备与消防系统关系
this.removeBondSystemId(id); this.removeBondSystemId(id);
this.baseMapper.deleteFilre(String.valueOf(id)); this.baseMapper.deleteFilre(String.valueOf(id));
int i = this.baseMapper.deleteById(id); int i = this.baseMapper.deleteById(id);
if (i > 0 && syncSwitch) { if (i > 0 && syncSwitch) {
syncDataService.syncDeletedFireFightingSystem(Arrays.asList(id)); syncDataService.syncDeletedFireFightingSystem(Arrays.asList(id));
} }
//删除动态关联表单实例数据 // 删除动态关联表单实例数据
if (entity.getInstanceId() != null) { if (entity.getInstanceId() != null) {
instanceService.remove( instanceService.remove(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId,
new LambdaQueryWrapper<DynamicFormInstance>() entity.getInstanceId()));
.eq(DynamicFormInstance::getInstanceId, entity.getInstanceId())); }
} return i > 0;
return i > 0; }
}
private void removeBondSystemId(Long id) {
private void removeBondSystemId(Long id) { List<EquipmentSpecific> equipmentSpecifics = equipmentSpecificSerivce
List<EquipmentSpecific> equipmentSpecifics = equipmentSpecificSerivce.list(new LambdaQueryWrapper<EquipmentSpecific>().like(EquipmentSpecific::getSystemId, id)); .list(new LambdaQueryWrapper<EquipmentSpecific>().like(EquipmentSpecific::getSystemId, id));
equipmentSpecifics.forEach(equipmentSpecific -> { equipmentSpecifics.forEach(equipmentSpecific -> {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
if (StringUtil.isNotEmpty(equipmentSpecific.getSystemId())) { if (StringUtil.isNotEmpty(equipmentSpecific.getSystemId())) {
ids = Arrays.asList(equipmentSpecific.getSystemId().split(",")); ids = Arrays.asList(equipmentSpecific.getSystemId().split(","));
ids = new ArrayList<>(ids); ids = new ArrayList<>(ids);
ids.remove(id.toString()); ids.remove(id.toString());
} }
equipmentSpecific.setSystemId(Joiner.on(",").join(ids)); equipmentSpecific.setSystemId(Joiner.on(",").join(ids));
}); });
if (!equipmentSpecifics.isEmpty()) { if (!equipmentSpecifics.isEmpty()) {
equipmentSpecificSerivce.saveOrUpdateBatch(equipmentSpecifics); equipmentSpecificSerivce.saveOrUpdateBatch(equipmentSpecifics);
} }
} }
@Override @Override
public Boolean isDeleteCanvas(Long id) { public Boolean isDeleteCanvas(Long id) {
FireFightingSystemEntity system = baseMapper.selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("scene_id", id)); FireFightingSystemEntity system = baseMapper
if (system != null) { .selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("scene_id", id));
return true; if (system != null) {
} else { return true;
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(id)); } else {
return false; FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(id));
} return false;
} }
}
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) { @Override
String type = equipTypeAmountPage.getType(); public IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(int hierarchy, String codeHead,
if (!"".equals(type) && "car".equals(type)) { EquipTypeAmountPageDTO equipTypeAmountPage) {
equipTypeAmountPage.setSystemId(null); String type = equipTypeAmountPage.getType();
equipTypeAmountPage.setStatus(null); if (!"".equals(type) && "car".equals(type)) {
} equipTypeAmountPage.setSystemId(null);
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper.getColaCategoryAmountList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage); equipTypeAmountPage.setStatus(null);
list.getRecords().forEach(x -> { }
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) { IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
x.setAmount(x.getAmount().split("\\.")[0]); .getColaCategoryAmountList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
} list.getRecords().forEach(x -> {
}); if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
return list; x.setAmount(x.getAmount().split("\\.")[0]);
} }
});
return list;
@Override }
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType(); @Override
if (!"".equals(type) && "car".equals(type)) { public IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead,
equipTypeAmountPage.setSystemId(null); EquipTypeAmountPageDTO equipTypeAmountPage) {
equipTypeAmountPage.setStatus(null); String type = equipTypeAmountPage.getType();
} if (!"".equals(type) && "car".equals(type)) {
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper.getColaCategoryAmountCarList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage); equipTypeAmountPage.setSystemId(null);
list.getRecords().forEach(x -> { equipTypeAmountPage.setStatus(null);
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) { }
x.setAmount(x.getAmount().split("\\.")[0]); IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
} .getColaCategoryAmountCarList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
}); list.getRecords().forEach(x -> {
return list; if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
} x.setAmount(x.getAmount().split("\\.")[0]);
@Override }
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) { });
String type = equipTypeAmountPage.getType(); return list;
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
equipTypeAmountPage.setStatus(null);
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper.getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
list.getRecords().forEach(x -> {
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]);
}
});
return list;
}
@Override
public List<EquipmentManageVo> getSystemCategory() {
return equipmentManageMapper.getSystemList();
}
@Override
public List<FireFightingSystem> getFireFightingSystemDetail(FireFightingSystemVo fireFightingSystemVo) {
return fireFightingSystemMapper.getFireFightingSystemDetail(fireFightingSystemVo);
}
@Override
public List<FireFightingSystemEntity> getFightingSysByCodes(String[] idsArr) {
List<FireFightingSystemEntity> fightingSystemList = fireFightingSystemMapper.getFightingSysByCodes(idsArr);
if (fightingSystemList != null && !fightingSystemList.isEmpty()) {
return fightingSystemList;
}
return Lists.newArrayList();
}
@Override
public List<FireFightingSystem3dVo> get3dFightingSystemList() {
FeignClientResult<List<DictionarieValueModel>> dictValues = Systemctl.dictionarieClient.dictValues(iotCoreParam);
Optional.ofNullable(dictValues).orElseThrow(() -> new BadRequest("查询字段数据为空"));
List<DictionarieValueModel> values = dictValues.getResult();
if (!CollectionUtils.isEmpty(values)) {
List<String> collect = values.stream().map(DictionarieValueModel::getDictDataKey).collect(Collectors.toList());
List<FireFightingSystem3dVo> list = fireFightingSystemMapper.get3dFightingSystemList(collect);
if (!CollectionUtils.isEmpty(list)) {
return list;
}
}
return Lists.newArrayList();
}
@Override
public FireFightingSystemEntity getDetailByCode(String systemCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireFightingSystemEntity::getCode, systemCode);
List<FireFightingSystemEntity> systemEntities = this.list(wrapper);
if (systemEntities.isEmpty()) {
throw new RuntimeException("code" + systemCode + "不存在");
}
return systemEntities.get(0);
}
@Override
public List<AlarmDataVO> getSystemById(Long id) {
return this.baseMapper.getSystemById(id);
}
@Override
public IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(IPage<EquipmentAlarmBySystemIdOrSourceIdVO> page, Long sourceId, Long systemId, Integer confirmType, String createDate, String type) {
return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType, createDate, type);
}
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements(); ) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements(); ) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub
if (!StringUtil.isNotEmpty(SystemTypeEnum.getEnum(systemCode))) {
return null;
}
Map<String, Object> data = null;
if (isUpdate) {
data = saveIntegrationPageSysData(systemCode);
} else {
if (redisUtils.hasKey(systemCode)) {
data = JSONObject.parseObject(redisUtils.get(systemCode).toString(), Map.class);
} else {
data = saveIntegrationPageSysData(systemCode);
}
}
if (!ObjectUtils.isEmpty(data)) {
mqttSendGateway.sendToMqtt(String.format("%s%s", "INTEGRATE_TOPIC/", systemCode), JSON.toJSONString(data));
}
return null;
}
public Map<String, Object> saveIntegrationPageSysData(String systemCode) {
Map<String, Object> data = null;
if (SystemTypeEnum.fireAlarmSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireAlarmSysEquipmentNumber();
this.putAll(data, fireFightingSystemMapper.fireAlarmSysIndexNumber());
this.putAll(data, fireFightingSystemMapper.fireWaterSysHydrant());
} else if (SystemTypeEnum.fireCAFSSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.getFireCafsSystem();
} else if (SystemTypeEnum.fireONLSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.getFireOnlSystem();
this.putAll(data, fireFightingSystemMapper.getFireOnlSystemThreeSmall());
} else if (SystemTypeEnum.fireFoamSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireFoamSysEquipmentIndexNumber();
} else if (SystemTypeEnum.fireFoamMistSys.getCode().equals(systemCode) || SystemTypeEnum.envMonitoringSys.getCode().equals(systemCode)) {
//TODO 灯泡及门状态,实时数据库刷新,存放数据,套用后续逻辑进行数据的发送
data = new HashMap<>();
data.put("waitRefresh", true);
} else if (SystemTypeEnum.fireWaterSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireWaterSysCollectingDevice();
this.putAll(data, fireFightingSystemMapper.fireWaterSysPool());
this.putAll(data, fireFightingSystemMapper.fireWaterSysWaterPump());
} else {
data = fireFightingSystemMapper.otherSysIndexNumAndTotal();
}
if (!ObjectUtils.isEmpty(data)) {
redisUtils.set(systemCode, JSONObject.toJSONString(data));
}
return data;
}
private void putAll(Map<String, Object> data, Map<String, Object> addMap) {
if (!CollectionUtils.isEmpty(addMap)) {
data.putAll(addMap);
}
}
@Override
public List<FireFightingSystemTreeVo> getSystemTreeByOrgCode(String bizOrgCode) {
// 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth("COMPANY,DEPARTMENT", bizOrgCode);
List<FireFightingSystemTreeVo> fireFightingSystemTreeList = orgUsrLists.stream()
.map(key -> {
FireFightingSystemTreeVo vo = new FireFightingSystemTreeVo();
vo.setId(String.valueOf(key.getSequenceNbr()));
vo.setName(key.getBizOrgName());
vo.setType(key.getBizOrgType());
vo.setBizOrgCode(key.getBizOrgCode());
vo.setParentId(key.getParentId());
return vo;
}).collect(Collectors.toList());
// 根据bizOrgCode获取系统list
List<String> bizOrgCodes = fireFightingSystemTreeList.stream().map(FireFightingSystemTreeVo::getBizOrgCode).collect(Collectors.toList());
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getBizOrgCode, bizOrgCodes);
List<FireFightingSystemEntity> fireFightingSystemEntityList = this.baseMapper.selectList(wrapper);
List<FireFightingSystemTreeVo> systemList = fireFightingSystemEntityList.stream()
.map(key -> {
FireFightingSystemTreeVo vo = new FireFightingSystemTreeVo();
vo.setId(String.valueOf(key.getId()));
vo.setName(key.getName());
vo.setType("system");
vo.setBizOrgCode(key.getBizOrgCode());
return vo;
}).collect(Collectors.toList());
// 组装公司部门树
fireFightingSystemTreeList.addAll(systemList);
return fireFightingSystemTreeList.stream()
.filter(d -> !"system".equals(d.getType()))
.peek((m) -> m.setChildren(getChildren(m, fireFightingSystemTreeList)))
.collect(Collectors.toList());
}
private List<FireFightingSystemTreeVo> getChildren(FireFightingSystemTreeVo root, List<FireFightingSystemTreeVo> all) {
return all.stream().filter(d -> StringUtil.isNotEmpty(d.getParentId()) && d.getParentId().equals(root.getId())
|| (StringUtil.isNotEmpty(d.getBizOrgCode())
&& d.getBizOrgCode().equals(root.getBizOrgCode())
&& !"system".equals(root.getType())
&& !d.getId().equals(root.getId()))
)
.peek(m -> m.setChildren(getChildren(m, all)))
.collect(Collectors.toList());
}
@Override
public List<OrgMenuDto> companyTreeByUserAndType(String type) {
return jcsRemoteService.getCompanyDeptTreeWithAuth(authKey, type);
}
@Override
public List<FireFightingSystemTypeTreeVo> systemTypeTree(String bizOrgCode) {
// 获取所有系统分类list
LambdaQueryWrapper<DynamicFormGroup> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DynamicFormGroup::getGroupType, "fireSystem");
wrapper.eq(DynamicFormGroup::getParentId, 0);
List<DynamicFormGroup> list = iEqDynamicFormGroupService.list(wrapper);
List<Map<String, Object>> typeList = fireFightingSystemMapper.listByBizOrgCode(bizOrgCode);
List<FireFightingSystemTypeTreeVo> childrenList = list.stream().map(item -> {
FireFightingSystemTypeTreeVo vo = new FireFightingSystemTypeTreeVo();
vo.setName(item.getGroupName());
typeList.forEach(obj -> {
if (item.getId().equals(Long.valueOf(obj.get("typeId").toString()))) {
vo.setTotal(obj.get("total").toString());
}
});
vo.setType(item.getGroupType());
vo.setId(String.valueOf(item.getId()));
return vo;
}).collect(Collectors.toList());
// 自定义根节点返回树
FireFightingSystemTypeTreeVo parentNode = new FireFightingSystemTypeTreeVo();
parentNode.setType("all");
parentNode.setName("全部分类");
parentNode.setId("-1");
parentNode.setParentId("-1");
parentNode.setChildren(childrenList);
return Collections.singletonList(parentNode);
}
public Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> equipmentTypeList =null;
// if (redisUtils.hasKey(equipTypeAndCount)) {
// equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(equipTypeAndCount)), EquipmentCategory.class);
// } else {
List<EquipmentCategory> responseList = this.typeList();
if(responseList == null || responseList.size()<1) {
return null;
}
equipmentTypeList = responseList.stream().filter(i->!i.getCode().startsWith("2") && "2".equals(i.getIndustryCode())).collect(Collectors.toList());
// }
return typeListTree(equipmentTypeList,bizOrgCode,SourceTypeEnum.EQUIPMENT);
} }
public Object getCarTypeAndCount(String bizOrgCode) throws Exception { @Override
List<EquipmentCategory> equipmentTypeList =null; public IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(int hierarchy, String codeHead,
// if (redisUtils.hasKey(carTypeAndCount)) { EquipTypeAmountPageDTO equipTypeAmountPage) {
// equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(carTypeAndCount)), EquipmentCategory.class); String type = equipTypeAmountPage.getType();
// } else { if (!"".equals(type) && "car".equals(type)) {
List<EquipmentCategory> responseList = this.typeList(); equipTypeAmountPage.setSystemId(null);
if(responseList == null || responseList.size()<1) { equipTypeAmountPage.setStatus(null);
return null; }
} IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
equipmentTypeList = responseList.stream().filter(i->i.getCode().startsWith("2") && "2".equals(i.getIndustryCode())).collect(Collectors.toList()); .getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
// } list.getRecords().forEach(x -> {
return typeListTree(equipmentTypeList,bizOrgCode,SourceTypeEnum.CAR); if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]);
}
});
return list;
}
@Override
public List<EquipmentManageVo> getSystemCategory() {
return equipmentManageMapper.getSystemList();
}
@Override
public List<FireFightingSystem> getFireFightingSystemDetail(FireFightingSystemVo fireFightingSystemVo) {
return fireFightingSystemMapper.getFireFightingSystemDetail(fireFightingSystemVo);
}
@Override
public List<FireFightingSystemEntity> getFightingSysByCodes(String[] idsArr) {
List<FireFightingSystemEntity> fightingSystemList = fireFightingSystemMapper.getFightingSysByCodes(idsArr);
if (fightingSystemList != null && !fightingSystemList.isEmpty()) {
return fightingSystemList;
}
return Lists.newArrayList();
} }
@Override
public List<FireFightingSystem3dVo> get3dFightingSystemList() {
public List<EquipmentCategory> typeList() { FeignClientResult<List<DictionarieValueModel>> dictValues = Systemctl.dictionarieClient
.dictValues(iotCoreParam);
Optional.ofNullable(dictValues).orElseThrow(() -> new BadRequest("查询字段数据为空"));
List<DictionarieValueModel> values = dictValues.getResult();
if (!CollectionUtils.isEmpty(values)) {
List<String> collect = values.stream().map(DictionarieValueModel::getDictDataKey)
.collect(Collectors.toList());
List<FireFightingSystem3dVo> list = fireFightingSystemMapper.get3dFightingSystemList(collect);
if (!CollectionUtils.isEmpty(list)) {
return list;
}
}
return Lists.newArrayList();
}
@Override
public FireFightingSystemEntity getDetailByCode(String systemCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(FireFightingSystemEntity::getCode, systemCode);
List<FireFightingSystemEntity> systemEntities = this.list(wrapper);
if (systemEntities.isEmpty()) {
throw new RuntimeException("code" + systemCode + "不存在");
}
return systemEntities.get(0);
}
@Override
public List<AlarmDataVO> getSystemById(Long id) {
return this.baseMapper.getSystemById(id);
}
@Override
public IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(
IPage<EquipmentAlarmBySystemIdOrSourceIdVO> page, Long sourceId, Long systemId, Integer confirmType,
String createDate, String type) {
return this.baseMapper.getEquipmentAlarmBySystemIdOrSourceIdVO(page, sourceId, systemId, confirmType,
createDate, type);
}
private static String getInet4Address() {
Enumeration<NetworkInterface> nis;
String ip = null;
try {
nis = NetworkInterface.getNetworkInterfaces();
for (; nis.hasMoreElements();) {
NetworkInterface ni = nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
for (; ias.hasMoreElements();) {
InetAddress ia = ias.nextElement();
if (ia instanceof Inet4Address && !ia.getHostAddress().equals("127.0.0.1")) {
ip = ia.getHostAddress();
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
return ip;
}
@Override
public Map<String, Object> integrationPageSysData(String systemCode, Boolean isUpdate) {
// TODO Auto-generated method stub
if (!StringUtil.isNotEmpty(SystemTypeEnum.getEnum(systemCode))) {
return null;
}
Map<String, Object> data = null;
if (isUpdate) {
data = saveIntegrationPageSysData(systemCode);
} else {
if (redisUtils.hasKey(systemCode)) {
data = JSONObject.parseObject(redisUtils.get(systemCode).toString(), Map.class);
} else {
data = saveIntegrationPageSysData(systemCode);
}
}
if (!ObjectUtils.isEmpty(data)) {
mqttSendGateway.sendToMqtt(String.format("%s%s", "INTEGRATE_TOPIC/", systemCode), JSON.toJSONString(data));
}
return null;
}
public Map<String, Object> saveIntegrationPageSysData(String systemCode) {
Map<String, Object> data = null;
if (SystemTypeEnum.fireAlarmSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireAlarmSysEquipmentNumber();
this.putAll(data, fireFightingSystemMapper.fireAlarmSysIndexNumber());
this.putAll(data, fireFightingSystemMapper.fireWaterSysHydrant());
} else if (SystemTypeEnum.fireCAFSSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.getFireCafsSystem();
} else if (SystemTypeEnum.fireONLSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.getFireOnlSystem();
this.putAll(data, fireFightingSystemMapper.getFireOnlSystemThreeSmall());
} else if (SystemTypeEnum.fireFoamSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireFoamSysEquipmentIndexNumber();
} else if (SystemTypeEnum.fireFoamMistSys.getCode().equals(systemCode)
|| SystemTypeEnum.envMonitoringSys.getCode().equals(systemCode)) {
// TODO 灯泡及门状态,实时数据库刷新,存放数据,套用后续逻辑进行数据的发送
data = new HashMap<>();
data.put("waitRefresh", true);
} else if (SystemTypeEnum.fireWaterSys.getCode().equals(systemCode)) {
data = fireFightingSystemMapper.fireWaterSysCollectingDevice();
this.putAll(data, fireFightingSystemMapper.fireWaterSysPool());
this.putAll(data, fireFightingSystemMapper.fireWaterSysWaterPump());
} else {
data = fireFightingSystemMapper.otherSysIndexNumAndTotal();
}
if (!ObjectUtils.isEmpty(data)) {
redisUtils.set(systemCode, JSONObject.toJSONString(data));
}
return data;
}
private void putAll(Map<String, Object> data, Map<String, Object> addMap) {
if (!CollectionUtils.isEmpty(addMap)) {
data.putAll(addMap);
}
}
@Override
public List<FireFightingSystemTreeVo> getSystemTreeByOrgCode(String bizOrgCode) {
// 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth("COMPANY,DEPARTMENT", bizOrgCode);
List<FireFightingSystemTreeVo> fireFightingSystemTreeList = orgUsrLists.stream().map(key -> {
FireFightingSystemTreeVo vo = new FireFightingSystemTreeVo();
vo.setId(String.valueOf(key.getSequenceNbr()));
vo.setName(key.getBizOrgName());
vo.setType(key.getBizOrgType());
vo.setBizOrgCode(key.getBizOrgCode());
vo.setParentId(key.getParentId());
return vo;
}).collect(Collectors.toList());
// 根据bizOrgCode获取系统list
List<String> bizOrgCodes = fireFightingSystemTreeList.stream().map(FireFightingSystemTreeVo::getBizOrgCode)
.collect(Collectors.toList());
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getBizOrgCode, bizOrgCodes);
List<FireFightingSystemEntity> fireFightingSystemEntityList = this.baseMapper.selectList(wrapper);
List<FireFightingSystemTreeVo> systemList = fireFightingSystemEntityList.stream().map(key -> {
FireFightingSystemTreeVo vo = new FireFightingSystemTreeVo();
vo.setId(String.valueOf(key.getId()));
vo.setName(key.getName());
vo.setType("system");
vo.setBizOrgCode(key.getBizOrgCode());
return vo;
}).collect(Collectors.toList());
// 组装公司部门树
fireFightingSystemTreeList.addAll(systemList);
return fireFightingSystemTreeList.stream().filter(d -> !"system".equals(d.getType()))
.peek((m) -> m.setChildren(getChildren(m, fireFightingSystemTreeList))).collect(Collectors.toList());
}
private List<FireFightingSystemTreeVo> getChildren(FireFightingSystemTreeVo root,
List<FireFightingSystemTreeVo> all) {
return all.stream()
.filter(d -> StringUtil.isNotEmpty(d.getParentId()) && d.getParentId().equals(root.getId())
|| (StringUtil.isNotEmpty(d.getBizOrgCode()) && d.getBizOrgCode().equals(root.getBizOrgCode())
&& !"system".equals(root.getType()) && !d.getId().equals(root.getId())))
.peek(m -> m.setChildren(getChildren(m, all))).collect(Collectors.toList());
}
@Override
public List<OrgMenuDto> companyTreeByUserAndType(String type) {
return jcsRemoteService.getCompanyDeptTreeWithAuth(authKey, type);
}
@Override
public List<FireFightingSystemTypeTreeVo> systemTypeTree(String bizOrgCode) {
// 获取所有系统分类list
LambdaQueryWrapper<DynamicFormGroup> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DynamicFormGroup::getGroupType, "fireSystem");
wrapper.eq(DynamicFormGroup::getParentId, 0);
List<DynamicFormGroup> list = iEqDynamicFormGroupService.list(wrapper);
List<Map<String, Object>> typeList = fireFightingSystemMapper.listByBizOrgCode(bizOrgCode);
List<FireFightingSystemTypeTreeVo> childrenList = list.stream().map(item -> {
FireFightingSystemTypeTreeVo vo = new FireFightingSystemTypeTreeVo();
vo.setName(item.getGroupName());
typeList.forEach(obj -> {
if (item.getId().equals(Long.valueOf(obj.get("typeId").toString()))) {
vo.setTotal(obj.get("total").toString());
}
});
vo.setType(item.getGroupType());
vo.setId(String.valueOf(item.getId()));
return vo;
}).collect(Collectors.toList());
// 自定义根节点返回树
FireFightingSystemTypeTreeVo parentNode = new FireFightingSystemTypeTreeVo();
parentNode.setType("all");
parentNode.setName("全部分类");
parentNode.setId("-1");
parentNode.setParentId("-1");
parentNode.setChildren(childrenList);
return Collections.singletonList(parentNode);
}
public Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception {
if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) {
List<EquipmentCategory> typeList = JSONArray.parseArray(
JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class);
return typeList;
} else {
return refreshEquipmentTypeAndCount(bizOrgCode);
}
}
public Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> responseList = this.typeList();
if (responseList == null || responseList.size() < 1) {
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.EQUIPMENT);
redisUtils.set(equipTypeAndCount + bizOrgCode, list);
return list;
}
public Object getCarTypeAndCount(String bizOrgCode) throws Exception {
if (redisUtils.hasKey(carTypeAndCount + bizOrgCode)) {
List<EquipmentCategory> typeList = JSONArray.parseArray(
JSONArray.toJSONString(redisUtils.get(carTypeAndCount + bizOrgCode)), EquipmentCategory.class);
return typeList;
} else {
return refreshCarTypeAndCount(bizOrgCode);
}
}
public Object refreshCarTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> responseList = this.typeList();
if (responseList == null || responseList.size() < 1) {
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.CAR);
redisUtils.set(carTypeAndCount + bizOrgCode, list);
return list;
}
public List<EquipmentCategory> typeList() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode)); .getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode));
return equipmentCategorys; return equipmentCategorys;
} }
public List<EquipmentCategory> typeListTree(List<EquipmentCategory> equipmentCategorys,String bizOrgCode,SourceTypeEnum sourceTypeEnum) {
public List<EquipmentCategory> typeListTree(List<EquipmentCategory> equipmentCategorys, String bizOrgCode,
SourceTypeEnum sourceTypeEnum) {
List<EquipmentCategory> list = new ArrayList<>(); List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>(); Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> { equipmentCategorys.forEach(action -> {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode()); int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
action.setCount(Double.parseDouble(num+"")); action.setCount(Double.parseDouble(num + ""));
if (action.getParentId() == null) { if (action.getParentId() == null) {
list.add(action); list.add(action);
} else { } else {
...@@ -1055,8 +1080,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1055,8 +1080,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
getChildren(list, tmpMap); getChildren(list, tmpMap);
return list; return list;
} }
private void getChildren(List<EquipmentCategory> list, Map<String, List<EquipmentCategory>> tmpMap) { private void getChildren(List<EquipmentCategory> list, Map<String, List<EquipmentCategory>> tmpMap) {
for (EquipmentCategory equipmentCategory : list) { for (EquipmentCategory equipmentCategory : list) {
if (tmpMap.get(equipmentCategory.getId().toString()) != null if (tmpMap.get(equipmentCategory.getId().toString()) != null
&& tmpMap.get(equipmentCategory.getId().toString()).size() > 0) { && tmpMap.get(equipmentCategory.getId().toString()).size() > 0) {
...@@ -1068,12 +1093,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1068,12 +1093,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
} }
@Override @Override
public List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode) { public List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
if (StringUtil.isNotEmpty(bizOrgCode)) { if (StringUtil.isNotEmpty(bizOrgCode)) {
wrapper.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode); wrapper.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode);
} }
return this.baseMapper.selectList(wrapper); return this.baseMapper.selectList(wrapper);
} }
} }
...@@ -59,6 +59,7 @@ import com.yeejoin.equipmanage.mapper.StockMapper; ...@@ -59,6 +59,7 @@ import com.yeejoin.equipmanage.mapper.StockMapper;
import com.yeejoin.equipmanage.service.EquipmentManageService; import com.yeejoin.equipmanage.service.EquipmentManageService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService; import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSystemSourceStatisticsService; import com.yeejoin.equipmanage.service.IEquipmentSystemSourceStatisticsService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService; import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IJournalService; import com.yeejoin.equipmanage.service.IJournalService;
...@@ -122,6 +123,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -122,6 +123,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
@Autowired @Autowired
private RelationRedisUtil relationRedisUtil; private RelationRedisUtil relationRedisUtil;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Override @Override
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public StockBill in(List<StockDetail> list, String type, AgencyUserModel agencyUserModel) { public StockBill in(List<StockDetail> list, String type, AgencyUserModel agencyUserModel) {
...@@ -284,7 +287,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -284,7 +287,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<EquipmentSpecific> uploadListByTemplate(List<EquipmentDetailDownloadTemplateDto> equipmentDetailDownloadVOS, ReginParams reginParams, AgencyUserModel agencyUserModel) { public List<EquipmentSpecific> uploadListByTemplate(List<EquipmentDetailDownloadTemplateDto> equipmentDetailDownloadVOS, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StringBuffer fireFightSysIdsBuffer = new StringBuffer(); equipmentSpecificSerivce.refreshStaData();//添加对于装备类型统计数据的刷新
StringBuffer fireFightSysIdsBuffer = new StringBuffer();
SimpleDateFormat stf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat stf = new SimpleDateFormat("yyyy-MM-dd");
List<EquipmentSpecific> list = new ArrayList<>(); List<EquipmentSpecific> list = new ArrayList<>();
if (equipmentDetailDownloadVOS.size() == 0) { if (equipmentDetailDownloadVOS.size() == 0) {
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -5,6 +5,7 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*; import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.VideoDTO; import com.yeejoin.equipmanage.common.entity.dto.VideoDTO;
import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto; import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -201,7 +203,17 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements ...@@ -201,7 +203,17 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override @Override
public Page<PageVideoVO> pageVideo(VideoDTO videoDTO) { public Page<PageVideoVO> pageVideo(VideoDTO videoDTO) {
return this.baseMapper.pageVideo(videoDTO.getPage(), videoDTO.getVideo()); Video video = videoDTO.getVideo();
String orgTypes = videoDTO.getOrgTypes();
String bizOrgCode = video.getBizOrgCode();
List<String> bizOrgCodeList = new ArrayList<>();
if (!StringUtils.isNotBlank(bizOrgCode)) {
List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes);
if (!CollectionUtils.isEmpty(list)) {
list.stream().filter(o -> StringUtils.isNotBlank(o.getBizOrgCode())).forEach(x -> bizOrgCodeList.add(x.getBizOrgCode()));
}
}
return this.baseMapper.pageVideo(videoDTO.getPage(), video, bizOrgCodeList);
} }
@Override @Override
......
...@@ -87,7 +87,8 @@ ...@@ -87,7 +87,8 @@
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS name, MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS name,
MAX( CASE WHEN a.field_name = 'code' THEN a.field_value END ) AS code, MAX( CASE WHEN a.field_name = 'code' THEN a.field_value END ) AS code,
MAX( CASE WHEN a.field_name = 'isRisk' THEN a.field_value END ) AS isRisk, MAX( CASE WHEN a.field_name = 'isRisk' THEN a.field_value END ) AS isRisk,
MAX( CASE WHEN a.field_name = 'address' THEN a.field_value END ) AS address MAX( CASE WHEN a.field_name = 'address' THEN a.field_value END ) AS address,
MAX( CASE WHEN a.field_name = 'bizOrgCode' THEN a.field_value END ) AS bizOrgCode
FROM FROM
`wl_form_instance` a `wl_form_instance` a
LEFT JOIN wl_source_scene wlss ON wlss.source_id = a.instance_id LEFT JOIN wl_source_scene wlss ON wlss.source_id = a.instance_id
...@@ -116,7 +117,9 @@ ...@@ -116,7 +117,9 @@
MAX(CASE WHEN a.field_name = 'hasFirePlan' THEN a.field_value END)AS hasFirePlan, MAX(CASE WHEN a.field_name = 'hasFirePlan' THEN a.field_value END)AS hasFirePlan,
MAX(CASE WHEN a.field_name = 'installLoc' THEN a.field_value END)AS installLoc, MAX(CASE WHEN a.field_name = 'installLoc' THEN a.field_value END)AS installLoc,
MAX(CASE WHEN a.field_name = 'inwhichBuild' THEN a.field_value END)AS inwhichBuild, MAX(CASE WHEN a.field_name = 'inwhichBuild' THEN a.field_value END)AS inwhichBuild,
MAX(CASE WHEN a.field_name = 'maintenanceUnit' THEN a.field_value END)AS maintenanceUnit MAX(CASE WHEN a.field_name = 'maintenanceUnit' THEN a.field_value END)AS maintenanceUnit,
MAX(CASE WHEN a.field_name = 'bizOrgCode' THEN a.field_value END)AS bizOrgCode,
MAX(CASE WHEN a.field_name = 'bizOrgName' THEN a.field_value END)AS bizOrgName
FROM FROM
`wl_form_instance` a `wl_form_instance` a
GROUP BY GROUP BY
...@@ -129,6 +132,9 @@ ...@@ -129,6 +132,9 @@
<if test="query.fieldValue != null and query.fieldValue !=''"> <if test="query.fieldValue != null and query.fieldValue !=''">
AND sa.fieldValue = #{query.fieldValue} AND sa.fieldValue = #{query.fieldValue}
</if> </if>
<if test="query.bizOrgCode != null and query.bizOrgCode !=''">
AND sa.bizOrgCode LIKE CONCAT(#{query.bizOrgCode},'%')
</if>
</where> </where>
ORDER BY sa.instanceId DESC ORDER BY sa.instanceId DESC
</select> </select>
......
...@@ -48,7 +48,13 @@ ...@@ -48,7 +48,13 @@
and wlv.type_code like concat('%',#{video.typeCode},'%') and wlv.type_code like concat('%',#{video.typeCode},'%')
</if> </if>
<if test="video!=null and video.bizOrgCode!=null and video.bizOrgCode!=''"> <if test="video!=null and video.bizOrgCode!=null and video.bizOrgCode!=''">
and wlv.biz_org_code = #{video.bizOrgCode} and wlv.biz_org_code LIKE CONCAT(#{video.bizOrgCode}, '%')
</if>
<if test="list != null and list.size() >0">
and wlv.biz_org_code IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if> </if>
group by wlv.id group by wlv.id
order by wlv.create_date desc order by wlv.create_date desc
......
...@@ -2435,5 +2435,55 @@ ...@@ -2435,5 +2435,55 @@
ALTER TABLE `cb_water_resource` add column `biz_org_name` varchar(104) DEFAULT NULL COMMENT '机构/部门名称'; ALTER TABLE `cb_water_resource` add column `biz_org_name` varchar(104) DEFAULT NULL COMMENT '机构/部门名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1640935104763-01">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_org_usr" columnName="pcz_code"/>
</not>
</preConditions>
<comment>cb_org_usr add column pcz_code 省市区code,用逗号分隔</comment>
<sql>
alter table `cb_org_usr` add column `pcz_code` varchar(255) DEFAULT NULL COMMENT '省市区code,用逗号分隔';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1640935104763-02">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_org_usr" columnName="pcz_name"/>
</not>
</preConditions>
<comment>cb_org_usr add column pcz_name '省市区名称,用逗号分隔'</comment>
<sql>
alter table `cb_org_usr` add column `pcz_name` varchar(255) DEFAULT NULL COMMENT '省市区名称,用逗号分隔';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1640935104763-03">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column"/>
</preConditions>
<comment>cb_dynamic_form_column add 电力字段</comment>
<sql>
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('7', 'businessCategory', '经营类别', 'select', '7', 'eq', b'0', b'0', '244', '{\"url\": \"\", \"data\": [], \"dict\": \"GLLB\", \"type\": \"dict\"}', NULL, NULL, '2021-07-07 10:58:11', b'0', NULL, '5', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('9', 'companyLocation', '单位地址', 'inputPoi', '7', 'like', b'0', b'0', '244', '{\"url\": \"/fire-fighting-system/mapsdk\", \"type\": \"url\"}', NULL, NULL, '2021-12-29 07:14:04', b'0', NULL, '2', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('10', 'companyPhone', '单位电话', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-07-07 02:59:34', b'0', NULL, '3', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('11', 'companyMaleEmployees', '男员工人数', 'inputNumber', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-07-12 03:06:11', b'0', NULL, '7', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('12', 'companyFemaleEmployees', '女员工人数', 'inputNumber', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-07-12 03:06:13', b'0', NULL, '8', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('13', 'companyPhoto', '单位照片', 'upload', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-07-07 02:59:31', b'0', NULL, '1', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('14', 'coordinate', '标注/标绘坐标数组', 'inputBitmap', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-08-19 09:13:14', b'1', NULL, '2', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('15', 'managementType', '管理类别', 'select', '7', 'eq', b'0', b'0', '244', '{\"url\": \"\", \"data\": [], \"dict\": \"GLLB\", \"type\": \"dict\"}', NULL, NULL, '2021-07-07 10:58:59', b'0', NULL, '1', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('16', 'companyNature', '单位性质', 'select', '7', 'eq', b'0', b'0', '244', '{\"url\": \"\", \"data\": [], \"dict\": \"DWXZ\", \"type\": \"dict\"}', NULL, NULL, '2021-07-07 10:58:44', b'0', NULL, '4', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812065', 'longitude', '经度', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-08-19 09:13:17', b'0', NULL, '9', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812066', 'latitude', '纬度', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-08-19 09:13:19', b'0', NULL, '10', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812089', 'useType', '用途类型', 'select', '7', 'eq', b'0', b'0', '244', '{\"url\": \"\", \"data\": [], \"dict\": \"USE_TYPE\", \"type\": \"dict\"}', NULL, NULL, '2021-12-14 17:34:56', b'0', NULL, '11', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812090', 'eleType', '站点类型', 'select', '7', 'eq', b'0', b'0', '244', '{\"url\": \"\", \"data\": [], \"dict\": \"ELE_TYPE\", \"type\": \"dict\"}', NULL, NULL, '2021-12-14 17:36:59', b'0', NULL, '12', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812092', 'orgChargePerson', '单位负责人', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:12', b'0', NULL, '13', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812093', 'orgChargePersonPhone', '单位负责人电话', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:14', b'0', NULL, '14', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812094', 'safetyChargePerson', '安全负责人', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:17', b'0', NULL, '15', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812095', 'safetyChargePersonPhone', '安全负责人电话', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:22', b'0', NULL, '16', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812096', 'safetyManager', '安全管理人', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:25', b'0', NULL, '17', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812097', 'safetyManagerPhone', '安全管理人电话', 'input', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 16:56:29', b'0', NULL, '18', NULL);
REPLACE INTO `cb_dynamic_form_column` (`sequence_nbr`, `field_code`, `field_name`, `field_type`, `group_id`, `query_strategy`, `not_null`, `block`, `group_code`, `column_config`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `remark`, `sort`, `org_code`) VALUES ('132828674812099', 'companyPlanePhonto', '单位总平面图', 'upload', '7', 'eq', b'0', b'0', '244', NULL, NULL, NULL, '2021-12-14 18:05:38', b'0', NULL, '20', NULL);
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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