Authored by caoyan

营业执照

package com.yohoufo.dal.order;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.order.model.BusinessLicense;
/**
* Created by caoyan on 2019/1/7.
*/
public interface BusinessLicenseMapper {
int insert(BusinessLicense businessLicense);
List<BusinessLicense> selectByUid(@Param("uid") Integer uid);
BusinessLicense selectById(@Param("id") Integer id);
}
... ...
package com.yohoufo.dal.order.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Builder;
/**
* @author caoyan
* @date 2019/1/7
*/
@ToString
@Data
public class BusinessLicense implements Serializable {
private static final long serialVersionUID = 2607922995706119816L;
private Integer id;
private Integer uid;
private Integer businessType;
private String businessName;
private String socialCreditCode;
private String certName;
private String certNo;
private Integer startTime;
private Integer expireTime;
private String licenseOriginalImage;
private String licenseCopyImage;
private String certFaceImage;
private String certReverseImage;
private Integer commitTime;
private Integer auditStatus;
private Integer auditTime;
private Integer auditUid;
private String rejectReason;
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.order.BusinessLicenseMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.BusinessLicense">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="business_type" property="businessType" jdbcType="INTEGER" />
<result column="business_name" property="businessName" jdbcType="VARCHAR" />
<result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR" />
<result column="cert_name" property="certName" jdbcType="VARCHAR" />
<result column="cert_no" property="certNo" jdbcType="VARCHAR" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="expire_time" property="expireTime" jdbcType="INTEGER" />
<result column="license_original_image" property="licenseOriginalImage" jdbcType="VARCHAR" />
<result column="license_copy_image" property="licenseCopyImage" jdbcType="VARCHAR" />
<result column="cert_face_image" property="certFaceImage" jdbcType="VARCHAR" />
<result column="cert_reverse_image" property="certReverseImage" jdbcType="VARCHAR" />
<result column="commit_time" property="commitTime" jdbcType="INTEGER" />
<result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="INTEGER" />
<result column="audit_uid" property="auditUid" jdbcType="INTEGER" />
<result column="reject_reason" property="rejectReason" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time, license_original_image,
license_copy_image, cert_face_image, cert_reverse_image, commit_time, audit_status, audit_time, audit_uid, reject_reason
</sql>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.BusinessLicense">
insert into business_license (uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time,
license_original_image, license_copy_image, cert_face_image, cert_reverse_image, commit_time) values (#{uid}, #{businessType}, #{businessName},
#{socialCreditCode}, #{certName}, #{certNo}, #{startTime}, #{expireTime}, #{licenseOriginalImage}, #{licenseCopyImage},
#{certFaceImage}, #{certReverseImage}, #{commitTime})
</insert>
<select id="selectByUid" resultMap="BaseResultMap" >
select <include refid="Base_Column_List"></include>
from business_license
where uid=#{uid}
order by commit_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from business_license
where id=#{id}
</select>
</mapper>
\ No newline at end of file
... ...
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;
}
}
... ...
package com.yohoufo.order.service;
import com.yohoufo.dal.order.model.BusinessLicense;
public interface IBusinessLicenseService {
int save(BusinessLicense bl);
BusinessLicense getAuditRecord(Integer uid);
}
... ...
package com.yohoufo.order.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yohoufo.dal.order.BusinessLicenseMapper;
import com.yohoufo.dal.order.model.BusinessLicense;
import com.yohoufo.order.service.IBusinessLicenseService;
/**
* @author caoyan
* @date 2019/1/7
*/
@Service
public class BusinessLicenseServiceImpl implements IBusinessLicenseService {
private static final Logger LOGGER = LoggerFactory.getLogger(BusinessLicenseServiceImpl.class);
@Autowired
private BusinessLicenseMapper businessLicenseMapper;
@Override
public int save(BusinessLicense bl) {
return businessLicenseMapper.insert(bl);
}
@Override
public BusinessLicense getAuditRecord(Integer uid) {
List<BusinessLicense> list = businessLicenseMapper.selectByUid(uid);
return list.get(0);
}
}
... ...
... ... @@ -73,6 +73,7 @@ datasources:
- com.yohoufo.dal.order.OrdersPrePayMapper
- com.yohoufo.dal.order.MetaConfigMapper
- com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
- com.yohoufo.dal.order.BusinessLicenseMapper
ufo_promotion:
servers:
... ...
... ... @@ -73,6 +73,7 @@ datasources:
- com.yohoufo.dal.order.OrdersPrePayMapper
- com.yohoufo.dal.order.MetaConfigMapper
- com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
- com.yohoufo.dal.order.BusinessLicenseMapper
ufo_promotion:
servers:
... ...