Commit b106cfc5 by xieshixiang

返回结果类封装

parent 19deeea7
......@@ -67,7 +67,7 @@ public class BindInfoControlller extends BaseController {
return Result.errorResult(ResultCode.PARAMETER_ERROR);
}
info.setStatus("0");
info.setEditorTime(DateTime.now());
info.setUnbindTime(DateTime.now());
return mapper.updateById(info) > 0 ? Result.successResult() : Result.errorResult();
}
......
......@@ -15,8 +15,10 @@ import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.par
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.VehicleRes;
import com.hikcreate.edl.pub.web.mobile.infra.data.feign.dcp_service_vehicle.param.response.ViolationRes;
import com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper;
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.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;
......@@ -49,12 +51,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
VechicleFeign vechicle;
@Resource
ViolationFeign violatio;
@Resource
VerifyInfoMapper verifyInfo;
@Override
public Result bind(BindInfo info) {
info.setUnqId(UUID.randomUUID().toString());
info.setEditorTime(DateTime.now());
info.setGmtBindTime(DateTime.now());
//判断规则1:用户已绑定的车辆不超过3辆,包括已解绑但未过一个月的车辆
QueryWrapper boundQuery = new QueryWrapper();
......@@ -76,7 +80,8 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
if (info.getPlateType() == null || info.getPlateType().equals("")) {
return Result.errorResult(ResultCode.DATA_ERROR);
}
return mapper.insert(info) > 0 ? Result.successResult(info.getUnqId()) : Result.errorResult();
return mapper.insert(info) > 0 ? Result.successResult(info.getUnqId()) :
Result.errorResult(ResultCode.SERVICE_ERROR);
}
@Override
......@@ -109,10 +114,14 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
req.setPlateNum(bindInfo.getPlateNum());
req.setPlateType(bindInfo.getPlateType());
List<ViolationRes> byPlateNumAndType = violatio.getByPlateNumAndType(req);
List<ViolationInfoRes> violationInfoResList=new ArrayList<>();
for (ViolationRes res : byPlateNumAndType){
List<ViolationInfoRes> violationInfoResList = new ArrayList<>();
for (ViolationRes res : byPlateNumAndType) {
ViolationInfoRes info = new ViolationInfoRes();
BeanUtil.copyProperties(res,info);
info.setPlateNum(res.getHphm());
info.setAction(res.getWfxw());
info.setAddress(res.getWfdz());
info.setGrade(res.getWfjfs());
info.setMoney(res.getfk);
violationInfoResList.add(info);
}
return Result.successResult(new ResultList<>(violationInfoResList));
......@@ -124,7 +133,13 @@ public class BindServiceImpl extends ServiceImpl<BindInfoMapper, BindInfo> imple
if (bindInfo == null || "0".equals(bindInfo.getStatus())) {
return Result.errorResult(ResultCode.DATA_ERROR);
}
return null;
VerifyInfo verifyInfo = this.verifyInfo.checkValidity(query.getPhone(), query.getUserId(),
DateUtil.offsetDay(DateTime.now(), -10));
if (verifyInfo == null) {
}
}
......
package com.hikcreate.edl.pub.web.mobile.infra.data.mapper;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo;
import org.apache.ibatis.annotations.Param;
/**
* 短信验证通过记录信息操作接口
*
* @author: xieshixiang
* @time:2020/6/19 18:34
**/
public interface VerifyInfoMapper extends BaseMapper<VerifyInfo> {
VerifyInfo checkValidity(@Param("phone") String phone,@Param("userId") String userId,@Param("time") DateTime last);
}
......@@ -45,9 +45,13 @@ public class BindInfo implements Serializable {
*/
private String status;
/**
* 信息的编辑时间
* 绑定时间
*/
private DateTime editorTime;
private DateTime gmtBindTime;
/**
* 解绑时间
*/
private DateTime unbindTime;
......
......@@ -10,16 +10,20 @@ import lombok.Data;
public class DrivingLicenseInfoRes {
/**
* 车牌号
*/
private String plateNum;
/**
*有效期止
*/
private String yxqz;
private String validityTime;
/**
* 驾驶证状态
*/
private String zt;
private String status;
/**
* 姓名
*/
private String xm;
private String driverName;
}
package com.hikcreate.edl.pub.web.mobile.infra.model.param.response;
import lombok.Data;
/**
* @author: xieshixiang
* @time:2020/6/19 17:06
**/
@Data
public class InsuranceInfoRes {
/**
* 车牌号
*/
private String plateNum;
/**
* 有效期始
*/
private String yxqs;
private String validityTimeStart;
/**
* 有效期止
*/
private String yxqz;
private String validityTimeEnd;
/**
* 保险状态
*/
private String zt;
private String status;
}
package com.hikcreate.edl.pub.web.mobile.infra.model.param.response;
import lombok.Data;
import java.util.List;
/**
......@@ -8,26 +10,31 @@ import java.util.List;
* @author: xieshixiang
* @time:2020/6/19 16:48
**/
@Data
public class ViolationInfoRes {
/**
* 车牌号
*/
private String plateNum;
/**
* 违法行为
*/
private String wfxw;
private String action;
/**
* 处理时间
*/
private String clsj;
private String time;
/**
* 违法地址
*/
private String wfdz;
private String address;
/**
* 罚款金额
*/
private String fkje;
private String money;
/**
* 违法计分
*/
private String wfjfs;
private String grade;
}
package com.hikcreate.edl.pub.web.mobile.infra.model.param.response;
import lombok.Data;
/**
* 年检信息返回实体类
* @author: xieshixiang
* @time:2020/6/19 16:45
**/
@Data
public class YearCheckInfoRes {
/**
* 车牌号
*/
private String plateNum;
/**
*有效期止
*/
private String yxqz;
private String validityTime;
/**
* 年检状态
*/
private String zt;
private String status;
}
......@@ -20,30 +20,18 @@
when '0' then '未绑定'
when '1' then '已绑定'
end status,
b.plate_num,b.plate_type,b.editor_time from edl_public.bind_info as b where b.status='1'
b.plate_num,b.plate_type,b.gmt_bind_time from edl_public.bind_info as b where b.status='1'
<if test="userId!=null and nuserId!=''">
and b.user_id=#{userId}
</if>
<if test="phone!=null and phone!=''">
and b.phone=#{phone}
</if>
<if test="plateColor!=null and plateColor!=''">
and b.plate_color=#{plateColor}
</if>
<if test="plateNum!=null and plateNum!=''">
and b.plate_num=#{plateNum}
</if>
<if test="plateType!=null and plateType!=''">
and b.plate_type=#{plateType}
</if>
<if test="editorTime!=null ">
and b.editor_time=#{editorTime}
</if>
</select>
<delete id="clearPast">
delete from edl_public.bind_info as b where b.editor_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'
</delete>
</mapper>
<?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.VerifyInfoMapper">
<select id="checkValidity" resultType="com.hikcreate.edl.pub.web.mobile.infra.model.VerifyInfo">
select id, user_id, verify_code, phone,pass_time from edl_public.verify_info as v
where pass_time <![CDATA[ >= ]]> #{time} and phone=#{phone} and user_id=#{userId}
</select>
</mapper>
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