Commit 89d807be by lixian7

Merge remote-tracking branch 'origin/master'

parents 2919089c 45329c1b
......@@ -70,7 +70,7 @@ public class BindInfoControlller extends BaseController {
}
info.setStatus("0");
info.setUnbindTime(DateTime.now().toString());
return mapper.updateById(info) > 0 ? ResponseGenerator.success() : ResponseGenerator.fail("");
return mapper.unbind(info) > 0 ? ResponseGenerator.success() : ResponseGenerator.fail("");
}
/**
......
......@@ -26,7 +26,11 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery;
import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.*;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.DrivingLicenseInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.InsuranceInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ResultList;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.ViolationInfoRes;
import com.hikcreate.edl.pub.web.mobile.infra.model.param.response.YearCheckInfoRes;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -72,7 +76,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper boundQuery = new QueryWrapper();
boundQuery.eq("user_id", info.getPhone());
boundQuery.eq("user_id", info.getUserId());
Integer bound = mapper.selectCount(boundQuery);
if (bound >= 3) {
return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR);
......@@ -90,8 +94,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
if (info.getPlateType() == null || info.getPlateType().equals("")) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR);
}
return mapper.insert(info) > 0 ? ResponseGenerator.success(info.getUnqId()) :
ResponseGenerator.fail(StatusCode.BUSINESS_ERROR);
try {
mapper.insert(info);
return ResponseGenerator.success(info.getUnqId());
} catch (Exception e) {
return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR);
}
}
@Override
......@@ -109,10 +118,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
}
YearCheckInfoRes yearCheckInfoRes = new YearCheckInfoRes();
yearCheckInfoRes.setPlateNum(bindInfo.getPlateNum());
if ( StrUtil.isNotBlank(vehicleRes.getYxqz()) ) {
yearCheckInfoRes.setValidityTime(vehicleRes.getYxqz().substring(0,10));
if (StrUtil.isNotBlank(vehicleRes.getYxqz())) {
yearCheckInfoRes.setValidityTime(vehicleRes.getYxqz().substring(0, 10));
Long checkTime = DateUtil.parse(vehicleRes.getYxqz(), "yyyy-MM-dd HH:mm:ss").getTime();
if ( checkTime >= System.currentTimeMillis() ) {
if (checkTime >= System.currentTimeMillis()) {
yearCheckInfoRes.setStatus("未到期");
} else {
yearCheckInfoRes.setStatus("已到期");
......@@ -237,6 +246,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
result.setPlateNum(drivingLicenseRes.getSfzmhm());
result.setValidityTime(drivingLicenseRes.getYxqz());
result.setStatus(drivingLicenseRes.getZtValue());
result.setSurplusGrade(String.valueOf(12 - Integer.parseInt(drivingLicenseRes.getLjjf())));
return ResponseGenerator.success(result);
}
......
......@@ -19,4 +19,6 @@ public interface BindInfoMapper extends BaseMapper<BindInfo> {
Integer clearPast(DateTime dateTime);
Integer unbind(BindInfo info);
}
package com.hikcreate.edl.pub.web.mobile.infra.model;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 绑定信息实体类
......@@ -56,5 +54,4 @@ public class BindInfo implements Serializable {
private String unbindTime;
}
......@@ -25,5 +25,9 @@ public class DrivingLicenseInfoRes {
* 姓名
*/
private String driverName;
/**
* 剩余计分
*/
private String surplusGrade;
}
<?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.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper">
<insert id="bindInfoInsert" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo">
insert ignore into edl_public.bind_info(unq_id,user_id,phone,plate_color,plate_num,plate_type,gmt_bind_time)
values (#{unqId},#{userId},#{phone},#{plateColor},#{plateNum},#{plateType},#{gmtBindTime})
</insert>
<select id="selectByQuery" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery"
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo">
select b.unq_id, b.user_id, b.phone,
......@@ -29,6 +36,11 @@
</if>
</select>
<update id="unbind">
update edl_public.bind_info as b set b.status="0",b.unbind_time=#{unbindTime} where b.unq_id=#{unqId}
</update>
<delete id="clearPast">
delete from edl_public.bind_info as b where b.unbind_time <![CDATA[ <= ]]> #{dateTime} and b.status='0'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment