Commit 4b063f3c authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents 21947f63 0bae592c
......@@ -247,4 +247,15 @@ public class AuthController {
return authService.checkToken(token);
}
@RequestMapping(value = "/updUsername", method = RequestMethod.POST)
public ObjectRestResponse updUsername(@RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
HttpServletRequest request)throws Exception {
log.info(username + "----require updUsername...");
String token = request.getHeader(tokenHeader);
return appAuthService.updUsername(username, mobilecode, token);
}
}
......@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.configuration.FeignConfiguration;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -78,4 +80,8 @@ public interface IUserService {
@PostMapping("/api/app/imi/login")
String loginImiWithToken();
@ApiModelProperty("修改手机号码")
@GetMapping("/api/app/updUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "username") String username, @RequestParam(value = "mobilecode") String mobilecode, @RequestParam(value = "userId",defaultValue = "0") Integer userId);
}
......@@ -6,6 +6,8 @@ import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
public interface AuthService {
String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
......@@ -39,4 +41,6 @@ public interface AuthService {
String loginImiWithToken();
ObjectRestResponse checkToken(String token);
ObjectRestResponse updUsername(String username, String mobilecode, String token);
}
......@@ -13,10 +13,13 @@ import com.github.wxiaoqi.security.common.constant.RequestTypeConstants;
import com.github.wxiaoqi.security.common.exception.auth.UserInvalidException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
/**
* @author keliii
*/
......@@ -138,4 +141,27 @@ public class AppAuthServiceImpl implements AuthService {
}
@Override
public ObjectRestResponse updUsername(String username, String mobilecode, String token) {
if (StringUtils.isEmpty(token)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"token不能为空");
}
try {
IJWTInfo ijwtInfo=jwtTokenUtil.getInfoFromToken(token);
if (ijwtInfo==null){
return ObjectRestResponse.createFailedResult(10009,"token失效");
}
Integer userId= Integer.parseInt(ijwtInfo.getId());
ObjectRestResponse objectRestResponse=userService.updUsername(username,mobilecode,userId);
if (objectRestResponse.getStatus()==ResultCode.SUCCESS_CODE){
token=getToken(username,userId);
objectRestResponse.setData(token);
}
return objectRestResponse;
}catch (Exception e){
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"操作失败");
}
}
}
......@@ -134,4 +134,27 @@ public class AuthServiceImpl implements AuthService {
}
}
@Override
public ObjectRestResponse updUsername(String username, String mobilecode, String token) {
if (StringUtils.isEmpty(token)){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"token不能为空");
}
try {
IJWTInfo ijwtInfo=jwtTokenUtil.getInfoFromToken(token);
if (ijwtInfo==null){
return ObjectRestResponse.createFailedResult(10009,"token失效");
}
Integer userId= Integer.parseInt(ijwtInfo.getId());
ObjectRestResponse objectRestResponse=userService.updUsername(username,mobilecode,userId);
if (objectRestResponse.getStatus()==ResultCode.SUCCESS_CODE){
token=getToken(username,userId);
objectRestResponse.setData(token);
}
return objectRestResponse;
}catch (Exception e){
e.printStackTrace();
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"操作失败");
}
}
}
......@@ -5,11 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.rpc.service.PermissionService;
import com.github.wxiaoqi.security.admin.vo.ImiVo;
import com.github.wxiaoqi.security.api.vo.authority.PermissionInfo;
import com.github.wxiaoqi.security.api.vo.user.AppUserInfo;
import com.github.wxiaoqi.security.api.vo.user.UserInfo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
......@@ -257,15 +255,25 @@ public class AppUserRest {
@ApiModelProperty("检查手机号验证码")
@GetMapping("/unauth/checkMobilecode")
public ObjectRestResponse checkMobilecode(@RequestParam(value = "phone") String phone,
@RequestParam(value = "mobilecode") String mobilecode){
if (StringUtils.isBlank(phone)||StringUtils.isBlank(mobilecode)){
@RequestParam(value = "mobilecode") String mobilecode) {
if (StringUtils.isBlank(phone) || StringUtils.isBlank(mobilecode)) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
String redisKey=appPermissionService.checkCodeByUsername(phone,mobilecode);
if (StringUtils.isBlank(redisKey)){
String redisKey = appPermissionService.checkCodeByUsername(phone, mobilecode);
if (StringUtils.isBlank(redisKey)) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "验证码错误");
}
return ObjectRestResponse.succ();
}
@ApiModelProperty("修改手机号码")
@GetMapping("/updUsername")
public ObjectRestResponse updUsername(@RequestParam(value = "username") String username,
@RequestParam(value = "mobilecode") String mobilecode,
@RequestParam(value = "userId",defaultValue = "0") Integer userId){
return appPermissionService.updUsername(userId,username,mobilecode);
}
......
package com.github.wxiaoqi.security.admin.rpc.service;
import cn.hutool.json.JSONUtil;
import com.ace.cache.annotation.CacheClear;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.constant.RedisKey;
......@@ -1134,4 +1135,26 @@ public class AppPermissionService {
public static final String CITY_NAME = "city";
}
//修改手机号码
public ObjectRestResponse updUsername(Integer userId,String username,String mobileCode){
if (StringUtils.isBlank(username)||StringUtils.isBlank(mobileCode)||userId==0||userId==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE,"参数不能为空");
}
if (StringUtils.isBlank(checkCodeByUsername(username,mobileCode))){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"验证码错误");
}
log.info("----updUsername----userId==="+userId+"---username==="+username);
// 是否已存在
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
if (null != user) {
return ObjectRestResponse.createFailedResult(ResultCode.EXIST_CODE, "用户已存在");
}
AppUserLogin userLogin=new AppUserLogin();
userLogin.setId(userId);
userLogin.setUsername(username);
appUserLoginBiz.disable(userLogin);
return ObjectRestResponse.succ();
}
}
......@@ -19,13 +19,18 @@ import java.util.List;
public class VehicleItemDTO extends OrderItem {
public static final int topNum = 2;
public BigDecimal calculateVehicleUnitPrice(BigDecimal vehicleAmount, BigDecimal metaVehicleAmount, Boolean isSetRealAmount) {
BigDecimal unitPrice = vehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
BigDecimal metaUnitPrice = metaVehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
if(isSetRealAmount) {
setRealAmount(vehicleAmount);
}
BigDecimal unitPrice = BigDecimal.ZERO;
BigDecimal metaUnitPrice = BigDecimal.ZERO;
if(getCalculateNum() > 0) {
unitPrice = vehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
metaUnitPrice = metaVehicleAmount.divide(new BigDecimal(getCalculateNum()+ ""), 2, RoundingMode.HALF_UP);
}
setUnitPrice(unitPrice);
setMetaUnitPrice(metaUnitPrice);
......
......@@ -72,7 +72,7 @@ public class RentDepositJobHandler extends IJobHandler {
@Override
public ReturnT<String> execute(String idLastNumInterval) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Integer rentDepositAutoRefundTime = new Integer(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
Long rentDepositAutoRefundTime = new Long(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_DEPOSIT_AUTO_REFUND_TIME).getDetail());
try {
List<BaseOrder> lists = baseOrderBiz.selectByExample(new Example.Builder(BaseOrder.class)
......@@ -80,7 +80,7 @@ public class RentDepositJobHandler extends IJobHandler {
.where(WeekendSqls.<BaseOrder>custom().andEqualTo(BaseOrder::getType, OrderTypeEnum.RENT_VEHICLE.getCode())
.andEqualTo(BaseOrder::getStatus, OrderStatusEnum.ORDER_FINISH.getCode()) //已完成的订单
.andEqualTo(BaseOrder::getRefundStatus, RefundStatusEnum.RESIDUE_ILLEGAL.getCode()) //已归还了部分押金
.andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000)))
.andLessThanOrEqualTo(BaseOrder::getCrtTime, DateUtil.date(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)))
// .andLike(BaseOrder::getId, "%"+ i)
).build());
......@@ -102,7 +102,7 @@ public class RentDepositJobHandler extends IJobHandler {
setType(crosstownTypeEnum);
}});
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60 * 1000)) < 0) {
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) {
OrderViolation orderViolation = orderViolationBiz.selectOne(new OrderViolation(){{
setDetailId(orvd.getId());
setIsDel(SYS_FALSE);
......
......@@ -316,8 +316,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//计算价格
if(vehicleDayNum > 0) {
for(int i = cutDayNum; i < vmcpds.size(); i++) {
vehicleAmount.add(vmcpds.get(i).getPrice());
metaVehicleAmount.add(vmcpds.get(i).getNo_discount_price());
vehicleAmount = vehicleAmount.add(vmcpds.get(i).getPrice());
metaVehicleAmount = metaVehicleAmount.add(vmcpds.get(i).getNo_discount_price());
}
}else {
vehicleOrderItem.setUnitPrice(BigDecimal.ZERO);
......
......@@ -55,6 +55,8 @@ public class ResultVehicleVo {
*/
private String parkBranchCompanyName;
/**
* 目的地分支机构(id)
*/
......@@ -70,6 +72,12 @@ public class ResultVehicleVo {
*/
private Integer useType;
/**
* 用途名称
*/
private String useTypeName;
/**
* 备注信息
*/
......
......@@ -59,4 +59,6 @@ public class VehicleBookRecordQueryVo extends PageParam {
private List<Integer> companyIds;
private String upkeepIds;
private Integer userCompany;
private Integer zoneId;
}
\ No newline at end of file
......@@ -2,8 +2,7 @@ package com.xxfc.platform.vehicle.pojo;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
@Data
public class VehicleExcelVo {
......@@ -27,9 +26,9 @@ public class VehicleExcelVo {
/**
*
* 用途名称
*/
private String useType;
private String useTypeName;
/**
......
package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists;
......@@ -11,19 +9,20 @@ import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.ResultVehicleVo;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicle> {
@Autowired
......@@ -32,7 +31,7 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
public List<VehicleExcelVo> getByPageNotAllData(VehiclePageQueryVo vehiclePageQueryVo, List<Integer> companyList) throws Exception {
public List getByPageNotAllData(VehiclePageQueryVo vehiclePageQueryVo, List<Integer> companyList) throws Exception {
Map<String, Object> params = PropertyUtils.describe(vehiclePageQueryVo);
//处理预定日期相关参数
vehicleBiz.adjustBookedInfoParam(params, vehiclePageQueryVo);
......@@ -42,10 +41,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
params.put("companyList", Arrays.asList(-1));
}
return mapper.getVehicleExcelVoNotAllData(params);
return mapper.getByPageNotAllData(params);
}
public List<VehicleExcelVo> getByPage(VehiclePageQueryVo vehiclePageQueryVo) throws Exception {
public List getByPage(VehiclePageQueryVo vehiclePageQueryVo) throws Exception {
Map<String, Object> params = PropertyUtils.describe(vehiclePageQueryVo);
//处理预定日期相关参数
......@@ -54,10 +53,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
if (vehiclePageQueryVo.getModelId() == null) {
params.remove("modelId");
}
return mapper.getVehicleExcelVo(params);
return mapper.getByPage(params);
}
public List<VehicleExcelVo> getList(String vehiclePageQueryVoJson, UserDTO userDTO) {
//getResultVehicleVoList
public List<ResultVehicleVo> getResultVehicleVoList(String vehiclePageQueryVoJson, UserDTO userDTO) {
VehiclePageQueryVo vehiclePageQueryVo = new VehiclePageQueryVo();
try {
if (StringUtils.isNotBlank(vehiclePageQueryVoJson)){
......@@ -75,4 +74,22 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
}
return new ArrayList();
}
public List<VehicleExcelVo> getList(String vehiclePageQueryVoJson, UserDTO userDTO) throws Exception {
List<ResultVehicleVo> resultVehicleVoList = getResultVehicleVoList(vehiclePageQueryVoJson, userDTO);
ArrayList<VehicleExcelVo> arrayList = Lists.newArrayList();
resultVehicleVoList.parallelStream().forEach(result->{
try {
VehicleExcelVo vehicleExcelVo = new VehicleExcelVo();
BeanUtilsBean.getInstance().copyProperties(vehicleExcelVo,result);
arrayList.add(vehicleExcelVo);
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
}
});
return arrayList;
}
}
......@@ -16,9 +16,7 @@ public interface VehicleMapper extends Mapper<Vehicle> {
public List<ResultVehicleVo> getByPageNotAllData(Map<String, Object> params);
List<VehicleExcelVo> getVehicleExcelVo(Map<String, Object> params);
List<VehicleExcelVo> getVehicleExcelVoNotAllData(Map<String, Object> params);
public int updateStatusById(Map<String, Object> params);
......
......@@ -51,7 +51,7 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
writer.addHeaderAlias("numberPlate", "车牌号");
writer.addHeaderAlias("code", "车辆编码");
writer.addHeaderAlias("vehicleType", "车型");
writer.addHeaderAlias("useType", "用途");
writer.addHeaderAlias("useTypeName", "用途");
writer.addHeaderAlias("parkBranchCompanyName", "停靠分公司");
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true);
......
......@@ -41,7 +41,7 @@
SELECT r.* FROM (
select DISTINCT v.`id`,
v.`code`,
(CASE WHEN #{status} != null THEN #{status}
(CASE WHEN #{status} is not null THEN #{status}
ELSE v.status END) status ,
v.number_plate,
v.brand,
......@@ -71,6 +71,7 @@
v.update_time,
v.model_id,
v.mileage_last_update as mileage,
c.val as useTypeName,
vm.name as vehicleType
<if test=" yearMonthAndParam != null ">
,vbi.booked_date
......@@ -89,6 +90,7 @@
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where
v.is_del=0
<if test="mRangeDateEnd !=null">
......@@ -182,7 +184,7 @@
SELECT r.* FROM (
select DISTINCT v.`id`,
v.`code`,
(CASE WHEN #{status} != null THEN #{status}
(CASE WHEN #{status} is not null THEN #{status}
ELSE v.status END) status ,
v.number_plate,
v.brand,
......@@ -214,6 +216,7 @@
v.update_time,
v.model_id,
v.mileage_last_update as mileage,
c.val as useTypeName,
vm.name as vehicleType
<if test=" yearMonthAndParam !=null ">
,vbi.booked_date
......@@ -232,6 +235,7 @@
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where
v.is_del=0
<if test="companyList != null">
......@@ -337,251 +341,6 @@
) r ORDER BY r.parkBranchCompanyName
</select>
<select id="getVehicleExcelVo" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.pojo.VehicleExcelVo">
SELECT r.* FROM (
select
v.`code`,
v.number_plate,
bc.name as parkBranchCompanyName,
c.val as useType,
vm.name as vehicleType
from vehicle v
<if test=" yearMonthAndParam != null ">
left join
vehicle_book_info vbi on v.`id` = vbi.vehicle
</if>
-- LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
-- LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 停车分公司
LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
-- 目的地分公司
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.vehicle_id = v.id
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where
v.is_del=0
<if test="mRangeDateEnd !=null">
and v.maintenance_date &lt;= #{mRangeDateEnd}
</if>
<if test="modelId != null and modelId != ''">
and v.model_id = #{modelId}
</if>
<if test="mRangeDateStart !=null">
and v.maintenance_date &gt;= #{mRangeDateStart}
</if>
<if test="aVRangeDateStart !=null">
and v.annual_verification_date &lt;= #{aVRangeDateEnd}
</if>
<if test="aVRangeDateEnd !=null">
and v.annual_verification_date &gt;= #{aVRangeDateStart}
</if>
<if test="insuranceDateRangeStart !=null">
and v.insurance_end_date &lt;= #{insuranceDateRangeEnd}
</if>
<if test="insuranceDateRangeEnd !=null">
and v.insurance_end_date &gt;= #{insuranceDateRangeStart}
</if>
<if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany}
</if>
<if test="belongToName !=null">
and v.belong_to_name = #{belongToName}
</if>
<if test="vin !=null and vin != ''">
and v.vin = #{vin}
</if>
<!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>-->
<if test="code !=null">
and v.code = #{code}
</if>
<if test="status !=null and status != 6 and status != 7">
and v.status = #{status}
</if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%')
</if>
<if test="brand !=null">
and v.brand = #{brand}
</if>
<if test="useType !=null">
and v.use_type = #{useType}
</if>
-- 添加所属大区搜索条件
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs}
)
</foreach>
</if>
<if test="subordinateBranch !=null ">
and ( v.park_branch_company_id = #{subordinateBranch})
</if>
<if test=" addrProvince !=null or addrCity !=null or zoneId !=null ">
<if test="addrProvince !=null">
and bc.addr_province=#{addrProvince}
</if>
<if test="addrCity !=null">
and bc.addr_city=#{addrCity}
</if>
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
</if>
order by v.code
) r ORDER BY r.parkBranchCompanyName
</select>
<select id="getVehicleExcelVoNotAllData" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.pojo.VehicleExcelVo">
SELECT r.* FROM (
select
v.`code`,
v.number_plate,
bc.name as parkBranchCompanyName,
c.val as useType,
vm.name as vehicleType
from vehicle v
<if test=" yearMonthAndParam !=null ">
left join
vehicle_book_info vbi on v.`id` = vbi.vehicle
</if>
-- 停车分公司
LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
-- 目的地分公司
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where
v.is_del=0
<if test="companyList != null">
and ( v.park_branch_company_id in (
<trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId},
</foreach>
</trim>
)
<!--or v.expect_destination_branch_company_id in (
<trim suffixOverrides=",">
<foreach collection="companyList" item="companyId">
#{companyId},
</foreach>
</trim>
)-->
<!-- or v.subordinate_branch in (-->
<!-- <trim suffixOverrides=",">-->
<!-- <foreach collection="companyList" item="companyId">-->
<!-- #{companyId},-->
<!-- </foreach>-->
<!-- </trim>-->
)
</if>
<if test="mRangeDateEnd !=null">
and v.maintenance_date &lt;= #{mRangeDateEnd}
</if>
<if test="modelId != null and modelId != ''">
and v.model_id = #{modelId}
</if>
<if test="mRangeDateStart !=null">
and v.maintenance_date &gt;= #{mRangeDateStart}
</if>
<if test="aVRangeDateStart !=null">
and v.annual_verification_date &lt;= #{aVRangeDateEnd}
</if>
<if test="aVRangeDateEnd !=null">
and v.annual_verification_date &gt;= #{aVRangeDateStart}
</if>
<if test="insuranceDateRangeStart !=null">
and v.insurance_end_date &lt;= #{insuranceDateRangeEnd}
</if>
<if test="insuranceDateRangeEnd !=null">
and v.insurance_end_date &gt;= #{insuranceDateRangeStart}
</if>
<if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany}
</if>
<if test="belongToName !=null and belongToName != ''">
and v.belong_to_name like concat('%',#{belongToName},'%')
</if>
<if test="vin !=null and vin != ''">
and v.vin = #{vin}
</if>
<!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>-->
<if test="code !=null">
and v.code = #{code}
</if>
<if test="status !=null and status != 6 and status != 7">
and v.status = #{status}
</if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%')
</if>
<if test="brand !=null">
and v.brand = #{brand}
</if>
<if test="useType !=null">
and v.use_type = #{useType}
</if>
-- 添加所属大区搜索条件
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
and
( (vbi.`year_month` = #{yearMonth} or vbi.`year_month` is null) and
ifnull(vbi.`booked_date`,0) &amp; #{andOperation.andOperationFactor} = #{andOperation.andOperationRs}
)
</foreach>
</if>
<if test="subordinateBranch !=null ">
and ( v.park_branch_company_id = #{subordinateBranch} or
v.expect_destination_branch_company_id=#{subordinateBranch} )
</if>
<if test=" addrProvince !=null or addrCity !=null or zoneId !=null ">
<if test="addrProvince !=null">
and bc.addr_province=#{addrProvince}
</if>
<if test="addrCity !=null">
and bc.addr_city=#{addrCity}
</if>
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
</if>
) r ORDER BY r.parkBranchCompanyName
</select>
<select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle"
......
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