Commit b3862d90 authored by zhengjiawei's avatar zhengjiawei

bug

parent bd4d32c4
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.controller; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.yeejoin.amos.fas.business.dao.repository.IFmeaDao;
import com.yeejoin.amos.fas.exception.YeeException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -49,6 +51,9 @@ public class RiskModelController extends BaseController { ...@@ -49,6 +51,9 @@ public class RiskModelController extends BaseController {
@Autowired @Autowired
private IFmeaService fmeaService; private IFmeaService fmeaService;
@Autowired
private IFmeaDao iFmeaDao;
@Permission @Permission
@ApiOperation(value = "根据父类编号获取子类风险点类型", notes = "根据父类编号获取子类风险点类型") @ApiOperation(value = "根据父类编号获取子类风险点类型", notes = "根据父类编号获取子类风险点类型")
@GetMapping(value = "/riskSource/getChildTypeByPid") @GetMapping(value = "/riskSource/getChildTypeByPid")
...@@ -159,6 +164,12 @@ public class RiskModelController extends BaseController { ...@@ -159,6 +164,12 @@ public class RiskModelController extends BaseController {
@RequestMapping(value = "/fmea/editFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/fmea/editFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse editFmea(@ApiParam(value = "Fmea模型对象", required = true) @RequestBody List<Fmea> params) { public CommonResponse editFmea(@ApiParam(value = "Fmea模型对象", required = true) @RequestBody List<Fmea> params) {
try { try {
params.forEach(param -> {
int i = iFmeaDao.checkIdAndName(param.getRiskSourceId(), param.getRiskFactorsId());
if (i>0){
throw new YeeException("危险因素重复");
}
});
AgencyUserModel user = getUserInfo(); AgencyUserModel user = getUserInfo();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("user_id", user.getUserId()); map.put("user_id", user.getUserId());
......
...@@ -48,4 +48,7 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> { ...@@ -48,4 +48,7 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
@Query(value = "select * from `f_fmea` where id in ?1",nativeQuery = true) @Query(value = "select * from `f_fmea` where id in ?1",nativeQuery = true)
List<Fmea> findAllByRiskSourceIds(List<Long> ids); List<Fmea> findAllByRiskSourceIds(List<Long> ids);
@Query(value = "select count(1) from `f_fmea` where risk_source_id = ?1 and risk_factors_id = ?2",nativeQuery = true)
int checkIdAndName(Long sId,Long nId);
} }
...@@ -14,6 +14,8 @@ import com.yeejoin.amos.fas.dao.entity.RiskFactor; ...@@ -14,6 +14,8 @@ 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.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
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;
...@@ -44,14 +46,18 @@ public class RiskFactorServiceImpl implements IRiskFactorService { ...@@ -44,14 +46,18 @@ public class RiskFactorServiceImpl implements IRiskFactorService {
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);
if(!CollectionUtils.isEmpty(content)){ if(!CollectionUtils.isEmpty(content)){
List<DictionarieValueModel> typeNameList = Systemctl.dictionarieClient.dictValues("INDUSTRY_TYPE").getResult();
Map<String, String> typeName = typeNameList.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
Set<String> userIds = new HashSet<>(); Set<String> userIds = new HashSet<>();
Set<String> deptIds = new HashSet<>(); Set<String> deptIds = new HashSet<>();
for(HashMap<String, Object> map : content) for(HashMap<String, Object> map : content)
{ {
map.put("typeName",typeName.get(map.get("type")));
String userId = String.valueOf(map.get("createBy")); String userId = String.valueOf(map.get("createBy"));
String deptId = String.valueOf(map.get("deptId")); String deptId = String.valueOf(map.get("deptId"));
userIds.add(userId); userIds.add(userId);
deptIds.add(deptId); deptIds.add(deptId);
} }
userIds.remove(null); userIds.remove(null);
userIds.remove(""); userIds.remove("");
......
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