Commit 5becc960 authored by helinlin's avatar helinlin

开发特种设备通讯录接口

parent fd5a5c89
......@@ -2,12 +2,13 @@ package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxUjerDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.IdxUjer;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IdxUjerMapper extends BaseMapper<IdxUjer> {
IPage<IdxUjer> getPage(IPage<IdxUjer> page, @Param("ids") List<String> ids, @Param("bizType") String bizType);
IPage<IdxUjerDto> getPage(IPage<IdxUjerDto> page, @Param("ids") List<String> ids, @Param("bizType") String bizType);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import lombok.Data;
@Data
public class IdxUjerDto {
private String businessName;
private byte[] businessAddress;
private String businessAddressStr;
private String contacts;
private String contactNumber;
private String companyId;
private String companyName;
private String bizType;
}
......@@ -12,7 +12,7 @@ import lombok.ToString;
@TableName("idx_biz_ujer")
public class IdxUjer extends IdxBaseEntity {
@TableField("businessName")
@TableField("business_name")
private String businessName;
@TableField("attachment")
......
......@@ -3,7 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.BizRecordCount;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.IdxUjer;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxUjerDto;
import java.util.List;
import java.util.Map;
......@@ -11,7 +11,7 @@ import java.util.Map;
public interface InspectionService {
IPage<IdxUjer> bizDetailList(String dimensionTableId, String selectValue, String bizType, int current, int size);
IPage<IdxUjerDto> bizDetailList(String dimensionTableId, String selectValue, String bizType, int current, int size);
List<Map<String, Object>> bizRecordCountByField(List<BizRecordCount> bizRecordCountList);
......
<?xml version="1.0" encoding="UTF-8"?>
<!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.tzs.api.mapper.IdxUjerMapper">
<select id="getPage" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.entity.IdxUjer">
<select id="getPage" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxUjerDto">
SELECT *, IF(b.id is null, '未建', '已建') as bizType
FROM idx_biz_odgu a
LEFT JOIN idx_biz_ujer b on a.companyId = b.companyId
......
......@@ -3,7 +3,7 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.BizRecordCount;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.IdxUjer;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxUjerDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.InspectionService;
import com.yeejoin.amos.component.feign.model.Page;
......@@ -45,14 +45,14 @@ public class InspectionController {
@GetMapping("/bizDetailList")
@ApiOperation(value = "检察任务填报详情")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<IPage<IdxUjer>> bizDetailList(
public ResponseModel<IPage<IdxUjerDto>> bizDetailList(
@RequestParam String dimensionTableId,
@RequestParam String selectValue,
@RequestParam(required = false) String bizType,
@RequestParam int current,
@RequestParam int size
) {
IPage<IdxUjer> page = inspectionService.bizDetailList(dimensionTableId, selectValue, bizType, current, size);
IPage<IdxUjerDto> page = inspectionService.bizDetailList(dimensionTableId, selectValue, bizType, current, size);
return ResponseHelper.buildResponse(page);
}
......
......@@ -9,7 +9,7 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.JsonValueUtils;
import com.yeejoin.amos.boot.module.tzs.api.mapper.IdxUjerMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.BizRecordCount;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.IdxUjer;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.IdxUjerDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.InspectionService;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -21,6 +21,8 @@ import org.apache.commons.lang.text.StrSubstitutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
......@@ -41,14 +43,37 @@ public class InspectionServiceImpl implements InspectionService {
JdbcTemplate bizJdbcTemplate;
@Override
public IPage<IdxUjer> bizDetailList(
public IPage<IdxUjerDto> bizDetailList(
String dimensionTableId,
String selectValue,
String bizType, int current, int size
) {
List<String> ids = idxFeignService.getTreeChildIds(dimensionTableId, selectValue).getResult();
IPage<IdxUjer> idxUjerPage = new Page<>(current, size);
return idxUjerMapper.getPage(idxUjerPage, ids, bizType);
List<String> companyIds = idxFeignService.getTreeChildIds(dimensionTableId, selectValue).getResult();
Collection<CompanyModel> companyModels = Privilege.companyClient.companyTreeWithoutAuth().getResult();
Map<String, String> companyMap = new HashMap<>();
convertCompanyTreeToMap(companyModels, companyMap);
IPage<IdxUjerDto> idxUjerPage = new Page<>(current, size);
IPage<IdxUjerDto> page = idxUjerMapper.getPage(idxUjerPage, companyIds, bizType);
List<IdxUjerDto> records = page.getRecords();
if (!CollectionUtils.isEmpty(records)) {
for (IdxUjerDto record : records) {
record.setBusinessAddressStr(record.getBusinessAddress() != null ? new String(record.getBusinessAddress()) : "");
record.setCompanyName(companyMap.get(record.getCompanyId()));
}
}
return page;
}
private void convertCompanyTreeToMap(Collection<CompanyModel> companyModels, Map<String, String> companyMap) {
if (!CollectionUtils.isEmpty(companyModels)) {
for (CompanyModel companyModel : companyModels) {
if (!ObjectUtils.isEmpty(companyModel)) {
companyMap.put(String.valueOf(companyModel.getSequenceNbr()), companyModel.getCompanyName());
Collection<CompanyModel> children = companyModel.getChildren();
convertCompanyTreeToMap(children, companyMap);
}
}
}
}
@Override
......@@ -120,7 +145,7 @@ public class InspectionServiceImpl implements InspectionService {
Collection<CompanyModel> result = Privilege.companyClient.queryAgencyTree(null).getResult();
JSONObject jsonObject = getParentCompanyName(JSONArray.parseArray(JSONArray.toJSONString(result)), companyId);
if (!ValidationUtil.isEmpty(jsonObject)){
if (!ValidationUtil.isEmpty(jsonObject)) {
String parentCompanyName = jsonObject.getString("companyName");
jsonObject.clear();
jsonObject.put("reconsiderOrgName", parentCompanyName + "/" + parentCompanyName.substring(0, parentCompanyName.indexOf("区") + 1) + "人民政府");
......
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