成本科目权限修改
This commit is contained in:
parent
81e92184cb
commit
539c86b969
7
pom.xml
7
pom.xml
@ -294,16 +294,17 @@
|
||||
</dependency>
|
||||
|
||||
<!--mysql-->
|
||||
<!-- <dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.48</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.11</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- Swagger API文档 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
|
||||
@ -47,7 +47,7 @@ public class OrganizationJobController {
|
||||
@PostMapping(value = "/selectList")
|
||||
public Result<List<OrganizationJob>> selectList(@RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<OrganizationJob> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OrganizationJob::getSn, MapUtils.getString(map, "sn"));
|
||||
// queryWrapper.lambda().eq(OrganizationJob::getSn, MapUtils.getString(map, "sn"));
|
||||
List<OrganizationJob> pageList = organizationJobService.list(queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
@ -61,7 +61,7 @@ public class OrganizationJobController {
|
||||
@PostMapping(value = "/selectPage")
|
||||
public Result<Page<OrganizationJob>> selectPage(@RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<OrganizationJob> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OrganizationJob::getSn, MapUtils.getString(map, "sn"));
|
||||
// queryWrapper.lambda().eq(OrganizationJob::getSn, MapUtils.getString(map, "sn"));
|
||||
Page page = PageUtil.getPage(map);
|
||||
Page<OrganizationJob> pageList = organizationJobService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
|
||||
@ -407,6 +407,7 @@ public class CostBudgetController {
|
||||
String startUser = object.getString("startUser");
|
||||
String projectSn = object.getJSONArray("projectSn").get(0).toString();
|
||||
String fileName = object.getJSONArray("file").getJSONObject(0).getString("url");
|
||||
Integer version = object.getJSONArray("version").getJSONObject(0).getInteger("url");
|
||||
String basePath = fileStorageProperties.getLocal().get(0).getBasePath();
|
||||
MultipartFile multipartFile = FileUtil.getMulFileByPath(basePath + fileName);
|
||||
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn);
|
||||
@ -438,6 +439,7 @@ public class CostBudgetController {
|
||||
costBudget.setCreateTime(new Date());
|
||||
costBudget.setIsCount(StringUtils.isBlank(codeList.get(0).getName()));
|
||||
costBudget.setLevel(codeList.get(0).getLevel());
|
||||
costBudget.setVersion(version);
|
||||
costBudgetList.add(costBudget);
|
||||
}
|
||||
int num = 0;
|
||||
|
||||
@ -16,8 +16,11 @@ import com.zhgd.xmgl.modules.basicdata.entity.Company;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostBudget;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubjectToOrganizationJob;
|
||||
import com.zhgd.xmgl.modules.cost.entity.dto.BindOrganizationJobDto;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostBudgetService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectToOrganizationJobService;
|
||||
import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
@ -31,13 +34,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@ -64,6 +65,9 @@ public class CostSubjectController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICostBudgetService costBudgetService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICostSubjectToOrganizationJobService toOrganizationJobService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -99,35 +103,6 @@ public class CostSubjectController {
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最下级节点
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "成本科目管理", operType = "列表查询", operDesc = "获取最下级节点")
|
||||
@ApiOperation(value = " 获取最下级节点", notes = "获取最下级节点", httpMethod = "POST")
|
||||
@PostMapping(value = "/lastNodeList")
|
||||
public Result<List<CostSubject>> lastNodeList(@RequestBody Map<String, Object> map) {
|
||||
List<CostSubject> lastNodeList = new ArrayList<>();
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
if (StringUtils.isBlank(projectSn)) {
|
||||
return Result.success(lastNodeList);
|
||||
}
|
||||
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn);
|
||||
Company company = companyService.getOne(Wrappers.<Company>lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn()));
|
||||
List<CostSubject> list = costSubjectService.list(Wrappers.<CostSubject>lambdaQuery()
|
||||
.eq(CostSubject::getSn, company.getHeadquartersSn())
|
||||
.eq(CostSubject::getType, projectInfoBySn.getProjectLx()));
|
||||
for (CostSubject subject : list) {
|
||||
long count = list.stream().filter(l -> l.getParentId().toString().equals(subject.getId().toString())).count();
|
||||
if (count == 0 && StringUtils.isNotBlank(subject.getName())) {
|
||||
lastNodeList.add(subject);
|
||||
}
|
||||
}
|
||||
return Result.success(lastNodeList);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 列表查询
|
||||
// *
|
||||
@ -156,6 +131,35 @@ public class CostSubjectController {
|
||||
// return Result.success(list);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取最下级节点
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "成本科目管理", operType = "列表查询", operDesc = "获取最下级节点")
|
||||
@ApiOperation(value = " 获取最下级节点", notes = "获取最下级节点", httpMethod = "POST")
|
||||
@PostMapping(value = "/lastNodeList")
|
||||
public Result<List<CostSubject>> lastNodeList(@RequestBody Map<String, Object> map) {
|
||||
List<CostSubject> lastNodeList = new ArrayList<>();
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
if (StringUtils.isBlank(projectSn)) {
|
||||
return Result.success(lastNodeList);
|
||||
}
|
||||
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn);
|
||||
Company company = companyService.getOne(Wrappers.<Company>lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn()));
|
||||
List<CostSubject> list = costSubjectService.list(Wrappers.<CostSubject>lambdaQuery()
|
||||
.eq(CostSubject::getSn, company.getHeadquartersSn())
|
||||
.eq(CostSubject::getType, projectInfoBySn.getProjectLx()));
|
||||
for (CostSubject subject : list) {
|
||||
long count = list.stream().filter(l -> l.getParentId().toString().equals(subject.getId().toString())).count();
|
||||
if (count == 0 && StringUtils.isNotBlank(subject.getName())) {
|
||||
lastNodeList.add(subject);
|
||||
}
|
||||
}
|
||||
return Result.success(lastNodeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
@ -181,7 +185,7 @@ public class CostSubjectController {
|
||||
}
|
||||
Page<CostSubject> page = PageUtil.getPage(map);
|
||||
QueryWrapper<CostSubject> queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map);
|
||||
Page<CostSubject> list = costSubjectService.tree(page, queryWrapper);
|
||||
Page<CostSubject> list = costSubjectService.tree(page, queryWrapper, map);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@ -282,7 +286,7 @@ public class CostSubjectController {
|
||||
Integer toLevelType = MapUtils.getInteger(param, "toLevelType");
|
||||
String sn = MapUtils.getString(param, "sn");
|
||||
List<CostSubject> exists = costSubjectService.list(new LambdaQueryWrapper<CostSubject>().eq(CostSubject::getSn, sn));
|
||||
Set<String> existCodes = exists.stream().map(CostSubject::getCode).collect(Collectors.toSet());
|
||||
Map<String, CostSubject> existCodes = exists.stream().collect(Collectors.toMap(CostSubject::getCode, Function.identity(), (k1, k2) -> k1));
|
||||
List<Long> subjectIds = exists.stream().map(CostSubject::getId).collect(Collectors.toList());
|
||||
Set<String> useCodes = new HashSet<>();
|
||||
if (CollUtil.isNotEmpty(subjectIds)) {
|
||||
@ -303,7 +307,7 @@ public class CostSubjectController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
private void addCostSubject(CostSubject costSubject, List<CostSubject> list, String sn, Long parentId, Integer toLevelType, Set<String> existCodes, Set<String> useCodes) {
|
||||
private void addCostSubject(CostSubject costSubject, List<CostSubject> list, String sn, Long parentId, Integer toLevelType, Map<String, CostSubject> existCodes, Set<String> useCodes) {
|
||||
List<CostSubject> childList = list.stream().filter(subject -> Objects.equals(subject.getParentId(), costSubject.getId())).collect(Collectors.toList());
|
||||
CostSubject costSubject1 = JSON.parseObject(JSON.toJSONString(costSubject), CostSubject.class);
|
||||
costSubject1.setId(null);
|
||||
@ -321,19 +325,52 @@ public class CostSubjectController {
|
||||
costSubject1.setLevelType(toLevelType);
|
||||
// costSubject1.setChildren(Lists.newArrayList());
|
||||
if (!useCodes.contains(costSubject1.getCode())) {
|
||||
if (existCodes.contains(costSubject1.getCode())) {
|
||||
if (existCodes.containsKey(costSubject1.getCode())) {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
costSubjectService.update(new LambdaUpdateWrapper<CostSubject>().set(CostSubject::getCreateBy, user.getUserId().toString())
|
||||
.set(CostSubject::getUpdateTime, new Date()).eq(CostSubject::getSn, sn).eq(CostSubject::getCode, costSubject1.getCode()));
|
||||
} else {
|
||||
costSubjectService.saveInfo(costSubject1);
|
||||
parentId = costSubject1.getId();
|
||||
}
|
||||
}
|
||||
if (existCodes.containsKey(costSubject.getCode())) {
|
||||
parentId = existCodes.get(costSubject.getCode()).getId();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(childList)) {
|
||||
for (CostSubject subject : childList) {
|
||||
addCostSubject(subject, list, sn, costSubject1.getId(), toLevelType, existCodes, useCodes);
|
||||
addCostSubject(subject, list, sn, parentId, toLevelType, existCodes, useCodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OperLog(operModul = "成本科目管理", operType = "", operDesc = "成本科目绑定岗位信息")
|
||||
@ApiOperation(value = "成本科目绑定岗位信息", notes = "成本科目绑定岗位信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/bindOrganizationJob")
|
||||
public Result bindOrganizationJob(@RequestBody BindOrganizationJobDto bindOrganizationJobDto) {
|
||||
toOrganizationJobService.remove(new LambdaQueryWrapper<CostSubjectToOrganizationJob>().eq(CostSubjectToOrganizationJob::getCostSubjectId, bindOrganizationJobDto.getCostSubjectId()));
|
||||
List<Long> organizationJobIds = bindOrganizationJobDto.getOrganizationJobIds();
|
||||
if (CollUtil.isNotEmpty(organizationJobIds)) {
|
||||
ArrayList<CostSubjectToOrganizationJob> toOrganizationJobs = new ArrayList<>();
|
||||
for (Long jobId : organizationJobIds) {
|
||||
CostSubjectToOrganizationJob toOrganizationJob = new CostSubjectToOrganizationJob();
|
||||
toOrganizationJob.setCostSubjectId(bindOrganizationJobDto.getCostSubjectId());
|
||||
toOrganizationJob.setOrganizationJobId(jobId);
|
||||
toOrganizationJobs.add(toOrganizationJob);
|
||||
}
|
||||
toOrganizationJobService.saveBatch(toOrganizationJobs);
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "成本科目管理", operType = "", operDesc = "查询一个成本科目绑定岗位ids")
|
||||
@ApiOperation(value = "查询一个成本科目绑定岗位ids", notes = "查询一个成本科目绑定岗位ids", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "costSubjectId", value = "成本科目ID", paramType = "query", required = true, dataType = "String")
|
||||
@GetMapping(value = "/getBindOrganizationJobIds")
|
||||
public Result<List<Long>> getBindOrganizationJobIds(@RequestParam String costSubjectId) {
|
||||
List<CostSubjectToOrganizationJob> list = toOrganizationJobService.list(new LambdaQueryWrapper<CostSubjectToOrganizationJob>().eq(CostSubjectToOrganizationJob::getCostSubjectId, costSubjectId));
|
||||
return Result.success(list.stream().map(CostSubjectToOrganizationJob::getOrganizationJobId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -41,4 +41,8 @@ public class CompanyProjectDto {
|
||||
@Excel(name = "父级ID", width = 15)
|
||||
@ApiModelProperty(value = "父级ID")
|
||||
private List<CompanyProjectDto> childrenList;
|
||||
|
||||
@ApiModelProperty(value = "项目类型")
|
||||
private java.lang.String projectLx;
|
||||
|
||||
}
|
||||
|
||||
@ -95,6 +95,11 @@ public class CostBudget implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "最后操作时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 版本(字典数据)
|
||||
*/
|
||||
@ApiModelProperty(value = "版本(字典数据)")
|
||||
private Integer version;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "科目级别")
|
||||
|
||||
@ -93,11 +93,41 @@ public class CostSubject implements Serializable {
|
||||
*/
|
||||
@ApiModelProperty(value = "级别类型:1:集团标准控制科目;2:公司控制科目;3:项目控制科目;")
|
||||
private Integer levelType;
|
||||
|
||||
/**
|
||||
* 科目归属(字典数据)
|
||||
*/
|
||||
@ApiModelProperty(value = "科目归属(字典数据)")
|
||||
private String subjectAttribution;
|
||||
/**
|
||||
* 是否科目大类(0否1是)
|
||||
*/
|
||||
@ApiModelProperty(value = "是否科目大类(0否1是)")
|
||||
private Integer isLargeCategory;
|
||||
/**
|
||||
* 科目细类(字典数据)
|
||||
*/
|
||||
@ApiModelProperty(value = "科目细类(字典数据)")
|
||||
private String subjectConcreteCategory;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String description;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "子级科目信息")
|
||||
private List<CostSubject> children;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "是否有权限修改删除")
|
||||
private Boolean hasPermission;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "科目类型名称")
|
||||
private String typeName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "科目归属名称")
|
||||
private String subjectAttributionName;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "科目细类名称")
|
||||
private String subjectConcreteCategoryName;
|
||||
/* @Excel(name = "预算成本", width = 15)
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "预算成本")
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.zhgd.xmgl.modules.cost.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
/**
|
||||
* @Description: 成本科目和组织岗位中间表
|
||||
* @author: pds
|
||||
* @date: 2024-09-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cost_subject_to_organization_job")
|
||||
@ApiModel(value="CostSubjectToOrganizationJob实体类",description="CostSubjectToOrganizationJob")
|
||||
public class CostSubjectToOrganizationJob implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
private java.lang.Long id ;
|
||||
/**成本科目ID*/
|
||||
@Excel(name = "成本科目ID", width = 15)
|
||||
@ApiModelProperty(value="成本科目ID")
|
||||
private java.lang.Long costSubjectId ;
|
||||
/**组织岗位ID*/
|
||||
@Excel(name = "组织岗位ID", width = 15)
|
||||
@ApiModelProperty(value="组织岗位ID")
|
||||
private java.lang.Long organizationJobId ;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.cost.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BindOrganizationJobDto {
|
||||
@ApiModelProperty("成本科目id")
|
||||
private Long costSubjectId;
|
||||
@ApiModelProperty("岗位ids")
|
||||
private List<Long> organizationJobIds;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.zhgd.xmgl.modules.cost.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubjectToOrganizationJob;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 成本科目和组织岗位中间表
|
||||
* @author: pds
|
||||
* @date: 2024-09-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CostSubjectToOrganizationJobMapper extends BaseMapper<CostSubjectToOrganizationJob> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.cost.mapper.CostSubjectToOrganizationJobMapper">
|
||||
|
||||
</mapper>
|
||||
@ -1,6 +1,5 @@
|
||||
package com.zhgd.xmgl.modules.cost.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
|
||||
@ -19,7 +18,7 @@ import java.util.Map;
|
||||
*/
|
||||
public interface ICostSubjectService extends IService<CostSubject> {
|
||||
|
||||
Page<CostSubject> tree(Page page, QueryWrapper<CostSubject> wrapper);
|
||||
Page<CostSubject> tree(Page page, QueryWrapper<CostSubject> wrapper, Map<String, Object> map);
|
||||
|
||||
boolean saveInfo(CostSubject costSubject);
|
||||
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
package com.zhgd.xmgl.modules.cost.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubjectToOrganizationJob;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 成本科目和组织岗位中间表
|
||||
* @author: pds
|
||||
* @date: 2024-09-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface ICostSubjectToOrganizationJobService extends IService<CostSubjectToOrganizationJob> {
|
||||
/**
|
||||
* 分页列表查询成本科目和组织岗位中间表信息
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<CostSubjectToOrganizationJob> queryPageList(HashMap<String, Object> param);
|
||||
/**
|
||||
* 列表查询成本科目和组织岗位中间表信息
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<CostSubjectToOrganizationJob> queryList(HashMap<String, Object> param);
|
||||
/**
|
||||
* 添加成本科目和组织岗位中间表信息
|
||||
* @param costSubjectToOrganizationJob 成本科目和组织岗位中间表
|
||||
* @return
|
||||
*/
|
||||
void add(CostSubjectToOrganizationJob costSubjectToOrganizationJob);
|
||||
/**
|
||||
* 编辑成本科目和组织岗位中间表信息
|
||||
* @param costSubjectToOrganizationJob 成本科目和组织岗位中间表
|
||||
* @return
|
||||
*/
|
||||
void edit(CostSubjectToOrganizationJob costSubjectToOrganizationJob);
|
||||
/**
|
||||
* 根据id删除成本科目和组织岗位中间表信息
|
||||
* @param id 成本科目和组织岗位中间表的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
/**
|
||||
* 根据id查询成本科目和组织岗位中间表信息
|
||||
* @param id 成本科目和组织岗位中间表的id
|
||||
* @return
|
||||
*/
|
||||
CostSubjectToOrganizationJob queryById(String id);
|
||||
|
||||
}
|
||||
@ -3,11 +3,10 @@ package com.zhgd.xmgl.modules.cost.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostBudgetDto;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostContractPlanDto;
|
||||
import com.zhgd.xmgl.modules.cost.dto.DynamicCostDto;
|
||||
import com.zhgd.xmgl.modules.cost.entity.*;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostContractPayPlanMapper;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostContractPlanMapper;
|
||||
import com.zhgd.xmgl.modules.cost.service.*;
|
||||
import com.zhgd.xmgl.modules.cost.vo.CostContractPlanVo;
|
||||
@ -17,12 +16,8 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -30,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @Description: 合约规划
|
||||
* @author: pengj
|
||||
* @date: 2024-07-31
|
||||
* @date: 2024-07-31
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -54,8 +49,13 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
||||
List<CostSubject> parentSubList = allSubList.stream().filter(l -> l.getParentId().toString().equals("0") && StringUtils.isNotBlank(l.getName())).collect(Collectors.toList());
|
||||
List<CostContractPlanDto> resultList = new ArrayList<>();
|
||||
if (allSubList.size() > 0) {
|
||||
CostBudget b = costBudgetService.getOne(Wrappers.<CostBudget>lambdaQuery()
|
||||
.eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn())
|
||||
.orderByDesc(CostBudget::getVersion).last("limit 1"));
|
||||
List<CostBudget> budgetList = costBudgetService.list(Wrappers.<CostBudget>lambdaQuery()
|
||||
.eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
.eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn())
|
||||
.eq(CostBudget::getVersion, b != null ? b.getVersion() : -1)
|
||||
);
|
||||
List<CostContract> contractList = costContractService.list(Wrappers.<CostContract>lambdaQuery()
|
||||
.eq(CostContract::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
List<CostContractPlan> contractPlanList = this.list(Wrappers.<CostContractPlan>lambdaQuery()
|
||||
@ -133,7 +133,7 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
||||
return this.removeById(costContractPlan.getId());
|
||||
}
|
||||
|
||||
// private void getChildren(List<CostContractPlanDto> list, List<CostContractPlanDto> allList, List<CostContractPlanDto> planList, List<CostBudget> budgetList) {
|
||||
// private void getChildren(List<CostContractPlanDto> list, List<CostContractPlanDto> allList, List<CostContractPlanDto> planList, List<CostBudget> budgetList) {
|
||||
// for (CostContractPlanDto costContractPlan : list) {
|
||||
// costContractPlan.setType(0);
|
||||
// List<CostContractPlanDto> childrenList = allList.stream().filter(a -> a.getSubjectId().toString().equals(costContractPlan.getId().toString())).collect(Collectors.toList());
|
||||
|
||||
@ -2,20 +2,24 @@ package com.zhgd.xmgl.modules.cost.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostDynamicDto;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostContract;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubjectToOrganizationJob;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostSubjectMapper;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostContractService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectService;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectToOrganizationJobService;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
@ -23,21 +27,17 @@ import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 成本科目
|
||||
* @author: pengj
|
||||
* @date: 2024-07-03
|
||||
* @date: 2024-07-03
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -48,14 +48,30 @@ public class CostSubjectServiceImpl extends ServiceImpl<CostSubjectMapper, CostS
|
||||
|
||||
@Autowired
|
||||
private ICostContractService costContractService;
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ICostSubjectToOrganizationJobService toOrganizationJobService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
@Override
|
||||
public Page<CostSubject> tree(Page page, QueryWrapper<CostSubject> wrapper) {
|
||||
public Page<CostSubject> tree(Page page, QueryWrapper<CostSubject> wrapper, Map<String, Object> map) {
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
wrapper.lambda().eq(CostSubject::getParentId, 0);
|
||||
wrapper.lambda().isNotNull(CostSubject::getName);
|
||||
List<CostSubject> allList = this.list();
|
||||
Page<CostSubject> pageList = this.page(page, wrapper);
|
||||
getChildren(pageList.getRecords(), allList);
|
||||
Long jobId = systemUserService.getById(SecurityUtils.getUser().getUserId()).getJobId();
|
||||
List<CostSubjectToOrganizationJob> toOrganizationJobs = toOrganizationJobService.list(new LambdaQueryWrapper<CostSubjectToOrganizationJob>().eq(CostSubjectToOrganizationJob::getOrganizationJobId, jobId));
|
||||
Set<Long> hasSubjectIds = toOrganizationJobs.stream().map(CostSubjectToOrganizationJob::getCostSubjectId).collect(Collectors.toSet());
|
||||
List<CostSubject> records = pageList.getRecords();
|
||||
Map<String, String> typeMap = dictionaryItemService.getDictList("project_lx", projectSn).stream().collect(Collectors.toMap(DictionaryItem::getData, DictionaryItem::getName, (s, s2) -> s));
|
||||
Map<String, String> subjectAttributionMap = dictionaryItemService.getDictList("cost_subject_attribution", projectSn).stream().collect(Collectors.toMap(DictionaryItem::getData, DictionaryItem::getName, (s, s2) -> s));
|
||||
Map<String, String> subjectConcreteCategoryMap = dictionaryItemService.getDictList("cost_subject_concrete_category", projectSn).stream().collect(Collectors.toMap(DictionaryItem::getData, DictionaryItem::getName, (s, s2) -> s));
|
||||
getChildren(records, allList, hasSubjectIds, typeMap, subjectAttributionMap, subjectConcreteCategoryMap);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@ -125,11 +141,19 @@ public class CostSubjectServiceImpl extends ServiceImpl<CostSubjectMapper, CostS
|
||||
return null;
|
||||
}
|
||||
|
||||
private void getChildren(List<CostSubject> list, List<CostSubject> allList) {
|
||||
private void getChildren(List<CostSubject> list, List<CostSubject> allList, Set<Long> hasSubjectIds, Map<String, String> typeMap, Map<String, String> subjectAttributionMap, Map<String, String> subjectConcreteCategoryMap) {
|
||||
for (CostSubject costSubject : list) {
|
||||
List<CostSubject> childrenList = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
||||
getChildren(childrenList, allList);
|
||||
getChildren(childrenList, allList, hasSubjectIds, typeMap, subjectAttributionMap, subjectConcreteCategoryMap);
|
||||
costSubject.setChildren(childrenList);
|
||||
boolean hasPermission = true;
|
||||
if (SecurityUtils.getUser().getUserId() != 4) {
|
||||
hasPermission = hasSubjectIds.contains(costSubject.getId());
|
||||
}
|
||||
costSubject.setHasPermission(hasPermission);
|
||||
costSubject.setTypeName(typeMap.get(costSubject.getType() + ""));
|
||||
costSubject.setSubjectAttributionName(typeMap.get(costSubject.getSubjectAttribution()));
|
||||
costSubject.setSubjectConcreteCategoryName(typeMap.get(costSubject.getSubjectConcreteCategory()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.zhgd.xmgl.modules.cost.service.impl;
|
||||
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubjectToOrganizationJob;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostSubjectToOrganizationJobMapper;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectToOrganizationJobService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 成本科目和组织岗位中间表
|
||||
* @author: pds
|
||||
* @date: 2024-09-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CostSubjectToOrganizationJobServiceImpl extends ServiceImpl<CostSubjectToOrganizationJobMapper, CostSubjectToOrganizationJob> implements ICostSubjectToOrganizationJobService {
|
||||
@Autowired
|
||||
private CostSubjectToOrganizationJobMapper costSubjectToOrganizationJobMapper;
|
||||
@Override
|
||||
public IPage<CostSubjectToOrganizationJob> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CostSubjectToOrganizationJob> queryWrapper = getQueryWrapper(param);
|
||||
Page<CostSubjectToOrganizationJob> page = PageUtil.getPage(param);
|
||||
IPage<CostSubjectToOrganizationJob> pageList = this.page(page, queryWrapper);
|
||||
pageList.setRecords(dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CostSubjectToOrganizationJob> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<CostSubjectToOrganizationJob> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(this.list(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<CostSubjectToOrganizationJob> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<CostSubjectToOrganizationJob> queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubjectToOrganizationJob.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(CostSubjectToOrganizationJob::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<CostSubjectToOrganizationJob> dealList(List<CostSubjectToOrganizationJob> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(CostSubjectToOrganizationJob costSubjectToOrganizationJob) {
|
||||
costSubjectToOrganizationJob.setId(null);
|
||||
baseMapper.insert(costSubjectToOrganizationJob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(CostSubjectToOrganizationJob costSubjectToOrganizationJob) {
|
||||
CostSubjectToOrganizationJob oldCostSubjectToOrganizationJob = baseMapper.selectById(costSubjectToOrganizationJob.getId());
|
||||
if(oldCostSubjectToOrganizationJob==null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(costSubjectToOrganizationJob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
CostSubjectToOrganizationJob costSubjectToOrganizationJob = baseMapper.selectById(id);
|
||||
if(costSubjectToOrganizationJob==null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CostSubjectToOrganizationJob queryById(String id) {
|
||||
CostSubjectToOrganizationJob entity = getById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
||||
@ -220,6 +220,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
||||
second.setType(2);
|
||||
second.setName(project.getProjectName());
|
||||
second.setCompanySn(project.getCompanySn());
|
||||
second.setProjectLx(project.getProjectLx());
|
||||
secondList.add(second);
|
||||
}
|
||||
first.setChildrenList(secondList);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user