bug修复

This commit is contained in:
guo 2023-08-21 09:49:00 +08:00
parent 5fb8b2dce3
commit c53ffe7780
9 changed files with 53 additions and 30 deletions

View File

@ -514,13 +514,13 @@ public class RedisRepository {
/** /**
* 存在则获取不存在则查询后获取默认4小时过期时间 * 存在则获取不存在则查询后获取
* *
* @param key the key * @param key the key
* @return 需要的对象 * @return 需要的对象
*/ */
public <Y> Y getOrSet(String key, Supplier<Y> supplier) { public <Y> Y getOrSet(String key, Supplier<Y> supplier) {
return getOrSet(key, supplier, 4 * 60 * 60L); return getOrSet(key, supplier, null);
} }
/** /**

View File

@ -20,7 +20,8 @@
b.project_kanban, b.project_kanban,
b.company_big_screen, b.company_big_screen,
su.account, su.account,
su.show_password su.show_password,
su.real_name
FROM company a FROM company a
INNER JOIN company_config b ON a.headquarters_sn = b.company_sn INNER JOIN company_config b ON a.headquarters_sn = b.company_sn
LEFT JOIN LEFT JOIN

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.basicdata.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.redis.lock.RedisRepository; import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.entity.SystemLogoConfig; import com.zhgd.xmgl.modules.basicdata.entity.SystemLogoConfig;
@ -14,7 +15,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @Description: 系统logo配置 * @Description: 系统logo配置
@ -43,6 +43,7 @@ public class SystemLogoConfigServiceImpl extends ServiceImpl<SystemLogoConfigMap
if (logoConfig != null) { if (logoConfig != null) {
systemLogoConfigMapper.updateById(systemLogoConfig); systemLogoConfigMapper.updateById(systemLogoConfig);
} else { } else {
systemLogoConfig.setId(null);
systemLogoConfigMapper.insert(systemLogoConfig); systemLogoConfigMapper.insert(systemLogoConfig);
} }
redisRepository.del(SYSTEM_LOGO_CONFIG_KEY_PREFIX + val); redisRepository.del(SYSTEM_LOGO_CONFIG_KEY_PREFIX + val);
@ -53,21 +54,26 @@ public class SystemLogoConfigServiceImpl extends ServiceImpl<SystemLogoConfigMap
if (StrUtil.isBlank(systemLogoConfig.getHeadquartersSn())) { if (StrUtil.isBlank(systemLogoConfig.getHeadquartersSn())) {
systemLogoConfig.setHeadquartersSn("-1"); systemLogoConfig.setHeadquartersSn("-1");
} }
return redisRepository.getOrSet(SYSTEM_LOGO_CONFIG_KEY_PREFIX + systemLogoConfig.getHeadquartersSn(), () -> { Object o = redisRepository.get(SYSTEM_LOGO_CONFIG_KEY_PREFIX + systemLogoConfig.getHeadquartersSn());
if (o != null) {
return (SystemLogoConfig) o;
}
String headquartersSn = systemLogoConfig.getHeadquartersSn(); String headquartersSn = systemLogoConfig.getHeadquartersSn();
SystemLogoConfig slc; SystemLogoConfig slc;
String val = headquartersSn;
//查询该企业的 //查询该企业的
slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, headquartersSn)); slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, headquartersSn));
if (slc == null) { if (slc == null) {
//查询默认 //查询默认
slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, "-1")); slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, "-1"));
val = "-1";
} }
if ("local".equals(fileStorageType)) { if ("local".equals(fileStorageType)) {
slc.setFileStorageType("0"); slc.setFileStorageType("0");
} else { } else {
slc.setFileStorageType("1"); slc.setFileStorageType("1");
} }
redisRepository.set(SYSTEM_LOGO_CONFIG_KEY_PREFIX + val, slc);
return slc; return slc;
});
} }
} }

View File

@ -335,7 +335,7 @@ public class LifterServiceImpl extends ServiceImpl<LifterMapper, Lifter> impleme
log.error("无对应升降机编号设备!设备编号为:{}", devSn); log.error("无对应升降机编号设备!设备编号为:{}", devSn);
throw new NullPointerException("无对应升降机编号设备!!"); throw new NullPointerException("无对应升降机编号设备!!");
} }
LifterCurrentData newData = redisRepository.getOrSet("lifterCurrentData" + lifter.getProjectSn() + lifter.getDevSn(), (() -> lifterCurrentDataMapper.getNewData(devSn))); LifterCurrentData newData = redisRepository.getOrSet("lifterCurrentData" + lifter.getProjectSn() + lifter.getDevSn(), (() -> lifterCurrentDataMapper.getNewData(devSn)), 3600 * 24L);
log.info("getRelatedInfo升降机实时数据信息{}", newData); log.info("getRelatedInfo升降机实时数据信息{}", newData);
List<DriverVO> driverList = lifter.getDriverList().stream().map(driver -> { List<DriverVO> driverList = lifter.getDriverList().stream().map(driver -> {
DriverVO driverVO = new DriverVO(); DriverVO driverVO = new DriverVO();

View File

@ -475,7 +475,7 @@ public class TowerServiceImpl extends ServiceImpl<TowerMapper, Tower> implements
log.error("无对应塔吊编号设备!设备编号为:{}", devSn); log.error("无对应塔吊编号设备!设备编号为:{}", devSn);
throw new NullPointerException("无对应塔吊编号设备!!"); throw new NullPointerException("无对应塔吊编号设备!!");
} }
TowerCurrentData newData = redisRepository.getOrSet("towerCurrentData" + tower.getProjectSn() + tower.getDevSn(), (() -> towerCurrentDataMapper.getNewData(devSn))); TowerCurrentData newData = redisRepository.getOrSet("towerCurrentData" + tower.getProjectSn() + tower.getDevSn(), (() -> towerCurrentDataMapper.getNewData(devSn)), 3600 * 24L);
log.info("getRelatedInfo塔吊实时数据信息{}", newData); log.info("getRelatedInfo塔吊实时数据信息{}", newData);
List<DriverVO> driverList = tower.getDriverList().stream().map(driver -> { List<DriverVO> driverList = tower.getDriverList().stream().map(driver -> {
DriverVO driverVO = new DriverVO(); DriverVO driverVO = new DriverVO();

View File

@ -164,4 +164,7 @@ public class CheckingPointInfo implements Serializable {
@ApiModelProperty("通知人名称") @ApiModelProperty("通知人名称")
@TableField(exist = false) @TableField(exist = false)
private String noticeUserNames; private String noticeUserNames;
@TableField(exist = false)
@ApiModelProperty(value = "操作人")
private java.lang.String operateName;
} }

View File

@ -8,10 +8,12 @@
su.real_name checkingPointUserName, su.real_name checkingPointUserName,
(SELECT group_concat(nu.real_name) (SELECT group_concat(nu.real_name)
FROM system_user nu FROM system_user nu
WHERE find_in_set(nu.user_id, cp.notice_user_ids)) noticeUserNames WHERE find_in_set(nu.user_id, cp.notice_user_ids)) noticeUserNames,
uo.real_name operate_name
from checking_point_info cpi from checking_point_info cpi
inner join checking_point cp on cpi.checking_point_id = cp.id inner join checking_point cp on cpi.checking_point_id = cp.id
inner join system_user su on cpi.checking_point_user_id = su.user_id inner join system_user su on cpi.checking_point_user_id = su.user_id
inner join system_user uo on cpi.operate_id = uo.user_id
where cp.project_sn = #{dto.projectSn} where cp.project_sn = #{dto.projectSn}
<if test="dto.queryStr != null and dto.queryStr != ''"> <if test="dto.queryStr != null and dto.queryStr != ''">
and (cp.checking_point_name like concat('%', #{dto.queryStr}, '%') and (cp.checking_point_name like concat('%', #{dto.queryStr}, '%')

View File

@ -83,7 +83,7 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
} }
CheckingPoint checkingPoint = checkingPointMapper.selectById(checkingPointInfo.getCheckingPointId()); CheckingPoint checkingPoint = checkingPointMapper.selectById(checkingPointInfo.getCheckingPointId());
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
for (String userId : userIds) { for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId); SystemUser systemUser = systemUserMapper.selectById(userId);
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),
@ -104,7 +104,7 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
CheckingPointInfo cpi = checkingPointInfoMapper.selectById(checkingPointInfo.getId()); CheckingPointInfo cpi = checkingPointInfoMapper.selectById(checkingPointInfo.getId());
CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId()); CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId());
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
for (String userId : userIds) { for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId); SystemUser systemUser = systemUserMapper.selectById(userId);
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),
@ -122,7 +122,7 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
removeById(id); removeById(id);
CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId()); CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId());
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
for (String userId : userIds) { for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId); SystemUser systemUser = systemUserMapper.selectById(userId);
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),

View File

@ -21,12 +21,14 @@ import com.zhgd.xmgl.modules.checking.service.CheckingPointService;
import com.zhgd.xmgl.util.DateUtil; import com.zhgd.xmgl.util.DateUtil;
import com.zhgd.xmgl.util.RegionUtil; import com.zhgd.xmgl.util.RegionUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
/** /**
* @author 邱平毅 * @author 邱平毅
@ -83,15 +85,24 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
QrCodeUtil.generate(JSON.toJSONString(jsonObject), 300, 300, FileUtil.file(path)); QrCodeUtil.generate(JSON.toJSONString(jsonObject), 300, 300, FileUtil.file(path));
updateById(checkingPoint); updateById(checkingPoint);
CheckingPoint cp = checkingPointMapper.selectById(checkingPoint.getId());
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = getNoticeUserIds(checkingPoint);
for (String userId : userIds) { for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),
String.format("新增巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())), String.format("新增巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cp.getCreateDate())),
"巡检点新增", "19"); "巡检点新增", "19");
} }
} }
private List<String> getNoticeUserIds(CheckingPoint checkingPoint) {
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ",");
List<String> inspectUserIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
userIds.addAll(inspectUserIds);
userIds = userIds.stream().distinct().collect(Collectors.toList());
return userIds;
}
@Override @Override
public void edit(CheckingPoint checkingPoint) { public void edit(CheckingPoint checkingPoint) {
@ -108,7 +119,7 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
updateById(checkingPoint); updateById(checkingPoint);
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = getNoticeUserIds(checkingPoint);
for (String userId : userIds) { for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),
String.format("修改巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())), String.format("修改巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())),
@ -122,7 +133,7 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
checkingPointInfoMapper.delete(new LambdaQueryWrapper<CheckingPointInfo>().eq(CheckingPointInfo::getCheckingPointId, id)); checkingPointInfoMapper.delete(new LambdaQueryWrapper<CheckingPointInfo>().eq(CheckingPointInfo::getCheckingPointId, id));
removeById(id); removeById(id);
//通知 //通知
List<String> userIds = StrUtil.split(checkingPoint.getNoticeUserIds(), ","); List<String> userIds = getNoticeUserIds(checkingPoint);
for (String userId : userIds) { for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId), noticeService.addUserNotice(Long.valueOf(userId),
String.format("删除巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())), String.format("删除巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())),