Commit daa85436 authored by tangwei's avatar tangwei

新增片区接口

parent e0ddf271
package com.yeejoin.amos.boot.module.jxiop.api.dto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import lombok.Data;
import java.util.Collection;
/**
* @description:
* @author: tw
* @createDate: 2023/4/25
*/
@Data
public class ListCompanyModel {
private String companyName;
private String companyCode;
private Long parentId;
private String orgCode;
private String companyType;
private Boolean disabled;
private Collection<ListCompanyModel> children;
private Long sequenceNbr;
}
......@@ -5,6 +5,7 @@ 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.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.ListCompanyModel;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
......@@ -56,18 +57,30 @@ public class PrivilegeController extends BaseController{
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subcompany")
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位、部门树", notes = "查询单位、子单位、部门树")
public ResponseModel< List<CompanyModel >> subcompany() {
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位", notes = "查询单位、子单位")
public ResponseModel< List<ListCompanyModel>> subcompany() {
//获取当前登录人单位
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long companyId=reginParams.getCompany().getSequenceNbr();
FeignClientResult<Collection<CompanyModel>> de =Privilege.companyClient.querySubAgencyTree(companyId);
CompanyModel companyModel=new CompanyModel();
companyModel.setSequenceNbr(companyId);
companyModel.setCompanyName(reginParams.getCompany().getCompanyName());
companyModel.setChildren(de.getResult());
List<CompanyModel > date=new ArrayList();
date.add(companyModel);
List<ListCompanyModel > date=new ArrayList();
if("area".equals(reginParams.getCompany().getLevel())){
ListCompanyModel companyModel=new ListCompanyModel();
companyModel.setSequenceNbr(companyId);
companyModel.setCompanyName(reginParams.getCompany().getCompanyName());
date.add(companyModel);
}else if("headquarter".equals(reginParams.getCompany().getLevel())){
FeignClientResult<Collection<CompanyModel>> de =Privilege.companyClient.querySubAgencyTree(companyId);
Collection<CompanyModel> dated= de.getResult();
for (CompanyModel companyModel : dated) {
if("area".equals(companyModel.getLevel())){
ListCompanyModel companyModeld=new ListCompanyModel();
companyModeld.setSequenceNbr(companyModel.getSequenceNbr());
companyModeld.setCompanyName(companyModel.getCompanyName());
date.add(companyModeld);
}
}
}
return ResponseHelper.buildResponse(date);
}
......
......@@ -8,9 +8,16 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IStationBasicService;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
......@@ -78,6 +85,15 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
@Transactional
public void add(StationBasic stationBasic) {
//平台增加场站
CompanyModel companyModeldata=new CompanyModel();
companyModeldata.setCompanyName(stationBasic.getStationName());
companyModeldata.setCompanyType("company");
companyModeldata.setLevel("station");
companyModeldata.setParentId(Long.valueOf(stationBasic.getArea()));
companyModeldata= this.addCompanyModel(companyModeldata);
//场站坐标信息
List<StationCoordinate> list= stationBasic.getStationCoordinate();
List<StationCoordinate> listdate=new ArrayList<>();
......@@ -88,7 +104,7 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
//单位
companyModel=personBasicServiceImpl.getCompanyModel(Long.parseLong(stationBasic.getArea()));
stationBasic.setAreaName(companyModel.getCompanyName());
stationBasic.setProjectOrgCode(companyModel.getOrgCode());
stationBasic.setProjectOrgCode(companyModeldata.getOrgCode());
//场站基本信息
this.save(stationBasic);
......@@ -104,7 +120,49 @@ public class StationBasicServiceImpl extends BaseService<StationBasicDto,Station
private CompanyModel addCompanyModel( CompanyModel companyModel) {
FeignClientResult<CompanyModel> Model =Privilege.companyClient.create(companyModel);
CompanyModel user=new CompanyModel();
if (!ObjectUtils.isEmpty(Model)) {
if(Model.getStatus()==200){
user = Model.getResult();
}else{
throw new RuntimeException(Model.getMessage());
}
}
return user;
}
private CompanyModel updateCompanyModel( CompanyModel companyModel,Long sequenceNbr) {
FeignClientResult<CompanyModel> Model =Privilege.companyClient.update(companyModel,sequenceNbr);
CompanyModel user=new CompanyModel();
if (!ObjectUtils.isEmpty(Model)) {
if(Model.getStatus()==200){
user = Model.getResult();
}else{
throw new RuntimeException(Model.getMessage());
}
}
return user;
}
public void update(StationBasic stationBasic) {
//平台增加场站
CompanyModel companyModeldata=new CompanyModel();
companyModeldata.setCompanyName(stationBasic.getStationName());
companyModeldata.setCompanyType("company");
companyModeldata.setLevel("station");
companyModeldata.setParentId(Long.valueOf(stationBasic.getArea()));
companyModeldata= this.updateCompanyModel(companyModeldata,);
//场站坐标信息
List<StationCoordinate> list= stationBasic.getStationCoordinate();
List<StationCoordinate> listdate=new ArrayList<>();
......
......@@ -30,6 +30,8 @@ spring.liquibase.enabled=true
## eureka properties:
eureka.instance.prefer-ip-address=true
eureka.instance.ip-address=172.16.3.41
eureka.client.registry-fetch-interval-seconds=5
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.lease-expiration-duration-in-seconds=10
......
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