Commit 5f382aef by levphon

指定组织授权-车辆监控bug修复

1 parent 773d7a99
...@@ -2273,10 +2273,10 @@ public class VehicleService extends AbstractCommonService { ...@@ -2273,10 +2273,10 @@ public class VehicleService extends AbstractCommonService {
list.add(vp); list.add(vp);
}); });
int assignCnt = 0;
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
int assignCnt = vehiclePermitMapper.insertIgnoreExistedPermit(list); assignCnt = vehiclePermitMapper.insertIgnoreExistedPermit(list);
log.info("{}授权给用户[{}] 车辆数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), addIdList); log.info("{}授权给用户[{}] 车辆数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), addIdList);
return assignCnt;
} }
//找出与旧数据的差异,删除本次剔除数据 //找出与旧数据的差异,删除本次剔除数据
...@@ -2292,7 +2292,7 @@ public class VehicleService extends AbstractCommonService { ...@@ -2292,7 +2292,7 @@ public class VehicleService extends AbstractCommonService {
int delCnt = vehiclePermitMapper.deleteExistedPermit(delIdList, assignBO.getReceiverId(), AssignDataTypeEnum.VEHICLE.getType()); int delCnt = vehiclePermitMapper.deleteExistedPermit(delIdList, assignBO.getReceiverId(), AssignDataTypeEnum.VEHICLE.getType());
log.info("{}剔除用户[{}] 车辆授权数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delIdList); log.info("{}剔除用户[{}] 车辆授权数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delIdList);
} }
return 0; return assignCnt;
} else { } else {
int delCnt = vehiclePermitMapper.deletePermitByReceiverId(assignBO.getReceiverId(), AssignDataTypeEnum.VEHICLE.getType()); int delCnt = vehiclePermitMapper.deletePermitByReceiverId(assignBO.getReceiverId(), AssignDataTypeEnum.VEHICLE.getType());
log.info("{}删除用户[{}] 车辆授权数据{}条", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delCnt); log.info("{}删除用户[{}] 车辆授权数据{}条", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delCnt);
...@@ -2311,7 +2311,6 @@ public class VehicleService extends AbstractCommonService { ...@@ -2311,7 +2311,6 @@ public class VehicleService extends AbstractCommonService {
* @param assignBO * @param assignBO
*/ */
public int assignOrgz(OrgzPermitAssignBO assignBO) { public int assignOrgz(OrgzPermitAssignBO assignBO) {
// TODO: 2022/8/18
if (CollectionUtils.isNotEmpty(assignBO.getOrgzIds())) { if (CollectionUtils.isNotEmpty(assignBO.getOrgzIds())) {
List<VehiclePermit> list = Lists.newArrayList(); List<VehiclePermit> list = Lists.newArrayList();
...@@ -2336,10 +2335,10 @@ public class VehicleService extends AbstractCommonService { ...@@ -2336,10 +2335,10 @@ public class VehicleService extends AbstractCommonService {
list.add(vp); list.add(vp);
}); });
int assignCnt = 0;
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
int assignCnt = vehiclePermitMapper.insertIgnoreExistedPermit(list); assignCnt = vehiclePermitMapper.insertIgnoreExistedPermit(list);
log.info("{}授权给用户[{}] 组织数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), addIdList); log.info("{}授权给用户[{}] 组织数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), addIdList);
return assignCnt;
} }
//找出与旧数据的差异,删除本次剔除数据 //找出与旧数据的差异,删除本次剔除数据
...@@ -2355,7 +2354,7 @@ public class VehicleService extends AbstractCommonService { ...@@ -2355,7 +2354,7 @@ public class VehicleService extends AbstractCommonService {
int delCnt = vehiclePermitMapper.deleteExistedPermit(delIdList, assignBO.getReceiverId(), AssignDataTypeEnum.ORG.getType()); int delCnt = vehiclePermitMapper.deleteExistedPermit(delIdList, assignBO.getReceiverId(), AssignDataTypeEnum.ORG.getType());
log.info("{}剔除用户[{}] 组织授权数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delIdList); log.info("{}剔除用户[{}] 组织授权数据 {}", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delIdList);
} }
return 0; return assignCnt;
} else { } else {
int delCnt = vehiclePermitMapper.deletePermitByReceiverId(assignBO.getReceiverId(), AssignDataTypeEnum.ORG.getType()); int delCnt = vehiclePermitMapper.deletePermitByReceiverId(assignBO.getReceiverId(), AssignDataTypeEnum.ORG.getType());
log.info("{}删除用户[{}] 组织授权数据{}条", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delCnt); log.info("{}删除用户[{}] 组织授权数据{}条", ShieldContextHolder.getUsername(), assignBO.getReceiverId(), delCnt);
......
...@@ -335,16 +335,29 @@ ...@@ -335,16 +335,29 @@
tv.vin, tv.vin,
tv.owner_name ownerName, tv.owner_name ownerName,
tvd.sn sns, tvd.sn sns,
tvp.receiver_id creatorId, ${loginUserId} creatorId,
td.source, td.source,
td.device_type deviceType td.device_type deviceType
from t_vehicle tv from t_vehicle tv
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_vehicle_permit tvp on tvp.content_id = tv.id where tv.del_flag = 0 and tvd.del_flag = 0
where tv.del_flag = 0 and tvd.del_flag = 0 and tvp.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvp.receiver_id = #{loginUserId} AND (
tv.id in (select tvp.content_id
from t_vehicle_permit tvp
where tvp.del_flag = 0
AND tvp.receiver_id IN (#{loginUserId})
AND tvp.content_type = 0)
OR tv.created_by IN (SELECT tu2.id
FROM t_user tu2
WHERE tu2.del_flag = 0
AND tu2.department_id IN (SELECT tvp.content_id
FROM t_vehicle_permit tvp
WHERE tvp.del_flag = 0
AND tvp.receiver_id IN (#{loginUserId})
AND tvp.content_type = 2))
)
<if test="term != null and term != ''"> <if test="term != null and term != ''">
<choose> <choose>
<when test="termType == 1"> <when test="termType == 1">
...@@ -358,7 +371,7 @@ ...@@ -358,7 +371,7 @@
</when> </when>
</choose> </choose>
</if> </if>
order by tv.id desc order by vid desc
<if test="threshold != null and threshold gt 0"> <if test="threshold != null and threshold gt 0">
limit #{threshold} limit #{threshold}
</if> </if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!