Commit 6b672855 authored by lisong's avatar lisong

更新

parent c07939bc
...@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.tcm.api.mapper; ...@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing; import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface TzsTwoStaffingMapper extends BaseMapper<TzsTwoStaffing> { public interface TzsTwoStaffingMapper extends BaseMapper<TzsTwoStaffing> {
List<TzsTwoStaffing> getListByOrgCode(@Param("orgCode")String orgCode, @Param("type")String type);
} }
package com.yeejoin.amos.boot.module.tcm.api.service; package com.yeejoin.amos.boot.module.tcm.api.service;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import java.util.LinkedHashMap;
import java.util.List;
/** /**
* 接口类 * 接口类
* *
...@@ -9,4 +14,5 @@ package com.yeejoin.amos.boot.module.tcm.api.service; ...@@ -9,4 +14,5 @@ package com.yeejoin.amos.boot.module.tcm.api.service;
*/ */
public interface ITzsTwoStaffingService { public interface ITzsTwoStaffingService {
List<TzsTwoStaffing> getStatisticsMessage(List<LinkedHashMap> list);
} }
...@@ -2,4 +2,7 @@ ...@@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper">
<select id="getListByOrgCode" resultType="com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing">
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.tcm.biz.controller; package com.yeejoin.amos.boot.module.tcm.biz.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService; import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService;
import com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsUserInfoServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@RestController @RestController
@Api(tags = "统计") @Api(tags = "统计")
...@@ -15,4 +33,23 @@ public class TzsTwoStaffingController extends BaseController { ...@@ -15,4 +33,23 @@ public class TzsTwoStaffingController extends BaseController {
@Autowired @Autowired
private ITzsTwoStaffingService tzsTwoStaffingService; private ITzsTwoStaffingService tzsTwoStaffingService;
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@Autowired
private TzsUserInfoServiceImpl tzsUserInfoServiceImpl;
@Autowired
RedisUtils redisUtils;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "通过组id查询组及组内人员信息", notes = "通过组id查询组及组内人员信息")
public ResponseModel<Object> getGroupAndPersonInfo(@RequestParam("sequenceNbr") String sequenceNbr) {
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>();
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
return ResponseHelper.buildResponse(tzsTwoStaffingService.getStatisticsMessage(list));
}
} }
...@@ -330,7 +330,7 @@ public class TzsUserInfoController extends BaseController { ...@@ -330,7 +330,7 @@ public class TzsUserInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTree") @GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "通过组id查询组及组内人员信息", notes = "通过组id查询组及组内人员信息") @ApiOperation(httpMethod = "GET", value = "根据当前登录人获取监管机构", notes = "根据当前登录人获取监管机构")
public ResponseModel<Object> getGroupAndPersonInfo() { public ResponseModel<Object> getGroupAndPersonInfo() {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(reginParams)) { if (ObjectUtils.isEmpty(reginParams)) {
...@@ -339,27 +339,8 @@ public class TzsUserInfoController extends BaseController { ...@@ -339,27 +339,8 @@ public class TzsUserInfoController extends BaseController {
Long id = reginParams.getCompany().getSequenceNbr(); Long id = reginParams.getCompany().getSequenceNbr();
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE); List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>(); ArrayList<LinkedHashMap> result = new ArrayList<>();
return ResponseHelper.buildResponse(screenData(result, data, id.toString())); return ResponseHelper.buildResponse(tzsUserInfoServiceImpl.screenData(result, data, id.toString()));
} }
private List<LinkedHashMap> screenData(List<LinkedHashMap> result, List<LinkedHashMap> data, String id) {
if (!ObjectUtils.isEmpty(result)) {
return result;
}
List<LinkedHashMap> list = data.stream().filter(item -> item.get("sequenceNbr").toString().equals(id)).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(list)) {
return list;
}
for (LinkedHashMap item : data) {
if (!ObjectUtils.isEmpty(item.get("children"))) {
List<LinkedHashMap> children = screenData(result, (List<LinkedHashMap>) item.get("children"), id);
if (!ObjectUtils.isEmpty(children)) {
result = children;
break;
}
}
}
return result;
}
} }
...@@ -4,9 +4,14 @@ import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing; ...@@ -4,9 +4,14 @@ import com.yeejoin.amos.boot.module.tcm.api.entity.TzsTwoStaffing;
import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper; import com.yeejoin.amos.boot.module.tcm.api.mapper.TzsTwoStaffingMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService; import com.yeejoin.amos.boot.module.tcm.api.service.ITzsTwoStaffingService;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto; import com.yeejoin.amos.boot.module.tcm.api.dto.TzsTwoStaffingDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -30,4 +35,28 @@ public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto,Tzs ...@@ -30,4 +35,28 @@ public class TzsTwoStaffingServiceImpl extends BaseService<TzsTwoStaffingDto,Tzs
public List<TzsTwoStaffingDto> queryForTzsTwoStaffingList() { public List<TzsTwoStaffingDto> queryForTzsTwoStaffingList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
@Override
public List<TzsTwoStaffing> getStatisticsMessage(List<LinkedHashMap> list) {
ArrayList<TzsTwoStaffing> tzsTwoStaffings = new ArrayList<>();
List<LinkedHashMap> supervisory = treeToList(new ArrayList<>(), list);
for (LinkedHashMap map : supervisory) {
TzsTwoStaffing tzsTwoStaffing = new TzsTwoStaffing();
tzsTwoStaffing.setSupervisoryUnitId(String.valueOf(map.get("sequenceNbr")));
tzsTwoStaffing.setSupervisoryUnitName(String.valueOf(map.get("companyName")));
tzsTwoStaffing.setSupervisoryUnitOrgcode(String.valueOf(map.get("orgCode")));
tzsTwoStaffings.add(tzsTwoStaffing);
}
return tzsTwoStaffings;
}
private List<LinkedHashMap> treeToList(List<LinkedHashMap> result, List<LinkedHashMap> list){
if (!ObjectUtils.isEmpty(list) && !ObjectUtils.isEmpty(list.get(0).get("children"))){
result.addAll((List<LinkedHashMap>)list.get(0).get("children"));
}else {
result.add(list.get(0));
}
return result;
}
} }
\ No newline at end of file
...@@ -524,4 +524,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI ...@@ -524,4 +524,25 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
} }
} }
public List<LinkedHashMap> screenData(List<LinkedHashMap> result, List<LinkedHashMap> data, String id) {
if (!ObjectUtils.isEmpty(result)) {
return result;
}
List<LinkedHashMap> list = data.stream().filter(item -> item.get("sequenceNbr").toString().equals(id)).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(list)) {
return list;
}
for (LinkedHashMap item : data) {
if (!ObjectUtils.isEmpty(item.get("children"))) {
List<LinkedHashMap> children = screenData(result, (List<LinkedHashMap>) item.get("children"), id);
if (!ObjectUtils.isEmpty(children)) {
result = children;
break;
}
}
}
return result;
}
} }
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