Authored by caoyan

营业执照

package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.BusinessLicense;
import com.yoho.order.model.BusinessLicenseReq;
/**
* Created by caoyan on 2019/1/7.
*/
public interface BusinessLicenseMapper {
int insert(BusinessLicense businessLicense);
List<BusinessLicense> selectByUid(@Param("uid") Integer uid);
int selectTotalByCondition(@Param("businessLicenseReq")BusinessLicenseReq businessLicenseReq);
List<BusinessLicense> selectByCondition(@Param("businessLicenseReq")BusinessLicenseReq businessLicenseReq);
BusinessLicense selectById(@Param("id") Integer id);
}
... ...
package com.yoho.order.model;
import java.io.Serializable;
/**
* @author caoyan
* @date 2019/1/7
*/
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;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getBusinessType() {
return businessType;
}
public void setBusinessType(Integer businessType) {
this.businessType = businessType;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getSocialCreditCode() {
return socialCreditCode;
}
public void setSocialCreditCode(String socialCreditCode) {
this.socialCreditCode = socialCreditCode;
}
public String getCertName() {
return certName;
}
public void setCertName(String certName) {
this.certName = certName;
}
public String getCertNo() {
return certNo;
}
public void setCertNo(String certNo) {
this.certNo = certNo;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getExpireTime() {
return expireTime;
}
public void setExpireTime(Integer expireTime) {
this.expireTime = expireTime;
}
public String getLicenseOriginalImage() {
return licenseOriginalImage;
}
public void setLicenseOriginalImage(String licenseOriginalImage) {
this.licenseOriginalImage = licenseOriginalImage;
}
public String getLicenseCopyImage() {
return licenseCopyImage;
}
public void setLicenseCopyImage(String licenseCopyImage) {
this.licenseCopyImage = licenseCopyImage;
}
public String getCertFaceImage() {
return certFaceImage;
}
public void setCertFaceImage(String certFaceImage) {
this.certFaceImage = certFaceImage;
}
public String getCertReverseImage() {
return certReverseImage;
}
public void setCertReverseImage(String certReverseImage) {
this.certReverseImage = certReverseImage;
}
public Integer getCommitTime() {
return commitTime;
}
public void setCommitTime(Integer commitTime) {
this.commitTime = commitTime;
}
public Integer getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(Integer auditStatus) {
this.auditStatus = auditStatus;
}
public Integer getAuditTime() {
return auditTime;
}
public void setAuditTime(Integer auditTime) {
this.auditTime = auditTime;
}
public Integer getAuditUid() {
return auditUid;
}
public void setAuditUid(Integer auditUid) {
this.auditUid = auditUid;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
@Override
public String toString() {
return "BusinessLicense{" +
"id=" + id +
", uid='" + uid + '\'' +
", businessType='" + businessType + '\'' +
", businessName='" + businessName + '\'' +
", socialCreditCode='" + socialCreditCode + '\'' +
", certName='" + certName + '\'' +
", certNo='" + certNo + '\'' +
", startTime='" + startTime + '\'' +
", expireTime='" + expireTime + '\'' +
", licenseOriginalImage='" + licenseOriginalImage + '\'' +
", licenseCopyImage='" + licenseCopyImage + '\'' +
", certFaceImage='" + certFaceImage + '\'' +
", certReverseImage='" + certReverseImage + '\'' +
", commitTime='" + commitTime + '\'' +
", auditStatus='" + auditStatus + '\'' +
", auditTime='" + auditTime + '\'' +
", auditUid='" + auditUid + '\'' +
", rejectReason='" + rejectReason + '\'' +
'}';
}
}
... ...
package com.yoho.order.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by caoyan.
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusinessLicenseReq extends PageRequestBO{
/**
*
*/
private static final long serialVersionUID = 1620427808531296022L;
private Integer id;
private Integer uid;
private Integer businessType;
private String businessName;
private String socialCreditCode;
private String certName;
private String certNo;
private String licenseImage;
private String certFaceImage;
private String certReverseImage;
private Integer validStatus;//入驻状态 1:已入驻 9:已退驻
}
... ...
package com.yoho.order.model;
import com.yoho.ufo.service.model.PageRequestBO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by caoyan.
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusinessLicenseRsp extends PageRequestBO{
/**
*
*/
private static final long serialVersionUID = 1620427808531296022L;
private Integer id;
private Integer uid;
private Integer businessType;
private String businessTypeStr;
private String certName;
private String certNo;
private String commitTime;
private Integer auditStatus;
private String auditStatusStr;
private String auditTime;
private String rejectReason;
private String startTime;
private String expireTime;
private String licenseOriginalImage;
private String licenseCopyImage;
private String businessName;
private String socialCreditCode;
}
... ...
<?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.yoho.order.dal.BusinessLicenseMapper">
<resultMap id="BaseResultMap" type="com.yoho.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.yoho.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}, #{licenseImage}, #{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>
<sql id="Query_Sql" >
<if test="businessLicenseReq.uid != null">
and a.uid=#{businessLicenseReq.uid}
</if>
<if test="businessLicenseReq.businessName!= null">
<bind name="pattern" value="'%' + businessLicenseReq.businessName + '%'" />
and a.business_name like #{pattern}
</if>
<if test="businessLicenseReq.validStatus != null">
and b.valid_status=#{businessLicenseReq.validStatus}
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BusinessLicenseReq">
select count(1)
from business_license a
<if test="businessLicenseReq.validStatus != null">
LEFT JOIN stored_seller b
ON( b.uid=a.uid)
</if>
where 1=1
<include refid="Query_Sql"></include>
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BusinessLicenseReq">
select a.*
from business_license a
<if test="businessLicenseReq.validStatus != null">
LEFT JOIN stored_seller b
ON( b.uid=a.uid)
</if>
where 1=1
<include refid="Query_Sql"></include>
order by a.commit_time desc
<if test="businessLicenseReq.start!=null and businessLicenseReq.size != null">
limit #{businessLicenseReq.start},#{businessLicenseReq.size}
</if>
</select>
<select id="selectById">
select <include refid="Base_Column_List"></include>
from business_license
where id=#{id}
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.ufo.order.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yoho.order.model.BusinessLicense;
import com.yoho.order.model.BusinessLicenseReq;
import com.yoho.order.model.BusinessLicenseRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.order.service.IBusinessLicenseService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageResponseBO;
@RestController
@RequestMapping(value = "/businessLicense")
public class BusinessLicenseController {
private static final Logger LOGGER = LoggerFactory.getLogger(BusinessLicenseController.class);
@Autowired
private IBusinessLicenseService businessLicenseService;
@RequestMapping(value = "/queryList")
public ApiResponse queryList(BusinessLicenseReq req) {
LOGGER.info("queryList in. req is {}", req);
PageResponseBO<BusinessLicenseRsp> result = businessLicenseService.queryList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
@RequestMapping(value = "/save")
public ApiResponse save(@RequestBody BusinessLicenseReq req) {
LOGGER.info("save in. req is {}", req);
int result = businessLicenseService.save(req);
if(result>0) {
return new ApiResponse.ApiResponseBuilder().code(200).message("保存成功").build();
}else {
return new ApiResponse.ApiResponseBuilder().code(500).message("保存失败").build();
}
}
@RequestMapping(value = "/queryAuditStatus")
public ApiResponse queryAuditStatus(@RequestBody BusinessLicenseReq req) {
LOGGER.info("queryAuditStatus in. req is {}", req);
BusinessLicense bl;
try {
bl = businessLicenseService.getAuditRecord(req);
} catch (PlatformException e) {
return new ApiResponse.ApiResponseBuilder().code(500).message(e.getMessage()).build();
}
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();
}
}
... ...
package com.yoho.ufo.order.service;
import com.yoho.order.model.BusinessLicense;
import com.yoho.order.model.BusinessLicenseReq;
import com.yoho.order.model.BusinessLicenseRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.service.model.PageResponseBO;
public interface IBusinessLicenseService {
int save(BusinessLicenseReq req);
BusinessLicense getAuditRecord(BusinessLicenseReq req) throws PlatformException;
PageResponseBO<BusinessLicenseRsp> queryList(BusinessLicenseReq req);
BusinessLicenseRsp getDetail(BusinessLicenseReq req);
}
... ...
package com.yoho.ufo.order.service.impl;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.order.dal.BusinessLicenseMapper;
import com.yoho.order.model.BusinessLicense;
import com.yoho.order.model.BusinessLicenseReq;
import com.yoho.order.model.BusinessLicenseRsp;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.order.service.IBusinessLicenseService;
import com.yoho.ufo.service.model.PageResponseBO;
/**
* @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(BusinessLicenseReq req) {
BusinessLicense item = new BusinessLicense();
BeanUtils.copyProperties(req, item);
item.setCommitTime(DateUtil.getCurrentTimeSecond());
return businessLicenseMapper.insert(item);
}
@Override
public BusinessLicense getAuditRecord(BusinessLicenseReq req) throws PlatformException {
if(null == req.getUid()) {
throw new PlatformException("用户ID为空", 400);
}
List<BusinessLicense> list = businessLicenseMapper.selectByUid(req.getUid());
return list.get(0);
}
@Override
public PageResponseBO<BusinessLicenseRsp> queryList(BusinessLicenseReq req){
int total = businessLicenseMapper.selectTotalByCondition(req);
if(total == 0) {
return null;
}
List<BusinessLicense> list = businessLicenseMapper.selectByCondition(req);
if(CollectionUtils.isEmpty(list)) {
return null;
}
List<BusinessLicenseRsp> rspList = Lists.newArrayList();
for(BusinessLicense item : list) {
BusinessLicenseRsp rsp = new BusinessLicenseRsp();
rsp.setId(item.getId());
rsp.setUid(item.getUid());
rsp.setBusinessType(item.getBusinessType());
rsp.setBusinessTypeStr(getBusinessTypeStr(item.getBusinessType()));
rsp.setCertName(item.getCertName());
rsp.setCertNo(item.getCertNo());
rsp.setCommitTime(DateUtil.getDateStrBySecond(item.getCommitTime(), "yyyy/MM/dd HH:mm:ss"));
rsp.setAuditStatus(item.getAuditStatus());
rsp.setAuditStatusStr(getAuditStatusStr(item.getAuditStatus()));
rsp.setAuditTime(null == item.getAuditTime() ? "/" : DateUtil.getDateStrBySecond(item.getAuditTime(), "yyyy/MM/dd HH:mm:ss"));
rsp.setRejectReason(StringUtils.isEmpty(item.getRejectReason()) ? "/" : item.getRejectReason());
rspList.add(rsp);
}
PageResponseBO<BusinessLicenseRsp> result=new PageResponseBO<>();
result.setList(rspList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
@Override
public BusinessLicenseRsp getDetail(BusinessLicenseReq req) {
BusinessLicense bl = businessLicenseMapper.selectById(req.getId());
if(null == bl) {
return null;
}
BusinessLicenseRsp rsp = new BusinessLicenseRsp();
BeanUtils.copyProperties(bl, rsp, BusinessLicenseRsp.class);
rsp.setBusinessTypeStr(getBusinessTypeStr(bl.getBusinessType()));
return rsp;
}
private String getBusinessTypeStr(int type) {
if(type == 1) {
return "个体工商户";
}else if(type == 2) {
return "企业法人";
}
return StringUtils.EMPTY;
}
private String getAuditStatusStr(int status) {
if(status == 0) {
return "待审核";
}else if(status == 1) {
return "审核通过";
}else if(status == 2) {
return "审核不通过";
}
return "";
}
}
... ...
... ... @@ -38,6 +38,7 @@ datasources:
- com.yoho.order.dal.QiniuLiveRecordMapper
- com.yoho.order.dal.CameraRecordMapper
- com.yoho.order.dal.UserCameraRecordMapper
- com.yoho.order.dal.BusinessLicenseMapper
ufo_resource:
servers:
... ...
... ... @@ -38,6 +38,7 @@ datasources:
- com.yoho.order.dal.QiniuLiveRecordMapper
- com.yoho.order.dal.CameraRecordMapper
- com.yoho.order.dal.UserCameraRecordMapper
- com.yoho.order.dal.BusinessLicenseMapper
ufo_resource:
servers:
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<style>
.selected{background: #5bc0de; color:#fff; }
</style>
<style type="text/css">
.nav li {float:left; list-style:none;}
.nav li a{float:left;text-decoration:none;padding:0.2em 1.6em;border-right:1px solid white;color:black; font-size:14px;}
</style>
</head>
<body class="easyui-layout">
<div region="north" style="height:230px;">
<script>
document.write(addHead('营业执照认证', '商户入驻资质审核'));
</script>
<div style="margin-left: 10px;margin-top: 30px">
<div style="border:1px solid #ddd;border-radius:5px 5px 5px 5px;">
<div style="margin-left: 10px;margin-top: 20px;margin-bottom: 20px">
<input id="uid" name="uid" />
<input id="businessName" name="businessName" />
<input id="validStatus" name="validStatus" />
<a id="searchBtn" class="btn-info">筛选</a>
<a id="allBtn" class="btn-success">全部</a>
</div>
</div>
</div>
</div>
<div id="businessList" region="center">
<table id="businessListTable"></table>
</div>
<script>
$(function() {
$("#uid").textbox({
prompt: "用户UID",
width: 200
});
$("#businessName").textbox({
prompt: "商家名称",
width: 200
});
$("#validStatus").combobox({
prompt: "入驻状态",
width: 150,
editable : false,
data: [
{"text" : "已入驻", "value" : 1},
{"text" : "已退驻", "value" : 9}
]
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#businessListTable").datagrid("load", {
uid : $("#uid").val(),
businessName : $("#businessName").val(),
validStatus : $("#validStatus").myCombobox("getValue")
});
}
});
//全部按钮
$("#allBtn").linkbutton({
iconCls: "icon-import",
onClick: function () {
$("#uid").textbox('setValue','');
$("#businessName").textbox('setValue','');
$("#validStatus").combobox('setValue','');
}
});
getBusinessList();
});
function getBusinessList(){
$("#businessListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: contextPath + "/businessLicense/queryList",
method: 'POST',
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "UID",
field: "uid",
width: 20,
align: "center"
}, {
title: "商户类型",
field: "businessTypeStr",
width: 20,
align: "center"
}, {
title: "姓名",
field: "certName",
width: 20,
align: "center"
}, {
title: "身份证号",
field: "certNo",
width: 30,
align: "center"
}, {
title: "提交时间",
field: "commitTime",
width: 30,
align: "center"
}, {
title: "审核状态",
field: "auditStatusStr",
width: 20,
align: "center"
}, {
title: "审核时间",
field: "auditTime",
width: 30,
align: "center"
}, {
title: "原因",
field: "rejectReason",
width: 30,
align: "center"
}, {
title: "操作",
field: "asdf",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
var str = "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #428bca !important;'>查看</a>";
if(rowData.auditStatus==0){
str = "<a role='audit' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>审核</a>" + str;
}
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 10,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
$(this).datagrid("getPanel").find("a[role='detail']").linkbutton({
onClick: function () {
var orderCode = $(this).attr("dataId");
window.open(contextPath + "/html/orderManage/detail.html?orderCode=" + orderCode + "&ver=" + new Date().getTime())
}
});
$(this).datagrid("getPanel").find("a[role='audit']").linkbutton({
onClick: function () {
var orderCode = $(this).attr("dataId");
window.open(contextPath + "/html/orderManage/detail.html?orderCode=" + orderCode + "&ver=" + new Date().getTime())
}
});
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...