|
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
@ -105,55 +106,26 @@ public class ApplyController extends BladeController { |
|
|
|
|
@GetMapping("/getEveryStatusAndCount") |
|
|
|
|
public Map<String, Integer> getEveryStatusAndCount(String isGetAll, Integer getType) { |
|
|
|
|
Map<String, Integer> map = new HashMap<>(6); |
|
|
|
|
QueryWrapper<Apply> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
// 驳回
|
|
|
|
|
queryWrapper.eq("status", -1); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("bh", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
// 待审核
|
|
|
|
|
queryWrapper.eq("status", 0); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("dsh", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
// 待出库
|
|
|
|
|
queryWrapper.eq("status", 1); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("dck", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
// 待确定
|
|
|
|
|
queryWrapper.eq("status", 2); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("dqd", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
// 待归还
|
|
|
|
|
queryWrapper.eq("status", 3); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("dgh", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
// 申领完成
|
|
|
|
|
queryWrapper.eq("status", 4); |
|
|
|
|
if (!"1".equals(isGetAll)) { |
|
|
|
|
queryWrapper.eq("create_dept", AuthUtil.getDeptId()); |
|
|
|
|
queryWrapper.eq("get_type", getType); |
|
|
|
|
} |
|
|
|
|
map.put("slwc", applyService.count(queryWrapper)); |
|
|
|
|
queryWrapper.clear(); |
|
|
|
|
|
|
|
|
|
// 定义状态映射
|
|
|
|
|
Map<String, Integer> statusMap = new LinkedHashMap<>(); |
|
|
|
|
statusMap.put("bh", -1); // 驳回
|
|
|
|
|
statusMap.put("dsh", 0); // 待审核
|
|
|
|
|
statusMap.put("dck", 1); // 待出库
|
|
|
|
|
statusMap.put("dqd", 2); // 待确定
|
|
|
|
|
statusMap.put("dgh", 3); // 待归还
|
|
|
|
|
statusMap.put("slwc", 4); // 申领完成
|
|
|
|
|
|
|
|
|
|
// 遍历状态映射并执行查询
|
|
|
|
|
statusMap.forEach((key, status) -> { |
|
|
|
|
LambdaQueryWrapper<Apply> wrapper = Wrappers.<Apply>lambdaQuery() |
|
|
|
|
.eq(Apply::getStatus, status) |
|
|
|
|
.eq(Apply::getGetType, getType) |
|
|
|
|
.eq(!"1".equals(isGetAll), Apply::getCreateDept, AuthUtil.getDeptId()); |
|
|
|
|
|
|
|
|
|
map.put(key, applyService.count(wrapper)); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -483,4 +455,4 @@ public class ApplyController extends BladeController { |
|
|
|
|
public R applyCheck() { |
|
|
|
|
return R.data(applyService.applyCheck()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |