Commit bf0af5f1 authored by unset's avatar unset

修改车辆价格权限问题

parent e93f7d62
...@@ -1402,16 +1402,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1402,16 +1402,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @return * @return
*/ */
public List<Vehicle> getAllVehicleByCompanyId(Integer companyId, Integer modelId) { public List<Vehicle> getAllVehicleByCompanyId(Integer companyId, Integer modelId) {
Example example = new Example(Vehicle.class); Map<String, Object> param = new HashMap<>();
Example.Criteria criteria = example.createCriteria();
if (companyId != null) { if (companyId != null) {
criteria.andEqualTo("subordinateBranch", companyId); param.put("companyId", 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) {
......
...@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz; ...@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface; 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;
...@@ -49,13 +50,17 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap ...@@ -49,13 +50,17 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!");
} }
UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
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(userDTO.getCompanyId(), null);
} }
if (vehicleCommonPriceInfo.getAllModelUse() != null && vehicleCommonPriceInfo.getAllModelUse() == 1) {//所有车型可用 if (vehicleCommonPriceInfo.getAllModelUse() != null && vehicleCommonPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(userDTO.getCompanyId(), 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,8 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,6 +4,8 @@ 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.dto.UserDTO;
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 +35,7 @@ import java.util.*; ...@@ -33,7 +35,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 +58,11 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM ...@@ -56,6 +58,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 +71,17 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM ...@@ -64,13 +71,17 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
if (vehicle == null) { if (vehicle == null) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!"); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "车辆不存在!");
} }
UserDTO userDTO = getAdminUserInfo();
if (userDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
}
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(userDTO.getCompanyId(), null);
} }
if (vehicleHolidayPriceInfo.getAllModelUse() != null && vehicleHolidayPriceInfo.getAllModelUse() == 1) {//所有车型可用 if (vehicleHolidayPriceInfo.getAllModelUse() != null && vehicleHolidayPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null); vehicleList = vehicleBiz.getAllVehicleByCompanyId(userDTO.getCompanyId(), 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,19 @@ ...@@ -762,6 +762,19 @@
ORDER BY parkCompanyName ORDER BY parkCompanyName
</select> </select>
<select id="getAllVehicleByParam" resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select * from vehicle v
LEFT JOIN branch_company bc2 ON v1.subordinate_branch = bc2.id
LEFT JOIN company_info ci on ci.id = bc2.company_id
where v.is_del != 1
<if test="modelId != null and modelId != ''">
and v.model_id = #{modelId}
</if>
<if test="companyId != null and companyId != ''">
and ci.id = #{companyId}
</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