Commit 3e53f8b8 authored by DESKTOP-BQLVS7A\admin's avatar DESKTOP-BQLVS7A\admin

增加管辖机构和管辖区域接口

parent 61e3cf46
package com.yeejoin.amos.boot.module.ugp.api.service;
/**
* 管辖单位和管辖区域
*/
public interface IUnitPersonService {
}
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.UnitPersonServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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;
@RestController
@Api(tags = "企业信息表")
@RequestMapping(value = "/UnitPerson")
public class UnitPersonController extends BaseController {
@Autowired
UnitPersonServiceImpl unitPersonServiceimpl;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/unitInformation")
@ApiOperation(httpMethod = "GET",value="获取管辖单位",notes = "获取管辖单位")
public ResponseModel<String> selectUnit(){
return ResponseHelper.buildResponse(unitPersonServiceimpl.selectUnit());
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IUnitPersonService;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class UnitPersonServiceImpl implements IUnitPersonService {
@Autowired
OrgServiceImpl orgService;
@Autowired
CompanyMapper companyMapper;
@Autowired
SuperviseRuleMapper superviseRuleMapper;
@BusinessIdentify
public String selectUnit() {
Long companySequenceNbr = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
Company companyInformation = companyMapper.selectById(companySequenceNbr);
String companyKey = companyInformation.getType();
String regionCode = companyInformation.getRegionCode();
String unitName = "";
if (companyKey.equals(OrgEnum.安装单位.getKey()) || companyKey.equals(OrgEnum.设计单位.getKey()) || companyKey.equals(OrgEnum.建设单位.getKey())) {
LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Company::getRegionCode, regionCode);
List<Company> codeLists = companyMapper.selectList(wrapper);
for (Company codeList : codeLists) {
LambdaQueryWrapper<SuperviseRule> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(SuperviseRule::getAdminRegionCode, codeList.getRegionCode());
List<SuperviseRule> superviseRuleLists = superviseRuleMapper.selectList(wrapper1);
for (SuperviseRule superviseRuleList : superviseRuleLists) {
LambdaQueryWrapper<Company> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(Company::getSequenceNbr, superviseRuleList.getSuperviseDeptId());
List<Company> companyNames = companyMapper.selectList(wrapper2);
for (Company companyName : companyNames) {
unitName = companyName.getName();
}
}
}
} else if (companyKey.equals(OrgEnum.监察部门.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getSuperviseDeptId, companySequenceNbr);
List<SuperviseRule> adminRegions = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule adminRegion : adminRegions) {
// unitName = String.join("、", String.valueOf(adminRegion.getAdminRegion()));
if (!ValidationUtil.isEmpty(adminRegion.getAdminRegion())) {
if(unitName.equals("")){
unitName = unitName.concat(adminRegion.getAdminRegion());
}
unitName = unitName.concat("、"+adminRegion.getAdminRegion());
}
}
} else if (companyKey.equals(OrgEnum.监检机构.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getInspectionUnitId, companySequenceNbr);
List<SuperviseRule> adminRegions = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule adminRegion : adminRegions) {
if (!ValidationUtil.isEmpty(adminRegion.getAdminRegion())){
unitName=unitName.concat(adminRegion.getAdminRegion()+"、");
}
}
}
return unitName;
}
}
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