Commit 0681b859 authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/dev_upgrade' into dev_upgrade

parents 1b136b63 cad29b4e
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.service.intfc.IDictService; import com.yeejoin.amos.fas.business.service.intfc.IDictService;
import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService; import com.yeejoin.amos.fas.business.service.intfc.IEmergencyTaskService;
import com.yeejoin.amos.fas.business.vo.EmergencyRelationVo;
import com.yeejoin.amos.fas.core.common.request.CommonPageable; import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.dao.entity.Dict; import com.yeejoin.amos.fas.dao.entity.Dict;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelation; import com.yeejoin.amos.fas.dao.entity.EmergencyRelation;
import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree; import com.yeejoin.amos.fas.dao.entity.EmergencyRelationTree;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
...@@ -15,6 +19,7 @@ import io.swagger.annotations.Api; ...@@ -15,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -29,6 +34,8 @@ import java.util.stream.Collectors; ...@@ -29,6 +34,8 @@ import java.util.stream.Collectors;
public class EmergencyTaskController extends BaseController{ public class EmergencyTaskController extends BaseController{
@Autowired @Autowired
JcsFeign jcsFeign;
@Autowired
IEmergencyTaskService iEmergencyTaskService; IEmergencyTaskService iEmergencyTaskService;
@Autowired @Autowired
private IDictService dictService; private IDictService dictService;
...@@ -50,7 +57,13 @@ public class EmergencyTaskController extends BaseController{ ...@@ -50,7 +57,13 @@ public class EmergencyTaskController extends BaseController{
tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList())); tree.setChildren(treeNodes.stream().filter(t->t.getObligationId().equals(e.getId())).collect(Collectors.toList()));
list.add(tree); list.add(tree);
}); });
return CommonResponseUtil.success(list); EmergencyRelationTree tree = new EmergencyRelationTree();
tree.setId(0);
tree.setName("全部");
tree.setType("3");
tree.setCode("0");
tree.setChildren(list);
return CommonResponseUtil.success(tree);
} }
...@@ -61,6 +74,9 @@ public class EmergencyTaskController extends BaseController{ ...@@ -61,6 +74,9 @@ public class EmergencyTaskController extends BaseController{
if (pageNumber >=1 ){ if (pageNumber >=1 ){
pageNumber = pageNumber -1 ; pageNumber = pageNumber -1 ;
} }
if(obligationId == 0){
obligationId = null;
}
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize); CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId,commonPageable); Page<EmergencyTaskContent> list = iEmergencyTaskService.list(obligationId,commonPageable);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
...@@ -77,12 +93,58 @@ public class EmergencyTaskController extends BaseController{ ...@@ -77,12 +93,58 @@ public class EmergencyTaskController extends BaseController{
@ApiOperation(httpMethod = "POST",value = "新增树人员节点", notes = "新增树人员节点") @ApiOperation(httpMethod = "POST",value = "新增树人员节点", notes = "新增树人员节点")
@PostMapping(value = "/savePerson", produces = "application/json;charset=UTF-8") @PostMapping(value = "/savePerson", produces = "application/json;charset=UTF-8")
public CommonResponse savePerson(@RequestBody EmergencyRelation emergencyRelation){ public CommonResponse savePerson(@RequestBody EmergencyRelationVo vo){
iEmergencyTaskService.save(emergencyRelation); List<Long> personIds = vo.getPersonIds();
emergencyRelation.setCreateDate(new Date()); List<Object> objects = jcsFeign.listCompanyByIds(personIds);
objects.forEach(e->
{
String json = JSONObject.toJSONString(e);
JSONObject jsonObject = JSONObject.parseObject(json);
EmergencyRelation emergencyRelation = new EmergencyRelation();
emergencyRelation.setObligationId(vo.getObligationId());
emergencyRelation.setPersonId(Long.valueOf(jsonObject.get("sequenceNbr").toString()));
emergencyRelation.setPersonName(jsonObject.get("bizOrgName").toString());
emergencyRelation.setAmosOrgId(Long.valueOf(jsonObject.get("amosOrgId").toString()));
emergencyRelation.setCreateDate(new Date());
iEmergencyTaskService.save(emergencyRelation);
}
);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
@ApiOperation(httpMethod = "POST",value = "编辑树人员节点", notes = "编辑树人员节点")
@PostMapping(value = "/editPerson", produces = "application/json;charset=UTF-8")
public CommonResponse editPerson(@RequestBody EmergencyRelationVo vo){
this.deleteTreeNode(vo.getObligationId(), null);
List<Long> personIds = vo.getPersonIds();
List<Object> objects = jcsFeign.listCompanyByIds(personIds);
objects.forEach(e->
{
String json = JSONObject.toJSONString(e);
JSONObject jsonObject = JSONObject.parseObject(json);
EmergencyRelation emergencyRelation = new EmergencyRelation();
emergencyRelation.setObligationId(vo.getObligationId());
emergencyRelation.setPersonId(Long.valueOf(jsonObject.get("sequenceNbr").toString()));
emergencyRelation.setPersonName(jsonObject.get("bizOrgName").toString());
emergencyRelation.setAmosOrgId(Long.valueOf(jsonObject.get("amosOrgId").toString()));
emergencyRelation.setCreateDate(new Date());
iEmergencyTaskService.save(emergencyRelation);
}
);
return CommonResponseUtil.success();
}
@ApiOperation(httpMethod = "GET",value = "获取当前节点绑定人员", notes = "获取当前节点绑定人员")
@RequestMapping(value = "/getPersons", method = RequestMethod.GET)
public CommonResponse getPersons(@RequestParam Long obligationId){
EmergencyRelationVo emergencyRelationVo = new EmergencyRelationVo();
emergencyRelationVo.setPersonIds(iEmergencyTaskService.getPersonIds(obligationId));
return CommonResponseUtil.success(emergencyRelationVo);
}
} }
...@@ -18,5 +18,8 @@ public interface EmergencyTaskMapper extends BaseMapper { ...@@ -18,5 +18,8 @@ public interface EmergencyTaskMapper extends BaseMapper {
List<String> roleCodes(String amosOrgId); List<String> roleCodes(String amosOrgId);
List<Long> getPersonIds(Long obligationId);
List<String> roleNames(String amosOrgId); List<String> roleNames(String amosOrgId);
} }
...@@ -6,6 +6,8 @@ import com.yeejoin.amos.fas.core.util.ResponseModel; ...@@ -6,6 +6,8 @@ import com.yeejoin.amos.fas.core.util.ResponseModel;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 消息推送 * 消息推送
...@@ -34,5 +36,8 @@ public interface JcsFeign { ...@@ -34,5 +36,8 @@ public interface JcsFeign {
*/ */
@RequestMapping(value = "/jcs/common/duty-person/person/on_duty/list", method = RequestMethod.GET,consumes = "application/json") @RequestMapping(value = "/jcs/common/duty-person/person/on_duty/list", method = RequestMethod.GET,consumes = "application/json")
ResponseModel dutyPersonList(); ResponseModel dutyPersonList();
@RequestMapping(value = "/jcs//org-person/listCompanyByIds", method = RequestMethod.GET,consumes = "application/json")
List<Object> listCompanyByIds(@RequestParam List<Long> ids);
} }
...@@ -58,4 +58,10 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService { ...@@ -58,4 +58,10 @@ public class EmergencyTaskServiceImpl implements IEmergencyTaskService {
String roleNames = String.join(",", list); String roleNames = String.join(",", list);
return roleNames; return roleNames;
} }
@Override
public List<Long> getPersonIds(Long obligationId) {
return emergencyTaskMapper.getPersonIds(obligationId);
}
} }
...@@ -21,6 +21,8 @@ public interface IEmergencyTaskService { ...@@ -21,6 +21,8 @@ public interface IEmergencyTaskService {
String getRolesByUserId(String userId); String getRolesByUserId(String userId);
List<Long> getPersonIds(Long obligationId);
String getRolesNameByUserId(String userId); String getRolesNameByUserId(String userId);
} }
package com.yeejoin.amos.fas.business.vo;
import lombok.Data;
import java.util.List;
@Data
public class EmergencyRelationVo {
//职责id
private Long obligationId;
//人员id
private List<Long> personIds;
}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
FROM FROM
c_emergency_task_content c_emergency_task_content
<where> <where>
<if test="_parameter != null "> <if test="obligationId != null ">
obligation_id = #{obligationId} obligation_id = #{obligationId}
</if> </if>
</where> </where>
...@@ -57,30 +57,50 @@ ...@@ -57,30 +57,50 @@
cer.amos_id = #{amosOrgId} cer.amos_id = #{amosOrgId}
</if> </if>
</where> </where>
</select> </select>
<select id="roleNames" resultType="string"> <select id="roleNames" resultType="string">
SELECT
f.dict_name AS dictName
FROM
c_emergency_relation cer LEFT JOIN f_dict f ON cer.obligationId = f.id
<where>
<if test="_parameter != null ">
cer.amos_id = #{amosOrgId}
</if>
</where>
</select>
<select id="getPersonIds" resultType="long">
SELECT SELECT
f.dict_name AS dictName cer.person_id AS persons
FROM FROM
c_emergency_relation cer LEFT JOIN f_dict f ON cer.obligationId = f.id c_emergency_relation cer
<where> <where>
<if test="_parameter != null "> <if test="_parameter != null ">
cer.amos_id = #{amosOrgId} cer.obligationId = #{obligationId}
</if> </if>
</where> </where>
</select> </select>
<delete id="deleteTreeNode"> <delete id="deleteTreeNode">
delete from c_emergency_relation where obligationId = #{obligationId} and person_id = #{personId} delete from c_emergency_relation cer
<where>
<if test="obligationId != null ">
cer.obligationId = #{obligationId}
</if>
<if test="personId != null ">
and cer.person_id = #{personId}
</if>
</where>
</delete> </delete>
<insert id="save" parameterType="com.yeejoin.amos.fas.dao.entity.EmergencyRelation"> <insert id="save" parameterType="com.yeejoin.amos.fas.dao.entity.EmergencyRelation">
INSERT INTO `c_emergency_relation`(id, `obligationId`, `person_id`, `amos_id`, `person_name`) INSERT INTO `c_emergency_relation`(id, `obligationId`, `person_id`, `amos_id`, `person_name`, `create_date`)
VALUES (#{id}, #{obligationId}, #{personId}, #{amosOrgId}, #{personName}); VALUES (#{id}, #{obligationId}, #{personId}, #{amosOrgId}, #{personName},#{createDate});
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
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