humuyu vor 2 Jahren
Ursprung
Commit
dea47107ac

+ 54 - 240
eladmin-system/src/main/java/me/zhengjie/application/user/mini/controller/MiniUserController.java

@@ -1,274 +1,88 @@
 package me.zhengjie.application.user.mini.controller;
 
 import com.alibaba.fastjson.JSONObject;
+
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.annotation.rest.AnonymousPostMapping;
+import me.zhengjie.application.bank.controller.BankAuthController;
+import me.zhengjie.application.bank.controller.vo.BankLoginVO;
 import me.zhengjie.application.bank.controller.vo.BankOrderVO;
+import me.zhengjie.application.bank.controller.vo.FileInfoVO;
+import me.zhengjie.application.bank.controller.vo.FileUploadVO;
+import me.zhengjie.application.bank.controller.vo.ImageUploadVO;
 import me.zhengjie.application.user.vo.SmsVo;
 import me.zhengjie.application.user.vo.UserVo;
+import me.zhengjie.application.bank.service.BankLoginService;
 import me.zhengjie.application.bank.service.BankOrderService;
+import me.zhengjie.application.bank.service.FileInfoService;
 import me.zhengjie.application.bank.service.UserAXQInfoService;
 import me.zhengjie.application.user.service.ApiService;
 import me.zhengjie.application.user.service.UserOrderService;
 import me.zhengjie.base.ResponseDTO;
 import me.zhengjie.base.ResultCode;
 import me.zhengjie.base.mq.RedisCacheConfig;
+import me.zhengjie.base.util.DateUtils;
 import me.zhengjie.base.util.FileUploadUtil;
+import me.zhengjie.base.util.HandwritingUtil;
+import me.zhengjie.base.util.StatusEnum.StepStatusEnum;
 import me.zhengjie.dao.mybatis.OrderFileRepository;
+import me.zhengjie.dao.mybatis.UserAXQInfoRepository;
 import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
+import me.zhengjie.dao.mybatis.entity.UserAXQInfoEntity;
+
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
-import java.util.List;
 
+import java.util.ArrayList;
+import java.util.List;
+@Slf4j
 @RestController
 @RequestMapping("/minipro")
 public class MiniUserController {
 
 
-	@Autowired
-	private ApiService apiService;
-
-
-	@Autowired
-	OrderFileRepository orderFileRepository;
-
-	@Autowired
-	BankOrderService bankOrderService;
-	@Autowired
-    UserOrderService userOrderService;
-	@Autowired
-    UserAXQInfoService userAXQInfoService;
-	@Autowired
-	private RedisTemplate<String, String> redisTemplate;
-
-	/**
-	 * 
-	 * @param request
-	 * @return
-	 */
-	@AnonymousPostMapping("/sendSms")
-	public ResponseDTO<?> sendSms(@RequestBody String phonejson, HttpServletRequest request) {
-		JSONObject jsonObj = JSONObject.parseObject(phonejson);
-		String phone = jsonObj.getString("phone");
-		if (StringUtils.isEmpty(phone)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		return this.apiService.sendSms(request, phone);
-	}
-
-	@AnonymousPostMapping("/login")
-	public ResponseDTO<?> login(@RequestBody SmsVo sms) {
-		return this.apiService.login(sms);
-	}
-
-	@RequestMapping("/order/list")
-	public ResponseDTO<?> getOrderList(@Valid @RequestBody UserVo user) {
-
-		Integer startIndex = 1;
-
-		Integer size = Integer.MAX_VALUE;
-
-		List<BankOrderVO> list = this.apiService.getOrderList(user, startIndex, size);
-		return ResponseDTO.success(list);
-	}
-
-	@RequestMapping("/order/detail")
-	public ResponseDTO<?> getDetail(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String businessNo = jsonObj.getString("businessNo");
-		String contractNo = jsonObj.getString("contractNo");
-		if (StringUtils.isEmpty(businessNo)||StringUtils.isEmpty(contractNo)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		BankOrderVO order = bankOrderService.getContractOrderWithBizNo(businessNo);
-		if (order == null) {
-			return ResponseDTO.error(ResultCode.ORDER_DATA_NOT_EXIST);
-		}
-		return ResponseDTO.success(order);
-	}
-	@RequestMapping("/order/search")
-	public ResponseDTO<?> orderSearch( @RequestBody BankOrderVO order ) {
-		 
-		if (order == null) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		 List<BankOrderVO> orders = this.apiService.getOrderByContion(order);
-		
-		return ResponseDTO.success(orders);
-	}
-
-//	@RequestMapping("/live/verify")
-//	public ResponseDTO<?> liveVerify(MultipartFile file, HttpServletRequest request) {
-//		return identityValidationService.liveVerify(file, request);
-//	}
-
-	@AnonymousPostMapping("/video/call")
-	public ResponseDTO<?> videoCall(@RequestBody String json) {
-		return this.apiService.videoCall(json);
-	}
-
-	@AnonymousPostMapping("/sendInfo")
-	public void sendInfo(@RequestBody String json) {
-		// 这里保存推送的数据
-		redisTemplate.convertAndSend(RedisCacheConfig.CHANNEL_WEB_SOCKET, json);
-	}
-
-	@RequestMapping("/order/pdf")
-	public ResponseDTO<?> getOrderPDF(@RequestBody String json) {
-
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String prodId = jsonObj.getString("prodId");
-		String businessNo = jsonObj.getString("businessNo");
-		if (StringUtils.isEmpty(prodId) || StringUtils.isEmpty(businessNo)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		ResponseDTO<?> order = this.apiService.getOrderPDF(businessNo,prodId);
-
-		return order;
-	}
-
-	@AnonymousPostMapping("/order/note")
-	public ResponseDTO<?> note(@RequestBody String json) {
-		
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String businessNo = jsonObj.getString("businessNo");
-		if (StringUtils.isEmpty(businessNo)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		//
-		OrderFileEntity orderFile = orderFileRepository.getOrderNote(businessNo);
-		// pdf的地址预览
-		String noteUrl = FileUploadUtil.getPreviewUrl(orderFile.getHtmlUrl());
-		
-		return ResponseDTO.success(noteUrl);
-	}
-
-	@RequestMapping("/video/complete")
-	public ResponseDTO<?> videoComplete(HttpServletRequest request) {
-		return this.apiService.videoComplete(request);
-	}
-
-//	@RequestMapping("/order/upfile")
-//	public ResponseDTO<?> appUpload(MultipartFile file, HttpServletRequest request) {
-//		return this.apiService.appUpload(file, request);
-//	}
-
-	// 功能点,云点播,视频通话,等杜
-//	@RequestMapping("/live/compare")
-//	public ResponseDTO<?> liveCompare(MultipartFile file, HttpServletRequest request) {
-//		return identityValidationService.liveCompare(file, request);
-//	}
-//
-//	@RequestMapping("/face/compare")
-//	public ResponseDTO<?> faceCompare(HttpServletRequest request) {
-//		return identityValidationService.faceCompare(request);
-//	}
-
-//	@RequestMapping("/pdf/sign")
-//	public ResponseDTO<?> sigin(MultipartFile file, Integer orderId) {
-//		// 判断订单号是否为空
-//		if (orderId == null) {
-//			return ResponseDTO.error(ResultCode.PARAM_NOT_COMPLETE);
-//		}
-//		return signService.sigin(file, orderId);
-//	}
-
-	@RequestMapping("/order/getFaceId")
-	public ResponseDTO<?> getFaceId(@RequestBody String json) throws Exception {
-
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String orderId = jsonObj.getString("orderId");
-		if (StringUtils.isEmpty(orderId)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-//		OrderDto order = this.apiService.getOrderDetail(orderId);
-//		JSONObject str = SdkTest.getFaceId(order.getUsername(), order.getIdCard(), orderId);
-		return ResponseDTO.success();
-	}
-
-	@RequestMapping("/order/updateStatus")
-	public ResponseDTO<?> updateOrderStatus(@RequestBody String json) throws Exception {
-
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String orderId = jsonObj.getString("orderId");
-		if (StringUtils.isEmpty(orderId)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		userOrderService.updateOrderStatus(orderId);
-
-		return ResponseDTO.success();
-	}
-
-	@RequestMapping("/axqRegister")
-	public ResponseDTO<?> axqRegister(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String idCard = jsonObj.getString("idCard");
-		String phone = jsonObj.getString("phone");
-		String name = jsonObj.getString("name");
-		if (StringUtils.isEmpty(idCard) || StringUtils.isEmpty(phone) || StringUtils.isEmpty(name)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		return userAXQInfoService.registAXQUser(idCard, phone, name);
-	}
-
-	@RequestMapping("/getAuthStatus")
-	public ResponseDTO<?> getAuthStatus(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String idCard = jsonObj.getString("idCard");
-		if (StringUtils.isEmpty(idCard)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		return userAXQInfoService.getAuthStatus(idCard);
-	}
-
-	@RequestMapping("/sendAuthMessage")
-	public ResponseDTO<?> sendAuthMessage(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String idCard = jsonObj.getString("idCard");
-		if (StringUtils.isEmpty(idCard)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		return userAXQInfoService.sendAuthMessage(idCard);
-	}
-
-	@RequestMapping("/verifyAuthMessage")
-	public ResponseDTO<?> verifyAuthMessage(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String idCard = jsonObj.getString("idCard");
-		String checkCode = jsonObj.getString("checkCode");
-		if (StringUtils.isEmpty(idCard) || StringUtils.isEmpty(checkCode)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		return userAXQInfoService.verifyAuthMessage(idCard, checkCode);
-	}
-
-	@RequestMapping("/uploadSeal")
-	public ResponseDTO<?> uploadSeal(@RequestBody String json) {
-//		JSONObject jsonObj = JSONObject.parseObject(json);
-//		String idCard = jsonObj.getString("idCard");
-//		String contractId = jsonObj.getString("contractId");
-//		String content = jsonObj.getString("content");
-//		if (StringUtils.isEmpty(idCard) || StringUtils.isEmpty(contractId) || StringUtils.isEmpty(content)) {
-//			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-//		}
-//		return userAXQInfoService.uploadSeal(idCard, contractId, content);
-		return null;
-	}
+    @Autowired
+    private Environment environment;
+    @Autowired
+    private  BankLoginService bankLoginService;
+    @Autowired
+    private  FileInfoService fileInfoService;
+    @Autowired
+    private  UserAXQInfoRepository userAXQInfoRepository;
+
+    /**
+     * 登录接口
+     *
+     * @param loginVo
+     * @return
+     */
+    @ApiOperation("登录")
+    @AnonymousPostMapping("/login")
+    public ResponseDTO<BankLoginVO> login(@Valid @RequestBody BankLoginVO loginVo) {
+        return bankLoginService.login(loginVo);
+    }
+
+    /**
+     * 得到业务编号
+     *
+     * @return
+     */
+    @RequestMapping("/businessNo")
+    public ResponseDTO<String> businessNo() {
+        String no = "110" + DateUtils.getNo();
+        return ResponseDTO.success(no);
+    }
 
-	@RequestMapping("/getNotarization")
-	public ResponseDTO<?> getNotarization(@RequestBody String json) {
-		JSONObject jsonObj = JSONObject.parseObject(json);
-		String businessNo = jsonObj.getString("businessNo");
-		if (StringUtils.isEmpty(businessNo)) {
-			return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
-		}
-		OrderFileEntity orderFile = orderFileRepository.getOrderNotarization(businessNo);
-		return ResponseDTO.success(orderFile.getSignedPdfUrl());
-	}
 }