Commit 1fe8adb3 authored by chenzhao's avatar chenzhao

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

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java # amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
parents 94eb0740 72b0c111
package com.yeejoin.amos.boot.biz.common.enums;
import lombok.AllArgsConstructor;
@AllArgsConstructor
public enum DictTypeEnum {
坐席技能组("ZXJNZ","坐席技能组");
private String type;//字典类型
private String desc;//描述
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 商务信息
......@@ -34,7 +36,14 @@ public class CommercialDto extends BaseDto {
private String telephone;
@ApiModelProperty(value = "省市区")
private String projectAddress;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "省市区名称")
private String projectAddressName;
@ApiModelProperty(value = "省市区文字集合")
private List<String> projectAddressText;
@ApiModelProperty(value = "设备信息")
private String device;
......@@ -55,52 +64,68 @@ public class CommercialDto extends BaseDto {
private String legalEmergentTelephone;
@ApiModelProperty(value = "结婚证文件标识")
private String marriageCredit;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> marriageCredit;
@ApiModelProperty(value = "房产证文件标识")
private String realEstateCredit;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> realEstateCredit;
@ApiModelProperty(value = "身份证正反面文件标识")
private String idCardCredit;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> idCardCredit;
@ApiModelProperty(value = "户口本文件标识")
private String householdBookCredit;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> householdBookCredit;
@ApiModelProperty(value = "手持身份证文件标识")
private String handIdCardCredit;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> handIdCardCredit;
@ApiModelProperty(value = "踏勘照片文件标识")
private String surveyPhotosWeb;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> surveyPhotosWeb;
@ApiModelProperty(value = "组件平面图与组串连线图文件标识")
private String formationWeb;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> formationWeb;
@ApiModelProperty(value = "房屋所有权继承说明文件标识")
private String inheritWeb;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> inheritWeb;
@ApiModelProperty(value = "户用光伏电站项目合作协议文件标识")
private String agreementWeb;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> agreementWeb;
@ApiModelProperty(value = "用户手持身份证照片文件标识")
private String handIdCardLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> handIdCardLegal;
@ApiModelProperty(value = "法人营业执照文件标识")
private String licenseLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> licenseLegal;
@ApiModelProperty(value = "法定代理人身份证文件标识")
private String agentLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> agentLegal;
@ApiModelProperty(value = "房产证明文件或乡镇街道土管部门房屋产权证明文件文件标识")
private String realEstateLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> realEstateLegal;
@ApiModelProperty(value = "房屋屋顶租赁协议/户用光伏共建开发协议文件标识")
private String houseAgreementLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> houseAgreementLegal;
@ApiModelProperty(value = "法人的企业征信报告、工商内档文件标识")
private String creditReportLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> creditReportLegal;
@ApiModelProperty(value = "项目备案证文件标识")
private String filingsLegal;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> filingsLegal;
@ApiModelProperty(value = " 省市区详细地址")
private String projectAddressDetail;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 扩展信息
......@@ -25,7 +27,8 @@ public class ExtendedInformationDto extends BaseDto {
private String orderDescription;
@ApiModelProperty(value = "联系人")
private String contacts;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> contacts;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 资料归档
......@@ -28,10 +31,12 @@ public class InformationDto extends BaseDto {
private String archivesNumber;
@ApiModelProperty(value = "身份证文件标识")
private String cardFile;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> cardFile;
@ApiModelProperty(value = " 房产证文件标识")
private String houseProve;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> houseProve;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -9,6 +10,7 @@ import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 农户信息
......@@ -50,20 +52,23 @@ public class PeasantHouseholdDto extends BaseDto {
private Date creationTime;
@ApiModelProperty(value = "项目地址")
private String projectAddress;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "项目地址Arr")
private String[] projectAddressArr;
@ApiModelProperty(value = "常住地址")
private String permanentAddress;
@ApiModelProperty(value = "常住是否相同")
private String isPermanent;
@ApiModelProperty(value = "常住地址Arr")
private String permanentAddressArr;
@ApiModelProperty(value = "常住地址")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
@ApiModelProperty(value = "是否勘察 0,1")
@ApiModelProperty(value = "是否勘察 0,1,2")
private Integer surveyOrNot;
@ApiModelProperty(value = "勘察状态描述")
private String surveyOrNotText;
@ApiModelProperty(value = "身份证号")
private String idCard;
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 勘察明细
......@@ -23,11 +27,13 @@ public class SurveyDetailsDto extends BaseDto {
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@JsonFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "勘察时间")
private Date surveyorTime;
@ApiModelProperty(value = "房屋类型")
private String houseType;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> houseType;
@ApiModelProperty(value = "房屋整体情况")
private String houseSituation;
......@@ -45,7 +51,7 @@ public class SurveyDetailsDto extends BaseDto {
private Integer houseHeight;
@ApiModelProperty(value = "房屋偏向")
private Integer houseBias;
private String houseBias;
@ApiModelProperty(value = "房屋偏向备注")
private String houseBiasNotes;
......@@ -63,25 +69,29 @@ public class SurveyDetailsDto extends BaseDto {
private String locationAlt;
@ApiModelProperty(value = "屋顶通道")
private String roofway;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> roofway;
@ApiModelProperty(value = "屋顶通道备注")
private String roofwayNotes;
@ApiModelProperty(value = "周边障碍物")
private String obstacle;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> obstacle;
@ApiModelProperty(value = "周边障碍物备注")
private String obstacleNotes;
@ApiModelProperty(value = "遮挡物")
private String screen;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> screen;
@ApiModelProperty(value = "遮挡物备注")
private String screenNotes;
@ApiModelProperty(value = "解决措施")
private String solutionMeasures;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> solutionMeasures;
@ApiModelProperty(value = "房屋产权")
private String houseProperty;
......@@ -141,27 +151,35 @@ public class SurveyDetailsDto extends BaseDto {
private String daylightingObstruction;
@ApiModelProperty(value = "房屋整体文件标识")
private String overallHousingSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> overallHousingSurvey;
@ApiModelProperty(value = "房屋周边文件标识")
private String surroundingHouseSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> surroundingHouseSurvey;
@ApiModelProperty(value = "房屋内部整体照片文件标识")
private String insideHouseSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> insideHouseSurvey;
@ApiModelProperty(value = "电表参数文件标识")
private String electricitySurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> electricitySurvey;
@ApiModelProperty(value = "屋顶全貌文件标识")
private String panoramaSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> panoramaSurvey;
@ApiModelProperty(value = "屋顶平面草图文件标识")
private String planSketchSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> planSketchSurvey;
@ApiModelProperty(value = "房屋方位角文件标识")
private String azimuthSurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> azimuthSurvey;
@ApiModelProperty(value = "其他附件文件标识")
private String otherAccessorySurvey;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> otherAccessorySurvey;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 勘察信息
......@@ -42,6 +46,7 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = "制单人")
private String creator;
@JsonFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "制单时间")
private Date creatorTime;
......@@ -51,6 +56,9 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束")
private Integer review;
@ApiModelProperty(value = "来源农户编号")
private String peasantHouseholdNo;
@ApiModelProperty(value = "业主姓名")
private String ownersName;
......@@ -69,10 +77,30 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = "常住详细地址")
private String permanentAddressDetail;
@ApiModelProperty(value = "项目地址code")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "项目地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> projectAddressText;
@ApiModelProperty(value = "项目地址")
private String projectAddress;
private String projectAddressName;
@ApiModelProperty(value = "常住地址code")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
@ApiModelProperty(value = "常住地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> permanentAddressText;
@ApiModelProperty(value = "常住是否相同")
private String isPermanent;
@ApiModelProperty(value = "常住地址")
private String permanentAddress;
@ApiModelProperty(value = "定金")
private Float deposit;
}
......@@ -48,6 +48,9 @@ public class UnitInfoDto extends BaseDto {
@ApiModelProperty(value = "管理员账户名")
private String adminLoginName;
@ApiModelProperty(value = "管理员账户名")
private String adminUserName;
@ApiModelProperty(value = "管理员电话")
private String adminPhone;
......@@ -66,4 +69,28 @@ public class UnitInfoDto extends BaseDto {
@ApiModelProperty(value = "角色id")
private String roleId;
@ApiModelProperty(value = "注册地址省-市-区")
private String registerPcd;
@ApiModelProperty(value = "工作地址省-市-区")
private String workPcd;
@ApiModelProperty(value = "注册地址省-市-区code")
private String registerPcdCode;
@ApiModelProperty(value = "工作地址省-市-区code")
private String workPcdCode;
@ApiModelProperty(value = "单位类型")
private String unitType;
@ApiModelProperty(value = "单位类型code")
private String unitTypeCode;
@ApiModelProperty(value = "管辖机构")
private String managementUnit;
@ApiModelProperty(value = "管辖单位id")
private String managementUnitId;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author DELL
*/
@Data
@ApiModel(value="UnitRegisterDto", description="单位注册")
public class UnitRegisterDto {
@ApiModelProperty(value = "企业名称")
private UnitInfoDto unitInfoDto;
@ApiModelProperty(value = "企业名称")
private CommerceInfoDto commerceInfoDto;
}
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 商务信息
......@@ -17,7 +19,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_commercial")
@TableName(value = "hygf_commercial",autoResultMap = true)
public class Commercial extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -53,10 +55,15 @@ public class Commercial extends BaseEntity {
private String telephone;
/**
* 省市区
* 省市区code
*/
@TableField("project_address")
private String projectAddress;
@TableField(value = "project_address",typeHandler = FastjsonTypeHandler.class)
private List<Object> projectAddress;
/**
* 省市区名称
*/
@TableField("project_address_name")
private String projectAddressName;
/**
* 设备信息
......@@ -97,98 +104,98 @@ public class Commercial extends BaseEntity {
/**
* 结婚证文件标识
*/
@TableField("marriage_credit")
private String marriageCredit;
@TableField(value = "marriage_credit",typeHandler = FastjsonTypeHandler.class)
private List<Object> marriageCredit;
/**
* 房产证文件标识
*/
@TableField("real_estate_credit")
private String realEstateCredit;
@TableField(value = "real_estate_credit",typeHandler = FastjsonTypeHandler.class)
private List<Object> realEstateCredit;
/**
* 身份证正反面文件标识
*/
@TableField("id_card_credit")
private String idCardCredit;
@TableField(value = "id_card_credit",typeHandler = FastjsonTypeHandler.class)
private List<Object> idCardCredit;
/**
* 户口本文件标识
*/
@TableField("household_book_credit")
private String householdBookCredit;
@TableField(value = "household_book_credit",typeHandler = FastjsonTypeHandler.class)
private List<Object> householdBookCredit;
/**
* 手持身份证文件标识
*/
@TableField("hand_id_card_credit")
private String handIdCardCredit;
@TableField(value = "hand_id_card_credit",typeHandler = FastjsonTypeHandler.class)
private List<Object> handIdCardCredit;
/**
* 踏勘照片文件标识
*/
@TableField("survey_photos_web")
private String surveyPhotosWeb;
@TableField(value = "survey_photos_web",typeHandler = FastjsonTypeHandler.class)
private List<Object> surveyPhotosWeb;
/**
* 组件平面图与组串连线图文件标识
*/
@TableField("formation_web")
private String formationWeb;
@TableField(value = "formation_web",typeHandler = FastjsonTypeHandler.class)
private List<Object> formationWeb;
/**
* 房屋所有权继承说明文件标识
*/
@TableField("inherit_web")
private String inheritWeb;
@TableField(value = "inherit_web",typeHandler = FastjsonTypeHandler.class)
private List<Object> inheritWeb;
/**
* 户用光伏电站项目合作协议文件标识
*/
@TableField("agreement_web")
private String agreementWeb;
@TableField(value = "agreement_web",typeHandler = FastjsonTypeHandler.class)
private List<Object> agreementWeb;
/**
* 用户手持身份证照片文件标识
*/
@TableField("hand_id_card_legal")
private String handIdCardLegal;
@TableField(value = "hand_id_card_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> handIdCardLegal;
/**
* 法人营业执照文件标识
*/
@TableField("license_legal")
private String licenseLegal;
@TableField(value = "license_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> licenseLegal;
/**
* 法定代理人身份证文件标识
*/
@TableField("agent_legal")
private String agentLegal;
@TableField(value = "agent_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> agentLegal;
/**
* 房产证明文件或乡镇街道土管部门房屋产权证明文件文件标识
*/
@TableField("real_estate_legal")
private String realEstateLegal;
@TableField(value = "real_estate_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> realEstateLegal;
/**
* 房屋屋顶租赁协议/户用光伏共建开发协议文件标识
*/
@TableField("house_agreement_legal")
private String houseAgreementLegal;
@TableField(value = "house_agreement_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> houseAgreementLegal;
/**
* 法人的企业征信报告、工商内档文件标识
*/
@TableField("credit_report_legal")
private String creditReportLegal;
@TableField(value = "credit_report_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> creditReportLegal;
/**
* 项目备案证文件标识
*/
@TableField("filings_legal")
private String filingsLegal;
@TableField(value = "filings_legal",typeHandler = FastjsonTypeHandler.class)
private List<Object> filingsLegal;
/**
* 省市区详细地址
......
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 扩展信息
......@@ -17,7 +19,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_extended_information")
@TableName(value = "hygf_extended_information",autoResultMap = true)
public class ExtendedInformation extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -31,8 +33,8 @@ public class ExtendedInformation extends BaseEntity {
/**
* 联系人
*/
@TableField("contacts")
private String contacts;
@TableField(value = "contacts",typeHandler = FastjsonTypeHandler.class)
private List<Object> contacts;
/**
* 勘察表id
......
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 资料归档
......@@ -17,7 +19,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_information")
@TableName(value = "hygf_information",autoResultMap = true)
public class Information extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -37,14 +39,14 @@ public class Information extends BaseEntity {
/**
* 身份证文件标识
*/
@TableField("card_file")
private String cardFile;
@TableField(value = "card_file",typeHandler = FastjsonTypeHandler.class)
private List<Object> cardFile;
/**
* 房产证文件标识
*/
@TableField("house_prove")
private String houseProve;
@TableField(value = "house_prove",typeHandler = FastjsonTypeHandler.class)
private List<Object> houseProve;
/**
* 勘察表id
......
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 农户信息
......@@ -17,7 +19,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_peasant_household")
@TableName(value = "hygf_peasant_household",autoResultMap = true)
public class PeasantHousehold extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -73,14 +75,14 @@ public class PeasantHousehold extends BaseEntity {
/**
* 项目地址
*/
@TableField("project_address")
private String projectAddress;
@TableField(value = "project_address",typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
/**
* 常住地址
*/
@TableField("permanent_address")
private String permanentAddress;
@TableField(value = "permanent_address",typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
/**
* 常住地址
......
......@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 勘察明细
......@@ -17,7 +19,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_survey_details")
@TableName(value = "hygf_survey_details",autoResultMap = true)
public class SurveyDetails extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -37,8 +39,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 房屋类型
*/
@TableField("house_type")
private String houseType;
@TableField(value = "house_type",typeHandler = FastjsonTypeHandler.class)
private List<String> houseType;
/**
* 房屋整体情况
......@@ -74,7 +76,7 @@ public class SurveyDetails extends BaseEntity {
* 房屋偏向
*/
@TableField("house_bias")
private Integer houseBias;
private String houseBias;
/**
* 房屋偏向备注
......@@ -109,8 +111,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 屋顶通道
*/
@TableField("roofway")
private String roofway;
@TableField(value = "roofway",typeHandler = FastjsonTypeHandler.class)
private List<String> roofway;
/**
* 屋顶通道备注
......@@ -121,8 +123,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 周边障碍物
*/
@TableField("obstacle")
private String obstacle;
@TableField(value = "obstacle",typeHandler = FastjsonTypeHandler.class)
private List<String> obstacle;
/**
* 周边障碍物备注
......@@ -133,8 +135,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 遮挡物
*/
@TableField("screen")
private String screen;
@TableField(value = "screen",typeHandler = FastjsonTypeHandler.class)
private List<String> screen;
/**
* 遮挡物备注
......@@ -145,8 +147,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 解决措施
*/
@TableField("solution_measures")
private String solutionMeasures;
@TableField(value = "solution_measures",typeHandler = FastjsonTypeHandler.class)
private List<String> solutionMeasures;
/**
* 房屋产权
......@@ -265,49 +267,49 @@ public class SurveyDetails extends BaseEntity {
/**
* 房屋整体文件标识
*/
@TableField("overall_housing_survey")
private String overallHousingSurvey;
@TableField(value = "overall_housing_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> overallHousingSurvey;
/**
* 房屋周边文件标识
*/
@TableField("surrounding_house_survey")
private String surroundingHouseSurvey;
@TableField(value = "surrounding_house_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> surroundingHouseSurvey;
/**
* 房屋内部整体照片文件标识
*/
@TableField("inside_house_survey")
private String insideHouseSurvey;
@TableField(value = "inside_house_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> insideHouseSurvey;
/**
* 电表参数文件标识
*/
@TableField("electricity_survey")
private String electricitySurvey;
@TableField(value = "electricity_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> electricitySurvey;
/**
* 屋顶全貌文件标识
*/
@TableField("panorama_survey")
private String panoramaSurvey;
@TableField(value = "panorama_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> panoramaSurvey;
/**
* 屋顶平面草图文件标识
*/
@TableField("plan_sketch_survey")
private String planSketchSurvey;
@TableField(value = "plan_sketch_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> planSketchSurvey;
/**
* 房屋方位角文件标识
*/
@TableField("azimuth_survey")
private String azimuthSurvey;
@TableField(value = "azimuth_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> azimuthSurvey;
/**
* 其他附件文件标识
*/
@TableField("other_accessory_survey")
private String otherAccessorySurvey;
@TableField(value = "other_accessory_survey",typeHandler = FastjsonTypeHandler.class)
private List<Object> otherAccessorySurvey;
}
......@@ -17,7 +17,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("hygf_survey_information")
@TableName(value = "hygf_survey_information",autoResultMap = true)
public class SurveyInformation extends BaseEntity {
private static final long serialVersionUID = 1L;
......@@ -49,7 +49,7 @@ public class SurveyInformation extends BaseEntity {
/**
* 业务员id
*/
@TableField("salesman _id")
@TableField("salesman_id")
private String salesmanId;
/**
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -112,4 +113,58 @@ public class UnitInfo extends BaseEntity {
@TableField("role_id")
private String roleId;
/**
* 管理员账户名
*/
@TableField("admin_user_name")
private String adminUserName;
/**
* 注册地址省-市-区
*/
@TableField("register_pcd")
private String registerPcd;
/**
* 工作地址省-市-区
*/
@TableField("work_Pcd")
private String workPcd;
/**
* 注册地址省-市-区code
*/
@TableField("register_pcd_code")
private String registerPcdCode;
/**
* 工作地址省-市-区code
*/
@TableField("work_pcd_code")
private String workPcdCode;
/**
* 单位类型
*/
@TableField("unit_type")
private String unitType;
/**
* 单位类型code
*/
@TableField("unit_type_code")
private String unitTypeCode;
/**
* 管辖机构
*/
@TableField("management_unit")
private String managementUnit;
/**
* 管辖单位id
*/
@TableField("management_unit_id")
private String managementUnitId;
}
package com.yeejoin.amos.boot.module.hygf.api.fegin;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.VerifyCodeAuthModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@FeignClient(value = "AMOS-API-PRIVILEGE", configuration = {FeignConfiguration.class})
public interface PrivilegeFeginService {
@RequestMapping(value = "/privilege/v1/agencyuser/me", method = RequestMethod.GET)
ResponseModel<AgencyUserModel> getMe();
//获取单位树
@RequestMapping(value = "/privilege/v1/company/tree", method = RequestMethod.GET)
FeignClientResult tree(@RequestHeader("token") String token, @RequestHeader("appKey") String appKey, @RequestHeader("product") String product);
//获取省级行政区划
@RequestMapping(value = "systemctl/v1/region/level", method = RequestMethod.GET)
FeignClientResult getProvince(@RequestParam String level);
//获取行政区划树
@RequestMapping(value = "systemctl/v1/region/tree", method = RequestMethod.GET)
FeignClientResult getTree();
/**
* 手机号验证码登录
*/
@RequestMapping(value = "/privilege/v1/auth/mobile/verifycode", method = RequestMethod.POST)
FeignClientResult mobileVerifyCode(@RequestBody VerifyCodeAuthModel model) throws InnerInvokException;
}
package com.yeejoin.amos.boot.module.hygf.api.hwsms;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.net.ssl.*;
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
* @author DELL
*/
@Component
@Slf4j
public class HwSendSms {
/**
* 无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值
*/
private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\"";
/**
* 无需修改,用于格式化鉴权头域,给"Authorization"参数赋值
*/
private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\"";
private static final String UTF_8 = "UTF-8";
private static final int SUCCESS_STATUS = 200;
private static final int FAIL_STATUS = 500;
@Value("${sms.huawei.url}")
private String url;
@Value("${sms.huawei.appKey}")
private String appKey;
@Value("${sms.huawei.appSecret}")
private String appSecret;
@Value("${sms.huawei.sender}")
private String sender;
@Value("${sms.huawei.signature}")
private String signature;
public int sendSms(String receiver, String templateParas, String templateId) throws Exception {
//选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告
String statusCallBack = "";
/**
* 选填,使用无变量模板时请赋空值 String templateParas = "";
* 单变量模板示例:模板内容为"您的验证码是${1}"时,templateParas可填写为"[\"369751\"]"
* 双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]"
* 模板中的每个变量都必须赋值,且取值不能为空
* 查看更多模板和变量规范:产品介绍>模板和变量规范
*/
//模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。
// String templateParas = "[\"12345\"]";
//请求Body,不携带签名名称时,signature请填null
String body = buildRequestBody(sender, receiver, templateId, templateParas, statusCallBack, signature);
if (null == body || body.isEmpty()) {
log.info("body is null.");
return FAIL_STATUS;
}
//请求Headers中的X-WSSE参数值
String wsseHeader = buildWsseHeader(appKey, appSecret);
if (null == wsseHeader || wsseHeader.isEmpty()) {
log.info("wsse header is null.");
return FAIL_STATUS;
}
Writer out = null;
BufferedReader in = null;
StringBuffer result = new StringBuffer();
HttpsURLConnection connection = null;
InputStream is = null;
//为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题
HostnameVerifier hv = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
trustAllHttpsCertificates();
try {
URL realUrl = new URL(url);
connection = (HttpsURLConnection) realUrl.openConnection();
connection.setHostnameVerifier(hv);
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(true);
//请求方法
connection.setRequestMethod("POST");
//请求Headers参数
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Authorization", AUTH_HEADER_VALUE);
connection.setRequestProperty("X-WSSE", wsseHeader);
connection.connect();
out = new OutputStreamWriter(connection.getOutputStream());
//发送请求Body参数
out.write(body);
out.flush();
out.close();
int status = connection.getResponseCode();
if (SUCCESS_STATUS == status) {
is = connection.getInputStream();
} else { //400/401
is = connection.getErrorStream();
}
in = new BufferedReader(new InputStreamReader(is, UTF_8));
String line = "";
while ((line = in.readLine()) != null) {
result.append(line);
}
log.info("短信发送返回详情:{}", result.toString());
return status;
} catch (Exception e) {
e.printStackTrace();
return FAIL_STATUS;
} finally {
try {
if (null != out) {
out.close();
}
if (null != is) {
is.close();
}
if (null != in) {
in.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 构造请求Body体
* @param sender
* @param receiver
* @param templateId
* @param templateParas
* @param statusCallBack
* @param signature | 签名名称,使用中国大陆短信通用模板时填写
* @return
*/
static String buildRequestBody(String sender, String receiver, String templateId, String templateParas,
String statusCallBack, String signature) {
if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty()
|| templateId.isEmpty()) {
System.out.println("buildRequestBody(): sender, receiver or templateId is null.");
return null;
}
Map<String, String> map = new HashMap<String, String>();
map.put("from", sender);
map.put("to", receiver);
map.put("templateId", templateId);
if (null != templateParas && !templateParas.isEmpty()) {
map.put("templateParas", templateParas);
}
if (null != statusCallBack && !statusCallBack.isEmpty()) {
map.put("statusCallback", statusCallBack);
}
if (null != signature && !signature.isEmpty()) {
map.put("signature", signature);
}
StringBuilder sb = new StringBuilder();
String temp = "";
for (String s : map.keySet()) {
try {
temp = URLEncoder.encode(map.get(s), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
sb.append(s).append("=").append(temp).append("&");
}
return sb.deleteCharAt(sb.length()-1).toString();
}
/**
* 构造X-WSSE参数值
* @param appKey
* @param appSecret
* @return
*/
static String buildWsseHeader(String appKey, String appSecret) {
if (null == appKey || null == appSecret || appKey.isEmpty() || appSecret.isEmpty()) {
System.out.println("buildWsseHeader(): appKey or appSecret is null.");
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
String time = sdf.format(new Date()); //Created
String nonce = UUID.randomUUID().toString().replace("-", ""); //Nonce
MessageDigest md;
byte[] passwordDigest = null;
try {
md = MessageDigest.getInstance("SHA-256");
md.update((nonce + time + appSecret).getBytes());
passwordDigest = md.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
//如果JDK版本是1.8,请加载原生Base64类,并使用如下代码
String passwordDigestBase64Str = Base64.getEncoder().encodeToString(passwordDigest); //PasswordDigest
//如果JDK版本低于1.8,请加载三方库提供Base64类,并使用如下代码
//String passwordDigestBase64Str = Base64.encodeBase64String(passwordDigest); //PasswordDigest
//若passwordDigestBase64Str中包含换行符,请执行如下代码进行修正
//passwordDigestBase64Str = passwordDigestBase64Str.replaceAll("[\\s*\t\n\r]", "");
return String.format(WSSE_HEADER_FORMAT, appKey, passwordDigestBase64Str, nonce, time);
}
/**
* 忽略证书信任问题
* @throws Exception
*/
static void trustAllHttpsCertificates() throws Exception {
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return;
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return;
}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
}
package com.yeejoin.amos.boot.module.hygf.api.hwsms;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* 发送短信验证码
* @author xxz
*/
@Component
public class SendSmsCode {
@Autowired
HwSendSms hwSendSms;
@Value("${sms.huawei.templateId}")
private String templateId;
private static final int SUCCESS_STATUS = 200;
public boolean sendSmsCode (String mobile, String templateParas) throws Exception {
int i = hwSendSms.sendSms(mobile, templateParas, templateId);
return i == SUCCESS_STATUS;
}
}
package com.yeejoin.amos.boot.module.hygf.api.service;
import com.yeejoin.amos.boot.module.hygf.api.dto.UnitRegisterDto;
import java.util.Collection;
/**
* 经销商人员信息接口类
*
......@@ -9,4 +13,7 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
*/
public interface IUnitInfoService {
Collection getManagementUnitTree(String orgCode);
UnitRegisterDto registerUnit(UnitRegisterDto model);
}
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
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.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
......@@ -16,8 +17,8 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -60,28 +61,43 @@ public class PeasantHouseholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDtoP model) {
public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDto model) {
AgencyUserModel userInfo = getUserInfo();
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() + "/";
if(StringUtils.isEmpty(model.getProjectAddressName())){
// 处理地址
String area = "";
for (Integer reg : model.getProjectAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
area = area + re.getRegionName() + "/";
}
}
model.setProjectAddressName(area.substring(0, area.length() - 2)+"/"+model.getProjectAddressDetail());
}
if ("1".equals(model.getIsPermanent())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
}
model.getFarmerInformation().setProjectAddressName(area.substring(0, area.length() - 2));
model.setSurveyInformationId(surveyInformationDto.getSequenceNbr());
model.setSurveyOrNot(0);
model.setReview(0);
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());
if(StringUtils.isEmpty(model.getDeveloperCode())){
model.setDeveloperCode(userInfo.getAgencyCode());
}
model.setDeveloperName(userInfo.getOrgNamesWithoutRole());
if(StringUtils.isEmpty(model.getDeveloper())){
model.setDeveloper(userInfo.getRealName());
}
if(model.getCreationTime() == null){
model.setCreationTime(new Date());
}
PeasantHouseholdDto householdDto = peasantHouseholdServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(householdDto);
}
......@@ -96,6 +112,34 @@ public class PeasantHouseholdController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新农户信息", notes = "根据sequenceNbr更新农户信息")
public ResponseModel<PeasantHouseholdDto> updateBySequenceNbrPeasantHousehold(@RequestBody PeasantHouseholdDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
if(model.getProjectAddress().size()>0){
// 处理项目地址
String projectAddressName = "";
for (Integer reg : model.getProjectAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
model.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 2));
}
if ("1".equals(model.getIsPermanent())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
}
if(model.getPermanentAddress().size()>0){
// 处理常驻地址
String permanentAddressName = "";
for (Integer reg : model.getPermanentAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
model.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 2));
}
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.updateWithModel(model));
}
......@@ -109,7 +153,7 @@ public class PeasantHouseholdController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除农户信息", notes = "根据sequenceNbr删除农户信息")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.removeById(sequenceNbr));
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.deletePeasantHouseholdBySequenceNbr(sequenceNbr));
}
/**
......@@ -122,7 +166,13 @@ public class PeasantHouseholdController extends BaseController {
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个农户信息", notes = "根据sequenceNbr查询单个农户信息")
public ResponseModel<PeasantHouseholdDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryBySeq(sequenceNbr));
PeasantHouseholdDto peasantHouseholdDto = peasantHouseholdServiceImpl.queryBySeq(sequenceNbr);
if(JSON.toJSONString(peasantHouseholdDto.getProjectAddress()).equals(JSON.toJSONString(peasantHouseholdDto.getPermanentAddress()))){
peasantHouseholdDto.setIsPermanent("1");
}else {
peasantHouseholdDto.setIsPermanent("0");
}
return ResponseHelper.buildResponse(peasantHouseholdDto);
}
/**
......@@ -135,12 +185,14 @@ public class PeasantHouseholdController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "农户信息分页查询", notes = "农户信息分页查询")
public ResponseModel<Page<PeasantHouseholdDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
public ResponseModel<Page<PeasantHouseholdDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "ownersName",required = false)String ownersName) {
Page<PeasantHouseholdDto> page = new Page<PeasantHouseholdDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page));
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page,userInfo.getAgencyCode(),ownersName));
}
/**
......
......@@ -123,8 +123,9 @@ public class SurveyInformationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息数据提交")
@PostMapping(value = "/surveySubmit")
public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto);
public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto,
@RequestParam(value = "operationType") String operationType) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto,operationType);
return ResponseHelper.buildResponse(returnDto);
}
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.hygf.api.dto.UnitRegisterDto;
import com.yeejoin.amos.boot.module.hygf.api.hwsms.SendSmsCode;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.ApiParam;
import org.apache.poi.util.ArrayUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.UnitInfoServiceImpl;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -24,25 +45,31 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
* @date 2023-07-07
*/
@RestController
@Api(tags = "经销商人员信息Api")
@Api(tags = "经销商单位信息Api")
@RequestMapping(value = "/unit-info")
public class UnitInfoController extends BaseController {
@Autowired
UnitInfoServiceImpl unitInfoServiceImpl;
/**
* 新增经销商人员信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增经销商人员信息", notes = "新增经销商人员信息")
public ResponseModel<UnitInfoDto> save(@RequestBody UnitInfoDto model) {
model = unitInfoServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
@Autowired
AmosRequestContext requestContext;
@Autowired
RedisUtils redisUtil;
@Value("${hygf.sms.tempCode}")
private String smsTempCode;
@Autowired
SendSmsCode sendSmsCode;
public static final String HYGF_USER_TEL = "hygf_tel_";
/**
* 验证码过期时间
*/
private long time = 180L;
/**
* 根据sequenceNbr更新
......@@ -113,4 +140,160 @@ public class UnitInfoController extends BaseController {
public ResponseModel<List<UnitInfoDto>> selectForList() {
return ResponseHelper.buildResponse(unitInfoServiceImpl.queryForUnitInfoList());
}
/**
* 管理员身份证图片上传 无token
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@PostMapping(value = "/uploadFile")
@ApiOperation(httpMethod = "POST", value = "管理员身份证图片上传 无token", notes = "管理员身份证图片上传 无token")
public ResponseModel<String> uploadFile(@ApiParam(value = "文件", required = true)@RequestParam MultipartFile file) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
RequestContext.setAppKey("AMOS_STUDIO");
RequestContext.setProduct("AMOS_STUDIO_WEB");
RequestContext.setToken(requestContext.getToken());
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString="";
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
}
}
return ResponseHelper.buildResponse(urlString);
}
/**
* 获取组织机构树
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/region/tree")
@ApiOperation(httpMethod = "GET", value = "获取组织机构树", notes = "获取组织机构树")
public ResponseModel<Collection<RegionModel>> getRegionTree() {
RequestContext.setAppKey("AMOS_STUDIO");
RequestContext.setProduct("AMOS_STUDIO_WEB");
RequestContext.setToken(requestContext.getToken());
return ResponseHelper.buildResponse(Systemctl.regionClient.queryForTree(null).getResult());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/management-unit/tree")
@ApiOperation(httpMethod = "GET", value = "管辖机构树", notes = "管辖机构树")
public ResponseModel<Collection> managementUnitTree(@RequestParam(required = false)String orgCode) {
RequestContext.setAppKey("AMOS_STUDIO");
RequestContext.setProduct("AMOS_STUDIO_WEB");
RequestContext.setToken(requestContext.getToken());
Collection result = unitInfoServiceImpl.getManagementUnitTree(orgCode);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/unitRegister")
@ApiOperation(httpMethod = "POST", value = "单位注册", notes = "单位注册")
public ResponseModel<UnitRegisterDto> save(@RequestBody UnitRegisterDto model) {
try {
RequestContext.setAppKey("AMOS_STUDIO");
RequestContext.setProduct("AMOS_STUDIO_WEB");
RequestContext.setToken(requestContext.getToken());
model = unitInfoServiceImpl.registerUnit(model);
return ResponseHelper.buildResponse(model);
} catch (Exception e) {
ResponseModel<UnitRegisterDto> response = new ResponseModel<>();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
response.setResult(null);
response.setDevMessage(e.getMessage());
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath());
return response;
}
}
/**
* 判断用户号码是否存在
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/hasExistPhone/{phone}")
@ApiOperation(httpMethod = "GET", value = "判断用户号码是否存在", notes = "判断用户号码是否存在")
public ResponseModel hasExistPhone( @PathVariable(value = "phone") String phone) {
try {
return CommonResponseUtil.success(Privilege.agencyUserClient.checkLoginId(phone).getResult());
} catch (Exception e) {
return CommonResponseUtil.failure("该手机号已经注册");
}
}
/**
* 发送手机号验证码
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/sendTelCode/{tel}")
@ApiOperation(httpMethod = "GET", value = "发送手机号验证码", notes = "发送手机号验证码")
public ResponseModel<Boolean> sendTelCode(@PathVariable(value = "tel") String tel,
@RequestParam(value = "type", required = false) String type) {
if (ValidationUtil.isEmpty(tel)) {
throw new BadRequest("参数校验失败.");
}
Boolean flag = true;
HashMap<String, String> params = new HashMap<>(3);
String code = this.getRandomCode();
params.put("code",code);
params.put("mobile",tel);
params.put("smsCode", smsTempCode);
try {
// sendSmsCode.sendSmsCode(tel, s);
Systemctl.smsClient.sendCommonSms(params).getResult();
// code 保存到缓存中
redisUtil.set(HYGF_USER_TEL + tel, code, time);
} catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage());
}
return ResponseHelper.buildResponse(flag);
}
/**
* 验证手机号验证码是否成功
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/verifyTelCode/{tel}/{code}")
@ApiOperation(httpMethod = "GET", value = "验证手机号验证码是否成功", notes = "验证手机号验证码是否成功")
public ResponseModel<Boolean> verifyTelCode(@PathVariable(value = "tel") String adminTel, @PathVariable(value = "code") String code) {
Boolean flag = false;
if (ValidationUtil.isEmpty(adminTel) || ValidationUtil.isEmpty(code)) {
throw new BadRequest("参数校验失败.");
}
if(redisUtil.hasKey(HYGF_USER_TEL + adminTel)) {
String redisCode = redisUtil.get(HYGF_USER_TEL + adminTel).toString();
if(code.equals(redisCode)) {
flag = true;
}
}
return ResponseHelper.buildResponse(flag);
}
private String getRandomCode(){
String code = "";
Random random = new Random();
for (int i = 0; i < 6; i++) {
int r = random.nextInt(10);
code = code + r;
}
return code;
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.Commercial;
import com.yeejoin.amos.boot.module.hygf.api.entity.ExtendedInformation;
import com.yeejoin.amos.boot.module.hygf.api.entity.Information;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.SurveyDetails;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPeasantHouseholdService;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.stream.Collectors;
/**
* 农户信息服务实现类
......@@ -17,11 +26,66 @@ import java.util.List;
*/
@Service
public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto,PeasantHousehold,PeasantHouseholdMapper> implements IPeasantHouseholdService {
@Autowired
SurveyInformationServiceImpl surveyInformationService;
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
public boolean deletePeasantHouseholdBySequenceNbr(Long sequenceNbr){
PeasantHouseholdDto peasantHouseholdDto = this.queryBySeq(sequenceNbr);
Long surveyInformationId = peasantHouseholdDto.getSurveyInformationId();
//删除勘察基本信息
surveyInformationService.deleteBySeq(surveyInformationId);
//删除扩展信息
QueryWrapper<ExtendedInformation> extendedInformationDeleteWrapper = new QueryWrapper<>();
extendedInformationDeleteWrapper.lambda().eq(ExtendedInformation::getSurveyInformationId,surveyInformationId);
extendedInformationService.getBaseMapper().delete(extendedInformationDeleteWrapper);
//删除勘察明细
QueryWrapper<SurveyDetails> surveyDetailsDeleteWrapper = new QueryWrapper<>();
surveyDetailsDeleteWrapper.lambda().eq(SurveyDetails::getSurveyInformationId,surveyInformationId);
surveyDetailsService.getBaseMapper().delete(surveyDetailsDeleteWrapper);
//删除商务信息
QueryWrapper<Commercial> commercialDeleteWrapper = new QueryWrapper<>();
commercialDeleteWrapper.lambda().eq(Commercial::getSurveyInformationId,surveyInformationId);
commercialService.getBaseMapper().delete(commercialDeleteWrapper);
//删除资料归档信息
QueryWrapper<Information> informationDeleteWrapper = new QueryWrapper<>();
informationDeleteWrapper.lambda().eq(Information::getSurveyInformationId,surveyInformationId);
informationService.getBaseMapper().delete(informationDeleteWrapper);
//删除农户信息
return this.deleteBySeq(sequenceNbr);
}
/**
* 分页查询
*/
public Page<PeasantHouseholdDto> queryForPeasantHouseholdPage(Page<PeasantHouseholdDto> page) {
return this.queryForPage(page, null, false);
public Page<PeasantHouseholdDto> queryForPeasantHouseholdPage(Page<PeasantHouseholdDto> page,String developerCode,@Condition(Operator.like) String ownersName) {
Page<PeasantHouseholdDto> peasantHouseholdDtoPage = this.queryForPage(page, null, false,developerCode,ownersName);
List<PeasantHouseholdDto> records = peasantHouseholdDtoPage.getRecords();
List<PeasantHouseholdDto> newRecords = records.stream().map(item -> {
if (item.getSurveyOrNot() == 0) {
item.setSurveyOrNotText("待勘察");
} else if (item.getSurveyOrNot() == 1) {
item.setSurveyOrNotText("已勘察");
} else if (item.getSurveyOrNot() == 2) {
item.setSurveyOrNotText("提交审核");
}
item.setProjectAddressName(item.getProjectAddressName()+"/"+item.getProjectAddressDetail());
return item;
}).collect(Collectors.toList());
peasantHouseholdDtoPage.setRecords(newRecords);
return peasantHouseholdDtoPage;
}
/**
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.*;
......@@ -11,6 +13,8 @@ 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.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -18,6 +22,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
......@@ -67,23 +72,88 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) {
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto,String operationType) {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
//更新勘察基本信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
surveyInformation.setReview(0);
this.saveOrUpdate(surveyInformation);
SurveyDetails surveyDetails = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyDetails(), SurveyDetails.class);
surveyDetailsService.save(surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr()));
//更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(), ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
extendedInformationService.saveOrUpdate(extendedInformation);
//更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
surveyDetailsService.saveOrUpdate(surveyDetails);
//更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 2));
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
commercialService.saveOrUpdate(commercial);
//更新资料归档信息
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()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
informationService.saveOrUpdate(information);
//勘察后,更新状态
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformation.getSequenceNbr());
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
if("submit".equals(operationType)){
peasantHousehold.setSurveyOrNot(1);
}else if("apply".equals(operationType)){
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
}
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 2));
//常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 2));
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
}
......@@ -91,40 +161,67 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
SurveyInformation surveyInformation = this.getById(surveyInformationId);
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = this.baseMapper.selectOne(queryWrapper);
surveyInfoAllDto.setSurveyInformation(BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class));
QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new QueryWrapper<>();
peasantHouseholdQueryWrapper.eq("surveyInformationId", surveyInformationId);
peasantHouseholdQueryWrapper.eq("survey_information_id", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation().setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if(!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())){
surveyInfoAllDto.getSurveyInformation().setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if(peasantHousehold.getPermanentAddress() ==null){
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
if(surveyDetails == null){
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
}else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
if(information == null){
surveyInfoAllDto.setInformation(new InformationDto());
}else {
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(information == null){
surveyInfoAllDto.setCommercial(new CommercialDto());
}else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if(commercial !=null && !StringUtils.isEmpty(commercial.getProjectAddressName())){
surveyInfoAllDto.getCommercial().setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("surveyInformationId", surveyInformationId);
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
if(information == null){
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
}else {
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
return surveyInfoAllDto;
}
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.hygf.api.dto.CommerceInfoDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UnitRegisterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.CommerceInfo;
import com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.hygf.api.fegin.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UnitInfoMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IUnitInfoService;
import com.yeejoin.amos.boot.module.hygf.api.dto.UnitInfoDto;
import com.yeejoin.amos.component.feign.config.TokenOperation;
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 com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 经销商人员信息服务实现类
......@@ -17,6 +48,24 @@ import java.util.List;
*/
@Service
public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitInfoMapper> implements IUnitInfoService {
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE";
@Value("${regulator.unit.code}")
private String code;
@Value("${dealer.appcode}")
private String appCodes;
@Autowired
RedisUtils redisUtil;
@Autowired
PrivilegeFeginService privilegeFeginService;
@Autowired
CommerceInfoServiceImpl commerceInfoService;
/**
* 分页查询
*/
......@@ -30,4 +79,193 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
public List<UnitInfoDto> queryForUnitInfoList() {
return this.queryForList("" , false);
}
@Override
public Collection getManagementUnitTree(String orgCode) {
List<LinkedHashMap> companyModels = (List<LinkedHashMap>) redisUtil.get(COMPANY_TREE_REDIS_KEY);
if (ValidationUtil.isEmpty(companyModels)) {
companyModels = creatTree();
}
if (!ValidationUtil.isEmpty(orgCode)) {
companyModels = findNodesByCondition(companyModels, "orgCode", orgCode, "children");
companyModels = (List<LinkedHashMap>) companyModels.get(0).get("children");
}
return companyModels;
}
@Override
public UnitRegisterDto registerUnit(UnitRegisterDto model) {
UnitInfoDto regUnitInfo = model.getUnitInfoDto();
try {
// 1. 调用平台进行创建单位、用户信息
this.createCompanyAndUser(regUnitInfo);
// 2.插入单位表
regUnitInfo = this.createWithModel(regUnitInfo);
CommerceInfoDto commerceInfo = model.getCommerceInfoDto();
commerceInfo.setUnitSeq(regUnitInfo.getSequenceNbr());
commerceInfo = commerceInfoService.createWithModel(commerceInfo);
model.setCommerceInfoDto(commerceInfo);
model.setUnitInfoDto(regUnitInfo);
} catch (Exception e) {
log.error(e.getMessage(), e);
// 失败后回滚:删除已经创建的企业信息
if (!ObjectUtils.isEmpty(regUnitInfo.getAmosCompanySeq())) {
FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient
.seleteOne(regUnitInfo.getAmosCompanySeq());
if (feignClientResult != null) {
Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq().toString());
}
}
// 失败后回滚:删除已经创建的管理员账号
if (StringUtils.isNotEmpty(regUnitInfo.getAdminUserId())) {
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient
.queryByUserId(regUnitInfo.getAdminUserId());
if (feignClientResult != null) {
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
}
}
throw new RuntimeException(e.getMessage());
}
return model;
}
private static List<LinkedHashMap> findNodesByCondition(List<LinkedHashMap> nodes, String conditionName,
String condition, String childName) {
return nodes.stream()
.flatMap(node -> Stream.concat(
node.get(conditionName).equals(condition) ? Stream.of(node) : Stream.empty(),
node.get(childName) != null ? findNodesByCondition((List<LinkedHashMap>) node.get(childName),
conditionName, condition, condition).stream() :
Stream.empty()
))
.collect(Collectors.toList());
}
private List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtil.set(COMPANY_TREE_REDIS_KEY, resultTree);
return resultTree;
}
/**
* 将管辖机构树中children为[]的修改为null
*
* @param result
* @return
*/
private List<LinkedHashMap> updateNullChildren(List<LinkedHashMap> result) {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//将管辖机构树中children为[]的修改为null
if (e.get("children") != null) {
if (((List<LinkedHashMap>) e.get("children")).size() == 0) {
e.put("children", null);
}
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
updateNullChildren((List<LinkedHashMap>) e.get("children"));
}
}
return result;
}
/**
* 删除管辖机构树中level为使用单位的数据
* @param result 管辖机构树
* @return 筛选过滤后不包含使用单位的管辖机构树
*/
private List<LinkedHashMap> deleteRegulatorTreeData(List<LinkedHashMap> result) {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
//删除使用单位
if ("company".equals(e.get("level"))) {
it.remove();
}
if (e.get("companyName").toString().contains("行政审批局")) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
deleteRegulatorTreeData((List<LinkedHashMap>) e.get("children"));
}
}
return result;
}
private void createCompanyAndUser(UnitInfoDto regUnitInfo) {
CompanyModel companyInfo = new CompanyModel();
FeignClientResult<AgencyUserModel> userResult = null;
try {
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null, null);
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
// 1创建公司
companyInfo.setAddress(regUnitInfo.getRegisterPcd());
companyInfo.setAgencyCode("JXIOP");
companyInfo.setParentId(Long.parseLong(regUnitInfo.getManagementUnitId()));
companyInfo.setLevel("station");
companyInfo.setCompanyName(regUnitInfo.getName());
// companyInfo.setCompanyCode(regUnitInfo.getUnitTypeCode());
companyInfo.setContact(regUnitInfo.getHeadName());
companyInfo.setCompanyType(regUnitInfo.getUnitType());
companyInfo.setLandlinePhone(regUnitInfo.getHeadPhone());
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
if (companyResult == null || companyResult.getResult() == null) {
throw new BadRequest("单位注册失败");
}
String adminUserName = regUnitInfo.getAdminUserName();
String loginName = regUnitInfo.getAdminLoginName();
String pwd = regUnitInfo.getAdminLoginPwd();
String adminTel = regUnitInfo.getAdminPhone();
// 2 创建平台用户
companyInfo = companyResult.getResult();
AgencyUserModel agencyUserModel = new AgencyUserModel();
agencyUserModel.setUserName(loginName);
agencyUserModel.setRealName(adminUserName);
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(pwd);
agencyUserModel.setRePassword(pwd);
agencyUserModel.setAgencyCode("JXIOP");
agencyUserModel.setMobile(adminTel);
List<String> split = Arrays.asList(StringUtils.split(appCodes, ','));
Map<Long, List<Long>> roleSeqMap = new HashMap<>();
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
userRoleList = allRoleList.stream().filter(r -> r.getRoleName().equals(regUnitInfo.getUnitTypeCode()))
.collect(Collectors.toList());
userRoleList.forEach(r -> {
if (!roleIds.contains(r.getSequenceNbr())) {
roleIds.add(r.getSequenceNbr());
}
});
roleSeqMap.put(companyInfo.getSequenceNbr(), roleIds);
orgRoles.put(companyInfo.getSequenceNbr(), userRoleList);
agencyUserModel.setAppCodes(split);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqMap);
userResult = Privilege.agencyUserClient.create(agencyUserModel);
if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败");
}
String[] userIds = { userResult.getResult().getUserId() };
regUnitInfo.setAdminUserId(userResult.getResult().getUserId());
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr());
} catch (Exception e) {
// 删除已经创建的 企业信息
if (companyInfo != null && companyInfo.getSequenceNbr() != null) {
Privilege.companyClient.deleteCompany(companyInfo.getSequenceNbr() + "");
}
if (userResult != null && userResult.getResult() != null
&& StringUtils.isNotEmpty(userResult.getResult().getUserId())) {
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
}
log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage());
}
}
}
\ No newline at end of file
## DB properties:
spring.datasource.url=jdbc:mysql://172.16.10.220:3306/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.10.220:3306/hygf_database?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
## eureka properties:
......@@ -85,3 +85,20 @@ spring.activemq.user=admin
spring.activemq.password=admin
spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
regulator.unit.code=86*258
# 经销商应用code
dealer.appcode=studio_normalapp_5133538
hygf.sms.tempCode=SMS_HYGF_0001
# 华为短信相关配置
sms.huawei.url=https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1
sms.huawei.appKey=n3FYPWO7Heo1ze212QRBvF4VA2E2
sms.huawei.appSecret=IFhiMpWROi7w4Ei21ZbfIjKyt97b
# 模板id
sms.huawei.templateId=6aaeb4bf916d4db0a1942c598912519e
# 签名通道号
sms.huawei.sender=1069368924410006092
# 签名名称
sms.huawei.signature=华为云短信测试
\ No newline at end of file
......@@ -60,3 +60,8 @@ spring.http.encoding.force=true
privilege.fegin.name=AMOS-API-PRIVILEGE
feign.client.config.default.connect-timeout=20000
feign.client.config.default.read-timeout=20000
amos.system.user.user-name=hygf_admin
amos.system.user.password=a1234567
amos.system.user.product=AMOS_STUDIO_WEB
amos.system.user.app-key=AMOS_STUDIO
......@@ -35,4 +35,6 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId);
List<Map<String, String>> getBoosterStationInfo(@Param("gatewayId") String gatewayId);
}
......@@ -88,4 +88,27 @@
from fan_config_power
where gateway_id = #{gatewayId}
</select>
<select id="getBoosterStationInfo" resultType="java.util.Map">
select
`sequence_nbr` as id,
`gateway_id` as gatewayId,
`booster_name` as text,
booster_name as value,
<!-- `booster_code` as value,-->
`sort` as sort
from booster_station_info
<where>
<if test="gatewayId != null and gatewayId != ''">
AND gateway_id = #{gatewayId}
</if>
<!-- <if test="sort != null and sort != ''">-->
<!-- AND sort = #{sort}-->
<!-- </if>-->
<!-- <if test="boosterName != null and boosterName != '' and (sort = null or sort = '')">-->
<!-- AND booster_name = #{boosterName}-->
<!-- </if>-->
</where>
ORDER BY sort ASC
</select>
</mapper>
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.SjglZsjZsbtzServiceImpl;
......@@ -23,10 +24,13 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
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;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -70,58 +74,63 @@ public class DemoController extends BaseController {
public StationBasic demoTest() {
return stationBasicServiceimpl.getById(1660231556607774721L);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试中间库")
@GetMapping("/test1")
public List<Test> demoTest1() {
return testServiceimpl.getList();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试influxdb")
@GetMapping("/test3")
public void demoTest2() {
String sql = "SELECT createdTime ,gatewayId,address,valueLabel FROM \"iot_data\" WHERE equipmentSpecificName=~/.*27风机.*/ and gatewayId='1668801435891929089' GROUP BY equipmentIndex ORDER BY time desc LIMIT 600";
List<IndexDto> list=influxDButils.getListData(sql,IndexDto.class);
String sql = "SELECT * FROM indicators_1668801435891929089";
String sql1 = "SELECT * FROM indicators_1668801570352926721";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> list2 = influxDButils.getListData(sql1, IndicatorsDto.class);
System.out.println(list.size());
System.out.println(list2.size());
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试获取风速平均值")
@ApiOperation(value = "初始化风机")
@GetMapping("/test4")
public void demoTest3() {
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
QueryWrapper<MonitorFanIndicator> QueryWrapper= new QueryWrapper<>();
QueryWrapper.eq("gateway","1668801435891929089");
long DATE =new Date().getTime();
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
QueryWrapper.eq("gateway", "1668801435891929089");
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list=monitorFanIndicatorregionMapper.selectList(QueryWrapper);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("address",monitorFanIndicator.getIndexAddress() );
tag.put("address", monitorFanIndicator.getIndexAddress());
tag.put("dataType", monitorFanIndicator.getDataType());
tag.put("equipmentSpecificName",monitorFanIndicator.getFanCode() );
tag.put("equipmentsIdx",monitorFanIndicator.getAddressGateway() );
tag.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
tag.put("gatewayId", monitorFanIndicator.getGateway());
tag.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "");
maps2.put("valueLabel","" );
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
// maps2.put("createdTime", "2023-07-05 18:30:26");
// maps2.put("unit", monitorFanIndicator.getUnit());
// maps2.put("value", "");
// maps2.put("valueLabel","" );
// maps2.put("traceId", "");
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
maps2.put("systemType", monitorFanIndicator.getSystemType());
influxDbConnection.insert("indicators_"+monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -129,8 +138,8 @@ public class DemoController extends BaseController {
@GetMapping("/test5")
public void demoTest4() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("test", String.valueOf(Math.random() *1000));
hashMap.put("test1", String.valueOf(Math.random() *100));
hashMap.put("test", String.valueOf(Math.random() * 1000));
hashMap.put("test1", String.valueOf(Math.random() * 100));
try {
emqKeeper.getMqttClient().publish("test_topic", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("test_topic1", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
......@@ -140,5 +149,58 @@ public class DemoController extends BaseController {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站")
@GetMapping("/test6")
public void demoTest5() {
//!!!!!!!!!!!!!!注意 初始化升压站的时候需要先更新monitor_fan_indicator_copy2表数据 且修改entity的表映射为monitor_fan_indicator_copy2
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
QueryWrapper.eq("gateway", "1668801570352926721");
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
//-------------------tag----------
tag.put("address", monitorFanIndicator.getIndexAddress());
tag.put("dataType", monitorFanIndicator.getDataType());
tag.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
tag.put("gatewayId", monitorFanIndicator.getGateway());
tag.put("isAlarm", monitorFanIndicator.getIsAlarm());
//--------------------field------------------------
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", "");
maps2.put("value", "");
maps2.put("valueLabel", "");
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", "");
maps2.put("frontModule", "");
maps2.put("systemType", "");
//升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
if (!ObjectUtils.isEmpty(monitorFanIndicator.getFrontModule())) {
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
}
if (!ObjectUtils.isEmpty(monitorFanIndicator.getSystemType())) {
maps2.put("systemType", monitorFanIndicator.getSystemType());
}
if (!ObjectUtils.isEmpty(monitorFanIndicator.getUnit())) {
maps2.put("unit", monitorFanIndicator.getUnit());
}
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试动态图片")
@GetMapping("/test7")
public ResponseModel<HashMap<String, String>> demoTest6() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("url", "upload/jxiop/amos_studio/758F6F4BC695B777899485DB0C7E5D3.gif");
return ResponseHelper.buildResponse(hashMap);
}
}
......@@ -11,10 +11,12 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.elasticsearch.index.Index;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -26,6 +28,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
......@@ -53,6 +56,9 @@ public class MonitorFanIdxController extends BaseController {
@Value("${gl.avg.column}")
String avgColumn;
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据设备编号、场站id、前段展示模块、系统类型查询表数据")
@GetMapping("/getFanIdxInfoByPage")
......@@ -91,6 +97,31 @@ public class MonitorFanIdxController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态图片")
@GetMapping("/getFanStatusListImage")
public ResponseModel<IPage<HashMap<String,String>>> getFanStatusListImages() {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList("1660231556607774721");
List<IndexDto> collect = fanStatusList.stream()
.limit(999)
.collect(Collectors.toList());
IPage<HashMap<String,String>> page = new Page<>();
HashMap<String,String> hashMap = new HashMap<>();
List<IndexDto> indexDtoList = collect.stream().sorted(Comparator.comparing(IndexDto::getEquipmentNumber)).collect(Collectors.toList());
for (int i = 1; i <= indexDtoList.size(); i++) {
IndexDto indexDto = indexDtoList.get(i-1);
hashMap.put("url"+i,fanStatusImagePathPrefix+"/"+"风机-"+indexDto.getState()+".gif");
hashMap.put("name"+i,indexDto.getEquipmentNumber());
}
page.setTotal(10);
page.setSize(10);
page.setCurrent(1);
List<HashMap<String,String>> hashMapList = new ArrayList<>();
hashMapList.add(hashMap);
page.setRecords(hashMapList);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机数量")
@GetMapping("/getFanNum")
public ResponseModel<Integer> getFanNum(@RequestParam(value = "stationId", required = false) String stationId) {
......@@ -251,6 +282,7 @@ public class MonitorFanIdxController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站光字牌/开关-通用")
@GetMapping("/getStatusGzp")
public ResponseModel<IPage<Map<String, Object>>> getStatusGzp(@RequestParam(value = "stationId", required = true)String stationId,String frontModule,String systemType) {
......@@ -300,4 +332,34 @@ public class MonitorFanIdxController extends BaseController {
@ApiOperation(value = "获取升压站信息 通过排序等")
@GetMapping("/getBoosterStationInfo")
public ResponseModel<List<Map<String, String>>> getBoosterStationInfo(@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorFanIndicator.getBoosterStationInfo(stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据id获取场站信息")
@GetMapping("/getByStationId")
public ResponseModel<IPage<StationBasic>> getByStationId(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic oneByStationNumber = monitorFanIndicator.getOneByStationNumber(stationId);
List<StationBasic> stationBasics = Collections.singletonList(oneByStationNumber);
IPage<StationBasic> result = new Page<>();
result.setRecords(stationBasics);
result.setCurrent(1);
result.setTotal(stationBasics.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "夏造运行列表API")
@GetMapping("/runningPageByStationId")
public ResponseModel<ResultsData> runningPageByStationId(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId) {
ResultsData resultsData = monitorFanIndicatorImpl.runningPageByStationId(current, size, stationId);
return ResponseHelper.buildResponse(resultsData);
}
}
......@@ -11,7 +11,7 @@ public class CompletionOfPowerIndicatorsDto {
private String installCapactity;
//风速或者辐照度
private String windSpeedOrIrradiance;
// 有功功率
//有功功率
private String activePower;
//日发电量
private String dailyPower;
......
......@@ -245,7 +245,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
private StationBasic getOneByStationNumber(String stationId) {
public StationBasic getOneByStationNumber(String stationId) {
return stationBasicMapper.selectById(stationId);
}
......@@ -665,7 +665,51 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
}
public List<Map<String, String>> getBoosterStationInfo(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(stationBasic.getFanGatewayId());
return boosterStationInfo;
}
public ResultsData runningPageByStationId(int current, int size, String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String baseSql = "SELECT equipmentNumber, value FROM \"indicators_%s\" where equipmentIndexName = '%s'";
String windSql = String.format(baseSql, stationBasic.getFanGatewayId(), "风向角");
List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(windSql,IndicatorsDto.class);
String powerSql = String.format(baseSql, stationBasic.getFanGatewayId(), "有功功率");
List<IndicatorsDto> powerSqlList = influxDButils.getListDataAll(powerSql,IndicatorsDto.class);
Map<String, String> powerSqlMap = powerSqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
String windSpeedSql = String.format(baseSql, stationBasic.getFanGatewayId(), "瞬时风速");
List<IndicatorsDto> windSpeedSqlList = influxDButils.getListDataAll(windSpeedSql,IndicatorsDto.class);
Map<String, String> windSpeedSqlMap = windSpeedSqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
String electricitySql = String.format(baseSql, stationBasic.getFanGatewayId(), "日发电量");
List<IndicatorsDto> electricitySqlList = influxDButils.getListDataAll(electricitySql,IndicatorsDto.class);
Map<String, String> electricitySqlMap = electricitySqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
ArrayList<Map<String, String>> resultList = new ArrayList<>();
windSqlList.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("equipmentNumber", item.getEquipmentNumber());
stringStringHashMap.put("wind", item.getValue());
stringStringHashMap.put("power", powerSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("windSpeed", windSpeedSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("electricity", electricitySqlMap.get(item.getEquipmentNumber()));
resultList.add(stringStringHashMap);
});
//构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelEquipmentNumber = new ColModel("equipmentNumber", "equipmentNumber", "风机编码", "风机编码", "dataGrid", "equipmentNumber");
ColModel colModelPower = new ColModel("power", "power", "有功功率", "有功功率", "dataGrid", "power");
ColModel colModelWindSpeed = new ColModel("windSpeed", "windSpeed", "风速", "风速", "dataGrid", "windSpeed");
ColModel colModelWind = new ColModel("wind", "wind", "风向", "风向", "dataGrid", "wind");
ColModel colModelElectricity = new ColModel("electricity", "electricity", "日发电量", "日发电量", "dataGrid", "electricity");
List<ColModel> listColModel = Arrays.asList(colModelEquipmentNumber, colModelPower, colModelWindSpeed, colModelWind, colModelElectricity);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
}
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.netflix.loadbalancer.RetryRule;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
......@@ -13,11 +14,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.File;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
......@@ -26,7 +29,22 @@ import java.util.stream.Collectors;
@Service
public class MonitoringServiceIMQTTmpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceIMQTTmpl.class);
//社会贡献Cron表达式
private final String totalSocialContributionCron = "0 0/1 * * * *";
//区域完成情况 Cron表达式
private final String completionOfPowerIndicatorsByProvinceNameCron = "0/30 * * * * *";
//风电站状态Cron表达式
private final String fanStatusStatisticsCron = "0/30 0 * * * *";
//风电站总览Cron表达式
private final String fanstationOverviewCron = "0/30 * * * * *";
//风电站功率曲线图表达式
private final String fanStationPowerBightCron = "0/30 * * * * *";
//风机状态列表Cron表达式
private final String fanStatusListCron = "0/30 * * * * *";
//风机实时数据Cron表达式
private final String fanCurrentDataCron = "0 0/1 * * * *";
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
/**
* 场站mapper
*/
......@@ -45,10 +63,11 @@ public class MonitoringServiceIMQTTmpl {
@Autowired
CommonServiceImpl commonService;
/**
* 社会贡献定时消息发送 1分钟推送一次
*/
@Scheduled(cron = "0 0/1 * * * *")
@Scheduled(cron = totalSocialContributionCron)
public void getTotalSocialContribution() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------社会贡献定时执行----------------------------------------------");
......@@ -100,7 +119,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 区域实时数据消息推送-30s一次
*/
@Scheduled(cron = "0/30 * * * * *")
@Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron)
public void getCompletionOfPowerIndicatorsByProvinceName() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
......@@ -157,7 +176,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时推送-风电站风机状态统计数据
*/
@Scheduled(cron = "0/30 0 * * * *")
@Scheduled(cron = fanStatusStatisticsCron)
public void getFanStatusStatistics() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
......@@ -180,7 +199,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时推送-风电站风场总概览
*/
@Scheduled(cron = "0/30 * * * * *")
@Scheduled(cron = fanstationOverviewCron)
public void getFanstationOverview() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
......@@ -243,7 +262,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时推送-场站功率曲线总概览
*/
@Scheduled(cron = "0/30 * * * * *")
@Scheduled(cron = fanStationPowerBightCron)
public void getFanStationPowerBight() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
......@@ -261,7 +280,7 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时同送-获取各场站的风机列表
*/
@Scheduled(cron = "0/30 * * * * *")
@Scheduled(cron = fanStatusListCron)
public void getFanStatusList() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
......@@ -272,8 +291,10 @@ public class MonitoringServiceIMQTTmpl {
.collect(Collectors.toList());
page.setTotal(fanStatusList.size());
page.setRecords(collect);
IPage<HashMap<String,String>> fanStatusListImages =getFanStatusListImages(collect);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationFanStatusList_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationFanStatusListImages_topic", JSON.toJSON(fanStatusListImages).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站风机列表数据消息=================== 成功!" + JSON.toJSONString(page));
} catch (Exception exception) {
logger.error("-----------------发送风电站风机列表数据消息=================== 失败!");
......@@ -281,43 +302,80 @@ public class MonitoringServiceIMQTTmpl {
});
}
@Scheduled(cron = "0 0/1 * * * *")
@Scheduled(cron = fanCurrentDataCron)
public void getFanCurrentData() {
Integer current = 1;
Integer size = 99;
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList(String.valueOf(stationBasic.getSequenceNbr()));
fanStatusList.forEach(indexDto -> {
String stationBasicId = String.valueOf(stationBasic.getSequenceNbr());
String equipmentNumber = indexDto.getEquipmentNumber();
String topicPrefix = stationBasicId+"_"+equipmentNumber;
String topicPrefix = stationBasicId + "_" + equipmentNumber;
IndexDto info = monitorFanIndicator.getFanBasicInfoByEquipNum(equipmentNumber, stationBasicId);
HashMap<String,Object> windspeddInfo= new HashMap<>();
String windspeddInfoValue = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber,"实时监控表计","风速");
windspeddInfo.put("value",windspeddInfoValue);
windspeddInfo.put("value",100);
String activepower = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber,"实时监控表计","有功功率");
String powerFrequency = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber,"实时监控表计","电网频率");
String hubSpeed = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber,"实时监控表计","轮毂转速");
HashMap<String, List<String>> realTimeTemperatureResult = monitorFanIndicator.getRealTimeTemperature(equipmentNumber, stationBasicId,"实时监控表计");
IPage<IndexDto> realTimedata=monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber,stationBasicId,"实时运行数据",1,99,"");
Map<String, Object> windSpeedOfFan=monitorFanIndicator.getDetailsWindSpeed(stationBasic.getFanGatewayId(),equipmentNumber);
HashMap<String, Object> windspeddInfo = new HashMap<>();
String windspeddInfoValue = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber, "实时监控表计", "风速");
windspeddInfo.put("value", windspeddInfoValue);
windspeddInfo.put("value", 100);
String activepower = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber, "实时监控表计", "有功功率");
String powerFrequency = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber, "实时监控表计", "电网频率");
String hubSpeed = monitorFanIndicator.getFanDataByType(stationBasicId, equipmentNumber, "实时监控表计", "轮毂转速");
HashMap<String, List<String>> realTimeTemperatureResult = monitorFanIndicator.getRealTimeTemperature(equipmentNumber, stationBasicId, "实时监控表计");
IPage<IndexDto> realTimedata = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "");
Map<String, Object> windSpeedOfFan = monitorFanIndicator.getDetailsWindSpeed(stationBasic.getFanGatewayId(), equipmentNumber);
//发电机系统
IPage<IndexDto> fdjSystem = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "发电机系统");
List<Map<String, Object>> fdjSystemStatus = monitorFanIndicator.getStatusMonitoring(stationBasic.getFanGatewayId(), equipmentNumber, "发电机系统");
//机舱与塔筒系统
IPage<IndexDto> jcyttSystem = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "机舱与塔筒系统");
List<Map<String, Object>> jcyttSystemStatus = monitorFanIndicator.getStatusMonitoring(stationBasic.getFanGatewayId(), equipmentNumber, "机舱与塔筒系统");
//偏航与液压系统
IPage<IndexDto> phyyySystem = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "偏航与液压系统");
List<Map<String, Object>> phyyySystemStatus = monitorFanIndicator.getStatusMonitoring(stationBasic.getFanGatewayId(), equipmentNumber, "偏航与液压系统");
//变流与主控系统
IPage<IndexDto> blyzkSystem = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "变流与主控系统");
List<Map<String, Object>> blyzkSystemStatus = monitorFanIndicator.getStatusMonitoring(stationBasic.getFanGatewayId(), equipmentNumber, "变流与主控系统");
//变流与主控系统
IPage<IndexDto> ylSystem = monitorFanIndicator.getFanIdxInfoByPage(equipmentNumber, stationBasicId, "实时运行数据", current, size, "叶轮系统");
List<Map<String, Object>> ylSystemStatus = monitorFanIndicator.getStatusMonitoring(stationBasic.getFanGatewayId(), equipmentNumber, "叶轮系统");
try {
//{stationBasicId}_{equipmentNumber}_fanBasicInfo_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_fanBasicInfo_topic", JSON.toJSON(info).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_fanBasicInfo_topic", JSON.toJSON(info).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windspeddInfo_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_windspeddInfo_topic", JSON.toJSON(windspeddInfo).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_windspeddInfo_topic", JSON.toJSON(windspeddInfo).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_activepower_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_activepower_topic", activepower.getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_activepower_topic", activepower.getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_powerFrequency_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_powerFrequency_topic", powerFrequency.getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_powerFrequency_topic", powerFrequency.getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_hubSpeed_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_hubSpeed_topic", hubSpeed.getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_hubSpeed_topic", hubSpeed.getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_realTimeTemperature_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_realTimeTemperature_topic", JSON.toJSON(realTimeTemperatureResult).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_realTimeTemperature_topic", JSON.toJSON(realTimeTemperatureResult).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_realTimedata_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_realTimedata_topic", JSON.toJSON(realTimedata).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_realTimedata_topic", JSON.toJSON(realTimedata).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_windSpeedOfFan_topic", JSON.toJSON(windSpeedOfFan).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_fdjSystem_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_fdjSystem_topic", JSON.toJSON(fdjSystem).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_fdjSystemStatus_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_fdjSystemStatus_topic", JSON.toJSON(fdjSystemStatus).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_jcyttSystem_topic", JSON.toJSON(jcyttSystem).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_jcyttSystemStatus_topic", JSON.toJSON(jcyttSystemStatus).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_phyyySystem_topic", JSON.toJSON(phyyySystem).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_phyyySystemStatus_topic", JSON.toJSON(phyyySystemStatus).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_blyzkSystem_topic", JSON.toJSON(blyzkSystem).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix+ "_windSpeedOfFan_topic", JSON.toJSON(windSpeedOfFan).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(topicPrefix + "_blyzkSystemStatus_topic", JSON.toJSON(blyzkSystemStatus).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_ylSystem_topic", JSON.toJSON(ylSystem).toString().getBytes("UTF-8"), 1, true);
//{stationBasicId}_{equipmentNumber}_windSpeedOfFan_topic
emqKeeper.getMqttClient().publish(topicPrefix + "_ylSystemStatus_topic", JSON.toJSON(ylSystemStatus).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站风机基础数据消息=================== 成功!");
} catch (Exception exception) {
logger.error("-----------------发送风电站风机基础数据消息=================== 失败!");
......@@ -325,4 +383,28 @@ public class MonitoringServiceIMQTTmpl {
});
});
}
/**
* @deprecated 根据查询出来的风机状态返回风机的状态图片
* @param collect 根据网关id查询出来的数据
* @return 加工后风机实时运行状态图列表数据
*/
public IPage<HashMap<String, String>> getFanStatusListImages(List<IndexDto> collect) {
IPage<HashMap<String, String>> page = new Page<>();
HashMap<String, String> hashMap = new HashMap<>();
//对于查出来的风机进行排序,便于数据处理
List<IndexDto> indexDtoList = collect.stream().sorted(Comparator.comparing(IndexDto::getEquipmentNumber)).collect(Collectors.toList());
for (int i = 1; i <= indexDtoList.size(); i++) {
IndexDto indexDto = indexDtoList.get(i - 1);
hashMap.put("url" + i, fanStatusImagePathPrefix + File.separator + "风机-" + indexDto.getState() + ".gif");
hashMap.put("name" + i, indexDto.getEquipmentNumber());
}
page.setTotal(10);
page.setSize(100);
page.setCurrent(1);
List<HashMap<String, String>> hashMapList = new ArrayList<>();
hashMapList.add(hashMap);
page.setRecords(hashMapList);
return page;
}
}
......@@ -99,3 +99,6 @@ spring.activemq.user=admin
spring.activemq.password=admin
spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
# ?????????
fan.statuts.stattuspath=upload/jxiop/device_status
......@@ -44,4 +44,9 @@ public interface ICtiService {
* @return
*/
Map<Object, Object> getUserStatus();
/**
* 根据坐席配置获取主叫号码
*/
String getCallPhone();
}
......@@ -3,12 +3,9 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.CtiDto;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,11 +22,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.security.MessageDigest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -109,5 +102,16 @@ public class CtiController extends BaseController {
return ResponseHelper.buildResponse(recordInfo);
}
/**
* 获取坐席技能组对应主叫号码信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/callPhone")
@ApiOperation(httpMethod = "GET", value = "获取坐席技能组对应主叫号码信息", notes = "获取坐席技能组对应主叫号码信息")
public ResponseModel<String> getCallPhone() {
String callPhone = ctiService.getCallPhone();
return ResponseHelper.buildResponse(callPhone);
}
}
......@@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.enums.DictTypeEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsCitInfo;
......@@ -40,6 +43,9 @@ public class CtiServiceImpl implements ICtiService {
@Autowired
TzsCitInfoServiceImpl ctiInfoService;
@Autowired
DataDictionaryServiceImpl dictionaryService;
/**
* token 过期时间, cti 系统为7200 ,tzs 系统小于7200 防止获取到无效token
*/
......@@ -229,8 +235,17 @@ public class CtiServiceImpl implements ICtiService {
return encryptStr;
}
@Override
public String getCallPhone() {
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
LambdaQueryWrapper<TzsCitInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzsCitInfo::getCtiUserId,me.getUserId());
TzsCitInfo ctiInfo = ctiInfoService.getOne(wrapper);
if (!ValidationUtil.isEmpty(ctiInfo)) {
String groupCode = ctiInfo.getGid().split(",")[0];
DataDictionary dataDictionary = dictionaryService.getByCode(groupCode, DictTypeEnum.坐席技能组.getType());
return dataDictionary.getName();
}
return "";
}
}
\ No newline at end of file
......@@ -188,7 +188,7 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
if (!ValidationUtil.isEmpty(elevator.getUseSiteCategory())) {
String categoryCode = elevator.getUseSiteCategory();
DataDictionary categoryDict = iDataDictionaryService.getByCode(categoryCode, "USE_SITE_CATEGORY");
useSiteCategory = categoryDict.getName();
useSiteCategory = ValidationUtil.isEmpty(categoryDict) ? "" : categoryDict.getName();
}
String useUnit = elevator.getUseUnit();
content = content.replace("$call_time",createTime).replace("$address",address).replace("$rescue_code",rescueCode).replace("$use_site_category",useSiteCategory);
......@@ -924,6 +924,7 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
if(infoCode.indexOf("1") != -1 && StringUtils.isNotBlank(dispatchTaskDto.getResponseUserTel())) { // 下发了短信
HashMap<String, String> params = new HashMap<>();
params.put("smsCode","SMS_TZS_0006");
params.put("mobile",dispatchTaskDto.getResponseUserTel());
params.put("content",dispatchTaskDto.getDispatchContext());
FeignClientResult<SmsRecordModel> result = Systemctl.smsClient.sendCommonSms(params);
}
......
......@@ -33,7 +33,6 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import liquibase.pro.packaged.O;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......
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