diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostBudgetController.java b/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostBudgetController.java new file mode 100644 index 000000000..a8eab84dd --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostBudgetController.java @@ -0,0 +1,353 @@ +package com.zhgd.xmgl.modules.cost.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zhgd.annotation.OperLog; +import com.zhgd.xmgl.modules.basicdata.entity.Company; +import com.zhgd.xmgl.modules.basicdata.service.ICompanyService; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import com.zhgd.xmgl.modules.cost.service.ICostSubjectService; +import com.zhgd.xmgl.modules.exam.entity.ExamQuestionBank; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; +import com.zhgd.xmgl.modules.project.service.IProjectService; +import com.zhgd.xmgl.security.entity.UserInfo; +import com.zhgd.xmgl.security.util.SecurityUtils; +import com.zhgd.xmgl.util.ExcelUtils; +import com.zhgd.xmgl.util.PageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +import java.math.BigDecimal; +import java.util.*; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; +import com.zhgd.xmgl.modules.cost.entity.CostBudget; +import com.zhgd.xmgl.modules.cost.service.ICostBudgetService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.apache.commons.collections.MapUtils; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import springfox.documentation.annotations.ApiIgnore; + + +/** + * @Title: Controller + * @Description: 成本科目预算 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/costBudget") +@Slf4j +@Api(tags = "成本科目预算管理") +public class CostBudgetController { + @Autowired + private ICostBudgetService costBudgetService; + + @Autowired + private ICostSubjectService costSubjectService; + + @Autowired + private IProjectService projectService; + + @Autowired + private ICompanyService companyService; + + /** + * 列表查询 + * + * @param map + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "列表查询", operDesc = "列表查询成本科目信息") + @ApiOperation(value = " 列表查询成本科目信息", notes = "列表查询成本科目信息", httpMethod = "POST") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", dataType = "String") + @PostMapping(value = "/tree") + public Result> tree(@ApiIgnore @RequestBody Map map) { + String projectSn = MapUtils.getString(map, "projectSn"); + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Company company = companyService.getOne(Wrappers.lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn())); + map.put("companySn", company.getHeadquartersSn()); + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map); + queryWrapper.lambda().eq(CostSubject::getType, projectInfoBySn.getProjectType()); + List list = costBudgetService.tree(queryWrapper, projectInfoBySn); + return Result.success(list); + } + + /** + * 分页列表查询 + * + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "分页查询", operDesc = "分页列表查询成本科目预算信息") + @ApiOperation(value = " 分页列表查询成本科目预算信息", notes = "分页列表查询成本科目预算信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") + }) + @PostMapping(value = "/page") + public Result> queryPageList(@ApiIgnore @RequestBody Map map) { + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostBudget.class, map); + Page page = PageUtil.getPage(map); + IPage pageList = costBudgetService.page(page, queryWrapper); + return Result.success(pageList); + } + + /** + * 列表查询 + * + * @param costBudget + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "列表查询", operDesc = "列表查询成本科目预算信息") + @ApiOperation(value = " 列表查询成本科目预算信息", notes = "列表查询成本科目预算信息", httpMethod = "POST") + @PostMapping(value = "/list") + public Result> queryList(@RequestBody CostBudget costBudget) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(costBudget); + List list = costBudgetService.list(queryWrapper); + return Result.success(list); + } + + + /** + * 添加 + * + * @param costBudget + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "新增", operDesc = "添加成本科目预算信息") + @ApiOperation(value = " 添加成本科目预算信息", notes = "添加成本科目预算信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody CostBudget costBudget) { + UserInfo user = SecurityUtils.getUser(); + costBudget.setCreateBy(user.getUserId().toString()); + costBudget.setCreateTime(new Date()); + costBudgetService.save(costBudget); + return Result.success("添加成功!"); + } + + /** + * 编辑 + * + * @param costBudget + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "修改", operDesc = "编辑成本科目预算信息") + @ApiOperation(value = "编辑成本科目预算信息", notes = "编辑成本科目预算信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody CostBudget costBudget) { + Result result = new Result(); + CostBudget costBudgetEntity = costBudgetService.getById(costBudget.getId()); + if (costBudgetEntity == null) { + result.error500("未找到对应实体"); + } else { + UserInfo user = SecurityUtils.getUser(); + costBudget.setUpdateBy(user.getUserId().toString()); + costBudget.setUpdateTime(new Date()); + boolean ok = costBudgetService.updateById(costBudget); + if (ok) { + result.success("修改成功!"); + } else { + result.success("操作失败!"); + } + } + + return result; + } + + /** + * 通过id删除 + * + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "删除", operDesc = "删除成本科目预算信息") + @ApiOperation(value = "删除成本科目预算信息", notes = "删除成本科目预算信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "成本科目预算ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@RequestBody CostBudget costBudget) { + Result result = new Result(); + CostBudget costBudgetEntity = costBudgetService.getById(costBudget.getId()); + if (costBudgetEntity == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = costBudgetService.removeById(costBudget.getId()); + if (ok) { + result.success("删除成功!"); + } else { + result.success("操作失败!"); + } + } + return result; + } + + /** + * 通过id查询 + * + * @return + */ + @OperLog(operModul = "成本科目预算管理", operType = "查询", operDesc = "通过id查询成本科目预算信息") + @ApiOperation(value = "通过id查询成本科目预算信息", notes = "通过id查询成本科目预算信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "成本科目预算ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + CostBudget costBudget = costBudgetService.getById(MapUtils.getString(map, "id")); + if (costBudget == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(costBudget); + result.setSuccess(true); + } + return result; + } + + /** + * 导出excel + * + */ + @ApiOperation(value = "导出excel成本科目预算信息", notes = "导出excel成本科目预算信息", httpMethod = "POST") + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", dataType = "String") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(@RequestBody Map map) { + // Step.1 组装查询条件 + String projectSn = MapUtils.getString(map, "projectSn"); + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Company company = companyService.getOne(Wrappers.lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn())); + map.put("companySn", company.getHeadquartersSn()); + map.put("type", projectInfoBySn.getProjectType()); + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map); + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List list = costBudgetService.exportList(queryWrapper, projectInfoBySn, true); + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "成本科目预算"); + mv.addObject(NormalExcelConstants.CLASS, CostSubject.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("成本科目预算数据", "导出人:" + SecurityUtils.getUser().getRealName(), "导出信息")); + mv.addObject(NormalExcelConstants.DATA_LIST, list); + return mv; + } + +// /** +// * 导出excel模版 +// * +// */ +// @ApiOperation(value = "导出excel成本科目预算模版", notes = "导出excel成本科目预算模版", httpMethod = "POST") +// @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", dataType = "String") +// @RequestMapping(value = "/exportTemplate") +// public ModelAndView exportTemplate(@RequestBody Map map) { +// // Step.1 组装查询条件 +// String projectSn = MapUtils.getString(map, "projectSn"); +// ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); +// Company company = companyService.getOne(Wrappers.lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn())); +// map.put("companySn", company.getHeadquartersSn()); +// map.put("type", projectInfoBySn.getProjectType()); +// QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map); +// //Step.2 AutoPoi 导出Excel +// ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); +// List list = costBudgetService.exportList(queryWrapper, projectInfoBySn, false); +// //导出文件名称 +// mv.addObject(NormalExcelConstants.FILE_NAME, "成本科目预算"); +// mv.addObject(NormalExcelConstants.CLASS, CostSubject.class); +// mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("成本科目预算数据", "导出人:" + SecurityUtils.getUser().getRealName(), "导出信息")); +// mv.addObject(NormalExcelConstants.DATA_LIST, list); +// return mv; +// } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @ApiOperation(value = "通过excel导入成本科目预算信息", notes = "通过excel导入成本科目预算信息", httpMethod = "POST") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + String projectSn = request.getParameter("projectSn"); + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Company company = companyService.getOne(Wrappers.lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn())); + Map fileMap = multipartRequest.getFileMap(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(CostSubject::getCompanySn, company.getHeadquartersSn()) + .eq(CostSubject::getType, projectInfoBySn.getProjectType()); + List subjectList = costSubjectService.list(wrapper); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + try { + List listCostSubjects = ExcelImportUtil.importExcel(file.getInputStream(), CostSubject.class, params); +// List> costSubjectList = ExcelUtils.jxlExlToList(file.getInputStream(), 0); + List costBudgetList = new ArrayList<>(); + for (CostSubject costSubject : listCostSubjects) { + String code = costSubject.getCode(); + String budgetCost = costSubject.getBudgetCost(); + String actualCost = costSubject.getActualCost(); + String costDifference = costSubject.getCostDifference(); + List codeList = subjectList.stream().filter(s -> s.getCode().equals(code)).collect(Collectors.toList()); + CostBudget costBudget = new CostBudget(); + costBudget.setSubjectId(codeList.get(0).getId()); + costBudget.setProjectSn(projectSn); + costBudget.setBudgetCost(budgetCost); + costBudget.setActualCost(actualCost); + costBudget.setCostDifference(costDifference); + costBudget.setCreateBy(SecurityUtils.getUser().getUserId().toString()); + costBudget.setCreateTime(new Date()); + costBudgetList.add(costBudget); + } + /*for (CostBudget costBudget : costBudgetList) { + List subSubject = subjectList.stream().filter(s -> s.getAncestors().contains(costBudget.getSubjectId().toString())).collect(Collectors.toList()); + if (subSubject.size() > 0) { + BigDecimal budgetCost = subSubject.stream().map(s -> new BigDecimal(s.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add).add(new BigDecimal(costBudget.getBudgetCost())); + BigDecimal actualCost = subSubject.stream().map(s -> new BigDecimal(s.getActualCost())).reduce(BigDecimal.ZERO, BigDecimal::add).add(new BigDecimal(costBudget.getActualCost())); + costBudget.setBudgetCost(budgetCost.toString()); + costBudget.setBudgetCost(budgetCost.toString()); + costBudget.setCostDifference(actualCost.subtract(budgetCost).divide(budgetCost, 2, BigDecimal.ROUND_HALF_UP).toString()); + } + }*/ + costBudgetService.remove(Wrappers.lambdaQuery().eq(CostBudget::getProjectSn, projectSn)); + costBudgetService.saveBatch(costBudgetList); + return Result.ok("文件导入成功!数据行数:" + costBudgetList.size()); + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("文件导入失败!"); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.ok("文件导入失败!"); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostSubjectController.java b/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostSubjectController.java new file mode 100644 index 000000000..1649097c7 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/controller/CostSubjectController.java @@ -0,0 +1,223 @@ +package com.zhgd.xmgl.modules.cost.controller; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zhgd.annotation.OperLog; +import com.zhgd.xmgl.modules.basicdata.entity.Company; +import com.zhgd.xmgl.modules.basicdata.service.ICompanyService; +import com.zhgd.xmgl.modules.cost.vo.CostSubjectVo; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; +import com.zhgd.xmgl.modules.project.service.IProjectService; +import com.zhgd.xmgl.util.PageUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import com.zhgd.xmgl.modules.cost.service.ICostSubjectService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.apache.commons.collections.MapUtils; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import springfox.documentation.annotations.ApiIgnore; + + +/** + * @Title: Controller + * @Description: 成本科目 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/costSubject") +@Slf4j +@Api(tags = "成本科目管理") +public class CostSubjectController { + @Autowired + private ICostSubjectService costSubjectService; + + @Autowired + private IProjectService projectService; + + @Autowired + private ICompanyService companyService; + + /** + * 分页列表查询 + * + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "分页查询", operDesc = "分页列表查询成本科目信息") + @ApiOperation(value = " 分页列表查询成本科目信息", notes = "分页列表查询成本科目信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") + }) + @PostMapping(value = "/page") + public Result> queryPageList(@ApiIgnore @RequestBody Map map) { + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map); + Page page = PageUtil.getPage(map); + IPage pageList = costSubjectService.page(page, queryWrapper); + return Result.success(pageList); + } + + /** + * 列表查询 + * + * @param costSubject + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "列表查询", operDesc = "列表查询成本科目信息") + @ApiOperation(value = " 列表查询成本科目信息", notes = "列表查询成本科目信息", httpMethod = "POST") + @PostMapping(value = "/list") + public Result> queryList(@RequestBody CostSubject costSubject) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(costSubject); + List list = costSubjectService.list(queryWrapper); + return Result.success(list); + } + + /** + * 列表查询 + * + * @param map + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "列表查询", operDesc = "列表查询成本科目信息") + @ApiOperation(value = " 列表查询成本科目信息", notes = "列表查询成本科目信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer"), + @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", dataType = "String"), + @ApiImplicitParam(name = "companySn", value = "企业SN", paramType = "body", dataType = "String") + }) + @PostMapping(value = "/tree") + public Result> tree(@ApiIgnore @RequestBody Map map) { + String projectSn = MapUtils.getString(map, "projectSn"); + if (StringUtils.isNotBlank(projectSn)) { + ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(projectSn); + Company company = companyService.getOne(Wrappers.lambdaQuery().eq(Company::getCompanySn, projectInfoBySn.getCompanySn())); + map.put("companySn", company.getHeadquartersSn()); + map.put("type", projectInfoBySn.getProjectType()); + } + Page page = PageUtil.getPage(map); + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(CostSubject.class, map); + Page list = costSubjectService.tree(page, queryWrapper); + return Result.success(list); + } + + + /** + * 添加 + * + * @param costSubject + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "新增", operDesc = "添加成本科目信息") + @ApiOperation(value = " 添加成本科目信息", notes = "添加成本科目信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody CostSubject costSubject) { + costSubjectService.saveInfo(costSubject); + return Result.success("添加成功!"); + } + + /** + * 编辑 + * + * @param costSubject + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "修改", operDesc = "编辑成本科目信息") + @ApiOperation(value = "编辑成本科目信息", notes = "编辑成本科目信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody CostSubject costSubject) { + Result result = new Result(); + CostSubject costSubjectEntity = costSubjectService.getById(costSubject.getId()); + if (costSubjectEntity == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = costSubjectService.updateInfo(costSubject); + if (ok) { + result.success("修改成功!"); + } else { + result.success("操作失败!"); + } + } + + return result; + } + + /** + * 通过id删除 + * + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "删除", operDesc = "删除成本科目信息") + @ApiOperation(value = "删除成本科目信息", notes = "删除成本科目信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "成本科目ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/delete") + public Result delete(@RequestBody CostSubject costSubject) { + Result result = new Result(); + CostSubject costSubjectEntity = costSubjectService.getById(costSubject.getId()); + if (costSubjectEntity == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = costSubjectService.delInfo(costSubject); + if (ok) { + result.success("删除成功!"); + } else { + result.success("操作失败!"); + } + } + return result; + } + + /** + * 通过id查询 + * + * @return + */ + @OperLog(operModul = "成本科目管理", operType = "查询", operDesc = "通过id查询成本科目信息") + @ApiOperation(value = "通过id查询成本科目信息", notes = "通过id查询成本科目信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "成本科目ID", paramType = "body", required = true, dataType = "Integer") + @PostMapping(value = "/queryById") + public Result queryById(@ApiIgnore @RequestBody Map map) { + Result result = new Result(); + CostSubject costSubject = costSubjectService.getById(MapUtils.getString(map, "id")); + if (costSubject == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(costSubject); + result.setSuccess(true); + } + return result; + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostBudget.java b/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostBudget.java new file mode 100644 index 000000000..667fe0f0f --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostBudget.java @@ -0,0 +1,106 @@ +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: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Data +@TableName("cost_budget") +@ApiModel(value = "CostBudget实体类", description = "CostBudget") +public class CostBudget implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 成本预算ID + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "成本预算ID") + private Long id; + /** + * 成本科目ID + */ + @Excel(name = "成本科目ID", width = 15) + @ApiModelProperty(value = "成本科目ID") + private Long subjectId; + /** + * 项目SN + */ + @Excel(name = "项目SN", width = 15) + @ApiModelProperty(value = "项目SN") + private String projectSn; + /** + * 分项 + */ + @Excel(name = "分项", width = 15) + @ApiModelProperty(value = "分项") + private String subItem; + /** + * 预算成本 + */ + @Excel(name = "预算成本", width = 15) + @ApiModelProperty(value = "预算成本") + private String budgetCost; + /** + * 成本占比 + */ + @Excel(name = "成本占比", width = 15) + @ApiModelProperty(value = "成本占比") + private String costRatio; + /** + * 目标对比差额 + */ + @Excel(name = "目标对比差额", width = 15) + @ApiModelProperty(value = "目标对比差额") + private String costDifference; + /** + * 预算清单附件 + */ + @Excel(name = "预算清单附件", width = 15) + @ApiModelProperty(value = "预算清单附件") + private String budgetFile; + /** + * 实际成本 + */ + @Excel(name = "实际成本", width = 15) + @ApiModelProperty(value = "实际成本") + private String actualCost; + /** + * 创建人 + */ + @Excel(name = "创建人", width = 15) + @ApiModelProperty(value = "创建人") + private String createBy; + /** + * 创建时间 + */ + @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private Date createTime; + /** + * 最后操作人 + */ + @Excel(name = "最后操作人", width = 15) + @ApiModelProperty(value = "最后操作人") + private String updateBy; + /** + * 最后操作时间 + */ + @Excel(name = "最后操作时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "最后操作时间") + private Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostSubject.java b/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostSubject.java new file mode 100644 index 000000000..01397cc42 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/entity/CostSubject.java @@ -0,0 +1,112 @@ +package com.zhgd.xmgl.modules.cost.entity; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +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: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Data +@TableName("cost_subject") +@ApiModel(value = "CostSubject实体类", description = "CostSubject") +public class CostSubject implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 成本科目ID + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "成本科目ID") + private Long id; + /** + * 科目类型(字典数据) + */ + @ApiModelProperty(value = "科目类型(字典数据)") + private Integer type; + /** + * 企业SN + */ + @ApiModelProperty(value = "企业SN") + private String companySn; + /** + * 级别层次 + */ + @ApiModelProperty(value = "级别层次") + private Integer level; + /** + * 科目名称 + */ + @Excel(name = "科目名称", width = 15) + @ApiModelProperty(value = "科目名称") + private String name; + /** + * 科目编码 + */ + @Excel(name = "科目编码", width = 15) + @ApiModelProperty(value = "科目编码") + private String code; + /** + * 父级科目ID + */ + @ApiModelProperty(value = "父级科目ID") + private Long parentId; + /** + * 祖级关系 + */ + @ApiModelProperty(value = "祖级关系") + private String ancestors; + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String createBy; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Date createTime; + /** + * 最后操作人 + */ + @ApiModelProperty(value = "最后操作人") + private String updateBy; + /** + * 最后操作时间 + */ + @ApiModelProperty(value = "最后操作时间") + private Date updateTime; + + @TableField(exist = false) + @ApiModelProperty(value = "子级科目信息") + private List children; + + @Excel(name = "预算成本", width = 15) + @TableField(exist = false) + @ApiModelProperty(value = "预算成本") + private String budgetCost; + + @Excel(name = "实际成本", width = 15) + @TableField(exist = false) + @ApiModelProperty(value = "实际成本") + private String actualCost; + + @Excel(name = "目标对比差额", width = 15) + @TableField(exist = false) + @ApiModelProperty(value = "目标对比差额") + private String costDifference; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostBudgetMapper.java b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostBudgetMapper.java new file mode 100644 index 000000000..81c952c24 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostBudgetMapper.java @@ -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.CostBudget; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 成本科目预算 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Mapper +public interface CostBudgetMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostSubjectMapper.java b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostSubjectMapper.java new file mode 100644 index 000000000..47e0a2e6d --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/CostSubjectMapper.java @@ -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.CostSubject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 成本科目 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Mapper +public interface CostSubjectMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostBudgetMapper.xml b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostBudgetMapper.xml new file mode 100644 index 000000000..188142c54 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostBudgetMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostSubjectMapper.xml b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostSubjectMapper.xml new file mode 100644 index 000000000..fc65c1375 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/mapper/xml/CostSubjectMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostBudgetService.java b/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostBudgetService.java new file mode 100644 index 000000000..f8fd17ac7 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostBudgetService.java @@ -0,0 +1,23 @@ +package com.zhgd.xmgl.modules.cost.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.modules.cost.entity.CostBudget; +import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; + +import java.util.List; + +/** + * @Description: 成本科目预算 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +public interface ICostBudgetService extends IService { + + List tree(QueryWrapper wrapper, ProjectInfoExtVo projectInfoBySn); + + List exportList(QueryWrapper wrapper, ProjectInfoExtVo projectInfoBySn, boolean flag); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostSubjectService.java b/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostSubjectService.java new file mode 100644 index 000000000..3c3af8d5c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/service/ICostSubjectService.java @@ -0,0 +1,26 @@ +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.entity.CostSubject; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @Description: 成本科目 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +public interface ICostSubjectService extends IService { + + Page tree(Page page, QueryWrapper wrapper); + + boolean saveInfo(CostSubject costSubject); + + boolean updateInfo(CostSubject costSubject); + + boolean delInfo(CostSubject costSubject); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostBudgetServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostBudgetServiceImpl.java new file mode 100644 index 000000000..e6fd5f952 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostBudgetServiceImpl.java @@ -0,0 +1,82 @@ +package com.zhgd.xmgl.modules.cost.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.modules.cost.entity.CostBudget; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import com.zhgd.xmgl.modules.cost.mapper.CostBudgetMapper; +import com.zhgd.xmgl.modules.cost.service.ICostBudgetService; +import com.zhgd.xmgl.modules.cost.service.ICostSubjectService; +import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 成本科目预算 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Service +public class CostBudgetServiceImpl extends ServiceImpl implements ICostBudgetService { + + @Autowired + private ICostSubjectService costSubjectService; + + @Override + public List tree(QueryWrapper wrapper, ProjectInfoExtVo projectInfoBySn) { + wrapper.lambda().eq(CostSubject::getParentId, 0); + List list = costSubjectService.list(wrapper); + if (list.size() > 0) { + List allList = costSubjectService.list(); + List budgetList = this.list(Wrappers.lambdaQuery() + .eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn())); + getChildren(list, allList, budgetList, true); + } + return list; + } + + @Override + public List exportList(QueryWrapper wrapper, ProjectInfoExtVo projectInfoBySn, boolean flag) { + wrapper.lambda().eq(CostSubject::getParentId, 0); + List list = costSubjectService.list(wrapper); + if (list.size() > 0) { + List allList = costSubjectService.list(); + List budgetList = this.list(Wrappers.lambdaQuery() + .eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn())); + getChildren(list, allList, budgetList, flag); + } + List resultList = new ArrayList<>(); + addChildren(list, resultList); + return resultList; + } + + private void addChildren(List list, List resultList) { + for (CostSubject costSubject : list) { + resultList.add(costSubject); + resultList.addAll(costSubject.getChildren()); + addChildren(costSubject.getChildren(), resultList); + } + } + + private void getChildren(List list, List allList, List budgetList, boolean flag) { + for (CostSubject costSubject : list) { + List costBudgets = budgetList.stream().filter(b -> costSubject.getId().toString().equals(b.getSubjectId().toString())).collect(Collectors.toList()); + if (costBudgets.size() > 0 && flag) { + costSubject.setBudgetCost(costBudgets.get(0).getBudgetCost()); + costSubject.setActualCost(costBudgets.get(0).getActualCost()); + costSubject.setCostDifference(costBudgets.get(0).getCostDifference()); + } + List childrenList = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList()); + getChildren(childrenList, allList, budgetList, flag); + costSubject.setChildren(childrenList); + } + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostSubjectServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostSubjectServiceImpl.java new file mode 100644 index 000000000..4cfd1df95 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/service/impl/CostSubjectServiceImpl.java @@ -0,0 +1,74 @@ +package com.zhgd.xmgl.modules.cost.service.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import com.zhgd.xmgl.modules.cost.mapper.CostSubjectMapper; +import com.zhgd.xmgl.modules.cost.service.ICostSubjectService; +import com.zhgd.xmgl.security.entity.UserInfo; +import com.zhgd.xmgl.security.util.SecurityUtils; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 成本科目 + * @author: pengj + * @date: 2024-07-03 + * @version: V1.0 + */ +@Service +public class CostSubjectServiceImpl extends ServiceImpl implements ICostSubjectService { + + @Override + public Page tree(Page page, QueryWrapper wrapper) { + wrapper.lambda().eq(CostSubject::getParentId, 0); + wrapper.lambda().isNotNull(CostSubject::getName); + List allList = this.list(); + Page pageList = this.page(page, wrapper); + getChildren(pageList.getRecords(), allList); + return pageList; + } + + @Override + public boolean saveInfo(CostSubject costSubject) { + UserInfo user = SecurityUtils.getUser(); + CostSubject parent = this.getById(costSubject.getParentId()); + if (parent != null) { + costSubject.setAncestors(parent.getAncestors() + "," + parent.getId().toString()); + } else { + costSubject.setAncestors("0"); + } + costSubject.setCreateBy(user.getUserId().toString()); + costSubject.setCreateTime(new Date()); + return this.save(costSubject); + } + + @Override + public boolean updateInfo(CostSubject costSubject) { + UserInfo user = SecurityUtils.getUser(); + costSubject.setUpdateBy(user.getUserId().toString()); + costSubject.setUpdateTime(new Date()); + return this.updateById(costSubject); + } + + @Override + public boolean delInfo(CostSubject costSubject) { + this.remove(Wrappers.lambdaQuery().apply("find_in_set({0}, ancestors)", costSubject.getId())); + return this.removeById(costSubject); + } + + private void getChildren(List list, List allList) { + for (CostSubject costSubject : list) { + List childrenList = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList()); + getChildren(childrenList, allList); + costSubject.setChildren(childrenList); + } + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/cost/vo/CostSubjectVo.java b/src/main/java/com/zhgd/xmgl/modules/cost/vo/CostSubjectVo.java new file mode 100644 index 000000000..ec21feed5 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/cost/vo/CostSubjectVo.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.modules.cost.vo; + +import com.zhgd.xmgl.modules.cost.entity.CostSubject; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "成本科目信息(VO)", description = "CostSubjectVo") +public class CostSubjectVo extends CostSubject { + + @ApiModelProperty(value = "项目SN") + private String projectSn; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/project/controller/ProgressPanoramaNodePlanController.java b/src/main/java/com/zhgd/xmgl/modules/project/controller/ProgressPanoramaNodePlanController.java index 0f9435089..eb2205c79 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/controller/ProgressPanoramaNodePlanController.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/controller/ProgressPanoramaNodePlanController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan; +import com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto; import com.zhgd.xmgl.modules.project.service.IProgressPanoramaNodePlanService; import com.zhgd.xmgl.util.MessageUtil; import io.swagger.annotations.Api; @@ -37,6 +38,23 @@ public class ProgressPanoramaNodePlanController { @Autowired private IProgressPanoramaNodePlanService progressPanoramaNodePlanService; + /** + * 分页列表查询 + * @return + */ + @ApiOperation(value = "分页列表查询进度-全景节点计划信息", notes = "分页列表查询进度-全景节点计划信息", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), + @ApiImplicitParam(name = "nodeName", value = "节点名称", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "bidSectionId", value = "标段ID", paramType = "body", required = false, dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), + }) + @PostMapping(value = "/tree") + public Result> queryTreeList(@RequestBody Map map) { + return Result.success(progressPanoramaNodePlanService.selectProgressPanoramaNodePlanPageList(map)); + } + /** * 分页列表查询 * @return @@ -50,7 +68,7 @@ public class ProgressPanoramaNodePlanController { @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), }) @PostMapping(value = "/list") - public Result> queryPageList(@RequestBody Map map) { + public Result> queryPageList(@RequestBody Map map) { return Result.success(progressPanoramaNodePlanService.selectProgressPanoramaNodePlanPageList(map)); } @@ -88,6 +106,12 @@ public class ProgressPanoramaNodePlanController { if(progressPanoramaNodePlanEntity==null) { result.error500(MessageUtil.get("notFindErr")); }else { + ProgressPanoramaNodePlan parent = progressPanoramaNodePlanService.getById(progressPanoramaNodePlan.getParentId()); + if (parent != null) { + progressPanoramaNodePlan.setAncestors(parent.getAncestors() + "," + parent.getId().toString()); + } else { + progressPanoramaNodePlan.setAncestors("0"); + } boolean ok = progressPanoramaNodePlanService.updateById(progressPanoramaNodePlan); if(ok) { diff --git a/src/main/java/com/zhgd/xmgl/modules/project/entity/ProgressPanoramaNodePlan.java b/src/main/java/com/zhgd/xmgl/modules/project/entity/ProgressPanoramaNodePlan.java index 883855367..07fc1cc90 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/entity/ProgressPanoramaNodePlan.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/entity/ProgressPanoramaNodePlan.java @@ -155,5 +155,14 @@ public class ProgressPanoramaNodePlan implements Serializable { @Excel(name = "城润标段名称", width = 15) @ApiModelProperty(value = "城润标段名称") private String crSectionName; - + /** + * 父级ID + */ + @ApiModelProperty(value = "父级ID") + private Long parentId; + /** + * 祖级关系 + */ + @ApiModelProperty(value = "祖级关系") + private String ancestors; } diff --git a/src/main/java/com/zhgd/xmgl/modules/project/entity/dto/ProgressPanoramaNodePlanDto.java b/src/main/java/com/zhgd/xmgl/modules/project/entity/dto/ProgressPanoramaNodePlanDto.java new file mode 100644 index 000000000..be2319332 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/project/entity/dto/ProgressPanoramaNodePlanDto.java @@ -0,0 +1,23 @@ +package com.zhgd.xmgl.modules.project.entity.dto; + +import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.util.List; + +@Data +@ApiModel(value = "全景计划信息(DTO)", description = "ProgressPanoramaNodePlanDto") +public class ProgressPanoramaNodePlanDto extends ProgressPanoramaNodePlan { + + @ApiModelProperty(value = "项目分期ID") + private String projectfId; + + @ApiModelProperty(value = "项目分期名称") + private String projectfName; + + @ApiModelProperty(value = "子项信息") + private List children; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/project/mapper/ProgressPanoramaNodePlanMapper.java b/src/main/java/com/zhgd/xmgl/modules/project/mapper/ProgressPanoramaNodePlanMapper.java index 2eef3304a..481f5977c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/mapper/ProgressPanoramaNodePlanMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/mapper/ProgressPanoramaNodePlanMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan; +import com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto; import com.zhgd.xmgl.modules.project.entity.vo.KeyNodeEarlyWarningStatisticsVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -21,7 +22,7 @@ import java.util.Map; @Mapper public interface ProgressPanoramaNodePlanMapper extends BaseMapper { - List selectProgressPanoramaNodePlanPageList(Page page, @Param("param") Map map); + List selectProgressPanoramaNodePlanPageList(Page page, @Param("param") Map map); List selectPanoramaNodePlanList(Map map); diff --git a/src/main/java/com/zhgd/xmgl/modules/project/mapper/xml/ProgressPanoramaNodePlanMapper.xml b/src/main/java/com/zhgd/xmgl/modules/project/mapper/xml/ProgressPanoramaNodePlanMapper.xml index 26e2c31c0..b39ba9aa1 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/mapper/xml/ProgressPanoramaNodePlanMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/project/mapper/xml/ProgressPanoramaNodePlanMapper.xml @@ -1,7 +1,7 @@ - SELECT a.*, b.projectf_id, b.projectf_name from progress_panorama_node_plan a LEFT JOIN progress_plan_bid_section b ON a.bid_section_id = b.id diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/IProgressPanoramaNodePlanService.java b/src/main/java/com/zhgd/xmgl/modules/project/service/IProgressPanoramaNodePlanService.java index 845e94149..0f02080b8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/IProgressPanoramaNodePlanService.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/IProgressPanoramaNodePlanService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan; +import com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto; import java.util.List; import java.util.Map; @@ -18,7 +19,7 @@ import java.util.Map; */ public interface IProgressPanoramaNodePlanService extends IService { - IPage selectProgressPanoramaNodePlanPageList(Map map); + IPage selectProgressPanoramaNodePlanPageList(Map map); void saveProgressPanoramaNodePlan(ProgressPanoramaNodePlan progressPanoramaNodePlan); diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressPanoramaNodePlanServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressPanoramaNodePlanServiceImpl.java index 3f79fa24c..253a662da 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressPanoramaNodePlanServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressPanoramaNodePlanServiceImpl.java @@ -8,13 +8,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.modules.cost.entity.CostSubject; import com.zhgd.xmgl.modules.project.entity.ProgressPanoramaNodePlan; import com.zhgd.xmgl.modules.project.entity.ProgressPlanBidSection; import com.zhgd.xmgl.modules.project.entity.Project; +import com.zhgd.xmgl.modules.project.entity.dto.ProgressPanoramaNodePlanDto; import com.zhgd.xmgl.modules.project.mapper.ProgressPanoramaNodePlanMapper; import com.zhgd.xmgl.modules.project.mapper.ProgressPlanBidSectionMapper; import com.zhgd.xmgl.modules.project.mapper.ProjectMapper; import com.zhgd.xmgl.modules.project.service.IProgressPanoramaNodePlanService; +import com.zhgd.xmgl.security.entity.UserInfo; +import com.zhgd.xmgl.security.util.SecurityUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,11 +46,11 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl selectProgressPanoramaNodePlanPageList(Map map) { + public IPage selectProgressPanoramaNodePlanPageList(Map map) { int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString()); int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString()); - Page page = new Page<>(pageNo, pageSize); - List list = progressPanoramaNodePlanMapper.selectProgressPanoramaNodePlanPageList(page, map); + Page page = new Page<>(pageNo, pageSize); + List list = progressPanoramaNodePlanMapper.selectProgressPanoramaNodePlanPageList(page, map); return page.setRecords(list); } @@ -59,6 +63,12 @@ public class ProgressPanoramaNodePlanServiceImpl extends ServiceImpl0){ // throw new OpenAlertException(MessageUtil.get("uniqueExistErr")); // } + ProgressPanoramaNodePlan parent = this.getById(progressPanoramaNodePlan.getParentId()); + if (parent != null) { + progressPanoramaNodePlan.setAncestors(parent.getAncestors() + "," + parent.getId().toString()); + } else { + progressPanoramaNodePlan.setAncestors("0"); + } progressPanoramaNodePlanMapper.insert(progressPanoramaNodePlan); }