Authored by caoyan

营业执照

  1 +package com.yohoufo.dal.order;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import com.yohoufo.dal.order.model.BusinessLicense;
  8 +
  9 +/**
  10 + * Created by caoyan on 2019/1/7.
  11 + */
  12 +public interface BusinessLicenseMapper {
  13 +
  14 + int insert(BusinessLicense businessLicense);
  15 +
  16 + List<BusinessLicense> selectByUid(@Param("uid") Integer uid);
  17 +
  18 + BusinessLicense selectById(@Param("id") Integer id);
  19 +
  20 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +import lombok.AllArgsConstructor;
  6 +import lombok.Data;
  7 +import lombok.NoArgsConstructor;
  8 +import lombok.ToString;
  9 +import lombok.experimental.Builder;
  10 +
  11 +/**
  12 + * @author caoyan
  13 + * @date 2019/1/7
  14 + */
  15 +@ToString
  16 +@Data
  17 +public class BusinessLicense implements Serializable {
  18 +
  19 + private static final long serialVersionUID = 2607922995706119816L;
  20 +
  21 + private Integer id;
  22 +
  23 + private Integer uid;
  24 +
  25 + private Integer businessType;
  26 +
  27 + private String businessName;
  28 +
  29 + private String socialCreditCode;
  30 +
  31 + private String certName;
  32 +
  33 + private String certNo;
  34 +
  35 + private Integer startTime;
  36 +
  37 + private Integer expireTime;
  38 +
  39 + private String licenseOriginalImage;
  40 +
  41 + private String licenseCopyImage;
  42 +
  43 + private String certFaceImage;
  44 +
  45 + private String certReverseImage;
  46 +
  47 + private Integer commitTime;
  48 +
  49 + private Integer auditStatus;
  50 +
  51 + private Integer auditTime;
  52 +
  53 + private Integer auditUid;
  54 +
  55 + private String rejectReason;
  56 +
  57 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yohoufo.dal.order.BusinessLicenseMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.BusinessLicense">
  5 + <result column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="uid" property="uid" jdbcType="INTEGER" />
  7 + <result column="business_type" property="businessType" jdbcType="INTEGER" />
  8 + <result column="business_name" property="businessName" jdbcType="VARCHAR" />
  9 + <result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR" />
  10 + <result column="cert_name" property="certName" jdbcType="VARCHAR" />
  11 + <result column="cert_no" property="certNo" jdbcType="VARCHAR" />
  12 + <result column="start_time" property="startTime" jdbcType="INTEGER" />
  13 + <result column="expire_time" property="expireTime" jdbcType="INTEGER" />
  14 + <result column="license_original_image" property="licenseOriginalImage" jdbcType="VARCHAR" />
  15 + <result column="license_copy_image" property="licenseCopyImage" jdbcType="VARCHAR" />
  16 + <result column="cert_face_image" property="certFaceImage" jdbcType="VARCHAR" />
  17 + <result column="cert_reverse_image" property="certReverseImage" jdbcType="VARCHAR" />
  18 + <result column="commit_time" property="commitTime" jdbcType="INTEGER" />
  19 + <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
  20 + <result column="audit_time" property="auditTime" jdbcType="INTEGER" />
  21 + <result column="audit_uid" property="auditUid" jdbcType="INTEGER" />
  22 + <result column="reject_reason" property="rejectReason" jdbcType="VARCHAR" />
  23 + </resultMap>
  24 +
  25 + <sql id="Base_Column_List">
  26 + id, uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time, license_original_image,
  27 + license_copy_image, cert_face_image, cert_reverse_image, commit_time, audit_status, audit_time, audit_uid, reject_reason
  28 + </sql>
  29 +
  30 + <insert id="insert" parameterType="com.yohoufo.dal.order.model.BusinessLicense">
  31 + insert into business_license (uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time,
  32 + license_original_image, license_copy_image, cert_face_image, cert_reverse_image, commit_time) values (#{uid}, #{businessType}, #{businessName},
  33 + #{socialCreditCode}, #{certName}, #{certNo}, #{startTime}, #{expireTime}, #{licenseOriginalImage}, #{licenseCopyImage},
  34 + #{certFaceImage}, #{certReverseImage}, #{commitTime})
  35 + </insert>
  36 +
  37 + <select id="selectByUid" resultMap="BaseResultMap" >
  38 + select <include refid="Base_Column_List"></include>
  39 + from business_license
  40 + where uid=#{uid}
  41 + order by commit_time desc
  42 + </select>
  43 +
  44 + <select id="selectById" resultMap="BaseResultMap">
  45 + select <include refid="Base_Column_List"></include>
  46 + from business_license
  47 + where id=#{id}
  48 + </select>
  49 +
  50 +
  51 +</mapper>
  1 +package com.yohoufo.order.controller;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.ResponseBody;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import com.yoho.core.common.utils.DateUtil;
  16 +import com.yohoufo.common.ApiResponse;
  17 +import com.yohoufo.dal.order.model.BusinessLicense;
  18 +import com.yohoufo.order.service.IBusinessLicenseService;
  19 +
  20 +@RestController
  21 +public class BusinessLicenseController {
  22 +
  23 + private static final Logger LOGGER = LoggerFactory.getLogger(BusinessLicenseController.class);
  24 +
  25 + @Autowired
  26 + private IBusinessLicenseService businessLicenseService;
  27 +
  28 + @RequestMapping(params = "method=ufo.businessLicense.save")
  29 + @ResponseBody
  30 + public ApiResponse save(@RequestParam("uid") Integer uid,
  31 + @RequestParam("business_type") Integer businessType,
  32 + @RequestParam("business_name") String businessName,
  33 + @RequestParam("social_credit_code") String socialCreditCode,
  34 + @RequestParam("cert_name") String certName,
  35 + @RequestParam("cert_no") String certNo,
  36 + @RequestParam("start_time") String startTime,
  37 + @RequestParam("expire_time") String expireTime,
  38 + @RequestParam("license_original_image") String licenseOriginalImage,
  39 + @RequestParam("license_copy_image") String licenseCopyImage,
  40 + @RequestParam("cert_face_image") String certFaceImage,
  41 + @RequestParam("cert_reverse_image") String certReverseImage) {
  42 + BusinessLicense bl = new BusinessLicense();
  43 + bl.setUid(uid);
  44 + bl.setBusinessType(businessType);
  45 + bl.setBusinessName(businessName);
  46 + bl.setSocialCreditCode(socialCreditCode);
  47 + bl.setCertName(certName);
  48 + bl.setCertNo(certNo);
  49 + bl.setStartTime(Integer.parseInt(convertDateToLong(startTime) + ""));
  50 + bl.setExpireTime(Integer.parseInt(convertDateToLong(expireTime) + ""));
  51 + bl.setLicenseOriginalImage(licenseOriginalImage);
  52 + bl.setLicenseCopyImage(licenseCopyImage);
  53 + bl.setCertFaceImage(certFaceImage);
  54 + bl.setCertReverseImage(certReverseImage);
  55 + bl.setCommitTime(DateUtil.getCurrentTimeSecond());
  56 + int result = businessLicenseService.save(bl);
  57 + if(result>0) {
  58 + return new ApiResponse.ApiResponseBuilder().code(200).message("保存成功").build();
  59 + }else {
  60 + return new ApiResponse.ApiResponseBuilder().code(500).message("保存失败").build();
  61 + }
  62 + }
  63 +
  64 + @RequestMapping(params = "method=ufo.businessLicense.queryAuditStatus")
  65 + @ResponseBody
  66 + public ApiResponse queryAuditStatus(@RequestParam("uid") Integer uid) {
  67 + LOGGER.info("queryAuditStatus in. uid is {}", uid);
  68 + BusinessLicense bl = businessLicenseService.getAuditRecord(uid);
  69 +
  70 + if(null == bl) {
  71 + return new ApiResponse.ApiResponseBuilder().code(400).message("记录不存在").build();
  72 + }
  73 +
  74 + String auditStatusStr = "审核中";
  75 + String info = "您的资料已提交审核,认证成功后我们将会第一时间通知您。";
  76 + if(bl.getAuditStatus().intValue() == 1) {
  77 + auditStatusStr = "审核通过";
  78 + info = "您的资料已审核通过,现您可以进行商家入驻。";
  79 + }else if(bl.getAuditStatus().intValue() == 2) {
  80 + auditStatusStr = "审核不通过";
  81 + info = bl.getRejectReason();
  82 + }
  83 +
  84 + return new ApiResponse.ApiResponseBuilder().code(200).message(info).data(auditStatusStr).build();
  85 + }
  86 +
  87 + private long convertDateToLong(String date) {
  88 + if(date.equals("0")) {
  89 + return 0;
  90 + }
  91 + SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  92 + Date dateDate = new Date();
  93 + try {
  94 + dateDate = formatter.parse(date + " 00:00:00");
  95 + } catch (ParseException e) {
  96 + e.printStackTrace();
  97 + }
  98 + return dateDate.getTime() / 1000;
  99 + }
  100 +
  101 +}
  1 +package com.yohoufo.order.service;
  2 +
  3 +import com.yohoufo.dal.order.model.BusinessLicense;
  4 +
  5 +public interface IBusinessLicenseService {
  6 + int save(BusinessLicense bl);
  7 +
  8 + BusinessLicense getAuditRecord(Integer uid);
  9 +
  10 +}
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import com.yohoufo.dal.order.BusinessLicenseMapper;
  11 +import com.yohoufo.dal.order.model.BusinessLicense;
  12 +import com.yohoufo.order.service.IBusinessLicenseService;
  13 +
  14 +/**
  15 + * @author caoyan
  16 + * @date 2019/1/7
  17 + */
  18 +@Service
  19 +public class BusinessLicenseServiceImpl implements IBusinessLicenseService {
  20 +
  21 + private static final Logger LOGGER = LoggerFactory.getLogger(BusinessLicenseServiceImpl.class);
  22 +
  23 + @Autowired
  24 + private BusinessLicenseMapper businessLicenseMapper;
  25 +
  26 + @Override
  27 + public int save(BusinessLicense bl) {
  28 + return businessLicenseMapper.insert(bl);
  29 + }
  30 +
  31 + @Override
  32 + public BusinessLicense getAuditRecord(Integer uid) {
  33 + List<BusinessLicense> list = businessLicenseMapper.selectByUid(uid);
  34 +
  35 + return list.get(0);
  36 + }
  37 +
  38 +}
@@ -73,6 +73,7 @@ datasources: @@ -73,6 +73,7 @@ datasources:
73 - com.yohoufo.dal.order.OrdersPrePayMapper 73 - com.yohoufo.dal.order.OrdersPrePayMapper
74 - com.yohoufo.dal.order.MetaConfigMapper 74 - com.yohoufo.dal.order.MetaConfigMapper
75 - com.yohoufo.dal.order.BuyerOrderStatusFlowMapper 75 - com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
  76 + - com.yohoufo.dal.order.BusinessLicenseMapper
76 77
77 ufo_promotion: 78 ufo_promotion:
78 servers: 79 servers:
@@ -73,6 +73,7 @@ datasources: @@ -73,6 +73,7 @@ datasources:
73 - com.yohoufo.dal.order.OrdersPrePayMapper 73 - com.yohoufo.dal.order.OrdersPrePayMapper
74 - com.yohoufo.dal.order.MetaConfigMapper 74 - com.yohoufo.dal.order.MetaConfigMapper
75 - com.yohoufo.dal.order.BuyerOrderStatusFlowMapper 75 - com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
  76 + - com.yohoufo.dal.order.BusinessLicenseMapper
76 77
77 ufo_promotion: 78 ufo_promotion:
78 servers: 79 servers: