Commit 54297ad9 by HlQ

[add]

1.项目管理添加文件数量统计功能
2.新增文件类型
1 parent a3266dd6
...@@ -7,7 +7,6 @@ import io.github.linpeilie.Converter; ...@@ -7,7 +7,6 @@ import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt; import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
...@@ -26,6 +25,7 @@ import vion.vo.UserVO; ...@@ -26,6 +25,7 @@ import vion.vo.UserVO;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/api") @RequestMapping("/api")
...@@ -69,12 +69,12 @@ public class StoreController { ...@@ -69,12 +69,12 @@ public class StoreController {
public String saveOrUpdate(@RequestBody StoreDTO data) { public String saveOrUpdate(@RequestBody StoreDTO data) {
UserVO user = (UserVO) StpUtil.getTokenSession().get("curLoginUser"); UserVO user = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
// 创建项目时,默认维保状态为 --
data.setMaintainStatus("--");
Store store = converter.convert(data, Store.class); Store store = converter.convert(data, Store.class);
if (data.getId() != null) { if (data.getId() != null) {
store.setModifyUser(user.getId()); store.setModifyUser(user.getId());
} else { } else {
// 创建项目时,默认维保状态为 --
store.setMaintainStatus("--");
store.setCreateUser(user.getId()); store.setCreateUser(user.getId());
} }
return storeService.saveOrUpdate(store) ? "成功" : "失败"; return storeService.saveOrUpdate(store) ? "成功" : "失败";
...@@ -95,8 +95,8 @@ public class StoreController { ...@@ -95,8 +95,8 @@ public class StoreController {
@GetMapping("/store/manualCal") @GetMapping("/store/manualCal")
@SaCheckPermission(value = "store:calMaintainStatus", orRole = "admin") @SaCheckPermission(value = "store:calMaintainStatus", orRole = "admin")
// todo 权限未加,前端未使用到该接口 // todo 权限未加,前端未使用到该接口
public String manualCalMaintainStatus() { public String manualCalMaintainStatus(@RequestParam(required = false) List<Long> storeIdList) {
return storeService.calMaintainStatus(ListUtil.empty()); return storeService.calMaintainStatus(storeIdList);
} }
@GetMapping("/store/user/{storeId}") @GetMapping("/store/user/{storeId}")
...@@ -161,4 +161,10 @@ public class StoreController { ...@@ -161,4 +161,10 @@ public class StoreController {
return storeService.addTag(id, tagIdList); return storeService.addTag(id, tagIdList);
} }
@GetMapping("/store/fileDetail")
@SaCheckPermission(value = "store:fileDetail", orRole = "admin")
public List<Map<String, Number>> fileDetail(@RequestParam List<Long> storeIdList) {
return storeService.fileDetail(storeIdList);
}
} }
...@@ -32,6 +32,7 @@ public class FileInfo { ...@@ -32,6 +32,7 @@ public class FileInfo {
* <br>16客户提交的门店图纸,17点位设计图,18合同范本,19客户上传的合同,20安装上线,与总部邮件截图</br> * <br>16客户提交的门店图纸,17点位设计图,18合同范本,19客户上传的合同,20安装上线,与总部邮件截图</br>
* <br>21服务单等表单富文本编辑器里传图用这个类型</br> * <br>21服务单等表单富文本编辑器里传图用这个类型</br>
* <br>22备件,23返修</br> * <br>22备件,23返修</br>
* <br>24验收报告,25竣工图纸,26点位表,27项目总结</br>
*/ */
private Integer sourceType; private Integer sourceType;
/** 文件来源id */ /** 文件来源id */
......
...@@ -2,12 +2,14 @@ package vion.service; ...@@ -2,12 +2,14 @@ package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
import org.springframework.web.bind.annotation.RequestParam;
import vion.dto.StatusDTO; import vion.dto.StatusDTO;
import vion.dto.StoreDTO; import vion.dto.StoreDTO;
import vion.model.Store; import vion.model.Store;
import vion.vo.StoreVO; import vion.vo.StoreVO;
import java.util.List; import java.util.List;
import java.util.Map;
public interface IStoreService extends MPJBaseService<Store> { public interface IStoreService extends MPJBaseService<Store> {
...@@ -23,4 +25,5 @@ public interface IStoreService extends MPJBaseService<Store> { ...@@ -23,4 +25,5 @@ public interface IStoreService extends MPJBaseService<Store> {
String addTag(Long id, List<Long> tagIdList); String addTag(Long id, List<Long> tagIdList);
List<Map<String, Number>> fileDetail(@RequestParam List<Long> storeIdList);
} }
...@@ -84,12 +84,20 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -84,12 +84,20 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.page(Page.of(data.getPageNum(), data.getPageSize())); .page(Page.of(data.getPageNum(), data.getPageSize()));
// todo 缓存 // todo 缓存
List<Account> accountList = accountService.list(); List<Account> accountList = accountService.list();
List<FileInfo> fileInfoList = fileService.lambdaQuery().eq(FileInfo::getSourceType, 1).list();
var store2CntMap = fileInfoList.stream().collect(Collectors.groupingBy(FileInfo::getStoreId, Collectors.counting()));
var storeIdList = Opt.ofEmptyAble(storeList.getRecords()) var storeIdList = Opt.ofEmptyAble(storeList.getRecords())
.map(recs -> recs.stream().map(Store::getId).collect(Collectors.toList())) .map(recs -> recs.stream().map(Store::getId).collect(Collectors.toList()))
.orElse(ListUtil.empty()); .orElse(ListUtil.empty());
// storeId -> 文件数量
var store2CntMap = Opt.ofEmptyAble(storeIdList)
.map(l -> fileService.lambdaQuery()
.in(FileInfo::getSourceId, l)
.in(FileInfo::getStoreId, l)
.in(FileInfo::getSourceType, 1, 24, 25, 26, 27)
.list())
.map(fileList -> fileList.stream().collect(Collectors.groupingBy(FileInfo::getStoreId, Collectors.counting())))
.orElse(MapUtil.empty());
// storeId -> 项目绑定的合同的 list // storeId -> 项目绑定的合同的 list
var storeIdMap = Opt.ofEmptyAble(storeIdList) var storeIdMap = Opt.ofEmptyAble(storeIdList)
.map(l -> contractStoreService.lambdaQuery().in(RContractStore::getStoreId, l).list()) .map(l -> contractStoreService.lambdaQuery().in(RContractStore::getStoreId, l).list())
...@@ -174,7 +182,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -174,7 +182,7 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
.map(c -> contractId2CpMap.getOrDefault(c.getId(), ListUtil.empty())) .map(c -> contractId2CpMap.getOrDefault(c.getId(), ListUtil.empty()))
.filter(CollUtil::isNotEmpty) .filter(CollUtil::isNotEmpty)
.map(l -> l.get(0).getNodeDate()) .map(l -> l.get(0).getNodeDate())
.ifPresent(masterContract::setFinalDate); .ifPresent(nodeDate -> masterContract.setFinalDate(nodeDate));
storeVO.setMainContract(Opt.ofNullable(masterContract).map(c -> converter.convert(c, ContractVO.class)).orElse(null)); storeVO.setMainContract(Opt.ofNullable(masterContract).map(c -> converter.convert(c, ContractVO.class)).orElse(null));
storeVO.setTaskCount(store2TaskIdMap.getOrDefault(storeId, ListUtil.empty()).size()); storeVO.setTaskCount(store2TaskIdMap.getOrDefault(storeId, ListUtil.empty()).size());
...@@ -364,4 +372,24 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp ...@@ -364,4 +372,24 @@ public class StoreServiceImpl extends MPJBaseServiceImpl<StoreMapper, Store> imp
}); });
return "成功"; return "成功";
} }
@Override
public List<Map<String, Number>> fileDetail(List<Long> storeIdList) {
var fileList = fileService.lambdaQuery()
.in(FileInfo::getSourceId, storeIdList)
.in(FileInfo::getStoreId, storeIdList)
.in(FileInfo::getSourceType, 1, 24, 25, 26, 27)
.list();
var storeId2FileMap = fileList.stream().collect(Collectors.groupingBy(FileInfo::getStoreId,Collectors.groupingBy(FileInfo::getSourceType)));
return storeIdList.stream().map(storeId -> {
var fileMap = storeId2FileMap.getOrDefault(storeId, MapUtil.empty());
Map<String, Number> map = new HashMap<>();
map.put("storeId", storeId);
map.put("24", fileMap.getOrDefault(24, List.of()).size());
map.put("25", fileMap.getOrDefault(25, List.of()).size());
map.put("26", fileMap.getOrDefault(26, List.of()).size());
map.put("27", fileMap.getOrDefault(27, List.of()).size());
return map;
}).collect(Collectors.toList());
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!