Commit c5120222 authored by tangwei's avatar tangwei

解决冲突

parents 1e8d1f0c 5c92bbac
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,8 @@ 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 device;
......@@ -55,54 +58,72 @@ 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;
@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;
/**
* 扩展信息
......@@ -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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
* 农户信息
......@@ -22,6 +26,9 @@ public class PeasantHouseholdDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察表id")
private Long surveyInformationId;
@ApiModelProperty(value = "农户信息编号")
private String peasantHouseholdNo;
......@@ -40,14 +47,22 @@ public class PeasantHouseholdDto extends BaseDto {
@ApiModelProperty(value = "定金")
private Float deposit;
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@ApiModelProperty(value = "创建时间")
private Date creationTime;
@ApiModelProperty(value = "项目地址")
private String projectAddress;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "常住是否相同")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> isPermanent;
@ApiModelProperty(value = "常住地址")
private String permanentAddress;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
@ApiModelProperty(value = "是否勘察 0,1")
private Integer surveyOrNot;
......@@ -68,4 +83,10 @@ public class PeasantHouseholdDto extends BaseDto {
private String permanentAddressDetail;
@ApiModelProperty(value = "开发人")
private String developer;
@ApiModelProperty(value = "常住地址")
private String permanentAddressName;
@ApiModelProperty(value = "项目地址")
private String projectAddressName;
}
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="PeasantHouseholdDto", description="农户信息")
public class PeasantHouseholdDtoP {
PeasantHouseholdDto farmerInformation;
}
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;
/**
* 勘察明细
......@@ -20,12 +24,16 @@ public class SurveyDetailsDto extends BaseDto {
private static final long serialVersionUID = 1L;
@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;
......@@ -43,7 +51,7 @@ public class SurveyDetailsDto extends BaseDto {
private Integer houseHeight;
@ApiModelProperty(value = "房屋偏向")
private Integer houseBias;
private String houseBias;
@ApiModelProperty(value = "房屋偏向备注")
private String houseBiasNotes;
......@@ -61,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;
......@@ -139,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 io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="SurveyInfoAllDto", description="勘察信息提交")
public class SurveyInfoAllDto {
// 资料归档
InformationDto information;
// 勘察信息详情
SurveyDetailsDto surveyDetails;
// 勘察信息
SurveyInformationDto surveyInformation;
// 扩展信息
ExtendedInformationDto extendedInformation;
// 商务信息
CommercialDto commercial;
}
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,4 +56,36 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = " 审核状态 0未审核,1审核中,2审核结束")
private Integer review;
@ApiModelProperty(value = "来源农户编号")
private String peasantHouseholdNo;
@ApiModelProperty(value = "业主姓名")
private String ownersName;
@ApiModelProperty(value = "联系电话")
private String telephone;
@ApiModelProperty(value = "身份证号")
private String idCard;
@ApiModelProperty(value = "邮箱")
private String mailbox;
@ApiModelProperty(value = "项目详细地址")
private String projectAddressDetail;
@ApiModelProperty(value = "常住详细地址")
private String permanentAddressDetail;
@ApiModelProperty(value = "项目地址")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "常住地址")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
@ApiModelProperty(value = "常住是否相同")
private List<String> isPermanent;
}
......@@ -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,12 +19,18 @@ 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;
/**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 商务类型
*/
@TableField("type")
......@@ -49,8 +57,8 @@ public class Commercial extends BaseEntity {
/**
* 省市区
*/
@TableField("project_address")
private String projectAddress;
@TableField(value = "project_address",typeHandler = FastjsonTypeHandler.class)
private List<Object> projectAddress;
/**
* 设备信息
......@@ -91,98 +99,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,11 +19,17 @@ 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;
/**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 农户信息编号
*/
......@@ -67,14 +75,26 @@ 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;
/**
* 常住地址
*/
@TableField("permanent_address_name")
private String permanentAddressName;
/**
* 项目地址
*/
@TableField("project_address_name")
private String projectAddressName;
/**
* 是否勘察 0,1
......
......@@ -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,12 +19,18 @@ 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;
/**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 勘察时间
*/
@TableField("surveyor_time")
......@@ -31,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;
/**
* 房屋整体情况
......@@ -68,7 +76,7 @@ public class SurveyDetails extends BaseEntity {
* 房屋偏向
*/
@TableField("house_bias")
private Integer houseBias;
private String houseBias;
/**
* 房屋偏向备注
......@@ -103,8 +111,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 屋顶通道
*/
@TableField("roofway")
private String roofway;
@TableField(value = "roofway",typeHandler = FastjsonTypeHandler.class)
private List<String> roofway;
/**
* 屋顶通道备注
......@@ -115,8 +123,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 周边障碍物
*/
@TableField("obstacle")
private String obstacle;
@TableField(value = "obstacle",typeHandler = FastjsonTypeHandler.class)
private List<String> obstacle;
/**
* 周边障碍物备注
......@@ -127,8 +135,8 @@ public class SurveyDetails extends BaseEntity {
/**
* 遮挡物
*/
@TableField("screen")
private String screen;
@TableField(value = "screen",typeHandler = FastjsonTypeHandler.class)
private List<String> screen;
/**
* 遮挡物备注
......@@ -139,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;
/**
* 房屋产权
......@@ -259,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;
......
......@@ -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.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.api.util;
import org.springframework.beans.BeanUtils;
public class BeanDtoUtils {
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public static <T> T convert(Object source, Class<T> targetClass) {
// 判断source是否为空
if (source == null) {
return null;
}
// 判断targetClass是否为空
if (targetClass == null) {
return null;
}
try {
// 创建新的对象实例
T target = targetClass.newInstance();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller;
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.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.apache.commons.lang3.StringUtils;
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.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -28,9 +42,17 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
@RequestMapping(value = "/peasant-household")
public class PeasantHouseholdController extends BaseController {
@Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/**
* 新增农户信息
*
......@@ -40,8 +62,27 @@ public class PeasantHouseholdController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增农户信息", notes = "新增农户信息")
public ResponseModel<PeasantHouseholdDto> save(@RequestBody PeasantHouseholdDto model) {
model = peasantHouseholdServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
surveyInformationServiceImpl.createWithModel(surveyInformationDto);
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 处理地址
String area = "";
for (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));
if (model.getIsPermanent().size()>0) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
}
model.setSurveyInformationId(surveyInformationDto.getSequenceNbr());
PeasantHouseholdDto householdDto = peasantHouseholdServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(householdDto);
}
/**
......@@ -55,6 +96,21 @@ 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);
// 处理地址
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));
if (model.getIsPermanent().size()>0) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
}
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.updateWithModel(model));
}
......@@ -81,7 +137,12 @@ 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(peasantHouseholdDto.getPermanentAddress() ==null){
peasantHouseholdDto.setPermanentAddress(JSON.parseArray("[]", Integer.class));
peasantHouseholdDto.setIsPermanent(JSON.parseArray("[1]", String.class));
}
return ResponseHelper.buildResponse(peasantHouseholdDto);
}
/**
......@@ -113,4 +174,35 @@ public class PeasantHouseholdController extends BaseController {
public ResponseModel<List<PeasantHouseholdDto>> selectForList() {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdList());
}
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if(null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) {
if(null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -113,4 +114,31 @@ public class SurveyInformationController extends BaseController {
public ResponseModel<List<SurveyInformationDto>> selectForList() {
return ResponseHelper.buildResponse(surveyInformationServiceImpl.queryForSurveyInformationList());
}
/**
* 勘察信息数据提交
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息数据提交")
@PostMapping(value = "/surveySubmit")
public ResponseModel<SurveyInfoAllDto> surveySubmit(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto);
return ResponseHelper.buildResponse(returnDto);
}
/**
* 勘察信息编辑
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑")
@GetMapping(value = "/surveyQuery")
public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam String surveyInformationId) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId);
return ResponseHelper.buildResponse(returnDto);
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller;
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.hygf.api.dto.UnitRegisterDto;
import com.yeejoin.amos.boot.module.ugp.api.constants.XJConstant;
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.commons.lang3.ObjectUtils;
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 +46,28 @@ 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;
public static final String HYGF_USER_TEL = "hygf_tel_";
/**
* 验证码过期时间
*/
private long time = 600l;
/**
* 根据sequenceNbr更新
......@@ -113,4 +138,159 @@ 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 = false;
HashMap<String, String> params = new HashMap<>();
String code = this.getRandomCode();
params.put("code",code);
params.put("mobile",tel);
params.put("smsCode", smsTempCode);
try {
Systemctl.smsClient.sendCommonSms(params).getResult();
flag = true;
} catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage());
}
// code 保存到缓存中
redisUtil.set(HYGF_USER_TEL + tel, code, time);
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.yeejoin.amos.boot.module.hygf.api.entity.SurveyInformation;
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.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.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;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
......@@ -17,6 +33,29 @@ import java.util.List;
*/
@Service
public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
RedisUtils redisUtils;
private static final String regionRedis="app_region_redis";
/**
* 分页查询
*/
......@@ -30,4 +69,107 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("" , false);
}
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) {
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
surveyInformation.setReview(0);
this.saveOrUpdate(surveyInformation);
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);
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
commercialService.saveOrUpdate(commercial);
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
informationService.saveOrUpdate(information);
return surveyInfoAllDto;
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId) {
SurveyInfoAllDto surveyInfoAllDto = new SurveyInfoAllDto();
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("survey_information_id", surveyInformationId);
PeasantHousehold peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdQueryWrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
if(peasantHousehold.getPermanentAddress() ==null){
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(JSON.parseArray("[]", Integer.class));
surveyInfoAllDto.getSurveyInformation().setIsPermanent(JSON.parseArray("[1]", String.class));
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper().selectOne(extendedInformationQueryWrapper);
surveyInfoAllDto.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
return surveyInfoAllDto;
}
public JSONArray getRegionName(){
JSONArray jsonArray = new JSONArray();
if (redisUtils.hasKey(regionRedis)) {
jsonArray= JSONArray.parseArray(redisUtils.get(regionRedis).toString());
}else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(610000L);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
for (RegionModel child : regionModel.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}
redisUtils.set(regionRedis,jsonArray);
}
return jsonArray;
}
}
\ No newline at end of file
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,9 @@ 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_TZS_0001
......@@ -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
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @description:
......@@ -33,4 +34,5 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId);
}
......@@ -79,6 +79,13 @@
indicator like concat('%',#{indicator},'%')
</select>
<select id="getFanConfigPower" resultType="java.util.Map">
select
sequence_nbr as id,
equipment_number as equipmentNumber,
equipment_specific_name as equipmentSpecificName,
gateway_id as gatewayId
from fan_config_power
where gateway_id = #{gatewayId}
</select>
</mapper>
......@@ -23,6 +23,7 @@ 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;
......@@ -70,58 +71,60 @@ 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);
List<IndexDto> list = influxDButils.getListData(sql, IndexDto.class);
System.out.println(list.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 +132,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 +143,57 @@ public class DemoController extends BaseController {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站")
@GetMapping("/test6")
public void demoTest5() {
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
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.put("address", monitorFanIndicator.getIndexAddress());
tag.put("dataType", "");
if (!ObjectUtils.isEmpty(monitorFanIndicator.getDataType())) {
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());
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", "");
if (!ObjectUtils.isEmpty(monitorFanIndicator.getFrontModule())) {
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
}
if (!ObjectUtils.isEmpty(monitorFanIndicator.getSystemType())) {
maps2.put("systemType", monitorFanIndicator.getSystemType());
}
if (!ObjectUtils.isEmpty(monitorFanIndicator.getSystemType())) {
maps2.put("unit", monitorFanIndicator.getUnit());
}
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
}
}
}
......@@ -234,5 +234,19 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(detailsWindSpeed);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "状态监控")
@GetMapping("/statusMonitoring")
public ResponseModel<IPage<Map<String, Object>>> getStatusMonitoring(@RequestParam(value = "stationId", required = true)String stationId,String equipNum,String systemType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusMonitoring(gatewayId, equipNum, systemType);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
public class SystemEnumDto {
private Long sequenceNumber;
private String type;
private String syetemName;
private String code;
private String enumDesc;
private String eunmValue;
private String gatewayId;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("system_enum")
public class SystemEnum {
@TableField("sequence_nbr")
private Long sequenceNumber;
@TableField("type")
private String type;
@TableField("system_name")
private String syetemName;
@TableField("code")
private String code;
@TableField("enum_desc")
private String enumDesc;
@TableField("eunm_value")
private String eunmValue;
@TableField("gatewayId")
private String gatewayId;
}
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SystemEnumDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SystemEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
public interface SystemEnumMapper extends BaseMapper<SystemEnum> {
List<SystemEnumDto> getStatusMonitoring(String type,String systemName);
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
......@@ -16,13 +17,11 @@ 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.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TemporaryData;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SystemEnumMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
......@@ -58,6 +57,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
InfluxDButils influxDButils;
@Autowired
SystemEnumMapper systemEnumMapper;
@Autowired
SjglZsjZsbtzServiceImpl sjglZsjZsbtzServiceImpl;
@Autowired
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
TemporaryDataMapper temporaryDataMapper;
......@@ -235,22 +243,76 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<IndexDto> getFanStatusList(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId());
String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState));
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId());
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
equipNumList.forEach(item -> {
item.setState(collect.get(item.getEquipmentNumber()));
if (!collect.containsKey(item.getEquipmentNumber())) {
item.setState("正常运行");
} else if (powList.contains(item.getEquipmentNumber())) {
item.setState("限功率");
} else if (!timeList.contains(item.getEquipmentNumber())) {
item.setState("通讯中断");
}
});
return equipNumList;
}
public List<IndexDto> getFanStatusStatistics(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentIndexName =~/^正常运行|告警运行|正常停机|故障停机|限功率|待机状态|维护状态|通讯中断$/ and value = 'true'", stationBasic.getFanGatewayId());
String sql = String.format("SELECT equipmentNumber, equipmentIndexName as state FROM \"indicators_%s\" WHERE equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true'", stationBasic.getFanGatewayId());
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
Map<String, Long> collect = influxDBList.stream().collect(Collectors.groupingBy(IndexDto::getEquipmentIndexName, Collectors.counting()));
Map<String, String> collect = influxDBList.stream().collect(Collectors.toMap(IndexDto::getEquipmentNumber, IndexDto::getState, (item1, item2) -> item1));
String sqlEquipNumList = String.format("SELECT (DISTINCT equipmentNumber) as equipmentNumber FROM \"indicators_%s\"", stationBasic.getFanGatewayId());
List<IndexDto> equipNumList = influxDButils.getListData(sqlEquipNumList, IndexDto.class);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId());
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
equipNumList.forEach(item -> {
item.setState(collect.get(item.getEquipmentNumber()));
if (!collect.containsKey(item.getEquipmentNumber())) {
item.setState("正常运行");
} else if (powList.contains(item.getEquipmentNumber())) {
item.setState("限功率");
} else if (!timeList.contains(item.getEquipmentNumber())) {
item.setState("通讯中断");
}
});
Map<String, Long> countMap = equipNumList.stream().collect(Collectors.groupingBy(IndexDto::getState, Collectors.counting()));
List<IndexDto> resultList = new ArrayList<>();
List<String> list = Arrays.asList("正常运行", "告警运行", "正常停机", "故障停机", "限功率", "待机状态", "维护状态", "通讯中断");
HashMap<String, String> colorMap = new HashMap<>();
colorMap.put("正常运行", "#00aa00");
......@@ -261,10 +323,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
colorMap.put("待机状态", "#ff0000");
colorMap.put("维护状态", "#ff00ff");
colorMap.put("通讯中断", "#7d8e95");
List<IndexDto> resultList = new ArrayList<>();
list.forEach(item -> {
IndexDto indexDto = new IndexDto();
indexDto.setCountString(collect.containsKey(item) ? String.valueOf(collect.get(item)) : "0");
indexDto.setCountString(countMap.containsKey(item) ? String.valueOf(countMap.get(item)) : "0");
indexDto.setEquipmentIndexName(item);
indexDto.setColor(colorMap.get(item));
resultList.add(indexDto);
......@@ -475,4 +536,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public List<Map<String,Object>> getStatusMonitoring(String gatewayId,String equipNum,String systemName){
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber = '"+equipNum+"' and equipmentIndexName =~/实时故障/";
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
String type = listData.get(0).getEquipmentSpecificName().substring(0,5);
List<SystemEnumDto> statusMonitoring = systemEnumMapper.getStatusMonitoring(type, systemName);
List<Map<String,Object>> statusMaps = new ArrayList<>();
for (SystemEnumDto systemEnumDto : statusMonitoring) {
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("title1",systemEnumDto.getEnumDesc());
for (IndicatorsDto listDatum : listData) {
if (listDatum.getEquipmentSpecificName().contains(systemEnumDto.getCode()) &&
systemEnumDto.getEunmValue().equals(listDatum.getValue())){
statusMap.put("state","1");
}else {
statusMap.put("state","0");
}
}
statusMaps.add(statusMap);
}
return statusMaps;
}
}
\ No newline at end of file
......@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
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.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;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
......@@ -16,14 +18,28 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Async
@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 * * * *";
/**
* 场站mapper
......@@ -37,9 +53,17 @@ public class MonitoringServiceIMQTTmpl {
RegionMapper regionMapper;
@Autowired
EmqKeeper emqKeeper;
@Autowired
MonitorFanIndicatorImpl monitorFanIndicator;
@Autowired
CommonServiceImpl commonService;
@Scheduled(cron = "0 0/1 * * * *")
/**
* 社会贡献定时消息发送 1分钟推送一次
*/
@Scheduled(cron = totalSocialContributionCron)
public void getTotalSocialContribution() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------社会贡献定时执行----------------------------------------------");
......@@ -88,8 +112,10 @@ public class MonitoringServiceIMQTTmpl {
}
}
@Scheduled(cron = "0/30 * * * * *")
/**
* 区域实时数据消息推送-30s一次
*/
@Scheduled(cron = completionOfPowerIndicatorsByProvinceNameCron)
public void getCompletionOfPowerIndicatorsByProvinceName() {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
......@@ -142,4 +168,213 @@ public class MonitoringServiceIMQTTmpl {
logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
}
/**
* 实时推送-风电站风机状态统计数据
*/
@Scheduled(cron = fanStatusStatisticsCron)
public void getFanStatusStatistics() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
List<IndexDto> fanStatusStatistics = monitorFanIndicator.getFanStatusStatistics(String.valueOf(stationBasic.getSequenceNbr()));
Page<IndexDto> page = new Page<>(1, 10);
List<IndexDto> collect = fanStatusStatistics.stream()
.limit(10)
.collect(Collectors.toList());
page.setTotal(fanStatusStatistics.size());
page.setRecords(collect);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStatusStatistics_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站风机状态数据消息=================== 成功!" + JSON.toJSONString(page));
} catch (Exception exception) {
logger.error("-----------------发送风电站风机状态数据消息=================== 失败!");
}
});
}
/**
* 实时推送-风电站风场总概览
*/
@Scheduled(cron = fanstationOverviewCron)
public void getFanstationOverview() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
String gatewayId = stationBasic.getFanGatewayId();
String[] sumColumns = new String[]{"日发电量", "月发电量", "年发电量"};
String[] avgColumns = new String[]{"有功功率", "瞬时风速"};
List<String> columnList = Arrays.asList(sumColumns);
List<String> columnLists = Arrays.asList(avgColumns);
Map<String, Object> columnMap = new HashMap<>();
for (String column : columnList) {
Double result = commonService.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, result);
}
for (String column : columnLists) {
Double result = commonService.getAvgvalueByIndicatior(gatewayId, column);
columnMap.put(column, result);
}
String num = monitorFanIndicator.getFJCount(gatewayId);
columnMap.put("风机台数", num);
Double capacityl = commonService.getStationCapactityByStationWerks(stationBasic.getStationNumber());
columnMap.put("装机容量", capacityl);
List<Map<String, Object>> objects = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
data.put("title", Float.valueOf(columnMap.get("装机容量").toString()));
objects.add(data);
Map<String, Object> data1 = new HashMap<>();
data1.put("title", Float.valueOf(columnMap.get("日发电量").toString()));
objects.add(data1);
Map<String, Object> data2 = new HashMap<>();
data2.put("title", columnMap.get("风机台数").toString().replace(".0", ""));
objects.add(data2);
Map<String, Object> data3 = new HashMap<>();
data3.put("title", Float.valueOf(columnMap.get("月发电量").toString()));
objects.add(data3);
Map<String, Object> data4 = new HashMap<>();
data4.put("title", Float.valueOf(columnMap.get("瞬时风速").toString()));
objects.add(data4);
Map<String, Object> data5 = new HashMap<>();
data5.put("title", Float.valueOf(columnMap.get("年发电量").toString()));
objects.add(data5);
Map<String, Object> data6 = new HashMap<>();
data6.put("title", Float.valueOf(columnMap.get("有功功率").toString()));
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title", 7.47);
objects.add(data7);
IPage<Map<String, Object>> result = new Page<>();
result.setRecords(objects);
result.setCurrent(1);
result.setTotal(objects.size());
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationOverview_topic", JSON.toJSON(result).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站总概览数据消息=================== 成功!" + JSON.toJSONString(result));
} catch (Exception exception) {
logger.error("-----------------发送风电站总概览数据消息=================== 失败!");
}
});
}
/**
* 实时推送-场站功率曲线总概览
*/
@Scheduled(cron = fanStationPowerBightCron)
public void getFanStationPowerBight() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationPowerBight_topic", JSON.toJSON(detailsWindSpeed).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站功率曲线数据消息=================== 成功!" + JSON.toJSONString(detailsWindSpeed));
} catch (Exception exception) {
logger.error("-----------------发送风电站功率曲线数据消息=================== 失败!");
}
});
}
/**
* 实时同送-获取各场站的风机列表
*/
@Scheduled(cron = fanStatusListCron)
public void getFanStatusList() {
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()));
Page<IndexDto> page = new Page<>(1, 999);
List<IndexDto> collect = fanStatusList.stream()
.limit(999)
.collect(Collectors.toList());
page.setTotal(fanStatusList.size());
page.setRecords(collect);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationFanStatusList_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站风机列表数据消息=================== 成功!" + JSON.toJSONString(page));
} catch (Exception exception) {
logger.error("-----------------发送风电站风机列表数据消息=================== 失败!");
}
});
}
@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;
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, "实时运行数据", 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);
//{stationBasicId}_{equipmentNumber}_windspeddInfo_topic
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);
//{stationBasicId}_{equipmentNumber}_powerFrequency_topic
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);
//{stationBasicId}_{equipmentNumber}_realTimeTemperature_topic
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);
//{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 + "_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("-----------------发送风电站风机基础数据消息=================== 失败!");
}
});
});
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SystemEnumMapper">
<select id="getStatusMonitoring" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.SystemEnumDto">
SELECT * FROM `system_enum` WHERE type = #{type} and system_name = #{systemName}
</select>
</mapper>
......@@ -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);
......
......@@ -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