Commit 45329c1b by xieshixiang

修改BUG

parent cd0bb81d
...@@ -70,7 +70,7 @@ public class BindInfoControlller extends BaseController { ...@@ -70,7 +70,7 @@ public class BindInfoControlller extends BaseController {
} }
info.setStatus("0"); info.setStatus("0");
info.setUnbindTime(DateTime.now().toString()); info.setUnbindTime(DateTime.now().toString());
return mapper.updateById(info) > 0 ? ResponseGenerator.success() : ResponseGenerator.fail(""); return mapper.unbind(info) > 0 ? ResponseGenerator.success() : ResponseGenerator.fail("");
} }
/** /**
......
...@@ -24,7 +24,11 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.VerifyInfoMapper; ...@@ -24,7 +24,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.BindInfo;
import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery; 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.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 lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -66,7 +70,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -66,7 +70,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆 //判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper boundQuery = new QueryWrapper(); QueryWrapper boundQuery = new QueryWrapper();
boundQuery.eq("user_id", info.getPhone()); boundQuery.eq("user_id", info.getUserId());
Integer bound = mapper.selectCount(boundQuery); Integer bound = mapper.selectCount(boundQuery);
if (bound >= 3) { if (bound >= 3) {
return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR); return ResponseGenerator.fail(StatusCode.BUSINESS_ERROR);
...@@ -84,8 +88,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -84,8 +88,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
if (info.getPlateType() == null || info.getPlateType().equals("")) { if (info.getPlateType() == null || info.getPlateType().equals("")) {
return ResponseGenerator.fail(StatusCode.DATA_ERROR); 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 @Override
...@@ -103,10 +112,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -103,10 +112,10 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
} }
YearCheckInfoRes yearCheckInfoRes = new YearCheckInfoRes(); YearCheckInfoRes yearCheckInfoRes = new YearCheckInfoRes();
yearCheckInfoRes.setPlateNum(bindInfo.getPlateNum()); yearCheckInfoRes.setPlateNum(bindInfo.getPlateNum());
if ( StrUtil.isNotBlank(vehicleRes.getYxqz()) ) { if (StrUtil.isNotBlank(vehicleRes.getYxqz())) {
yearCheckInfoRes.setValidityTime(vehicleRes.getYxqz().substring(0,10)); yearCheckInfoRes.setValidityTime(vehicleRes.getYxqz().substring(0, 10));
Long checkTime = DateUtil.parse(vehicleRes.getYxqz(), "yyyy-MM-dd HH:mm:ss").getTime(); Long checkTime = DateUtil.parse(vehicleRes.getYxqz(), "yyyy-MM-dd HH:mm:ss").getTime();
if ( checkTime >= System.currentTimeMillis() ) { if (checkTime >= System.currentTimeMillis()) {
yearCheckInfoRes.setStatus("未到期"); yearCheckInfoRes.setStatus("未到期");
} else { } else {
yearCheckInfoRes.setStatus("已到期"); yearCheckInfoRes.setStatus("已到期");
...@@ -231,6 +240,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple ...@@ -231,6 +240,7 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
result.setPlateNum(drivingLicenseRes.getSfzmhm()); result.setPlateNum(drivingLicenseRes.getSfzmhm());
result.setValidityTime(drivingLicenseRes.getYxqz()); result.setValidityTime(drivingLicenseRes.getYxqz());
result.setStatus(drivingLicenseRes.getZtValue()); result.setStatus(drivingLicenseRes.getZtValue());
result.setSurplusGrade(String.valueOf(12 - Integer.parseInt(drivingLicenseRes.getLjjf())));
return ResponseGenerator.success(result); return ResponseGenerator.success(result);
} }
......
...@@ -19,4 +19,6 @@ public interface BindInfoMapper extends BaseMapper<BindInfo> { ...@@ -19,4 +19,6 @@ public interface BindInfoMapper extends BaseMapper<BindInfo> {
Integer clearPast(DateTime dateTime); Integer clearPast(DateTime dateTime);
Integer unbind(BindInfo info);
} }
package com.hikcreate.edl.pub.web.mobile.infra.model; package com.hikcreate.edl.pub.web.mobile.infra.model;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 绑定信息实体类 * 绑定信息实体类
...@@ -56,5 +54,4 @@ public class BindInfo implements Serializable { ...@@ -56,5 +54,4 @@ public class BindInfo implements Serializable {
private String unbindTime; private String unbindTime;
} }
...@@ -25,5 +25,9 @@ public class DrivingLicenseInfoRes { ...@@ -25,5 +25,9 @@ public class DrivingLicenseInfoRes {
* 姓名 * 姓名
*/ */
private String driverName; private String driverName;
/**
* 剩余计分
*/
private String surplusGrade;
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <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" <select id="selectByQuery" parameterType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery"
resultType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo"> resultType="com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo">
select b.unq_id, b.user_id, b.phone, select b.unq_id, b.user_id, b.phone,
...@@ -29,6 +36,11 @@ ...@@ -29,6 +36,11 @@
</if> </if>
</select> </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 id="clearPast">
delete from edl_public.bind_info as b where b.unbind_time <![CDATA[ <= ]]> #{dateTime} and b.status='0' 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