|
@@ -4,9 +4,10 @@ import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
import com.imed.costaccount.common.exception.CostException;
|
|
import com.imed.costaccount.common.exception.CostException;
|
|
import com.imed.costaccount.common.util.BeanUtil;
|
|
import com.imed.costaccount.common.util.BeanUtil;
|
|
-import com.imed.costaccount.common.util.JsonUtil;
|
|
|
|
|
|
+import com.imed.costaccount.common.util.JacksonUtil;
|
|
import com.imed.costaccount.common.util.PageUtils;
|
|
import com.imed.costaccount.common.util.PageUtils;
|
|
import com.imed.costaccount.constants.NumberConstant;
|
|
import com.imed.costaccount.constants.NumberConstant;
|
|
import com.imed.costaccount.mapper.CostAccountShareMapper;
|
|
import com.imed.costaccount.mapper.CostAccountShareMapper;
|
|
@@ -68,12 +69,12 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
List<CostAccountShare> costAccountShareList = pages.getRecords();
|
|
List<CostAccountShare> costAccountShareList = pages.getRecords();
|
|
|
|
|
|
List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
|
|
List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
|
|
- costAccountShareVOList.forEach(i->{
|
|
|
|
|
|
+ costAccountShareVOList.forEach(i -> {
|
|
String accountingIds = i.getAccountingIds();
|
|
String accountingIds = i.getAccountingIds();
|
|
- if (StrUtil.isNotBlank(accountingIds)){
|
|
|
|
|
|
+ if (StrUtil.isNotBlank(accountingIds)) {
|
|
List<String> list = Arrays.asList(accountingIds.split(StrUtil.COMMA));
|
|
List<String> list = Arrays.asList(accountingIds.split(StrUtil.COMMA));
|
|
i.setAccountingIdList(list);
|
|
i.setAccountingIdList(list);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
i.setAccountingIdList(null);
|
|
i.setAccountingIdList(null);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -117,7 +118,7 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
* @param costAccountShareSaveDto {@link CostAccountShareSaveDto}
|
|
* @param costAccountShareSaveDto {@link CostAccountShareSaveDto}
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
public void addCostAccountShare(CostAccountShareSaveDto costAccountShareSaveDto) {
|
|
public void addCostAccountShare(CostAccountShareSaveDto costAccountShareSaveDto) {
|
|
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
Long hospId = user.getHospId();
|
|
Long hospId = user.getHospId();
|
|
@@ -131,27 +132,28 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
|
|
|
|
/**
|
|
/**
|
|
* 检验输入数据的合理性
|
|
* 检验输入数据的合理性
|
|
|
|
+ *
|
|
* @param costAccountShareSaveDto
|
|
* @param costAccountShareSaveDto
|
|
* @param hospId
|
|
* @param hospId
|
|
*/
|
|
*/
|
|
private void checkAccountShare(CostAccountShareSaveDto costAccountShareSaveDto, Long hospId) {
|
|
private void checkAccountShare(CostAccountShareSaveDto costAccountShareSaveDto, Long hospId) {
|
|
Long responsibilityId = costAccountShareSaveDto.getResponsibilityId();
|
|
Long responsibilityId = costAccountShareSaveDto.getResponsibilityId();
|
|
- Responsibility responsibility = responsibilityService.getOne(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId,hospId).eq(Responsibility::getId, responsibilityId));
|
|
|
|
- if (Objects.isNull(responsibility)){
|
|
|
|
- throw new CostException(500,"输入的责任不存在");
|
|
|
|
|
|
+ Responsibility responsibility = responsibilityService.getOne(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId).eq(Responsibility::getId, responsibilityId));
|
|
|
|
+ if (Objects.isNull(responsibility)) {
|
|
|
|
+ throw new CostException(500, "输入的责任不存在");
|
|
}
|
|
}
|
|
costAccountShareSaveDto.setResponsibilityId(responsibilityId);
|
|
costAccountShareSaveDto.setResponsibilityId(responsibilityId);
|
|
costAccountShareSaveDto.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
costAccountShareSaveDto.setResponsibilityCode(responsibility.getResponsibilityCode());
|
|
costAccountShareSaveDto.setResponsibilityName(responsibility.getResponsibilityName());
|
|
costAccountShareSaveDto.setResponsibilityName(responsibility.getResponsibilityName());
|
|
costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
|
|
costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
|
|
- List<CostAccountShare> costAccountShareList = baseMapper.selectList(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId,hospId).eq(CostAccountShare::getResponsibilityId,costAccountShareSaveDto.getResponsibilityId()));
|
|
|
|
- if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())){
|
|
|
|
|
|
+ List<CostAccountShare> costAccountShareList = baseMapper.selectList(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId).eq(CostAccountShare::getResponsibilityId, costAccountShareSaveDto.getResponsibilityId()));
|
|
|
|
+ if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) {
|
|
// 这个责任中心允许输入会计科目
|
|
// 这个责任中心允许输入会计科目
|
|
List<Long> accountIdList = Arrays.stream(costAccountShareSaveDto.getAccountingIds().split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
List<Long> accountIdList = Arrays.stream(costAccountShareSaveDto.getAccountingIds().split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId).in(Accounting::getId, accountIdList).orderByDesc(Accounting::getCreateTime));
|
|
List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId).in(Accounting::getId, accountIdList).orderByDesc(Accounting::getCreateTime));
|
|
- if (CollectionUtils.isEmpty(accountingList)){
|
|
|
|
- throw new CostException(500,"输入的会计科目不存在");
|
|
|
|
- }else {
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(accountingList)) {
|
|
|
|
+ throw new CostException(500, "输入的会计科目不存在");
|
|
|
|
+ } else {
|
|
String accountIds = accountingList.stream().map(Accounting::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
|
|
String accountIds = accountingList.stream().map(Accounting::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
|
|
costAccountShareSaveDto.setAccountingIds(accountIds);
|
|
costAccountShareSaveDto.setAccountingIds(accountIds);
|
|
String accountNames = accountingList.stream().map(Accounting::getAccountingName).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
|
|
String accountNames = accountingList.stream().map(Accounting::getAccountingName).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
|
|
@@ -161,41 +163,42 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
}
|
|
}
|
|
// Map<String, List<CostAccountShare>> costAccountMap = costAccountShareList.stream().collect(Collectors.groupingBy(CostAccountShare::getResponsibilityCode));
|
|
// Map<String, List<CostAccountShare>> costAccountMap = costAccountShareList.stream().collect(Collectors.groupingBy(CostAccountShare::getResponsibilityCode));
|
|
// List<CostAccountShare> list = costAccountMap.get(costAccountShareSaveDto.getResponsibilityCode());
|
|
// List<CostAccountShare> list = costAccountMap.get(costAccountShareSaveDto.getResponsibilityCode());
|
|
- if (!CollectionUtils.isEmpty(costAccountShareList)){
|
|
|
|
- costAccountShareList.forEach(i->{
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(costAccountShareList)) {
|
|
|
|
+ costAccountShareList.forEach(i -> {
|
|
String accountingIds = i.getAccountingIds();
|
|
String accountingIds = i.getAccountingIds();
|
|
Integer isShareCost = i.getIsShareCost();
|
|
Integer isShareCost = i.getIsShareCost();
|
|
List<Long> accountIdListRequest = Arrays.stream(accountingIds.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
List<Long> accountIdListRequest = Arrays.stream(accountingIds.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
|
|
- if (!Collections.disjoint(accountIdListRequest,accountIdList)){
|
|
|
|
- throw new CostException(500,"存在重复的数据");
|
|
|
|
- }if (NumberConstant.ONE.equals(isShareCost) && NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())){
|
|
|
|
- throw new CostException(500,"责任中心已包含分摊成本");
|
|
|
|
|
|
+ if (!Collections.disjoint(accountIdListRequest, accountIdList)) {
|
|
|
|
+ throw new CostException(500, "存在重复的数据");
|
|
|
|
+ }
|
|
|
|
+ if (NumberConstant.ONE.equals(isShareCost) && NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())) {
|
|
|
|
+ throw new CostException(500, "责任中心已包含分摊成本");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
// 此时是
|
|
// 此时是
|
|
// 责任中心只允许出现一次
|
|
// 责任中心只允许出现一次
|
|
- if (!CollectionUtils.isEmpty(costAccountShareList)){
|
|
|
|
- throw new CostException(500,"该责任中心合并计算已存在");
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(costAccountShareList)) {
|
|
|
|
+ throw new CostException(500, "该责任中心合并计算已存在");
|
|
}
|
|
}
|
|
- if (!NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())){
|
|
|
|
- throw new CostException(500,"合并计算责任中心必须要设置成包含分摊参数");
|
|
|
|
|
|
+ if (!NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())) {
|
|
|
|
+ throw new CostException(500, "合并计算责任中心必须要设置成包含分摊参数");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 检验输入的这个责任中心是否允许输入会计科目
|
|
// 检验输入的这个责任中心是否允许输入会计科目
|
|
Long shareId = responsibility.getShareId();
|
|
Long shareId = responsibility.getShareId();
|
|
CostShareLevel costShareLevel = costShareLevelService.getOne(new QueryWrapper<CostShareLevel>().lambda()
|
|
CostShareLevel costShareLevel = costShareLevelService.getOne(new QueryWrapper<CostShareLevel>().lambda()
|
|
.eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getId, shareId));
|
|
.eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getId, shareId));
|
|
- if (Objects.nonNull(costShareLevel)){
|
|
|
|
- if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
|
|
|
|
- throw new CostException(500,"合并计算不允许选择会计科目");
|
|
|
|
|
|
+ if (Objects.nonNull(costShareLevel)) {
|
|
|
|
+ if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())) {
|
|
|
|
+ throw new CostException(500, "合并计算不允许选择会计科目");
|
|
}
|
|
}
|
|
- if ((StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
|
|
|
|
- throw new CostException(500,"分开计算的责任中心需要选择会计科目");
|
|
|
|
|
|
+ if ((StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ONE.equals(costShareLevel.getCalcType())) {
|
|
|
|
+ throw new CostException(500, "分开计算的责任中心需要选择会计科目");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- throw new CostException(500,"对不起该责任中心没有对应分摊层级");
|
|
|
|
|
|
+ } else {
|
|
|
|
+ throw new CostException(500, "对不起该责任中心没有对应分摊层级");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -205,20 +208,20 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
* @param costAccountShareEditDto
|
|
* @param costAccountShareEditDto
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
public void updateByCostAccountShare(CostAccountShareEditDto costAccountShareEditDto) {
|
|
public void updateByCostAccountShare(CostAccountShareEditDto costAccountShareEditDto) {
|
|
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
Long hospId = user.getHospId();
|
|
Long hospId = user.getHospId();
|
|
Long id = costAccountShareEditDto.getId();
|
|
Long id = costAccountShareEditDto.getId();
|
|
CostAccountShare costAccountShare = baseMapper.selectById(id);
|
|
CostAccountShare costAccountShare = baseMapper.selectById(id);
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"成本分摊参数对应数据不存在");
|
|
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "成本分摊参数对应数据不存在");
|
|
}
|
|
}
|
|
baseMapper.deleteById(id);
|
|
baseMapper.deleteById(id);
|
|
// 新增责任中心成本对照数据
|
|
// 新增责任中心成本对照数据
|
|
CostAccountShareSaveDto costAccountShareSaveDto = BeanUtil.convertObj(costAccountShareEditDto, CostAccountShareSaveDto.class);
|
|
CostAccountShareSaveDto costAccountShareSaveDto = BeanUtil.convertObj(costAccountShareEditDto, CostAccountShareSaveDto.class);
|
|
// 检验输入的数据是否符合规则
|
|
// 检验输入的数据是否符合规则
|
|
- checkAccountShare(costAccountShareSaveDto,hospId);
|
|
|
|
|
|
+ checkAccountShare(costAccountShareSaveDto, hospId);
|
|
CostAccountShareEditDto accountShareEditDto = BeanUtil.convertObj(costAccountShareSaveDto, CostAccountShareEditDto.class);
|
|
CostAccountShareEditDto accountShareEditDto = BeanUtil.convertObj(costAccountShareSaveDto, CostAccountShareEditDto.class);
|
|
CostAccountShare costAccountShareRequest = BeanUtil.convertObj(accountShareEditDto, CostAccountShare.class);
|
|
CostAccountShare costAccountShareRequest = BeanUtil.convertObj(accountShareEditDto, CostAccountShare.class);
|
|
costAccountShareRequest.setId(null);
|
|
costAccountShareRequest.setId(null);
|
|
@@ -235,51 +238,52 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
* @param shareParamEditDto
|
|
* @param shareParamEditDto
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
public void updateShareParam(ShareParamEditDto shareParamEditDto) {
|
|
public void updateShareParam(ShareParamEditDto shareParamEditDto) {
|
|
List<ShareParamProportionVO> shareParamProportionVOList1 = shareParamEditDto.getShareParamProportionVOList();
|
|
List<ShareParamProportionVO> shareParamProportionVOList1 = shareParamEditDto.getShareParamProportionVOList();
|
|
- User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
+ User user = (User) SecurityUtils.getSubject().getPrincipal();
|
|
Long hospId = user.getHospId();
|
|
Long hospId = user.getHospId();
|
|
Long id = shareParamEditDto.getId();
|
|
Long id = shareParamEditDto.getId();
|
|
- CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
|
|
|
|
- .eq(CostAccountShare::getHospId, hospId)
|
|
|
|
- .eq(CostAccountShare::getId, id));
|
|
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"分摊参数对应数据不存在");
|
|
|
|
- }
|
|
|
|
- if (!CollectionUtils.isEmpty(shareParamProportionVOList1)){
|
|
|
|
|
|
+ CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
|
|
|
|
+ .eq(CostAccountShare::getHospId, hospId)
|
|
|
|
+ .eq(CostAccountShare::getId, id));
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "分摊参数对应数据不存在");
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(shareParamProportionVOList1)) {
|
|
List<ShareParamProportionVO> shareParamProportionVOList = shareParamEditDto.getShareParamProportionVOList();
|
|
List<ShareParamProportionVO> shareParamProportionVOList = shareParamEditDto.getShareParamProportionVOList();
|
|
// 检验输入的成本分摊参数是否存在
|
|
// 检验输入的成本分摊参数是否存在
|
|
List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
|
|
List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
|
|
Map<Long, List<CostShareParamVO>> listMap = costShareParamServiceAll.stream().collect(Collectors.groupingBy(CostShareParamVO::getId));
|
|
Map<Long, List<CostShareParamVO>> listMap = costShareParamServiceAll.stream().collect(Collectors.groupingBy(CostShareParamVO::getId));
|
|
- shareParamProportionVOList.forEach(i->{
|
|
|
|
- if (CollectionUtils.isEmpty(listMap.get(i.getId()))){
|
|
|
|
- throw new CostException(500,"分摊名称:"+i.getShareParamName()+"未找到");
|
|
|
|
|
|
+ shareParamProportionVOList.forEach(i -> {
|
|
|
|
+ if (CollectionUtils.isEmpty(listMap.get(i.getId()))) {
|
|
|
|
+ throw new CostException(500, "分摊名称:" + i.getShareParamName() + "未找到");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
// 检验输入的数据的和是否是100
|
|
// 检验输入的数据的和是否是100
|
|
- AtomicReference<Integer> sum= new AtomicReference<>(0);
|
|
|
|
- shareParamProportionVOList.forEach(i->{
|
|
|
|
|
|
+ AtomicReference<Integer> sum = new AtomicReference<>(0);
|
|
|
|
+ shareParamProportionVOList.forEach(i -> {
|
|
sum.updateAndGet(v -> v + i.getShareParamPopout());
|
|
sum.updateAndGet(v -> v + i.getShareParamPopout());
|
|
});
|
|
});
|
|
int max = Integer.parseInt(sum.toString());
|
|
int max = Integer.parseInt(sum.toString());
|
|
- if (!NumberConstant.ONE_HUNDRED.equals(max)){
|
|
|
|
- throw new CostException(500,"分摊比例的和不是100");
|
|
|
|
|
|
+ if (!NumberConstant.ONE_HUNDRED.equals(max)) {
|
|
|
|
+ throw new CostException(500, "分摊比例的和不是100");
|
|
}
|
|
}
|
|
|
|
|
|
// 判断添加的分摊是否存在一样的
|
|
// 判断添加的分摊是否存在一样的
|
|
HashMap<Long, ShareParamProportionVO> hashMap = new HashMap<>();
|
|
HashMap<Long, ShareParamProportionVO> hashMap = new HashMap<>();
|
|
- shareParamProportionVOList.forEach(i->{
|
|
|
|
|
|
+ shareParamProportionVOList.forEach(i -> {
|
|
Long paramId = i.getId();
|
|
Long paramId = i.getId();
|
|
- if (hashMap.containsKey(paramId)){
|
|
|
|
- throw new CostException(500,"不可以添加相同的分摊参数");
|
|
|
|
|
|
+ if (hashMap.containsKey(paramId)) {
|
|
|
|
+ throw new CostException(500, "不可以添加相同的分摊参数");
|
|
}
|
|
}
|
|
- hashMap.put(paramId,i);
|
|
|
|
|
|
+ hashMap.put(paramId, i);
|
|
});
|
|
});
|
|
//
|
|
//
|
|
- String paramList = JsonUtil.toJSONString(shareParamProportionVOList);
|
|
|
|
|
|
+// String paramList = JsonUtil.toJSONString(shareParamProportionVOList);
|
|
|
|
+ String paramList = JacksonUtil.obj2StrPretty(shareParamProportionVOList);
|
|
costAccountShare.setParamList(paramList);
|
|
costAccountShare.setParamList(paramList);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
costAccountShare.setParamList(null);
|
|
costAccountShare.setParamList(null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -297,11 +301,13 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
public List<ShareParamProportionVO> selectShareParamById(Integer id, Long hospId) {
|
|
public List<ShareParamProportionVO> selectShareParamById(Integer id, Long hospId) {
|
|
CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
|
|
CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
|
|
.eq(CostAccountShare::getHospId, hospId).eq(CostAccountShare::getId, id));
|
|
.eq(CostAccountShare::getHospId, hospId).eq(CostAccountShare::getId, id));
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"责任中心成本不存在");
|
|
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "责任中心成本不存在");
|
|
}
|
|
}
|
|
String paramList = costAccountShare.getParamList();
|
|
String paramList = costAccountShare.getParamList();
|
|
- return JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
|
|
|
+// return JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
|
+// return JacksonUtil.string2ObjList(paramList, List.class, ShareParamProportionVO.class);
|
|
|
|
+ return JacksonUtil.str2ObjList(paramList, new TypeReference<List<ShareParamProportionVO>>() {});
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -315,13 +321,14 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
public List<CostShareParamStatusVO> getAllShareParamStatusById(Integer id, Long hospId) {
|
|
public List<CostShareParamStatusVO> getAllShareParamStatusById(Integer id, Long hospId) {
|
|
List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
|
|
List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
|
|
CostAccountShare costAccountShare = baseMapper.selectById(id);
|
|
CostAccountShare costAccountShare = baseMapper.selectById(id);
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"成本分摊对应数据不存在");
|
|
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "成本分摊对应数据不存在");
|
|
}
|
|
}
|
|
String paramList = costAccountShare.getParamList();
|
|
String paramList = costAccountShare.getParamList();
|
|
List<CostShareParamStatusVO> costShareParamStatusVOList = BeanUtil.convertList(costShareParamServiceAll, CostShareParamStatusVO.class);
|
|
List<CostShareParamStatusVO> costShareParamStatusVOList = BeanUtil.convertList(costShareParamServiceAll, CostShareParamStatusVO.class);
|
|
if (!StringUtils.isEmpty(paramList)) {
|
|
if (!StringUtils.isEmpty(paramList)) {
|
|
- List<ShareParamProportionVO> shareParamProportionVOList = JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
|
|
|
+// List<ShareParamProportionVO> shareParamProportionVOList = JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
|
+ List<ShareParamProportionVO> shareParamProportionVOList = JacksonUtil.str2ObjList(paramList, new TypeReference<List<ShareParamProportionVO>>() {});
|
|
Map<Long, List<ShareParamProportionVO>> map = shareParamProportionVOList.stream().collect(Collectors.groupingBy(ShareParamProportionVO::getId));
|
|
Map<Long, List<ShareParamProportionVO>> map = shareParamProportionVOList.stream().collect(Collectors.groupingBy(ShareParamProportionVO::getId));
|
|
costShareParamStatusVOList.forEach(i -> {
|
|
costShareParamStatusVOList.forEach(i -> {
|
|
Long paramId = i.getId();
|
|
Long paramId = i.getId();
|
|
@@ -337,22 +344,22 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
* 拷贝
|
|
* 拷贝
|
|
*
|
|
*
|
|
* @param accountShareCopyDto 赋值数据
|
|
* @param accountShareCopyDto 赋值数据
|
|
- * @param hospId 医院Id
|
|
|
|
|
|
+ * @param hospId 医院Id
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
public void copyAccountShareData(AccountShareCopyDto accountShareCopyDto, Long hospId) {
|
|
public void copyAccountShareData(AccountShareCopyDto accountShareCopyDto, Long hospId) {
|
|
Long id = accountShareCopyDto.getId();
|
|
Long id = accountShareCopyDto.getId();
|
|
CostAccountShare costAccountShare = this.getById(id);
|
|
CostAccountShare costAccountShare = this.getById(id);
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"成本分摊参数设置对应数据不存在");
|
|
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "成本分摊参数设置对应数据不存在");
|
|
}
|
|
}
|
|
List<CostAccountShare> accountShareList = new ArrayList<>();
|
|
List<CostAccountShare> accountShareList = new ArrayList<>();
|
|
List<Long> responsibilityIds = accountShareCopyDto.getResponsibilityIds();
|
|
List<Long> responsibilityIds = accountShareCopyDto.getResponsibilityIds();
|
|
Map<Long, Responsibility> responsibilityMap = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
|
|
Map<Long, Responsibility> responsibilityMap = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
|
|
- .eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOne->synOne));
|
|
|
|
|
|
+ .eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOne -> synOne));
|
|
long millis = System.currentTimeMillis();
|
|
long millis = System.currentTimeMillis();
|
|
- responsibilityIds.forEach(i->{
|
|
|
|
|
|
+ responsibilityIds.forEach(i -> {
|
|
CostAccountShare accountShareRequest = BeanUtil.convertObj(costAccountShare, CostAccountShare.class);
|
|
CostAccountShare accountShareRequest = BeanUtil.convertObj(costAccountShare, CostAccountShare.class);
|
|
accountShareRequest.setId(null);
|
|
accountShareRequest.setId(null);
|
|
accountShareRequest.setCreateTime(millis);
|
|
accountShareRequest.setCreateTime(millis);
|
|
@@ -370,7 +377,6 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
/**
|
|
/**
|
|
* 获取指定类型的责任中心集合 分开计算还是合并计算
|
|
* 获取指定类型的责任中心集合 分开计算还是合并计算
|
|
*
|
|
*
|
|
- *
|
|
|
|
* @param accountShareId
|
|
* @param accountShareId
|
|
* @param hospId
|
|
* @param hospId
|
|
* @return
|
|
* @return
|
|
@@ -378,8 +384,8 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
@Override
|
|
@Override
|
|
public List<Responsibility> getResponsibilityCalType(Long accountShareId, Long hospId) {
|
|
public List<Responsibility> getResponsibilityCalType(Long accountShareId, Long hospId) {
|
|
CostAccountShare costAccountShare = this.getById(accountShareId);
|
|
CostAccountShare costAccountShare = this.getById(accountShareId);
|
|
- if (Objects.isNull(costAccountShare)){
|
|
|
|
- throw new CostException(500,"成本分摊参数设置对应数据不存在");
|
|
|
|
|
|
+ if (Objects.isNull(costAccountShare)) {
|
|
|
|
+ throw new CostException(500, "成本分摊参数设置对应数据不存在");
|
|
}
|
|
}
|
|
Long responsibilityId = costAccountShare.getResponsibilityId();
|
|
Long responsibilityId = costAccountShare.getResponsibilityId();
|
|
Responsibility responsibility = responsibilityService.getById(responsibilityId);
|
|
Responsibility responsibility = responsibilityService.getById(responsibilityId);
|
|
@@ -390,7 +396,7 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
List<Long> responsibilityIds = this.list(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId)).stream().map(CostAccountShare::getResponsibilityId).collect(Collectors.toList());
|
|
List<Long> responsibilityIds = this.list(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId)).stream().map(CostAccountShare::getResponsibilityId).collect(Collectors.toList());
|
|
// 执行类型的分摊级别的Id的集合
|
|
// 执行类型的分摊级别的Id的集合
|
|
List<Long> costShareIds = costShareLevelService.list(new QueryWrapper<CostShareLevel>().lambda()
|
|
List<Long> costShareIds = costShareLevelService.list(new QueryWrapper<CostShareLevel>().lambda()
|
|
- .eq(CostShareLevel::getHospId,hospId).eq(CostShareLevel::getCalcType, calcType))
|
|
|
|
|
|
+ .eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getCalcType, calcType))
|
|
.stream().map(CostShareLevel::getId).collect(Collectors.toList());
|
|
.stream().map(CostShareLevel::getId).collect(Collectors.toList());
|
|
// 筛选责任中心里面符合指定类型的责任中心
|
|
// 筛选责任中心里面符合指定类型的责任中心
|
|
// 筛选指定类型的责任中心 并且当前没有设置的责任中心
|
|
// 筛选指定类型的责任中心 并且当前没有设置的责任中心
|