Commit 1db7315e authored by unset's avatar unset

Merge branch 'master-vehicle-price' into dev-tiande

# Conflicts:
#	xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
parents 98f6cc3b 05633fad
package com.xxfc.platform.vehicle.entity; package com.xxfc.platform.vehicle.entity;
import com.github.wxiaoqi.security.common.vo.DataInter;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
...@@ -21,7 +20,7 @@ import java.util.Date; ...@@ -21,7 +20,7 @@ import java.util.Date;
*/ */
@Data @Data
@Table(name = "vehicle_common_price_info") @Table(name = "vehicle_common_price_info")
public class VehicleCommonPriceInfo implements Serializable { public class VehicleCommonPriceInfo implements Serializable, DataInter {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
...@@ -112,4 +111,9 @@ public class VehicleCommonPriceInfo implements Serializable { ...@@ -112,4 +111,9 @@ public class VehicleCommonPriceInfo implements Serializable {
@Column(name = "is_del") @Column(name = "is_del")
private Integer isDel; private Integer isDel;
@Transient
List<Integer> dataCompanyIds;
@Transient
List<Integer> dataCorporationIds;
} }
package com.xxfc.platform.vehicle.entity; package com.xxfc.platform.vehicle.entity;
import com.github.wxiaoqi.security.common.vo.DataInter;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -7,6 +8,7 @@ import javax.persistence.*; ...@@ -7,6 +8,7 @@ import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
...@@ -18,7 +20,7 @@ import java.util.Date; ...@@ -18,7 +20,7 @@ import java.util.Date;
*/ */
@Data @Data
@Table(name = "vehicle_holiday_price_info") @Table(name = "vehicle_holiday_price_info")
public class VehicleHolidayPriceInfo implements Serializable { public class VehicleHolidayPriceInfo implements Serializable, DataInter {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
...@@ -121,4 +123,10 @@ public class VehicleHolidayPriceInfo implements Serializable { ...@@ -121,4 +123,10 @@ public class VehicleHolidayPriceInfo implements Serializable {
@Transient @Transient
private String endTime; private String endTime;
@Transient
List<Integer> dataCompanyIds;
@Transient
List<Integer> dataCorporationIds;
} }
...@@ -1398,20 +1398,18 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1398,20 +1398,18 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
/** /**
* 获取所属公司所有车辆 * 获取所属公司所有车辆
* @param companyId * @param companyIds
* @return * @return
*/ */
public List<Vehicle> getAllVehicleByCompanyId(Integer companyId, Integer modelId) { public List<Vehicle> getAllVehicleByCompanyId(List<Integer> companyIds, Integer modelId) {
Example example = new Example(Vehicle.class); Map<String, Object> param = new HashMap<>();
Example.Criteria criteria = example.createCriteria(); if (companyIds != null) {
if (companyId != null) { param.put("companyIds", companyIds);
criteria.andEqualTo("subordinateBranch", companyId);
} }
if (modelId != null) { if (modelId != null) {
criteria.andEqualTo("modelId", modelId); param.put("modelId", modelId);
} }
criteria.andEqualTo("isDel", 0); return mapper.getAllVehicleByParam(param);
return mapper.selectByExample(example);
} }
public ObjectRestResponse<PageDataVO<VehicleAndModelInfoVo>> getVehicle(VehiclePlanDto vehiclePlanDto) { public ObjectRestResponse<PageDataVO<VehicleAndModelInfoVo>> getVehicle(VehiclePlanDto vehiclePlanDto) {
......
...@@ -41,6 +41,7 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap ...@@ -41,6 +41,7 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap
public UserFeign getUserFeign() { public UserFeign getUserFeign() {
return userFeign; return userFeign;
} }
public ObjectRestResponse<VehicleCommonPriceInfo> addOrUpdate(VehicleCommonPriceInfo vehicleCommonPriceInfo) { public ObjectRestResponse<VehicleCommonPriceInfo> addOrUpdate(VehicleCommonPriceInfo vehicleCommonPriceInfo) {
if (vehicleCommonPriceInfo == null) { if (vehicleCommonPriceInfo == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
...@@ -49,13 +50,14 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap ...@@ -49,13 +50,14 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!");
} }
setPowerData(vehicleCommonPriceInfo);
vehicleCommonPriceInfo.setCompanyId(vehicle.getSubordinateBranch()); vehicleCommonPriceInfo.setCompanyId(vehicle.getSubordinateBranch());
List<Vehicle> vehicleList = null; List<Vehicle> vehicleList = null;
if (vehicleCommonPriceInfo.getAllVehicleUse() != null && vehicleCommonPriceInfo.getAllVehicleUse() == 1) {//所有车辆可用 if (vehicleCommonPriceInfo.getAllVehicleUse() != null && vehicleCommonPriceInfo.getAllVehicleUse() == 1) {//所有车辆可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicleCommonPriceInfo.getDataCompanyIds(), null);
} }
if (vehicleCommonPriceInfo.getAllModelUse() != null && vehicleCommonPriceInfo.getAllModelUse() == 1) {//所有车型可用 if (vehicleCommonPriceInfo.getAllModelUse() != null && vehicleCommonPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicleCommonPriceInfo.getDataCompanyIds(), vehicle.getModelId());
} }
if (vehicleList == null || vehicleList.size() <= 0) { //单个车辆可用 if (vehicleList == null || vehicleList.size() <= 0) { //单个车辆可用
VehicleCommonPriceInfo oldValue = getByVehicleId(vehicleCommonPriceInfo.getVehicleId()); VehicleCommonPriceInfo oldValue = getByVehicleId(vehicleCommonPriceInfo.getVehicleId());
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember; import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
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 com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
...@@ -33,7 +34,7 @@ import java.util.*; ...@@ -33,7 +34,7 @@ import java.util.*;
*/ */
@Service @Service
@Slf4j @Slf4j
public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoMapper, VehicleHolidayPriceInfo> { public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoMapper, VehicleHolidayPriceInfo> implements UserRestInterface {
private static final Integer DEFAULT_DISCOUNT = 100; private static final Integer DEFAULT_DISCOUNT = 100;
private static final Integer DEFAULT_FREE_DAYS = 1; private static final Integer DEFAULT_FREE_DAYS = 1;
private static final Integer DEFAULT_MEMBER_LEVEL = 0; private static final Integer DEFAULT_MEMBER_LEVEL = 0;
...@@ -56,6 +57,11 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM ...@@ -56,6 +57,11 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
@Autowired @Autowired
VehicleCommonPriceInfoBiz vehicleCommonPriceInfoBiz; VehicleCommonPriceInfoBiz vehicleCommonPriceInfoBiz;
@Override
public UserFeign getUserFeign() {
return userFeign;
}
public ObjectRestResponse addOrUpdate(VehicleHolidayPriceInfo vehicleHolidayPriceInfo ) { public ObjectRestResponse addOrUpdate(VehicleHolidayPriceInfo vehicleHolidayPriceInfo ) {
if (vehicleHolidayPriceInfo == null) { if (vehicleHolidayPriceInfo == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
...@@ -64,13 +70,14 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM ...@@ -64,13 +70,14 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!");
} }
setPowerData(vehicleHolidayPriceInfo);
vehicleHolidayPriceInfo.setCompanyId(vehicle.getSubordinateBranch()); vehicleHolidayPriceInfo.setCompanyId(vehicle.getSubordinateBranch());
List<Vehicle> vehicleList = null; List<Vehicle> vehicleList = null;
if (vehicleHolidayPriceInfo.getAllVehicleUse() != null && vehicleHolidayPriceInfo.getAllVehicleUse() == 1) {//所有车辆可用 if (vehicleHolidayPriceInfo.getAllVehicleUse() != null && vehicleHolidayPriceInfo.getAllVehicleUse() == 1) {//所有车辆可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicleHolidayPriceInfo.getDataCompanyIds(), null);
} }
if (vehicleHolidayPriceInfo.getAllModelUse() != null && vehicleHolidayPriceInfo.getAllModelUse() == 1) {//所有车型可用 if (vehicleHolidayPriceInfo.getAllModelUse() != null && vehicleHolidayPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicleHolidayPriceInfo.getDataCompanyIds(), vehicle.getModelId());
} }
if (vehicleList == null || vehicleList.size() <= 0) { //单个车辆可用 if (vehicleList == null || vehicleList.size() <= 0) { //单个车辆可用
deleteAllVehiclePrice(vehicleHolidayPriceInfo.getVehicleId(), vehicleHolidayPriceInfo.getFestivalId()); deleteAllVehiclePrice(vehicleHolidayPriceInfo.getVehicleId(), vehicleHolidayPriceInfo.getFestivalId());
......
...@@ -55,4 +55,6 @@ public interface VehicleMapper extends Mapper<Vehicle> { ...@@ -55,4 +55,6 @@ public interface VehicleMapper extends Mapper<Vehicle> {
List<String> findExistVehicleIds(); List<String> findExistVehicleIds();
List<BranchCompanyVehicleCountVo> getAllVehicleInfo(); List<BranchCompanyVehicleCountVo> getAllVehicleInfo();
List<Vehicle> getAllVehicleByParam(Map<String, Object> param);
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("vehicleCommonPriceInfo") @RequestMapping("vehicleCommonPriceInfo")
public class VehicleCommonPriceInfoController extends BaseController<VehicleCommonPriceInfoBiz,VehicleCommonPriceInfo> { public class VehicleCommonPriceInfoController extends BaseController<VehicleCommonPriceInfoBiz,VehicleCommonPriceInfo>{
@PostMapping(value = "/admin/addOrUpdate") @PostMapping(value = "/admin/addOrUpdate")
public ObjectRestResponse saveOrUpdate(@RequestBody VehicleCommonPriceInfo vehicleCommonPriceInfo) { public ObjectRestResponse saveOrUpdate(@RequestBody VehicleCommonPriceInfo vehicleCommonPriceInfo) {
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
<if test="companyId !=null "> <if test="companyId !=null ">
and ( ci.id = #{companyId}) and ( ci.id = #{companyId})
</if> </if>
<if test="numberPlate != null"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate = #{numberPlate} and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
and v.is_del = 0 and v.is_del = 0
</where> </where>
......
...@@ -762,6 +762,20 @@ ...@@ -762,6 +762,20 @@
ORDER BY parkCompanyName ORDER BY parkCompanyName
</select> </select>
<select id="getAllVehicleByParam" resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select * from vehicle v
where v.is_del != 1
<if test="modelId != null and modelId != ''">
and v.model_id = #{modelId}
</if>
<if test="companyIds != null and companyIds.size > 0">
and v.subordinate_branch in
<foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="countVehicleByParam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto" <select id="countVehicleByParam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
resultType="com.xxfc.platform.vehicle.pojo.VehicleCountVo"> resultType="com.xxfc.platform.vehicle.pojo.VehicleCountVo">
SELECT count(*) total , SELECT count(*) total ,
......
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