|
@@ -3,22 +3,31 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
|
|
import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonCompanyIdentity;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.InOutWarehouseTask;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.*;
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.*;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonCompanyIdentityMapper;
|
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonUserMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.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.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.sql.*;
|
|
import java.sql.*;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -32,16 +41,8 @@ import java.util.List;
|
|
public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityAuthenticationInfoMapper, IdentityAuthenticationInfo> implements IIdentityAuthenticationInfoService {
|
|
public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityAuthenticationInfoMapper, IdentityAuthenticationInfo> implements IIdentityAuthenticationInfoService {
|
|
@Autowired
|
|
@Autowired
|
|
private ICommonBillOperateHisService billOperateHisService;
|
|
private ICommonBillOperateHisService billOperateHisService;
|
|
- @Value("com.mysql.jdbc.Driver")
|
|
|
|
- private String driverClassName;
|
|
|
|
- @Value("jdbc:mysql://47.100.3.209:3306/talk-core?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;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommonCompanyIdentityMapper commonCompanyIdentityMapper;
|
|
/**
|
|
/**
|
|
* 粮商认证列表
|
|
* 粮商认证列表
|
|
* @param identityAuthenticationInfo
|
|
* @param identityAuthenticationInfo
|
|
@@ -108,26 +109,8 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
if ("3".equals(identityAuthenticationInfo.getCustomerTypeFlag())){
|
|
if ("3".equals(identityAuthenticationInfo.getCustomerTypeFlag())){
|
|
identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_COMPLETED.getName());
|
|
identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_COMPLETED.getName());
|
|
identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_COMPLETED.getFlag());
|
|
identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_COMPLETED.getFlag());
|
|
- //将粮信用户表的粮农字段更新为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.farmer_flag = 1 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
|
|
|
|
- }
|
|
|
|
- close();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- //将粮信用户表的粮商字段更新为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();
|
|
|
|
- }
|
|
|
|
identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
|
|
identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
|
|
}
|
|
}
|
|
@@ -145,7 +128,10 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
}
|
|
}
|
|
// 操作主表数据
|
|
// 操作主表数据
|
|
this.insert(identityAuthenticationInfo);
|
|
this.insert(identityAuthenticationInfo);
|
|
-
|
|
|
|
|
|
+ //如果是个人粮商且公司id不为空,则添加公司与个人粮商关系表
|
|
|
|
+ if("1".equals(identityAuthenticationInfo.getCustomerTypeFlag())&&identityAuthenticationInfo.getCompId() != null && !identityAuthenticationInfo.getCompId().isEmpty()){
|
|
|
|
+ this.saveCompanyIdentity(identityAuthenticationInfo);
|
|
|
|
+ }
|
|
return identityAuthenticationInfo.getId();
|
|
return identityAuthenticationInfo.getId();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -188,18 +174,6 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
if(identityAuthenticationInfo != null){
|
|
if(identityAuthenticationInfo != null){
|
|
//删除身份认证
|
|
//删除身份认证
|
|
this.deleteById(identityAuthenticationInfo.getId());
|
|
this.deleteById(identityAuthenticationInfo.getId());
|
|
- //粮农身份不需审核
|
|
|
|
- if ("3".equals(identityAuthenticationInfo.getCustomerTypeFlag())){
|
|
|
|
- //将粮信用户表的粮农字段更新为0
|
|
|
|
- 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.farmer_flag = 0 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
|
|
|
|
- }
|
|
|
|
- close();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -377,60 +351,61 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
return identityAuthenticationInfo1;
|
|
return identityAuthenticationInfo1;
|
|
}
|
|
}
|
|
|
|
|
|
- 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){
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<IdentityAuthenticationInfo> selectIdentityAuthenticationInfoPurchase(IdentityAuthenticationInfo identityAuthenticationInfo) {
|
|
try{
|
|
try{
|
|
- Statement stmt=(Statement)coon.createStatement();
|
|
|
|
- ResultSet rs=(ResultSet)stmt.executeQuery(sql);//得到的是结果的集合
|
|
|
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
|
+ pageView.put("startRecord", (identityAuthenticationInfo.getCurrentPage() - 1)
|
|
|
|
+ * identityAuthenticationInfo.getPageSize());
|
|
|
|
+ //公司id
|
|
|
|
+ pageView.put("compId", identityAuthenticationInfo.getCompId());
|
|
|
|
+ pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
|
|
|
|
+ pageView.put("pageSize", identityAuthenticationInfo.getPageSize());
|
|
|
|
+ pageView.put("currentPage", identityAuthenticationInfo.getCurrentPage());
|
|
|
|
|
|
- while(rs.next()){
|
|
|
|
- String id=rs.getString("id");
|
|
|
|
- if(id != null && !id.isEmpty()){
|
|
|
|
- return id;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- stmt.close();
|
|
|
|
- return null;
|
|
|
|
- }catch(Exception e){
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoByCondition(pageView);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Integer dataCount = this.baseMapper.getIdentityCountByCondition(pageView);
|
|
|
|
+
|
|
|
|
+ Page<IdentityAuthenticationInfo> page = new Page<>();
|
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
|
+ page.setCurrent(identityAuthenticationInfo.getCurrentPage());
|
|
|
|
+ page.setSize(identityAuthenticationInfo.getPageSize());
|
|
|
|
+ return page;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e){
|
|
|
|
+ System.out.println("查询异常:"+e.toString());
|
|
return null;
|
|
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();
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String saveCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo) {
|
|
|
|
+ CommonCompanyIdentity commonCompanyIdentity = new CommonCompanyIdentity();
|
|
|
|
+ commonCompanyIdentity.setIdentityId(identityAuthenticationInfo.getId());
|
|
|
|
+ commonCompanyIdentity.setComId(identityAuthenticationInfo.getCompId());
|
|
|
|
+
|
|
|
|
+ Integer one=this.commonCompanyIdentityMapper.insert(commonCompanyIdentity);
|
|
|
|
+ //成功返回ok
|
|
|
|
+ if (one>0 ) {
|
|
|
|
+ return "OK";
|
|
|
|
+ } else {
|
|
|
|
+ return "NG";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void deleteCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo) {
|
|
|
|
+ List<CommonCompanyIdentity> list = this.commonCompanyIdentityMapper.selectList(new EntityWrapper<CommonCompanyIdentity>()
|
|
|
|
+ .eq("com_id",identityAuthenticationInfo.getCompId()).eq("identity_id",identityAuthenticationInfo.getId()));
|
|
|
|
+ for(CommonCompanyIdentity commonCompanyIdentity : list){
|
|
|
|
+ this.commonCompanyIdentityMapper.deleteById(commonCompanyIdentity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|