| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- package me.zhengjie.application.bank.controller;
- import com.alibaba.fastjson.JSONObject;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import me.zhengjie.annotation.rest.AnonymousPostMapping;
- import me.zhengjie.application.bank.BaseController;
- import me.zhengjie.application.bank.controller.vo.BankOrderVO;
- import me.zhengjie.application.bank.service.BankOrderService;
- import me.zhengjie.base.ResponseDTO;
- import me.zhengjie.base.ResultCode;
- import me.zhengjie.base.util.DateUtils;
- import me.zhengjie.base.util.StatusEnum;
- import me.zhengjie.domain.order.OrderConstant;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.PostMapping;
- 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.validation.Valid;
- import java.util.List;
- @Validated
- @RestController
- @RequestMapping("${fqgz.bank.app.url-prefix}/order")
- @Slf4j
- @RequiredArgsConstructor
- @Api(tags = "客户经理APP: 订单管理")
- public class BankOrderController extends BaseController {
- private final BankOrderService bankOrderService;
- /**
- * 得到业务编号
- *
- * @return
- */
- @RequestMapping("/business-no")
- public ResponseDTO<String> businessNo() {
- String no = "100" + DateUtils.getNo();
- return ResponseDTO.success(no);
- }
- /**
- * 创建/修改订单
- *
- * @return
- */
- @AnonymousPostMapping("/save")
- public ResponseDTO<String> saveOrder(@RequestBody @Valid BankOrderVO vo) {
- if (vo.getJointFlag() != null && vo.getJointFlag() == OrderConstant.JOINT_FLAG_TRUE) {
- if (StringUtils.isEmpty(vo.getJointName()) || StringUtils.isEmpty(vo.getJointIdCard()) || StringUtils.isEmpty(vo.getJointPhone()) || StringUtils.isEmpty(vo.getJointSex()) || StringUtils.isEmpty(vo.getJointIdcardFrontPic()) || StringUtils.isEmpty(vo.getJointIdcardBackPic())) {
- return ResponseDTO.error(ResultCode.PARAM_IS_BLANK);
- }
- }
- bankOrderService.saveContractOrder(vo, getCurrentUser());
- return ResponseDTO.success();
- }
- /**
- * 订单列表
- *
- * @param json
- * @return
- */
- @PostMapping("/list")
- public ResponseDTO<List<BankOrderVO>> orderList(@RequestBody String json) {
- JSONObject jsonObj = JSONObject.parseObject(json);
- String phone = jsonObj.getString("phone");
- String status = jsonObj.getString("status");
- String contractNo = jsonObj.getString("contractNo");
- Long index = jsonObj.getLong("index");
- Long size = jsonObj.getLong("size");
- List<BankOrderVO> list = bankOrderService.getContractOrderList(contractNo, phone, status, index, size);
- return ResponseDTO.success(list);
- }
- /**
- * 查询主订单详情
- *
- * @param json
- * @return
- */
- @RequestMapping("/info")
- public ResponseDTO<?> orderInfo(@RequestBody String json) {
- JSONObject jsonObj = JSONObject.parseObject(json);
- String businessNo = jsonObj.getString("businessNo");
- if (StringUtils.isEmpty(businessNo)) {
- 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);
- }
- /**
- * 提交订单
- *
- * @param json
- * @return
- */
- @ApiOperation("提交订单")
- @PostMapping(value = "/submit")
- public ResponseDTO<String> submitOrder(@RequestBody String json) {
- JSONObject jsonObj = JSONObject.parseObject(json);
- String businessNo = jsonObj.getString("businessNo");
- return bankOrderService.submitContractOrder(businessNo, getCurrentUser());
- }
- /**
- * 删除订单
- *
- * @param json
- * @return
- */
- @RequestMapping("/delete")
- public ResponseDTO<String> delete(@RequestBody String json) {
- JSONObject jsonObj = JSONObject.parseObject(json);
- String businessNo = jsonObj.getString("businessNo");
- String status= StatusEnum.NotaryStatusEnum.DELETE.getStatus().toString();
- bankOrderService.updateStatus(businessNo,status,null);
- return ResponseDTO.success();
- }
- /**
- * 银行合同OCR解析输入
- *
- * @param file
- * @param orderType
- * @return
- */
- @RequestMapping("/ocr-parser")
- public ResponseDTO<?> orderOCRParser(MultipartFile file, Integer orderType) {
- Object object = bankOrderService.parseContractOrder(orderType, file, getCurrentUser());
- if (object == null) {
- return ResponseDTO.error(ResultCode.ORDER_OCR_SERVICE_UNAVAILABLE);
- }
- return ResponseDTO.success(object);
- }
- }
|