Commit e50a5968 authored by lisong's avatar lisong

修改bug

parent a36ff5a7
......@@ -19,6 +19,8 @@ public interface IHouseholdPvDistrictService extends IService<HouseholdPvDistric
List<CompanyTreeDto> getBusinessTree(Long parentId);
List<CompanyTreeDto> stationTree();
HouseholdPvDistrict treeAdd(Long parentId, String name);
HouseholdPvDistrict treeUpdate(Long id, String name);
......
......@@ -22,9 +22,7 @@
household_pv hp
LEFT JOIN household_pv_install hpi ON hp.sequence_nbr = hpi.household_pv_id
WHERE
hp.platform_company_id = #{id}
OR hp.district_id = #{id}
OR hpi.platform_company_id = #{id}
hp.district_id = #{id}
</select>
<select id="selectIds" resultType="java.lang.Long">
......
......@@ -125,7 +125,7 @@ public class HouseholdPvDistrictController extends BaseController {
@GetMapping(value = "/getTree")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "厂站树", notes = "厂站树")
@ApiOperation(httpMethod = "GET", value = "全量厂站树", notes = "全量厂站树")
public ResponseModel<Object> getTree() {
return ResponseHelper.buildResponse(householdPvDistrictService.getTree());
}
......@@ -138,6 +138,13 @@ public class HouseholdPvDistrictController extends BaseController {
return ResponseHelper.buildResponse(householdPvDistrictService.getBusinessTree(parentId));
}
@GetMapping(value = "/stationTree")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "厂站树", notes = "厂站树")
public ResponseModel<Object> stationTree() {
return ResponseHelper.buildResponse(householdPvDistrictService.stationTree());
}
/**
* 树节点新增
*
......@@ -152,6 +159,7 @@ public class HouseholdPvDistrictController extends BaseController {
String name = dto.get("name").toString();
LambdaQueryWrapper<HouseholdPvDistrict> lambda = new QueryWrapper<HouseholdPvDistrict>().lambda();
lambda.eq(HouseholdPvDistrict :: getName, name);
lambda.eq(HouseholdPvDistrict::getParentId, id);
Integer integer = householdPvDistrictService.getBaseMapper().selectCount(lambda);
if (integer > 0){
return CommonResponseUtil.failure("节点已存在!");
......@@ -171,8 +179,10 @@ public class HouseholdPvDistrictController extends BaseController {
Map<String, Object> dto = (Map<String, Object>)model.get("dto");
String id = dto.get("id").toString();
String name = dto.get("name").toString();
HouseholdPvDistrict householdPvDistrict = householdPvDistrictService.getBaseMapper().selectById(id);
LambdaQueryWrapper<HouseholdPvDistrict> lambda = new QueryWrapper<HouseholdPvDistrict>().lambda();
lambda.eq(HouseholdPvDistrict :: getName, name);
lambda.eq(HouseholdPvDistrict::getParentId, householdPvDistrict.getParentId());
lambda.ne(HouseholdPvDistrict :: getSequenceNbr, id);
Integer integer = householdPvDistrictService.getBaseMapper().selectCount(lambda);
if (integer > 0){
......
......@@ -127,6 +127,19 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
return list.stream().filter(a -> list.stream().noneMatch(c -> c.getId().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId(), list))).collect(Collectors.toList());
}
@Override
public List<CompanyTreeDto> stationTree() {
ArrayList<CompanyTreeDto> list = new ArrayList<>();
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long sequenceNbr = reginParams.getCompany().getSequenceNbr();
FeignClientResult<Collection<UserOrgTreeModel>> collectionFeignClientResult = Privilege.companyClient.queryOrgTree(sequenceNbr);
if (collectionFeignClientResult != null) {
Collection<UserOrgTreeModel> result = collectionFeignClientResult.getResult();
change(result, list);
}
return list.stream().filter(a -> list.stream().noneMatch(c -> c.getId().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId(), list))).collect(Collectors.toList());
}
private String getOrgCode(Long platformCompanyId) {
String bizOrgCode = null;
HouseholdPvDistrict parentDetail = householdPvDistrictMapper.selectById(platformCompanyId);
......
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvContactService
import com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvInstallService;
import com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvLeaseService;
import com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvService;
import com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponseUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
......@@ -145,13 +146,13 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
if (!ObjectUtils.isEmpty(item.getPlatformCompanyId())) {
if (map.containsKey(item.getPlatformCompanyId())) {
householdPv.setPlatformCompanyId(Long.parseLong(String.valueOf(map.get(item.getPlatformCompanyId()))));
householdPv.setBizOrgCode(getOrgCode(householdPv.getPlatformCompanyId()));
}
}
// 所属乡镇
if (!ObjectUtils.isEmpty(item.getDistrictId())) {
if (map.containsKey(item.getDistrictId())) {
householdPv.setDistrictId(Long.parseLong(String.valueOf(map.get(item.getDistrictId()))));
householdPv.setBizOrgCode(getOrgCode(householdPv.getDistrictId()));
}
}
householdPvs.add(householdPv);
......@@ -287,7 +288,7 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
BeanUtils.copyProperties(householdPvDto, householdPv);
// 默认状态为正常
householdPv.setLevel(LevelType.NORMAL.getName());
householdPv.setBizOrgCode(getOrgCode(householdPv.getPlatformCompanyId()));
householdPv.setBizOrgCode(getOrgCode(householdPv.getDistrictId()));
this.save(householdPv);
HouseholdPvContact householdPvContact = new HouseholdPvContact();
......@@ -312,7 +313,7 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
public HouseholdPvDto update(HouseholdPvDto householdPvDto) {
HouseholdPv householdPv = new HouseholdPv();
BeanUtils.copyProperties(householdPvDto, householdPv);
householdPv.setBizOrgCode(getOrgCode(householdPv.getPlatformCompanyId()));
householdPv.setBizOrgCode(getOrgCode(householdPv.getDistrictId()));
this.updateById(householdPv);
HouseholdPvContact householdPvContact = new HouseholdPvContact();
......
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