Commit 49b3fd1a authored by wujiang's avatar wujiang

提交同步代码

parent c7ff5f91
package com.yeejoin.amos.boot.module.tzs.api.dto; package com.yeejoin.amos.boot.module.tzs.api.dto;
import java.util.Date; import java.util.Date;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* 企业数据信息Dto * 企业数据信息Dto
* *
* @author duanwei * @author duanwei
* @date 2022-07-26 * @date 2022-07-26
*/ */
@Data @Data
public class TzsJgEnterpriseInfoDto extends BaseDto { public class TzsJgEnterpriseInfoDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
/**
* id
*/
private Long sequenceNbr;
@ApiModelProperty(value = "使用单位唯一标识")
/**
* 使用单位唯一标识
*/
private String useUnitCode;
@ApiModelProperty(value = "监管系统唯一编码")
/**
* 监管系统唯一编码
*/
private String superviseCode;
@ApiModelProperty(value = "使用单位证件类型")
/**
* 使用单位证件类型
*/
private String useUnitCertificate;
@ApiModelProperty(value = "使用单位代码")
/**
* 使用单位代码
*/
private String useCode;
@ApiModelProperty(value = "使用单位名称")
/**
* 使用单位名称
*/
private String useUnit;
@ApiModelProperty(value = "是否重点监控单位")
/**
* 是否重点监控单位
*/
private String keyUnit;
@ApiModelProperty(value = "重点场所分类")
/**
* 重点场所分类
*/
private String classPlaces;
@ApiModelProperty(value = "单位所在省份名称")
/**
* 单位所在省份名称
*/
private String province;
@ApiModelProperty(value = "单位所在城市名称")
/**
* 单位所在城市名称
*/
private String city;
@ApiModelProperty(value = "单位所在区县名称")
/**
* 单位所在区县名称
*/
private String district;
@ApiModelProperty(value = "单位所在街道名称")
/**
* 单位所在街道名称
*/
private String street;
@ApiModelProperty(value = "单位所在社区名称")
/**
* 单位所在社区名称
*/
private String community;
@ApiModelProperty(value = "单位详细地址")
/**
* 单位详细地址
*/
private String address;
@ApiModelProperty(value = "使用单位法人")
/**
* 使用单位法人
*/
private String legalPerson;
@ApiModelProperty(value = "法人联系电话")
/**
* 法人联系电话
*/
private String legalPhone;
@ApiModelProperty(value = "使用单位联系人")
/**
* 使用单位联系人
*/
private String useContact;
@ApiModelProperty(value = "联系人联系电话")
/**
* 联系人联系电话
*/
private String contactPhone;
@ApiModelProperty(value = "安全管理人员1姓名")
/**
* 安全管理人员1姓名
*/
private String safetyOne;
@ApiModelProperty(value = "安全管理人员1身份证")
/**
* 安全管理人员1身份证
*/
private String safetyOneId;
@ApiModelProperty(value = "安全管理人员1联系电话")
/**
* 安全管理人员1联系电话
*/
private String safetyOnePhone;
@ApiModelProperty(value = "安全管理人员2")
/**
* 安全管理人员2
*/
private String safetyTwo;
@ApiModelProperty(value = "安全管理人员2身份证")
/**
* 安全管理人员2身份证
*/
private String safetyTwoId;
@ApiModelProperty(value = "安全管理人员2联系电话")
/**
* 安全管理人员2联系电话
*/
private String safetyTwoPhone;
@ApiModelProperty(value = "单位地理坐标经度")
/**
* 单位地理坐标经度
*/
private String longitude;
@ApiModelProperty(value = "单位地理坐标纬度")
/**
* 单位地理坐标纬度
*/
private String latitude;
@ApiModelProperty(value = "同步时间")
/**
* 同步时间
*/
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
/**
* 同步状态(0-新增 1-更新 2-删除)
*/
private Integer syncState;
@ApiModelProperty(value = "对接公司编码")
/**
* 对接公司编码
*/
private String appId;
@ApiModelProperty(value = "创建时间")
/**
* 创建时间
*/
private Date recDate;
@ApiModelProperty(value = "操作人员")
/**
* 操作人员
*/
private String recUserId;
@ApiModelProperty(value = "id")
/**
* id
*/
private Long sequenceNbr;
@ApiModelProperty(value = "使用单位唯一标识")
/**
* 使用单位唯一标识
*/
private String useUnitCode;
@ApiModelProperty(value = "监管系统唯一编码")
/**
* 监管系统唯一编码
*/
private String superviseCode;
@ApiModelProperty(value = "使用单位证件类型")
/**
* 使用单位证件类型
*/
private String useUnitCertificate;
@ApiModelProperty(value = "使用单位代码")
/**
* 使用单位代码
*/
private String useCode;
@ApiModelProperty(value = "使用单位名称")
/**
* 使用单位名称
*/
private String useUnit;
@ApiModelProperty(value = "是否重点监控单位")
/**
* 是否重点监控单位
*/
private String keyUnit;
@ApiModelProperty(value = "重点场所分类")
/**
* 重点场所分类
*/
private String classPlaces;
@ApiModelProperty(value = "单位所在省份名称")
/**
* 单位所在省份名称
*/
private String province;
@ApiModelProperty(value = "单位所在城市名称")
/**
* 单位所在城市名称
*/
private String city;
@ApiModelProperty(value = "单位所在区县名称")
/**
* 单位所在区县名称
*/
private String district;
@ApiModelProperty(value = "单位所在街道名称")
/**
* 单位所在街道名称
*/
private String street;
@ApiModelProperty(value = "单位所在社区名称")
/**
* 单位所在社区名称
*/
private String community;
@ApiModelProperty(value = "单位详细地址")
/**
* 单位详细地址
*/
private String address;
@ApiModelProperty(value = "使用单位法人")
/**
* 使用单位法人
*/
private String legalPerson;
@ApiModelProperty(value = "法人联系电话")
/**
* 法人联系电话
*/
private String legalPhone;
@ApiModelProperty(value = "使用单位联系人")
/**
* 使用单位联系人
*/
private String useContact;
@ApiModelProperty(value = "联系人联系电话")
/**
* 联系人联系电话
*/
private String contactPhone;
@ApiModelProperty(value = "安全管理人员1姓名")
/**
* 安全管理人员1姓名
*/
private String safetyOne;
@ApiModelProperty(value = "安全管理人员1身份证")
/**
* 安全管理人员1身份证
*/
private String safetyOneId;
@ApiModelProperty(value = "安全管理人员1联系电话")
/**
* 安全管理人员1联系电话
*/
private String safetyOnePhone;
@ApiModelProperty(value = "安全管理人员2")
/**
* 安全管理人员2
*/
private String safetyTwo;
@ApiModelProperty(value = "安全管理人员2身份证")
/**
* 安全管理人员2身份证
*/
private String safetyTwoId;
@ApiModelProperty(value = "安全管理人员2联系电话")
/**
* 安全管理人员2联系电话
*/
private String safetyTwoPhone;
@ApiModelProperty(value = "单位地理坐标经度")
/**
* 单位地理坐标经度
*/
private String longitude;
@ApiModelProperty(value = "单位地理坐标纬度")
/**
* 单位地理坐标纬度
*/
private String latitude;
@ApiModelProperty(value = "同步时间")
/**
* 同步时间
*/
private Date syncDate;
@ApiModelProperty(value = "同步状态(0-新增 1-更新 2-删除)")
/**
* 同步状态(0-新增 1-更新 2-删除)
*/
private Integer syncState;
@ApiModelProperty(value = "对接公司编码")
/**
* 对接公司编码
*/
private String appId;
@ApiModelProperty(value = "创建时间")
/**
* 创建时间
*/
private Date recDate;
@ApiModelProperty(value = "操作人员")
/**
* 操作人员
*/
private String recUserId;
@ApiModelProperty(value = "单位类型")
private String unitType;
} }
...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors; ...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_construction_info") @TableName("tz_jg_construction_info")
@ApiModel(value = "TzsJgConstructionInfo对象", description = "特种设备基本信息-施工信息") @ApiModel(value = "TzsJgConstructionInfo对象", description = "特种设备基本信息-施工信息")
public class TzsJgConstructionInfo extends BaseEntity { public class TzsJgConstructionInfo extends BaseEntity {
......
...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors; ...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_design_info") @TableName("tz_jg_design_info")
@ApiModel(value="TzsJgDesignInfo对象", description="特种设备基本信息-设计信息") @ApiModel(value="TzsJgDesignInfo对象", description="特种设备基本信息-设计信息")
public class TzsJgDesignInfo extends BaseEntity { public class TzsJgDesignInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_elevator_tech_info") @TableName("tz_jg_elevator_tech_info")
@ApiModel(value="TzsJgElevatorTechInfo对象", description="电梯技术参数") @ApiModel(value="TzsJgElevatorTechInfo对象", description="电梯技术参数")
public class TzsJgElevatorTechInfo extends BaseEntity { public class TzsJgElevatorTechInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_enclosure_info") @TableName("tz_jg_enclosure_info")
@ApiModel(value="TzsJgEnclosureInfo对象", description="特种设备附件资料信息") @ApiModel(value="TzsJgEnclosureInfo对象", description="特种设备附件资料信息")
public class TzsJgEnclosureInfo extends BaseEntity { public class TzsJgEnclosureInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_enterprise_info") @TableName("tz_jg_enterprise_info")
@ApiModel(value="TzsJgEnterpriseInfo对象", description="企业数据信息") @ApiModel(value="TzsJgEnterpriseInfo对象", description="企业数据信息")
public class TzsJgEnterpriseInfo extends BaseEntity { public class TzsJgEnterpriseInfo extends BaseEntity {
...@@ -107,5 +107,8 @@ public class TzsJgEnterpriseInfo extends BaseEntity { ...@@ -107,5 +107,8 @@ public class TzsJgEnterpriseInfo extends BaseEntity {
@ApiModelProperty(value = "对接公司编码") @ApiModelProperty(value = "对接公司编码")
private String appId; private String appId;
@ApiModelProperty(value = "单位类型")
private String unitType;
} }
...@@ -21,7 +21,7 @@ import lombok.experimental.Accessors; ...@@ -21,7 +21,7 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_file") @TableName("tz_jg_file")
@ApiModel(value = "TzsJgFile对象", description = "附件表") @ApiModel(value = "TzsJgFile对象", description = "附件表")
public class TzsJgFile extends BaseEntity { public class TzsJgFile extends BaseEntity {
......
...@@ -20,7 +20,7 @@ import lombok.experimental.Accessors; ...@@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_inspection_info") @TableName("tz_jg_inspection_info")
@ApiModel(value="TzsJgInspectionInfo对象", description="特种设备检验信息") @ApiModel(value="TzsJgInspectionInfo对象", description="特种设备检验信息")
public class TzsJgInspectionInfo extends BaseEntity { public class TzsJgInspectionInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_maintenance_info") @TableName("tz_jg_maintenance_info")
@ApiModel(value="TzsJgMaintenanceInfo对象", description="特种设备基本信息-维保备案信息") @ApiModel(value="TzsJgMaintenanceInfo对象", description="特种设备基本信息-维保备案信息")
public class TzsJgMaintenanceInfo extends BaseEntity { public class TzsJgMaintenanceInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_other_info") @TableName("tz_jg_other_info")
@ApiModel(value="TzsJgOtherInfo对象", description="特种设备基本信息-其他信息") @ApiModel(value="TzsJgOtherInfo对象", description="特种设备基本信息-其他信息")
public class TzsJgOtherInfo extends BaseEntity { public class TzsJgOtherInfo extends BaseEntity {
......
...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors; ...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_produce_info") @TableName("tz_jg_produce_info")
@ApiModel(value = "TzsJgProduceInfo对象", description = "特种设备基本信息-制造信息") @ApiModel(value = "TzsJgProduceInfo对象", description = "特种设备基本信息-制造信息")
public class TzsJgProduceInfo extends BaseEntity { public class TzsJgProduceInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_registration_info") @TableName("tz_jg_registration_info")
@ApiModel(value="TzsJgRegistrationInfo对象", description="特种设备基本信息-注册登记信息 ") @ApiModel(value="TzsJgRegistrationInfo对象", description="特种设备基本信息-注册登记信息 ")
public class TzsJgRegistrationInfo extends BaseEntity { public class TzsJgRegistrationInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_staff_base_info") @TableName("tz_jg_staff_base_info")
@ApiModel(value="TzsJgStaffBaseInfo对象", description="人员数据信息-基本信息") @ApiModel(value="TzsJgStaffBaseInfo对象", description="人员数据信息-基本信息")
public class TzsJgStaffBaseInfo extends BaseEntity { public class TzsJgStaffBaseInfo extends BaseEntity {
......
...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors; ...@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_staff_qualif_info") @TableName("tz_jg_staff_qualif_info")
@ApiModel(value = "TzsJgStaffQualifInfo对象", description = "人员数据信息-资质信息") @ApiModel(value = "TzsJgStaffQualifInfo对象", description = "人员数据信息-资质信息")
public class TzsJgStaffQualifInfo extends BaseEntity { public class TzsJgStaffQualifInfo extends BaseEntity {
......
...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors; ...@@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_supervise_info") @TableName("tz_jg_supervise_info")
@ApiModel(value="TzsJgSuperviseInfo对象", description="特种设备基本信息-监督管理信息") @ApiModel(value="TzsJgSuperviseInfo对象", description="特种设备基本信息-监督管理信息")
public class TzsJgSuperviseInfo extends BaseEntity { public class TzsJgSuperviseInfo extends BaseEntity {
......
...@@ -21,7 +21,7 @@ import lombok.experimental.Accessors; ...@@ -21,7 +21,7 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tzs_jg_use_info") @TableName("tz_jg_use_info")
@ApiModel(value = "TzsJgUseInfo对象", description = "特种设备基本信息-使用信息") @ApiModel(value = "TzsJgUseInfo对象", description = "特种设备基本信息-使用信息")
public class TzsJgUseInfo extends BaseEntity { public class TzsJgUseInfo extends BaseEntity {
......
package com.yeejoin.amos; package com.yeejoin.amos;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -11,18 +16,22 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; ...@@ -11,18 +16,22 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.net.InetAddress; import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import java.net.UnknownHostException; import com.yeejoin.amos.boot.module.tzs.biz.listener.BaseEnterpriseMqTtlListener;
import com.yeejoin.amos.boot.module.tzs.biz.listener.CarcylUnitInspectMqTtlListener;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService;
/** /**
* <pre> * <pre>
* 特种设备服务启动类 * 特种设备服务启动类
* </pre> * </pre>
* *
* @author DELL * @author DELL
...@@ -36,26 +45,51 @@ import java.net.UnknownHostException; ...@@ -36,26 +45,51 @@ import java.net.UnknownHostException;
@EnableAsync @EnableAsync
@EnableEurekaClient @EnableEurekaClient
@EnableScheduling @EnableScheduling
@MapperScan({"org.typroject.tyboot.demo.face.orm.dao*", @MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.face.*.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
"org.typroject.tyboot.component.*.face.orm.dao*", @ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" })
"com.yeejoin.amos.boot.module.**.api.mapper",
"com.yeejoin.amos.boot.biz.common.dao.mapper"})
@ComponentScan(basePackages = {"org.typroject", "com.yeejoin.amos"})
public class AmosTzsApplication { public class AmosTzsApplication {
private static final Logger logger = LoggerFactory.getLogger(AmosTzsApplication.class); private static final Logger logger = LoggerFactory.getLogger(AmosTzsApplication.class);
@Autowired
public static void main(String[] args) throws UnknownHostException { private EmqKeeper emqKeeper;
ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args);
Environment env = context.getEnvironment(); @Autowired
String ip = InetAddress.getLocalHost().getHostAddress(); private CarcylUnitInspectMqTtlListener carcylUnitInspectMqTtlListener;
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); @Autowired
private BaseEnterpriseMqTtlListener baseEnterpriseMqTtlListener;
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" + @Autowired
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + private StartPlatformTokenService startPlatformTokenService;
"----------------------------------------------------------");
} public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmosTzsApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port
+ path + "/doc.html\n" + "----------------------------------------------------------");
}
/**
* 初始化MQTT
*
* @throws MqttException
*/
@Bean
public void initMqtt() throws MqttException {
emqKeeper.getMqttClient().subscribe("/idx/idx_biz_carcyl_unit_inspect", 1, carcylUnitInspectMqTtlListener);
emqKeeper.getMqttClient().subscribe("/tm/tz_base_enterprise_info", 1, baseEnterpriseMqTtlListener);
// emqKeeper.getMqttClient().subscribe("topic_mqtt_exam", 1, examMqTtlListener);
// emqKeeper.getMqttClient().subscribe("topic_mqtt_exam_record", 1, examMqTtRecordListener);
}
@Bean
public void initToken() {
startPlatformTokenService.getToken();
}
} }
package com.yeejoin.amos.boot.module.tzs.biz.listener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tzs.biz.utils.DesUtil;
import com.yeejoin.amos.boot.module.tzs.biz.utils.RedisUtil;
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.ApplicationModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j;
/**
* @Description: mqtt监听服务
* @Author: duanwei
* @Date: 2020/9/15
*/
@Component
@Slf4j
public class BaseEnterpriseMqTtlListener extends EmqxListener {
@Value("${amos.secret.key}")
String secretKey;
@Value("${admin.product}")
String product;
@Value("${admin.appkey}")
String appkey;
@Autowired
RedisUtil redisUtil;
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
System.out.println(message);
JSONObject object = null;
try {
object = JSONObject.parseObject(message.toString());
} catch (Exception e) {
throw new Exception("公司同步消息解析失败");
}
RequestContext.setAppKey(appkey);
RequestContext.setProduct(product);
RequestContext.setToken(String.valueOf(redisUtil.get("platform_token")));
FeignClientResult<List<ApplicationModel>> aResult = Privilege.applicationClient.queryAgencyApplications();
List<ApplicationModel> aList = aResult.getResult();
List<String> appCodes = aList.stream().filter(i -> "监管端,企业端".indexOf(i.getAppName()) != -1)
.map(i -> i.getAppCode()).collect(Collectors.toList());
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(object.getLong("sequence_nbr"));
if (cResult.getResult() == null) {
CompanyModel companyModel = new CompanyModel();
companyModel.setCompanyName(object.getString("use_unit"));
companyModel.setParentId(0L);
companyModel.setLevel("company");
companyModel.setSequenceNbr(object.getLong("sequence_nbr"));
companyModel.setCompanyCode(object.getString("use_code"));
FeignClientResult<HashMap<String,Object>> result= Privilege.companyClient.queryByOrgcode(object.getString("supervise_org_code"));
//JSONObject parent = JSONObject.parseObject(JSONObject.toJSONString(result.getResult()));
if(result.getResult().get("sequenceNbr")!=null)
{
companyModel.setParentId(Long.valueOf(result.getResult().get("sequenceNbr").toString()));
}
Privilege.companyClient.create(companyModel);
}
String unitCode = object.getString("use_code");
if (unitCode == null || unitCode.length() < 6) {
log.error("公司统一信用代码长度不够6位");
throw new Exception("公司统一信用代码长度不够6位");
}
String userName = unitCode.substring(unitCode.length() - 6, unitCode.length());
FeignClientResult<AgencyUserModel> uResult = Privilege.agencyUserClient.queryByUserName(userName);
if (uResult.getResult() == null) {
AgencyUserModel userModel = new AgencyUserModel();
userModel.setUserName(userName);
userModel.setRealName(userName);
userModel.setPassword(DesUtil.encode(userName, secretKey));
userModel.setRePassword(DesUtil.encode(userName, secretKey));
// userModel.setMobile(vo.getPhoneNo());
userModel.setLockStatus("UNLOCK");
FeignClientResult<List<RoleModel>> list = Privilege.roleClient.queryRoleList("使用单位", "admin");
Map<Long, List<Long>> orgRoles = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
roleIds.add(list.getResult().get(0).getSequenceNbr());
orgRoles.put(object.getLong("sequence_nbr"), roleIds);
userModel.setAppCodes(appCodes);
userModel.setOrgRoleSeqs(orgRoles);
Privilege.agencyUserClient.create(userModel);
}
}
}
package com.yeejoin.amos.boot.module.tzs.biz.listener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tzs.biz.utils.DesUtil;
import com.yeejoin.amos.boot.module.tzs.biz.utils.RedisUtil;
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.ApplicationModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import lombok.extern.slf4j.Slf4j;
/**
* @Description: mqtt监听服务
* @Author: duanwei
* @Date: 2020/9/15
*/
@Component
@Slf4j
public class CarcylUnitInspectMqTtlListener extends EmqxListener {
@Value("${amos.secret.key}")
String secretKey;
@Value("${admin.product}")
String product;
@Value("${admin.appkey}")
String appkey;
@Autowired
RedisUtil redisUtil;
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
System.out.println(message);
JSONObject object = null;
try {
object = JSONObject.parseObject(message.toString());
} catch (Exception e) {
throw new Exception("公司同步消息解析失败");
}
RequestContext.setAppKey(appkey);
RequestContext.setProduct(product);
RequestContext.setToken(String.valueOf(redisUtil.get("platform_token")));
FeignClientResult<List<ApplicationModel>> aResult = Privilege.applicationClient.queryAgencyApplications();
List<ApplicationModel> aList = aResult.getResult();
List<String> appCodes = aList.stream().filter(i -> "监管端,企业端".indexOf(i.getAppName()) != -1)
.map(i -> i.getAppCode()).collect(Collectors.toList());
String uuid = object.getString("id");
Long id = Long.valueOf(uuid.replaceAll("-","").hashCode());
FeignClientResult<CompanyModel> cResult = Privilege.companyClient.seleteOne(id);
if (cResult.getResult() == null) {
CompanyModel companyModel = new CompanyModel();
companyModel.setCompanyName(object.getString("inspect_unit_name"));
companyModel.setParentId(0L);
companyModel.setLevel("company");
companyModel.setSequenceNbr(id);
companyModel.setCompanyCode(object.getString("org_unit_name"));
Privilege.companyClient.create(companyModel);
}
String unitCode = object.getString("org_unit_name");
if (unitCode == null || unitCode.length() < 6) {
log.error("公司统一信用代码长度不够6位");
throw new Exception("公司统一信用代码长度不够6位");
}
String userName = unitCode.substring(unitCode.length() - 6, unitCode.length());
FeignClientResult<AgencyUserModel> uResult = Privilege.agencyUserClient.queryByUserName(userName);
if (uResult.getResult() == null) {
AgencyUserModel userModel = new AgencyUserModel();
userModel.setUserName(userName);
userModel.setRealName(userName);
userModel.setPassword(DesUtil.encode(userName, secretKey));
userModel.setRePassword(DesUtil.encode(userName, secretKey));
// userModel.setMobile(vo.getPhoneNo());
userModel.setLockStatus("UNLOCK");
FeignClientResult<List<RoleModel>> list = Privilege.roleClient.queryRoleList("检验单位", "admin");
Map<Long, List<Long>> orgRoles = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
roleIds.add(list.getResult().get(0).getSequenceNbr());
orgRoles.put(id, roleIds);
userModel.setAppCodes(appCodes);
userModel.setOrgRoleSeqs(orgRoles);
Privilege.agencyUserClient.create(userModel);
}
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.yeejoin.amos.boot.module.tzs.biz.utils.DesUtil;
import com.yeejoin.amos.boot.module.tzs.biz.utils.RedisUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
@Service
public class StartPlatformTokenService {
@Value("${admin.product}")
String product;
@Value("${admin.appkey}")
String appkey;
@Value("${admin.user}")
String user;
@Value("${admin.password}")
String password;
@Value("${amos.secret.key}")
String secretKey;
@Autowired
RedisUtil redisUtil;
public void getToken() {
RequestContext.setProduct(product);
RequestContext.setAppKey(appkey);
IdPasswordAuthModel authModel = new IdPasswordAuthModel();
authModel.setLoginId(user);
authModel.setPassword(DesUtil.encode(password, secretKey));
System.out.println("user:" + user);
System.out.println("secretKey:" + secretKey);
FeignClientResult<Map<String, String>> authResult = Privilege.authClient.idpassword(authModel);
String token = authResult.getResult().get("token");
System.out.println("token:" + token);
RequestContext.setToken(token);
redisUtil.set("platform_token", token);
}
}
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.99:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.10.90:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.10.90:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.10.90:${server.port}${server.servlet.context-path}/swagger-ui.html
## ES properties:
biz.elasticsearch.address=172.16.10.90
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
## unit(h)
alertcall.es.synchrony.time=48
fileserver.domain=https://rpm.yeeamos.com:8888/
#redis properties:
spring.redis.database=1
spring.redis.host=172.16.10.90
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.90:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ No newline at end of file
spring.application.name=TZS spring.application.name=TZS-WJ
server.servlet.context-path=/tzs server.servlet.context-path=/tzs
server.port=11000 server.port=11000
spring.profiles.active=dev spring.profiles.active=dev2
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
...@@ -119,4 +119,11 @@ tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY ...@@ -119,4 +119,11 @@ tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ���ںŲ����û�id��ƽ̨userId�� ## ���ںŲ����û�id��ƽ̨userId��
tzs.wechat.test.userId=3393279 tzs.wechat.test.userId=3393279
\ No newline at end of file
admin.product=AMOS-SERVICE-ADMIN
admin.appkey=AMOS_ADMIN
admin.user=admin_tzs
admin.password=a1234560
admin.product.web=AMOS-WEB-ADMIN
amos.secret.key=qaz
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/tzs.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO" />
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.apache.activemq" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin" level="INFO"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<!-- <appender-ref ref="FILE" /> -->
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
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