|
|
@ -1,15 +1,28 @@ |
|
|
|
package com.epmet.plugin.power.modules.axis.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.enums.EpmetDelFlagEnum; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.plugin.power.dto.axis.form.StructLeaderBriefFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.axis.result.PowerAxisSLeaderResultDTO; |
|
|
|
import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO; |
|
|
|
import com.epmet.plugin.power.enums.PowerTagLevelEnum; |
|
|
|
import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao; |
|
|
|
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructDao; |
|
|
|
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao; |
|
|
|
import com.epmet.plugin.power.dto.axis.PowerAxisStructLeaderDTO; |
|
|
|
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity; |
|
|
|
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity; |
|
|
|
import com.epmet.plugin.power.modules.axis.service.PowerAxisStructLeaderService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -22,7 +35,7 @@ import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 动力主轴负责人关系 |
|
|
|
* 动力主轴负责人关系 |
|
|
|
* |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2022-04-19 |
|
|
@ -34,7 +47,13 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS |
|
|
|
// private PowerAxisStructLeaderRedis powerAxisStructLeaderRedis;
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
LoginUserUtil loginUserUtil; |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PowerAxisLeaderDao powerAxisLeaderDao; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PowerAxisStructDao powerAxisStructDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PowerAxisStructLeaderDTO> page(Map<String, Object> params) { |
|
|
@ -52,8 +71,8 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS |
|
|
|
return ConvertUtils.sourceToTarget(entityList, PowerAxisStructLeaderDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<PowerAxisStructLeaderEntity> getWrapper(Map<String, Object> params){ |
|
|
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
|
|
private QueryWrapper<PowerAxisStructLeaderEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<PowerAxisStructLeaderEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
@ -91,7 +110,35 @@ public class PowerAxisStructLeaderServiceImpl extends BaseServiceImpl<PowerAxisS |
|
|
|
@Override |
|
|
|
public PowerAxisSLeaderResultDTO queryLeaderDetailById(String axisStructId) { |
|
|
|
String customerId = loginUserUtil.getLoginUserCustomerId(); |
|
|
|
return baseDao.queryLeaderDetailById(axisStructId,customerId); |
|
|
|
return baseDao.queryLeaderDetailById(axisStructId, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PowerAxisSimpleListDTO> listLeaderByStructId(TokenDto tokenDto, StructLeaderBriefFormDTO formDto) { |
|
|
|
|
|
|
|
int structLevel = formDto.getStructLevel(); |
|
|
|
String axisStructId = formDto.getAxisStructId(); |
|
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
String rootId; |
|
|
|
if (PowerTagLevelEnum.ROOT.level() == structLevel) { |
|
|
|
rootId = axisStructId; |
|
|
|
} else { |
|
|
|
|
|
|
|
LambdaQueryWrapper<PowerAxisStructEntity> lqw = new LambdaQueryWrapper<>(); |
|
|
|
lqw.eq(PowerAxisStructEntity::getCustomerId, customerId) |
|
|
|
.eq(PowerAxisStructEntity::getPid, axisStructId) |
|
|
|
.eq(PowerAxisStructEntity::getDelFlag, EpmetDelFlagEnum.NORMAL.value()); |
|
|
|
|
|
|
|
PowerAxisStructEntity axisStructEntity = powerAxisStructDao.selectOne(lqw); |
|
|
|
if (null == axisStructEntity) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "节点匹配错误"); |
|
|
|
} |
|
|
|
|
|
|
|
rootId = StringUtils.split(axisStructEntity.getPids(), StrConstant.COLON)[NumConstant.ZERO]; |
|
|
|
} |
|
|
|
|
|
|
|
formDto.setCustomerId(customerId); |
|
|
|
formDto.setAxisStructId(rootId); |
|
|
|
return baseDao.listLeaderBriefByRootStructId(formDto); |
|
|
|
} |
|
|
|
} |