Commit b49c1fae by zhengxj

finish 技工认证 on 20191017 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@24332 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent b06aaf12
......@@ -50,7 +50,8 @@ public interface Constants {
public static final String MECHANIC_STATUS_PASS_CHECK = "sys_user_status_pass_check";
public static final String MECHANIC_STATUS_UNCHECK = "sys_user_status_uncheck";
// 认证中
public static final String SYS_USER_STATUS_CHECKING = "sys_user_status_checking";
/**
* 用户状态
......
......@@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.glsx.common.constants.Constants;
import com.glsx.common.constants.ResultObject;
......@@ -46,6 +47,8 @@ import com.glsx.common.utils.PropertiesUtil;
import com.glsx.common.utils.wehcat.WechatUtils;
import com.glsx.usercenter.constants.ResultCodeEnum;
import com.glsx.usercenter.pojo.sp.ProviderVo;
import com.glsx.usercenter.pojo.user.SysMechanicEntity;
import com.glsx.usercenter.service.IMechanicService;
import com.glsx.usercenter.utils.ShiroUtil;
/**
......@@ -63,6 +66,9 @@ public class MechanicController extends BaseReportController {
@Autowired
private WechatUtils wechatUtils;
@Autowired
private IMechanicService mechanicService;
/**
*
*
......@@ -85,11 +91,33 @@ public class MechanicController extends BaseReportController {
@PostMapping("/verify")
public ResultObject verify(@RequestParam(required = true) String bankCarkImgUrl,
@RequestParam(required = true) String IDCardFrontImgUrl,
@RequestParam(required = true) String IDCardBackImgUrl) {
int userId = ShiroUtil.getUserId();
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), null);
public ResultObject verify(SysMechanicEntity sysMechanicEntity) {
if (StringUtils.isEmpty(sysMechanicEntity.getRealName())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请填写真实姓名!", null);
}
if (StringUtils.isEmpty(sysMechanicEntity.getIdcard())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请填写身份证号!", null);
}
if (StringUtils.isEmpty(sysMechanicEntity.getAddress())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请获取定位位置!", null);
}
if (StringUtils.isEmpty(sysMechanicEntity.getIdcardFront())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请填上传身份证人像面照!", null);
}
if (StringUtils.isEmpty(sysMechanicEntity.getIdcardBack())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请填上传身份证国徽面照!", null);
}
if (0 == sysMechanicEntity.getServiceItemsKey().length) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请选择技能!", null);
}
if (StringUtils.isEmpty(sysMechanicEntity.getBankCardNo())) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "请填写银行卡号!", null);
}
sysMechanicEntity.setUserId(ShiroUtil.getUserId());
mechanicService.verify(sysMechanicEntity);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), "资料已提交,请等待审核!", null);
}
@RequestMapping(value = "/IdCardOcr", method = RequestMethod.POST)
......
package com.glsx.usercenter.mapper;
import com.glsx.usercenter.pojo.user.SysMechanicEntity;
public interface SysMechanicMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysMechanicEntity record);
int insertSelective(SysMechanicEntity record);
SysMechanicEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysMechanicEntity record);
int updateByPrimaryKey(SysMechanicEntity record);
}
\ No newline at end of file
package com.glsx.usercenter.pojo.user;
public class SysMechanicEntity {
private Integer id;
private Integer userId;
private String district;
private String address;
private String workTimeStart;
private String workTimeEnd;
private Byte dispatchType;
private Byte serviceType;
private String idcard;
private String mechanicStatus;
private Byte workStatus;
private Byte sendType;
private String bankCardNo;
private String idcardFront;
private String idcardBack;
private String bankCardImg;
private String realName;
private String[] serviceItemsKey;
public String[] getServiceItemsKey() {
return serviceItemsKey;
}
public void setServiceItemsKey(String[] serviceItemsKey) {
this.serviceItemsKey = serviceItemsKey;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district == null ? null : district.trim();
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address == null ? null : address.trim();
}
public String getWorkTimeStart() {
return workTimeStart;
}
public void setWorkTimeStart(String workTimeStart) {
this.workTimeStart = workTimeStart == null ? null : workTimeStart.trim();
}
public String getWorkTimeEnd() {
return workTimeEnd;
}
public void setWorkTimeEnd(String workTimeEnd) {
this.workTimeEnd = workTimeEnd == null ? null : workTimeEnd.trim();
}
public Byte getDispatchType() {
return dispatchType;
}
public void setDispatchType(Byte dispatchType) {
this.dispatchType = dispatchType;
}
public Byte getServiceType() {
return serviceType;
}
public void setServiceType(Byte serviceType) {
this.serviceType = serviceType;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard == null ? null : idcard.trim();
}
public String getMechanicStatus() {
return mechanicStatus;
}
public void setMechanicStatus(String mechanicStatus) {
this.mechanicStatus = mechanicStatus == null ? null : mechanicStatus.trim();
}
public Byte getWorkStatus() {
return workStatus;
}
public void setWorkStatus(Byte workStatus) {
this.workStatus = workStatus;
}
public Byte getSendType() {
return sendType;
}
public void setSendType(Byte sendType) {
this.sendType = sendType;
}
public String getBankCardNo() {
return bankCardNo;
}
public void setBankCardNo(String bankCardNo) {
this.bankCardNo = bankCardNo == null ? null : bankCardNo.trim();
}
public String getIdcardFront() {
return idcardFront;
}
public void setIdcardFront(String idcardFront) {
this.idcardFront = idcardFront == null ? null : idcardFront.trim();
}
public String getIdcardBack() {
return idcardBack;
}
public void setIdcardBack(String idcardBack) {
this.idcardBack = idcardBack == null ? null : idcardBack.trim();
}
public String getBankCardImg() {
return bankCardImg;
}
public void setBankCardImg(String bankCardImg) {
this.bankCardImg = bankCardImg == null ? null : bankCardImg.trim();
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName == null ? null : realName.trim();
}
}
\ No newline at end of file
/*
* Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
* GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.glsx.usercenter.service;
import com.glsx.usercenter.pojo.user.SysMechanicEntity;
/**
* @ClassName: IMechanicService
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2019年10月17日
*
*/
public interface IMechanicService {
void verify(SysMechanicEntity sysMechanicEntity);
}
/*
* Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
* GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.glsx.usercenter.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.usercenter.constants.Constants;
import com.glsx.usercenter.mapper.DictionaryTypeMapper;
import com.glsx.usercenter.mapper.SysMechanicMapper;
import com.glsx.usercenter.mapper.SysUserServicesMapper;
import com.glsx.usercenter.pojo.user.SysMechanicEntity;
import com.glsx.usercenter.pojo.user.SysUserServices;
import com.glsx.usercenter.service.IMechanicService;
/**
* @ClassName: IMechanicServiceImpl
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2019年10月17日
*
*/
@Service
public class MechanicServiceImpl implements IMechanicService {
@Autowired
private SysMechanicMapper sysMechanicMapper;
@Autowired
private SysUserServicesMapper sysUserServicesMapper;
/**
* 技工认证
*/
@Override
public void verify(SysMechanicEntity sysMechanicEntity) {
// 修改状态,插入资料
sysMechanicEntity.setMechanicStatus(Constants.SYS_USER_STATUS_CHECKING);
sysMechanicMapper.updateByPrimaryKeySelective(sysMechanicEntity);
String[] items = sysMechanicEntity.getServiceItemsKey();
for (int i = 0; i < items.length; i++) {
SysUserServices record = new SysUserServices();
record.setServiceKey(items[i]);
record.setUserId(sysMechanicEntity.getUserId());
sysUserServicesMapper.deleteByUserIdAndServiceId(sysMechanicEntity.getUserId(), items[i]);
sysUserServicesMapper.insertSelective(record);
}
}
}
<?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.glsx.usercenter.mapper.SysMechanicMapper">
<resultMap id="BaseResultMap" type="com.glsx.usercenter.pojo.user.SysMechanicEntity">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="district" jdbcType="VARCHAR" property="district" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="work_time_start" jdbcType="VARCHAR" property="workTimeStart" />
<result column="work_time_end" jdbcType="VARCHAR" property="workTimeEnd" />
<result column="dispatch_type" jdbcType="TINYINT" property="dispatchType" />
<result column="service_type" jdbcType="TINYINT" property="serviceType" />
<result column="IDCard" jdbcType="VARCHAR" property="idcard" />
<result column="mechanic_status" jdbcType="VARCHAR" property="mechanicStatus" />
<result column="work_status" jdbcType="TINYINT" property="workStatus" />
<result column="send_type" jdbcType="TINYINT" property="sendType" />
<result column="bank_card_no" jdbcType="VARCHAR" property="bankCardNo" />
<result column="IDCard_front" jdbcType="VARCHAR" property="idcardFront" />
<result column="IDCard_back" jdbcType="VARCHAR" property="idcardBack" />
<result column="bank_card_img" jdbcType="VARCHAR" property="bankCardImg" />
<result column="real_name" jdbcType="VARCHAR" property="realName" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, district, address, work_time_start, work_time_end, dispatch_type, service_type,
IDCard, mechanic_status, work_status, send_type, bank_card_no, IDCard_front, IDCard_back,
bank_card_img, real_name
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_mechanic
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_mechanic
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys_mechanic (user_id, district, address,
work_time_start, work_time_end, dispatch_type,
service_type, IDCard, mechanic_status,
work_status, send_type, bank_card_no,
IDCard_front, IDCard_back, bank_card_img,
real_name)
values (#{userId,jdbcType=INTEGER}, #{district,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
#{workTimeStart,jdbcType=VARCHAR}, #{workTimeEnd,jdbcType=VARCHAR}, #{dispatchType,jdbcType=TINYINT},
#{serviceType,jdbcType=TINYINT}, #{idcard,jdbcType=VARCHAR}, #{mechanicStatus,jdbcType=VARCHAR},
#{workStatus,jdbcType=TINYINT}, #{sendType,jdbcType=TINYINT}, #{bankCardNo,jdbcType=VARCHAR},
#{idcardFront,jdbcType=VARCHAR}, #{idcardBack,jdbcType=VARCHAR}, #{bankCardImg,jdbcType=VARCHAR},
#{realName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys_mechanic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="district != null">
district,
</if>
<if test="address != null">
address,
</if>
<if test="workTimeStart != null">
work_time_start,
</if>
<if test="workTimeEnd != null">
work_time_end,
</if>
<if test="dispatchType != null">
dispatch_type,
</if>
<if test="serviceType != null">
service_type,
</if>
<if test="idcard != null">
IDCard,
</if>
<if test="mechanicStatus != null">
mechanic_status,
</if>
<if test="workStatus != null">
work_status,
</if>
<if test="sendType != null">
send_type,
</if>
<if test="bankCardNo != null">
bank_card_no,
</if>
<if test="idcardFront != null">
IDCard_front,
</if>
<if test="idcardBack != null">
IDCard_back,
</if>
<if test="bankCardImg != null">
bank_card_img,
</if>
<if test="realName != null">
real_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="district != null">
#{district,jdbcType=VARCHAR},
</if>
<if test="address != null">
#{address,jdbcType=VARCHAR},
</if>
<if test="workTimeStart != null">
#{workTimeStart,jdbcType=VARCHAR},
</if>
<if test="workTimeEnd != null">
#{workTimeEnd,jdbcType=VARCHAR},
</if>
<if test="dispatchType != null">
#{dispatchType,jdbcType=TINYINT},
</if>
<if test="serviceType != null">
#{serviceType,jdbcType=TINYINT},
</if>
<if test="idcard != null">
#{idcard,jdbcType=VARCHAR},
</if>
<if test="mechanicStatus != null">
#{mechanicStatus,jdbcType=VARCHAR},
</if>
<if test="workStatus != null">
#{workStatus,jdbcType=TINYINT},
</if>
<if test="sendType != null">
#{sendType,jdbcType=TINYINT},
</if>
<if test="bankCardNo != null">
#{bankCardNo,jdbcType=VARCHAR},
</if>
<if test="idcardFront != null">
#{idcardFront,jdbcType=VARCHAR},
</if>
<if test="idcardBack != null">
#{idcardBack,jdbcType=VARCHAR},
</if>
<if test="bankCardImg != null">
#{bankCardImg,jdbcType=VARCHAR},
</if>
<if test="realName != null">
#{realName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
update sys_mechanic
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="district != null">
district = #{district,jdbcType=VARCHAR},
</if>
<if test="address != null">
address = #{address,jdbcType=VARCHAR},
</if>
<if test="workTimeStart != null">
work_time_start = #{workTimeStart,jdbcType=VARCHAR},
</if>
<if test="workTimeEnd != null">
work_time_end = #{workTimeEnd,jdbcType=VARCHAR},
</if>
<if test="dispatchType != null">
dispatch_type = #{dispatchType,jdbcType=TINYINT},
</if>
<if test="serviceType != null">
service_type = #{serviceType,jdbcType=TINYINT},
</if>
<if test="idcard != null">
IDCard = #{idcard,jdbcType=VARCHAR},
</if>
<if test="mechanicStatus != null">
mechanic_status = #{mechanicStatus,jdbcType=VARCHAR},
</if>
<if test="workStatus != null">
work_status = #{workStatus,jdbcType=TINYINT},
</if>
<if test="sendType != null">
send_type = #{sendType,jdbcType=TINYINT},
</if>
<if test="bankCardNo != null">
bank_card_no = #{bankCardNo,jdbcType=VARCHAR},
</if>
<if test="idcardFront != null">
IDCard_front = #{idcardFront,jdbcType=VARCHAR},
</if>
<if test="idcardBack != null">
IDCard_back = #{idcardBack,jdbcType=VARCHAR},
</if>
<if test="bankCardImg != null">
bank_card_img = #{bankCardImg,jdbcType=VARCHAR},
</if>
<if test="realName != null">
real_name = #{realName,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
update sys_mechanic
set user_id = #{userId,jdbcType=INTEGER},
district = #{district,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
work_time_start = #{workTimeStart,jdbcType=VARCHAR},
work_time_end = #{workTimeEnd,jdbcType=VARCHAR},
dispatch_type = #{dispatchType,jdbcType=TINYINT},
service_type = #{serviceType,jdbcType=TINYINT},
IDCard = #{idcard,jdbcType=VARCHAR},
mechanic_status = #{mechanicStatus,jdbcType=VARCHAR},
work_status = #{workStatus,jdbcType=TINYINT},
send_type = #{sendType,jdbcType=TINYINT},
bank_card_no = #{bankCardNo,jdbcType=VARCHAR},
IDCard_front = #{idcardFront,jdbcType=VARCHAR},
IDCard_back = #{idcardBack,jdbcType=VARCHAR},
bank_card_img = #{bankCardImg,jdbcType=VARCHAR},
real_name = #{realName,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!