|
@@ -16,11 +16,13 @@ import com.tianhu.common.log.enums.BusinessType;
|
|
|
import com.tianhu.common.redis.service.RedisService;
|
|
|
import com.tianhu.common.security.service.TokenService;
|
|
|
import com.tianhu.system.api.RemoteFileService;
|
|
|
+import com.tianhu.system.api.RemoteSystemService;
|
|
|
import com.tianhu.system.api.domain.PubFileInf;
|
|
|
import com.tianhu.system.api.domain.SysDept;
|
|
|
import com.tianhu.system.api.domain.SysRole;
|
|
|
import com.tianhu.system.api.domain.SysUser;
|
|
|
import com.tianhu.system.api.model.LoginUser;
|
|
|
+import com.tianhu.system.common.IMessageUtilsService;
|
|
|
import com.tianhu.system.companyAuth.service.IOwnAuthService;
|
|
|
import com.tianhu.system.domain.*;
|
|
|
import com.tianhu.system.mapper.SysProductMenuMapper;
|
|
@@ -99,6 +101,10 @@ public class OwnAuthController extends BaseController {
|
|
|
private ISysPermissionService permissionService;
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
+ @Autowired
|
|
|
+ private RemoteSystemService remoteSystemService;
|
|
|
+ @Autowired
|
|
|
+ private IMessageUtilsService messageUtilsService;
|
|
|
/**
|
|
|
* CFCA (是否开启生产环境配置 true 开启 false 关闭)
|
|
|
*/
|
|
@@ -171,6 +177,10 @@ public class OwnAuthController extends BaseController {
|
|
|
* 融资企业普通用户
|
|
|
*/
|
|
|
private String SUPPLIERORDINARY = "system.company.supplierOrdinary";
|
|
|
+ /**
|
|
|
+ * 用户注册成功
|
|
|
+ */
|
|
|
+ private String zhucechenggong = "zhucechenggong";
|
|
|
@Autowired
|
|
|
private FlowableService flowableService;
|
|
|
/**
|
|
@@ -185,7 +195,6 @@ public class OwnAuthController extends BaseController {
|
|
|
public R add(@RequestBody Map<String,Object> map) throws Exception {
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser use = userInfo.getSysUser();
|
|
|
-
|
|
|
//企业名称
|
|
|
String scyName = CommonUtil.objToString(map.get("scyName"));
|
|
|
if(CommonUtil.isEmpty(scyName)){
|
|
@@ -245,14 +254,14 @@ public class OwnAuthController extends BaseController {
|
|
|
if(CommonUtil.isEmpty(scyLegalId)){
|
|
|
return R.fail("法人证件号码不能为空");
|
|
|
}
|
|
|
- if(!RegularUtil.isPositive(scyLegalId)){
|
|
|
+ if(!RegularUtil.cardId(scyLegalId)){
|
|
|
throw new Exception("法人证件号码格式错误!");
|
|
|
}
|
|
|
//经办人姓名
|
|
|
String handler = null;
|
|
|
//是否法人亲办
|
|
|
if("1".equals(CommonUtil.objToString(map.get("legalHandle")))){
|
|
|
- handler = CommonUtil.objToString(map.get("handler"));
|
|
|
+ handler = CommonUtil.objToString(map.get("handler"));
|
|
|
if(CommonUtil.isEmpty(scyLegalId)){
|
|
|
return R.fail("经办人名称不能为空");
|
|
|
}
|
|
@@ -265,7 +274,7 @@ public class OwnAuthController extends BaseController {
|
|
|
if(CommonUtil.isEmpty(handlerCard)){
|
|
|
return R.fail("经办人身份证不能为空");
|
|
|
}
|
|
|
- if(!RegularUtil.isPositive(handlerCard)){
|
|
|
+ if(!RegularUtil.cardId(handlerCard)){
|
|
|
throw new Exception("法人证件号码格式错误!");
|
|
|
}
|
|
|
}
|
|
@@ -369,29 +378,29 @@ public class OwnAuthController extends BaseController {
|
|
|
//获取社会统一信用代码前两位
|
|
|
String scySocial = scySocialCode.substring(0, 2);
|
|
|
if("91".equals(scySocial)||"92".equals(scySocial)||"93".equals(scySocial)){
|
|
|
- //工商四要素
|
|
|
- JSONObject companyAuth = CfcaUtil.companyAuth(ISPRO, INSTITUTIONID, scyName, scySocialCode, scyLegal, IDENTIFICATIONTYPE, scyLegalId, zbiRemark);
|
|
|
+ //工商四要素
|
|
|
+ JSONObject companyAuth = CfcaUtil.companyAuth(ISPRO, INSTITUTIONID, scyName, scySocialCode, scyLegal, IDENTIFICATIONTYPE, scyLegalId, zbiRemark);
|
|
|
/*JSONObject companyAuth = new JSONObject();
|
|
|
companyAuth.put("Message", "SUCCESS");
|
|
|
companyAuth.put("Verification", "20");*/
|
|
|
- System.out.print("工商四要素结果==========>" + companyAuth);
|
|
|
- //状态(00:正常, 01:停用, 02:待四要素认证(认证中), 03:待对公户认证(认证中), 04:待实名审核(认证中), 99:删除)
|
|
|
- SysCompany.setScyStatus("03");
|
|
|
- //四要素认证状态(00:未认证, 01:认证通过, 02:认证未通过, 03:人工审批通过, 04:人工审批不通过)
|
|
|
- if("SUCCESS".equals(operatorAuth.getString("Message"))){
|
|
|
- if(!"20".equals(operatorAuth.getString("Verification"))){
|
|
|
- SysCompany.setScyAuthStatus("02");
|
|
|
- }else{
|
|
|
- SysCompany.setScyAuthStatus("01");
|
|
|
- };
|
|
|
- }else{
|
|
|
+ System.out.print("工商四要素结果==========>" + companyAuth);
|
|
|
+ //状态(00:正常, 01:停用, 02:待四要素认证(认证中), 03:待对公户认证(认证中), 04:待实名审核(认证中), 99:删除)
|
|
|
+ SysCompany.setScyStatus("03");
|
|
|
+ //四要素认证状态(00:未认证, 01:认证通过, 02:认证未通过, 03:人工审批通过, 04:人工审批不通过)
|
|
|
+ if("SUCCESS".equals(operatorAuth.getString("Message"))){
|
|
|
+ if(!"20".equals(operatorAuth.getString("Verification"))){
|
|
|
SysCompany.setScyAuthStatus("02");
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ SysCompany.setScyAuthStatus("01");
|
|
|
+ };
|
|
|
+ }else{
|
|
|
+ SysCompany.setScyAuthStatus("02");
|
|
|
+ }
|
|
|
}else{
|
|
|
//企查查
|
|
|
JSONObject BasicDetailsByName = QccCommonUtil.getBasicDetailsByName(KEY,SECRETKEY,scySocialCode);
|
|
|
//
|
|
|
- String status =BasicDetailsByName.getString("Status");
|
|
|
+ String status =BasicDetailsByName.getString("Status");
|
|
|
if("200".equals(status)){
|
|
|
String name =BasicDetailsByName.getJSONObject("Result").getString("Name");
|
|
|
if(!scyName.equals(name)){
|
|
@@ -410,9 +419,9 @@ public class OwnAuthController extends BaseController {
|
|
|
} else {
|
|
|
sysCompanyService.updateSysCompany(SysCompany);
|
|
|
}
|
|
|
- SysCompany companyServices = sysCompanyService.getById(scyId);
|
|
|
+ SysCompany companyServices = sysCompanyService.getById(scyId);
|
|
|
if("01".equals(companyServices.getScyType())&&(CommonUtil.isEmpty(operator)||CommonUtil.isEmpty(number))){
|
|
|
- throw new Exception("核心企业请填写其他管理员!");
|
|
|
+ throw new Exception("核心企业需填写业务操作员信息!");
|
|
|
}
|
|
|
//部门id
|
|
|
SysDept dept = new SysDept();
|
|
@@ -423,7 +432,7 @@ public class OwnAuthController extends BaseController {
|
|
|
dept.setDeptName(scyName);
|
|
|
dept.setDeptId(deptList.get(0).getDeptId());
|
|
|
deptService.updateDept(dept);
|
|
|
- // 创建部门
|
|
|
+ // 创建部门
|
|
|
} else {
|
|
|
String alternateNumber = IdUtils.fastSimpleUUID();
|
|
|
dept.setAlternateNumber(alternateNumber);
|
|
@@ -489,7 +498,7 @@ public class OwnAuthController extends BaseController {
|
|
|
sysUserCompanyRel.setSucrCardBackFile(jsfzfList.get(0).get("uid"));
|
|
|
}
|
|
|
sysUserCompanyRelService.saveOrUpdate(sysUserCompanyRel);
|
|
|
- // 经办人与登录用户不是同一手机号
|
|
|
+ // 经办人与登录用户不是同一手机号
|
|
|
} else {
|
|
|
// 经办人手机号是否存在
|
|
|
handlerUser = userService.selectUserByUserName(phoneNumber);
|
|
@@ -507,7 +516,10 @@ public class OwnAuthController extends BaseController {
|
|
|
sysUser.setCreateBy(use.getUserId()+"");
|
|
|
sysUser.setRoleIds(roleIds);
|
|
|
userService.insertUser(sysUser);
|
|
|
-
|
|
|
+ //发送注册成功短信
|
|
|
+ Map passwordMap =new HashMap();
|
|
|
+ passwordMap.put("password",password);
|
|
|
+ messageUtilsService.sendMessageCode(phoneNumber,zhucechenggong,passwordMap,null);
|
|
|
handlerUser = userService.selectUserByUserName(phoneNumber);
|
|
|
//创建经办人与企业关系
|
|
|
SysUserCompanyRel sysUserCompanyRel = new SysUserCompanyRel();
|
|
@@ -525,7 +537,7 @@ public class OwnAuthController extends BaseController {
|
|
|
sysUserCompanyRel.setSucrCardBackFile(jsfzfList.get(0).get("uid"));
|
|
|
}
|
|
|
sysUserCompanyRelService.saveOrUpdate(sysUserCompanyRel);
|
|
|
- // 经办人不存在
|
|
|
+ // 经办人不存在
|
|
|
} else {
|
|
|
// TODO多公司用户名字存在不一样问题
|
|
|
OwnSysUser sysUser = new OwnSysUser();
|
|
@@ -581,6 +593,10 @@ public class OwnAuthController extends BaseController {
|
|
|
user.setCreateBy(use.getUserId() + "");
|
|
|
user.setRoleIds(roleIds);
|
|
|
userService.insertUser(user);
|
|
|
+ //发送注册成功短信
|
|
|
+ Map passwordMap =new HashMap();
|
|
|
+ passwordMap.put("password",password);
|
|
|
+ messageUtilsService.sendMessageCode(phoneNumber,zhucechenggong,passwordMap,null);
|
|
|
operatorUser = userService.selectUserByUserName(number);
|
|
|
}else{
|
|
|
operatorUser.setRoleIds(roleIds);
|
|
@@ -640,14 +656,23 @@ public class OwnAuthController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/getlicense")
|
|
|
- public R getlicense(MultipartFile file) {
|
|
|
- //获取企业信息
|
|
|
- SysCompany sysCompany = ownAuthService.businessLicense(file);
|
|
|
+ public R getlicense(MultipartFile file) throws Exception {
|
|
|
+ SysCompany sysCompany = null;
|
|
|
//获取上传文件token
|
|
|
+ try{
|
|
|
+ //获取企业信息
|
|
|
+ sysCompany = ownAuthService.businessLicense(file);
|
|
|
+ }catch (Exception e) {
|
|
|
+ throw new Exception("识别失败,请重新上传!");
|
|
|
+ }
|
|
|
String token = SecurityUtils.getToken(ServletUtils.getRequest());
|
|
|
- //文件传输
|
|
|
- R<PubFileInf> fileResult = remoteFileService.uploadFile(file,"01","04","00", "", token);
|
|
|
- sysCompany.setScyLicenseFile(fileResult.getData().getPfiFileId());
|
|
|
+ try{
|
|
|
+ //文件传输
|
|
|
+ R<PubFileInf> fileResult = remoteFileService.uploadFile(file,"01","04","00", "", token);
|
|
|
+ sysCompany.setScyLicenseFile(fileResult.getData().getPfiFileId());
|
|
|
+ }catch (Exception e) {
|
|
|
+ throw new Exception("文件传输失败!");
|
|
|
+ }
|
|
|
//返回营业执照信息
|
|
|
System.out.print("ocr识别==========>" + sysCompany);
|
|
|
return R.ok(sysCompany);
|
|
@@ -659,18 +684,27 @@ public class OwnAuthController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/getCardPositive")
|
|
|
- public R getCardPositive(MultipartFile file,String fileType) {
|
|
|
+ public R getCardPositive(MultipartFile file,String fileType) throws Exception {
|
|
|
+ Map map =null;
|
|
|
//获取企业信息
|
|
|
- Map map = ownAuthService.getCardPositive(file,fileType);
|
|
|
- //获取上传文件token
|
|
|
- String token = SecurityUtils.getToken(ServletUtils.getRequest());
|
|
|
- //文件传输
|
|
|
- R<PubFileInf> fileResult = remoteFileService.uploadFile(file,"01","04","00", "", token);
|
|
|
- if("00".equals(fileType)){
|
|
|
- map.put("fsfzzList",fileResult.getData().getPfiFileId());
|
|
|
- }else{
|
|
|
- map.put("jsfzzList",fileResult.getData().getPfiFileId());
|
|
|
+ try{
|
|
|
+ map = ownAuthService.getCardPositive(file,fileType);
|
|
|
+ }catch (Exception e) {
|
|
|
+ throw new Exception("识别失败,请重新上传!");
|
|
|
}
|
|
|
+ //获取上传文件token
|
|
|
+ String token = SecurityUtils.getToken(ServletUtils.getRequest());
|
|
|
+ //文件传输
|
|
|
+ try{
|
|
|
+ R<PubFileInf> fileResult = remoteFileService.uploadFile(file,"01","04","00", "", token);
|
|
|
+ if("00".equals(fileType)){
|
|
|
+ map.put("fsfzzList",fileResult.getData().getPfiFileId());
|
|
|
+ }else{
|
|
|
+ map.put("jsfzzList",fileResult.getData().getPfiFileId());
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ throw new Exception("文件传输失败!");
|
|
|
+ }
|
|
|
//返回发票信息
|
|
|
return R.ok(map);
|
|
|
}
|
|
@@ -730,7 +764,7 @@ public class OwnAuthController extends BaseController {
|
|
|
if(formatter.format(calendar.getTime()).compareTo(formatter.format(bankAcc.get(0).getPbaiCfcaDate()))<0){
|
|
|
throw new BaseException("当前账户已存在");
|
|
|
}
|
|
|
- }else{
|
|
|
+ }else{
|
|
|
//企业打款申请
|
|
|
JSONObject operatorAuth = CfcaUtil.paymentApply(ISPRO, INSTITUTIONID, pbaiAccountName, pbaiBankaccountId,pbaiBankName,zbiRemark);
|
|
|
/*JSONObject operatorAuth = new JSONObject();
|
|
@@ -798,8 +832,8 @@ public class OwnAuthController extends BaseController {
|
|
|
if(!RegularUtil.isPositive(amount)){
|
|
|
throw new Exception("请输入正确的金额!");
|
|
|
}
|
|
|
- if(1.00<Double.valueOf(amount)){
|
|
|
- throw new Exception("校验金额不能大于一元!");
|
|
|
+ if(1.00<=Double.valueOf(amount)){
|
|
|
+ throw new Exception("校验金额不能大于等于一元!");
|
|
|
}
|
|
|
String[] strs = amount.split("\\.");
|
|
|
System.out.println("strs"+strs);
|
|
@@ -924,18 +958,16 @@ public class OwnAuthController extends BaseController {
|
|
|
if(CommonUtil.isNotEmpty(handler)) {
|
|
|
try {
|
|
|
companyAccount = AxqCommonUtil.companyAccount(scyName, IDENTTYPECODE, scySocialCode, phoneNumber, scyPhone, AUTHENTICATIONMODE, handler, TYPECODE, handlerCard,new HttpConnector(jksPath,keyStorePassword,channel,platId));
|
|
|
- }catch (Exception e) {
|
|
|
- System.out.println("开户失败===》"+e);
|
|
|
+ }catch (Exception e) {
|
|
|
throw new Exception("开户失败!");
|
|
|
- }
|
|
|
+ }
|
|
|
}else{
|
|
|
try {
|
|
|
companyAccount = AxqCommonUtil.companyAccount(scyName, IDENTTYPECODE, scySocialCode, phoneNumber, scyPhone, AUTHENTICATIONMODE, scyLegal, TYPECODE, scyLegalId,new HttpConnector(jksPath,keyStorePassword,channel,platId));
|
|
|
}catch (Exception e) {
|
|
|
- System.out.println("开户失败===》"+e);
|
|
|
throw new Exception("开户失败!");
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
System.out.print("开户结果==========>" + companyAccount);
|
|
|
//返回cfca用户id
|
|
|
String userId = companyAccount.getJSONObject("enterprise").getString("userId");
|
|
@@ -952,7 +984,7 @@ public class OwnAuthController extends BaseController {
|
|
|
String managementProductId = null;
|
|
|
//判断是核心企业还是供应商
|
|
|
if("01".equals(pany.get(0).getScyType())){
|
|
|
- managementProductId = configService.selectConfigByKey("system.company.core");
|
|
|
+ managementProductId = configService.selectConfigByKey("system.company.core");
|
|
|
}else{
|
|
|
managementProductId = configService.selectConfigByKey("system.company.supplier");
|
|
|
}
|
|
@@ -1020,6 +1052,21 @@ public class OwnAuthController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
//TODO 加消息通知
|
|
|
+ //获取经办人id
|
|
|
+ LambdaQueryWrapper<SysUserCompanyRel> companyRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,scyId);
|
|
|
+ companyRelLambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
|
|
|
+ List<SysUserCompanyRel> sysUserCompanyRel = sysUserCompanyRelService.findSysUserCompanyRels(companyRelLambdaQueryWrapper);
|
|
|
+ if(sysUserCompanyRel.size()==0){
|
|
|
+ throw new Exception("获取经办人失败,请联系管理员!");
|
|
|
+ }
|
|
|
+ //待办标题
|
|
|
+ String tittle = "【" +scyName+"】尊敬的用户,您好! 欢迎您来到招采云链医疗供应链金融平台,平台将提供:" +
|
|
|
+ "医疗招商、医疗集采、供应链金融等企业级服务,如果您再平台使用中遇到任何问题," +
|
|
|
+ "请再首页查看并拨打平台客服专线电话,我们将竭尽所能为您提供免费的咨询服务";
|
|
|
+ List<Long> users= new ArrayList<>();
|
|
|
+ users.add(Long.valueOf(sysUserCompanyRel.get(0).getSucrUserId()));
|
|
|
+ remoteSystemService.sendNotice(scyId,scyId,tittle,"01","00",null,"0",users,null);
|
|
|
// 刷新登录用户菜单和权限
|
|
|
SysUser sysUser = loginUser.getSysUser();
|
|
|
sysUser.setCompanyId(scyId);
|