|
@@ -1,10 +1,13 @@
|
|
|
package com.xjrsoft.module.personnel.service.impl;
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalMonthPageDto;
|
|
|
import com.xjrsoft.module.personnel.dto.BasePersonnelLabourCapitalYearPageDto;
|
|
|
import com.xjrsoft.module.personnel.entity.BasePersonnelLabourCapital;
|
|
@@ -35,14 +38,18 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
|
public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<BasePersonnelLabourCapitalMapper, BasePersonnelLabourCapital> implements IBasePersonnelLabourCapitalService {
|
|
|
- private final BasePersonnelLabourCapitalMapper basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper;
|
|
|
+ private final BasePersonnelLabourCapitalMapper labourCapitalMapper;
|
|
|
|
|
|
- private final BasePersonnelLabourCapitalDataMapper basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper;
|
|
|
- private final BasePersonnelLabourCapitalTitleMapper basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper;
|
|
|
+ private final BasePersonnelLabourCapitalDataMapper capitalDataMapper;
|
|
|
+ private final BasePersonnelLabourCapitalTitleMapper capitalTitleMapper;
|
|
|
+ private final IUserService userService;
|
|
|
|
|
|
@Override
|
|
|
public Page<BasePersonnelLabourCapitalMonthPageVo> getMonthPage(Page<BasePersonnelLabourCapitalMonthPageDto> page, BasePersonnelLabourCapitalMonthPageDto dto) {
|
|
|
- Page<BasePersonnelLabourCapitalMonthPageVo> resultPage = basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.getMonthPage(page, dto);
|
|
|
+ long userId = StpUtil.getLoginIdAsLong();
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ dto.setJobNumber(user.getUserName());
|
|
|
+ Page<BasePersonnelLabourCapitalMonthPageVo> resultPage = labourCapitalMapper.getMonthPage(page, dto);
|
|
|
|
|
|
for (BasePersonnelLabourCapitalMonthPageVo record : resultPage.getRecords()) {
|
|
|
JSONObject extendJsonObj = JSON.parseObject(record.getPendingJson());
|
|
@@ -63,11 +70,14 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
|
|
|
@Override
|
|
|
public Page<BasePersonnelLabourCapitalYearPageVo> getYearPage(Page<BasePersonnelLabourCapitalYearPageDto> page, BasePersonnelLabourCapitalYearPageDto dto) {
|
|
|
- return basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.getYearPage(page, dto);
|
|
|
+ long userId = StpUtil.getLoginIdAsLong();
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ dto.setJobNumber(user.getUserName());
|
|
|
+ return labourCapitalMapper.getYearPage(page, dto);
|
|
|
}
|
|
|
|
|
|
private String getBpName(String columnNumber) {
|
|
|
- List<BasePersonnelLabourCapitalTitle> bpTitles = basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.selectList(Wrappers.<BasePersonnelLabourCapitalTitle>lambdaQuery().eq(BasePersonnelLabourCapitalTitle::getColumnNumber, columnNumber));
|
|
|
+ List<BasePersonnelLabourCapitalTitle> bpTitles = capitalTitleMapper.selectList(Wrappers.<BasePersonnelLabourCapitalTitle>lambdaQuery().eq(BasePersonnelLabourCapitalTitle::getColumnNumber, columnNumber));
|
|
|
if (bpTitles != null && !bpTitles.isEmpty()) {
|
|
|
return bpTitles.get(0).getName();
|
|
|
} else {
|
|
@@ -78,14 +88,14 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean add(BasePersonnelLabourCapital basePersonnelLabourCapital) {
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.insert(basePersonnelLabourCapital);
|
|
|
+ labourCapitalMapper.insert(basePersonnelLabourCapital);
|
|
|
for (BasePersonnelLabourCapitalData basePersonnelLabourCapitalData : basePersonnelLabourCapital.getBasePersonnelLabourCapitalDataList()) {
|
|
|
basePersonnelLabourCapitalData.setLabourCapitalId(basePersonnelLabourCapital.getId());
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.insert(basePersonnelLabourCapitalData);
|
|
|
+ capitalDataMapper.insert(basePersonnelLabourCapitalData);
|
|
|
}
|
|
|
for (BasePersonnelLabourCapitalTitle basePersonnelLabourCapitalTitle : basePersonnelLabourCapital.getBasePersonnelLabourCapitalTitleList()) {
|
|
|
basePersonnelLabourCapitalTitle.setLabourCapitalId(basePersonnelLabourCapital.getId());
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.insert(basePersonnelLabourCapitalTitle);
|
|
|
+ capitalTitleMapper.insert(basePersonnelLabourCapitalTitle);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -94,11 +104,11 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean update(BasePersonnelLabourCapital basePersonnelLabourCapital) {
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.updateById(basePersonnelLabourCapital);
|
|
|
+ labourCapitalMapper.updateById(basePersonnelLabourCapital);
|
|
|
//********************************* BasePersonnelLabourCapitalData 增删改 开始 *******************************************/
|
|
|
{
|
|
|
// 查出所有子级的id
|
|
|
- List<BasePersonnelLabourCapitalData> basePersonnelLabourCapitalDataList = basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.selectList(Wrappers.lambdaQuery(BasePersonnelLabourCapitalData.class).eq(BasePersonnelLabourCapitalData::getLabourCapitalId, basePersonnelLabourCapital.getId()).select(BasePersonnelLabourCapitalData::getId));
|
|
|
+ List<BasePersonnelLabourCapitalData> basePersonnelLabourCapitalDataList = capitalDataMapper.selectList(Wrappers.lambdaQuery(BasePersonnelLabourCapitalData.class).eq(BasePersonnelLabourCapitalData::getLabourCapitalId, basePersonnelLabourCapital.getId()).select(BasePersonnelLabourCapitalData::getId));
|
|
|
List<Long> basePersonnelLabourCapitalDataIds = basePersonnelLabourCapitalDataList.stream().map(BasePersonnelLabourCapitalData::getId).collect(Collectors.toList());
|
|
|
//原有子表单 没有被删除的主键
|
|
|
List<Long> basePersonnelLabourCapitalDataOldIds = basePersonnelLabourCapital.getBasePersonnelLabourCapitalDataList().stream().map(BasePersonnelLabourCapitalData::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
@@ -108,18 +118,18 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
for (BasePersonnelLabourCapitalData basePersonnelLabourCapitalData : basePersonnelLabourCapital.getBasePersonnelLabourCapitalDataList()) {
|
|
|
//如果不等于空则修改
|
|
|
if (basePersonnelLabourCapitalData.getId() != null) {
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.updateById(basePersonnelLabourCapitalData);
|
|
|
+ capitalDataMapper.updateById(basePersonnelLabourCapitalData);
|
|
|
}
|
|
|
//如果等于空 则新增
|
|
|
else {
|
|
|
//已经不存在的id 删除
|
|
|
basePersonnelLabourCapitalData.setLabourCapitalId(basePersonnelLabourCapital.getId());
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.insert(basePersonnelLabourCapitalData);
|
|
|
+ capitalDataMapper.insert(basePersonnelLabourCapitalData);
|
|
|
}
|
|
|
}
|
|
|
//已经不存在的id 删除
|
|
|
if(basePersonnelLabourCapitalDataRemoveIds.size() > 0){
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.deleteBatchIds(basePersonnelLabourCapitalDataRemoveIds);
|
|
|
+ capitalDataMapper.deleteBatchIds(basePersonnelLabourCapitalDataRemoveIds);
|
|
|
}
|
|
|
}
|
|
|
//********************************* BasePersonnelLabourCapitalData 增删改 结束 *******************************************/
|
|
@@ -127,7 +137,7 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
//********************************* BasePersonnelLabourCapitalTitle 增删改 开始 *******************************************/
|
|
|
{
|
|
|
// 查出所有子级的id
|
|
|
- List<BasePersonnelLabourCapitalTitle> basePersonnelLabourCapitalTitleList = basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.selectList(Wrappers.lambdaQuery(BasePersonnelLabourCapitalTitle.class).eq(BasePersonnelLabourCapitalTitle::getLabourCapitalId, basePersonnelLabourCapital.getId()).select(BasePersonnelLabourCapitalTitle::getId));
|
|
|
+ List<BasePersonnelLabourCapitalTitle> basePersonnelLabourCapitalTitleList = capitalTitleMapper.selectList(Wrappers.lambdaQuery(BasePersonnelLabourCapitalTitle.class).eq(BasePersonnelLabourCapitalTitle::getLabourCapitalId, basePersonnelLabourCapital.getId()).select(BasePersonnelLabourCapitalTitle::getId));
|
|
|
List<Long> basePersonnelLabourCapitalTitleIds = basePersonnelLabourCapitalTitleList.stream().map(BasePersonnelLabourCapitalTitle::getId).collect(Collectors.toList());
|
|
|
//原有子表单 没有被删除的主键
|
|
|
List<Long> basePersonnelLabourCapitalTitleOldIds = basePersonnelLabourCapital.getBasePersonnelLabourCapitalTitleList().stream().map(BasePersonnelLabourCapitalTitle::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
|
@@ -137,18 +147,18 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
for (BasePersonnelLabourCapitalTitle basePersonnelLabourCapitalTitle : basePersonnelLabourCapital.getBasePersonnelLabourCapitalTitleList()) {
|
|
|
//如果不等于空则修改
|
|
|
if (basePersonnelLabourCapitalTitle.getId() != null) {
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.updateById(basePersonnelLabourCapitalTitle);
|
|
|
+ capitalTitleMapper.updateById(basePersonnelLabourCapitalTitle);
|
|
|
}
|
|
|
//如果等于空 则新增
|
|
|
else {
|
|
|
//已经不存在的id 删除
|
|
|
basePersonnelLabourCapitalTitle.setLabourCapitalId(basePersonnelLabourCapital.getId());
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.insert(basePersonnelLabourCapitalTitle);
|
|
|
+ capitalTitleMapper.insert(basePersonnelLabourCapitalTitle);
|
|
|
}
|
|
|
}
|
|
|
//已经不存在的id 删除
|
|
|
if(basePersonnelLabourCapitalTitleRemoveIds.size() > 0){
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.deleteBatchIds(basePersonnelLabourCapitalTitleRemoveIds);
|
|
|
+ capitalTitleMapper.deleteBatchIds(basePersonnelLabourCapitalTitleRemoveIds);
|
|
|
}
|
|
|
}
|
|
|
//********************************* BasePersonnelLabourCapitalTitle 增删改 结束 *******************************************/
|
|
@@ -159,9 +169,9 @@ public class BasePersonnelLabourCapitalServiceImpl extends MPJBaseServiceImpl<Ba
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean delete(List<Long> ids) {
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalMapper.deleteBatchIds(ids);
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalDataMapper.delete(Wrappers.lambdaQuery(BasePersonnelLabourCapitalData.class).in(BasePersonnelLabourCapitalData::getLabourCapitalId, ids));
|
|
|
- basePersonnelLabourCapitalBasePersonnelLabourCapitalTitleMapper.delete(Wrappers.lambdaQuery(BasePersonnelLabourCapitalTitle.class).in(BasePersonnelLabourCapitalTitle::getLabourCapitalId, ids));
|
|
|
+ labourCapitalMapper.deleteBatchIds(ids);
|
|
|
+ capitalDataMapper.delete(Wrappers.lambdaQuery(BasePersonnelLabourCapitalData.class).in(BasePersonnelLabourCapitalData::getLabourCapitalId, ids));
|
|
|
+ capitalTitleMapper.delete(Wrappers.lambdaQuery(BasePersonnelLabourCapitalTitle.class).in(BasePersonnelLabourCapitalTitle::getLabourCapitalId, ids));
|
|
|
|
|
|
return true;
|
|
|
}
|