Commit 4d37b07c authored by lilongyang's avatar lilongyang

Merge branch 'developer' of http://36.40.66.175:5000/moa/jxdj_zx/amos-boot-zx-biz into developer

Conflicts: amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
parents 89380ffe 6f2f97b9
package com.yeejoin.amos.api.householdapi.constant;
import java.util.HashMap;
/**
* 碳银常量类
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.constant
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 10:22
*/
public class TanYinConstant {
public static String ACCESS_TOKEN_KEY = "TanYin_Token";
/**
* 获取电站信息
*/
public static String stationListUrl = "/v1/yx/query/station/info";
/**
* 获取客户信息
*/
public static String customerInfoUrl = "/v1/yx/query/customer/info";
/**
* 电站逆变器信息接口
*/
public static String inverterListUrl = "/v1/station/getTodayDetail";
/**
* 获取 Access_Token
*/
public static String getAccessTokenUrl = "/v1/auth/getAccessToken";
/**
* 刷新 Access_Token
*/
public static String refreshAccessTokenUrl = "/v1/auth/refreshAccessToken";
public static final HashMap<String, String> stationStatus = new HashMap<String, String>() {
{
put("0", "在线");
put("1", "离线");
put("2", "异常");
}
};
public static final HashMap<String, String> intoNetWorkStatus = new HashMap<String, String>() {
{
put("0", "普通并网");
}
};
}
...@@ -73,7 +73,8 @@ public class HouseholdTestController { ...@@ -73,7 +73,8 @@ public class HouseholdTestController {
@Autowired
private TanYinDataAcquisitionService tanYinDataAcquisitionService;
/** /**
* 新增户用光伏-厂商API haders * 新增户用光伏-厂商API haders
...@@ -257,8 +258,25 @@ public class HouseholdTestController { ...@@ -257,8 +258,25 @@ public class HouseholdTestController {
/* ---------------- 碳银接口 Test -------------- */
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
@PostMapping(value = "/tanyin/station")
@ApiOperation(httpMethod = "POST", value = "电站基本信息接口", notes = "电站基本信息接口")
public void tanyinStation() {
tanYinDataAcquisitionService.stationList();
}
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
@PostMapping(value = "/tanyin/inverter")
@ApiOperation(httpMethod = "POST", value = "电站逆变器信息接口", notes = "电站逆变器信息接口")
public void tanyinInverter() {
tanYinDataAcquisitionService.inverterList();
}
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
@PostMapping(value = "/tanyin/customer")
@ApiOperation(httpMethod = "POST", value = "客户信息查询接口", notes = "客户信息查询接口")
public void tanyinCustomer() {
tanYinDataAcquisitionService.customerInfoList();
}
} }
package com.yeejoin.amos.api.householdapi.exception;
import org.apache.commons.lang3.StringUtils;
import org.typroject.tyboot.core.foundation.exception.BaseException;
/**
* 自定义异常
*
* @author yangyang
* @version v1.0
* @date 2023/9/19 12:37
*/
public class BusinessException extends BaseException {
private String code;
public BusinessException(String message) {
super(message, BusinessException.class.getSimpleName(), "错误的请求.");
this.code = "-1";
this.httpStatus = 500;
}
public BusinessException(String errorCode, String message) {
super(message, BusinessException.class.getSimpleName(), message);
if (StringUtils.isBlank(errorCode)) {
this.httpStatus = 500;
this.code = errorCode;
} else {
this.httpStatus = Integer.parseInt(errorCode);
this.code = errorCode;
}
}
public boolean isTokenError() {
return "401".equals(this.code);
}
}
package com.yeejoin.amos.api.householdapi.face.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 碳银Access_Token类
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.dto
*
* @author yangyang
* @version v1.0
* @date 2024/7/16 14:08
*/
@NoArgsConstructor
@Data
public class TanYinAccessTokenDTO {
@ApiModelProperty ("业务请求 token")
@JsonProperty ("access_token")
private String accessToken;
@ApiModelProperty ("有效时间")
@JsonProperty ("expires_in")
private Integer accessTokenExpiresIn;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 碳银接口返回类
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.dto
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 14:03
*/
@NoArgsConstructor
@Data
public class TanYinBaseResultDTO<T> {
@JsonProperty ("code")
private Integer code;
@JsonProperty ("data")
private T data;
@JsonProperty ("msg")
private String msg;
@JsonProperty ("deskey")
private Object deskey;
@JsonProperty ("success")
private Boolean success;
@JsonProperty ("fail")
private Boolean fail;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 碳银分页请求类
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.dto
*
* @author yangyang
* @version v1.0
* @date 2024/7/16 14:09
*/
@NoArgsConstructor
@Data
public class TanYinPageResultDTO<T> {
@JsonProperty ("pageNo")
private Integer pageNo;
@JsonProperty ("pageSize")
private Integer pageSize;
@JsonProperty ("totalPage")
private Integer totalPage;
@JsonProperty ("total")
private Integer total;
@JsonProperty ("list")
private List<T> list;
@JsonProperty ("start")
private Integer start;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 客户信息
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 16:11
*/
@NoArgsConstructor
@Data
@TableName (value = "tanyin_customer_info", autoResultMap = true)
public class TanYinCustomerInfo {
@ApiModelProperty ("客户身份证号码")
@TableField ("customer_id_no")
private String customerIdNo;
@ApiModelProperty ("客户姓名")
@TableField ("customer_name")
private String customerName;
@ApiModelProperty ("客户手机号")
@TableField ("customer_phone")
private String customerPhone;
@ApiModelProperty ("客户并网通过时间 毫秒时间戳")
@TableField ("electric_contract_pass")
private Long electricContractPass;
@ApiModelProperty ("项目编号")
@TableField ("project_no")
private String projectNo;
@TableField("create_time")
private Long createTime;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 逆变器实时数据
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 16:10
*/
@NoArgsConstructor
@Data
@TableName (value = "tanyin_inveter_info", autoResultMap = true)
public class TanYinInveterInfo {
@TableField ("project_no")
private String projectNo;
@TableField ("device_name")
private String deviceName;
@TableField ("sn")
private String sn;
@TableField ("supplier")
private Integer supplier;
@ApiModelProperty ("更新时间")
@TableField ("gmt_create")
private String gmtCreate;
@ApiModelProperty ("ID")
@TableField ("id_string")
private String idString;
@ApiModelProperty ("功率")
@TableField ("watt")
private String watt;
@ApiModelProperty ("日发电量")
@TableField ("daily_energy")
private String dailyEnergy;
@ApiModelProperty ("总发电量")
@TableField ("total_energy")
private String totalEnergy;
@ApiModelProperty ("逆变器在线状态:在线;1、离线;2、异常")
@TableField ("status")
private String status;
@ApiModelProperty ("故障原因")
@TableField ("error_detail")
private String errorDetail;
@ApiModelProperty ("故障码")
@TableField ("error_code")
private String errorCode;
@ApiModelProperty ("输入电压 1")
@TableField ("vol0")
private String vol0;
@ApiModelProperty ("输入电压 2")
@TableField ("vol1")
private String vol1;
@ApiModelProperty ("输入电压 3")
@TableField ("vol2")
private String vol2;
@ApiModelProperty ("输入电压 4")
@TableField ("vol3")
private String vol3;
@ApiModelProperty ("输入电压 5")
@TableField ("vol4")
private String vol4;
@ApiModelProperty ("输出电压 1")
@TableField ("vol5")
private String vol5;
@ApiModelProperty ("输出电压 2")
@TableField ("vol6")
private String vol6;
@ApiModelProperty ("输出电压 3")
@TableField ("vol7")
private String vol7;
@ApiModelProperty ("输出电压 3")
@TableField ("vol8")
private String vol8;
@ApiModelProperty ("输出电压 3")
@TableField ("vol9")
private String vol9;
@ApiModelProperty ("输入电压 6")
@TableField ("vol10")
private String vol10;
@ApiModelProperty ("输出电压 3")
@TableField ("vol11")
private String vol11;
@ApiModelProperty ("输出电压 3")
@TableField ("vol12")
private String vol12;
@ApiModelProperty ("输出电压 3")
@TableField ("vol13")
private String vol13;
@ApiModelProperty ("输出电压 3")
@TableField ("vol14")
private String vol14;
@ApiModelProperty ("输出电压 3")
@TableField ("vol15")
private String vol15;
@ApiModelProperty ("输入电流 1")
@TableField ("amp0")
private String amp0;
@ApiModelProperty ("输入电流 2")
@TableField ("amp1")
private String amp1;
@ApiModelProperty ("输入电流 3")
@TableField ("amp2")
private String amp2;
@ApiModelProperty ("输入电流 4")
@TableField ("amp3")
private String amp3;
@ApiModelProperty ("输入电流 5")
@TableField ("amp4")
private String amp4;
@ApiModelProperty ("输入电流 6")
@TableField ("amp5")
private String amp5;
@ApiModelProperty ("输入电流 7")
@TableField ("amp6")
private String amp6;
@ApiModelProperty ("输入电流 8")
@TableField ("amp7")
private String amp7;
@ApiModelProperty ("输入电流 9")
@TableField ("amp8")
private String amp8;
@ApiModelProperty ("输入电流 10")
@TableField ("amp9")
private String amp9;
@ApiModelProperty ("输入电流 11")
@TableField ("amp10")
private String amp10;
@ApiModelProperty ("输入电流 12")
@TableField ("amp11")
private String amp11;
@ApiModelProperty ("输入电流 13")
@TableField ("amp12")
private String amp12;
@ApiModelProperty ("输入电流 14")
@TableField ("amp13")
private String amp13;
@ApiModelProperty ("输入电流 15")
@TableField ("amp14")
private String amp14;
@ApiModelProperty ("输入电流 16")
@TableField ("amp15")
private String amp15;
@ApiModelProperty ("温度(单位:摄氏度)")
@TableField ("temperature")
private String temperature;
@TableField ("create_time")
private Long createTime;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 电站基本信息
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 16:05
*/
@NoArgsConstructor
@Data
@TableName (value = "tanyin_station_info", autoResultMap = true)
public class TanYinStationInfo {
@ApiModelProperty ("项目编号")
@TableField ("project_no")
private String projectNo;
@ApiModelProperty ("姓名")
@TableField ("customer_name")
private String customerName;
@ApiModelProperty ("手机号")
@TableField ("customer_phone")
private String customerPhone;
@ApiModelProperty ("身份证")
@TableField ("customer_id_no")
private String customerIdNo;
@ApiModelProperty ("省")
@TableField ("province")
private String province;
@ApiModelProperty ("市")
@TableField ("city")
private String city;
@ApiModelProperty ("区")
@TableField ("area")
private String area;
@ApiModelProperty ("镇 + 详细地址")
@TableField ("complete_address")
private String completeAddress;
@TableField (value = "inverterList",exist = false)
private List<InverterListDTO> inverterList;
@ApiModelProperty ("装机容量")
@TableField ("capacity_size")
private String capacitySize;
@ApiModelProperty ("累计总发电量")
@TableField ("total_power")
private String totalPower;
@ApiModelProperty ("当年发电量")
@TableField ("year_power")
private String yearPower;
@ApiModelProperty ("当月发电量")
@TableField ("month_power")
private String monthPower;
@ApiModelProperty ("当日发电量")
@TableField ("day_power")
private String dayPower;
@ApiModelProperty ("纬度")
@TableField ("latitude")
private String latitude;
@ApiModelProperty ("经度")
@TableField ("longitude")
private String longitude;
@TableField ("create_time")
private Long createTime;
@NoArgsConstructor
@Data
public static class InverterListDTO {
private String deviceName;
private Integer supplier;
private String sn;
}
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TanYinCustomerInfo;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface TanYinCustomerInfoMapper extends BaseMapper<TanYinCustomerInfo> {
@Select("select project_no from tanyin_customer_info")
List<String> listProjectNo();
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TanYinInveterInfo;
public interface TanYinInveterInfoMapper extends BaseMapper<TanYinInveterInfo> {
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TanYinStationInfo;
public interface TanYinStationInfoMapper extends BaseMapper<TanYinStationInfo> {
}
package com.yeejoin.amos.api.householdapi.face.service;
/**
* <p>
* ProjectName: amos-boot-zx-biz
* PackageName: com.yeejoin.amos.api.householdapi.face.service
*
* @author yangyang
* @version v1.0
* @date 2024/7/15 10:05
*/
public interface TanYinDataAcquisitionService {
/**
* 通过并网时间段查询对应范围内的项目信息
*
* @param
* @return {@link }
* @throws
* @author yangyang
* @date 2024/7/15 16:55
*/
void customerInfoList();
/**
* 电站基本信息
*
* @param
* @return {@link }
* @throws
* @author yangyang
* @date 2024/7/15 16:55
*/
void stationList();
/**
* 电站逆变器信息
*
* @param
* @return {@link }
* @throws
* @author yangyang
* @date 2024/7/15 16:55
*/
void inverterList();
}
...@@ -9,7 +9,8 @@ public enum PVProducerInfoEnum { ...@@ -9,7 +9,8 @@ public enum PVProducerInfoEnum {
JLY("锦浪云","JLY"), JLY("锦浪云","JLY"),
KSOLAR("科士达","KSD"), KSOLAR("科士达","KSD"),
YG("阳光","YG"), YG("阳光","YG"),
HUAWEI("华为","HW"); HUAWEI("华为","HW"),
TANYIN("碳银","TY");
private String name; private String name;
......
...@@ -72,4 +72,10 @@ dataRequstScheduled.keshida=0 0/50 * * * * ...@@ -72,4 +72,10 @@ dataRequstScheduled.keshida=0 0/50 * * * *
dataRequstScheduled.Sunlight=0 0/50 * * * * dataRequstScheduled.Sunlight=0 0/50 * * * *
dataRequstScheduled.GoodWe=0 0/3 * * * * dataRequstScheduled.GoodWe=0 0/3 * * * *
dataRequstScheduled.Sofar=0 0/50 * * * * dataRequstScheduled.Sofar=0 0/50 * * * *
\ No newline at end of file
# 碳银
tanYin.api.apiUrl=https://userauth.tanwin.cn
tanYin.api.clientSecret=rKrWVa2sXsSZeNAOW43v
tanYin.api.clientKey=yx10001
dataRequestScheduled.tanYin=0 0/10 * * * *
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.api.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 电子钱包接口类
*
* @author system_generator
* @date 2024-01-12
*/
public interface IHygfIcbcService {
void icbcRegisterWalletUrl(HttpServletRequest req, HttpServletResponse resp);
}
...@@ -67,35 +67,35 @@ ...@@ -67,35 +67,35 @@
<version>1.10.4</version> <version>1.10.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>io.github.openfeign</groupId> <!-- <groupId>io.github.openfeign</groupId>-->
<artifactId>feign-httpclient</artifactId> <!-- <artifactId>feign-httpclient</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.esotericsoftware.kryo</groupId> <!-- <groupId>com.esotericsoftware.kryo</groupId>-->
<artifactId>kryo</artifactId> <!-- <artifactId>kryo</artifactId>-->
<version>2.24.0</version> <!-- <version>2.24.0</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>de.javakaffee</groupId> <!-- <groupId>de.javakaffee</groupId>-->
<artifactId>kryo-serializers</artifactId> <!-- <artifactId>kryo-serializers</artifactId>-->
<version>0.45</version> <!-- <version>0.45</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.esotericsoftware</groupId> <!-- <groupId>com.esotericsoftware</groupId>-->
<artifactId>kryo</artifactId> <!-- <artifactId>kryo</artifactId>-->
<version>4.0.2</version> <!-- <version>4.0.2</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>cn.com.vastdata</groupId> <!-- <groupId>cn.com.vastdata</groupId>-->
<artifactId>vastbase-jdbc</artifactId> <!-- <artifactId>vastbase-jdbc</artifactId>-->
<version>2.7p</version> <!-- <version>2.7p</version>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>io.seata</groupId> <!-- <groupId>io.seata</groupId>-->
<artifactId>seata-spring-boot-starter</artifactId> <!-- <artifactId>seata-spring-boot-starter</artifactId>-->
<version>1.8.0</version> <!-- <version>1.8.0</version>-->
</dependency> <!-- </dependency>-->
<!-- ICBC工行支付 --> <!-- ICBC工行支付 -->
<dependency> <dependency>
......
//package com.yeejoin.amos.boot.module.hygf.biz.config;
//
//
//import com.baomidou.mybatisplus.core.config.GlobalConfig;
//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
//import com.github.pagehelper.PageInterceptor;
//import com.yeejoin.amos.boot.biz.config.MetaHandler;
//import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpowerInterceptor;
//import io.seata.rm.datasource.DataSourceProxy;
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//import java.util.Properties;
//
//
///**
// * mysql配置类
// * @author zhengwen
// */
//@Configuration
//@MapperScan(basePackages = {"com.yeejoin.amos.boot.module.hygf.api.mapper"}, sqlSessionTemplateRef = "mysqlSqlSessionTemplate")
//public class MysqlServerConfig {
//
// @Autowired
// MetaHandler metaHandler;
// private static final String MAPPER_LOCATION = "classpath*:mapper/mysql/*.xml";
// @Bean(name = "mysqlDataSource")
// @ConfigurationProperties(prefix = "spring.datasource.mysql-service")
// @Primary
// public DataSource mysqlDataSource() {
// return DataSourceBuilder.create().build();
// }
//
// @Bean("mysqlDataSourceProxy")
// public DataSourceProxy dataSourceProxy(@Qualifier("mysqlDataSource") DataSource hikariDataSource) {
// return new DataSourceProxy(hikariDataSource);
// }
//
// @Bean(name = "mysqlSqlSessionFactory")
// @Primary
// public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSourceProxy") DataSource dataSource, GlobalConfig globalConfig) throws Exception {
// //注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效
// MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
// bean.setDataSource(dataSource);
// bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
// globalConfig.setMetaObjectHandler(metaHandler);
// bean.setGlobalConfig(globalConfig);
// //分页插件
// Interceptor interceptor = new PageInterceptor();
// Properties properties = new Properties();
// properties.setProperty("helperDialect", "mysql");
// properties.setProperty("offsetAsPageNum", "true");
// properties.setProperty("rowBoundsWithCount", "true");
// properties.setProperty("reasonable", "true");
// properties.setProperty("supportMethodsArguments","true");
// properties.setProperty("params","pageNum=current;pageSize=size" +
// "" +
// ";");
// interceptor.setProperties(properties);
// bean.setPlugins(new Interceptor[] {interceptor,
// userEmpowerInterceptor(),
// paginationInterceptor()
// });
// return bean.getObject();
// }
//
// @Bean(name = "mysqlTransactionManager")
// @Primary
// public DataSourceTransactionManager mysqlTransactionManager(@Qualifier("mysqlDataSource") DataSource dataSource) {
// return new DataSourceTransactionManager(dataSource);
// }
//
// @Bean(name = "mysqlSqlSessionTemplate")
// @Primary
// public SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
// return new SqlSessionTemplate(sqlSessionFactory);
// }
//
// @Bean
// public PaginationInterceptor paginationInterceptor() {
// PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// paginationInterceptor.setDialectType("mysql");
// return paginationInterceptor;
// }
//
//
// @Bean
// public UserEmpowerInterceptor userEmpowerInterceptor() {
// UserEmpowerInterceptor userEmpowerInterceptor = new UserEmpowerInterceptor();
//
// return userEmpowerInterceptor;
// }
//
//
//}
package com.yeejoin.amos.boot.module.hygf.biz.config; package com.yeejoin.amos.boot.module.hygf.biz.config;
...@@ -7,7 +115,6 @@ import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; ...@@ -7,7 +115,6 @@ import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor; import com.github.pagehelper.PageInterceptor;
import com.yeejoin.amos.boot.biz.config.MetaHandler; import com.yeejoin.amos.boot.biz.config.MetaHandler;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpowerInterceptor; import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpowerInterceptor;
import io.seata.rm.datasource.DataSourceProxy;
import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.SqlSessionTemplate;
...@@ -44,18 +151,16 @@ public class MysqlServerConfig { ...@@ -44,18 +151,16 @@ public class MysqlServerConfig {
return DataSourceBuilder.create().build(); return DataSourceBuilder.create().build();
} }
@Bean("mysqlDataSourceProxy")
public DataSourceProxy dataSourceProxy(@Qualifier("mysqlDataSource") DataSource hikariDataSource) {
return new DataSourceProxy(hikariDataSource);
}
@Bean(name = "mysqlSqlSessionFactory") @Bean(name = "mysqlSqlSessionFactory")
@Primary @Primary
public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSourceProxy") DataSource dataSource, GlobalConfig globalConfig) throws Exception { public SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("mysqlDataSource") DataSource dataSource, GlobalConfig globalConfig) throws Exception {
//注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效 //注意这里一定要用MybatisSqlSessionFactoryBean,如果用SqlSessionFactory,配置无效
MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean();
bean.setDataSource(dataSource); bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION)); bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATION));
globalConfig.setMetaObjectHandler(metaHandler); globalConfig.setMetaObjectHandler(metaHandler);
bean.setGlobalConfig(globalConfig); bean.setGlobalConfig(globalConfig);
//分页插件 //分页插件
...@@ -70,7 +175,10 @@ public class MysqlServerConfig { ...@@ -70,7 +175,10 @@ public class MysqlServerConfig {
"" + "" +
";"); ";");
interceptor.setProperties(properties); interceptor.setProperties(properties);
bean.setPlugins(new Interceptor[] {interceptor, bean.setPlugins(new Interceptor[] {interceptor,
paginationInterceptor(),
userEmpowerInterceptor(), userEmpowerInterceptor(),
paginationInterceptor() paginationInterceptor()
}); });
...@@ -105,4 +213,4 @@ public class MysqlServerConfig { ...@@ -105,4 +213,4 @@ public class MysqlServerConfig {
} }
} }
\ No newline at end of file
...@@ -5,8 +5,8 @@ import cn.hutool.core.map.MapBuilder; ...@@ -5,8 +5,8 @@ import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil; import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseUtil; import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseUtil;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -48,7 +48,7 @@ public class FinancingInfoController extends BaseController { ...@@ -48,7 +48,7 @@ public class FinancingInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
@GlobalTransactional @Transactional
public ResponseModel<FinancingInfoDto> save(@RequestBody FinancingInfoDto model) { public ResponseModel<FinancingInfoDto> save(@RequestBody FinancingInfoDto model) {
model = financingInfoServiceImpl.saveModel(model); model = financingInfoServiceImpl.saveModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
...@@ -63,7 +63,7 @@ public class FinancingInfoController extends BaseController { ...@@ -63,7 +63,7 @@ public class FinancingInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
@GlobalTransactional @Transactional
public ResponseModel<FinancingInfoDto> updateBySequenceNbrFinancingInfo(@RequestBody FinancingInfoDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<FinancingInfoDto> updateBySequenceNbrFinancingInfo(@RequestBody FinancingInfoDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
model.setFile(JSON.toJSONString(model.getFiles())); model.setFile(JSON.toJSONString(model.getFiles()));
...@@ -147,7 +147,7 @@ public class FinancingInfoController extends BaseController { ...@@ -147,7 +147,7 @@ public class FinancingInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "撤回", notes = "撤回") @ApiOperation(httpMethod = "GET",value = "撤回", notes = "撤回")
@GlobalTransactional @Transactional
@GetMapping(value = "/rollback") @GetMapping(value = "/rollback")
public ResponseModel rollback(String instanceId,String peasantHouseholdId) { public ResponseModel rollback(String instanceId,String peasantHouseholdId) {
financingInfoServiceImpl.rollback(instanceId,peasantHouseholdId); financingInfoServiceImpl.rollback(instanceId,peasantHouseholdId);
...@@ -158,7 +158,7 @@ public class FinancingInfoController extends BaseController { ...@@ -158,7 +158,7 @@ public class FinancingInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "审核", notes = "审核") @ApiOperation(httpMethod = "POST",value = "审核", notes = "审核")
@PostMapping(value = "/execueFlow") @PostMapping(value = "/execueFlow")
@GlobalTransactional @Transactional
public ResponseModel execueFlow(@RequestBody Map<String, Object> params) { public ResponseModel execueFlow(@RequestBody Map<String, Object> params) {
financingInfoServiceImpl.execueFlow(params); financingInfoServiceImpl.execueFlow(params);
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HygfIcbcServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 并网信息
*/
@RestController
@Api(tags = "电子钱包")
@RequestMapping(value = "/icbc")
public class HygfIcbcController extends BaseController {
@Autowired
HygfIcbcServiceImpl hygfIcbcService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/icbcRegisterWalletUrl")
@ApiOperation(httpMethod = "GET",value = "注册电子钱包", notes = "注册电子钱包")
public void getHygfIcbcRegisterWalletUrl(HttpServletRequest req, HttpServletResponse resp) {
hygfIcbcService.icbcRegisterWalletUrl(req, resp);
}
}
...@@ -6,10 +6,10 @@ import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits; ...@@ -6,10 +6,10 @@ import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PowerStationServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PowerStationServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -132,7 +132,7 @@ public class PowerStationController extends BaseController { ...@@ -132,7 +132,7 @@ public class PowerStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "电站审核", notes = "电站审核") @ApiOperation(httpMethod = "POST",value = "电站审核", notes = "电站审核")
@PostMapping(value = "/powerStationExamine") @PostMapping(value = "/powerStationExamine")
@GlobalTransactional @Transactional
public ResponseModel<String> powerStationExamine(@RequestParam(value = "pageId") long pageId, public ResponseModel<String> powerStationExamine(@RequestParam(value = "pageId") long pageId,
@RequestParam(value = "nodeCode") String nodeCode, @RequestParam(value = "nodeCode") String nodeCode,
@RequestParam(value = "stationId") String stationId, @RequestParam(value = "stationId") String stationId,
......
...@@ -19,11 +19,11 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DesignInformationServi ...@@ -19,11 +19,11 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DesignInformationServi
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HygfReplenishmentServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HygfReplenishmentServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PreparationMoneyServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PreparationMoneyServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -69,7 +69,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -69,7 +69,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增发货单", notes = "新增发货单") @ApiOperation(httpMethod = "POST", value = "新增发货单", notes = "新增发货单")
@GlobalTransactional @Transactional
@UserLimits @UserLimits
public ResponseModel<PreparationMoney> save( @RequestParam("isSubmit") String isSubmit, @RequestBody PreparationMoney model) { public ResponseModel<PreparationMoney> save( @RequestParam("isSubmit") String isSubmit, @RequestBody PreparationMoney model) {
AgencyUserModel agencyUserModel= getUserInfo(); AgencyUserModel agencyUserModel= getUserInfo();
...@@ -257,7 +257,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -257,7 +257,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/uploadVoucher") @PostMapping(value = "/uploadVoucher")
@ApiOperation(httpMethod = "POST",value = "上传收获凭证", notes = "上传收获凭证") @ApiOperation(httpMethod = "POST",value = "上传收获凭证", notes = "上传收获凭证")
@GlobalTransactional @Transactional
public ResponseModel uploadVoucher(@RequestParam(value = "instanceId",required = false) String instanceId,@RequestBody PreparationMoney model, String isSubmit) { public ResponseModel uploadVoucher(@RequestParam(value = "instanceId",required = false) String instanceId,@RequestBody PreparationMoney model, String isSubmit) {
preparationMoneyServiceImpl.uploadVoucher(model,instanceId,isSubmit); preparationMoneyServiceImpl.uploadVoucher(model,instanceId,isSubmit);
...@@ -267,7 +267,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -267,7 +267,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/excuteFlow") @PostMapping(value = "/excuteFlow")
@ApiOperation(httpMethod = "POST",value = "收货审核", notes = "收货审核") @ApiOperation(httpMethod = "POST",value = "收货审核", notes = "收货审核")
@GlobalTransactional @Transactional
public ResponseModel excuteFlow(@RequestParam(value = "instanceId" ,required = false) String instanceId, public ResponseModel excuteFlow(@RequestParam(value = "instanceId" ,required = false) String instanceId,
@RequestParam(value = "sequenceNbr") Long sequenceNbr,@RequestBody Map<String, Object> kv) { @RequestParam(value = "sequenceNbr") Long sequenceNbr,@RequestBody Map<String, Object> kv) {
...@@ -278,7 +278,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -278,7 +278,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/replenishmentSubmit") @PostMapping(value = "/replenishmentSubmit")
@ApiOperation(httpMethod = "POST",value = "补货申请", notes = "补货申请") @ApiOperation(httpMethod = "POST",value = "补货申请", notes = "补货申请")
@GlobalTransactional @Transactional
public ResponseModel replenishmentSubmit( @RequestBody HygfReplenishment hygfReplenishment) { public ResponseModel replenishmentSubmit( @RequestBody HygfReplenishment hygfReplenishment) {
// HygfReplenishment hygfReplenishment1 = new HygfReplenishment(); // HygfReplenishment hygfReplenishment1 = new HygfReplenishment();
// BeanUtils.copyProperties(hygfReplenishment,hygfReplenishment1); // BeanUtils.copyProperties(hygfReplenishment,hygfReplenishment1);
...@@ -302,7 +302,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -302,7 +302,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/replenishmentAudit") @PostMapping(value = "/replenishmentAudit")
@ApiOperation(httpMethod = "POST",value = "补货审核", notes = "补货审核") @ApiOperation(httpMethod = "POST",value = "补货审核", notes = "补货审核")
@GlobalTransactional @Transactional
public ResponseModel replenishmentAudit(@RequestParam(value = "sequenceNbr") Long sequenceNbr,@RequestBody Map<String,Object> kv) { public ResponseModel replenishmentAudit(@RequestParam(value = "sequenceNbr") Long sequenceNbr,@RequestBody Map<String,Object> kv) {
preparationMoneyServiceImpl.replenishmentAudit(sequenceNbr,kv); preparationMoneyServiceImpl.replenishmentAudit(sequenceNbr,kv);
return CommonResponseNewUtil.success(); return CommonResponseNewUtil.success();
...@@ -311,7 +311,7 @@ public class PreparationMoneyController extends BaseController { ...@@ -311,7 +311,7 @@ public class PreparationMoneyController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/submitOrder") @PostMapping(value = "/submitOrder")
@ApiOperation(httpMethod = "POST",value = "补货审核", notes = "补货审核") @ApiOperation(httpMethod = "POST",value = "补货审核", notes = "补货审核")
@GlobalTransactional @Transactional
public ResponseModel submitOrder(@RequestParam(value = "instanceId") String instanceId, public ResponseModel submitOrder(@RequestParam(value = "instanceId") String instanceId,
@RequestParam(value = "isSubmit") String isSubmit, @RequestParam(value = "isSubmit") String isSubmit,
@RequestBody PreparationMoney model) { @RequestBody PreparationMoney model) {
......
...@@ -25,7 +25,6 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -25,7 +25,6 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.GroupModel; import com.yeejoin.amos.feign.privilege.model.GroupModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -33,6 +32,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -33,6 +32,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -262,7 +262,7 @@ public class UnitInfoController extends BaseController { ...@@ -262,7 +262,7 @@ public class UnitInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/unitRegister") @PostMapping(value = "/unitRegister")
@ApiOperation(httpMethod = "POST", value = "单位注册", notes = "单位注册") @ApiOperation(httpMethod = "POST", value = "单位注册", notes = "单位注册")
@GlobalTransactional @Transactional
public ResponseModel<UnitRegisterDto> save(@RequestBody UnitRegisterDto model) { public ResponseModel<UnitRegisterDto> save(@RequestBody UnitRegisterDto model) {
try { try {
......
package com.yeejoin.amos.boot.module.hygf.biz.feign; package com.yeejoin.amos.boot.module.hygf.biz.feign;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model; import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
...@@ -16,7 +17,8 @@ import java.util.List; ...@@ -16,7 +17,8 @@ import java.util.List;
* @apiNote 待办Feign调用 * @apiNote 待办Feign调用
* @date 2024-05-16 * @date 2024-05-16
*/ */
@FeignClient(name = "AMOS-API-PRIVILEGE", path = "/systemctl/v2/task", configuration = {XidFeignConfiguration.class}) //@FeignClient(name = "AMOS-API-PRIVILEGE", path = "/systemctl/v2/task", configuration = {XidFeignConfiguration.class})
@FeignClient(name = "AMOS-API-PRIVILEGE", path = "/systemctl/v2/task", configuration = {MultipartSupportConfig.class})
public interface TaskV2FeignService { public interface TaskV2FeignService {
/** /**
......
package com.yeejoin.amos.boot.module.hygf.biz.feign; package com.yeejoin.amos.boot.module.hygf.biz.feign;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.workflow.model.*; import com.yeejoin.amos.feign.workflow.model.*;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -8,7 +9,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -8,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@FeignClient(name = "${workflow.feign.name}", path = "workflow", configuration = {XidFeignConfiguration.class}) @FeignClient(name = "${workflow.feign.name}", path = "workflow", configuration = {MultipartSupportConfig.class})
public interface WorkFlowFeignService { public interface WorkFlowFeignService {
/*** /***
......
...@@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@FeignClient(name = "${workflow.feign.name:AMOS-API-WORKFLOW}", path = "workflow", configuration = {MultipartSupportConfig.class})
@FeignClient(name = "${workflow.feign.name:AMOS-API-WORKFLOW}", path = "workflow", configuration = {XidFeignConfiguration.class}) //@FeignClient(name = "${workflow.feign.name:AMOS-API-WORKFLOW}", path = "workflow", configuration = {XidFeignConfiguration.class})
public interface WorkflowFeignClient { public interface WorkflowFeignClient {
/*** /***
......
package com.yeejoin.amos.boot.module.hygf.biz.feign; //package com.yeejoin.amos.boot.module.hygf.biz.feign;
//
import feign.RequestInterceptor; //import feign.RequestInterceptor;
import feign.RequestTemplate; //import feign.RequestTemplate;
import feign.codec.Encoder; //import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder; //import feign.form.spring.SpringFormEncoder;
import io.seata.core.context.RootContext; //import io.seata.core.context.RootContext;
import org.springframework.beans.factory.ObjectFactory; //import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters; //import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder; //import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils; //import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextListener; //import org.springframework.web.context.request.RequestContextListener;
//
@Configuration //@Configuration
public class XidFeignConfiguration implements RequestInterceptor { //public class XidFeignConfiguration implements RequestInterceptor {
@Autowired // @Autowired
private ObjectFactory<HttpMessageConverters> messageConverters; // private ObjectFactory<HttpMessageConverters> messageConverters;
//
@Bean // @Bean
public Encoder feignFormEncoder() { // public Encoder feignFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters)); // return new SpringFormEncoder(new SpringEncoder(messageConverters));
} // }
/** // /**
* 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用 // * 创建Feign请求拦截器,在发送请求前设置认证的token,各个微服务将token设置到环境变量中来达到通用
* @return // * @return
*/ // */
@Bean // @Bean
public RequestContextListener requestInterceptor() { // public RequestContextListener requestInterceptor() {
return new RequestContextListener(); // return new RequestContextListener();
} // }
//
@Override // @Override
public void apply(RequestTemplate template) { // public void apply(RequestTemplate template) {
String xid = RootContext.getXID(); // String xid = RootContext.getXID();
if(StringUtils.hasText(xid)){ // if(StringUtils.hasText(xid)){
template.header(RootContext.KEY_XID, xid); // template.header(RootContext.KEY_XID, xid);
} // }
} // }
} //}
\ No newline at end of file \ No newline at end of file
...@@ -20,11 +20,11 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceRectificationOrd ...@@ -20,11 +20,11 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceRectificationOrd
import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil; import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -103,7 +103,7 @@ public class AcceptanceRectificationOrderServiceImpl extends BaseService<Accepta ...@@ -103,7 +103,7 @@ public class AcceptanceRectificationOrderServiceImpl extends BaseService<Accepta
* 提交整改并触发工作流 * 提交整改并触发工作流
*/ */
@GlobalTransactional @Transactional
public AcceptanceRectificationOrderDto updateAndDriveWorkflow(AcceptanceRectificationOrderDto model, String userId) { public AcceptanceRectificationOrderDto updateAndDriveWorkflow(AcceptanceRectificationOrderDto model, String userId) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
......
...@@ -19,11 +19,11 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper; ...@@ -19,11 +19,11 @@ import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceService; import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceService;
import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil; import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -115,7 +115,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService { ...@@ -115,7 +115,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
return Optional.ofNullable(item).orElse(new AcceptanceCheckItem()); return Optional.ofNullable(item).orElse(new AcceptanceCheckItem());
} }
@Override @Override
@GlobalTransactional @Transactional
public void checkAccept(Long basicGridAcceptanceId, String userId) { public void checkAccept(Long basicGridAcceptanceId, String userId) {
String lockName = String.format("LockName:checkAccept:%s", basicGridAcceptanceId); String lockName = String.format("LockName:checkAccept:%s", basicGridAcceptanceId);
Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1); Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1);
......
...@@ -13,7 +13,6 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IBasicGridAcceptanceService ...@@ -13,7 +13,6 @@ import com.yeejoin.amos.boot.module.hygf.api.service.IBasicGridAcceptanceService
import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil; import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil;
import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil; import com.yeejoin.amos.boot.module.hygf.api.util.RedisLockUtil;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -94,7 +93,7 @@ public class BasicGridAcceptanceServiceImpl ...@@ -94,7 +93,7 @@ public class BasicGridAcceptanceServiceImpl
return grid; return grid;
} }
@GlobalTransactional @Transactional
public synchronized HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) { public synchronized HygfOnGrid saveAndCommit(HygfOnGrid grid, String userId) {
BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper BasicGridAcceptance basicGridAcceptance = basicGridAcceptanceMapper
...@@ -202,7 +201,7 @@ public class BasicGridAcceptanceServiceImpl ...@@ -202,7 +201,7 @@ public class BasicGridAcceptanceServiceImpl
return bool; return bool;
} }
@GlobalTransactional @Transactional
public void execute(AcceptanceCheckItem dto, String userId) { public void execute(AcceptanceCheckItem dto, String userId) {
String lockName = String.format("LockName:executeWorkflow:%s", dto.getBasicGridAcceptanceId()); String lockName = String.format("LockName:executeWorkflow:%s", dto.getBasicGridAcceptanceId());
Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1); Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1);
......
...@@ -35,7 +35,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; ...@@ -35,7 +35,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO; import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.icbc.api.IcbcConstants;
import com.icbc.api.UiIcbcClient;
import com.icbc.api.request.JftUiUserEntrustopenacctSubmitRequestV1;
import com.yeejoin.amos.boot.module.hygf.api.service.IHygfIcbcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.UUID;
/**
* 并网信息服务实现类
*
* @author system_generator
* @date 2024-01-12
*/
@Service
@Slf4j
public class HygfIcbcServiceImpl implements IHygfIcbcService {
private static final long serialVersionUID = 1L;
// 合作方 APPID
private static final String APP_ID = "11000000000000028870";
// 此处替换合作方 APPID 对应私钥
private static final String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAlcIeANdqipul3/qAIRlknSacHiFCMzLzUJisGcr9ipm3p2rir8WDsac2MxgtUt+f89SGNoWyjv4q0/QAKQQTd5U3KuGAksCJLBGVibuFe7G7YGYVezUksjvocvp8GIinCIkzq67KL2SOpGXAu3s+282rx8AxdTZA/EhXQvbORbWz5+DamyY+wS7Maa8KmIOb6WZPtiXgENZxDHAafrqW8Gt1BnVfJNf5yS5J9Wl+LcR1EPvi5iH8dSIdn1ZMVupoREjV/DvItSogVehsqTRZWuekAo2xH9YEli1UMG/l3deViRn/A4VmPPzdv0xXpn/yO+OTjWez+KmSmJfAZXBvAgMBAAECggEABRYviWFWTz8X+1qeIDI/nHO2KFt3X2tAxkJztd/8h5PYmYw3e4NPATp5Ayp4UgIlW/ExxNW91EiImBL/F939eJIpA8sDJ8U4hqb+U+fOZyksOZnDOIAHmE+I24vl588yFM9Z6F55gGeeDVJ0SZHqIG/nz8i339aLt02yj3N6V1peQugBP6L9arcD+gVu4F70whkqW+lHBK/WzX1OazqEx3Ip175jqzi9/0vO/h/kqnGGXuMi2VeuAPsa+d0a6lf/FScxqCt3t6dCkJ5DPA1MCj81dPi5ZfCM/vE0N8I6LEV+RyC7bb4YVO/PoicFjb2j8vfLvldOUrsvkNH51dZusQKBgQDpMHacOBpIuVzEFfNtS9SgA96cUV6NCSmHoQppJ/p9xKzY4DpcqoOCIBT4WCvVe6PeN5mrjzt8Q5gJWxiq0tVgIF9k8GjLmuiJ2v4Qh8aUmlRwn0T0DYiX/Y7uzX+pRlkpoKrSktlTOT9vmGwZDGDk0h2+H3hZ3YQEucfA6bhHmQKBgQDTbHrbr1WsUR9lrdLaGi/Uphpl3BXLuCnJXav3yIZOktO5V68MfPZXLP7aaNtbK3n0YHD+Uv8wpHBBSWQYjVYlGdvlniA/W1pr73GZJECFfS1BmmFC4GG3E92D5IkmrcPlUuz8XxKrlwHnfW1F0MoDvhp930vS0tS6u+WYTt9dRwKBgCeEQPVkRIACeYf5OFFTQmsDfNv8pgs8fD8xuTPsxHQ/uhLenMVLWBHbIfKb7oG0/CYSQgZitW/vfHpJZ7q7E9HAaqoOW5P1YmbKJ7fhanOQW7LiKqs5B+bJ30j0piendkCpq4kXvaBu2SMuL1NnV5wvRz8K0jhYY6DxYrp8YPAxAoGAZxWTaZ25tgTvvBHeprzx6Ur7wAJpFiU7KpVjjbLV2WW5mbro/LvJGIQ11qQdn/w4wDBtp3MsPblPimWQSnBPOlO7Zd+NdZbDJbFfv/1vACcic8Qj/AmPW0ZyUSaSwKskwqGGLx7j6Yn9QbNkHhBJDz4XiJvhSm/FjS6kKXj7a20CgYEArnEiPmL5g1Ca/qKK9ql8Q6P9gipIfGGpaFu23y0trbcFpVn8Oos/ic0Jgw4Xiz+rqvb6bW2V6lqBJ+9/kdn0i7zlZxKNpYsW2xFgi04OU3d5HkGL16Y1rpqMYYEhjFaOIn7J8P046UYR99yaybgQd18TE6oFrX8OL5uY8M4ge4Y=";
// 指定《聚富通委托代扣签约同步开户页面服务V1》URL
private static final String serviceUrl = "https://gw.open.icbc.com.cn/ui/jft/ui/user/entrustopenacct/submit/V1";
private static final String corpNo = "020240710000001169";
private static final String trxChannel = "05"; // 05表示小程序
// 此处替换合作方 AES 加密秘钥
private static final String AES_Key = "nuCVNzIxOTHZWv8YjEeYQA==";
private static final String CAMS_PUBLIC_KEY = "655CE8706E6ED9A30B92E57D8D645ADDE8C541C27C5C5AFD529C610C4C0B04F9074E3B6E933C50A3316AEA60CEF461BE4C7916D2AF51170D3A2631394A7F3939";
@Override
public void icbcRegisterWalletUrl(HttpServletRequest req, HttpServletResponse resp) {
try {
UiIcbcClient client = new UiIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY, IcbcConstants.CHARSET_UTF8);
String userId = req.getParameter("userId");
JftUiUserEntrustopenacctSubmitRequestV1 request = new JftUiUserEntrustopenacctSubmitRequestV1();
request.setServiceUrl(serviceUrl);
JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz bizContent = new JftUiUserEntrustopenacctSubmitRequestV1.JftUiUserEntrustopenacctSubmitRequestV1Biz();
bizContent.setAppId(APP_ID);
bizContent.setCorpNo(corpNo);
bizContent.setOutUserId(userId);
bizContent.setCorpSerno(UUID.randomUUID().toString());
bizContent.setTrxChannel(trxChannel);
bizContent.setSignProtocol("0"); // 是否对接缴费代扣流程
// bizContent.setOutVendorId("MAA7TGFK-2"); // 企业外系统编号
// bizContent.setProjectId(UUID.randomUUID().toString().substring(0, 16)); // 缴费项目编号
// bizContent.setBusiCode(userId); // 缴费编号
// bizContent.setProtocolEndDate("2030-12-30");
// bizContent.setProtocolLimitAmount("99999999999999999");
// bizContent.setCallbackUrl("https://www.icbc.com.cn/notify");
// bizContent.setJumpUrl("https://www.icbc.com.cn/jumpback?userId=xxx");
// bizContent.setFailJumpUrl("https://www.icbc.com.cn/jumpback?userId=xxx");
bizContent.setCamsPublicKey(CAMS_PUBLIC_KEY);
request.setBizContent(bizContent);
// 调用工行 SDK,生成自动提交表单,将用户跳转到收方入驻页面
resp.setHeader("Content-Type", "text/html;charset=" + IcbcConstants.CHARSET_UTF8);
PrintWriter out = resp.getWriter();
out.write("<html>");
out.write("<head>");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" + IcbcConstants.CHARSET_UTF8 + "\">");
out.write("</head>");
out.write("<body>");
System.out.println("111111111111111118888888888888" + client.buildPostForm(request).toString());
out.write(client.buildPostForm(request));
out.write("</body>");
out.write("</html>");
} catch (Exception e) {
log.error(e.getMessage(),e);
throw new BadRequest("报错了");
}
}
}
\ No newline at end of file
...@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient; ...@@ -21,7 +21,6 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext; import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
......
...@@ -34,7 +34,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO; ...@@ -34,7 +34,6 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO; import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO; import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO; import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -916,7 +915,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -916,7 +915,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
} }
@GlobalTransactional @Transactional
public void uploadVoucher(PreparationMoney model, String instanceId, String isSubmit) { public void uploadVoucher(PreparationMoney model, String instanceId, String isSubmit) {
//经销商暂存则只更新发货单属性 不进行业务推动 //经销商暂存则只更新发货单属性 不进行业务推动
if ("1".equals(isSubmit)) { if ("1".equals(isSubmit)) {
...@@ -1033,7 +1032,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -1033,7 +1032,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
} }
@GlobalTransactional @Transactional
public void replenishmentRollback(Long sequenceNbr) { public void replenishmentRollback(Long sequenceNbr) {
LambdaQueryWrapper<HygfPreparationMoneyAuditing> lambda = new LambdaQueryWrapper(); LambdaQueryWrapper<HygfPreparationMoneyAuditing> lambda = new LambdaQueryWrapper();
lambda.eq(HygfPreparationMoneyAuditing::getPreparationMoneyId, sequenceNbr); lambda.eq(HygfPreparationMoneyAuditing::getPreparationMoneyId, sequenceNbr);
......
...@@ -25,7 +25,6 @@ import com.yeejoin.amos.component.robot.AmosRequestContext; ...@@ -25,7 +25,6 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
...@@ -149,7 +148,7 @@ public class SurveyInformationServiceImpl ...@@ -149,7 +148,7 @@ public class SurveyInformationServiceImpl
return this.queryForList("", false); return this.queryForList("", false);
} }
@GlobalTransactional @Transactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) { public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto, String operationType) {
String lockName = null; String lockName = null;
try { try {
......
...@@ -7,7 +7,6 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient; ...@@ -7,7 +7,6 @@ import com.yeejoin.amos.boot.module.hygf.biz.feign.WorkflowFeignClient;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO; import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
...@@ -119,7 +119,7 @@ spring.security.user.password=a1234560 ...@@ -119,7 +119,7 @@ spring.security.user.password=a1234560
fire-rescue=123 fire-rescue=123
mybatis-plus.global-config.db-config.update-strategy=ignored mybatis-plus.global-config.db-config.field-strategy=IGNORED
# user-amos setting : This value is the secretkey for person manage moudle accout password encryption.please don't change it!!! # user-amos setting : This value is the secretkey for person manage moudle accout password encryption.please don't change it!!!
amos.secret.key=qaz amos.secret.key=qaz
...@@ -246,9 +246,3 @@ spring.elasticsearch.rest.connection-timeout=30000 ...@@ -246,9 +246,3 @@ spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=123456 spring.elasticsearch.rest.password=123456
spring.elasticsearch.rest.read-timeout=30000 spring.elasticsearch.rest.read-timeout=30000
## 47环境 排除es报错引进无用配置 业务未实际使用es
spring.elasticsearch.rest.uris=http://47.92.234.253:9200
spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=123456
spring.elasticsearch.rest.read-timeout=30000
\ No newline at end of file
## DB properties: ## DB properties:
spring.datasource.dynamic.primary= mysql-service spring.datasource.dynamic.primary= mysql-service
spring.datasource.mysql-service.driver-class-name=com.kingbase8.Driver
spring.datasource.mysql-service.jdbc-url=jdbc:kingbase8://10.20.1.176:54321/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&currentSchema=root #spring.datasource.mysql-service.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.mysql-service.jdbc-url=jdbc:mysql://47.92.234.253:3306/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.mysql-service.username=root spring.datasource.mysql-service.username=root
spring.datasource.mysql-service.password=Yeejoin@2020 spring.datasource.mysql-service.password=Yeejoin@2020
spring.datasource.mysql-service.type=com.zaxxer.hikari.HikariDataSource spring.datasource.mysql-service.type=com.zaxxer.hikari.HikariDataSource
...@@ -50,11 +52,11 @@ spring.datasource.tdengine-service.connection-test-query: SELECT 1 ...@@ -50,11 +52,11 @@ spring.datasource.tdengine-service.connection-test-query: SELECT 1
## eureka properties: ## eureka properties:
eureka.instance.hostname=10.20.1.160 eureka.instance.hostname=47.92.234.253
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties: ## redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=10.20.1.210 spring.redis.host=47.92.234.253
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
...@@ -90,7 +92,7 @@ lettuce.timeout=10000 ...@@ -90,7 +92,7 @@ lettuce.timeout=10000
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://10.20.1.210:2883 emqx.broker=tcp://47.92.234.253:2883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
emqx.max-inflight=1000 emqx.max-inflight=1000
...@@ -125,7 +127,7 @@ amos.secret.key=qaz ...@@ -125,7 +127,7 @@ amos.secret.key=qaz
# if your service can't be access ,you can use this setting , you need change ip as your. # if your service can't be access ,you can use this setting , you need change ip as your.
#eureka.instance.prefer-ip-address=true #eureka.instance.prefer-ip-address=true
#eureka.instance.ip-address=172.16.3.122 #eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url=tcp://10.20.1.210:61616 spring.activemq.broker-url=tcp://47.92.234.253:61616
spring.activemq.user=admin spring.activemq.user=admin
spring.activemq.password=admin spring.activemq.password=admin
spring.jms.pub-sub-domain=false spring.jms.pub-sub-domain=false
...@@ -231,12 +233,18 @@ dealer.amosDealerId=1767820997374775298 ...@@ -231,12 +233,18 @@ dealer.amosDealerId=1767820997374775298
#Seata Config #Seata Config
seata.tx-service-group=hygf-seata seata.tx-service-group=hygf-seata
seata.service.grouplist.hygf-seata=47.92.234.253:8091 seata.service.grouplist.hygf-seata=172.16.0.29:8091
# Seata 配置 # Seata 配置
seata.enabled=true seata.enabled=true
seata.enable-auto-data-source-proxy=false seata.enable-auto-data-source-proxy=false
#seata.client.undo.log-serialization=kryo #seata.client.undo.log-serialization=kryo
#
seata.datasource.autoproxy.datasource-proxy-mode=original ## 47环境 排除es报错引进无用配置 业务未实际使用es
seata.datasource.autoproxy.enabled=true spring.elasticsearch.rest.uris=http://47.92.234.253:9200
seata.datasource.autoproxy.data-source-names=postgresql spring.elasticsearch.rest.connection-timeout=30000
\ No newline at end of file spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=123456
spring.elasticsearch.rest.read-timeout=30000
...@@ -2,7 +2,7 @@ spring.application.name=AMOS-HYGF-CZ ...@@ -2,7 +2,7 @@ spring.application.name=AMOS-HYGF-CZ
server.servlet.context-path=/hygf server.servlet.context-path=/hygf
server.port=33330 server.port=33330
server.uri-encoding=UTF-8 server.uri-encoding=UTF-8
spring.profiles.active=dev spring.profiles.active=kingbase8
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
logging.config=classpath:logback-${spring.profiles.active}.xml logging.config=classpath:logback-${spring.profiles.active}.xml
...@@ -56,7 +56,7 @@ amos.system.user.user-name=hygf_robot ...@@ -56,7 +56,7 @@ amos.system.user.user-name=hygf_robot
amos.system.user.password=a1234560 amos.system.user.password=a1234560
amos.system.user.product=AMOS_STUDIO_WEB amos.system.user.product=AMOS_STUDIO_WEB
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
workflow.feign.name=AMOS-API-WORKFLOW-CZ workflow.feign.name=AMOS-API-WORKFLOW
feign.okhttp.enabled= true feign.okhttp.enabled= true
\ No newline at end of file
...@@ -28,16 +28,16 @@ ...@@ -28,16 +28,16 @@
</encoder> </encoder>
</appender> </appender>
<!--myibatis log configure--> <!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/> <logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="java.sql.Connection" level="INFO"/> <logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="INFO"/> <logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="INFO"/> <logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/> <logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.springframework" level="INFO"/> <logger name="org.springframework" level="DEBUG"/>
<logger name="org.typroject" level="INFO"/> <logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="INFO"/> <logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="INFO"> <root level="DEBUG">
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<logger name="org.typroject" level="DEBUG"/> <logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/> <logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 --> <!-- 日志输出级别 -->
<root level="INFO"> <root level="DEBUG">
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
......
...@@ -105,7 +105,6 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -105,7 +105,6 @@ public class BigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
......
...@@ -130,6 +130,23 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -130,6 +130,23 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘-10分钟", notes = "场站设备健康状态指数与趋势 - 仪表盘-10分钟")
@GetMapping(value = "/getHealthScoreInfoByMinute")
public ResponseModel<Map<String, Object>> getHealthScoreInfoByMinute(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode,
@RequestParam (required = false) String tableName) {
HashMap<String, Object> stringBigDecimalHashMap = new HashMap<>();
if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper.getHealthScoreInfoByStationByMinute(stationCode, tableName));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
stringBigDecimalHashMap.put("value",
idxBizFanHealthIndexMapper.getHealthScoreInfoByLatest(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode,
......
...@@ -22,12 +22,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; ...@@ -22,12 +22,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> { public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> {
BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode, BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode,
@Param("tableName") String tableName); @Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByStationByMinute(@Param("stationCode") String stationCode,
@Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode,
@Param("analysisType") String analysisType); @Param("analysisType") String analysisType);
......
...@@ -220,6 +220,109 @@ ...@@ -220,6 +220,109 @@
FROM ${tableName} a FROM ${tableName} a
where (a.DISPOSOTION_STATE = '待确认') where (a.DISPOSOTION_STATE = '待确认')
<!-- or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY ))--> <!-- or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY ))-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
<if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
</where>
limit 1
</select>
<select id="getHealthScoreInfoByStationByMinute" resultType="java.math.BigDecimal">
SELECT
round(IFNULL( HEALTH_INDEX , 100 ), 1) AS healthIndex
FROM
${tableName}
<where>
ANALYSIS_TYPE = '按10分钟'
<if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
</where>
order by REC_DATE DESC
limit 1
</select>
<select id="getHealthListInfo" resultType="java.util.Map">
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
DATE_ADD( a.date, INTERVAL - 1 DAY ) as date
FROM
(
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
) a
LEFT JOIN (
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_pv_health_index
<where>
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</where>
UNION ALL
(
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_fan_health_index
<where>
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
)
) b ON DATE_FORMAT( b.recDate, '%Y-%m-%d' ) = a.date
GROUP BY
a.date
</select>
<select id="getAllEquipAlarmInfo" resultType="java.util.Map">
SELECT ARAE as area,
WARNING_NAME as warningName,
count(1) as num
FROM ${tableName} a
where (a.DISPOSOTION_STATE = '待确认')
<!-- or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY ))-->
or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > get_time_sub(3,'DAY') or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > get_time_sub(3,'DAY')
group by ARAE, group by ARAE,
WARNING_NAME WARNING_NAME
......
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
@MappedJdbcTypes(JdbcType.BIT)
public class BitTypeHandler extends BaseTypeHandler<Boolean> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Boolean parameter, JdbcType jdbcType)
throws SQLException {
//原生的boolean会再sql上加上引号比如'0'或者'1',人大金仓不支持,支持不带引号的
//ps.setBoolean(i, parameter);
ps.setInt(i, parameter?1:0);
}
@Override
public Boolean getNullableResult(ResultSet rs, String columnName) throws SQLException {
return rs.getBoolean(columnName);
}
@Override
public Boolean getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return rs.getBoolean(columnIndex);
}
@Override
public Boolean getNullableResult(java.sql.CallableStatement cs, int columnIndex) throws SQLException {
return cs.getBoolean(columnIndex);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.doc.TycloudResource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.HashMap;
/**
* TODO 临时方案,后续要优化该方案
*
* @ProjectName amos-qms
* @Author yangyang
* @CreateTime 2024-02-20 10:29
* @Description
**/
@RestController
@TycloudResource(module = "OAuth", value = "OAuth")
@RequestMapping(value = "/bigscreen/oauth")
@Api(tags = "大屏对接")
@Slf4j
public class OAuthResource {
public static final String SECRETKEY = "qaz";
private final static String AUTHORIZE = "http://%s/authorize?redirect_uri=%s";
private final static String AUTOLOGIN = "http://%s/autologin?token=%s&userId=%s&redirectURI=%s";
private final static String BIGSCREEN = "/vizagfun/jepc?appId=jepc1&top=monitor&bottom=ovarall";
@Value("${appKey:AMOS_ADMIN}")
private String APP_KEY;
@Value("${product:AMOS-WEB-ADMIN}")
private String PRODUCT;
@Value("${redirect.host:iiet-jepcc.powerchina.cn:8088}")
private String host;
@TycloudOperation(needAuth = false, ApiLevel = UserType.PUBLIC)
@GetMapping("/redirect")
public void getAuth(@RequestParam("loginId") String loginId, @RequestParam("password") String password, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (ValidationUtil.isEmpty(loginId) || ValidationUtil.isEmpty(password)) {
response.sendRedirect(String.format(AUTHORIZE, host, getRedirectURI(null)));
}
String redirectUrl;
// 已取得认证用户信息,执行相应操作…
RequestContext.setAppKey(APP_KEY);
RequestContext.setProduct(PRODUCT);
// 登录
IdPasswordAuthModel idPasswordAuthModel = new IdPasswordAuthModel();
idPasswordAuthModel.setLoginId(loginId);
idPasswordAuthModel.setPassword(password);
FeignClientResult<HashMap<String, Object>> feignClientResult = null;
try {
feignClientResult = Privilege.authClient.idpassword(idPasswordAuthModel);
} catch (Exception e) {
e.printStackTrace();
}
if (feignClientResult == null || feignClientResult.getStatus() != 200) {
redirectUrl = String.format(AUTHORIZE, host, getRedirectURI(null));
log.info("用户[{}]未在平台创建。。。", loginId);
response.sendRedirect(redirectUrl);
}
String userId = (String) feignClientResult.getResult().get("userId");
String amosToken = (String) feignClientResult.getResult().get("token");
redirectUrl = String.format(AUTOLOGIN, host, amosToken, userId, getRedirectURI(BIGSCREEN));
log.info("重定向访问地址:{}", redirectUrl);
response.sendRedirect(redirectUrl);
}
public String getRedirectURI(String redirectUrl) {
if (StringUtils.isEmpty(redirectUrl)) {
return "";
}
return URLEncoder.encode(redirectUrl);
}
}
...@@ -4,33 +4,33 @@ spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource ...@@ -4,33 +4,33 @@ spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:kingbase8://10.20.1.176:54321/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&currentSchema=root spring.db1.datasource.url=jdbc:kingbase8://10.20.1.176:54321/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&currentSchema=root
spring.db1.datasource.username=root spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020 spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name: com.kingbase8.Driver spring.db1.datasource.driver-class-name=com.kingbase8.Driver
## db2-sync_data ## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:kingbase8://10.20.1.176:54321/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&currentSchema=root spring.db2.datasource.url=jdbc:kingbase8://10.20.1.176:54321/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&currentSchema=root
spring.db2.datasource.username=root spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020 spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name: com.kingbase8.Driver spring.db2.datasource.driver-class-name=com.kingbase8.Driver
##db3
spring.db3.datasource.url=jdbc:TAOS-RS://10.20.1.157:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
##db4
spring.db4.datasource.url=jdbc:TAOS-RS://10.20.1.157:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true spring.db4.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# kingbase8 backquote not support
mybatis-plus.global-config.db-config.table-field-strategy=ignore
## eureka properties: ## eureka properties:
eureka.instance.hostname=10.20.1.160 #eureka.instance.hostname=139.9.173.44
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/ eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@47.92.234.253:10001/eureka/
## redis properties: ## redis properties:
spring.redis.database=1 spring.redis.database=1
spring.redis.host=10.20.1.210 spring.redis.host=47.92.234.253
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
...@@ -65,17 +65,18 @@ lettuce.timeout=10000 ...@@ -65,17 +65,18 @@ lettuce.timeout=10000
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=AMOS-JXIOP-BIGSCREEN
emqx.broker=tcp://10.20.1.210:2883 emqx.client-user-name=
emqx.client-password=
emqx.broker=tcp://47.92.234.253:2883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://10.20.1.210:8083/mqtt mqtt.scene.host=mqtt://47.92.234.253:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000 emqx.max-inflight=1000
emqx.client-user-name=admin
emqx.client-password=public
## influxDB ## influxDB
#spring.influx.url= http://172.16.3.155:18186 #spring.influx.url= http://172.16.3.155:18186
...@@ -98,7 +99,8 @@ emqx.client-password=public ...@@ -98,7 +99,8 @@ emqx.client-password=public
#spring.influx.bufferLimit=20000 #spring.influx.bufferLimit=20000
#spring.influx.url=http://10.20.1.157:18086 # influxDB
#spring.influx.url= http://192.168.120.102:18086
#spring.influx.password=Yeejoin@2020 #spring.influx.password=Yeejoin@2020
#spring.influx.user=root #spring.influx.user=root
#spring.influx.database=iot_platform #spring.influx.database=iot_platform
...@@ -128,28 +130,19 @@ amos.secret.key=qaz ...@@ -128,28 +130,19 @@ amos.secret.key=qaz
#eureka.instance.ip-address=172.16.3.122 #eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url=tcp://10.20.1.210:61616 spring.activemq.broker-url=tcp://47.92.234.253:61616
spring.activemq.user=admin spring.activemq.user=admin
spring.activemq.password=admin spring.activemq.password=admin
spring.jms.pub-sub-domain=false spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
spring.elasticsearch.rest.uris=http://10.20.0.223:9200
spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000
# ????????? # ?????????
fan.statuts.stattuspath=upload/jxiop/device_status fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=upload/jxiop/syz/ pictureUrl=upload/jxiop/syz/
# Ԥ large.cron=0 0/5 * * * ?
idx.predict.serviceUrl=http://10.20.1.157:8095/jxdj/predict-data
forecast.url= forecast.url=
logic=
\ No newline at end of file logic=
...@@ -2,7 +2,7 @@ spring.application.name=AMOS-JXIOP-BIGSCREEN-CZ ...@@ -2,7 +2,7 @@ spring.application.name=AMOS-JXIOP-BIGSCREEN-CZ
server.servlet.context-path=/jxiop-bigscreen server.servlet.context-path=/jxiop-bigscreen
server.port=33300 server.port=33300
server.uri-encoding=UTF-8 server.uri-encoding=UTF-8
spring.profiles.active=dev1 spring.profiles.active=kingbase8
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
logging.config=classpath:logback-${spring.profiles.active}.xml logging.config=classpath:logback-${spring.profiles.active}.xml
...@@ -75,11 +75,7 @@ station.section=10 ...@@ -75,11 +75,7 @@ station.section=10
gl.sum.column=日发电量,月发电量,年发电量 gl.sum.column=日发电量,月发电量,年发电量
gl.avg.column=有功功率,日利用小时,瞬时风速 gl.avg.column=有功功率,日利用小时,瞬时风速
spring.elasticsearch.rest.uris=http://139.9.173.44:9200
spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000
daily.power.generation.cron=0 0/1 * * * ? daily.power.generation.cron=0 0/1 * * * ?
moon.power.generation.cron=0 0/1 * * * ? moon.power.generation.cron=0 0/1 * * * ?
......
...@@ -329,10 +329,10 @@ ...@@ -329,10 +329,10 @@
<module>amos-boot-biz-common</module> <module>amos-boot-biz-common</module>
<module>amos-boot-core</module> <module>amos-boot-core</module>
<module>amos-boot-data</module> <module>amos-boot-data</module>
<module>amos-boot-module</module> <!-- <module>amos-boot-module</module>-->
<module>amos-boot-system-ccs</module> <!-- <module>amos-boot-system-ccs</module>-->
<module>amos-boot-system-jcs</module> <!-- <module>amos-boot-system-jcs</module>-->
<module>amos-boot-system-equip</module> <!-- <module>amos-boot-system-equip</module>-->
<module>amos-boot-system-jxiop</module> <module>amos-boot-system-jxiop</module>
</modules> </modules>
</project> </project>
\ 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