Commit 17897011 authored by 郝彦辉's avatar 郝彦辉

提交2020.06.11

parent 4de7b501
......@@ -23,10 +23,10 @@ public class RenHangDatasourceProperties {
@Value("${db.driver}")
private String driverClass;
@Value("${db.minPoolSize}")
private int minPoolSize;
@Value("${db.maxPoolSize}")
private int maxPoolSize;
//@Value("${db.minPoolSize}")
private int minPoolSize = 10;
//@Value("${db.maxPoolSize}")
private int maxPoolSize =20 ;
......
package cn.quantgroup.report.config.datasource.xyqbuser;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
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.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* Desc:
* User: HaiNan.Wang
* Date: 2017/5/2
*/
@Import(XyqbUserDatasourceProperties.class)
@Configuration
@Slf4j
@MapperScan(basePackages = XyqbUserDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "xyqbUserSqlSessionFactory")
public class XyqbUserDataSourceConfig {
static final String PACKAGE = "cn.quantgroup.report.mapper.xyqbuser";
@Value("${xyqb_user.mapper-locations}")
private String mapperLocations;
@Value("${xyqb_user.type-aliases-package}")
private String typeAliasesPackage;
@Value("${config-location}")
private String configLocation;
@Autowired
private XyqbUserDatasourceProperties xyqbUserDatasourceProperties;
@Bean(name = "xyqbUserDataSource")
public DataSource xyqbUserDataSource() {
HikariConfig config = new HikariConfig();
config.setJdbcUrl(xyqbUserDatasourceProperties.getJdbcUrl());
log.info("数据库地址:{}", xyqbUserDatasourceProperties.getJdbcUrl());
config.setPassword(xyqbUserDatasourceProperties.getPassword());
config.setUsername(xyqbUserDatasourceProperties.getUsername());
config.setMaximumPoolSize(xyqbUserDatasourceProperties.getMaxPoolSize());
config.setMinimumIdle(xyqbUserDatasourceProperties.getMinPoolSize());
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
return new HikariDataSource(config);
}
@Bean(name = "xyqbUserTransactionManager")
public DataSourceTransactionManager xyqbUserTransactionManager(@Qualifier("xyqbUserDataSource") DataSource xyqbUserDataSource) {
return new DataSourceTransactionManager(xyqbUserDataSource);
}
@Bean(name = "xyqbUserSqlSessionFactory")
public SqlSessionFactory xyqbUserSqlSessionFactory(@Qualifier("xyqbUserDataSource") DataSource xyqbUserDataSource) throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(xyqbUserDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(mapperLocations));
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver()
.getResource(configLocation));
return sessionFactory.getObject();
}
@Bean(name = "xyqbUserSqlSessionTemplate")
public SqlSessionTemplate xyqbUserSqlSessionTemplate(@Qualifier("xyqbUserSqlSessionFactory") SqlSessionFactory xyqbUserSqlSessionFactory) throws Exception {
return new SqlSessionTemplate(xyqbUserSqlSessionFactory);
}
}
package cn.quantgroup.report.config.datasource.xyqbuser;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* Desc:
* User: HaiNan.Wang
* Date: 2017/5/2
*/
@Getter
@Setter
@Configuration
public class XyqbUserDatasourceProperties {
@Value("${db.driver}")
private String driverClass;
@Value("${db.minPoolSize}")
private int minPoolSize;
@Value("${db.maxPoolSize}")
private int maxPoolSize;
@Value("${db.xyqb_user.url}")
private String jdbcUrl;
@Value("${db.xyqb_user.username}")
private String username;
@Value("${db.xyqb_user.password}")
private String password;
}
......@@ -2,8 +2,10 @@ package cn.quantgroup.report.controller;
import cn.quantgroup.report.response.GlobalResponse;
import cn.quantgroup.report.service.manualTool.ManualToolService;
import cn.quantgroup.report.service.renhang.UserOcrService;
import com.google.common.collect.ImmutableMap;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -18,6 +20,9 @@ public class ManualToolController {
@Autowired
private ManualToolService manualToolService;
@Autowired
private UserOcrService userOcrService;
......@@ -68,4 +73,30 @@ public class ManualToolController {
}
@RequestMapping("/synGrowingUser")
public String synGrowingUser(String startnyr, String endnyr) {
userOcrService.synGrowingUserOcr(startnyr, endnyr);
return "synGrowingUser方法调度成功";
}
@RequestMapping("/synUserOcrByUuids")
public String synUserOcrByUuids(String uuids) {
if (StringUtils.isEmpty(uuids)) {
return "参数为空";
}
userOcrService.synUserOcrByUuids(uuids);
return "synUserOcrByUuids方法调度成功";
}
@RequestMapping("/synValidDateEndUserOcr")
public String synValidDateEndUserOcr() {
userOcrService.synValidDateEndUserOcr();
return "synValidDateEndUserOcr方法调度成功";
}
}
package cn.quantgroup.report.domain.renhang;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
import org.apache.commons.net.ntp.TimeStamp;
import java.io.Serializable;
import java.util.Date;
@Builder
@Data
......@@ -27,8 +29,10 @@ public class User implements Serializable{
private Integer enable; //'是否可用'
private TimeStamp createdAt;
//@JsonIgnore
private Date createdAt;
private TimeStamp updatedAt;
//@JsonIgnore
private Date updatedAt;
}
package cn.quantgroup.report.domain.xyqbuser;
import lombok.Data;
import java.util.Date;
@Data
public class User {
private Long id;
private String phoneNo;
private String uuid;
private Date createdAt;
}
\ No newline at end of file
package cn.quantgroup.report.domain.xyqbuser;
import lombok.Data;
import java.util.Date;
@Data
public class UserDetail {
private Long id;
private Long userId;
private String phoneNo;
private String name;
private String idNo;
private Integer idType;
private Boolean isAuthenticated;
private Integer gender;
private String email;
private String qq;
private Date createdAt;
private Date updatedAt;
}
\ No newline at end of file
......@@ -13,4 +13,5 @@ public interface UserMapper {
//查询日增用户,之前没有的
List<User> queryGrowingUser();
List<User> queryValidDateEndUserOcr(String todayNyr);
}
\ No newline at end of file
package cn.quantgroup.report.mapper.xyqbuser;
import cn.quantgroup.report.domain.xyqbuser.UserDetail;
import java.util.List;
public interface UserDetailMapper {
UserDetail selectByPrimaryKey(Long id);
UserDetail selectByUserId(Long userId);
List<UserDetail> selectByIdentityNumber(String identityNumber);
}
\ No newline at end of file
package cn.quantgroup.report.mapper.xyqbuser;
import cn.quantgroup.report.domain.xyqbuser.User;
public interface UserMapper {
User selectByPrimaryKey(Long id);
User selectByUuid(String uuid);
}
\ No newline at end of file
package cn.quantgroup.report.service.renhang;
import cn.quantgroup.report.domain.renhang.UserOcrVo;
import com.alibaba.fastjson.JSON;
import com.mysql.jdbc.PreparedStatement;
import cn.quantgroup.report.utils.RenHangHikDataSource;
import lombok.extern.slf4j.Slf4j;
import java.sql.*;
import java.util.List;
import static cn.quantgroup.report.utils.RenHangHikDataSource.HIK_DATA_SOURCE_RENHANG;
@Slf4j
public class RenHangBatchExecuteJdbc {
......@@ -31,62 +28,87 @@ public class RenHangBatchExecuteJdbc {
public static void batchInsertExecute(List<UserOcrVo> ocrInfoList){
String insert_sql = "INSERT INTO `user_ocr` (`uuid`, `address`, `birthday`, `citizen_id`, `gender`, `name`, `nation`, `agency`, `valid_date_begin`, `valid_date_end`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
int commit_count = 1000;
String insert_sql = "INSERT INTO `user_ocr` (`uuid`, `address`, `birthday`, `citizen_id`, `gender`, `name`, `nation`, `agency`, `valid_date_begin`, `valid_date_end`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
Connection conn = null;
java.sql.PreparedStatement ps = null;
try {
conn = HIK_DATA_SOURCE_RENHANG.dataSourceJdbc.getConnection();
conn = RenHangHikDataSource.INSTANCE.batchDataSourceJdbc.getConnection();
ps = conn.prepareStatement(insert_sql);
conn.setAutoCommit(false);
for (int i = 0; i < ocrInfoList.size(); i++) {
UserOcrVo bean = ocrInfoList.get(i);
ps.setString(1, bean.getUuid());
ps.setString(2, bean.getAddress());
ps.setString(3, bean.getBirthday());
ps.setString(4, bean.getCitizenId());
ps.setString(5, bean.getGender());
ps.setString(6, bean.getName());
ps.setString(7, bean.getNation());
ps.setString(8, bean.getAgency());
ps.setString(9, bean.getValidDateBegin());
ps.setString(10, bean.getValidDateEnd());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ps.setTimestamp(11, timestamp);
ps.setTimestamp(12, timestamp);
ps.addBatch();
try{
UserOcrVo bean = ocrInfoList.get(i);
ps.setString(1, bean.getUuid());
ps.setString(2, bean.getAddress());
ps.setString(3, bean.getBirthday());
ps.setString(4, bean.getCitizenId());
ps.setString(5, bean.getGender());
ps.setString(6, bean.getName());
ps.setString(7, bean.getNation());
ps.setString(8, bean.getAgency());
ps.setString(9, bean.getValidDateBegin());
ps.setString(10, bean.getValidDateEnd());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ps.setTimestamp(11, timestamp);
ps.setTimestamp(12, timestamp);
ps.addBatch();
if(i>0 && i%commit_count==0){
ps.executeBatch();
conn.commit();
//ps.clearBatch();
log.info("提交结束:"+ (i/commit_count + 1));
}
}catch (Exception e){
log.error("执行batchInsertExecute异常, SQL:{} , count: {} ", insert_sql, e);
}
}
ps.executeBatch();
conn.commit();
log.info("所有保存提交结束");
}catch(Exception e){
log.error("======执行batchInsertExecute异常======"+insert_sql+"\r\n",e);
e.printStackTrace();
log.error("执行batchInsertExecute异常, SQL:{} , count: last ", insert_sql, e);
}finally {
close(conn, ps,null);
}
}
public static void batchUpdateExecute(List<UserOcrVo> ocrInfoList){
String update_sql = "update user_ocr set valid_date_begin=?, valid_date_end=?, updated_at=? where uuid=?";
int commit_count = 1000;
String update_sql = "update user_ocr set valid_date_begin=?, valid_date_end=?, updated_at=? where uuid=? ";
Connection conn = null;
java.sql.PreparedStatement ps = null;
try {
conn = HIK_DATA_SOURCE_RENHANG.dataSourceJdbc.getConnection();
conn = RenHangHikDataSource.INSTANCE.batchDataSourceJdbc.getConnection();
ps = conn.prepareStatement(update_sql);
conn.setAutoCommit(false);
for (int i = 0; i < ocrInfoList.size(); i++) {
UserOcrVo bean = ocrInfoList.get(i);
ps.setString(1, bean.getValidDateBegin());
ps.setString(2, bean.getValidDateEnd());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ps.setTimestamp(3, timestamp);
ps.setString(4, bean.getUuid());
ps.addBatch();
try{
UserOcrVo bean = ocrInfoList.get(i);
ps.setString(1, bean.getValidDateBegin());
ps.setString(2, bean.getValidDateEnd());
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ps.setTimestamp(3, timestamp);
ps.setString(4, bean.getUuid());
ps.addBatch();
if(i>0 && i%commit_count==0){
ps.executeBatch();
conn.commit();
//ps.clearBatch();
log.info("提交结束:"+ (i/commit_count + 1));
}
}catch (Exception e){
log.error("执行batchUpdateExecute异常, SQL:{} , count: {} ", update_sql, e);
}
}
ps.executeBatch();
conn.commit();
}catch(Exception e){
log.error("======执行batchUpdateExecute异常======"+update_sql+"\r\n",e);
e.printStackTrace();
log.error("执行batchUpdateExecute异常, SQL:{} , count: last ", update_sql, e);
}finally {
close(conn, ps,null);
}
......
package cn.quantgroup.report.service.usersdk;
import cn.quantgroup.report.domain.sdk.SdkUser;
import cn.quantgroup.report.domain.xyqbuser.User;
import cn.quantgroup.report.domain.xyqbuser.UserDetail;
public interface IUserCenterService {
......@@ -19,14 +17,7 @@ public interface IUserCenterService {
*/
public SdkUser getSdkUserByUuid(String uuid);
public User getSdkUserByUserId(String userId);
public UserDetail getSdkUserDetailByUserId(Long userId);
public Long getUserIdByIdentityNumberAndName(String identityNumber, String name);
public Long getUserIdByIdentityNumber(String identityNumber);
public String getUuidByIdentityNumber(String identityNumber);
public String getUuidByPhoneNumber(String phoneNumber);
public SdkUser getUserFullInfoByUuid(String uuid);
......
package cn.quantgroup.report.service.usersdk.impl;
import cn.quantgroup.motan.bean.UserInfo;
import cn.quantgroup.motan.retbean.XUser;
import cn.quantgroup.motan.retbean.XUserDetail;
import cn.quantgroup.motan.retbean.XUserFullInfo;
import cn.quantgroup.motan.vo.UserSysResult;
import cn.quantgroup.report.cmpt.CommonAlarmCmpt;
import cn.quantgroup.report.domain.sdk.SdkUser;
import cn.quantgroup.report.domain.xyqbuser.User;
import cn.quantgroup.report.error.QGExceptionType;
import cn.quantgroup.report.error.QGPreconditions;
import cn.quantgroup.report.service.usersdk.IUserCenterService;
import cn.quantgroup.report.domain.xyqbuser.UserDetail;
import cn.quantgroup.report.service.http.IHttpService;
import cn.quantgroup.report.service.usersdk.IUserCenterService;
import cn.quantgroup.user.IUserSdkService;
import cn.quantgroup.user.UserSdkServiceFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.impl.client.CloseableHttpClient;
import org.slf4j.Logger;
......@@ -30,9 +23,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Service
public class UserCenterServiceImpl implements IUserCenterService {
......@@ -93,113 +83,6 @@ public class UserCenterServiceImpl implements IUserCenterService {
return null;
}
@Override
public User getSdkUserByUserId(String userId) {
try{
UserSysResult<XUser> userByUserId = userSdkService.findUserByUserId(Long.parseLong(userId));
User user = new User();
if(userByUserId.isSuccess()&&userByUserId.getData()!=null){
XUser data = userByUserId.getData();
BeanUtils.copyProperties(data, user);
return user;
}
}catch(Exception e){
LOGGER.error("查询用户用心异常,uuid: {} , {}",userId,e);
iMonitorAlarmService.alarm("WARN","用户中心查询异常告警","接口 : findUserByUserId(userId) , 异常信息:"+e.getMessage());
}
return null;
}
@Override
public UserDetail getSdkUserDetailByUserId(Long userId) {
try{
UserSysResult<XUserDetail> userDetailUserSysResult = userSdkService.findUserDetailByUserId(userId);
UserDetail userDetail = new UserDetail();
if(userDetailUserSysResult.isSuccess() && userDetailUserSysResult.getData()!=null){
XUserDetail xUserDetail = userDetailUserSysResult.getData();
BeanUtils.copyProperties(xUserDetail, userDetail);
return userDetail;
}
}catch(Exception e){
LOGGER.error("查询用户中心用户详情异常, userId: {} , {}", userId, e);
iMonitorAlarmService.alarm("WARN","用户中心查询异常告警","接口 : getSdkUserDetailByUserId(userId) , 异常信息:"+e.getMessage());
}
return null;
}
@Override
public Long getUserIdByIdentityNumberAndName(String identityNumber, String name) {
UserSysResult<List<XUserDetail>> userDetailBySpecification = userSdkService.queryUserDetailBySpecification(null, null, identityNumber);
LOGGER.info("getUserIdByIdentityNumberAndName, identityNumber: {} , name:{}, 结果:{}", identityNumber, name, JSON.toJSONString(userDetailBySpecification));
List<UserDetail> userDetails = new ArrayList<>();
if(userDetailBySpecification.isSuccess()&&userDetailBySpecification.getData()!=null){
List<XUserDetail> xUserDetails = userDetailBySpecification.getData();
xUserDetails.forEach(xUserDetail2 -> {
UserDetail userDetail = new UserDetail();
BeanUtils.copyProperties(xUserDetail2, userDetail);
userDetails.add(userDetail);
});
QGPreconditions.checkArgument(CollectionUtils.isNotEmpty(userDetails), QGExceptionType.XYQB_USER_NOT_EXSIT);
Optional<UserDetail> optional = userDetails.parallelStream().filter(detail -> StringUtils.equals(detail.getName(), name)).findFirst();
boolean isPresent = optional.isPresent();
QGPreconditions.checkArgument(isPresent, QGExceptionType.XYQB_USER_NOT_MATCH);
long userId = optional.get().getUserId();
return userId;
}
return null;
}
public Long getUserIdByIdentityNumber(String identityNumber) {
UserSysResult<List<XUserDetail>> userDetailBySpecification = userSdkService.queryUserDetailBySpecification(null, null, identityNumber);
LOGGER.info("getUserIdByIdentityNumber, identityNumber:{}, 结果:{}", identityNumber, JSON.toJSONString(userDetailBySpecification));
List<UserDetail> userDetails = new ArrayList<>();
if(userDetailBySpecification.isSuccess()&&userDetailBySpecification.getData()!=null){
List<XUserDetail> xUserDetails = userDetailBySpecification.getData();
xUserDetails.forEach(xUserDetail2 -> {
UserDetail userDetail = new UserDetail();
BeanUtils.copyProperties(xUserDetail2, userDetail);
userDetails.add(userDetail);
});
QGPreconditions.checkArgument(CollectionUtils.isNotEmpty(userDetails), QGExceptionType.XYQB_USER_NOT_EXSIT);
Optional<UserDetail> optional = userDetails.parallelStream().filter(detail -> (detail.getUserId() != null)).findFirst();
boolean isPresent = optional.isPresent();
QGPreconditions.checkArgument(isPresent, QGExceptionType.XYQB_USER_NOT_MATCH);
long userId = optional.get().getUserId();
return userId;
}
return null;
}
@Override
public String getUuidByIdentityNumber(String identityNumber) {
try {
UserSysResult<List<XUserDetail>> userDetailBySpecification = userSdkService.queryUserDetailBySpecification(null, null, identityNumber);
LOGGER.info("getUuidByIdentityNumber, identityNumber: {} , 结果:{}", identityNumber, JSON.toJSONString(userDetailBySpecification));
List<UserDetail> userDetails = new ArrayList<>();
if (userDetailBySpecification.isSuccess() && userDetailBySpecification.getData() != null) {
List<XUserDetail> xUserDetails = userDetailBySpecification.getData();
xUserDetails.forEach(xUserDetail2 -> {
UserDetail userDetail = new UserDetail();
BeanUtils.copyProperties(xUserDetail2, userDetail);
userDetails.add(userDetail);
});
QGPreconditions.checkArgument(CollectionUtils.isNotEmpty(userDetails), QGExceptionType.XYQB_USER_NOT_EXSIT);
Optional<UserDetail> optional = userDetails.parallelStream().filter(detail -> (detail.getUserId() != null)).findFirst();
boolean isPresent = optional.isPresent();
QGPreconditions.checkArgument(isPresent, QGExceptionType.XYQB_USER_NOT_MATCH);
long userId = optional.get().getUserId();
User user = getSdkUserByUserId(String.valueOf(userId));
if (user == null) {
LOGGER.info("查询用户用心,identityNumber: {} , user {}",identityNumber, user);
return null;
}
return user.getUuid();
}
}catch (Exception e){
LOGGER.error("查询用户用心异常,identityNumber: {} , {}",identityNumber,e);
}
return null;
}
@Override
public String getUuidByPhoneNumber(String phoneNumber) {
......
package cn.quantgroup.report.utils;
import cn.quantgroup.report.service.renhang.UserOcrService;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import javax.sql.DataSource;
@Slf4j
public enum RenHangHikDataSource {
HIK_DATA_SOURCE_RENHANG;
@Value("${db.renhang.rc_sync_guangda.fullurl}")
INSTANCE;
/* @Value("${db.renhang.rc_sync_guangda.fullurl}")
private String datasourceJdbcUrl;
@Value("${db.renhang.rc_sync_guangda.username}")
private String datasourceUsername;
@Value("${db.renhang.rc_sync_guangda.password}")
private String datasourcePassword;
private String datasourcePassword;*/
public DataSource dataSourceJdbc;
public DataSource batchDataSourceJdbc;
RenHangHikDataSource(){
if(dataSourceJdbc==null){
Logger log = LoggerFactory.getLogger(RenHangHikDataSource.class);
if(batchDataSourceJdbc==null){
HikariConfig config = new HikariConfig();
//"jdbc:mysql://fengkong-tidb.quantgroups.com:4010/risk_datasource?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true"
config.setJdbcUrl(datasourceJdbcUrl.substring(0, datasourceJdbcUrl.indexOf("?"))+"?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true");
config.setUsername(datasourceUsername);
config.setPassword(datasourcePassword);
config.setJdbcUrl("jdbc:mysql://172.30.220.4:3306/rc_sync_guangda?useUnicode=true&characterEncoding=UTF8&useSSL=false&rewriteBatchedStatements=true");
//config.setJdbcUrl(datasourceJdbcUrl.substring(0, datasourceJdbcUrl.indexOf("?"))+"?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true");
config.setUsername("rc_sync_guangda_w");
config.setPassword("KETqFdAj6b4vHX4z");
config.setDriverClassName("com.mysql.jdbc.Driver");
config.setMaximumPoolSize(10);
config.setMinimumIdle(5);
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
dataSourceJdbc = new HikariDataSource(config);
System.out.println("rc_sync_guangda创建数据库连接完毕");
batchDataSourceJdbc = new HikariDataSource(config);
log.info("rc_sync_guangda创建数据库连接完毕");
}
}
......
......@@ -6,7 +6,7 @@
<resultMap id="growingUserMap" type="cn.quantgroup.report.domain.renhang.User">
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
<result column="enable" jdbcType="INTEGER" property="enable"/>
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
</resultMap>
......@@ -17,4 +17,20 @@
where o.id is null;
</select>
<select id="findTargetRepaymentDayList" parameterType="java.lang.String" resultType="java.lang.String">
select date(DATE_SUB(deadline,INTERVAL 1 second)) from xyqb_i_repayment_plan where loan_application_history_id=#{reqID}
</select>
<select id="queryValidDateEndUserOcr" parameterType="java.lang.String" resultMap="growingUserMap">
select uo.uuid, '1' enable, uo.updated_at, uo.created_at from user_ocr uo
where LENGTH(uo.valid_date_end)=8
and DATE_FORMAT(uo.valid_date_end,'%Y%m%d') &lt; DATE_FORMAT(#{todayNyr},'%Y-%m-%d')
UNION
select uo.uuid, '1' enable, uo.updated_at, uo.created_at from user_ocr uo
where LENGTH(uo.valid_date_end)!=8
and uo.valid_date_end!='长期'
and uo.valid_date_end!='长期有效'
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quantgroup.report.mapper.xyqbuser.UserDetailMapper">
<resultMap id="BaseResultMap" type="cn.quantgroup.report.domain.xyqbuser.UserDetail">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="phone_no" jdbcType="VARCHAR" property="phoneNo"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="id_no" jdbcType="VARCHAR" property="idNo"/>
<result column="id_type" jdbcType="TINYINT" property="idType"/>
<result column="is_authenticated" jdbcType="BIT" property="isAuthenticated"/>
<result column="gender" jdbcType="TINYINT" property="gender"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="qq" jdbcType="VARCHAR" property="qq"/>
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt"/>
</resultMap>
<sql id="Base_Column_List">
id, user_id, phone_no, name, id_no, id_type, is_authenticated, gender, email, qq,
created_at, updated_at
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user_detail
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByUserId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user_detail
where user_id = #{userId,jdbcType=BIGINT}
</select>
<select id="selectByIdentityNumber" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user_detail
where id_no = #{identityNumber,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.quantgroup.report.mapper.xyqbuser.UserMapper">
<resultMap id="BaseResultMap" type="cn.quantgroup.report.domain.xyqbuser.User">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="phone_no" jdbcType="VARCHAR" property="phoneNo"/>
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt"/>
</resultMap>
<sql id="Base_Column_List">
id, phone_no, uuid,created_at
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectByUuid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user
where uuid = #{uuid,jdbcType=VARCHAR}
</select>
</mapper>
\ 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