|
|
@@ -1,13 +1,17 @@
|
|
|
package shop.alien.store.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import shop.alien.entity.result.R;
|
|
|
+import shop.alien.entity.store.LifeUser;
|
|
|
import shop.alien.entity.store.StoreAliPayLog;
|
|
|
+import shop.alien.entity.store.StoreInfo;
|
|
|
+import shop.alien.entity.store.StoreUser;
|
|
|
import shop.alien.store.service.AliService;
|
|
|
import shop.alien.store.service.LifeUserService;
|
|
|
import shop.alien.store.service.StoreInfoService;
|
|
|
@@ -22,8 +26,10 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author ssk
|
|
|
@@ -67,17 +73,51 @@ public class AliController {
|
|
|
|
|
|
@ApiOperation("身份证二要素核验")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "idCard", value = "身份证号", dataType = "String", paramType = "query", required = true)})
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "idCard", value = "身份证号", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "appType", value = "端区分(0:用户, 1:商家)", dataType = "Integer", paramType = "query", required = true, defaultValue = "0")
|
|
|
+ })
|
|
|
@GetMapping("/getIdInfo")
|
|
|
- public R getIdInfo(String name, String idCard) {
|
|
|
+ public R getIdInfo(@RequestParam("name") String name, @RequestParam("idCard") String idCard, @RequestParam("appType") Integer appType) {
|
|
|
log.info("AliController.getIdInfo?name={}&idCard={}", name, idCard);
|
|
|
+ int size = 0;
|
|
|
+ if (appType == 0) {
|
|
|
+ //根据身份查询未注销的用户
|
|
|
+ size = lifeUserService
|
|
|
+ .list(new LambdaQueryWrapper<LifeUser>()
|
|
|
+ .eq(LifeUser::getIdCard, idCard)
|
|
|
+ .eq(LifeUser::getRealName, name)
|
|
|
+ .eq(LifeUser::getLogoutFlag, 0))
|
|
|
+ .size();
|
|
|
+ } else {
|
|
|
+ //根据身份查询已入住或审核中的商家
|
|
|
+ List<StoreUser> storeUserList = storeUserService
|
|
|
+ .list(new LambdaQueryWrapper<StoreUser>()
|
|
|
+ .eq(StoreUser::getIdCard, idCard)
|
|
|
+ .eq(StoreUser::getName, name));
|
|
|
+ List<Integer> storeIds = storeUserList.stream()
|
|
|
+ .map(StoreUser::getStoreId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!storeIds.isEmpty()) {
|
|
|
+ size = storeInfoService
|
|
|
+ .list(new LambdaQueryWrapper<StoreInfo>()
|
|
|
+ .in(StoreInfo::getId, storeIds)
|
|
|
+ .notIn(StoreInfo::getStoreApplicationStatus, 2))
|
|
|
+ .size();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (size > 0) {
|
|
|
+ return R.fail("该身份证已实名认证过");
|
|
|
+ }
|
|
|
if (aliPayConfig.getIdInfo(name, idCard)) {
|
|
|
return R.success("身份验证成功");
|
|
|
}
|
|
|
- Map map = new HashMap();
|
|
|
- map.put("msg","身份验证失败");
|
|
|
- return R.data(map,"身份验证失败");
|
|
|
+// Map map = new HashMap();
|
|
|
+// map.put("msg","身份验证失败");
|
|
|
+// return R.data(map,"身份验证失败");
|
|
|
+ return R.fail("身份证号与姓名不一致,请检查后重新填写");
|
|
|
}
|
|
|
|
|
|
@ApiOperation("单笔转账接口")
|
|
|
@@ -225,63 +265,42 @@ public class AliController {
|
|
|
return R.data(aliApi.promotionPackagePay(price, subject));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("退款")
|
|
|
+ @ApiOperation("处理退款")
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "outTradeNo", value = "订单号", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "outTradeNo", value = "订单编号", dataType = "String", paramType = "query", required = true),
|
|
|
@ApiImplicitParam(name = "refundAmount", value = "退款金额", dataType = "String", paramType = "query", required = true),
|
|
|
@ApiImplicitParam(name = "refundReason", value = "退款原因", dataType = "String", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "partialRefundCode", value = "部分退款编码", dataType = "String", paramType = "query", required = false)
|
|
|
+ @ApiImplicitParam(name = "partialRefundCode", value = "部分退款编号", dataType = "String", paramType = "query")
|
|
|
})
|
|
|
@GetMapping("/processRefund")
|
|
|
- public String processRefund(@RequestParam(value = "outTradeNo") String outTradeNo,
|
|
|
- @RequestParam(value = "refundAmount") String refundAmount,
|
|
|
- @RequestParam(value = "refundReason") String refundReason,
|
|
|
- @RequestParam(value = "partialRefundCode") String partialRefundCode) {
|
|
|
+ public String processRefund(@RequestParam("outTradeNo") String outTradeNo,
|
|
|
+ @RequestParam("refundAmount") String refundAmount,
|
|
|
+ @RequestParam("refundReason") String refundReason,
|
|
|
+ @RequestParam(value = "partialRefundCode", required = false) String partialRefundCode) {
|
|
|
+ log.info("AliController.processRefund?outTradeNo={}, refundAmount={}, refundReason={}, partialRefundCode={}",
|
|
|
+ outTradeNo, refundAmount, refundReason, partialRefundCode);
|
|
|
return aliApi.processRefund(outTradeNo, refundAmount, refundReason, partialRefundCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 支付宝OCR识别
|
|
|
- *
|
|
|
- * @param imageId 图片id
|
|
|
- * @param ocrType OCR识别类型
|
|
|
- * @return OCR识别结果
|
|
|
- * @throws Exception 识别异常
|
|
|
- */
|
|
|
- @ApiOperation("支付宝OCR识别方式一")
|
|
|
- @ApiOperationSupport(order = 14)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "imageId", value = "图片id", dataType = "String", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "ocrType", value = "OCR识别类型", dataType = "String", paramType = "query", required = true)
|
|
|
- })
|
|
|
- @GetMapping("/ocrRequest")
|
|
|
- public R<JSONObject> ocrRequest(@RequestParam(value = "imageId") String imageId, @RequestParam(value = "ocrType") String ocrType) {
|
|
|
- try {
|
|
|
- return aliApi.ocrRequest(imageId, ocrType);
|
|
|
- } catch (Exception e) {
|
|
|
- return R.fail("OCR识别异常:"+e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 支付宝OCR识别
|
|
|
- *
|
|
|
- * @return OCR识别结果
|
|
|
- * @throws Exception 识别异常
|
|
|
+ * 二手委托人识别(底层调用IDcard识别)
|
|
|
*/
|
|
|
- @ApiOperation("支付宝OCR识别方式二")
|
|
|
- @ApiOperationSupport(order = 15)
|
|
|
+ @ApiOperation("二手委托人识别(底层调用IDcard识别)")
|
|
|
+ @ApiOperationSupport(order = 16)
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "ocrType", value = "OCR识别类型", dataType = "String", paramType = "query", required = true)
|
|
|
+ @ApiImplicitParam(name = "imageUrl", value = "图片文件", dataType = "File", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "ocrType", value = "OCR识别类型", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "userName", value = "委托人姓名", dataType = "String", paramType = "query", required = true),
|
|
|
+ @ApiImplicitParam(name = "idCard", value = "委托人身份证号", dataType = "String", paramType = "query", required = true)
|
|
|
})
|
|
|
- @PostMapping("/ocrRequestByBase64")
|
|
|
- public R ocrRequestByBase64(MultipartFile imageFile,
|
|
|
- @RequestParam("ocrType") String ocrType) {
|
|
|
+ @PostMapping("/secondClient")
|
|
|
+ public R secondClient(@RequestBody Map<String, String> params)
|
|
|
+ {
|
|
|
try {
|
|
|
- return aliApi.ocrRequestByBase64(imageFile, ocrType);
|
|
|
+ return aliApi.secondClient(params.get("imageUrl"), params.get("ocrType"), params.get("userName"), params.get("idCard"));
|
|
|
} catch (Exception e) {
|
|
|
- return R.fail("OCR识别异常:"+e.getMessage());
|
|
|
+ return R.fail(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|