Commit 3810a950 authored by 吴江's avatar 吴江

去掉s_表

parent b21acf0b
...@@ -45,7 +45,7 @@ public class AccidentTypeController extends BaseController { ...@@ -45,7 +45,7 @@ public class AccidentTypeController extends BaseController {
public CommonResponse queryRiskLevelPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, public CommonResponse queryRiskLevelPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> list = iAccidentTypeService.queryAccidentTypePage(param); Page<HashMap<String, Object>> list = iAccidentTypeService.queryAccidentTypePage(getToken(),getProduct(),getAppKey(),param);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
......
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.yeejoin.amos.fas.business.param.ImgParam; import com.yeejoin.amos.fas.business.param.ImgParam;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.vo.ReginParams; import com.yeejoin.amos.fas.business.vo.ReginParams;
...@@ -12,25 +28,10 @@ import com.yeejoin.amos.fas.core.util.StringUtil; ...@@ -12,25 +28,10 @@ import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.Equipment; import com.yeejoin.amos.fas.dao.entity.Equipment;
import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment; import com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment;
import com.yeejoin.amos.fas.dao.entity.PreplanPicture; import com.yeejoin.amos.fas.dao.entity.PreplanPicture;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/impEquip") @RequestMapping(value = "/api/impEquip")
...@@ -249,7 +250,7 @@ public class EquipmentController extends BaseController { ...@@ -249,7 +250,7 @@ public class EquipmentController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "重点装备详情", notes = "重点装备详情") @ApiOperation(httpMethod = "GET", value = "重点装备详情", notes = "重点装备详情")
@GetMapping(value = "/detail/{equipmentId}", produces = "application/json;charset=UTF-8") @GetMapping(value = "/detail/{equipmentId}", produces = "application/json;charset=UTF-8")
public CommonResponse findEquipDetail(@PathVariable Long equipmentId) { public CommonResponse findEquipDetail(@PathVariable Long equipmentId) {
return CommonResponseUtil.success(iEquipService.findEquipDetailsById(equipmentId)); return CommonResponseUtil.success(iEquipService.findEquipDetailsById(getToken(),getProduct(),getAppKey(),equipmentId));
} }
/** /**
......
...@@ -91,7 +91,7 @@ public class FireSourceController extends BaseController { ...@@ -91,7 +91,7 @@ public class FireSourceController extends BaseController {
@RequestMapping(value = "/fire-car/det/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/fire-car/det/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryFireCar(@ApiParam(value = "查询条件", required = true) @PathVariable Long id) { public CommonResponse queryFireCar(@ApiParam(value = "查询条件", required = true) @PathVariable Long id) {
FireCarDetailVo car = fireCarService.findFireCarById(id); FireCarDetailVo car = fireCarService.findFireCarById(getToken(),getProduct(),getAppKey(),id);
return CommonResponseUtil.success(car); return CommonResponseUtil.success(car);
} }
......
...@@ -41,7 +41,7 @@ public class RiskFactorController extends BaseController { ...@@ -41,7 +41,7 @@ public class RiskFactorController extends BaseController {
public CommonResponse queryRiskFactorPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, public CommonResponse queryRiskFactorPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> list = iRiskFactorService.queryRiskFactorPage(param); Page<HashMap<String, Object>> list = iRiskFactorService.queryRiskFactorPage(getToken(),getProduct(),getAppKey(),param);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
......
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.param.AlarmParam; import java.util.ArrayList;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import java.util.HashMap;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService; import java.util.List;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService; import java.util.Map;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.service.model.ProtalDataRo;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -30,10 +20,21 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -30,10 +20,21 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import com.yeejoin.amos.fas.business.param.AlarmParam;
import java.util.HashMap; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import java.util.List; import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
import java.util.Map; import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.service.model.ProtalDataRo;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@RestController @RestController
@RequestMapping("/api/risksource") @RequestMapping("/api/risksource")
...@@ -484,7 +485,7 @@ public class RiskSourceController extends BaseController { ...@@ -484,7 +485,7 @@ public class RiskSourceController extends BaseController {
@ApiParam(value = "分页参数", required = true) @RequestParam Integer pageNumber, @ApiParam(value = "分页参数", required = true) @RequestParam Integer pageNumber,
@ApiParam(value = "分页参数", required = true) @RequestParam Integer pageSize) { @ApiParam(value = "分页参数", required = true) @RequestParam Integer pageSize) {
try { try {
Page<Map<String, Object>> list = riskSourceService.listFmeaPointInputitem(fmeaId, pageNumber, pageSize); Page<Map<String, Object>> list = riskSourceService.listFmeaPointInputitem(getToken(),getProduct(),getAppKey(),fmeaId, pageNumber, pageSize);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.google.common.base.Joiner;
import com.yeejoin.amos.fas.business.dao.mapper.AccidentTypeMapper; import com.yeejoin.amos.fas.business.dao.mapper.AccidentTypeMapper;
import com.yeejoin.amos.fas.business.dao.repository.IAccidentTypeDao; import com.yeejoin.amos.fas.business.dao.repository.IAccidentTypeDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IAccidentTypeService; import com.yeejoin.amos.fas.business.service.intfc.IAccidentTypeService;
import com.yeejoin.amos.fas.dao.entity.AccidentType; import com.yeejoin.amos.fas.dao.entity.AccidentType;
import com.yeejoin.amos.fas.dao.entity.RiskFactor; import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
@Service("accidentTypeService") @Service("accidentTypeService")
...@@ -30,7 +33,8 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService { ...@@ -30,7 +33,8 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService {
IAccidentTypeDao iAccidentTypeDao; IAccidentTypeDao iAccidentTypeDao;
@Autowired @Autowired
IRiskFactorDao iRiskFactorDao; IRiskFactorDao iRiskFactorDao;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Override @Override
public void detAccidentType(Long[] param) { public void detAccidentType(Long[] param) {
//1.校验 //1.校验
...@@ -72,29 +76,38 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService { ...@@ -72,29 +76,38 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService {
} }
@Override @Override
public Page<HashMap<String, Object>> queryAccidentTypePage(CommonPageInfoParam param) { public Page<HashMap<String, Object>> queryAccidentTypePage(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = accidentTypeMapper.countPageData(param); long total = accidentTypeMapper.countPageData(param);
List<HashMap<String, Object>> content = accidentTypeMapper.findAccidentTypePage(param); List<HashMap<String, Object>> content = accidentTypeMapper.findAccidentTypePage(param);
StringBuffer sb = new StringBuffer(); List<String> userIdList = new ArrayList<String>();
for(HashMap<String, Object> map : content) List<String> deptIdList = new ArrayList<String>();
{
sb.append(map.get("createBy"));
sb.append(map.get(","));
}
sb.deleteCharAt(sb.length()-1);
FeignClientResult<List<AgencyUserModel>> resultSec = Privilege.agencyUserClient.queryByIds(sb.toString());
for(HashMap<String, Object> map : content) for(HashMap<String, Object> map : content)
{ {
String userId =String.valueOf(map.get("createBy")) ; String userId = String.valueOf(map.get("createBy"));
for(AgencyUserModel user : resultSec.getResult()) String deptId = String.valueOf(map.get("deptId"));
if(userId!=null)
{ {
if(userId!=null&& userId.equals(user.getUserId())) userIdList.add(userId);
{
map.put("userName", user.getRealName());
break;
}
} }
if(deptId!=null)
{
deptIdList.add(deptId);
}
}
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
Map<String, String> userMap = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
}
List<LinkedHashMap> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdList));
Map<String, String> deptMap = new HashMap<String,String>();
for (int i = 0; i < depts.size(); i++) {
deptMap.put(depts.get(i).get("sequenceNbr").toString(), depts.get(i).get("departmentName").toString());
} }
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total); Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total);
return result; return result;
} }
......
...@@ -41,6 +41,7 @@ import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao; ...@@ -41,6 +41,7 @@ import com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao; import com.yeejoin.amos.fas.business.dao.repository.IFireEquipmentDao;
import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao; import com.yeejoin.amos.fas.business.dao.repository.IPreplanPictureDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.ImgParam; import com.yeejoin.amos.fas.business.param.ImgParam;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService; import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData; import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
...@@ -55,6 +56,8 @@ import com.yeejoin.amos.fas.dao.entity.PreplanPicture; ...@@ -55,6 +56,8 @@ import com.yeejoin.amos.fas.dao.entity.PreplanPicture;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
@Service("equipService") @Service("equipService")
public class EquipmentServiceImpl implements IEquipmentService { public class EquipmentServiceImpl implements IEquipmentService {
...@@ -99,6 +102,9 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -99,6 +102,9 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Value("${linux.img.path}") @Value("${linux.img.path}")
private String linuxImgPath; private String linuxImgPath;
@Autowired
private RemoteSecurityService remoteSecurityService;
public Equipment save(Equipment equipment) { public Equipment save(Equipment equipment) {
Long eqId = equipment.getId(); Long eqId = equipment.getId();
equipment = iEquipmentDao.saveAndFlush(equipment); equipment = iEquipmentDao.saveAndFlush(equipment);
...@@ -408,12 +414,23 @@ public class EquipmentServiceImpl implements IEquipmentService { ...@@ -408,12 +414,23 @@ public class EquipmentServiceImpl implements IEquipmentService {
} }
@Override @Override
public EquipDetailsResponse findEquipDetailsById(Long id) { public EquipDetailsResponse findEquipDetailsById(String toke,String product,String appKey,Long id) {
EquipDetailsResponse equipDetailsResponse = fireEquipMapper.findEquipDetailsById(id); EquipDetailsResponse equipDetailsResponse = fireEquipMapper.findEquipDetailsById(id);
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.queryByUserId(equipDetailsResponse.getUserId()); AgencyUserModel user = remoteSecurityService.getUserById(toke, product, appKey, equipDetailsResponse.getUserId());
AgencyUserModel user = feignClientResult.getResult();
equipDetailsResponse.setUsername(user.getRealName()); equipDetailsResponse.setUsername(user.getRealName());
equipDetailsResponse.setTel(user.getMobile()); equipDetailsResponse.setTel(user.getMobile());
if(user.getCompanys().get(0)!=null)
{
CompanyModel companyModel = user.getCompanys().get(0);
if(user.getCompanyDepartments().get(companyModel.getSequenceNbr())!=null)
{
List<DepartmentModel> departList = user.getCompanyDepartments().get(companyModel.getSequenceNbr());
if(!departList.isEmpty())
{
equipDetailsResponse.setDepName(departList.get(0).getDepartmentName());
}
}
}
return equipDetailsResponse; return equipDetailsResponse;
} }
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; import com.yeejoin.amos.fas.business.constants.FasConstant;
...@@ -11,19 +31,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IFireCarService; ...@@ -11,19 +31,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IFireCarService;
import com.yeejoin.amos.fas.business.vo.FireCarDetailVo; import com.yeejoin.amos.fas.business.vo.FireCarDetailVo;
import com.yeejoin.amos.fas.dao.entity.FireCar; import com.yeejoin.amos.fas.dao.entity.FireCar;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import org.apache.commons.collections.CollectionUtils; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.assertj.core.util.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.*;
@Service("fireCarService") @Service("fireCarService")
...@@ -109,8 +117,10 @@ public class FireCarServiceImpl implements IFireCarService { ...@@ -109,8 +117,10 @@ public class FireCarServiceImpl implements IFireCarService {
} }
@Override @Override
public FireCarDetailVo findFireCarById(Long truckId) { public FireCarDetailVo findFireCarById(String toke,String product,String appKey,Long truckId) {
FireCarDetailVo carVo = fireCarMapper.getFireCarDetailById(truckId); FireCarDetailVo carVo = fireCarMapper.getFireCarDetailById(truckId);
DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, carVo.getDeptId());
carVo.setDepartmentName(departmentModel.getDepartmentName());
return carVo; return carVo;
} }
......
package com.yeejoin.amos.fas.business.service.impl; package com.yeejoin.amos.fas.business.service.impl;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import com.google.common.base.Joiner;
import com.yeejoin.amos.fas.business.dao.mapper.RiskFactorMapper; import com.yeejoin.amos.fas.business.dao.mapper.RiskFactorMapper;
import com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper; import com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper;
import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao; import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao; import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService; import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
import com.yeejoin.amos.fas.dao.entity.Fmea; import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.fas.dao.entity.RiskFactor; import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Service("riskFactorService") @Service("riskFactorService")
public class RiskFactorServiceImpl implements IRiskFactorService { public class RiskFactorServiceImpl implements IRiskFactorService {
...@@ -37,31 +40,41 @@ public class RiskFactorServiceImpl implements IRiskFactorService { ...@@ -37,31 +40,41 @@ public class RiskFactorServiceImpl implements IRiskFactorService {
RiskSourceMapper riskSourceMapper; RiskSourceMapper riskSourceMapper;
@Autowired @Autowired
IRiskLevelDao iRiskLevelDao; IRiskLevelDao iRiskLevelDao;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Override @Override
public Page<HashMap<String, Object>> queryRiskFactorPage(CommonPageInfoParam param) { public Page<HashMap<String, Object>> queryRiskFactorPage(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = riskFactorMapper.countPageData(param); long total = riskFactorMapper.countPageData(param);
List<HashMap<String, Object>> content = riskFactorMapper.queryRiskFactorPage(param); List<HashMap<String, Object>> content = riskFactorMapper.queryRiskFactorPage(param);
StringBuffer sb = new StringBuffer(); List<String> userIdList = new ArrayList<String>();
List<String> deptIdList = new ArrayList<String>();
for(HashMap<String, Object> map : content) for(HashMap<String, Object> map : content)
{ {
sb.append(map.get("createBy")); String userId = String.valueOf(map.get("createBy"));
sb.append(map.get(",")); String deptId = String.valueOf(map.get("deptId"));
} if(userId!=null)
sb.deleteCharAt(sb.length()-1); {
FeignClientResult<List<AgencyUserModel>> resultSec = Privilege.agencyUserClient.queryByIds(sb.toString()); userIdList.add(userId);
for(HashMap<String, Object> map : content) }
{ if(deptId!=null)
String userId =String.valueOf(map.get("createBy")) ;
for(AgencyUserModel user : resultSec.getResult())
{ {
if(userId!=null&& userId.equals(user.getUserId())) deptIdList.add(deptId);
{
map.put("userName", user.getRealName());
break;
}
} }
} }
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
Map<String, String> userMap = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
}
List<LinkedHashMap> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdList));
Map<String, String> deptMap = new HashMap<String,String>();
for (int i = 0; i < depts.size(); i++) {
deptMap.put(depts.get(i).get("sequenceNbr").toString(), depts.get(i).get("departmentName").toString());
}
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total); Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total);
return result; return result;
} }
......
...@@ -6,6 +6,7 @@ import java.util.ArrayList; ...@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -39,6 +40,7 @@ import org.typroject.tyboot.component.cache.enumeration.CacheType; ...@@ -39,6 +40,7 @@ import org.typroject.tyboot.component.cache.enumeration.CacheType;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
...@@ -572,39 +574,44 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -572,39 +574,44 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
@Override @Override
public Page<Map<String, Object>> listFmeaPointInputitem(Long fmeaId, Integer pageNumber, Integer pageSize) { public Page<Map<String, Object>> listFmeaPointInputitem(String toke,String product,String appKey,Long fmeaId, Integer pageNumber, Integer pageSize) {
List<Map<String, Object>> content = Lists.newArrayList(); List<Map<String, Object>> content = Lists.newArrayList();
long total = fmeaPointInputitemMapper.countByFmeaId(fmeaId); long total = fmeaPointInputitemMapper.countByFmeaId(fmeaId);
if (total == 0L) { if (total == 0L) {
return new PageImpl<>(content, null, total); return new PageImpl<>(content, null, total);
} }
content = fmeaPointInputitemMapper.listByFmeaId(fmeaId, pageNumber, pageSize); content = fmeaPointInputitemMapper.listByFmeaId(fmeaId, pageNumber, pageSize);
StringBuffer sb = new StringBuffer(); List<String> userIdList = new ArrayList<String>();
for(Map<String, Object> map :content) List<String> deptIdList = new ArrayList<String>();
{ for(Map<String, Object> map : content)
if(map.get("userId")!=null) {
{ String userId = String.valueOf(map.get("userId"));
sb.append(map.get("userId")); String deptId = String.valueOf(map.get("deptId"));
sb.append(","); if(userId!=null)
}
}
sb.deleteCharAt(sb.length()-1);
FeignClientResult<List<AgencyUserModel>> result = Privilege.agencyUserClient.queryByIds(sb.toString());
for(Map<String, Object> map :content)
{
String userId =String.valueOf(map.get("userId")) ;
for(AgencyUserModel user : result.getResult())
{ {
if(userId!=null&& userId.equals(user.getUserId())) userIdList.add(userId);
{
map.put("username", user.getRealName());
map.put("tel", user.getMobile());
break;
}
} }
} if(deptId!=null)
{
deptIdList.add(deptId);
}
}
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
Map<String, String> userMap = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
userMap.put(users.get(i).getUserId()+"tel", users.get(i).getMobile());
}
List<LinkedHashMap> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdList));
Map<String, String> deptMap = new HashMap<String,String>();
for (int i = 0; i < depts.size(); i++) {
deptMap.put(depts.get(i).get("sequenceNbr").toString(), depts.get(i).get("departmentName").toString());
}
content.forEach(e -> {
e.put("username",userMap.get(e.get("userId")));
e.put("depName",deptMap.get(e.get("deptId")));
e.put("tel",userMap.get(e.get("deptId")+"tel"));
});
return new PageImpl<>(content, null, total); return new PageImpl<>(content, null, total);
} }
......
...@@ -2,12 +2,10 @@ package com.yeejoin.amos.fas.business.service.intfc; ...@@ -2,12 +2,10 @@ package com.yeejoin.amos.fas.business.service.intfc;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.dao.entity.AccidentType;
public interface IAccidentTypeService { public interface IAccidentTypeService {
...@@ -15,8 +13,9 @@ public interface IAccidentTypeService { ...@@ -15,8 +13,9 @@ public interface IAccidentTypeService {
void editAccidentType(HashMap<String, Object> map); void editAccidentType(HashMap<String, Object> map);
List<HashMap<String,Object>> queryAccidentType(String orgCode); List<HashMap<String, Object>> queryAccidentType(String orgCode);
Page<HashMap<String, Object>> queryAccidentTypePage(CommonPageInfoParam param); Page<HashMap<String, Object>> queryAccidentTypePage(String toke, String product, String appKey,
CommonPageInfoParam param);
} }
...@@ -88,7 +88,7 @@ public interface IEquipmentService { ...@@ -88,7 +88,7 @@ public interface IEquipmentService {
*/ */
List<Map<String, Object>> findEquipVideoList(); List<Map<String, Object>> findEquipVideoList();
EquipDetailsResponse findEquipDetailsById(Long id); EquipDetailsResponse findEquipDetailsById(String toke,String product,String appKey,Long id);
/** /**
* 获取所有重点装备 * 获取所有重点装备
......
...@@ -13,13 +13,10 @@ public interface IFireCarService { ...@@ -13,13 +13,10 @@ public interface IFireCarService {
Page<HashMap<String, Object>> queryFireCar(String toke,String product,String appKey,CommonPageInfoParam param); Page<HashMap<String, Object>> queryFireCar(String toke,String product,String appKey,CommonPageInfoParam param);
FireCarDetailVo findFireCarById(Long id); FireCarDetailVo findFireCarById(String toke,String product,String appKey,Long id);
FireCar save(FireCar fireCar); FireCar save(FireCar fireCar);
FireCar queryOne(Long id); FireCar queryOne(Long id);
String [] delete(String []idArray) throws Exception; String [] delete(String []idArray) throws Exception;
......
...@@ -14,7 +14,7 @@ public interface IRiskFactorService { ...@@ -14,7 +14,7 @@ public interface IRiskFactorService {
* @param param * @param param
* @return * @return
*/ */
Page<HashMap<String, Object>> queryRiskFactorPage(CommonPageInfoParam param); Page<HashMap<String, Object>> queryRiskFactorPage(String toke,String product,String appKey,CommonPageInfoParam param);
/** /**
* 危险因素查询不分页 * 危险因素查询不分页
*/ */
......
...@@ -64,7 +64,7 @@ public interface IRiskSourceService { ...@@ -64,7 +64,7 @@ public interface IRiskSourceService {
List<Map<String, Object>> listEquipmentPointById(Long fmeaId, Long importantEquipId, Long equipmentId, String equipmentPointName); List<Map<String, Object>> listEquipmentPointById(Long fmeaId, Long importantEquipId, Long equipmentId, String equipmentPointName);
Page<Map<String, Object>> listFmeaPointInputitem(Long fmeaId, Integer pageNumber, Integer pageSize); Page<Map<String, Object>> listFmeaPointInputitem(String toke,String product,String appKey,Long fmeaId, Integer pageNumber, Integer pageSize);
Page<Map<String, Object>> listFeamEquipmentPoint(Long fmeaId, Integer pageNumber, Integer pageSize); Page<Map<String, Object>> listFeamEquipmentPoint(Long fmeaId, Integer pageNumber, Integer pageSize);
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
count(1) AS total_num count(1) AS total_num
FROM FROM
f_accident_type a f_accident_type a
left join s_department c on a.dept_id = c.id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if> <if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if>
</trim> </trim>
...@@ -20,14 +19,12 @@ ...@@ -20,14 +19,12 @@
a.name, a.name,
a.influence, a.influence,
a.severity, a.severity,
c.id as deptId , a.dept_id as deptId ,
c.department_name as deptName,
a.create_by as createBy , a.create_by as createBy ,
a.create_date as createDate, a.create_date as createDate,
a.remark a.remark
FROM FROM
f_accident_type a f_accident_type a
left join s_department c on a.dept_id = c.id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if> <if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if>
</trim> </trim>
...@@ -44,8 +41,7 @@ ...@@ -44,8 +41,7 @@
a.name, a.name,
CONCAT(fem.influence,'-',fem.`describe`) as influence, CONCAT(fem.influence,'-',fem.`describe`) as influence,
fem.coefficient as severity, fem.coefficient as severity,
c.id as deptId , a.dept_id as deptId ,
c.department_name as deptName,
a.create_by as createBy , a.create_by as createBy ,
a.create_date as createDate, a.create_date as createDate,
a.evaluation_sid as evaluationSid, a.evaluation_sid as evaluationSid,
...@@ -53,7 +49,6 @@ ...@@ -53,7 +49,6 @@
FROM FROM
f_accident_type a f_accident_type a
left join f_evaluation_model fem on fem.id = a.evaluation_sid left join f_evaluation_model fem on fem.id = a.evaluation_sid
left join s_department c on a.dept_id = c.id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if> <if test="name!=null"> and a.name like concat(concat("%",#{name}),"%") </if>
</trim> </trim>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
a.remark, a.remark,
a.create_by createBy, a.create_by createBy,
date_format(a.create_date , '%Y-%m-%d %H:%i:%s') as createDate, date_format(a.create_date , '%Y-%m-%d %H:%i:%s') as createDate,
d.department_name AS departmentName,
a.performance_index AS performanceIndex, a.performance_index AS performanceIndex,
a.floor3d, a.floor3d,
a.org_code AS orgCode, a.org_code AS orgCode,
...@@ -36,7 +35,6 @@ ...@@ -36,7 +35,6 @@
rs.name riskSourceName rs.name riskSourceName
FROM FROM
f_fire_car a f_fire_car a
LEFT JOIN s_department d ON d.id = a.dept_id
LEFT JOIN f_risk_source rs on rs.id = a.risk_source_id LEFT JOIN f_risk_source rs on rs.id = a.risk_source_id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and (a.name like concat(concat("%",#{name}),"%") or a.type like concat(concat("%",#{name}),"%"))</if> <if test="name!=null"> and (a.name like concat(concat("%",#{name}),"%") or a.type like concat(concat("%",#{name}),"%"))</if>
...@@ -65,7 +63,6 @@ ...@@ -65,7 +63,6 @@
a.create_date, a.create_date,
'%Y-%m-%d %H:%i:%s' '%Y-%m-%d %H:%i:%s'
) AS createDate, ) AS createDate,
d.department_name AS departmentName,
a.performance_index AS performanceIndex, a.performance_index AS performanceIndex,
a.floor3d, a.floor3d,
a.is_indoor as isIndoor, a.is_indoor as isIndoor,
...@@ -75,7 +72,6 @@ ...@@ -75,7 +72,6 @@
a.risk_source_id as riskSourceId a.risk_source_id as riskSourceId
FROM FROM
f_fire_car a f_fire_car a
LEFT JOIN s_department d ON d.id = a.dept_id
WHERE 1=1 WHERE 1=1
<if test="truckId!=null"> AND a.id = #{truckId}</if> <if test="truckId!=null"> AND a.id = #{truckId}</if>
</select> </select>
......
...@@ -297,11 +297,9 @@ ...@@ -297,11 +297,9 @@
eq.`code`, eq.`code`,
eq.address, eq.address,
fs.`name` stationName, fs.`name` stationName,
sd.department_name depName,
eq.charge_user_id userId eq.charge_user_id userId
FROM FROM
f_equipment eq f_equipment eq
LEFT JOIN s_department sd ON sd.id = su.department_id
LEFT JOIN f_fire_station fs ON fs.id = eq.fire_station_id LEFT JOIN f_fire_station fs ON fs.id = eq.fire_station_id
WHERE 1=1 WHERE 1=1
<if test="id!=null">AND eq.id = #{id}</if> <if test="id!=null">AND eq.id = #{id}</if>
......
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
p_input_item as pii on pii.id = b.input_item_id p_input_item as pii on pii.id = b.input_item_id
left join left join
p_point as pp on pp.id = b.point_id p_point as pp on pp.id = b.point_id
left join
s_department as sd on sd.id = pp.charge_dept_id
where where
a.fmea_id = #{fmeaId} a.fmea_id = #{fmeaId}
group by b.point_id group by b.point_id
...@@ -72,8 +70,8 @@ ...@@ -72,8 +70,8 @@
pp.id as pointId, pp.id as pointId,
pp.point_no as pointNo, pp.point_no as pointNo,
pp.name as pointName, pp.name as pointName,
sd.department_name as depName,
pp.charge_person_id as userId, pp.charge_person_id as userId,
pp.charge_dept_id as deptId,
group_concat(concat(pii.name, '##', a.state) SEPARATOR <![CDATA[ '\n' ]]>) as inputItems group_concat(concat(pii.name, '##', a.state) SEPARATOR <![CDATA[ '\n' ]]>) as inputItems
from from
f_fmea_point_inputitem a f_fmea_point_inputitem a
...@@ -83,8 +81,6 @@ ...@@ -83,8 +81,6 @@
p_input_item as pii on pii.id = b.input_item_id p_input_item as pii on pii.id = b.input_item_id
left join left join
p_point as pp on pp.id = b.point_id p_point as pp on pp.id = b.point_id
left join
s_department as sd on sd.id = pp.charge_dept_id
where where
a.fmea_id = #{fmeaId} a.fmea_id = #{fmeaId}
group by b.point_id group by b.point_id
......
...@@ -20,14 +20,12 @@ ...@@ -20,14 +20,12 @@
a.accident_type_id as accidentTypeId, a.accident_type_id as accidentTypeId,
d.name as accidentName, d.name as accidentName,
a.type, a.type,
a.dept_id as deptId, a.dept_id as deptId,,
c.department_name as deptName,
a.create_by as createBy, a.create_by as createBy,
a.create_date as createDate, a.create_date as createDate,
a.remark a.remark
FROM FROM
f_risk_factor a f_risk_factor a
left join s_department c on a.dept_id = c.id
left join f_accident_type d on a.accident_type_id = d.id left join f_accident_type d on a.accident_type_id = d.id
<trim prefix="WHERE" prefixOverrides="AND "> <trim prefix="WHERE" prefixOverrides="AND ">
<if test="name!=null"> and a.name like concat(concat("%",#{name}),"%")</if> <if test="name!=null"> and a.name like concat(concat("%",#{name}),"%")</if>
......
...@@ -331,15 +331,13 @@ ...@@ -331,15 +331,13 @@
pp.id pointId, pp.id pointId,
pp.point_no pointNo, pp.point_no pointNo,
pp.`name` pointName, pp.`name` pointName,
sd.department_name depName,
pp.charge_person_id userId, pp.charge_person_id userId,
pp.charge_dept_id deptId,
GROUP_CONCAT(pii.`name`) inputItems GROUP_CONCAT(pii.`name`) inputItems
FROM FROM
`f_risk_source_point_inputitem` rspi `f_risk_source_point_inputitem` rspi
LEFT JOIN p_point pp ON pp.id = rspi.point_id LEFT JOIN p_point pp ON pp.id = rspi.point_id
LEFT JOIN p_input_item pii ON pii.id = rspi.point_inputitem_id LEFT JOIN p_input_item pii ON pii.id = rspi.point_inputitem_id
LEFT JOIN s_user su ON su.id = pp.charge_person_id
LEFT JOIN s_department sd ON sd.id = pp.charge_dept_id
WHERE pii.`name` is not NULL WHERE pii.`name` is not NULL
AND rspi.risk_source_id = #{riskSourceId} AND rspi.risk_source_id = #{riskSourceId}
GROUP BY riskId,pointId,pointNo,pointName,depName,username,telephone GROUP BY riskId,pointId,pointNo,pointName,depName,username,telephone
......
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