Commit 4afac4ca authored by jiaorz's avatar jiaorz

发现排序

parent dd61298a
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date; import java.util.Date;
/** /**
...@@ -12,6 +13,7 @@ import java.util.Date; ...@@ -12,6 +13,7 @@ import java.util.Date;
* *
*/ */
@Data @Data
@Table(name = "vehicle_warning_msg")
public class VehicleWarningMsg { public class VehicleWarningMsg {
@Id @Id
......
...@@ -11,5 +11,7 @@ import java.util.List; ...@@ -11,5 +11,7 @@ import java.util.List;
public class VehicleAndModelInfoVo extends Vehicle { public class VehicleAndModelInfoVo extends Vehicle {
VehicleModel vehicleModel; VehicleModel vehicleModel;
List<VehicleBookRecord> vehicleBookRecord; List<VehicleBookRecord> vehicleBookRecord;
private String endCompanyName; private String parkCompanyName;
private String subordinateBranchName;
private String destinationBranchCompanyName;
} }
...@@ -1090,9 +1090,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -1090,9 +1090,17 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
Query query = new Query(vehiclePlanDto); Query query = new Query(vehiclePlanDto);
PageDataVO<VehicleAndModelInfoVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getAllVehicle(query.getSuper())); PageDataVO<VehicleAndModelInfoVo> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.getAllVehicle(query.getSuper()));
for(VehicleAndModelInfoVo vehicleAndModelInfoVo : pageDataVO.getData()) { for(VehicleAndModelInfoVo vehicleAndModelInfoVo : pageDataVO.getData()) {
CompanyDetail restResponse = branchCompanyBiz.getDetailById(vehicleAndModelInfoVo.getParkBranchCompanyId()); CompanyDetail partCompany = branchCompanyBiz.getDetailById(vehicleAndModelInfoVo.getParkBranchCompanyId());
if(restResponse != null) { if(partCompany != null) {
vehicleAndModelInfoVo.setEndCompanyName(restResponse.getName()); vehicleAndModelInfoVo.setParkCompanyName(partCompany.getName());
}
CompanyDetail subCompany = branchCompanyBiz.getDetailById(vehicleAndModelInfoVo.getSubordinateBranch());
if(subCompany != null) {
vehicleAndModelInfoVo.setSubordinateBranchName(subCompany.getName());
}
CompanyDetail disCompany = branchCompanyBiz.getDetailById(vehicleAndModelInfoVo.getExpectDestinationBranchCompanyId());
if(disCompany != null) {
vehicleAndModelInfoVo.setDestinationBranchCompanyName(disCompany.getName());
} }
} }
......
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.RedisKey; import com.xxfc.platform.vehicle.constant.RedisKey;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.constant.VehicleMsgStatus; import com.xxfc.platform.vehicle.constant.VehicleMsgStatus;
import com.xxfc.platform.vehicle.constant.VehicleMsgType; import com.xxfc.platform.vehicle.constant.VehicleMsgType;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
...@@ -84,14 +88,22 @@ public class VehicleWarningMsgBiz extends BaseBiz<VehicleWarningMsgMapper, Vehic ...@@ -84,14 +88,22 @@ public class VehicleWarningMsgBiz extends BaseBiz<VehicleWarningMsgMapper, Vehic
/** /**
* 按页查询 * 按页查询
* @param queryVehicleWarningMsgVo * @param
* @return * @return
*/ */
public PageDataVO<VehicleWarningMsg> getByPage(QueryVehicleWarningMsgVo queryVehicleWarningMsgVo){ public RestResponse<PageDataVO<VehicleWarningMsg>> getByPage(String queryVehicleWarningMsgVoJson){
PageHelper.startPage(queryVehicleWarningMsgVo.getPage(),queryVehicleWarningMsgVo.getLimit()); try {
List<VehicleWarningMsg> vehicleWarningMsgs = mapper.getByPages(queryVehicleWarningMsgVo); QueryVehicleWarningMsgVo queryVehicleWarningMsgVo = JSON.parseObject(queryVehicleWarningMsgVoJson, QueryVehicleWarningMsgVo.class);
PageInfo<VehicleWarningMsg> vehicleWarningMsgPageInfo = new PageInfo<>(vehicleWarningMsgs); PageHelper.startPage(queryVehicleWarningMsgVo.getPage(),queryVehicleWarningMsgVo.getLimit());
return PageDataVO.pageInfo(vehicleWarningMsgPageInfo); List<VehicleWarningMsg> vehicleWarningMsgs = mapper.getByPages(queryVehicleWarningMsgVo);
PageInfo<VehicleWarningMsg> vehicleWarningMsgPageInfo = new PageInfo<>(vehicleWarningMsgs);
return RestResponse.data(PageDataVO.pageInfo(vehicleWarningMsgPageInfo));
} catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
} }
/** /**
......
package com.xxfc.platform.vehicle.common; package com.xxfc.platform.vehicle.common;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Slf4j @Slf4j
public class BaseController<Biz extends BaseBiz> { public class BaseController<Biz extends BaseBiz> {
@Autowired @Autowired
protected HttpServletRequest request; protected HttpServletRequest request;
@Autowired @Autowired
@Lazy
protected Biz baseBiz; protected Biz baseBiz;
} }
package com.xxfc.platform.vehicle.rest; package com.xxfc.platform.vehicle.rest;
import com.alibaba.fastjson.JSON; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.alibaba.fastjson.JSONException; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.xxfc.platform.vehicle.biz.VehicleWarningMsgBiz; import com.xxfc.platform.vehicle.biz.VehicleWarningMsgBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.common.CustomIllegalParamException;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleWarningMsg; import com.xxfc.platform.vehicle.entity.VehicleWarningMsg;
import com.xxfc.platform.vehicle.pojo.AddVehicleWarningMsgVo; import com.xxfc.platform.vehicle.pojo.AddVehicleWarningMsgVo;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.pojo.QueryVehicleWarningMsgVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
...@@ -20,37 +15,32 @@ import java.util.Map; ...@@ -20,37 +15,32 @@ import java.util.Map;
@RestController @RestController
@RequestMapping("/vehicleWarningMsg") @RequestMapping("/vehicleWarningMsg")
@IgnoreClientToken
@Slf4j @Slf4j
public class VehicleWarningMsgController extends BaseController<VehicleWarningMsgBiz> { public class VehicleWarningMsgController{
@Autowired
VehicleWarningMsgBiz vehicleWarningMsgBiz;
@RequestMapping(value ="{id}",method = RequestMethod.GET) @RequestMapping(value ="{id}",method = RequestMethod.GET)
private RestResponse<VehicleWarningMsg> get(@PathVariable Integer id) throws Exception{ private RestResponse<VehicleWarningMsg> get(@PathVariable Integer id) throws Exception{
return RestResponse.codeAndData(RestResponse.SUC_CODE,baseBiz.selectById(id)); return RestResponse.codeAndData(RestResponse.SUC_CODE,vehicleWarningMsgBiz.selectById(id));
} }
@RequestMapping(value ="page",method = RequestMethod.GET) @RequestMapping(value ="page",method = RequestMethod.GET)
@IgnoreUserToken
private RestResponse<PageDataVO<VehicleWarningMsg>> getByPage(@RequestParam String queryVehicleWarningMsgVoJson) throws Exception{ private RestResponse<PageDataVO<VehicleWarningMsg>> getByPage(@RequestParam String queryVehicleWarningMsgVoJson) throws Exception{
QueryVehicleWarningMsgVo queryVehicleWarningMsgVo = null; return vehicleWarningMsgBiz.getByPage(queryVehicleWarningMsgVoJson);
try {
queryVehicleWarningMsgVo = JSON.parseObject(queryVehicleWarningMsgVoJson, QueryVehicleWarningMsgVo.class);
return RestResponse.data(baseBiz.getByPage(queryVehicleWarningMsgVo));
} catch (JSONException ex) {
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
} catch (CustomIllegalParamException ex){
return RestResponse.code(ResCode.INVALID_REST_REQ_PARAM.getCode());
}
} }
@RequestMapping(value ="",method = RequestMethod.POST) @RequestMapping(value ="",method = RequestMethod.POST)
private RestResponse<Integer> add(@RequestBody AddVehicleWarningMsgVo addVehicleWarningMsgVo) throws Exception{ private RestResponse<Integer> add(@RequestBody AddVehicleWarningMsgVo addVehicleWarningMsgVo) throws Exception{
new RestResponse<Map>().setData(new HashMap<String, Object>()); new RestResponse<Map>().setData(new HashMap<String, Object>());
return baseBiz.add(addVehicleWarningMsgVo); return vehicleWarningMsgBiz.add(addVehicleWarningMsgVo);
} }
@RequestMapping(value ="deal/{id}",method = RequestMethod.PUT) @RequestMapping(value ="deal/{id}",method = RequestMethod.PUT)
private RestResponse deal(@PathVariable Integer id) throws Exception{ private RestResponse deal(@PathVariable Integer id) throws Exception{
return baseBiz.deal(id); return vehicleWarningMsgBiz.deal(id);
} }
} }
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