Commit a55aac3d authored by hezhen's avatar hezhen

添加图片上传接口

parent ddef924c
......@@ -7,6 +7,7 @@ public enum ResCode {
INVALID_REST_REQ_PARAM(100000,"rest请求参数非法"),
//车辆信息相关返回码-预定信息
VEHICLE_BOOKED_INFO_ALREADY_CHANGED(101001,"车辆预定信息已更改,请刷新后继续操作"),
......
package com.xxfc.platform.vehicle.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 驾驶人信息表
*/
@Table(name = "vehicle_user_license")
@Data
public class VehicleUserLicense {
@Id
private Integer id;
//用户id
private Long userid;
//手机号
private String phone;
//身份证号
@Column(name = "id_card")
private String idCard;
//驾驶证
private String license;
//正面照
private String img;
//反面照
private String fimg;
//更新时间
@Column(name = "update_time")
private Long updateTime;
private Integer isdel;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.vo;
/**
* 驾驶人信息表
*/
public class VehicleUserLicenseVo {
private Integer id;
//用户id
private Long userid;
//手机号
private String phone;
//身份证号
private String idCard;
//驾驶证
private String license;
//正面照
private String img;
//反面照
private String fimg;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.Campsite;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.dto.AppUserDTO;
import com.xxfc.platform.vehicle.feign.dto.UserDTO;
import com.xxfc.platform.vehicle.mapper.VehicleLicenseMapper;
import com.xxfc.platform.vehicle.vo.PageDataVO;
import com.xxfc.platform.vehicle.vo.VehicleUserLicenseVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import static com.github.wxiaoqi.security.auth.common.constatns.CommonConstants.DATA_ALL_FALSE;
import static com.xxfc.platform.vehicle.constant.DbColumnConstant.COMPANY_ZONE_ID;
import static com.xxfc.platform.vehicle.constant.DbColumnConstant.ID;
@Service
@Slf4j
public class VehicleLicenseBiz extends BaseBiz<VehicleLicenseMapper, VehicleUserLicense> {
//更新
@Transactional
public RestResponse update(VehicleUserLicenseVo licenseVo){
VehicleUserLicense vehicleUserLicense = new VehicleUserLicense();
BeanUtils.copyProperties(licenseVo,vehicleUserLicense);
vehicleUserLicense.setUpdateTime(System.currentTimeMillis()/1000);
if(vehicleUserLicense.getId()==null||vehicleUserLicense.getId()==0){
mapper.insertSelective(vehicleUserLicense);
}else{
mapper.updateByPrimaryKeySelective(vehicleUserLicense);
}
return RestResponse.suc();
}
public PageDataVO<VehicleUserLicense> getAllByUserid(Integer page, Integer limit, Integer userid){
Example example = new Example(VehicleUserLicense.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userid",userid);
example.setOrderByClause("`id` desc");
PageHelper.startPage(page,limit);
PageInfo<VehicleUserLicense> campsitePageInfo = new PageInfo<VehicleUserLicense>(mapper.selectByExample(example));
return PageDataVO.pageInfo(campsitePageInfo);
}
}
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import tk.mybatis.mapper.common.Mapper;
public interface VehicleLicenseMapper extends Mapper<VehicleUserLicense> {
}
\ No newline at end of file
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.xxfc.platform.vehicle.biz.VehicleLicenseBiz;
import com.xxfc.platform.vehicle.biz.VehiclePlatCataBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.common.VehicleBaseController;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.dto.AppUserDTO;
import com.xxfc.platform.vehicle.vo.CataVo;
import com.xxfc.platform.vehicle.vo.PageDataVO;
import com.xxfc.platform.vehicle.vo.VehicleUserLicenseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/user")
@Slf4j
@IgnoreClientToken
public class VehicleLicenseController extends VehicleBaseController<VehicleLicenseBiz> {
@RequestMapping(value = "/license/update", method = RequestMethod.POST)
public RestResponse update(@RequestBody VehicleUserLicenseVo licenseVo) throws Exception {
return baseBiz.update(licenseVo);
}
@RequestMapping(value = "/license/all", method = RequestMethod.POST)
public RestResponse<PageDataVO<VehicleUserLicense>> all(
@RequestParam(value="page",defaultValue="1")Integer page,
@RequestParam(value="limit",defaultValue="10")Integer limit) throws Exception {
AppUserDTO userDTO =getUserInfo();
if(userDTO==null){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
return RestResponse.suc(baseBiz.getAllByUserid( page,limit,userDTO.getId()));
}
}
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