Browse Source

分页查询返回集合

ljx 4 years ago
parent
commit
c0f58ae03b

+ 5 - 1
src/main/java/com/imed/costaccount/model/vo/CostAccountShareVO.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * @author 李加喜
  * @Package com.imed.costaccount.model.vo
@@ -28,8 +30,10 @@ public class CostAccountShareVO {
     @ApiModelProperty(name = "responsibilityCode",value = "责任中心名称")
     private String responsibilityName;
 
-    @ApiModelProperty(name = "accountingId",value = "会计科目的Id")
+    @ApiModelProperty(name = "accountingIds",value = "会计科目的Ids")
     private String accountingIds;
+    @ApiModelProperty(name = "accountingIdList",value = "会计科目的Id集合  前端回显")
+    private List<String> accountingIdList;
 
     @ApiModelProperty(name = "accountingName",value = "会计科目名称")
     private String accountingNames;

+ 9 - 2
src/main/java/com/imed/costaccount/service/impl/CostAccountShareServiceImpl.java

@@ -68,6 +68,13 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         List<CostAccountShare> costAccountShareList = pages.getRecords();
 
         List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
+        costAccountShareVOList.forEach(i->{
+            String accountingIds = i.getAccountingIds();
+            if (StrUtil.isNotBlank(accountingIds)){
+                List<String> list = Arrays.asList(accountingIds.split(StrUtil.COMMA));
+                i.setAccountingIdList(list);
+            }
+        });
 //        getMessage(hospId, costAccountShareVOList);
         PageUtils pageUtils = new PageUtils(pages);
         pageUtils.setList(costAccountShareVOList);
@@ -144,7 +151,7 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
         costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
         if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())){
             // 这个责任中心允许输入会计科目
-            List<String> accountIdList = Arrays.asList(costAccountShareSaveDto.getAccountingIds().split(StrUtil.COMMA));
+            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));
             if (CollectionUtils.isEmpty(accountingList)){
                 throw new CostException(500,"输入的会计科目不存在");
@@ -162,7 +169,7 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
             List<CostAccountShare> list = costAccountMap.get(costAccountShareSaveDto.getResponsibilityCode());
             if (!CollectionUtils.isEmpty(list)){
                 String accountingIds = list.get(0).getAccountingIds();
-                List<String> accountIdListRequest = Arrays.asList(accountingIds.split(StrUtil.COMMA));
+                List<Long> accountIdListRequest = Arrays.stream(accountingIds.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
                 if (!Collections.disjoint(accountIdListRequest,accountIdList)){
                     throw new CostException(500,"存在重复的数据");
                 }

+ 1 - 2
src/main/java/com/imed/costaccount/web/ResponsibilityController.java

@@ -12,7 +12,6 @@ import com.imed.costaccount.service.ResponsibilityService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.SecurityUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -49,7 +48,7 @@ public class ResponsibilityController extends AbstractController{
     }
 
     @GetMapping("/getLevelTwo")
-    @ApiOperation("获取不是汇总中心列表")
+    @ApiOperation("获取不是汇总中心列表")
     public Result getLevelTwo(){
         User user = getUser();
         Long hospId = user.getHospId();