|
@@ -1,5 +1,6 @@
|
|
|
package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.lang.UUID;
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
@@ -14,10 +15,13 @@ import com.yh.saas.plugin.yiliangyiyun.exception.*;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.util.MD5Util;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.sqlite.util.StringUtils;
|
|
|
|
|
|
+import java.sql.*;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -32,6 +36,16 @@ import java.util.List;
|
|
|
public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityAuthenticationInfoMapper, IdentityAuthenticationInfo> implements IIdentityAuthenticationInfoService {
|
|
|
@Autowired
|
|
|
private ICommonBillOperateHisService billOperateHisService;
|
|
|
+ @Value("com.mysql.jdbc.Driver")
|
|
|
+ private String driverClassName;
|
|
|
+ @Value("jdbc:mysql://47.100.3.209:3306/talk-portal?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true")
|
|
|
+ private String url;
|
|
|
+ @Value("root")
|
|
|
+ private String username;
|
|
|
+ @Value("Ccj841968545")
|
|
|
+ private String password;
|
|
|
+
|
|
|
+ Connection coon=null;
|
|
|
/**
|
|
|
* 粮商认证列表
|
|
|
* @param identityAuthenticationInfo
|
|
@@ -103,6 +117,15 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
|
}
|
|
|
// 操作主表数据
|
|
|
this.insert(identityAuthenticationInfo);
|
|
|
+ //将粮信用户表的粮商字段更新为1
|
|
|
+ if(identityAuthenticationInfo.getCustomerPhone() != null){
|
|
|
+ DBConnection();
|
|
|
+ String sUserId = excSelect("select * from s_user s where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
|
|
|
+ if( sUserId != null && !sUserId.isEmpty()){
|
|
|
+ excUpdate("update s_user s set s.trader_flag = 1 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
|
|
|
+ }
|
|
|
+ close();
|
|
|
+ }
|
|
|
return identityAuthenticationInfo.getId();
|
|
|
}
|
|
|
|
|
@@ -172,5 +195,57 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
|
}
|
|
|
return identityAuthenticationInfo;
|
|
|
}
|
|
|
+ public void DBConnection(){
|
|
|
+ try{
|
|
|
+ //加载驱动程序
|
|
|
+ Class.forName(driverClassName);
|
|
|
+ coon=(Connection) DriverManager.getConnection(url,username,password);
|
|
|
+ if(!coon.isClosed()){
|
|
|
+ System.out.println("成功连接数据库!");
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void close(){
|
|
|
+ try{
|
|
|
+ this.coon.close();
|
|
|
+ System.out.println("成功关闭数据库连接!");
|
|
|
+ }catch(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ System.out.println("关闭数据库连接异常!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询s_user表
|
|
|
+ public String excSelect(String sql,Connection coon){
|
|
|
+ try{
|
|
|
+ Statement stmt=(Statement)coon.createStatement();
|
|
|
+ ResultSet rs=(ResultSet)stmt.executeQuery(sql);//得到的是结果的集合
|
|
|
+
|
|
|
+ while(rs.next()){
|
|
|
+ String id=rs.getString("id");
|
|
|
+ if(id != null && !id.isEmpty()){
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ stmt.close();
|
|
|
+ return null;
|
|
|
+ }catch(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更改数据
|
|
|
+ public void excUpdate(String sql,Connection coon){
|
|
|
+ try{
|
|
|
+ PreparedStatement prestmt=(PreparedStatement)coon.prepareStatement(sql);
|
|
|
+ prestmt.executeUpdate();
|
|
|
+ System.out.println("更改数据成功!");
|
|
|
+ prestmt.close();
|
|
|
+ }catch(Exception e){
|
|
|
+ System.out.println("粮信更改数据异常!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|