Commit bf0af5f1 authored by unset's avatar unset

修改车辆价格权限问题

parent e93f7d62
......@@ -1402,16 +1402,14 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
* @return
*/
public List<Vehicle> getAllVehicleByCompanyId(Integer companyId, Integer modelId) {
Example example = new Example(Vehicle.class);
Example.Criteria criteria = example.createCriteria();
Map<String, Object> param = new HashMap<>();
if (companyId != null) {
criteria.andEqualTo("subordinateBranch", companyId);
param.put("companyId", companyId);
}
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) {
......
......@@ -3,6 +3,7 @@ package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
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.msg.ObjectRestResponse;
......@@ -49,13 +50,17 @@ public class VehicleCommonPriceInfoBiz extends BaseBiz<VehicleCommonPriceInfoMap
if (vehicle == null) {
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());
List<Vehicle> vehicleList = null;
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) {//所有车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null);
if (vehicleCommonPriceInfo.getAllModelUse() != null && vehicleCommonPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(userDTO.getCompanyId(), vehicle.getModelId());
}
if (vehicleList == null || vehicleList.size() <= 0) { //单个车辆可用
VehicleCommonPriceInfo oldValue = getByVehicleId(vehicleCommonPriceInfo.getVehicleId());
......
......@@ -4,6 +4,8 @@ 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.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.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
......@@ -33,7 +35,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 +58,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 +71,17 @@ public class VehicleHolidayPriceInfoBiz extends BaseBiz<VehicleHolidayPriceInfoM
if (vehicle == null) {
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());
List<Vehicle> vehicleList = null;
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) {//所有车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(vehicle.getSubordinateBranch(), null);
if (vehicleHolidayPriceInfo.getAllModelUse() != null && vehicleHolidayPriceInfo.getAllModelUse() == 1) {//车型可用
vehicleList = vehicleBiz.getAllVehicleByCompanyId(userDTO.getCompanyId(), 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,19 @@
ORDER BY parkCompanyName
</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"
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