代码提交

This commit is contained in:
huangzj
2023-10-09 16:05:21 +08:00
parent 1582d55a5c
commit 0ba019fad7
5 changed files with 40 additions and 7 deletions

View File

@@ -18,5 +18,5 @@ public interface IMqttUserService extends IService<MqttUser> {
* @param password
*/
void insertMqttUser(String password);
void deleteUser(String ndid);
}

View File

@@ -67,6 +67,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
private final UserFeignClient userFeignClient;
private final FeedBackFeignClient feedBackFeignClient;
private final IMqttUserService mqttUserService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -267,7 +268,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
}
@Override
@Transactional(rollbackFor = {Exception.class})
// @Transactional(rollbackFor = {Exception.class})
public Boolean delete(String eid) {
String userIndex = RequestUtil.getUserIndex();
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus, "1").eq(CsDeviceUserPO::getPrimaryUserId, userIndex).list();
@@ -278,8 +279,12 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
CsEquipmentDeliveryPO csEquipmentDeliveryPO =new CsEquipmentDeliveryPO();
csEquipmentDeliveryPO.setId(eid);
csEquipmentDeliveryPO.setRunStatus(0);
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0").update();
CsEquipmentDeliveryPO temp = csEquipmentDeliveryMapper.selectById(eid);
mqttUserService.deleteUser(temp.getNdid());
List<CsLedger> list1 = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, eid).list();
if(!com.alibaba.nacos.client.naming.utils.CollectionUtils.isEmpty(list1)){
List<String> collect = list1.stream().map(CsLedger::getId).collect(Collectors.toList());

View File

@@ -42,6 +42,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -91,6 +92,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
private final DictTreeFeignClient dictTreeFeignClient;
private final CsEquipmentProcessPOService csEquipmentProcessPOService;
private final IMqttUserService mqttUserService;
@Override
@Transactional(rollbackFor = {Exception.class})
@@ -120,7 +122,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
}
@Override
@Transactional(rollbackFor = {Exception.class})
// @Transactional(rollbackFor = {Exception.class}, propagation = Propagation.REQUIRED)
public Boolean AuditEquipmentDelivery(String id) {
UpdateWrapper<CsEquipmentDeliveryPO> wrapper = new UpdateWrapper();
wrapper.eq ("id", id);
@@ -140,6 +142,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
queryWrap.eq("device_id",id);
csTouristDataPOService.getBaseMapper().delete(queryWrap);
CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.getBaseMapper().selectById(id);
mqttUserService.deleteUser(csEquipmentDeliveryPO.getNdid());
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
return update;
}

View File

@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
import cn.hutool.crypto.digest.DigestUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.mapper.MqttUserMapper;
import com.njcn.csdevice.pojo.po.MqttUser;
@@ -33,4 +34,13 @@ public class MqttUserServiceImpl extends ServiceImpl<MqttUserMapper, MqttUser> i
mqttUser.setPassword(DigestUtil.sha256Hex(password + mqttUser.getSalt()));
this.save(mqttUser);
}
@Override
public void deleteUser(String ndid) {
QueryWrapper<MqttUser> queryWrap = new QueryWrapper<>();
queryWrap.eq("username",ndid);
this.getBaseMapper().delete(queryWrap);
}
}

View File

@@ -8,9 +8,11 @@ import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
import com.njcn.csharmonic.mapper.CsEventPOMapper;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.service.CsEventPOService;
import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.service.EvtDataService;
import com.njcn.system.api.DicDataFeignClient;
@@ -53,6 +55,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
private final EvtDataService evtDataService;
private final EpdFeignClient epdFeignClient;
private final EleEvtFeignClient eleEvtFeignClient;
private final CsEventPOMapper csEventPOMapper;
@Override
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
@@ -172,12 +175,21 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
csEventUserQueryParam.setUserId(RequestUtil.getUserIndex());
//getEventIds传空一键已读
if(CollectionUtil.isEmpty(csEventUserQueryParam.getEventIds())){
this.lambdaUpdate().eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
List<EventDetailVO> list = this.queryUserEventList(csEventUserQueryParam);
if(!CollectionUtils.isEmpty(list)){
List<String> collect = list.stream().map(EventDetailVO::getId).collect(Collectors.toList());
this.lambdaUpdate().in(CsEventUserPO::getEventId,collect).
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
set(CsEventUserPO::getStatus,1).update();
}
}else {
this.lambdaUpdate().in(CsEventUserPO::getEventId,csEventUserQueryParam.getEventIds()).
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
set(CsEventUserPO::getStatus,1).update();
}
this.lambdaUpdate().in(CsEventUserPO::getEventId,csEventUserQueryParam.getEventIds()).
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
set(CsEventUserPO::getStatus,1).update();
}
@Override