|
|
@@ -11,6 +11,7 @@ import com.tianhu.common.core.domain.R;
|
|
|
import com.tianhu.common.core.exception.BaseException;
|
|
|
import com.tianhu.common.core.utils.*;
|
|
|
import com.tianhu.common.core.web.controller.BaseController;
|
|
|
+import com.tianhu.common.core.web.domain.AjaxResult;
|
|
|
import com.tianhu.common.log.annotation.Log;
|
|
|
import com.tianhu.common.log.enums.BusinessType;
|
|
|
import com.tianhu.common.redis.service.RedisService;
|
|
|
@@ -24,6 +25,7 @@ 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.controller.OwnSysUserController;
|
|
|
import com.tianhu.system.domain.*;
|
|
|
import com.tianhu.system.mapper.SysProductMenuMapper;
|
|
|
import com.tianhu.system.mapper.SysRoleMapper;
|
|
|
@@ -45,7 +47,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -189,6 +194,11 @@ public class OwnAuthController extends BaseController {
|
|
|
private String zhucechenggong = "zhucechenggong";
|
|
|
|
|
|
/**
|
|
|
+ * 默认的文件名最大长度 70
|
|
|
+ */
|
|
|
+ public static final int DEFAULT_FILE_NAME_LENGTH = 60;
|
|
|
+
|
|
|
+ /**
|
|
|
* 新增企业认证
|
|
|
*
|
|
|
* @param map 企业信息
|
|
|
@@ -695,7 +705,6 @@ public class OwnAuthController extends BaseController {
|
|
|
sysUserCompanyRelService.createSysUserCompanyRel(sysUserCompanyRel);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//创建其他和管理员
|
|
|
SysUser operatorUser = null;
|
|
|
|
|
|
@@ -746,38 +755,41 @@ public class OwnAuthController extends BaseController {
|
|
|
redisService.setCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token, userInfo, Constants.TOKEN_EXPIRE * 60, TimeUnit.SECONDS);
|
|
|
//返回企业信息
|
|
|
SysCompany company = sysCompanyService.getById(scyId);
|
|
|
- // 审批增加分组
|
|
|
- Map<String, Object> flowableRes = flowableService.addFlowableGroup(scyId, company.getScyName());
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- flowableRes = flowableService.addFlowableGroup(deptList.get(0).getAlternateNumber(), dept.getDeptName());
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- // 经办人与登录用户是同一手机号
|
|
|
- if (use.getUserName().equals(phoneNumber)) {
|
|
|
- flowableRes = flowableService.addFlowableUser(String.valueOf(use.getUserId()), use.getNickName(), scyId);
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- } else {
|
|
|
- flowableRes = flowableService.addFlowableUser(String.valueOf(use.getUserId()), use.getNickName(), scyId);
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- flowableRes = flowableService.addFlowableUser(String.valueOf(handlerUser.getUserId()), handlerUser.getNickName(), scyId);
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- }
|
|
|
- // 业务人员不存在
|
|
|
- if (operatorUser != null) {
|
|
|
- flowableRes = flowableService.addFlowableUser(String.valueOf(operatorUser.getUserId()), operatorUser.getNickName(), scyId);
|
|
|
- if (!"200".equals(flowableRes.get("code"))) {
|
|
|
- throw new Exception("审批数据新增失败!");
|
|
|
- }
|
|
|
- }
|
|
|
+ String tittle = "【企业认证】"+scyName+"CFCA工商四要素认证失败,请联系用户"+phoneNumber+"线下核实企业信息;";
|
|
|
+ ownNoticeService.sendNotice(scyId,scyId,tittle,"00",null,"09","0","1",null, null, null);
|
|
|
+
|
|
|
+// // 审批增加分组
|
|
|
+// Map<String, Object> flowableRes = flowableService.addFlowableGroup(scyId, company.getScyName());
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// flowableRes = flowableService.addFlowableGroup(deptList.get(0).getAlternateNumber(), dept.getDeptName());
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// // 经办人与登录用户是同一手机号
|
|
|
+// if (use.getUserName().equals(phoneNumber)) {
|
|
|
+// flowableRes = flowableService.addFlowableUser(String.valueOf(use.getUserId()), use.getNickName(), scyId);
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// flowableRes = flowableService.addFlowableUser(String.valueOf(use.getUserId()), use.getNickName(), scyId);
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// flowableRes = flowableService.addFlowableUser(String.valueOf(handlerUser.getUserId()), handlerUser.getNickName(), scyId);
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 业务人员不存在
|
|
|
+// if (operatorUser != null) {
|
|
|
+// flowableRes = flowableService.addFlowableUser(String.valueOf(operatorUser.getUserId()), operatorUser.getNickName(), scyId);
|
|
|
+// if (!"200".equals(flowableRes.get("code"))) {
|
|
|
+// throw new Exception("审批数据新增失败!");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
return R.ok(company);
|
|
|
}
|
|
|
@@ -790,6 +802,9 @@ public class OwnAuthController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/getlicense")
|
|
|
public R getlicense(MultipartFile file) throws Exception {
|
|
|
+ if(file.getOriginalFilename().length()>DEFAULT_FILE_NAME_LENGTH){
|
|
|
+ throw new Exception("文件名称太长,建议长度小于"+DEFAULT_FILE_NAME_LENGTH);
|
|
|
+ }
|
|
|
SysCompany sysCompany = null;
|
|
|
//获取上传文件token
|
|
|
try{
|
|
|
@@ -824,6 +839,9 @@ public class OwnAuthController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/getCardPositive")
|
|
|
public R getCardPositive(MultipartFile file,String fileType) throws Exception {
|
|
|
+ if(file.getOriginalFilename().length()>DEFAULT_FILE_NAME_LENGTH){
|
|
|
+ throw new Exception("文件名称太长,建议长度小于"+DEFAULT_FILE_NAME_LENGTH);
|
|
|
+ }
|
|
|
Map map =null;
|
|
|
//获取企业信息
|
|
|
try{
|
|
|
@@ -892,47 +910,6 @@ public class OwnAuthController extends BaseController {
|
|
|
bank.eq(PayBankAccInf::getPbaiAccountName,pbaiAccountName);
|
|
|
bank.eq(PayBankAccInf::getPbaiBankaccountId,pbaiBankaccountId);
|
|
|
List<PayBankAccInf> bankAcc = payBankAccInfService.findPayBankAccInfs(bank);
|
|
|
-
|
|
|
- if(bankAcc.size()>0){
|
|
|
- //取得指定时间间隔后的系统时间
|
|
|
- GregorianCalendar calendar = (GregorianCalendar) Calendar.getInstance();
|
|
|
- calendar.add( Calendar.DAY_OF_MONTH, 3);
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
- System.out.println("比较时间"+formatter.format(calendar.getTime()));
|
|
|
- System.out.println("最后时间"+formatter.format(bankAcc.get(0).getPbaiCfcaDate()));
|
|
|
- if(formatter.format(calendar.getTime()).compareTo(formatter.format(bankAcc.get(0).getPbaiCfcaDate()))<0){
|
|
|
- throw new BaseException("当前账户已存在");
|
|
|
- }else{
|
|
|
- //企业打款申请
|
|
|
- JSONObject operatorAuth = CfcaUtil.paymentApply(ISPRO, INSTITUTIONID, pbaiAccountName, pbaiBankaccountId,list.get(0).getZcbiBankNo(),zbiRemark);
|
|
|
- /*JSONObject operatorAuth = new JSONObject();
|
|
|
- operatorAuth.put("Message", "SUCCESS");
|
|
|
- operatorAuth.put("Status", "20");
|
|
|
- operatorAuth.put("TxSN", "100000001");*/
|
|
|
- System.out.print("绑定对公户返回结果==========>" + operatorAuth);
|
|
|
- String TxSN = operatorAuth.getString("TxSN");
|
|
|
- if("SUCCESS".equals(operatorAuth.getString("Message"))){
|
|
|
- if(!"20".equals(operatorAuth.getString("Status"))){
|
|
|
- return R.fail("绑定账户失败");
|
|
|
- };
|
|
|
- }else{
|
|
|
- return R.fail("绑定账户失败");
|
|
|
- }
|
|
|
- PayBankAccInf payBankAccInf = new PayBankAccInf();
|
|
|
- String pbiId = IdUtils.fastSimpleUUID();
|
|
|
- payBankAccInf.setPbaiId(pbiId);
|
|
|
- payBankAccInf.setPbaiCstno(scyId);
|
|
|
- payBankAccInf.setPbaiAccountName(pbaiAccountName);
|
|
|
- payBankAccInf.setPbaiBankaccountId(pbaiBankaccountId);
|
|
|
- payBankAccInf.setPbaiBankName(list.get(0).getZcbiBankName());
|
|
|
- payBankAccInf.setPbaiStatus("1");
|
|
|
- payBankAccInf.setPbaiCfcaNo(TxSN);
|
|
|
- //获取当前时间
|
|
|
- Date currentTime = DateUtils.getNowDate();
|
|
|
- payBankAccInf.setPbaiCfcaDate(currentTime);
|
|
|
- payBankAccInfService.createPayBankAccInf(payBankAccInf);
|
|
|
- }
|
|
|
- }else{
|
|
|
//企业打款申请
|
|
|
JSONObject operatorAuth = CfcaUtil.paymentApply(ISPRO, INSTITUTIONID, pbaiAccountName, pbaiBankaccountId,list.get(0).getZcbiBankNo(),zbiRemark);
|
|
|
/*JSONObject operatorAuth = new JSONObject();
|
|
|
@@ -956,6 +933,7 @@ public class OwnAuthController extends BaseController {
|
|
|
payBankAccInf.setPbaiBankaccountId(pbaiBankaccountId);
|
|
|
payBankAccInf.setPbaiBankName(list.get(0).getZcbiBankName());
|
|
|
payBankAccInf.setPbaiStatus("1");
|
|
|
+ payBankAccInf.setPbaiCfcaTime("0");
|
|
|
payBankAccInf.setPbaiCfcaNo(TxSN);
|
|
|
//获取当前时间
|
|
|
Date currentTime = DateUtils.getNowDate();
|
|
|
@@ -965,8 +943,9 @@ public class OwnAuthController extends BaseController {
|
|
|
sysCompany.setScyId(scyId);
|
|
|
//打款认证
|
|
|
sysCompany.setScyStatus("05");
|
|
|
+ //对公户打款次数
|
|
|
+ sysCompany.setScyCfcaAuthNumber(AmtUtil.add(bankAcc.get(0).getPbaiCfcaTime(),"1",0));
|
|
|
sysCompanyService.updateSysCompany(sysCompany);
|
|
|
- }
|
|
|
// 刷新登录用户菜单和权限
|
|
|
SysUser sysUser = user.getSysUser();
|
|
|
sysUser.setCompanyId(scyId);
|
|
|
@@ -986,27 +965,30 @@ public class OwnAuthController extends BaseController {
|
|
|
@PostMapping("/payment")
|
|
|
@Log(title = "打款验证", businessType = BusinessType.UPDATE)
|
|
|
public R payment(@RequestBody Map<String,Object> map,HttpServletRequest request) throws Exception {
|
|
|
- //获取登录用户
|
|
|
+ //获取登录用户/47.94.174.212:7001
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser users = userInfo.getSysUser();
|
|
|
- LambdaQueryWrapper<SysUserCompanyRel> userCompanyRel = new LambdaQueryWrapper<>();
|
|
|
- //用户名
|
|
|
- userCompanyRel.eq(SysUserCompanyRel::getSucrUserId,users.getUserId());
|
|
|
- List<SysUserCompanyRel> companyRel = sysUserCompanyRelService.findSysUserCompanyRels(userCompanyRel);
|
|
|
- if(companyRel.size()==0){
|
|
|
- return R.fail("企业未认证请联系管理员");
|
|
|
- }else if(CommonUtil.isEmpty(companyRel.get(0).getSucrCompanyId())){
|
|
|
- return R.fail("企业认证失败请联系管理员");
|
|
|
- }
|
|
|
+// LambdaQueryWrapper<SysUserCompanyRel> userCompanyRel = new LambdaQueryWrapper<>();
|
|
|
+// //用户名
|
|
|
+// userCompanyRel.eq(SysUserCompanyRel::getSucrUserId,users.getUserId());
|
|
|
+// List<SysUserCompanyRel> companyRel = sysUserCompanyRelService.findSysUserCompanyRels(userCompanyRel);
|
|
|
+// if(companyRel.size()==0){
|
|
|
+// return R.fail("企业未认证请联系管理员");
|
|
|
+// }else if(CommonUtil.isEmpty(companyRel.get(0).getSucrCompanyId())){
|
|
|
+// return R.fail("企业认证失败请联系管理员");
|
|
|
+// }
|
|
|
//查询账户
|
|
|
LambdaQueryWrapper<PayBankAccInf> bank = new LambdaQueryWrapper<>();
|
|
|
//所属银行
|
|
|
- bank.eq(PayBankAccInf::getPbaiCstno,companyRel.get(0).getSucrCompanyId());
|
|
|
+ bank.eq(PayBankAccInf::getPbaiCstno,users.getCompanyId());
|
|
|
bank.orderByDesc(PayBankAccInf::getPbaiCfcaDate);
|
|
|
List<PayBankAccInf> bankAcc = payBankAccInfService.findPayBankAccInfs(bank);
|
|
|
if(bankAcc.size()==0){
|
|
|
return R.fail("所属账号不存在");
|
|
|
}
|
|
|
+ if(Integer.valueOf(bankAcc.get(0).getPbaiCfcaTime())>=3){
|
|
|
+ throw new Exception("当前账户打款上限,请重新申请开户!");
|
|
|
+ }
|
|
|
//企业id
|
|
|
String scyId = CommonUtil.objToString(map.get("scyId"));
|
|
|
//金额(元)
|
|
|
@@ -1031,23 +1013,28 @@ public class OwnAuthController extends BaseController {
|
|
|
operatorAuth.put("Message", "SUCCESS");
|
|
|
operatorAuth.put("Verification", "20");*/
|
|
|
System.out.print("打款认证结果==========>" + operatorAuth);
|
|
|
+ PayBankAccInf payBankAccInf =new PayBankAccInf();
|
|
|
if (!"交易异常[已验证通过,不能重复验证]".equals(operatorAuth.getString("Message"))) {
|
|
|
//校验已通过
|
|
|
if ("SUCCESS".equals(operatorAuth.getString("Message"))) {
|
|
|
if (!"20".equals(operatorAuth.getString("Verification"))) {
|
|
|
+ payBankAccInf.setPbaiCfcaTime(AmtUtil.add(bankAcc.get(0).getPbaiCfcaTime(),"1",0));
|
|
|
+ payBankAccInfService.updatePayBankAccInf(payBankAccInf);
|
|
|
return R.fail("账户验证失败");
|
|
|
}
|
|
|
;
|
|
|
} else {
|
|
|
+ payBankAccInf.setPbaiCfcaTime(AmtUtil.add(bankAcc.get(0).getPbaiCfcaTime(),"1",0));
|
|
|
+ payBankAccInfService.updatePayBankAccInf(payBankAccInf);
|
|
|
return R.fail("账户验证失败");
|
|
|
}
|
|
|
}
|
|
|
- PayBankAccInf payBankAccInf =new PayBankAccInf();
|
|
|
payBankAccInf.setPbaiId(bankAcc.get(0).getPbaiId());
|
|
|
payBankAccInf.setPbaiStatus("0");
|
|
|
+ payBankAccInf.setPbaiCfcaTime(AmtUtil.add(bankAcc.get(0).getPbaiCfcaTime(),"1",0));
|
|
|
payBankAccInfService.updatePayBankAccInf(payBankAccInf);
|
|
|
SysCompany sysCompany =new SysCompany();
|
|
|
- sysCompany.setScyId(companyRel.get(0).getSucrCompanyId());
|
|
|
+ sysCompany.setScyId(users.getCompanyId());
|
|
|
//待实名认证
|
|
|
sysCompany.setScyStatus("04");
|
|
|
sysCompanyService.updateSysCompany(sysCompany);
|
|
|
@@ -1364,6 +1351,33 @@ public class OwnAuthController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 企业账户验证网联支持银行列表
|
|
|
+ */
|
|
|
+ @PostMapping("/bankList")
|
|
|
+ public void bankList(HttpServletResponse response) throws FileNotFoundException {
|
|
|
+ // 下载本地文件
|
|
|
+ String fileName = "Operator.doc".toString(); // 文件的默认保存名
|
|
|
+ // 读到流中
|
|
|
+ InputStream inStream = OwnSysUserController.class.getClassLoader().getResourceAsStream("企业账户验证网联支持银行列表.xlsx");
|
|
|
+
|
|
|
+ // 设置输出的格式
|
|
|
+ response.reset();
|
|
|
+ response.setContentType("bin");
|
|
|
+ response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
|
|
+ // 循环取出流中的数据
|
|
|
+ byte[] b = new byte[100];
|
|
|
+ int len;
|
|
|
+ try {
|
|
|
+ while ((len = inStream.read(b)) > 0) {
|
|
|
+ response.getOutputStream().write(b, 0, len);
|
|
|
+ }
|
|
|
+ inStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 查询银行
|
|
|
*
|
|
|
* @return
|