Commit bf67ec0e authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 6811eca1 91624d57
...@@ -3,6 +3,6 @@ package com.yeejoin.amos.boot.biz.common; ...@@ -3,6 +3,6 @@ package com.yeejoin.amos.boot.biz.common;
public class Test { public class Test {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("ddddddcccdddddddd"); System.out.println("ddddrrdddd");
} }
} }
...@@ -105,4 +105,6 @@ public class CommercialDto extends BaseDto { ...@@ -105,4 +105,6 @@ public class CommercialDto extends BaseDto {
@ApiModelProperty(value = " 省市区详细地址") @ApiModelProperty(value = " 省市区详细地址")
private String projectAddressDetail; private String projectAddressDetail;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto; package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
/** /**
...@@ -21,6 +24,9 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -21,6 +24,9 @@ public class PeasantHouseholdDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@ApiModelProperty(value = "农户信息编号") @ApiModelProperty(value = "农户信息编号")
private String peasantHouseholdNo; private String peasantHouseholdNo;
...@@ -39,15 +45,22 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -39,15 +45,22 @@ public class PeasantHouseholdDto extends BaseDto {
@ApiModelProperty(value = "定金") @ApiModelProperty(value = "定金")
private Float deposit; private Float deposit;
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date creationTime; private Date creationTime;
@ApiModelProperty(value = "项目地址") @ApiModelProperty(value = "项目地址")
private String projectAddress; private String projectAddress;
@ApiModelProperty(value = "项目地址Arr")
private String[] projectAddressArr;
@ApiModelProperty(value = "常住地址") @ApiModelProperty(value = "常住地址")
private String permanentAddress; private String permanentAddress;
@ApiModelProperty(value = "常住地址Arr")
private String permanentAddressArr;
@ApiModelProperty(value = "是否勘察 0,1") @ApiModelProperty(value = "是否勘察 0,1")
private Integer surveyOrNot; private Integer surveyOrNot;
...@@ -65,5 +78,12 @@ public class PeasantHouseholdDto extends BaseDto { ...@@ -65,5 +78,12 @@ public class PeasantHouseholdDto extends BaseDto {
@ApiModelProperty(value = "常住详细地址") @ApiModelProperty(value = "常住详细地址")
private String permanentAddressDetail; private String permanentAddressDetail;
@ApiModelProperty(value = "开发人")
private String developer;
@ApiModelProperty(value = "常住地址")
private String permanentAddressName;
@ApiModelProperty(value = "项目地址")
private String projectAddressName;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="PeasantHouseholdDto", description="农户信息")
public class PeasantHouseholdDtoP {
PeasantHouseholdDto farmerInformation;
}
...@@ -20,6 +20,8 @@ public class SurveyDetailsDto extends BaseDto { ...@@ -20,6 +20,8 @@ public class SurveyDetailsDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@ApiModelProperty(value = "勘察时间") @ApiModelProperty(value = "勘察时间")
private Date surveyorTime; private Date surveyorTime;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="SurveyInfoAllDto", description="勘察信息提交")
public class SurveyInfoAllDto {
// 资料归档
InformationDto information;
// 勘察信息详情
SurveyDetailsDto surveyDetails;
// 勘察信息
SurveyInformationDto surveyInformation;
// 扩展信息
ExtendedInformationDto extendedInformation;
// 商务信息
CommercialDto commercial;
}
...@@ -34,8 +34,7 @@ public class SurveyInformationDto extends BaseDto { ...@@ -34,8 +34,7 @@ public class SurveyInformationDto extends BaseDto {
private String developerCode; private String developerCode;
@ApiModelProperty(value = " 业务员id") @ApiModelProperty(value = " 业务员id")
private String salesman private String salesmanId;
Id;
@ApiModelProperty(value = "业务员名称") @ApiModelProperty(value = "业务员名称")
private String salesman; private String salesman;
...@@ -52,4 +51,28 @@ Id; ...@@ -52,4 +51,28 @@ Id;
@ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束") @ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束")
private Integer review; private Integer review;
@ApiModelProperty(value = "业主姓名")
private String ownersName;
@ApiModelProperty(value = "联系电话")
private String telephone;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "邮箱")
private String mailbox;
@ApiModelProperty(value = "项目详细地址")
private String projectAddressDetail;
@ApiModelProperty(value = "常住详细地址")
private String permanentAddressDetail;
@ApiModelProperty(value = "项目地址")
private String projectAddress;
@ApiModelProperty(value = "常住地址")
private String permanentAddress;
} }
...@@ -23,6 +23,12 @@ public class Commercial extends BaseEntity { ...@@ -23,6 +23,12 @@ public class Commercial extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 商务类型 * 商务类型
*/ */
@TableField("type") @TableField("type")
......
...@@ -22,6 +22,12 @@ public class PeasantHousehold extends BaseEntity { ...@@ -22,6 +22,12 @@ public class PeasantHousehold extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/** /**
* 农户信息编号 * 农户信息编号
*/ */
...@@ -77,6 +83,18 @@ public class PeasantHousehold extends BaseEntity { ...@@ -77,6 +83,18 @@ public class PeasantHousehold extends BaseEntity {
private String permanentAddress; private String permanentAddress;
/** /**
* 常住地址
*/
@TableField("permanent_address_name")
private String permanentAddressName;
/**
* 项目地址
*/
@TableField("project_address_name")
private String projectAddressName;
/**
* 是否勘察 0,1 * 是否勘察 0,1
*/ */
@TableField("survey_or_not") @TableField("survey_or_not")
...@@ -112,4 +130,9 @@ public class PeasantHousehold extends BaseEntity { ...@@ -112,4 +130,9 @@ public class PeasantHousehold extends BaseEntity {
@TableField("permanent_address_detail") @TableField("permanent_address_detail")
private String permanentAddressDetail; private String permanentAddressDetail;
/*
* 开发人
* */
@TableField("developer")
private String developer;
} }
...@@ -23,6 +23,12 @@ public class SurveyDetails extends BaseEntity { ...@@ -23,6 +23,12 @@ public class SurveyDetails extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 勘察时间 * 勘察时间
*/ */
@TableField("surveyor_time") @TableField("surveyor_time")
......
...@@ -49,10 +49,8 @@ public class SurveyInformation extends BaseEntity { ...@@ -49,10 +49,8 @@ public class SurveyInformation extends BaseEntity {
/** /**
* 业务员id * 业务员id
*/ */
@TableField("salesman @TableField("salesman _id")
_id") private String salesmanId;
private String salesman
Id;
/** /**
* 业务员名称 * 业务员名称
......
package com.yeejoin.amos.boot.module.hygf.api.util;
import org.springframework.beans.BeanUtils;
public class BeanDtoUtils {
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public static <T> T convert(Object source, Class<T> targetClass) {
// 判断source是否为空
if (source == null) {
return null;
}
// 判断targetClass是否为空
if (targetClass == null) {
return null;
}
try {
// 创建新的对象实例
T target = targetClass.newInstance();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDtoP;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -28,9 +41,17 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -28,9 +41,17 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
@RequestMapping(value = "/peasant-household") @RequestMapping(value = "/peasant-household")
public class PeasantHouseholdController extends BaseController { public class PeasantHouseholdController extends BaseController {
@Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl;
@Autowired @Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl; PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/** /**
* 新增农户信息 * 新增农户信息
* *
...@@ -39,9 +60,29 @@ public class PeasantHouseholdController extends BaseController { ...@@ -39,9 +60,29 @@ public class PeasantHouseholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息") @ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDto model) { public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDtoP model) {
model = peasantHouseholdServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
surveyInformationServiceImpl.createWithModel(surveyInformationDto);
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 处理地址
String area = "";
for (String reg : model.getFarmerInformation().getProjectAddressArr())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
area = area + re.getRegionName() + "/";
}
}
model.getFarmerInformation().setProjectAddressName(area.substring(0, area.length() - 2));
model.getFarmerInformation().setProjectAddress(StringUtils.joinWith(",", model.getFarmerInformation().getProjectAddressArr()));
model.getFarmerInformation().setPermanentAddress(StringUtils.joinWith(",", model.getFarmerInformation().getPermanentAddressArr()));
model.getFarmerInformation().setSurveyInformationId(surveyInformationDto.getSequenceNbr());
PeasantHouseholdDto householdDto = peasantHouseholdServiceImpl.createWithModel(model.getFarmerInformation());
return ResponseHelper.buildResponse(householdDto);
} }
/** /**
...@@ -113,4 +154,35 @@ public class PeasantHouseholdController extends BaseController { ...@@ -113,4 +154,35 @@ public class PeasantHouseholdController extends BaseController {
public ResponseModel<List<PeasantHouseholdDto>> selectForList() { public ResponseModel<List<PeasantHouseholdDto>> selectForList() {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdList()); return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdList());
} }
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if(null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) {
if(null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -113,4 +114,31 @@ public class SurveyInformationController extends BaseController { ...@@ -113,4 +114,31 @@ public class SurveyInformationController extends BaseController {
public ResponseModel<List<SurveyInformationDto>> selectForList() { public ResponseModel<List<SurveyInformationDto>> selectForList() {
return ResponseHelper.buildResponse(surveyInformationServiceImpl.queryForSurveyInformationList()); return ResponseHelper.buildResponse(surveyInformationServiceImpl.queryForSurveyInformationList());
} }
/**
* 勘察信息数据提交
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息数据提交")
@PostMapping(value = "/surveySubmit")
public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto);
return ResponseHelper.buildResponse(returnDto);
}
/**
* 勘察信息编辑
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑")
@GetMapping(value = "/surveyQuery")
public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam String surveyInformationId) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId);
return ResponseHelper.buildResponse(returnDto);
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.SurveyInformation; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService; import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto; import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -17,6 +29,29 @@ import java.util.List; ...@@ -17,6 +29,29 @@ import java.util.List;
*/ */
@Service @Service
public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService { public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -30,4 +65,94 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -30,4 +65,94 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
public List<SurveyInformationDto> queryForSurveyInformationList() { public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) {
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
this.saveOrUpdate(surveyInformation);
SurveyDetails surveyDetails = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyDetails(), SurveyDetails.class);
surveyDetailsService.save(surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr()));
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
informationService.save(information.setSurveyInformationId(surveyInformation.getSequenceNbr()));
Commercial commercial = BeanDtoUtils.convert(surveyInfoAllDto.getCommercial(), Commercial.class);
commercialService.save(commercial.setSurveyInformationId(surveyInformation.getSequenceNbr()));
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(), ExtendedInformation.class);
extendedInformationService.save(extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr()));
return surveyInfoAllDto;
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
SurveyInformation surveyInformation = this.getById(surveyInformationId);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("surveyInformationId", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
return surveyInfoAllDto;
}
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
for (RegionModel child : regionModel.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @description: * @description:
...@@ -33,4 +34,5 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato ...@@ -33,4 +34,5 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
Object getIndicatoralueTotal(String gateway,String indicator); Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId);
} }
...@@ -79,6 +79,13 @@ ...@@ -79,6 +79,13 @@
indicator like concat('%',#{indicator},'%') indicator like concat('%',#{indicator},'%')
</select> </select>
<select id="getFanConfigPower" resultType="java.util.Map">
select
sequence_nbr as id,
equipment_number as equipmentNumber,
equipment_specific_name as equipmentSpecificName,
gateway_id as gatewayId
from fan_config_power
where gateway_id = #{gatewayId}
</select>
</mapper> </mapper>
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
...@@ -61,6 +62,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -61,6 +62,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired @Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
TemporaryDataMapper temporaryDataMapper; TemporaryDataMapper temporaryDataMapper;
@Autowired @Autowired
...@@ -236,22 +243,76 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -236,22 +243,76 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<IndexDto> getFanStatusList(String stationId) { public List<IndexDto> getFanStatusList(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId); StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId()); String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class); List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState)); Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId()); String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class); List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId());
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
equipNumList.forEach(item -> { equipNumList.forEach(item -> {
item.setState(collect.get(item.getEquipmentNumber())); item.setState(collect.get(item.getEquipmentNumber()));
if (!collect.containsKey(item.getEquipmentNumber())) {
item.setState("正常运行");
} else if (powList.contains(item.getEquipmentNumber())) {
item.setState("限功率");
} else if (!timeList.contains(item.getEquipmentNumber())) {
item.setState("通讯中断");
}
}); });
return equipNumList; return equipNumList;
} }
public List<IndexDto> getFanStatusStatistics(String stationId) { public List<IndexDto> getFanStatusStatistics(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId); StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId()); String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class); List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
Map<String, Long> collect = influxDBList.stream().collect(Collectors.groupingBy(IndexDto::getEquipmentIndexName, Collectors.counting())); Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId());
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
equipNumList.forEach(item -> {
item.setState(collect.get(item.getEquipmentNumber()));
if (!collect.containsKey(item.getEquipmentNumber())) {
item.setState("正常运行");
} else if (powList.contains(item.getEquipmentNumber())) {
item.setState("限功率");
} else if (!timeList.contains(item.getEquipmentNumber())) {
item.setState("通讯中断");
}
});
Map<String, Long> countMap = equipNumList.stream().collect(Collectors.groupingBy(IndexDto::getState, Collectors.counting()));
List<IndexDto> resultList = new ArrayList<>();
List<String> list = Arrays.asList("正常运行", "告警运行", "正常停机", "故障停机", "限功率", "待机状态", "维护状态", "通讯中断"); List<String> list = Arrays.asList("正常运行", "告警运行", "正常停机", "故障停机", "限功率", "待机状态", "维护状态", "通讯中断");
HashMap<String, String> colorMap = new HashMap<>(); HashMap<String, String> colorMap = new HashMap<>();
colorMap.put("正常运行", "#00aa00"); colorMap.put("正常运行", "#00aa00");
...@@ -262,10 +323,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -262,10 +323,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
colorMap.put("待机状态", "#ff0000"); colorMap.put("待机状态", "#ff0000");
colorMap.put("维护状态", "#ff00ff"); colorMap.put("维护状态", "#ff00ff");
colorMap.put("通讯中断", "#7d8e95"); colorMap.put("通讯中断", "#7d8e95");
List<IndexDto> resultList = new ArrayList<>();
list.forEach(item -> { list.forEach(item -> {
IndexDto indexDto = new IndexDto(); IndexDto indexDto = new IndexDto();
indexDto.setCountString(collect.containsKey(item) ? String.valueOf(collect.get(item)) : "0"); indexDto.setCountString(countMap.containsKey(item) ? String.valueOf(countMap.get(item)) : "0");
indexDto.setEquipmentIndexName(item); indexDto.setEquipmentIndexName(item);
indexDto.setColor(colorMap.get(item)); indexDto.setColor(colorMap.get(item));
resultList.add(indexDto); resultList.add(indexDto);
......
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