|
@@ -6,6 +6,7 @@ import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.google.gson.JsonObject;
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysSocialDetails;
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysSocialDetails;
|
|
@@ -24,6 +25,7 @@ import com.qunzhixinxi.hnqz.admin.mapper.UserAgreementSignatureRecordMapper;
|
|
import com.qunzhixinxi.hnqz.admin.service.*;
|
|
import com.qunzhixinxi.hnqz.admin.service.*;
|
|
import com.qunzhixinxi.hnqz.admin.service.retry.PartyARetryService;
|
|
import com.qunzhixinxi.hnqz.admin.service.retry.PartyARetryService;
|
|
import com.qunzhixinxi.hnqz.common.core.constant.enums.LoginTypeEnum;
|
|
import com.qunzhixinxi.hnqz.common.core.constant.enums.LoginTypeEnum;
|
|
|
|
+import com.qunzhixinxi.hnqz.common.core.util.Base64Utils;
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
import com.qunzhixinxi.hnqz.common.security.annotation.Inner;
|
|
@@ -47,6 +49,7 @@ import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperECheckReque
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperEidTokenRequest;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperEidTokenRequest;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperGetUserAgreementRequest;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperGetUserAgreementRequest;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperUserAgreementAuthorizationRequest;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperUserAgreementAuthorizationRequest;
|
|
|
|
+import com.qunzhixinxi.hnqz.common.taxhelper.entity.request.TaxHelperUserAgreementAuthorizationRequestV2;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.response.TaxHelperResponse;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.response.TaxHelperResponse;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.vo.TaxHelperAddMemberVo;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.vo.TaxHelperAddMemberVo;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.vo.TaxHelperBingCardConfirmVo;
|
|
import com.qunzhixinxi.hnqz.common.taxhelper.entity.vo.TaxHelperBingCardConfirmVo;
|
|
@@ -68,6 +71,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.net.URI;
|
|
|
|
+import java.net.URISyntaxException;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -180,7 +185,7 @@ public class WmTaxHelperController {
|
|
|
|
|
|
// 已经增员的补偿逻辑
|
|
// 已经增员的补偿逻辑
|
|
String errorMsg = String.format(CommonConstants.ALREADY_ADD_MEMBER_SUCCESSFUL, dept.getTaxCode());
|
|
String errorMsg = String.format(CommonConstants.ALREADY_ADD_MEMBER_SUCCESSFUL, dept.getTaxCode());
|
|
- if (errorMsg.equals(response.getMessage())){
|
|
|
|
|
|
+ if (errorMsg.equals(response.getMessage())) {
|
|
log.info("税邦云历史增员成功:{},{},原因是:{}", user.getRealname(), user.getUsername(), response.getMessage());
|
|
log.info("税邦云历史增员成功:{},{},原因是:{}", user.getRealname(), user.getUsername(), response.getMessage());
|
|
SysUser tmp = new SysUser();
|
|
SysUser tmp = new SysUser();
|
|
tmp.setUserId(user.getUserId());
|
|
tmp.setUserId(user.getUserId());
|
|
@@ -207,7 +212,11 @@ public class WmTaxHelperController {
|
|
*/
|
|
*/
|
|
@SysLog(value = "税邦云回传用户协议授权信息")
|
|
@SysLog(value = "税邦云回传用户协议授权信息")
|
|
@PostMapping(value = "/agreement-signature")
|
|
@PostMapping(value = "/agreement-signature")
|
|
- public R<?> userAgreementAuthorization() {
|
|
|
|
|
|
+ public R<?> userAgreementAuthorization(@RequestBody String params) {
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(params);
|
|
|
|
+ String signPic = jsonObject.getStr("pic");
|
|
|
|
+
|
|
HnqzUser hnqzUser = SecurityUtils.getUser();
|
|
HnqzUser hnqzUser = SecurityUtils.getUser();
|
|
|
|
|
|
// 判断当前用户是否已经存在回调操作,避免同时多次回调
|
|
// 判断当前用户是否已经存在回调操作,避免同时多次回调
|
|
@@ -265,16 +274,21 @@ public class WmTaxHelperController {
|
|
return R.failed(userAgreement);
|
|
return R.failed(userAgreement);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- //
|
|
|
|
TaxHelperUserAgreementAuthorizationModel model = new TaxHelperUserAgreementAuthorizationModel(config);
|
|
TaxHelperUserAgreementAuthorizationModel model = new TaxHelperUserAgreementAuthorizationModel(config);
|
|
model.setEnterpriseCode(dept.getTaxCode());
|
|
model.setEnterpriseCode(dept.getTaxCode());
|
|
LocalDateTime signTime = LocalDateTime.now();
|
|
LocalDateTime signTime = LocalDateTime.now();
|
|
model.setAuthorizationTime(LocalDateTimeUtil.format(signTime, CommonConstants.DEFAULT_DATE_TIME_FORMAT_PATTERN));
|
|
model.setAuthorizationTime(LocalDateTimeUtil.format(signTime, CommonConstants.DEFAULT_DATE_TIME_FORMAT_PATTERN));
|
|
model.setIdCard(user.getIdCardNumber());
|
|
model.setIdCard(user.getIdCardNumber());
|
|
|
|
+ try {
|
|
|
|
+ model.setSignatureHandwriting(Base64Utils.encodeImageWithPrefix(new URI(signPic)));
|
|
|
|
|
|
- TaxHelperUserAgreementAuthorizationRequest request = new TaxHelperUserAgreementAuthorizationRequest(model);
|
|
|
|
- TaxHelperResponse response = taxHelperService.userAgreementAuthorization(request);
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("获取手签图片失败");
|
|
|
|
+ return R.failed("获取手签图片失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TaxHelperUserAgreementAuthorizationRequestV2 request = new TaxHelperUserAgreementAuthorizationRequestV2(model);
|
|
|
|
+ TaxHelperResponse response = taxHelperService.userAgreementAuthorizationV2(request);
|
|
|
|
|
|
// 记录认证结果
|
|
// 记录认证结果
|
|
record.setCode(response.getCode());
|
|
record.setCode(response.getCode());
|
|
@@ -846,7 +860,7 @@ public class WmTaxHelperController {
|
|
sysCertResultRecordMapper.insert(record);
|
|
sysCertResultRecordMapper.insert(record);
|
|
|
|
|
|
if (response.success()) {
|
|
if (response.success()) {
|
|
- if (Objects.equals(user.getCertStatus(),TaxHelperCertStatus.CERT.getCode())){
|
|
|
|
|
|
+ if (Objects.equals(user.getCertStatus(), TaxHelperCertStatus.CERT.getCode())) {
|
|
return R.ok(response.getMessage());
|
|
return R.ok(response.getMessage());
|
|
}
|
|
}
|
|
SysUser sysUser = new SysUser();
|
|
SysUser sysUser = new SysUser();
|
|
@@ -883,7 +897,7 @@ public class WmTaxHelperController {
|
|
@Inner(value = false)
|
|
@Inner(value = false)
|
|
@PostMapping(value = "/{user_id}/settlementNotify")
|
|
@PostMapping(value = "/{user_id}/settlementNotify")
|
|
public String taxHelperSettlementNotify(@PathVariable(value = "user_id") String userId,
|
|
public String taxHelperSettlementNotify(@PathVariable(value = "user_id") String userId,
|
|
- @RequestBody String body) {
|
|
|
|
|
|
+ @RequestBody String body) {
|
|
// 判断当前用户是否已经存在回调操作,避免多次回调
|
|
// 判断当前用户是否已经存在回调操作,避免多次回调
|
|
String cacheKey = CacheConstants.TAX_HELPER_SETTLEMENT_NOTIFY_KEY + userId;
|
|
String cacheKey = CacheConstants.TAX_HELPER_SETTLEMENT_NOTIFY_KEY + userId;
|
|
boolean absent = redisTemplate.opsForValue().setIfAbsent(cacheKey, userId, 3, TimeUnit.SECONDS);
|
|
boolean absent = redisTemplate.opsForValue().setIfAbsent(cacheKey, userId, 3, TimeUnit.SECONDS);
|
|
@@ -923,7 +937,7 @@ public class WmTaxHelperController {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|
|
- return responseJson(2000,"结算通知回调成功");
|
|
|
|
|
|
+ return responseJson(2000, "结算通知回调成功");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -989,7 +1003,7 @@ public class WmTaxHelperController {
|
|
throw new RuntimeException(e.getMessage());
|
|
throw new RuntimeException(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
- return responseJson(2000,"结算通知回调成功");
|
|
|
|
|
|
+ return responseJson(2000, "结算通知回调成功");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|