|
@@ -25,6 +25,8 @@ import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
|
import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
@@ -47,6 +49,7 @@ import java.util.stream.Collectors;
|
|
|
* @author lixuesong
|
|
|
* @date 2021年12月08日 13:57
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/team")
|
|
|
@AllArgsConstructor
|
|
@@ -137,12 +140,14 @@ public class WmTeamController {
|
|
|
// 设置为禁用
|
|
|
wmTeamService.update(Wrappers.<WmTeam>lambdaUpdate()
|
|
|
.eq(WmTeam::getId, id)
|
|
|
- .set(WmTeam::getDelFlag, DelEnum.DELETED.val()));
|
|
|
+ .set(WmTeam::getDelFlag, DelEnum.DELETED.val())
|
|
|
+ .set(WmTeam::getUpdateTime, LocalDateTime.now())
|
|
|
+ .set(WmTeam::getUpdateUser, SecurityUtils.getUser().getId()));
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * TODO
|
|
|
+ * 批量导入
|
|
|
*
|
|
|
* @param teamExcelModelList
|
|
|
* @return
|
|
@@ -150,6 +155,11 @@ public class WmTeamController {
|
|
|
@SysLog("团队批量导入")
|
|
|
@PostMapping("/batch-import")
|
|
|
public R<?> batchImport(@RequestExcel List<WmTeamExcelModel> teamExcelModelList) {
|
|
|
+ // 参数校验
|
|
|
+ if (CollectionUtils.isEmpty(teamExcelModelList)) {
|
|
|
+ log.error("空报表,不能上传");
|
|
|
+ return R.failed("空报表,不能上传");
|
|
|
+ }
|
|
|
|
|
|
return null;
|
|
|
}
|
|
@@ -273,11 +283,13 @@ public class WmTeamController {
|
|
|
public R<List<Map<String, Object>>> listPackageUserScope() {
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
+ Integer userId = SecurityUtils.getUser().getId();
|
|
|
// 查询当前企业下的团队
|
|
|
List<WmTeam> list = wmTeamService.list(Wrappers.<WmTeam>lambdaQuery()
|
|
|
.eq(WmTeam::getDeptId, deptId)
|
|
|
.eq(WmTeam::getDelFlag, DelEnum.NOT_DEL.val())
|
|
|
- .eq(WmTeam::getEnableFlag, EnableEnum.ENABLE.val()));
|
|
|
+ .eq(WmTeam::getEnableFlag, EnableEnum.ENABLE.val())
|
|
|
+ .apply("FIND_IN_SET({0}, leader)", String.valueOf(userId)));
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
List<Map<String, Object>> mapList = list.stream().map(wmTeam -> {
|
|
|
Map<String, Object> teamMap = MapUtil.newHashMap(2);
|
|
@@ -286,19 +298,20 @@ public class WmTeamController {
|
|
|
return teamMap;
|
|
|
}).collect(Collectors.toList());
|
|
|
resultList.addAll(mapList);
|
|
|
- }
|
|
|
- // 拼上原有的字典数据项
|
|
|
- List<SysDictItem> packageUserScopeDictList = sysDictItemService.list(Wrappers.<SysDictItem>lambdaQuery()
|
|
|
- .eq(SysDictItem::getType, "package_user_scope")
|
|
|
- .eq(SysDictItem::getDelFlag, DelEnum.NOT_DEL.val()));
|
|
|
- if (CollectionUtil.isNotEmpty(packageUserScopeDictList)) {
|
|
|
- List<Map<String, Object>> dictMapList = packageUserScopeDictList.stream().map(sysDictItem -> {
|
|
|
- Map<String, Object> dictMap = MapUtil.newHashMap(2);
|
|
|
- dictMap.put("label", sysDictItem.getLabel());
|
|
|
- dictMap.put("value", sysDictItem.getValue());
|
|
|
- return dictMap;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- resultList.addAll(dictMapList);
|
|
|
+ } else {
|
|
|
+ // 原有的字典数据项
|
|
|
+ List<SysDictItem> packageUserScopeDictList = sysDictItemService.list(Wrappers.<SysDictItem>lambdaQuery()
|
|
|
+ .eq(SysDictItem::getType, "package_user_scope")
|
|
|
+ .eq(SysDictItem::getDelFlag, DelEnum.NOT_DEL.val()));
|
|
|
+ if (CollectionUtil.isNotEmpty(packageUserScopeDictList)) {
|
|
|
+ List<Map<String, Object>> dictMapList = packageUserScopeDictList.stream().map(sysDictItem -> {
|
|
|
+ Map<String, Object> dictMap = MapUtil.newHashMap(2);
|
|
|
+ dictMap.put("label", sysDictItem.getLabel());
|
|
|
+ dictMap.put("value", sysDictItem.getValue());
|
|
|
+ return dictMap;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ resultList.addAll(dictMapList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return R.ok(resultList);
|