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 {
* 分组类型
*/
private String groupType;
private String bizOrgCode;
}
......@@ -15,4 +15,6 @@ public class VideoDTO extends BaseDTO<Video> {
* 监控
*/
Video video;
String orgTypes;
}
......@@ -281,4 +281,12 @@ public class BuildingController extends AbstractBaseController {
public Map<String, String> getBuildingToLongitudeAndLatitude(@RequestParam String 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;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -100,6 +101,7 @@ import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.ISystemDicService;
import com.yeejoin.equipmanage.service.ProductionQRCode;
import com.yeejoin.equipmanage.service.impl.EquipmentSpecificSerivceImpl;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -118,90 +120,94 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CarController extends AbstractBaseController {
@Autowired
@Lazy
ICarService iCarService;
@Autowired
private EquipmentMapper equipmentMapper;
@Autowired
ISystemDicService iSystemDicService;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
ICarInfoService iCarInfoService;
@Autowired
ICarPropertyService iCarPropertyService;
@Autowired
CarInfoMapper carInfoMapper;
@Autowired
private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
private CarPropertyMapper carPropertyMapper;
@Autowired
IEquipmentOnCarService iEquipmentOnCarService;
@Autowired
ExtinguishantOnCarMapper extinguishantOnCarMapper;
@Autowired
SystemDicMapper systemDicMapper;
@Autowired
CarMapper carMapper;
@Autowired
private EquipmentIndexMapper equipmentIndexMapper;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
EquipmentQrcodeMapper equipmentQrcodeMapper;
@Resource(name = "productionQRCodeFactoryMap")
private Map<String, ProductionQRCode> messageHandMap;
@Autowired
EquipmentIotMqttReceiveConfig equipmentIotMqttReceiveConfig;
@Autowired
ICarLonAndLatDataService iCarLonAndLatDataService;
@Autowired
IEquipmentService iEquipmentService;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
IEquipmentQrcodeService iEquipmentQrcodeService;
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RestTemplate restTemplate;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-car}")
private String carAuthKey;
@Autowired
JcsFeign jcsFeign;
/**
* 新增消防车信息
*
* @return
*/
@RequestMapping(value = "/save", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增消防车信息", notes = "新增消防车信息")
public Car saveCar(HttpServletRequest request, @RequestBody Car car) {
@Autowired
@Lazy
ICarService iCarService;
@Autowired
private EquipmentMapper equipmentMapper;
@Autowired
ISystemDicService iSystemDicService;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
ICarInfoService iCarInfoService;
@Autowired
ICarPropertyService iCarPropertyService;
@Autowired
CarInfoMapper carInfoMapper;
@Autowired
private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
private CarPropertyMapper carPropertyMapper;
@Autowired
IEquipmentOnCarService iEquipmentOnCarService;
@Autowired
ExtinguishantOnCarMapper extinguishantOnCarMapper;
@Autowired
SystemDicMapper systemDicMapper;
@Autowired
CarMapper carMapper;
@Autowired
private EquipmentIndexMapper equipmentIndexMapper;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
EquipmentQrcodeMapper equipmentQrcodeMapper;
@Resource(name = "productionQRCodeFactoryMap")
private Map<String, ProductionQRCode> messageHandMap;
@Autowired
EquipmentIotMqttReceiveConfig equipmentIotMqttReceiveConfig;
@Autowired
ICarLonAndLatDataService iCarLonAndLatDataService;
@Autowired
IEquipmentService iEquipmentService;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
IEquipmentQrcodeService iEquipmentQrcodeService;
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RestTemplate restTemplate;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
@Value("${fileserver_domain}")
private String fileServer;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-car}")
private String carAuthKey;
@Autowired
JcsFeign jcsFeign;
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
/**
* 新增消防车信息
*
* @return
* @throws Exception
*/
@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();
// if (carRequest == null || carRequest.getCar() == null) {
// return new CommonResponse(FAILED, "参数有误");
......@@ -211,73 +217,85 @@ public class CarController extends AbstractBaseController {
// Set<CarProperty> carpList = carRequest.getCarPropertyList();
// Car carInstance = iCarService.saveCar(user, car, carInfo, carpList);
// saveFile(carInstance); 图片视频后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
car.setQrCode(QRCodeUtil.generateQRCode());
List<CarProperty> carPropertyList = car.getCarPropertyList();
if (carPropertyList.size() > 0) {
carPropertyList.forEach(x -> {
QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", x.getEquipmentIndexId());
EquipmentIndex equipmentIndex = iEquipmentIndexService.getOne(queryWrapper);
String state = equipmentIndex.getPerfQuotaDefinitionId();
if ("state".equals(state)) {
if ("是".equals(x.getValue())) {
x.setValue(TrueOrFalseEnum.real.value);
} else {
x.setValue(TrueOrFalseEnum.fake.value);
}
}
});
}
iCarService.refreshStaData();
return iCarService.saveOne(car);
}
/**
* 根据iotCode查询
*
* @param iotCode
* @return
*/
@RequestMapping(value = "/checkIotCode/{iotCode}/{id}", method = RequestMethod.GET)
@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位字符!");
Map map2 = new HashMap();
map2.put("state", "DUPLICATE");
map2.put("message", "物联编码重复,请重新设置!");
Map map3 = new HashMap();
map3.put("state", "SUCCESS");
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()) {
iotCodeList = list.stream().filter(x -> x.equals(iotCode)).collect(Collectors.toList());
}
if (iotCodeList.size() == 0) {
return CommonResponseUtil.success(map3);
} else {
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) {
// saveFile(carInstance); 图片视频后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
car.setQrCode(QRCodeUtil.generateQRCode());
List<CarProperty> carPropertyList = car.getCarPropertyList();
if (carPropertyList.size() > 0) {
carPropertyList.forEach(x -> {
QueryWrapper<EquipmentIndex> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", x.getEquipmentIndexId());
EquipmentIndex equipmentIndex = iEquipmentIndexService.getOne(queryWrapper);
String state = equipmentIndex.getPerfQuotaDefinitionId();
if ("state".equals(state)) {
if ("是".equals(x.getValue())) {
x.setValue(TrueOrFalseEnum.real.value);
} else {
x.setValue(TrueOrFalseEnum.fake.value);
}
}
});
}
refreshCount(car.getBizOrgCode());
return iCarService.saveOne(car);
}
@Async
public void refreshCount(String bizOrgCode) {
iCarService.refreshStaData();
try {
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
} catch (Exception e) {
}
}
/**
* 根据iotCode查询
*
* @param iotCode
* @return
*/
@RequestMapping(value = "/checkIotCode/{iotCode}/{id}", method = RequestMethod.GET)
@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位字符!");
Map map2 = new HashMap();
map2.put("state", "DUPLICATE");
map2.put("message", "物联编码重复,请重新设置!");
Map map3 = new HashMap();
map3.put("state", "SUCCESS");
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()) {
iotCodeList = list.stream().filter(x -> x.equals(iotCode)).collect(Collectors.toList());
}
if (iotCodeList.size() == 0) {
return CommonResponseUtil.success(map3);
} else {
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());
// if (null == car) {
// return new CommonResponse(FAILED, "未查询到该车辆!");
......@@ -290,870 +308,867 @@ public class CarController extends AbstractBaseController {
// carInstance.setImPassword(car.getImPassword());
// Set<CarProperty> carpList = carRequest.getCarPropertyList();
// carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList);
// saveFile(carInstance);视频图片文件后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
iCarService.refreshStaData();
return iCarService.updateOneById(car);
}
/**
* 根据id删除
*
* @param
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public CommonResponse deleteById(@ApiParam(value = "车辆管理id", required = true) @RequestParam("ids") String... ids) {
List<String> idStrings = Arrays.asList(ids);
QueryWrapper<EquipmentOnCar> queryWrapper = new QueryWrapper<EquipmentOnCar>();
queryWrapper.lambda().in(EquipmentOnCar::getCarId, idStrings);
List<EquipmentOnCar> result = iEquipmentOnCarService.list(queryWrapper);
if (!result.isEmpty()) {
return new CommonResponse(FAILED, "无法删除已有车载装备的数据!");
} else {
boolean b = iCarService.removeByIds(idStrings);
// AST数据同步
if (b && syncSwitch) {
List<Long> carIds = idStrings.stream().map(id -> Long.parseLong(id.trim())).collect(Collectors.toList());
syncDataService.syncDeletedFireVehicle(carIds);
iCarService.dataSyncDeletedIds(carIds);
}
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
boolean flag = false;
for (String id : idStrings) {
String iotCode = iCarService.getById(id).getIotCode();
if (StringUtil.isNotEmpty(iotCode)) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) {
if (topic.equals(oldTopic)) {
flag = true;
break;
}
}
if (flag) {
try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
iCarService.refreshStaData();
return new CommonResponse(SUCCESS);
}
}
/**
* 根据id查询
*
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car selectById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.selectOneById(id);
}
/**
* 根据id查询车辆详情信息
*
* @param id
* @return
*/
@RequestMapping(value = "/getCarDetailById/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car getCarDetailById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.getCarDetailById(id);
}
/**
// saveFile(carInstance);视频图片文件后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
refreshCount(car.getBizOrgCode());
return iCarService.updateOneById(car);
}
/**
* 根据id删除
*
* @param
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public CommonResponse deleteById(@ApiParam(value = "车辆管理id", required = true) @RequestParam("ids") String... ids) {
List<String> idStrings = Arrays.asList(ids);
QueryWrapper<EquipmentOnCar> queryWrapper = new QueryWrapper<EquipmentOnCar>();
queryWrapper.lambda().in(EquipmentOnCar::getCarId, idStrings);
List<EquipmentOnCar> result = iEquipmentOnCarService.list(queryWrapper);
if (!result.isEmpty()) {
return new CommonResponse(FAILED, "无法删除已有车载装备的数据!");
} else {
boolean b = iCarService.removeByIds(idStrings);
// AST数据同步
if (b && syncSwitch) {
List<Long> carIds = idStrings.stream().map(id -> Long.parseLong(id.trim()))
.collect(Collectors.toList());
syncDataService.syncDeletedFireVehicle(carIds);
iCarService.dataSyncDeletedIds(carIds);
}
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
boolean flag = false;
for (String id : idStrings) {
String iotCode = iCarService.getById(id).getIotCode();
if (StringUtil.isNotEmpty(iotCode)) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) {
if (topic.equals(oldTopic)) {
flag = true;
break;
}
}
if (flag) {
try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return new CommonResponse(SUCCESS);
}
}
/**
* 根据id查询
*
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car selectById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.selectOneById(id);
}
/**
* 根据id查询车辆详情信息
*
* @param id
* @return
*/
@RequestMapping(value = "/getCarDetailById/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car getCarDetailById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.getCarDetailById(id);
}
/**
* 根据车辆id查询车辆详情信息,供iot_tree展示
*
* @param carNum
* @return
*/
@RequestMapping(value = "/threeDimensional/getCarDetailById/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车辆id查询", notes = "根据车辆id查询")
public CarForUE4VO getCarDetailByCarNumToThreeDimensional (HttpServletRequest request, @PathVariable Long id) {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车辆id查询", notes = "根据车辆id查询")
public CarForUE4VO getCarDetailByCarNumToThreeDimensional(HttpServletRequest request, @PathVariable Long id) {
String orgCode = getOrgCode();
return iCarService.getCarDetailByCarNumToThreeDimensional(id, orgCode);
}
/**
* 根据车牌号查询车辆详情信息
*
* @param carNum
* @return
*/
@RequestMapping(value = "/getCarDetailByCarNum/{carNum}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车牌号查询", notes = "根据车牌号查询")
public Car getCarDetailByCarNum(HttpServletRequest request, @PathVariable String carNum) {
String orgCode = getOrgCode();
return iCarService.getCarDetailByCarNum(carNum, orgCode);
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<Car> listPage(String pageNum, String pageSize, Car car) {
Page<Car> pageBean;
QueryWrapper<Car> carQueryWrapper = new QueryWrapper<>();
Class<? extends Car> aClass = car.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(car);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(car);
carQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<Car> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iCarService.page(pageBean, car);
return page;
}
/**
* http://172.16.11.15:8080/carmanager/create
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "创建车辆初始化(<font color='blue'>release</font>)", notes = "创建车辆初始化")
@GetMapping(value = "/init", produces = "application/json;charset=UTF-8")
public CommonResponse createInit() {
List<SystemDic> carStatusList = iSystemDicService.findAllByType(SystemDicTypeEum.carState.getType());
List<SystemDic> dropDownPerformance = iSystemDicService.findAllByType(SystemDicTypeEum.perfQuotaType.getType());
Map<String, Object> result = new HashMap<>();
result.put("performances", dropDownPerformance);
result.put("carStatus", carStatusList);
return new CommonResponse(SUCCESS, result);
}
/**
* <pre>
* 获取车辆国别数据
* </pre>
*
* @return CommonResponse
* @throws @version: 1.0
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆国别数据(<font color='blue'>release</font>)", notes = "获取车辆国别数据")
@RequestMapping(value = "/countrys", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse getCountrys() {
List<SystemDic> countryList = iSystemDicService.findAllByType(SystemDicTypeEum.country.getType());
return new CommonResponse(SUCCESS, countryList);
}
/**
* <pre>
* 车辆分类列表
* </pre>
*
* @return CommonResponse
* @throws @version: 1.0
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆分类列表(<font color='blue'>release</font>)", notes = "按装备分类,获取该分类下级树")
@RequestMapping(value = "/query/carCategory", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse queryCarCategory() {
List<EquipmentCategory> results = iCarService.getCarCategory();
List<EquipmentCategory> list = new ArrayList<>();
for (EquipmentCategory instance : results) {
if (instance.getParentId() == null || instance.getLevel().equals("1")) {
list.add(instance);
} else {
getChildren(list, instance.getParentId().toString()).add(instance);
}
}
return new CommonResponse(SUCCESS, list);
}
/**
* 根据装备分类list,递归找到对应的分类子集。
*
* @param list
* @param id
* @return
*/
private List<EquipmentCategory> getChildren(List<EquipmentCategory> list, String id) {
List<EquipmentCategory> temp = null;
for (EquipmentCategory instance : list) {
if (instance.getId() != null && !instance.getId().toString().equals(id)) {
temp = getChildren(instance.getChildren(), id);
if (null != temp) {
break;
}
} else {
instance.setHasLowerClassification(true);
temp = instance.getChildren();
break;
}
}
return temp;
}
/**
* 获取损耗车辆列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装备药剂的车辆列表-APP", notes = "装备药剂的车辆列表")
@RequestMapping(value = "/queryExtinguishantOnCarlist", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> queryExtinguishantOnCarlist() {
try {
ArrayList<String> strings = new ArrayList<>();
strings.add(CarStatusEnum.WX.getCode());
strings.add(CarStatusEnum.TY.getCode());
strings.add(CarStatusEnum.BF.getCode());
List<Map<String, Object>> list = extinguishantOnCarMapper.queryExtinguishantOnCarlist(strings);
return list;
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
/**
* 获取车辆车载
*
* @param carId
* @param pageNum
* @param pageSize
* @param code
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆装载灭火药剂(<font color='blue'>release</font>)", notes = "获取车辆装载")
@RequestMapping(value = "/car/extinguishants", method = RequestMethod.GET)
public Page getCarExtinguishants(Long carId, String pageNum, String pageSize, String code) {
try {
if (code != null && !"".equals(code)) {
code = code.substring(0, 2);
}
Page pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
List<Map<String, Object>> list = extinguishantOnCarMapper.getCarExtinguishants(null, carId,
pageBean.offset(), pageBean.getSize(), code);
int count = extinguishantOnCarMapper.getCarExtinguishantscount(null, carId, code);
if (list != null && list.size() > 0) {
for (Map<String, Object> map : list) {
String img = (String) map.get("img");
if (img != null && !"".equals(img)) {
map.put("img", fileServer + img);
}
}
}
pageBean.setTotal(count);
pageBean.setRecords(list);
return pageBean;
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
// 车辆灭火药剂损耗
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "损耗车载灭火剂(<font color='blue'>release</font>)", notes = "损耗车载灭火剂")
@RequestMapping(value = "/{carId}/loss-extinguishants", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, String> lossCarExtinguishants(
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") String carId,
@ApiParam(value = "灭火剂损耗请求条件", required = false) @RequestBody(required = false) List<ExtinguishantLossRequest> requests) {
try {
iCarService.refreshStaData();
return iCarService.lossExtinguishants(Long.valueOf(carId), requests);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("车载灭火药剂损耗失败,请联系管理员!");
}
}
/**
* 根据车辆id,查询车辆信息
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车辆id,查询车辆信息(<font color='blue'>release</font>)", notes = "根据车辆id,查询车辆信息")
@RequestMapping(value = "/cars/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CarInfosResponse show(@ApiParam(value = "车辆管理id", required = true) @PathVariable Long id) {
try {
Car car = iCarService.getById(id);
if (null == car) {
throw new RuntimeException("该车辆不存在!");
}
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("car_id", car.getId());
List<CarProperty> carPropertyList = carPropertyMapper.selectByMap(columnMap);
return this.createCarInfosResponse(car, carPropertyList);
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
public CarInfosResponse createCarInfosResponse(Car car, List<CarProperty> carPropertyList) {
CarInfosResponse response = new CarInfosResponse();
// 根据车辆获取装备信息
Equipment equipment = equipmentMapper.selectById(car.getEquipmentId());
// 分类
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectById(equipment.getCategoryId());
// 生产商
ManufacturerInfo manufacturerInfo = manufacturerInfoMapper.selectById(car.getManufacturerId());
ParsePropertyUtil.setting(response::setManufacturerInfo, () -> manufacturerInfo);
// 等级
// 国别
SystemDic systemDic1 = systemDicMapper.selectById(car.getCountry());
// 车牌类型
// 车辆状态
SystemDic systemDic3 = systemDicMapper.selectById(car.getCarState());
ParsePropertyUtil.setting(response::setCarPropertyList, () -> createCarPropertyList(carPropertyList));
ParsePropertyUtil.setting(response::setId, () -> car.getId().toString());
ParsePropertyUtil.setting(response::setCarNum, car::getCarNum);
ParsePropertyUtil.setting(response::setCarState, () -> systemDic3.getName());
ParsePropertyUtil.setting(response::setEquipType, () -> equipmentCategory.getCode());
ParsePropertyUtil.setting(response::setEquipTypeName, () -> equipmentCategory.getName());
ParsePropertyUtil.setting(response::setEquipName, () -> equipment.getName());
ParsePropertyUtil.setting(response::setEquipCode, () -> equipment.getCode());
ParsePropertyUtil.setting(response::setEquipmentId, () -> car.getEquipmentId());
// ParsePropertyUtil.setting(response::setStandard, car::getStandard);
ParsePropertyUtil.setting(response::setOrgCode, car::getOrgCode);
ParsePropertyUtil.setting(response::setManufacturer, () -> manufacturerInfo.getName());
ParsePropertyUtil.setting(response::setManufacturerId, () -> manufacturerInfo.getId());
ParsePropertyUtil.setting(response::setRemark, car::getRemark);
ParsePropertyUtil.setting(response::setCompanyName, () -> car.getCompanyName());
ParsePropertyUtil.setting(response::setCountry, () -> systemDic1.getName());
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::setFilm, () -> car.getVideo().get(0).getUrl());
ParsePropertyUtil.setting(response::setDefaultImg, () -> equipment.getImg());
// ParsePropertyUtil.setting(response::setChassisType, car::getChassisType);
// ParsePropertyUtil.setting(response::setChassisCountry,
// car::getChassisCountry);
return response;
}
private List<CarProperty> createCarPropertyList(List<CarProperty> carPropertyList) {
List<CarProperty> carProList = new ArrayList<CarProperty>();
if (!carPropertyList.isEmpty()) {
carPropertyList.forEach(action -> {
/**
* 根据车牌号查询车辆详情信息
*
* @param carNum
* @return
*/
@RequestMapping(value = "/getCarDetailByCarNum/{carNum}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车牌号查询", notes = "根据车牌号查询")
public Car getCarDetailByCarNum(HttpServletRequest request, @PathVariable String carNum) {
String orgCode = getOrgCode();
return iCarService.getCarDetailByCarNum(carNum, orgCode);
}
/**
* 列表分页查询
*
* @return
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public IPage<Car> listPage(String pageNum, String pageSize, Car car) {
Page<Car> pageBean;
QueryWrapper<Car> carQueryWrapper = new QueryWrapper<>();
Class<? extends Car> aClass = car.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(car);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(car);
carQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(car);
carQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
IPage<Car> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iCarService.page(pageBean, car);
return page;
}
/**
* http://172.16.11.15:8080/carmanager/create
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "创建车辆初始化(<font color='blue'>release</font>)", notes = "创建车辆初始化")
@GetMapping(value = "/init", produces = "application/json;charset=UTF-8")
public CommonResponse createInit() {
List<SystemDic> carStatusList = iSystemDicService.findAllByType(SystemDicTypeEum.carState.getType());
List<SystemDic> dropDownPerformance = iSystemDicService.findAllByType(SystemDicTypeEum.perfQuotaType.getType());
Map<String, Object> result = new HashMap<>();
result.put("performances", dropDownPerformance);
result.put("carStatus", carStatusList);
return new CommonResponse(SUCCESS, result);
}
/**
* <pre>
* 获取车辆国别数据
* </pre>
*
* @return CommonResponse
* @throws @version: 1.0
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆国别数据(<font color='blue'>release</font>)", notes = "获取车辆国别数据")
@RequestMapping(value = "/countrys", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse getCountrys() {
List<SystemDic> countryList = iSystemDicService.findAllByType(SystemDicTypeEum.country.getType());
return new CommonResponse(SUCCESS, countryList);
}
/**
* <pre>
* 车辆分类列表
* </pre>
*
* @return CommonResponse
* @throws @version: 1.0
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆分类列表(<font color='blue'>release</font>)", notes = "按装备分类,获取该分类下级树")
@RequestMapping(value = "/query/carCategory", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse queryCarCategory() {
List<EquipmentCategory> results = iCarService.getCarCategory();
List<EquipmentCategory> list = new ArrayList<>();
for (EquipmentCategory instance : results) {
if (instance.getParentId() == null || instance.getLevel().equals("1")) {
list.add(instance);
} else {
getChildren(list, instance.getParentId().toString()).add(instance);
}
}
return new CommonResponse(SUCCESS, list);
}
/**
* 根据装备分类list,递归找到对应的分类子集。
*
* @param list
* @param id
* @return
*/
private List<EquipmentCategory> getChildren(List<EquipmentCategory> list, String id) {
List<EquipmentCategory> temp = null;
for (EquipmentCategory instance : list) {
if (instance.getId() != null && !instance.getId().toString().equals(id)) {
temp = getChildren(instance.getChildren(), id);
if (null != temp) {
break;
}
} else {
instance.setHasLowerClassification(true);
temp = instance.getChildren();
break;
}
}
return temp;
}
/**
* 获取损耗车辆列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装备药剂的车辆列表-APP", notes = "装备药剂的车辆列表")
@RequestMapping(value = "/queryExtinguishantOnCarlist", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> queryExtinguishantOnCarlist() {
try {
ArrayList<String> strings = new ArrayList<>();
strings.add(CarStatusEnum.WX.getCode());
strings.add(CarStatusEnum.TY.getCode());
strings.add(CarStatusEnum.BF.getCode());
List<Map<String, Object>> list = extinguishantOnCarMapper.queryExtinguishantOnCarlist(strings);
return list;
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
/**
* 获取车辆车载
*
* @param carId
* @param pageNum
* @param pageSize
* @param code
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆装载灭火药剂(<font color='blue'>release</font>)", notes = "获取车辆装载")
@RequestMapping(value = "/car/extinguishants", method = RequestMethod.GET)
public Page getCarExtinguishants(Long carId, String pageNum, String pageSize, String code) {
try {
if (code != null && !"".equals(code)) {
code = code.substring(0, 2);
}
Page pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
List<Map<String, Object>> list = extinguishantOnCarMapper.getCarExtinguishants(null, carId,
pageBean.offset(), pageBean.getSize(), code);
int count = extinguishantOnCarMapper.getCarExtinguishantscount(null, carId, code);
if (list != null && list.size() > 0) {
for (Map<String, Object> map : list) {
String img = (String) map.get("img");
if (img != null && !"".equals(img)) {
map.put("img", fileServer + img);
}
}
}
pageBean.setTotal(count);
pageBean.setRecords(list);
return pageBean;
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
// 车辆灭火药剂损耗
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "损耗车载灭火剂(<font color='blue'>release</font>)", notes = "损耗车载灭火剂")
@RequestMapping(value = "/{carId}/loss-extinguishants", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, String> lossCarExtinguishants(
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") String carId,
@ApiParam(value = "灭火剂损耗请求条件", required = false) @RequestBody(required = false) List<ExtinguishantLossRequest> requests) {
try {
return iCarService.lossExtinguishants(Long.valueOf(carId), requests);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("车载灭火药剂损耗失败,请联系管理员!");
}
}
/**
* 根据车辆id,查询车辆信息
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据车辆id,查询车辆信息(<font color='blue'>release</font>)", notes = "根据车辆id,查询车辆信息")
@RequestMapping(value = "/cars/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CarInfosResponse show(@ApiParam(value = "车辆管理id", required = true) @PathVariable Long id) {
try {
Car car = iCarService.getById(id);
if (null == car) {
throw new RuntimeException("该车辆不存在!");
}
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("car_id", car.getId());
List<CarProperty> carPropertyList = carPropertyMapper.selectByMap(columnMap);
return this.createCarInfosResponse(car, carPropertyList);
} catch (Exception e) {
throw new RuntimeException("查询异常!");
}
}
public CarInfosResponse createCarInfosResponse(Car car, List<CarProperty> carPropertyList) {
CarInfosResponse response = new CarInfosResponse();
// 根据车辆获取装备信息
Equipment equipment = equipmentMapper.selectById(car.getEquipmentId());
// 分类
EquipmentCategory equipmentCategory = equipmentCategoryMapper.selectById(equipment.getCategoryId());
// 生产商
ManufacturerInfo manufacturerInfo = manufacturerInfoMapper.selectById(car.getManufacturerId());
ParsePropertyUtil.setting(response::setManufacturerInfo, () -> manufacturerInfo);
// 等级
// 国别
SystemDic systemDic1 = systemDicMapper.selectById(car.getCountry());
// 车牌类型
// 车辆状态
SystemDic systemDic3 = systemDicMapper.selectById(car.getCarState());
ParsePropertyUtil.setting(response::setCarPropertyList, () -> createCarPropertyList(carPropertyList));
ParsePropertyUtil.setting(response::setId, () -> car.getId().toString());
ParsePropertyUtil.setting(response::setCarNum, car::getCarNum);
ParsePropertyUtil.setting(response::setCarState, () -> systemDic3.getName());
ParsePropertyUtil.setting(response::setEquipType, () -> equipmentCategory.getCode());
ParsePropertyUtil.setting(response::setEquipTypeName, () -> equipmentCategory.getName());
ParsePropertyUtil.setting(response::setEquipName, () -> equipment.getName());
ParsePropertyUtil.setting(response::setEquipCode, () -> equipment.getCode());
ParsePropertyUtil.setting(response::setEquipmentId, () -> car.getEquipmentId());
// ParsePropertyUtil.setting(response::setStandard, car::getStandard);
ParsePropertyUtil.setting(response::setOrgCode, car::getOrgCode);
ParsePropertyUtil.setting(response::setManufacturer, () -> manufacturerInfo.getName());
ParsePropertyUtil.setting(response::setManufacturerId, () -> manufacturerInfo.getId());
ParsePropertyUtil.setting(response::setRemark, car::getRemark);
ParsePropertyUtil.setting(response::setCompanyName, () -> car.getCompanyName());
ParsePropertyUtil.setting(response::setCountry, () -> systemDic1.getName());
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::setFilm, () -> car.getVideo().get(0).getUrl());
ParsePropertyUtil.setting(response::setDefaultImg, () -> equipment.getImg());
// ParsePropertyUtil.setting(response::setChassisType, car::getChassisType);
// ParsePropertyUtil.setting(response::setChassisCountry,
// car::getChassisCountry);
return response;
}
private List<CarProperty> createCarPropertyList(List<CarProperty> carPropertyList) {
List<CarProperty> carProList = new ArrayList<CarProperty>();
if (!carPropertyList.isEmpty()) {
carPropertyList.forEach(action -> {
// PerfQuotaDefinition perfQuotaDefinition = perfQuotaDefinitionMapper
// .selectById(action.getPerfQuotaDefinitionId());
CarProperty carProperty = new CarProperty();
carProperty.setId(action.getId());
carProperty.setCarId(action.getCarId());
CarProperty carProperty = new CarProperty();
carProperty.setId(action.getId());
carProperty.setCarId(action.getCarId());
// carProperty.setPerfQuotaDefinitionId(action.getPerfQuotaDefinitionId());
// carProperty.setPerfQuotaDefinitionName(perfQuotaDefinition.getName());
carProperty.setRemark(action.getRemark());
carProperty.setValue(action.getValue());
EquipmentIndex equipmentIndex = equipmentIndexMapper.selectById(action.getEquipmentIndexId());
if (equipmentIndex.getUnitName() != null) {
carProperty.setUnitName(equipmentIndex.getUnitName());
}
carProList.add(carProperty);
});
}
return carProList;
}
/*
* 向车辆上装载灭火药剂
*
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "向车辆上装载灭火药剂(<font color='blue'>release</font>)", notes = "向车辆上装载灭火药剂")
@RequestMapping(value = "/{carId}/loading-extinguishant", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, String> loadingExtinguishant(
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") Long carId,
@ApiParam(value = "灭火药剂明细账列表", required = true) @RequestBody List<ExtinguishantRequeset> extinguishants) {
try {
return iCarService.loadingExtinguishants(carId, extinguishants);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 装卸载装备
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/loading-equipments", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, Object> loadingEquipment(
@ApiParam(value = "提交的装备", required = true) @RequestBody(required = true) OnBoardEquipment params) {
try {
if (OnBoardEquipmentEnum.LOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.loadingEquipment(params, getUserInfo());
} else if (OnBoardEquipmentEnum.UNLOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.unloadEquipment(params, getUserInfo());
} else {
throw new RuntimeException("参数传入失败!无法进行装备装卸车!");
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("person", getUserInfo().getRealName());
map.put("time", DateUtils.getNowStrLong());
return map;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
// 获取九大类
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/getEquipmentType", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<EquipmentCategory> getEquipmentType() {
try {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.isNull("parent_id");
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
return list;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
// 获取九大类二级统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentTypeCount/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentTypeCount(@PathVariable(value = "id") Long id,
String warehouseStructureId, String standard, String StateName, String brand) {
try {
QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", id);
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
String type = list.get(0).getCode().substring(0, 1);
// 获取二级code前两位
List<String> listd = new ArrayList<>();
List<Map<String, Object>> listr = new ArrayList<>();
for (EquipmentCategory equipmentCategory : list) {
listd.add(equipmentCategory.getCode().substring(0, 2));
Map<String, Object> map = new HashMap<>();
map.put("name", equipmentCategory.getName());
map.put("ercode", equipmentCategory.getCode().substring(0, 2));
map.put("amount", 0);
if ("21".equals(equipmentCategory.getCode().substring(0, 2))) {
map.put("type", "car");
} else {
map.put("type", "equipment");
}
listr.add(map);
}
Map<String, Object> mape = new HashMap<>();
mape.put("ids", listd);
mape.put("id", id);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
// 根据二级分类查询统计
List<Map<String, Object>> listdate = equipmentCategoryMapper.getEquipCategoryListcount(mape);
mape.clear();
for (Map<String, Object> map : listr) {
mape.putAll(map);
for (Map<String, Object> map1 : listdate) {
if (map.get("ercode").toString().equals(map1.get("ercode").toString())) {
if (type.equals("4")) {
map.put("amount", map1.get("amount"));
} else {
double dou = Double.parseDouble(map1.get("amount").toString());
int i = new Double(dou).intValue();
map.put("amount", i);
}
map.put("type", map1.get("type"));
}
}
}
return listr;
} catch (Exception e) {
System.err.println(e.getMessage());
throw new RuntimeException("系统异常!");
}
}
// 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentCount/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentCount(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand) {
try {
List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
listdate = equipmentCategoryMapper.getEquipmentCount(mape);
for (Map<String, Object> map : listdate) {
map.put("img", fileServer + map.get("img"));
Object amount = map.get("amount");
String unit = map.get("unit").toString();
if (ercode.substring(0, 1).equals("4")) {
map.put("amount", map.get("amount").toString() + " " + map.get("unit").toString());
} else {
double dou = Double.parseDouble(map.get("amount").toString());
int i = new Double(dou).intValue();
map.put("amount", i + " " + map.get("unit").toString());
}
}
return listdate;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
// 九大类详情列表
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "详情列表")
@RequestMapping(value = "/getEquipmentlist/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentlist(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand, String name) {
try {
List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
mape.put("name", name);
listdate = equipmentCategoryMapper.getDetailed(mape);
for (Map<String, Object> map : listdate) {
String utname = map.get("utname").toString();
String eqCode = map.get("ercode").toString();
String amount = map.get("amount").toString();
if (StringUtil.isNotEmpty(eqCode) && !eqCode.startsWith("4")) {
amount = amount.split("\\.")[0] + utname;
} else {
amount = amount + utname;
}
map.put("amount", amount);
map.put("img", fileServer + map.get("img"));
}
return listdate;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
// 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@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,
String pageSize) {
Page<Car> 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 iCarService.getCarList(ercode, orgcode, car, pageBean);
}
/**
* 车辆装备品牌 下拉框
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备品牌 下拉框")
@RequestMapping(value = "/getbrandlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getbrandlist(@PathVariable(value = "type") String type, String name) {
List<String> result = new ArrayList<String>();
if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name);
}
List<Car> list = carMapper.selectList(queryWrapper.groupBy("brand"));
for (Car car : list) {
result.add(car.getBrand());
}
return result;
} else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name);
}
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("brand"));
for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getBrand());
}
return result;
}
}
/**
* 车辆装备状态
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备状态")
@RequestMapping(value = "/getStatuslist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<SystemDic> getStatuslist(@PathVariable(value = "type") String type) {
try {
Map<String, Object> columnMap = new HashMap<String, Object>();
if ("car".equals(type)) {
columnMap.put("type", SystemDicTypeEum.carState.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd;
} else {
columnMap.put("type", SystemDicTypeEum.equipStatus.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd;
}
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 规格型号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "规格型号")
@RequestMapping(value = "/getstandardlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getstandardlist(@PathVariable(value = "type") String type, String name) {
try {
List<String> result = new ArrayList<String>();
if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("model", "");
queryWrapper.isNotNull("model");
if (name != null && !"".equals(name)) {
queryWrapper.like("model", name);
}
List<Car> list = carMapper.selectList(queryWrapper.groupBy("model"));
for (Car car : list) {
result.add(car.getStandard());
}
return result;
} else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("standard", "");
queryWrapper.isNotNull("standard");
if (name != null && !"".equals(name)) {
queryWrapper.like("standard", name);
}
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("standard"));
for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getStandard());
}
return result;
}
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* <pre>
* 打印车辆二维码
* </pre>
*
* @param id 车辆ID
* @param amount 打印数量
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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")
public List<EquipmentQrcode> printQRCode(@PathVariable("id") Long id, @PathVariable("amount") Integer amount,
@PathVariable("type") String type, @DateTimeFormat(pattern = "yyyy-MM-dd") Date productDate) {
try {
ProductionQRCode productionQRCode = messageHandMap.get(type);
List<EquipmentQrcode> list = productionQRCode.getProductionQRCode(id, amount, productDate);
return list;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 批量删除
*
* @param idList
* @return
* @throws Exception
*/
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean delete(HttpServletRequest request, @RequestBody List<Long> idList) throws Exception {
List<Car> cars = iCarService.list(new QueryWrapper<Car>().in("id", idList));
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
cars.forEach(car -> {
List<EquipmentOnCarAppVO> equipmentOnCarAppVOS = carMapper.selectEquipmentOnCarAppList(car.getId());
if (equipmentOnCarAppVOS.size() > 0) {
throw new BadRequest("有车载装备的车辆不能删除,请先卸载装备!");
}
boolean flag = false;
String iotCode = car.getIotCode();
if (StringUtil.isNotEmpty(car.getIotCode()) && iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) {
if (topic.equals(oldTopic)) {
flag = true;
break;
}
}
if (flag) {
try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
return iCarService.removeOneByIds(idList);
}
/**
* 获取车辆物联信息
*
* @return
*/
@RequestMapping(value = "/getCarsIotInfo", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆物联信息", notes = "获取车辆物联信息")
public Map<Long, List<CarIndexVo>> getCarsIotInfo() {
Map<Long, List<CarIndexVo>> map = null;
String orgCode = getOrgCode();
List<CarIndexVo> carVoList = iCarService.getCarsIotInfo(orgCode);
if (!carVoList.isEmpty()) {
map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getId()));
}
return map;
}
/**
* 根据车辆ID,获取车载装备及状态
*
* @param id
* @return
*/
@RequestMapping(value = "/getCarEquipmentsById/{id}/state", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆车载装备状态", notes = "获取车辆车载装备状态")
public List<EquipStateOnCarVo> getCarEquipmentsById(@PathVariable(value = "id") Long id) {
return iCarService.getCarEquipmentsById(id);
}
/**
* <pre>
* 车辆历史轨迹数据
* </pre>
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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")
public ResponseModel getCarHistoryTrackAndTrendById(@PathVariable("iotCode") String iotCode, @PathVariable("timeStart") String timeStart,
@PathVariable("timeEnd") String timeEnd) {
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("车辆物联编码错误,请确认!");
}
LonAndLatEntityVo lonAndLatEntityVo = new LonAndLatEntityVo();
String url = iotServerName;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", getProduct());
headers.set("token", getToken());
headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(lonAndLatEntityVo, headers);
ResponseEntity<FeignClientResult> feignClientResult = null;
try {
feignClientResult = restTemplate.exchange("http://" + url
+ "/iot/v1/livedata/list?timeStart=" + timeStart + "&timeEnd=" + timeEnd + "&productKey=" + prefix + "&deviceName=" + suffix,
HttpMethod.GET, httpEntity, FeignClientResult.class);
} catch (Exception e) {
e.printStackTrace();
}
if (null != feignClientResult && feignClientResult.getBody().getStatus() == 200) {
return CommonResponseUtil.success(feignClientResult.getBody().getResult());
}
else {
log.error("注:iotCode为 (" + iotCode + ") 的车辆不存在于物联系统或物联系统车辆历史轨迹接口出错!");
return CommonResponseUtil.success();
}
}
carProperty.setRemark(action.getRemark());
carProperty.setValue(action.getValue());
EquipmentIndex equipmentIndex = equipmentIndexMapper.selectById(action.getEquipmentIndexId());
if (equipmentIndex.getUnitName() != null) {
carProperty.setUnitName(equipmentIndex.getUnitName());
}
carProList.add(carProperty);
});
}
return carProList;
}
/*
* 向车辆上装载灭火药剂
*
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "向车辆上装载灭火药剂(<font color='blue'>release</font>)", notes = "向车辆上装载灭火药剂")
@RequestMapping(value = "/{carId}/loading-extinguishant", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, String> loadingExtinguishant(
@ApiParam(value = "车辆Id", required = true) @PathVariable(value = "carId") Long carId,
@ApiParam(value = "灭火药剂明细账列表", required = true) @RequestBody List<ExtinguishantRequeset> extinguishants) {
try {
return iCarService.loadingExtinguishants(carId, extinguishants);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
/**
* 装卸载装备
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/loading-equipments", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public Map<String, Object> loadingEquipment(
@ApiParam(value = "提交的装备", required = true) @RequestBody(required = true) OnBoardEquipment params) {
try {
if (OnBoardEquipmentEnum.LOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.loadingEquipment(params, getUserInfo());
} else if (OnBoardEquipmentEnum.UNLOAD == OnBoardEquipmentEnum.getEnum(params.getType())) {
iCarService.unloadEquipment(params, getUserInfo());
} else {
throw new RuntimeException("参数传入失败!无法进行装备装卸车!");
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("person", getUserInfo().getRealName());
map.put("time", DateUtils.getNowStrLong());
return map;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
// 获取九大类
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装卸载装备(<font color='blue'>release</font>)", notes = "装载装备")
@RequestMapping(value = "/getEquipmentType", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<EquipmentCategory> getEquipmentType() {
try {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.isNull("parent_id");
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
return list;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
// 获取九大类二级统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentTypeCount/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentTypeCount(@PathVariable(value = "id") Long id,
String warehouseStructureId, String standard, String StateName, String brand) {
try {
QueryWrapper<EquipmentCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", id);
queryWrapper.eq("industry_code", IndustryEnum.EQUIP.getCode());
List<EquipmentCategory> list = equipmentCategoryMapper.selectList(queryWrapper);
String type = list.get(0).getCode().substring(0, 1);
// 获取二级code前两位
List<String> listd = new ArrayList<>();
List<Map<String, Object>> listr = new ArrayList<>();
for (EquipmentCategory equipmentCategory : list) {
listd.add(equipmentCategory.getCode().substring(0, 2));
Map<String, Object> map = new HashMap<>();
map.put("name", equipmentCategory.getName());
map.put("ercode", equipmentCategory.getCode().substring(0, 2));
map.put("amount", 0);
if ("21".equals(equipmentCategory.getCode().substring(0, 2))) {
map.put("type", "car");
} else {
map.put("type", "equipment");
}
listr.add(map);
}
Map<String, Object> mape = new HashMap<>();
mape.put("ids", listd);
mape.put("id", id);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
// 根据二级分类查询统计
List<Map<String, Object>> listdate = equipmentCategoryMapper.getEquipCategoryListcount(mape);
mape.clear();
for (Map<String, Object> map : listr) {
mape.putAll(map);
for (Map<String, Object> map1 : listdate) {
if (map.get("ercode").toString().equals(map1.get("ercode").toString())) {
if (type.equals("4")) {
map.put("amount", map1.get("amount"));
} else {
double dou = Double.parseDouble(map1.get("amount").toString());
int i = new Double(dou).intValue();
map.put("amount", i);
}
map.put("type", map1.get("type"));
}
}
}
return listr;
} catch (Exception e) {
System.err.println(e.getMessage());
throw new RuntimeException("系统异常!");
}
}
// 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@RequestMapping(value = "/getEquipmentCount/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentCount(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand) {
try {
List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
listdate = equipmentCategoryMapper.getEquipmentCount(mape);
for (Map<String, Object> map : listdate) {
map.put("img", fileServer + map.get("img"));
Object amount = map.get("amount");
String unit = map.get("unit").toString();
if (ercode.substring(0, 1).equals("4")) {
map.put("amount", map.get("amount").toString() + " " + map.get("unit").toString());
} else {
double dou = Double.parseDouble(map.get("amount").toString());
int i = new Double(dou).intValue();
map.put("amount", i + " " + map.get("unit").toString());
}
}
return listdate;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
// 九大类详情列表
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "详情列表")
@RequestMapping(value = "/getEquipmentlist/{ercode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<Map<String, Object>> getEquipmentlist(@PathVariable(value = "ercode") String ercode,
String warehouseStructureId, String standard, String StateName, String brand, String name) {
try {
List<Map<String, Object>> listdate = null;
Map<String, Object> mape = new HashMap();
mape.put("ercode", ercode);
mape.put("warehouseStructureId", warehouseStructureId);
mape.put("standard", standard);
mape.put("StateName", StateName);
mape.put("brand", brand);
mape.put("name", name);
listdate = equipmentCategoryMapper.getDetailed(mape);
for (Map<String, Object> map : listdate) {
String utname = map.get("utname").toString();
String eqCode = map.get("ercode").toString();
String amount = map.get("amount").toString();
if (StringUtil.isNotEmpty(eqCode) && !eqCode.startsWith("4")) {
amount = amount.split("\\.")[0] + utname;
} else {
amount = amount + utname;
}
map.put("amount", amount);
map.put("img", fileServer + map.get("img"));
}
return listdate;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
// 三级按模板名称统计
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取九大类二级统计")
@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,
String pageSize) {
Page<Car> 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 iCarService.getCarList(ercode, orgcode, car, pageBean);
}
/**
* 车辆装备品牌 下拉框
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备品牌 下拉框")
@RequestMapping(value = "/getbrandlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getbrandlist(@PathVariable(value = "type") String type, String name) {
List<String> result = new ArrayList<String>();
if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name);
}
List<Car> list = carMapper.selectList(queryWrapper.groupBy("brand"));
for (Car car : list) {
result.add(car.getBrand());
}
return result;
} else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("brand", "");
queryWrapper.isNotNull("brand");
if (name != null && !"".equals(name)) {
queryWrapper.like("brand", name);
}
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("brand"));
for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getBrand());
}
return result;
}
}
/**
* 车辆装备状态
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆装备状态")
@RequestMapping(value = "/getStatuslist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<SystemDic> getStatuslist(@PathVariable(value = "type") String type) {
try {
Map<String, Object> columnMap = new HashMap<String, Object>();
if ("car".equals(type)) {
columnMap.put("type", SystemDicTypeEum.carState.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd;
} else {
columnMap.put("type", SystemDicTypeEum.equipStatus.getType());
List<SystemDic> listd = systemDicMapper.selectByMap(columnMap);
return listd;
}
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 规格型号
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "规格型号")
@RequestMapping(value = "/getstandardlist/{type}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<String> getstandardlist(@PathVariable(value = "type") String type, String name) {
try {
List<String> result = new ArrayList<String>();
if ("car".equals(type)) {
QueryWrapper<Car> queryWrapper = new QueryWrapper<Car>();
queryWrapper.ne("model", "");
queryWrapper.isNotNull("model");
if (name != null && !"".equals(name)) {
queryWrapper.like("model", name);
}
List<Car> list = carMapper.selectList(queryWrapper.groupBy("model"));
for (Car car : list) {
result.add(car.getStandard());
}
return result;
} else {
QueryWrapper<EquipmentDetail> queryWrapper = new QueryWrapper<EquipmentDetail>();
queryWrapper.ne("standard", "");
queryWrapper.isNotNull("standard");
if (name != null && !"".equals(name)) {
queryWrapper.like("standard", name);
}
List<EquipmentDetail> list = equipmentDetailMapper.selectList(queryWrapper.groupBy("standard"));
for (EquipmentDetail equipmentDetail : list) {
result.add(equipmentDetail.getStandard());
}
return result;
}
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* <pre>
* 打印车辆二维码
* </pre>
*
* @param id 车辆ID
* @param amount 打印数量
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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")
public List<EquipmentQrcode> printQRCode(@PathVariable("id") Long id, @PathVariable("amount") Integer amount,
@PathVariable("type") String type, @DateTimeFormat(pattern = "yyyy-MM-dd") Date productDate) {
try {
ProductionQRCode productionQRCode = messageHandMap.get(type);
List<EquipmentQrcode> list = productionQRCode.getProductionQRCode(id, amount, productDate);
return list;
} catch (Exception e) {
throw new RuntimeException("系统异常!");
}
}
/**
* 批量删除
*
* @param idList
* @return
* @throws Exception
*/
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean delete(HttpServletRequest request, @RequestBody List<Long> idList) throws Exception {
List<Car> cars = iCarService.list(new QueryWrapper<Car>().in("id", idList));
String[] topics = equipmentIotMqttReceiveConfig.adapter.getTopic();
cars.forEach(car -> {
List<EquipmentOnCarAppVO> equipmentOnCarAppVOS = carMapper.selectEquipmentOnCarAppList(car.getId());
if (equipmentOnCarAppVOS.size() > 0) {
throw new BadRequest("有车载装备的车辆不能删除,请先卸载装备!");
}
boolean flag = false;
String iotCode = car.getIotCode();
if (StringUtil.isNotEmpty(car.getIotCode()) && iotCode.length() > 8) {
String prefix = iotCode.substring(0, 8);
String suffix = iotCode.substring(8);
String oldTopic = prefix + "/" + suffix + "/property";
for (String topic : topics) {
if (topic.equals(oldTopic)) {
flag = true;
break;
}
}
if (flag) {
try {
equipmentIotMqttReceiveConfig.adapter.removeTopic(prefix + "/" + suffix + "/property");
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
return iCarService.removeOneByIds(idList);
}
/**
* 获取车辆物联信息
*
* @return
*/
@RequestMapping(value = "/getCarsIotInfo", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆物联信息", notes = "获取车辆物联信息")
public Map<Long, List<CarIndexVo>> getCarsIotInfo() {
Map<Long, List<CarIndexVo>> map = null;
String orgCode = getOrgCode();
List<CarIndexVo> carVoList = iCarService.getCarsIotInfo(orgCode);
if (!carVoList.isEmpty()) {
map = carVoList.stream().collect(Collectors.groupingBy(vo -> vo.getId()));
}
return map;
}
/**
* 根据车辆ID,获取车载装备及状态
*
* @param id
* @return
*/
@RequestMapping(value = "/getCarEquipmentsById/{id}/state", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取车辆车载装备状态", notes = "获取车辆车载装备状态")
public List<EquipStateOnCarVo> getCarEquipmentsById(@PathVariable(value = "id") Long id) {
return iCarService.getCarEquipmentsById(id);
}
/**
* <pre>
* 车辆历史轨迹数据
* </pre>
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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")
public ResponseModel getCarHistoryTrackAndTrendById(@PathVariable("iotCode") String iotCode,
@PathVariable("timeStart") String timeStart, @PathVariable("timeEnd") String timeEnd) {
String prefix = null;
String suffix = null;
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
return CommonResponseUtil.failure("车辆物联编码错误,请确认!");
}
LonAndLatEntityVo lonAndLatEntityVo = new LonAndLatEntityVo();
String url = iotServerName;
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Content-Type", "application/json");
headers.set("product", getProduct());
headers.set("token", getToken());
headers.set("appKey", getAppKey());
HttpEntity httpEntity = new HttpEntity<>(lonAndLatEntityVo, headers);
ResponseEntity<FeignClientResult> feignClientResult = null;
try {
feignClientResult = restTemplate.exchange(
"http://" + url + "/iot/v1/livedata/list?timeStart=" + timeStart + "&timeEnd=" + timeEnd
+ "&productKey=" + prefix + "&deviceName=" + suffix,
HttpMethod.GET, httpEntity, FeignClientResult.class);
} catch (Exception e) {
e.printStackTrace();
}
if (null != feignClientResult && feignClientResult.getBody().getStatus() == 200) {
return CommonResponseUtil.success(feignClientResult.getBody().getResult());
} else {
log.error("注:iotCode为 (" + iotCode + ") 的车辆不存在于物联系统或物联系统车辆历史轨迹接口出错!");
return CommonResponseUtil.success();
}
}
/**
* <pre>
* 模拟车辆历史运动趋势数据
* </pre>
*/
/**
* <pre>
* 模拟车辆历史运动趋势数据
* </pre>
*/
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @RequestMapping(value = "/history/trend/{iotCode}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
// public List<SpeedAndTimeEntityVo> getCarHistoryTrendById(@PathVariable("iotCode") String iotCode) {
......@@ -1165,134 +1180,123 @@ public class CarController extends AbstractBaseController {
// }
// }
/**
* 查询车辆-共共接口
*
* @param teamId 队伍id
* @param name 车辆名称
* @return List<CarInfoVo>
*/
@GetMapping(value = "/list-all")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public List<CarInfoDto> equipmentList(
@RequestParam(required = false) Long teamId,
@RequestParam(required = false) String name) {
return iCarService.carInfoList(teamId, name);
}
/**
* 查询车辆-共共接口
*
* @param teamId 队伍id
* @param name 车辆名称
* @return List<CarInfoVo>
*/
@GetMapping(value = "/list-allpag")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public Page<CarInfoDto> equipmentCarList(
@RequestParam(required = false) Long teamId,
@RequestParam(required = false) String name,
@RequestParam(required = false) String code ,
@RequestParam(required = false) String pageNum,
@RequestParam(required = false) String pageSize,
@RequestParam(required = false) Long id,
@RequestParam(required = false) Boolean 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 iCarService.equipmentCarList(pageBean,teamId, name,code,id,isNo);
}
/**
* 机场查询队伍与车辆数量
*
* @return List<Map < String, Object>>
*/
@GetMapping(value = "/list-info")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "队伍与车辆数量", notes = "队伍与车辆数量")
public List<Map<String, Object>> carList() {
return iCarService.teamCarList();
}
@PostMapping(value = "/status")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "更新车辆状态", notes = "更新车辆状态")
public ResponseModel updateCarStatus(@RequestBody List<CarStatusInfoDto> cars) {
return ResponseHelper.buildResponse(iCarService.updateCarStatus(cars));
}
/**
* 获取消防队伍的消防车辆
*
* @param id 队伍ID,非必填
* @return
*/
@GetMapping(value = "/getTeamCarList")
@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));
}
/**
* 根据id查询车辆简要信息
*
* @param id
* @return
*/
@RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询车辆简要信息", notes = "根据id查询车辆简要信息")
public Car selectById(@PathVariable Long id) {
return iCarService.querySimpleInfoById(id);
}
/**
* 根据查询车辆简要信息
*
* @param id
* @return
*/
@RequestMapping(value = "/state/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据车牌号查询车辆信息", notes = "根据车牌号查询车辆信息")
public ResponseModel getCarStateInfoByCarNum(@RequestParam(required = false) String carNum) {
return CommonResponseUtil.success(iCarService.getCarStateInfoByCarNum(carNum));
}
/**
* 查询所有融合终端车辆
*
* @return
*/
@RequestMapping(value = "/all/fusion", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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());
}
/**
* 查询车辆-共共接口
*
* @param teamId 队伍id
* @param name 车辆名称
* @return List<CarInfoVo>
*/
@GetMapping(value = "/list-all")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public List<CarInfoDto> equipmentList(@RequestParam(required = false) Long teamId,
@RequestParam(required = false) String name) {
return iCarService.carInfoList(teamId, name);
}
/**
* 查询车辆-共共接口
*
* @param teamId 队伍id
* @param name 车辆名称
* @return List<CarInfoVo>
*/
@GetMapping(value = "/list-allpag")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "车辆列表", notes = "车辆列表")
public Page<CarInfoDto> equipmentCarList(@RequestParam(required = false) Long teamId,
@RequestParam(required = false) String name, @RequestParam(required = false) String code,
@RequestParam(required = false) String pageNum, @RequestParam(required = false) String pageSize,
@RequestParam(required = false) Long id, @RequestParam(required = false) Boolean 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 iCarService.equipmentCarList(pageBean, teamId, name, code, id, isNo);
}
/**
* 机场查询队伍与车辆数量
*
* @return List<Map < String, Object>>
*/
@GetMapping(value = "/list-info")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "队伍与车辆数量", notes = "队伍与车辆数量")
public List<Map<String, Object>> carList() {
return iCarService.teamCarList();
}
@PostMapping(value = "/status")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "更新车辆状态", notes = "更新车辆状态")
public ResponseModel updateCarStatus(@RequestBody List<CarStatusInfoDto> cars) {
return ResponseHelper.buildResponse(iCarService.updateCarStatus(cars));
}
/**
* 获取消防队伍的消防车辆
*
* @param id 队伍ID,非必填
* @return
*/
@GetMapping(value = "/getTeamCarList")
@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));
}
/**
* 根据id查询车辆简要信息
*
* @param id
* @return
*/
@RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询车辆简要信息", notes = "根据id查询车辆简要信息")
public Car selectById(@PathVariable Long id) {
return iCarService.querySimpleInfoById(id);
}
/**
* 根据查询车辆简要信息
*
* @param id
* @return
*/
@RequestMapping(value = "/state/info", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据车牌号查询车辆信息", notes = "根据车牌号查询车辆信息")
public ResponseModel getCarStateInfoByCarNum(@RequestParam(required = false) String carNum) {
return CommonResponseUtil.success(iCarService.getCarStateInfoByCarNum(carNum));
}
/**
* 查询所有融合终端车辆
*
* @return
*/
@RequestMapping(value = "/all/fusion", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@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;
import com.yeejoin.equipmanage.mapper.ManufacturerInfoMapper;
import com.yeejoin.equipmanage.mapper.StockDetailMapper;
import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import com.yeejoin.equipmanage.utils.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -82,7 +84,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
/**
* 新增
*
......@@ -92,9 +96,18 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public EquipmentDetail saveEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDetail equipmentDetail) {
equipmentSpecificSerivce.refreshStaData();
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 {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public EquipmentDate saveEquipmentDetail(@RequestBody EquipmentDate equipmentDate) {
equipmentSpecificSerivce.refreshStaData();
if (equipmentDate.getEquipmentSpecific().getSingle() == null) {
throw new BadRequest("管理方式未输入");
}
......@@ -202,6 +216,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public EquipmentDate updateByIdEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDate equipmentDate) {
equipmentSpecificSerivce.refreshStaData();
EquipmentSpecific vo = equipmentDate.getEquipmentSpecific();
String sysCode = vo.getCode();
if (StringUtils.isNotEmpty(sysCode) && StringUtils.isNotEmpty(sysCode.trim())) {
......@@ -258,6 +273,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "根据id删除", notes = "根据id删除")
public boolean deleteById(HttpServletRequest request, @PathVariable Long id) {
equipmentSpecificSerivce.refreshStaData();
return iEquipmentDetailService.removeOneById(id);
}
......@@ -265,6 +281,7 @@ public class EquipmentDetailController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "修改", notes = "修改")
public boolean quotaUpdate(HttpServletRequest request, @RequestBody List<EquProperty> e) {
equipmentSpecificSerivce.refreshStaData();
return iEquipmentDetailService.quotaUpdate(e);
}
......
......@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -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.SourceNameListDTO;
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.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -71,11 +72,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "补码列表接口,废弃未用到")
public IPage<ComplementCodeVO> saveEquipmentPoint(@RequestBody EquipmentSpecificDTO equipmentSpecific) {
equipmentSpecificSerivce.refreshStaData();
return equipmentSpecificSerivce.selectEquipmentSpecific(equipmentSpecific);
}
/**
* 通过id获取设备区域建筑等信息
*
......@@ -107,9 +106,8 @@ public class EquipmentSpecificController extends AbstractBaseController {
*/
@RequestMapping(value = "/exit", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "修改", notes = "修改")
@ApiOperation(httpMethod = "POST", value = "修改" , notes = "修改")
public EquipmentSpecific updateEquipmentSpecific(@RequestBody EquipmentSpecific equipmentSpecific) {
equipmentSpecificSerivce.refreshStaData();
EquipmentSpecific updateEquipmentSpecific = equipmentSpecificSerivce.updateEquipmentSpecific(equipmentSpecific, getSelectedOrgInfo(), getUserInfo());
if (syncSwitch) {
// TODO 后续判断成功,执行同步
......@@ -249,7 +247,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) {
equipmentSpecificSerivce.refreshStaData();
return CommonResponseUtil.success(equipmentSpecificSerivce.delEquipmentBySpecificId(specificId));
}
......@@ -262,7 +259,6 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "批量删除装备相关所有数据", notes = "批量删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestBody List<Long> specificIds) {
equipmentSpecificSerivce.refreshStaData();
if(ObjectUtils.isEmpty(specificIds)){
return CommonResponseUtil.failure("参数为空");
}
......
......@@ -17,7 +17,7 @@ import java.util.List;
*/
@Mapper
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);
......
......@@ -308,4 +308,11 @@ public interface IBuilldService extends IService<Building> {
*/
Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId);
/**
* 根据登陆人获取公司部门树
* @return list
*/
List<BuildingTreeVo> getCompanyBuildingTree();
}
......@@ -50,6 +50,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
......@@ -1195,4 +1196,47 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
// TODO Auto-generated method stub
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;
import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.MqttSendGateway;
@Service
public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity> implements IFireFightingSystemService {
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IRiskSourceSceneService iRiskSourceSceneService;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipmentManageMapper equipmentManageMapper;
@Autowired
private EquipmentManageService equipmentManageService;
@Autowired
private BuildingMapper buildingMapper;
@Autowired
private FormInstanceMapper formInstanceMapper;
@Autowired
private SourceSceneMapper sourceSceneMapper;
@Value("${equipment.fire.systemid}")
private String fireSystemId;
@Value("${morphic.projectSeq}")
private Long projectSeq;
@Value("${mqtt.scene.host}")
private String sceneUrl;
@Value("${equip.point.equipmentdata.topic}")
private String wsTopic;
@Value("${equip.point.speindex.url}")
private String speindexUrl;
@Value("${equip.point.equipmentDetail.url}")
private String equipmentDetailUrl;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Autowired
private IEqDynamicFormGroupService iEqDynamicFormGroupService;
@Autowired
private IEqDynamicFormInstanceService instanceService;
@Autowired
@Lazy
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired
private ISourceSceneService iSourceSceneService;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RedisUtils redisUtils;
@Autowired
MqttSendGateway mqttSendGateway;
@Autowired
private JCSRemoteService jcsRemoteService;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-system:fire_system_info}")
private String authKey;
public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity>
implements IFireFightingSystemService {
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IRiskSourceSceneService iRiskSourceSceneService;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipmentManageMapper equipmentManageMapper;
@Autowired
private EquipmentManageService equipmentManageService;
@Autowired
private BuildingMapper buildingMapper;
@Autowired
private FormInstanceMapper formInstanceMapper;
@Autowired
private SourceSceneMapper sourceSceneMapper;
@Value("${equipment.fire.systemid}")
private String fireSystemId;
@Value("${morphic.projectSeq}")
private Long projectSeq;
@Value("${mqtt.scene.host}")
private String sceneUrl;
@Value("${equip.point.equipmentdata.topic}")
private String wsTopic;
@Value("${equip.point.speindex.url}")
private String speindexUrl;
@Value("${equip.point.equipmentDetail.url}")
private String equipmentDetailUrl;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Autowired
private IEqDynamicFormGroupService iEqDynamicFormGroupService;
@Autowired
private IEqDynamicFormInstanceService instanceService;
@Autowired
@Lazy
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired
private ISourceSceneService iSourceSceneService;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RedisUtils redisUtils;
@Autowired
MqttSendGateway mqttSendGateway;
@Autowired
private JCSRemoteService jcsRemoteService;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-system:fire_system_info}")
private String authKey;
@Value("${equipment.type}")
String equipmentCategoryLeftTypeCode;
@Autowired
IEquipmentCategoryService iEquipmentCategoryService;
@Autowired
ISourceStatistics sourceStatistics;
@Value("${redis_car_type_count}")
private String carTypeAndCount;
@Value("${redis_equip_type_count}")
private String equipTypeAndCount;
@Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId);
}
@Override
public List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId) {
return this.baseMapper.getEquiplistBySystemId(systemId);
}
@Override
public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize) {
Map<String, Object> map = equipmentManageService.queryEquipmenInfoAndCount(equimentName, equimentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize);
List<EquipmentManageVo> dataList = (List<EquipmentManageVo>) map.get("dataList");
StringBuilder stb = new StringBuilder();
dataList.forEach(y -> {
if (StringUtil.isNotEmpty(String.valueOf(stb))) {
stb.append("," + y.getChargePerson());
} else {
stb.append(y.getChargePerson());
}
});
Map<String, String> userMap = new HashMap<>();
if (StringUtil.isNotEmpty(stb)) {
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString());
agencyUserModels.forEach(z -> {
userMap.put(z.getUserId(), z.getRealName());
});
}
dataList.forEach(x -> {
x.setChargePerson(userMap.get(x.getChargePerson()));
x.setSystemimg(equipmentManageMapper.getFiles(String.valueOf(x.getId()), "face"));
});
map.put("dataList", dataList);
return map;
}
@Override
public FireFightingSystemEntity getOneById(Long id) {
FireFightingSystemEntity fireFightingSystemEntity = this.baseMapper.selectById(id);
return fireFightingSystemEntity;
}
@Override
public String save(FireFightingSystemVo vo) {
if (!systemCodeCheck(vo)) {
throw new BadRequest("系统编号已存在,请重新输入");
}
List<DynamicFormInstance> formInstance = vo.getFormInstances();
// 验证必填项 BUG 2725 by kongfm 2021-09-09
formInstance.stream().forEach(item -> {
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
}
});
String userId = remoteSecurityService.getAgencyUser().getUserId();
//冗余名称,数据同步使用
this.setChargePersonName(vo);
String s = String.valueOf(System.currentTimeMillis());
vo.setId(s);
vo.setRecUserId(userId);
vo.setSort(s);
DynamicFormGroup dynamicFormGroup = iEqDynamicFormGroupService.getById(vo.getFormGroupId());
vo.setSystemType(dynamicFormGroup.getRelationId() != null ? dynamicFormGroup.getRelationId().toString() : "");
// fireSystemId 为字典表火灾系统id 以此确保第一个生成的火灾报警系统排序为1
if (vo.getSystemType().equals(fireSystemId)) {
vo.setSort("1");
}
if ("".equals(vo.getInstallDate())) {
vo.setInstallDate(null);
}
if ("".equals(vo.getFirstMaintenanceDate())) {
vo.setFirstMaintenanceDate(null);
}
//1.保存动态表单数据
if (vo.getFormInstances() != null && vo.getFormInstances().size() > 0) {
Long instanceId = instanceService.saveInstanceBatch(vo.getFormInstances());
vo.setInstanceId(instanceId);
s = s + "," + instanceId;
}
//2.保存消防系统数据
int save = fireFightingSystemMapper.save(vo);
if (save > 0 && syncSwitch) {
// AST数据同步
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
} else {
return s;
}
//3.保存图片数据
this.insertFiles(vo);
return s;
}
@Override
public String update(FireFightingSystemVo vo) {
if (!systemCodeCheck(vo)) {
throw new BadRequest("系统编号已存在,请重新输入");
}
// 验证必填项 BUG 2725 by kongfm 2021-09-09
List<DynamicFormInstance> formInstance = vo.getFormInstances();
formInstance.stream().forEach(item -> {
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
}
});
String userId = remoteSecurityService.getAgencyUser().getUserId();
vo.setRecUserId(userId);
//冗余名称,数据同步使用
this.setChargePersonName(vo);
if ("".equals(vo.getInstallDate())) {
vo.setInstallDate(null);
}
if ("".equals(vo.getFirstMaintenanceDate())) {
vo.setFirstMaintenanceDate(null);
}
int update = fireFightingSystemMapper.update(vo);
if (update > 0 && syncSwitch) {
// AST数据同步
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
} else {
return null;
}
//1.更新消防系统数据
String sequenceNbr = vo.getId();
fireFightingSystemMapper.deleteFilre(sequenceNbr);
//2.更新动态表单数据
if (vo.getInstanceId() != null && vo.getFormInstances().size() > 0) {
instanceService.updateInstanceBatch(vo.getInstanceId(), vo.getFormInstances());
}
//3.更新图片数据
this.insertFiles(vo);
return vo.getId();
}
private void setChargePersonName(FireFightingSystemVo vo) {
if (StringUtil.isNotEmpty(vo.getChargePerson())) {
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
vo.setChargePersonName(userModel.getRealName());
}
}
private boolean systemCodeCheck(FireFightingSystemVo systemVo) {
if (StringUtils.isEmpty(systemVo.getId())) {
// 新建系统时
int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>().eq(FireFightingSystemEntity::getCode, systemVo.getCode()));
return count < 1;
} else {
int count =
this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>().eq(FireFightingSystemEntity::getCode, systemVo.getCode()).ne(FireFightingSystemEntity::getId, systemVo.getId()));
return count < 1;
}
}
@Override
public FireFightingSystemVo createMorphic(FireFightingSystemVo model) {
ResourceDTO resourceDTO = new ResourceDTO();
resourceDTO.setSubjectId(projectSeq);
resourceDTO.setSubjectid(projectSeq);
resourceDTO.setName(model.getName());
// 为首次 添加的画布添加mqtt 相关数据
String content = "{\"layout\":\"\",\"boardConfig\":{\"modeType\":\"custom\",\"orientation\":\"lengthways\",\"autoRefresh\":true,\"name\":\"1\",\"showMode\":\"actual\",\"paperSize\":\"1280X900\"},\"boardStyle\":{\"backgroundImage\":\"\"},\"dataConfig\":{}}";
Map parse = (Map) JSON.parse(content);
Map<String, Object> dataConfig = new HashMap<>();
dataConfig.put("msgType", "mqtt");
dataConfig.put("wsUrl", sceneUrl);
parse.put("dataConfig", dataConfig);
content = JSONObject.toJSONString(parse);
dataConfig.put("wsTopic", wsTopic);
resourceDTO.setContent(content);
ResourceDTO morphic = Morphic.morphicSubjectClient.create(resourceDTO).getResult();
model.setSceneId(morphic.getId());
@Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId);
}
@Override
public List<EquiplistSpecificBySystemVO> getEquiplistBySystemId(Long systemId) {
return this.baseMapper.getEquiplistBySystemId(systemId);
}
@Override
public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction,
String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize) {
Map<String, Object> map = equipmentManageService.queryEquipmenInfoAndCount(equimentName, equimentCode,
construction, maintenance, bizOrgCode, formGroupId, current, pageSize);
List<EquipmentManageVo> dataList = (List<EquipmentManageVo>) map.get("dataList");
StringBuilder stb = new StringBuilder();
dataList.forEach(y -> {
if (StringUtil.isNotEmpty(String.valueOf(stb))) {
stb.append("," + y.getChargePerson());
} else {
stb.append(y.getChargePerson());
}
});
Map<String, String> userMap = new HashMap<>();
if (StringUtil.isNotEmpty(stb)) {
List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(stb.toString());
agencyUserModels.forEach(z -> {
userMap.put(z.getUserId(), z.getRealName());
});
}
dataList.forEach(x -> {
x.setChargePerson(userMap.get(x.getChargePerson()));
x.setSystemimg(equipmentManageMapper.getFiles(String.valueOf(x.getId()), "face"));
});
map.put("dataList", dataList);
return map;
}
@Override
public FireFightingSystemEntity getOneById(Long id) {
FireFightingSystemEntity fireFightingSystemEntity = this.baseMapper.selectById(id);
return fireFightingSystemEntity;
}
@Override
public String save(FireFightingSystemVo vo) {
if (!systemCodeCheck(vo)) {
throw new BadRequest("系统编号已存在,请重新输入");
}
List<DynamicFormInstance> formInstance = vo.getFormInstances();
// 验证必填项 BUG 2725 by kongfm 2021-09-09
formInstance.stream().forEach(item -> {
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
}
});
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 冗余名称,数据同步使用
this.setChargePersonName(vo);
String s = String.valueOf(System.currentTimeMillis());
vo.setId(s);
vo.setRecUserId(userId);
vo.setSort(s);
DynamicFormGroup dynamicFormGroup = iEqDynamicFormGroupService.getById(vo.getFormGroupId());
vo.setSystemType(dynamicFormGroup.getRelationId() != null ? dynamicFormGroup.getRelationId().toString() : "");
// fireSystemId 为字典表火灾系统id 以此确保第一个生成的火灾报警系统排序为1
if (vo.getSystemType().equals(fireSystemId)) {
vo.setSort("1");
}
if ("".equals(vo.getInstallDate())) {
vo.setInstallDate(null);
}
if ("".equals(vo.getFirstMaintenanceDate())) {
vo.setFirstMaintenanceDate(null);
}
// 1.保存动态表单数据
if (vo.getFormInstances() != null && vo.getFormInstances().size() > 0) {
Long instanceId = instanceService.saveInstanceBatch(vo.getFormInstances());
vo.setInstanceId(instanceId);
s = s + "," + instanceId;
}
// 2.保存消防系统数据
int save = fireFightingSystemMapper.save(vo);
if (save > 0 && syncSwitch) {
// AST数据同步
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
} else {
return s;
}
// 3.保存图片数据
this.insertFiles(vo);
return s;
}
@Override
public String update(FireFightingSystemVo vo) {
if (!systemCodeCheck(vo)) {
throw new BadRequest("系统编号已存在,请重新输入");
}
// 验证必填项 BUG 2725 by kongfm 2021-09-09
List<DynamicFormInstance> formInstance = vo.getFormInstances();
formInstance.stream().forEach(item -> {
if (item.getNotNull() == true && StringUtils.isEmpty(item.getFieldValue())) {
throw new BadRequest(item.getFieldLabel() + "为必填项,请确认");
}
});
String userId = remoteSecurityService.getAgencyUser().getUserId();
vo.setRecUserId(userId);
// 冗余名称,数据同步使用
this.setChargePersonName(vo);
if ("".equals(vo.getInstallDate())) {
vo.setInstallDate(null);
}
if ("".equals(vo.getFirstMaintenanceDate())) {
vo.setFirstMaintenanceDate(null);
}
int update = fireFightingSystemMapper.update(vo);
if (update > 0 && syncSwitch) {
// AST数据同步
List<FireFightingSystem> fireFightingSystemDetail = getFireFightingSystemDetail(vo);
syncDataService.syncCreatedFireFightingSystem(fireFightingSystemDetail);
} else {
return null;
}
// 1.更新消防系统数据
String sequenceNbr = vo.getId();
fireFightingSystemMapper.deleteFilre(sequenceNbr);
// 2.更新动态表单数据
if (vo.getInstanceId() != null && vo.getFormInstances().size() > 0) {
instanceService.updateInstanceBatch(vo.getInstanceId(), vo.getFormInstances());
}
// 3.更新图片数据
this.insertFiles(vo);
return vo.getId();
}
private void setChargePersonName(FireFightingSystemVo vo) {
if (StringUtil.isNotEmpty(vo.getChargePerson())) {
FeignClientResult<AgencyUserModel> result = Privilege.agencyUserClient.queryByUserId(vo.getChargePerson());
AgencyUserModel userModel = result == null ? new AgencyUserModel() : result.getResult();
vo.setChargePersonName(userModel.getRealName());
}
}
private boolean systemCodeCheck(FireFightingSystemVo systemVo) {
if (StringUtils.isEmpty(systemVo.getId())) {
// 新建系统时
int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>()
.eq(FireFightingSystemEntity::getCode, systemVo.getCode()));
return count < 1;
} else {
int count = this.baseMapper.selectCount(new LambdaQueryWrapper<FireFightingSystemEntity>()
.eq(FireFightingSystemEntity::getCode, systemVo.getCode())
.ne(FireFightingSystemEntity::getId, systemVo.getId()));
return count < 1;
}
}
@Override
public FireFightingSystemVo createMorphic(FireFightingSystemVo model) {
ResourceDTO resourceDTO = new ResourceDTO();
resourceDTO.setSubjectId(projectSeq);
resourceDTO.setSubjectid(projectSeq);
resourceDTO.setName(model.getName());
// 为首次 添加的画布添加mqtt 相关数据
String content = "{\"layout\":\"\",\"boardConfig\":{\"modeType\":\"custom\",\"orientation\":\"lengthways\",\"autoRefresh\":true,\"name\":\"1\",\"showMode\":\"actual\",\"paperSize\":\"1280X900\"},\"boardStyle\":{\"backgroundImage\":\"\"},\"dataConfig\":{}}";
Map parse = (Map) JSON.parse(content);
Map<String, Object> dataConfig = new HashMap<>();
dataConfig.put("msgType", "mqtt");
dataConfig.put("wsUrl", sceneUrl);
parse.put("dataConfig", dataConfig);
content = JSONObject.toJSONString(parse);
dataConfig.put("wsTopic", wsTopic);
resourceDTO.setContent(content);
ResourceDTO morphic = Morphic.morphicSubjectClient.create(resourceDTO).getResult();
model.setSceneId(morphic.getId());
// fireFightingSystemMapper.setSceneId(model);
return model;
}
@Override
@Transactional
public ResourceDTO updateMorphic(ResourceDTO resourceDTO) {
try {
//1.更新画布信息
resourceDTO.setSubjectId(projectSeq);
resourceDTO.setSubjectid(projectSeq);
String content = resourceDTO.getContent();
Map parse = (Map) JSON.parse(content);
Map<String, Object> dataConfig = new HashMap<>();
dataConfig.put("msgType", "mqtt");
dataConfig.put("wsUrl", sceneUrl);
dataConfig.put("wsTopic", wsTopic);
parse.put("dataConfig", dataConfig);
content = JSONObject.toJSONString(parse);
resourceDTO.setContent(content);
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
//2.更新业务关联的画布id
Long systemId = Long.valueOf(resourceDTO.getCode());
FireFightingSystemVo systemVo = new FireFightingSystemVo();
systemVo.setId(String.valueOf(systemId));
systemVo.setSceneId(resourceDTO.getId());
fireFightingSystemMapper.setSceneId(systemVo);
//3.保存场景关联信息表
SourceScene sourceScene = sourceSceneMapper.selectOne(new LambdaQueryWrapper<SourceScene>().eq(SourceScene::getSceneId, resourceDTO.getId()));
if (sourceScene == null) {
sourceScene = new SourceScene();
sourceScene.setProjectId(String.valueOf(projectSeq));
sourceScene.setSourceId(systemId);
sourceScene.setSourceName(resourceDTO.getName());
sourceScene.setSceneId(resourceDTO.getId());
}
//TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头)
List<Map> children = (List<Map>) parse.get("children");
String pointInScene = "";
String videoInScene = "";
if (!CollectionUtils.isEmpty(children)) {
for (Map<String, String> map : children) {
String key = map.get("key");
if (!"".equals(key) && "equipment".equals(key)) {
pointInScene = "".equals(pointInScene) ? map.get("sequenceNbr") : pointInScene + "," + 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) {
log.error(e.getMessage(), e);
throw new BadRequest("保存画布失败");
}
return resourceDTO;
}
@Override
public List<PointTreeVo> getPointTree(String id, String orgCode) {
return model;
}
@Override
@Transactional
public ResourceDTO updateMorphic(ResourceDTO resourceDTO) {
try {
// 1.更新画布信息
resourceDTO.setSubjectId(projectSeq);
resourceDTO.setSubjectid(projectSeq);
String content = resourceDTO.getContent();
Map parse = (Map) JSON.parse(content);
Map<String, Object> dataConfig = new HashMap<>();
dataConfig.put("msgType", "mqtt");
dataConfig.put("wsUrl", sceneUrl);
dataConfig.put("wsTopic", wsTopic);
parse.put("dataConfig", dataConfig);
content = JSONObject.toJSONString(parse);
resourceDTO.setContent(content);
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.update(resourceDTO));
// 2.更新业务关联的画布id
Long systemId = Long.valueOf(resourceDTO.getCode());
FireFightingSystemVo systemVo = new FireFightingSystemVo();
systemVo.setId(String.valueOf(systemId));
systemVo.setSceneId(resourceDTO.getId());
fireFightingSystemMapper.setSceneId(systemVo);
// 3.保存场景关联信息表
SourceScene sourceScene = sourceSceneMapper
.selectOne(new LambdaQueryWrapper<SourceScene>().eq(SourceScene::getSceneId, resourceDTO.getId()));
if (sourceScene == null) {
sourceScene = new SourceScene();
sourceScene.setProjectId(String.valueOf(projectSeq));
sourceScene.setSourceId(systemId);
sourceScene.setSourceName(resourceDTO.getName());
sourceScene.setSceneId(resourceDTO.getId());
}
// TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头)
List<Map> children = (List<Map>) parse.get("children");
String pointInScene = "";
String videoInScene = "";
if (!CollectionUtils.isEmpty(children)) {
for (Map<String, String> map : children) {
String key = map.get("key");
if (!"".equals(key) && "equipment".equals(key)) {
pointInScene = "".equals(pointInScene) ? map.get("sequenceNbr")
: pointInScene + "," + 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) {
log.error(e.getMessage(), e);
throw new BadRequest("保存画布失败");
}
return resourceDTO;
}
@Override
public List<PointTreeVo> getPointTree(String id, String orgCode) {
// CommonResponse se = riskModelFeign.getRiskSourceList(orgCode);
// List<Map<String, Object>> list = (List<Map<String, Object>>) se.getDataList();
// List<PointTreeVo> responses = new ArrayList<>();
......@@ -432,233 +437,234 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p);
// });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode);
return transferListToPointTree(buildList, id);
}
@Override
public List<SpeIndexVo> getSpeIndex(Long id) {
return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
}
private void insertFiles(FireFightingSystemVo vo) {
List<FileUploadVo> video = vo.getVideo();
if (video.size() > 0) {
for (FileUploadVo f : video) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("video");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> faceimg = vo.getFaceimg();
if (faceimg.size() > 0) {
for (FileUploadVo f : faceimg) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("face");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> instruction = vo.getInstruction();
if (instruction.size() > 0) {
for (FileUploadVo f : instruction) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("instruction");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> asser = vo.getAsser();
if (asser.size() > 0) {
for (FileUploadVo f : asser) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("certificate");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> spotimg = vo.getSpotimg();
if (spotimg.size() > 0) {
for (FileUploadVo f : spotimg) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("spotimg");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> tdmod = vo.getTdmod();
if (tdmod.size() > 0) {
for (FileUploadVo f : tdmod) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("tdmod");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
}
/**
* 生成树结构
*
* @param allRiskSource
* @param id
* @return
*/
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) {
List<PointTreeVo> treeList = new ArrayList<>();
//TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) {
List<Long> idList = pointData.stream().map(PointTreeVo::getSequenceNbr).collect(Collectors.toList());
List<SpeIndexVo> indexVoList = fireFightingSystemMapper.getSpeIndexIn(idList);
if (!CollectionUtils.isEmpty(indexVoList)) {
Map<Long, List<SpeIndexVo>> indexMap = indexVoList.stream().collect(Collectors.groupingBy(SpeIndexVo::getEquipmentSpecificId));
pointData.stream().forEach(p -> {
Map map = new HashMap();
map.put("imgPath", p.getImgPath());
map.put("equipCode", p.getEquipCode());
map.put("equipSyetemId", p.getEquipSyetemId());
map.put("equipTypeId", p.getEquipId());
map.put("speindexList", makeStatus(indexMap.get(p.getSequenceNbr())));
map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map);
});
}
}
allRiskSource.addAll(pointData);
for (PointTreeVo tree : allRiskSource) {
if (tree.getParentId() == null || tree.getParentId() == -1) {
treeList.add(tree);
}
for (PointTreeVo treeNode : allRiskSource) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
return treeList;
}
/**
* 生成树结构
*
* @param allRiskSource
* @return
*/
public List<PointTreeVo> transferListTo3dPointTree(List<PointTreeVo> allRiskSource) {
List<PointTreeVo> treeList = new ArrayList<>();
List<PointTreeVo> pointData = fireFightingSystemMapper.get3dPointData();
if (!CollectionUtils.isEmpty(pointData)) {
allRiskSource.addAll(pointData);
for (PointTreeVo tree : allRiskSource) {
if (tree.getParentId() == null || tree.getParentId() == -1) {
treeList.add(tree);
}
for (PointTreeVo treeNode : allRiskSource) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
return treeList;
}
return Lists.newArrayList();
}
private static <T> void mapToBean(Map<String, Object> map, T bean) {
try {
BeanUtils.populate(bean, map);
} catch (Exception e) {
throw new RuntimeException(e);
}
Set<?> set = new HashSet<>();
}
/**
* 生成 性能指标数据
*
* @param list
* @return
*/
private List<SpeIndexVo> makeStatus(List<SpeIndexVo> list) {
if (list == null || list.size() == 0) {
return new ArrayList<>();
}
List<SpeIndexVo> newList = new ArrayList<>();
List<SpeIndexVo> statusList = new ArrayList<>();
for (SpeIndexVo vo : list) {
String k = vo.getTypeCode();
if (EquipmentRiskTypeEnum.GZ.getCode().equals(k) ||
EquipmentRiskTypeEnum.HZGJ.getCode().equals(k) ||
EquipmentRiskTypeEnum.YXZT.getCode().equals(k) ||
EquipmentRiskTypeEnum.PB.getCode().equals(k)) {
statusList.add(vo);
}
newList.add(vo);
}
if (statusList.size() == 0) {
return newList;
}
SpeIndexVo spe = new SpeIndexVo();
spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode());
spe.setName("当前状态");
spe.setValue(getStatus(statusList));
statusList.clear();
statusList.add(spe);
statusList.addAll(newList);
return statusList;
}
/**
* 判断 装备状态
*
* @param statusList
* @return
*/
private String getStatus(List<SpeIndexVo> statusList) {
SpeIndexVo indexVo = statusList.get(0);
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())) {
return "故障";
}
if (EquipmentRiskTypeEnum.PB.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "屏蔽";
}
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(indexVo.getTypeCode()) && TrueOrFalseEnum.fake.value.equals(indexVo.getValue())) {
return "停运";
}
return "运行";
}
@Override
public List<FireFightingSystemEntity> getList() {
return this.list();
}
@Override
public Boolean deleteSystem(Long id) {
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode);
return transferListToPointTree(buildList, id);
}
@Override
public List<SpeIndexVo> getSpeIndex(Long id) {
return makeStatus(fireFightingSystemMapper.getSpeIndex(id));
}
private void insertFiles(FireFightingSystemVo vo) {
List<FileUploadVo> video = vo.getVideo();
if (video.size() > 0) {
for (FileUploadVo f : video) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("video");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> faceimg = vo.getFaceimg();
if (faceimg.size() > 0) {
for (FileUploadVo f : faceimg) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("face");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> instruction = vo.getInstruction();
if (instruction.size() > 0) {
for (FileUploadVo f : instruction) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("instruction");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> asser = vo.getAsser();
if (asser.size() > 0) {
for (FileUploadVo f : asser) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("certificate");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> spotimg = vo.getSpotimg();
if (spotimg.size() > 0) {
for (FileUploadVo f : spotimg) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("spotimg");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
List<FileUploadVo> tdmod = vo.getTdmod();
if (tdmod.size() > 0) {
for (FileUploadVo f : tdmod) {
f.setId(String.valueOf(System.currentTimeMillis()));
f.setUserId(vo.getRecUserId());
f.setFileType("tdmod");
f.setObjectId(vo.getId());
fireFightingSystemMapper.insertFile(f);
}
}
}
/**
* 生成树结构
*
* @param allRiskSource
* @param id
* @return
*/
public List<PointTreeVo> transferListToPointTree(List<PointTreeVo> allRiskSource, String id) {
List<PointTreeVo> treeList = new ArrayList<>();
// TODO id为空,为消防建筑使用;id不为空,为点位图使用
List<PointTreeVo> pointData = fireFightingSystemMapper.getPointData(id);
if (!CollectionUtils.isEmpty(pointData)) {
List<Long> idList = pointData.stream().map(PointTreeVo::getSequenceNbr).collect(Collectors.toList());
List<SpeIndexVo> indexVoList = fireFightingSystemMapper.getSpeIndexIn(idList);
if (!CollectionUtils.isEmpty(indexVoList)) {
Map<Long, List<SpeIndexVo>> indexMap = indexVoList.stream()
.collect(Collectors.groupingBy(SpeIndexVo::getEquipmentSpecificId));
pointData.stream().forEach(p -> {
Map map = new HashMap();
map.put("imgPath", p.getImgPath());
map.put("equipCode", p.getEquipCode());
map.put("equipSyetemId", p.getEquipSyetemId());
map.put("equipTypeId", p.getEquipId());
map.put("speindexList", makeStatus(indexMap.get(p.getSequenceNbr())));
map.put("speindexApi", speindexUrl + p.getSequenceNbr());
map.put("detailInfoApi", equipmentDetailUrl + p.getSequenceNbr());
map.put("detailApi", equipmentDetailUrl + p.getSequenceNbr());
p.setDataConfig(map);
});
}
}
allRiskSource.addAll(pointData);
for (PointTreeVo tree : allRiskSource) {
if (tree.getParentId() == null || tree.getParentId() == -1) {
treeList.add(tree);
}
for (PointTreeVo treeNode : allRiskSource) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
return treeList;
}
/**
* 生成树结构
*
* @param allRiskSource
* @return
*/
public List<PointTreeVo> transferListTo3dPointTree(List<PointTreeVo> allRiskSource) {
List<PointTreeVo> treeList = new ArrayList<>();
List<PointTreeVo> pointData = fireFightingSystemMapper.get3dPointData();
if (!CollectionUtils.isEmpty(pointData)) {
allRiskSource.addAll(pointData);
for (PointTreeVo tree : allRiskSource) {
if (tree.getParentId() == null || tree.getParentId() == -1) {
treeList.add(tree);
}
for (PointTreeVo treeNode : allRiskSource) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
}
return treeList;
}
return Lists.newArrayList();
}
private static <T> void mapToBean(Map<String, Object> map, T bean) {
try {
BeanUtils.populate(bean, map);
} catch (Exception e) {
throw new RuntimeException(e);
}
Set<?> set = new HashSet<>();
}
/**
* 生成 性能指标数据
*
* @param list
* @return
*/
private List<SpeIndexVo> makeStatus(List<SpeIndexVo> list) {
if (list == null || list.size() == 0) {
return new ArrayList<>();
}
List<SpeIndexVo> newList = new ArrayList<>();
List<SpeIndexVo> statusList = new ArrayList<>();
for (SpeIndexVo vo : list) {
String k = vo.getTypeCode();
if (EquipmentRiskTypeEnum.GZ.getCode().equals(k) || EquipmentRiskTypeEnum.HZGJ.getCode().equals(k)
|| EquipmentRiskTypeEnum.YXZT.getCode().equals(k) || EquipmentRiskTypeEnum.PB.getCode().equals(k)) {
statusList.add(vo);
}
newList.add(vo);
}
if (statusList.size() == 0) {
return newList;
}
SpeIndexVo spe = new SpeIndexVo();
spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode());
spe.setName("当前状态");
spe.setValue(getStatus(statusList));
statusList.clear();
statusList.add(spe);
statusList.addAll(newList);
return statusList;
}
/**
* 判断 装备状态
*
* @param statusList
* @return
*/
private String getStatus(List<SpeIndexVo> statusList) {
SpeIndexVo indexVo = statusList.get(0);
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())) {
return "故障";
}
if (EquipmentRiskTypeEnum.PB.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "屏蔽";
}
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.fake.value.equals(indexVo.getValue())) {
return "停运";
}
return "运行";
}
@Override
public List<FireFightingSystemEntity> getList() {
return this.list();
}
@Override
public Boolean deleteSystem(Long id) {
// QueryWrapper<FormInstance> fqw = new QueryWrapper<>();
// fqw.eq("field_value",id);
// fqw.groupBy("instance_id");
......@@ -672,372 +678,391 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// String name = formInstance.getFieldValue();
// throw new BadRequest(name+"建筑与该系统存在绑定关系,请清除后再进行删除!");
// }
FireFightingSystemEntity entity = baseMapper.selectById(id);
if (entity.getSceneId() != null) {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
}
formInstanceMapper.clearSystemId(id);
//解除装备与消防系统关系
this.removeBondSystemId(id);
this.baseMapper.deleteFilre(String.valueOf(id));
int i = this.baseMapper.deleteById(id);
if (i > 0 && syncSwitch) {
syncDataService.syncDeletedFireFightingSystem(Arrays.asList(id));
}
//删除动态关联表单实例数据
if (entity.getInstanceId() != null) {
instanceService.remove(
new LambdaQueryWrapper<DynamicFormInstance>()
.eq(DynamicFormInstance::getInstanceId, entity.getInstanceId()));
}
return i > 0;
}
private void removeBondSystemId(Long id) {
List<EquipmentSpecific> equipmentSpecifics = equipmentSpecificSerivce.list(new LambdaQueryWrapper<EquipmentSpecific>().like(EquipmentSpecific::getSystemId, id));
equipmentSpecifics.forEach(equipmentSpecific -> {
List<String> ids = new ArrayList<>();
if (StringUtil.isNotEmpty(equipmentSpecific.getSystemId())) {
ids = Arrays.asList(equipmentSpecific.getSystemId().split(","));
ids = new ArrayList<>(ids);
ids.remove(id.toString());
}
equipmentSpecific.setSystemId(Joiner.on(",").join(ids));
});
if (!equipmentSpecifics.isEmpty()) {
equipmentSpecificSerivce.saveOrUpdateBatch(equipmentSpecifics);
}
}
@Override
public Boolean isDeleteCanvas(Long id) {
FireFightingSystemEntity system = baseMapper.selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("scene_id", id));
if (system != null) {
return true;
} else {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(id));
return false;
}
}
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
equipTypeAmountPage.setStatus(null);
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper.getColaCategoryAmountList(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 IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
equipTypeAmountPage.setStatus(null);
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper.getColaCategoryAmountCarList(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 IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(int hierarchy, String codeHead, EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
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);
FireFightingSystemEntity entity = baseMapper.selectById(id);
if (entity.getSceneId() != null) {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
}
formInstanceMapper.clearSystemId(id);
// 解除装备与消防系统关系
this.removeBondSystemId(id);
this.baseMapper.deleteFilre(String.valueOf(id));
int i = this.baseMapper.deleteById(id);
if (i > 0 && syncSwitch) {
syncDataService.syncDeletedFireFightingSystem(Arrays.asList(id));
}
// 删除动态关联表单实例数据
if (entity.getInstanceId() != null) {
instanceService.remove(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId,
entity.getInstanceId()));
}
return i > 0;
}
private void removeBondSystemId(Long id) {
List<EquipmentSpecific> equipmentSpecifics = equipmentSpecificSerivce
.list(new LambdaQueryWrapper<EquipmentSpecific>().like(EquipmentSpecific::getSystemId, id));
equipmentSpecifics.forEach(equipmentSpecific -> {
List<String> ids = new ArrayList<>();
if (StringUtil.isNotEmpty(equipmentSpecific.getSystemId())) {
ids = Arrays.asList(equipmentSpecific.getSystemId().split(","));
ids = new ArrayList<>(ids);
ids.remove(id.toString());
}
equipmentSpecific.setSystemId(Joiner.on(",").join(ids));
});
if (!equipmentSpecifics.isEmpty()) {
equipmentSpecificSerivce.saveOrUpdateBatch(equipmentSpecifics);
}
}
@Override
public Boolean isDeleteCanvas(Long id) {
FireFightingSystemEntity system = baseMapper
.selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("scene_id", id));
if (system != null) {
return true;
} else {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(id));
return false;
}
}
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountList(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
equipTypeAmountPage.setStatus(null);
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountList(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 IPage<EquipTypeImgAmountVO> getColaCategoryAmountCarList(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
if (!"".equals(type) && "car".equals(type)) {
equipTypeAmountPage.setSystemId(null);
equipTypeAmountPage.setStatus(null);
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountCarList(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;
}
public Object getCarTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> equipmentTypeList =null;
// if (redisUtils.hasKey(carTypeAndCount)) {
// equipmentTypeList = JSONArray.parseArray(JSONArray.toJSONString(redisUtils.get(carTypeAndCount)), 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.CAR);
@Override
public IPage<EquipTypeImgAmountVO> getColaCategoryAmountEquList(int hierarchy, String codeHead,
EquipTypeAmountPageDTO equipTypeAmountPage) {
String type = equipTypeAmountPage.getType();
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();
}
public List<EquipmentCategory> typeList() {
@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 {
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
.getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode));
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<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
action.setCount(Double.parseDouble(num+""));
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, sourceTypeEnum, action.getCode());
action.setCount(Double.parseDouble(num + ""));
if (action.getParentId() == null) {
list.add(action);
} else {
......@@ -1055,8 +1080,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
getChildren(list, tmpMap);
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) {
if (tmpMap.get(equipmentCategory.getId().toString()) != null
&& tmpMap.get(equipmentCategory.getId().toString()).size() > 0) {
......@@ -1068,12 +1093,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
@Override
public List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
if (StringUtil.isNotEmpty(bizOrgCode)) {
wrapper.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode);
}
return this.baseMapper.selectList(wrapper);
}
@Override
public List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
if (StringUtil.isNotEmpty(bizOrgCode)) {
wrapper.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode);
}
return this.baseMapper.selectList(wrapper);
}
}
......@@ -59,6 +59,7 @@ import com.yeejoin.equipmanage.mapper.StockMapper;
import com.yeejoin.equipmanage.service.EquipmentManageService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IEquipmentSystemSourceStatisticsService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IJournalService;
......@@ -122,6 +123,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
@Autowired
private RelationRedisUtil relationRedisUtil;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Override
@Transactional(rollbackFor = {Exception.class})
public StockBill in(List<StockDetail> list, String type, AgencyUserModel agencyUserModel) {
......@@ -284,7 +287,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
@Override
@Transactional(rollbackFor = Exception.class)
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");
List<EquipmentSpecific> list = new ArrayList<>();
if (equipmentDetailDownloadVOS.size() == 0) {
......
......@@ -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.service.impl.ServiceImpl;
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.dto.VideoDTO;
import com.yeejoin.equipmanage.common.entity.dto.VideoSaveDto;
......@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -201,7 +203,17 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override
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
......
......@@ -87,7 +87,8 @@
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 = '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
`wl_form_instance` a
LEFT JOIN wl_source_scene wlss ON wlss.source_id = a.instance_id
......@@ -116,7 +117,9 @@
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 = '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
`wl_form_instance` a
GROUP BY
......@@ -129,6 +132,9 @@
<if test="query.fieldValue != null and query.fieldValue !=''">
AND sa.fieldValue = #{query.fieldValue}
</if>
<if test="query.bizOrgCode != null and query.bizOrgCode !=''">
AND sa.bizOrgCode LIKE CONCAT(#{query.bizOrgCode},'%')
</if>
</where>
ORDER BY sa.instanceId DESC
</select>
......
......@@ -48,7 +48,13 @@
and wlv.type_code like concat('%',#{video.typeCode},'%')
</if>
<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>
group by wlv.id
order by wlv.create_date desc
......
......@@ -2435,5 +2435,55 @@
ALTER TABLE `cb_water_resource` add column `biz_org_name` varchar(104) DEFAULT NULL COMMENT '机构/部门名称';
</sql>
</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>
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