Commit 2853b53f by 杨林龙

开发 1.12.0 版本 工单列表增加车架号重复校验

1 parent ff50b7d4
...@@ -12,6 +12,7 @@ import cn.com.glsx.admin.modules.model.param.ReLinkVehicleBo; ...@@ -12,6 +12,7 @@ import cn.com.glsx.admin.modules.model.param.ReLinkVehicleBo;
import cn.com.glsx.admin.modules.model.param.WorkOrderBO; import cn.com.glsx.admin.modules.model.param.WorkOrderBO;
import cn.com.glsx.admin.modules.model.param.WorkOrderSearch; import cn.com.glsx.admin.modules.model.param.WorkOrderSearch;
import cn.com.glsx.admin.modules.model.vo.LinkVehicleVO; import cn.com.glsx.admin.modules.model.vo.LinkVehicleVO;
import cn.com.glsx.admin.modules.service.VehicleService;
import cn.com.glsx.admin.modules.service.WorkOrderService; import cn.com.glsx.admin.modules.service.WorkOrderService;
import cn.com.glsx.auth.utils.ShieldContextHolder; import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.stdinterface.dto.UpdateImageBO; import cn.com.glsx.stdinterface.dto.UpdateImageBO;
...@@ -109,6 +110,20 @@ public class WorkOrderController { ...@@ -109,6 +110,20 @@ public class WorkOrderController {
} }
/** /**
* 根据权限验证车架号是否重复
*
* @param vin 车架号
* @return
*/
@SysLog(module = MODULE, value = "验证车架号是否重复", action = OperateType.ADD)
@ApiOperation(value = "验证车架号是否重复")
@PostMapping(value = "/verifyDuplicateVim")
public R verifyDuplicateVim(@RequestParam String vin) {
Boolean flag = workOrderService.verifyDuplicateVim(vin);
return R.ok().data(flag);
}
/**
* 新增工单 * 新增工单
* *
* @param workOrderBO * @param workOrderBO
......
...@@ -113,6 +113,15 @@ public interface VehicleMapper extends CommonBaseMapper<Vehicle> { ...@@ -113,6 +113,15 @@ public interface VehicleMapper extends CommonBaseMapper<Vehicle> {
List<Vehicle> getVehicleListByVin(@Param("vin") String vin); List<Vehicle> getVehicleListByVin(@Param("vin") String vin);
/** /**
* 根据权限查询车架号对应的车辆
*
* @param vin 车架号
* @return
*/
@DataPerm(permTable = "tv", showSql = true)
List<Vehicle> getVehicleListByVinWithAuth(@Param("vin") String vin);
/**
* 查询车辆基础信息 * 查询车辆基础信息
* *
* @param search * @param search
...@@ -358,5 +367,4 @@ public interface VehicleMapper extends CommonBaseMapper<Vehicle> { ...@@ -358,5 +367,4 @@ public interface VehicleMapper extends CommonBaseMapper<Vehicle> {
int updateSettleFlagById(@Param("id") Long id, @Param("settleFlag") Integer settleFlag); int updateSettleFlagById(@Param("id") Long id, @Param("settleFlag") Integer settleFlag);
int countByUserId(@Param("userId") Long userId); int countByUserId(@Param("userId") Long userId);
} }
\ No newline at end of file \ No newline at end of file
...@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSON; ...@@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSON;
import com.glsx.plat.common.utils.DateUtils; import com.glsx.plat.common.utils.DateUtils;
import com.glsx.plat.common.utils.StringUtils; import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.office.excel.EasyExcelUtils; import com.glsx.plat.office.excel.EasyExcelUtils;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -26,10 +27,7 @@ import java.time.Duration; ...@@ -26,10 +27,7 @@ import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@NoArgsConstructor @NoArgsConstructor
...@@ -49,6 +47,11 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo ...@@ -49,6 +47,11 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo
private WorkOrderService workOrderService; private WorkOrderService workOrderService;
/**
* 缓存车架号集合
*/
private List<String> bufferList = Lists.newArrayList();
public WorkOrderImportListener(WorkOrderService workOrderService) { public WorkOrderImportListener(WorkOrderService workOrderService) {
this.failList = new ArrayList<>(); this.failList = new ArrayList<>();
this.workOrderService = workOrderService; this.workOrderService = workOrderService;
...@@ -112,7 +115,10 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo ...@@ -112,7 +115,10 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo
* 加上存储数据库 * 加上存储数据库
*/ */
public void saveData() { public void saveData() {
List<WorkOrderImport> importList = new ArrayList<>(); List<WorkOrderImport> importList = new ArrayList<>();
list.forEach(woi -> { list.forEach(woi -> {
if (check(woi)) { if (check(woi)) {
importList.add(woi); importList.add(woi);
...@@ -127,7 +133,7 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo ...@@ -127,7 +133,7 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo
/** /**
* 数据校验 * 数据校验
* *
* @param woi * @param woi 工单数据
* @return * @return
*/ */
public boolean check(WorkOrderImport woi) { public boolean check(WorkOrderImport woi) {
...@@ -173,7 +179,7 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo ...@@ -173,7 +179,7 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo
//检查未完成工单 //检查未完成工单
WorkOrder workOrder = workOrderService.getIncompleteWorkOrder(BizServiceTypeEnum.INSTALL.getType(), woi.getVin()); WorkOrder workOrder = workOrderService.getIncompleteWorkOrder(BizServiceTypeEnum.INSTALL.getType(), woi.getVin());
if (workOrder != null) { if (workOrder != null) {
woi.setImportFailReason("存在相同的车架号"); woi.setImportFailReason("存在相同的车架号未激活的工单");
log.warn(woi.toString()); log.warn(woi.toString());
return false; return false;
} }
...@@ -188,6 +194,15 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo ...@@ -188,6 +194,15 @@ public class WorkOrderImportListener extends AnalysisEventListener<WorkOrderImpo
// TODO: 2022/1/1 车型相关 // TODO: 2022/1/1 车型相关
woi.setNeedInstall(needInstallFlag ? "Y" : "N"); woi.setNeedInstall(needInstallFlag ? "Y" : "N");
// 校验导入的表格中是否存在相同的车架号
if (bufferList.contains(woi.getVin())) {
woi.setImportFailReason("导入模板中存在相同的车架号的列");
log.warn(woi.toString());
return false;
}
bufferList.add(woi.getVin());
return true; return true;
} }
......
package cn.com.glsx.admin.modules.service; package cn.com.glsx.admin.modules.service;
import cn.com.glsx.admin.common.constant.UserConstants;
import cn.com.glsx.admin.common.constants.Constants; import cn.com.glsx.admin.common.constants.Constants;
import cn.com.glsx.admin.common.constants.ConstantsDevice; import cn.com.glsx.admin.common.constants.ConstantsDevice;
import cn.com.glsx.admin.common.constants.ConstantsVehicle; import cn.com.glsx.admin.common.constants.ConstantsVehicle;
...@@ -43,7 +42,6 @@ import cn.com.glsx.stdinterface.dto.SimpleDeviceItem; ...@@ -43,7 +42,6 @@ import cn.com.glsx.stdinterface.dto.SimpleDeviceItem;
import cn.com.glsx.usercenter.api.dto.response.CUser; import cn.com.glsx.usercenter.api.dto.response.CUser;
import cn.com.glsx.usercenter.api.dto.response.User; import cn.com.glsx.usercenter.api.dto.response.User;
import cn.com.glsx.usercenter.api.dto.tree.OrgTreeModel; import cn.com.glsx.usercenter.api.dto.tree.OrgTreeModel;
import cn.com.glsx.usercenter.api.feign.UserService;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -77,7 +75,6 @@ import org.springframework.context.ApplicationEventPublisher; ...@@ -77,7 +75,6 @@ import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
...@@ -1949,7 +1946,7 @@ public class VehicleService extends AbstractCommonService { ...@@ -1949,7 +1946,7 @@ public class VehicleService extends AbstractCommonService {
public FreqInfoVO getEffectFreqInfo(String sn) { public FreqInfoVO getEffectFreqInfo(String sn) {
DeviceFreq deviceFreq = deviceFreqMapper.selectEffectFreqBySn(sn); DeviceFreq deviceFreq = deviceFreqMapper.selectEffectFreqBySn(sn);
//如果没有生效的调频 返回一条初始化调频记录 //如果没有生效的调频 返回一条初始化调频记录
if(Objects.isNull(deviceFreq)) { if (Objects.isNull(deviceFreq)) {
FreqInfoVO result = new FreqInfoVO(); FreqInfoVO result = new FreqInfoVO();
result.setSn(sn); result.setSn(sn);
result.setFreqType(TypeConverseEnum.FreqTypeEnum.INITIALIZATION_MODE.getFreqType()); result.setFreqType(TypeConverseEnum.FreqTypeEnum.INITIALIZATION_MODE.getFreqType());
......
...@@ -156,7 +156,7 @@ public class WorkOrderService extends AbstractCommonService { ...@@ -156,7 +156,7 @@ public class WorkOrderService extends AbstractCommonService {
} }
private Map<Long, String> getBeLongLevels(Collection<Long> userIds) { private Map<Long, String> getBeLongLevels(Collection<Long> userIds) {
if(CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(userIds)) {
return Maps.newHashMap(); return Maps.newHashMap();
} }
//全组织层级 //全组织层级
...@@ -731,4 +731,15 @@ public class WorkOrderService extends AbstractCommonService { ...@@ -731,4 +731,15 @@ public class WorkOrderService extends AbstractCommonService {
oLog.setCreatedBy(operatorId); oLog.setCreatedBy(operatorId);
workOrderLogMapper.insert(oLog); workOrderLogMapper.insert(oLog);
} }
/**
* 校验车架号是否重复
*
* @param vin 车架号
* @return
*/
public Boolean verifyDuplicateVim(String vin) {
List<Vehicle> vehicleList = vehicleMapper.getVehicleListByVinWithAuth(vin);
return CollectionUtil.isNotEmpty(vehicleList);
}
} }
...@@ -493,6 +493,12 @@ ...@@ -493,6 +493,12 @@
from t_vehicle tv where tv.vin = #{vin} and del_flag = 0 from t_vehicle tv where tv.vin = #{vin} and del_flag = 0
</select> </select>
<select id="getVehicleListByVinWithAuth" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle tv where tv.vin = #{vin} and del_flag = 0
</select>
<select id="searchVehicleInfo" parameterType="cn.com.glsx.admin.modules.model.param.VehicleInfoSearch" <select id="searchVehicleInfo" parameterType="cn.com.glsx.admin.modules.model.param.VehicleInfoSearch"
resultType="cn.com.glsx.admin.modules.model.VehicleInfoPageDTO"> resultType="cn.com.glsx.admin.modules.model.VehicleInfoPageDTO">
select tv.id , select tv.id ,
...@@ -518,7 +524,8 @@ ...@@ -518,7 +524,8 @@
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn left join t_device_location tdl on tdl.sn = tvd.sn
left join t_user tu on tu.id = tv.created_by left join t_user tu on tu.id = tv.created_by
left join (select vehicle_id, sn, status from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn = left join (select vehicle_id, sn, status from (SELECT * FROM t_device_freq order by created_date desc) temp
GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn =
td.sn td.sn
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
...@@ -557,22 +564,28 @@ ...@@ -557,22 +564,28 @@
<if test="deviceState != null"> <if test="deviceState != null">
<choose> <choose>
<when test="deviceState == 0"> <!-- 行驶中--> <when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360) and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and tdl.stay_status = 2 and tdl.stay_status = 2
</when> </when>
<when test="deviceState == 1"> <!-- 静止--> <when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360) and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (tdl.stay_status is null or tdl.stay_status = 1) and (tdl.stay_status is null or tdl.stay_status = 1)
</when> </when>
<when test="deviceState == 2"> <!-- 离线--> <when test="deviceState == 2"> <!-- 离线-->
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND,
tdl.last_bs_time, now()) &gt; #{offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null) or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt;
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null) #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is
null)
) )
</when> </when>
<when test="deviceState == 3"> <!-- 在线--> <when test="deviceState == 3"> <!-- 在线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime}) and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or
timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime})
</when> </when>
</choose> </choose>
</if> </if>
...@@ -591,7 +604,8 @@ ...@@ -591,7 +604,8 @@
tvd.sn , tvd.sn ,
td.source deviceType, td.source deviceType,
case when td.source = 1 then '有线' when td.source = 0 then '无线' else '--' end as deviceTypeStr, case when td.source = 1 then '有线' when td.source = 0 then '无线' else '--' end as deviceTypeStr,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName, case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.vehicle_type vehicleType, tv.vehicle_type vehicleType,
tv.vehicle_usages vehicleUsages, tv.vehicle_usages vehicleUsages,
tv.created_date activateTime, tv.created_date activateTime,
...@@ -616,7 +630,8 @@ ...@@ -616,7 +630,8 @@
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn left join t_device_location tdl on tdl.sn = tvd.sn
left join t_device_power tdp on tdp.sn = tvd.sn and tvd.id = tdp.vd_id left join t_device_power tdp on tdp.sn = tvd.sn and tvd.id = tdp.vd_id
left join (select * from (select * from t_device_freq order by created_date desc) temp group by temp.sn) tdf on tdf.vehicle_id = tv.id and tdf.sn = td.sn left join (select * from (select * from t_device_freq order by created_date desc) temp group by temp.sn) tdf on
tdf.vehicle_id = tv.id and tdf.sn = td.sn
left join t_user tu2 on tu2.id = tv.updated_by left join t_user tu2 on tu2.id = tv.updated_by
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
...@@ -655,22 +670,28 @@ ...@@ -655,22 +670,28 @@
<if test="deviceState != null"> <if test="deviceState != null">
<choose> <choose>
<when test="deviceState == 0"> <!-- 行驶中--> <when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360) and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and tdl.stay_status = 2 and tdl.stay_status = 2
</when> </when>
<when test="deviceState == 1"> <!-- 静止--> <when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360) and (td.source=1) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (tdl.stay_status is null or tdl.stay_status = 1) and (tdl.stay_status is null or tdl.stay_status = 1)
</when> </when>
<when test="deviceState == 2"> <!-- 离线--> <when test="deviceState == 2"> <!-- 离线-->
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND,
tdl.last_bs_time, now()) &gt; #{offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null) or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt;
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null) #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is
null)
) )
</when> </when>
<when test="deviceState == 3"> <!-- 在线--> <when test="deviceState == 3"> <!-- 在线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime}) and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or
timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime})
</when> </when>
</choose> </choose>
</if> </if>
...@@ -980,7 +1001,8 @@ ...@@ -980,7 +1001,8 @@
order by tvd.id desc order by tvd.id desc
</select> </select>
<select id="searchCommonTearDownAlarmList" resultType="cn.com.glsx.admin.modules.model.export.CommonTearDownModelExport"> <select id="searchCommonTearDownAlarmList"
resultType="cn.com.glsx.admin.modules.model.export.CommonTearDownModelExport">
select tvd.id, tw.partner_order_no as workOrderNo, select tvd.id, tw.partner_order_no as workOrderNo,
tu.username as shopName, tu.username as shopName,
tv.owner_name as ownerName, tv.owner_name as ownerName,
...@@ -1114,7 +1136,8 @@ ...@@ -1114,7 +1136,8 @@
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.sn left join t_device_location tdl on tdl.sn = td.sn
WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1 WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND,
tdl.last_bs_time, now()) &gt; #{offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null) or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null) or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null)
...@@ -1133,7 +1156,8 @@ ...@@ -1133,7 +1156,8 @@
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0 left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_device_journey tdj on tvd.id = tdj.vd_id and tdj.begin_time <![CDATA[ >= ]]> #{journeyStartTime} and tdj.begin_time <![CDATA[ <= ]]> #{journeyEndTime} left join t_device_journey tdj on tvd.id = tdj.vd_id and tdj.begin_time <![CDATA[ >= ]]> #{journeyStartTime} and
tdj.begin_time <![CDATA[ <= ]]> #{journeyEndTime}
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvd.del_flag = 0 and tvd.del_flag = 0
...@@ -1247,7 +1271,8 @@ ...@@ -1247,7 +1271,8 @@
and tvd.bind_status = 1 and tvd.bind_status = 1
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
and tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn = #{term}) and tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn =
#{term})
</when> </when>
<when test="termType == 2"> <when test="termType == 2">
and tv.vin = #{term} and tv.vin = #{term}
...@@ -1292,7 +1317,8 @@ ...@@ -1292,7 +1317,8 @@
group_concat(td.device_type order by td.id) deviceTypes, group_concat(td.device_type order by td.id) deviceTypes,
group_concat(td.source order by td.id) deviceSources, group_concat(td.source order by td.id) deviceSources,
tv.license_plate licensePlate, tv.license_plate licensePlate,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName, case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.created_date activateTime, tv.created_date activateTime,
tw.created_date createdDate, tw.created_date createdDate,
ifnull(tw.mechanic_name,tu.username) activator, ifnull(tw.mechanic_name,tu.username) activator,
...@@ -1320,7 +1346,8 @@ ...@@ -1320,7 +1346,8 @@
tv.owner_name like '%${term}%' tv.owner_name like '%${term}%'
or tv.vin like '%${term}%' or tv.vin like '%${term}%'
or tw.partner_order_no like '%${term}%' or tw.partner_order_no like '%${term}%'
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like '%${term}%') or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like
'%${term}%')
) )
</if> </if>
group by tv.id group by tv.id
...@@ -1338,7 +1365,8 @@ ...@@ -1338,7 +1365,8 @@
group_concat(td.device_type order by td.id) deviceTypes, group_concat(td.device_type order by td.id) deviceTypes,
group_concat(td.source order by td.id) deviceSources, group_concat(td.source order by td.id) deviceSources,
tv.license_plate licensePlate, tv.license_plate licensePlate,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName, case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.created_date activateTime, tv.created_date activateTime,
tv.remark, tv.remark,
tw.shop_name shopName, tw.shop_name shopName,
...@@ -1372,7 +1400,8 @@ ...@@ -1372,7 +1400,8 @@
tv.owner_name like '%${term}%' tv.owner_name like '%${term}%'
or tv.vin like '%${term}%' or tv.vin like '%${term}%'
or tw.partner_order_no like '%${term}%' or tw.partner_order_no like '%${term}%'
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like '%${term}%') or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like
'%${term}%')
) )
</if> </if>
group by tv.id group by tv.id
......
...@@ -2,21 +2,31 @@ package cn.com.glsx.admin.modules.service; ...@@ -2,21 +2,31 @@ package cn.com.glsx.admin.modules.service;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.admin.modules.remote.RemoteNotifyCenterService; import cn.com.glsx.admin.modules.remote.RemoteNotifyCenterService;
import cn.com.glsx.auth.api.AuthFeignClient;
import cn.com.glsx.auth.model.Department;
import cn.com.glsx.auth.model.Role;
import cn.com.glsx.auth.model.SyntheticUser;
import cn.com.glsx.auth.model.Tenant;
import cn.com.glsx.auth.utils.ShieldContextHolder;
import cn.com.glsx.notify.dto.request.MailMessageRequest; import cn.com.glsx.notify.dto.request.MailMessageRequest;
import cn.com.glsx.notify.dto.request.SmsMessageRequest; import cn.com.glsx.notify.dto.request.SmsMessageRequest;
import cn.com.glsx.stdinterface.dto.InstallWorkOrderBO; import cn.com.glsx.stdinterface.dto.InstallWorkOrderBO;
import cn.com.glsx.stdinterface.dto.InstallWorkOrderVehicleBO; import cn.com.glsx.stdinterface.dto.InstallWorkOrderVehicleBO;
import com.glsx.plat.common.utils.DateUtils; import com.glsx.plat.common.utils.DateUtils;
import com.glsx.plat.core.web.R;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
...@@ -30,6 +40,33 @@ class WorkOrderServiceTest { ...@@ -30,6 +40,33 @@ class WorkOrderServiceTest {
@Autowired @Autowired
private WorkOrderService workOrderService; private WorkOrderService workOrderService;
@Autowired
private AuthFeignClient authFeignClient;
@BeforeEach
public void runBeforeTestMethod() {
SyntheticUser user = new SyntheticUser();
user.setUserId(8160L);
user.setIsSupperAdmin(false);
user.setAccount("zlgj");
// 山东顺骋租户数据
Tenant tenant = new Tenant();
tenant.setTenantId(86L);
tenant.setTenantName("仲利国际");
user.setTenant(tenant);
Department department = new Department();
department.setDeptId(4602L);
user.setDepartment(department);
List<Role> roleList = new ArrayList<>();
Role role = new Role();
role.setRoleId(74L);
roleList.add(role);
user.setRoles(roleList);
ShieldContextHolder.setUser(user);
}
@Test @Test
void sendMail() { void sendMail() {
MailMessageRequest messageDTO = new MailMessageRequest(); MailMessageRequest messageDTO = new MailMessageRequest();
...@@ -85,4 +122,11 @@ class WorkOrderServiceTest { ...@@ -85,4 +122,11 @@ class WorkOrderServiceTest {
Long userId = 111L; Long userId = 111L;
workOrderService.deleteById(orderId, userId); workOrderService.deleteById(orderId, userId);
} }
@Test
public void testVerifyDuplicateVim() {
Boolean flag = workOrderService.verifyDuplicateVim("dijsfdh8713723832");
System.out.println("flag = " + flag);
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!