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