|
|
package com.yohoufo.order.controller;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.dal.order.model.BusinessLicense;
|
|
|
import com.yohoufo.order.service.IBusinessLicenseService;
|
|
|
|
|
|
@RestController
|
|
|
public class BusinessLicenseController {
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(BusinessLicenseController.class);
|
|
|
|
|
|
@Autowired
|
|
|
private IBusinessLicenseService businessLicenseService;
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.businessLicense.save")
|
|
|
@ResponseBody
|
|
|
public ApiResponse save(@RequestParam("uid") Integer uid,
|
|
|
@RequestParam("business_type") Integer businessType,
|
|
|
@RequestParam("business_name") String businessName,
|
|
|
@RequestParam("social_credit_code") String socialCreditCode,
|
|
|
@RequestParam("cert_name") String certName,
|
|
|
@RequestParam("cert_no") String certNo,
|
|
|
@RequestParam("start_time") String startTime,
|
|
|
@RequestParam("expire_time") String expireTime,
|
|
|
@RequestParam("license_original_image") String licenseOriginalImage,
|
|
|
@RequestParam("license_copy_image") String licenseCopyImage,
|
|
|
@RequestParam("cert_face_image") String certFaceImage,
|
|
|
@RequestParam("cert_reverse_image") String certReverseImage) {
|
|
|
BusinessLicense bl = new BusinessLicense();
|
|
|
bl.setUid(uid);
|
|
|
bl.setBusinessType(businessType);
|
|
|
bl.setBusinessName(businessName);
|
|
|
bl.setSocialCreditCode(socialCreditCode);
|
|
|
bl.setCertName(certName);
|
|
|
bl.setCertNo(certNo);
|
|
|
bl.setStartTime(Integer.parseInt(convertDateToLong(startTime) + ""));
|
|
|
bl.setExpireTime(Integer.parseInt(convertDateToLong(expireTime) + ""));
|
|
|
bl.setLicenseOriginalImage(licenseOriginalImage);
|
|
|
bl.setLicenseCopyImage(licenseCopyImage);
|
|
|
bl.setCertFaceImage(certFaceImage);
|
|
|
bl.setCertReverseImage(certReverseImage);
|
|
|
bl.setCommitTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result = businessLicenseService.save(bl);
|
|
|
if(result>0) {
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message("保存成功").build();
|
|
|
}else {
|
|
|
return new ApiResponse.ApiResponseBuilder().code(500).message("保存失败").build();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(params = "method=ufo.businessLicense.queryAuditStatus")
|
|
|
@ResponseBody
|
|
|
public ApiResponse queryAuditStatus(@RequestParam("uid") Integer uid) {
|
|
|
LOGGER.info("queryAuditStatus in. uid is {}", uid);
|
|
|
BusinessLicense bl = businessLicenseService.getAuditRecord(uid);
|
|
|
|
|
|
if(null == bl) {
|
|
|
return new ApiResponse.ApiResponseBuilder().code(400).message("记录不存在").build();
|
|
|
}
|
|
|
|
|
|
String auditStatusStr = "审核中";
|
|
|
String info = "您的资料已提交审核,认证成功后我们将会第一时间通知您。";
|
|
|
if(bl.getAuditStatus().intValue() == 1) {
|
|
|
auditStatusStr = "审核通过";
|
|
|
info = "您的资料已审核通过,现您可以进行商家入驻。";
|
|
|
}else if(bl.getAuditStatus().intValue() == 2) {
|
|
|
auditStatusStr = "审核不通过";
|
|
|
info = bl.getRejectReason();
|
|
|
}
|
|
|
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message(info).data(auditStatusStr).build();
|
|
|
}
|
|
|
|
|
|
private long convertDateToLong(String date) {
|
|
|
if(date.equals("0")) {
|
|
|
return 0;
|
|
|
}
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
|
|
Date dateDate = new Date();
|
|
|
try {
|
|
|
dateDate = formatter.parse(date + " 00:00:00");
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return dateDate.getTime() / 1000;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|