包头进度和bug修改

This commit is contained in:
guoshengxiong 2024-12-07 17:47:46 +08:00
parent 4499cbbb70
commit ac66c540eb
18 changed files with 319 additions and 230 deletions

View File

@ -78,18 +78,6 @@ public class PlanChooseCategoryController {
return Result.ok(); return Result.ok();
} }
@OperLog(operModul = "进度选择分类码管理", operType = "添加", operDesc = "添加多个进度选择分类码信息")
@ApiOperation(value = "添加多个进度选择分类码信息", notes = "添加多个进度选择分类码信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryIdList", value = "分类码id", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/addMany")
public Result<PlanChooseCategory> addMany(@RequestBody @Validate Map<String, Object> param) {
planChooseCategoryService.addMany(param);
return Result.ok();
}
/** /**
* 编辑 * 编辑
* *
@ -132,4 +120,17 @@ public class PlanChooseCategoryController {
return Result.success(planChooseCategoryService.queryById(id)); return Result.success(planChooseCategoryService.queryById(id));
} }
@OperLog(operModul = "进度选择分类码管理", operType = "添加", operDesc = "添加多个进度选择分类码信息")
@ApiOperation(value = "添加多个进度选择分类码信息", notes = "添加多个进度选择分类码信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryIdList", value = "分类码id", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/addMany")
public Result<PlanChooseCategory> addMany(@RequestBody @Validate Map<String, Object> param) {
planChooseCategoryService.addMany(param);
return Result.ok();
}
} }

View File

@ -85,21 +85,6 @@ public class PlanFeedbackApprovalController {
return Result.ok(); return Result.ok();
} }
@OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "保存进度反馈审批信息")
@ApiOperation(value = "保存进度反馈审批信息", notes = "保存进度反馈审批信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "recordIdList", value = "recordIdList", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/save")
public Result saveInfo(@RequestBody @Validate Map<String, Object> param) {
try {
planFeedbackApprovalService.saveInfo(param);
} catch (OpenAlertException e) {
return Result.success(e.getMessage());
}
return Result.ok();
}
/** /**
* 编辑 * 编辑
@ -146,7 +131,6 @@ public class PlanFeedbackApprovalController {
@OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "提交审批") @OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "提交审批")
@ApiOperation(value = "提交审批", notes = "提交审批", httpMethod = "POST") @ApiOperation(value = "提交审批", notes = "提交审批", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "recordIdList", value = "计划编制id的list", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "approval", value = "反馈审批对象", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "approval", value = "反馈审批对象", paramType = "body", required = true, dataType = "String"),
}) })
@ -171,7 +155,6 @@ public class PlanFeedbackApprovalController {
@OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "查询责任人自己的进度反馈审批信息") @OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "查询责任人自己的进度反馈审批信息")
@ApiOperation(value = "查询责任人自己的进度反馈审批信息", notes = "查询责任人自己的进度反馈审批信息", httpMethod = "GET") @ApiOperation(value = "查询责任人自己的进度反馈审批信息", notes = "查询责任人自己的进度反馈审批信息", httpMethod = "GET")
// @ApiImplicitParam(name = "id", value = "进度反馈审批ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryMyApproval") @GetMapping(value = "/queryMyApproval")
public Result<PlanFeedbackApproval> queryMyApproval() { public Result<PlanFeedbackApproval> queryMyApproval() {
return Result.success(planFeedbackApprovalService.queryMyApproval()); return Result.success(planFeedbackApprovalService.queryMyApproval());
@ -209,4 +192,14 @@ public class PlanFeedbackApprovalController {
return Result.success(p); return Result.success(p);
} }
@OperLog(operModul = "进度反馈审批管理", operType = "", operDesc = "保存勾选批量反馈的信息")
@ApiOperation(value = "保存勾选批量反馈的信息", notes = "保存勾选批量反馈的信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "recordIdList", value = "recordIdList", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/save")
public Result saveInfo(@RequestBody @Validate Map<String, Object> param) {
return planFeedbackApprovalService.saveInfo(param);
}
} }

View File

@ -96,14 +96,6 @@ public class PlanFeedbackController {
return Result.ok(); return Result.ok();
} }
@OperLog(operModul = "进度反馈记录管理", operType = "", operDesc = "保存进度反馈记录信息")
@ApiOperation(value = "保存进度反馈记录信息", notes = "保存进度反馈记录信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<PlanFeedback> saveInfo(@RequestBody PlanFeedback planFeedback) {
planFeedbackService.saveInfo(planFeedback);
return Result.ok();
}
/** /**
* 通过id删除 * 通过id删除
* *
@ -180,4 +172,13 @@ public class PlanFeedbackController {
return Result.success(planFeedbackService.getPeriodMilestones(param)); return Result.success(planFeedbackService.getPeriodMilestones(param));
} }
@OperLog(operModul = "进度反馈记录管理", operType = "", operDesc = "保存进度反馈记录信息")
@ApiOperation(value = "保存进度反馈记录信息", notes = "保存进度反馈记录信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<PlanFeedback> saveInfo(@RequestBody PlanFeedback planFeedback) {
planFeedbackService.saveInfo(planFeedback);
return Result.ok();
}
} }

View File

@ -65,31 +65,6 @@ public class PlanMilestoneController {
return Result.success(planMilestoneService.queryList(param)); return Result.success(planMilestoneService.queryList(param));
} }
@OperLog(operModul = "进度里程碑管理", operType = "分页查询", operDesc = "分页列表查询最近上级的wps进度里程碑信息")
@ApiOperation(value = "分页列表查询最近上级的wps进度里程碑信息", notes = "分页列表查询最近上级的wps进度里程碑信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/getWpsMilestonePage")
public Result<IPage<PlanMilestone>> getWpsMilestonePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
String recordId = MapUtils.getString(param, "recordId");
List<PlanMilestone> periodMilestones = planMilestoneService.getParentMilestones(recordId);
int pageNo = Integer.parseInt(param.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(param.getOrDefault("pageSize", 10).toString());
if (pageSize < 0) {
pageSize = Integer.MAX_VALUE;
}
int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize);
List<PlanMilestone> records = CollUtil.sub(periodMilestones, i, i + pageSize);
IPage<PlanMilestone> p = new Page<>();
p.setTotal(periodMilestones.size());
p.setRecords(records);
p.setCurrent(pageNo);
p.setSize(pageSize);
return Result.success(p);
}
/** /**
* 添加 * 添加
* *
@ -146,4 +121,30 @@ public class PlanMilestoneController {
return Result.success(planMilestoneService.queryById(id)); return Result.success(planMilestoneService.queryById(id));
} }
@OperLog(operModul = "进度里程碑管理", operType = "分页查询", operDesc = "分页列表查询最近上级的wps进度里程碑信息")
@ApiOperation(value = "分页列表查询最近上级的wps进度里程碑信息", notes = "分页列表查询最近上级的wps进度里程碑信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/getWpsMilestonePage")
public Result<IPage<PlanMilestone>> getWpsMilestonePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
String recordId = MapUtils.getString(param, "recordId");
List<PlanMilestone> periodMilestones = planMilestoneService.getParentMilestones(recordId);
int pageNo = Integer.parseInt(param.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(param.getOrDefault("pageSize", 10).toString());
if (pageSize < 0) {
pageSize = Integer.MAX_VALUE;
}
int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize);
List<PlanMilestone> records = CollUtil.sub(periodMilestones, i, i + pageSize);
IPage<PlanMilestone> p = new Page<>();
p.setTotal(periodMilestones.size());
p.setRecords(records);
p.setCurrent(pageNo);
p.setSize(pageSize);
return Result.success(p);
}
} }

View File

@ -51,16 +51,6 @@ public class PlanPbsController {
return Result.success(planPbsService.queryPageList(param)); return Result.success(planPbsService.queryPageList(param));
} }
@OperLog(operModul = "进度PBS管理", operType = "", operDesc = "树形分页列表查询进度PBS信息")
@ApiOperation(value = "树形分页列表查询进度PBS信息", notes = "树形分页列表查询进度PBS信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanPbs>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planPbsService.queryTreePage(param));
}
/** /**
* 列表查询 * 列表查询
@ -130,4 +120,15 @@ public class PlanPbsController {
return Result.success(planPbsService.queryById(id)); return Result.success(planPbsService.queryById(id));
} }
@OperLog(operModul = "进度PBS管理", operType = "", operDesc = "树形分页列表查询进度PBS信息")
@ApiOperation(value = "树形分页列表查询进度PBS信息", notes = "树形分页列表查询进度PBS信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanPbs>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planPbsService.queryTreePage(param));
}
} }

View File

@ -95,14 +95,6 @@ public class PlanPeriodController {
return Result.ok(); return Result.ok();
} }
@OperLog(operModul = "进度监测周期管理", operType = "保存", operDesc = "保存进度监测周期信息")
@ApiOperation(value = "保存进度监测周期信息", notes = "保存进度监测周期信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<PlanPeriod> saveInfo(@RequestBody PlanPeriod planPeriod) {
planPeriodService.saveInfo(planPeriod);
return Result.ok();
}
/** /**
* 通过id删除 * 通过id删除
* *
@ -161,4 +153,14 @@ public class PlanPeriodController {
} }
@OperLog(operModul = "进度监测周期管理", operType = "保存", operDesc = "保存进度监测周期信息")
@ApiOperation(value = "保存进度监测周期信息", notes = "保存进度监测周期信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<PlanPeriod> saveInfo(@RequestBody PlanPeriod planPeriod) {
planPeriodService.saveInfo(planPeriod);
return Result.ok();
}
} }

View File

@ -57,16 +57,6 @@ public class PlanRecordController {
return Result.success(planRecordService.queryPageList(param)); return Result.success(planRecordService.queryPageList(param));
} }
@OperLog(operModul = "进度计划编制管理", operType = "", operDesc = "树形分页列表查询进度计划编制信息")
@ApiOperation(value = "树形分页列表查询进度计划编制信息", notes = "树形分页列表查询进度计划编制信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanRecord>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planRecordService.queryTreePage(param));
}
/** /**
* 列表查询 * 列表查询
@ -137,8 +127,8 @@ public class PlanRecordController {
@ApiOperation(value = "分页查询计划分摊列表", notes = "分页查询计划分摊列表", httpMethod = "GET") @ApiOperation(value = "分页查询计划分摊列表", notes = "分页查询计划分摊列表", httpMethod = "GET")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "beginDate", value = "开始日期", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "periodStart", value = "开始日期", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", required = false, dataType = "String") @ApiImplicitParam(name = "periodEnd", value = "结束日期", paramType = "query", required = false, dataType = "String")
}) })
@GetMapping(value = "/getPlanSharePage") @GetMapping(value = "/getPlanSharePage")
public Result<IPage<PlanFeedbackPeriod>> getPlanSharePage(@RequestParam Map<String, Object> param) { public Result<IPage<PlanFeedbackPeriod>> getPlanSharePage(@RequestParam Map<String, Object> param) {
@ -198,4 +188,16 @@ public class PlanRecordController {
return Result.success(planRecordService.getProjectMilestone(param)); return Result.success(planRecordService.getProjectMilestone(param));
} }
@OperLog(operModul = "进度计划编制管理", operType = "", operDesc = "树形分页列表查询进度计划编制信息")
@ApiOperation(value = "树形分页列表查询进度计划编制信息", notes = "树形分页列表查询进度计划编制信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanRecord>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planRecordService.queryTreePage(param));
}
} }

View File

@ -74,16 +74,7 @@ public class PlanWorkCategoryController {
public Result<IPage<PlanWorkCategory>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) { public Result<IPage<PlanWorkCategory>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planWorkCategoryService.queryPageList(param)); return Result.success(planWorkCategoryService.queryPageList(param));
} }
@OperLog(operModul = "进度作业分类码管理", operType = "", operDesc = "树形分页列表查询进度作业分类码信息")
@ApiOperation(value = "树形分页列表查询进度作业分类码信息", notes = "树形分页列表查询进度作业分类码信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanWorkCategory>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planWorkCategoryService.queryTreePage(param));
}
/** /**
* 列表查询 * 列表查询
* @return * @return
@ -147,4 +138,14 @@ public class PlanWorkCategoryController {
return Result.success(planWorkCategoryService.queryById(id)); return Result.success(planWorkCategoryService.queryById(id));
} }
@OperLog(operModul = "进度作业分类码管理", operType = "", operDesc = "树形分页列表查询进度作业分类码信息")
@ApiOperation(value = "树形分页列表查询进度作业分类码信息", notes = "树形分页列表查询进度作业分类码信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
})
@GetMapping(value = "/tree/page")
public Result<IPage<PlanWorkCategory>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {
return Result.success(planWorkCategoryService.queryTreePage(param));
}
} }

View File

@ -54,12 +54,12 @@ public class PlanFeedbackPeriod implements Serializable {
private java.util.Date updateTime ; private java.util.Date updateTime ;
@TableField(exist = false) @TableField(exist = false)
private List<PlanMilestoneVal> milestoneVals; private List<PlanMilestoneVal> milestoneVals;
@ApiModelProperty(value = "实际进度完成%(未算权重)") // @ApiModelProperty(value = "实际进度完成%(未算权重)")
@TableField(exist = false) // @TableField(exist = false)
private BigDecimal actualOriginPer; // private BigDecimal actualOriginPer;
@ApiModelProperty(value = "计划进度完成%(未算权重)") // @ApiModelProperty(value = "计划进度完成%(未算权重)")
@TableField(exist = false) // @TableField(exist = false)
private BigDecimal planOriginPer; // private BigDecimal planOriginPer;
@ApiModelProperty(value = "实际进度完成%") @ApiModelProperty(value = "实际进度完成%")
@TableField(exist = false) @TableField(exist = false)
private BigDecimal actualPer; private BigDecimal actualPer;

View File

@ -162,7 +162,7 @@ public class PlanRecord implements Serializable {
*/ */
@ApiModelProperty(value = "后置作业") @ApiModelProperty(value = "后置作业")
private java.lang.String postDecessorJob; private java.lang.String postDecessorJob;
@ApiModelProperty(value = "最新的feedBackId") @ApiModelProperty(value = "审批通过的最新的feedBackId")
private Long newestFeedBackId; private Long newestFeedBackId;
/** /**
* 节点状态1:关键控制点;2:重要事件的控制;3:作业项目的节点; * 节点状态1:关键控制点;2:重要事件的控制;3:作业项目的节点;

View File

@ -1,8 +1,10 @@
package com.zhgd.xmgl.modules.baotou.plan.service; package com.zhgd.xmgl.modules.baotou.plan.service;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackApproval;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackApproval;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -16,36 +18,47 @@ import java.util.Map;
public interface IPlanFeedbackApprovalService extends IService<PlanFeedbackApproval> { public interface IPlanFeedbackApprovalService extends IService<PlanFeedbackApproval> {
/** /**
* 分页列表查询进度反馈审批信息 * 分页列表查询进度反馈审批信息
*
* @param param 参数map * @param param 参数map
* @return * @return
*/ */
IPage<PlanFeedbackApproval> queryPageList(HashMap<String, Object> param); IPage<PlanFeedbackApproval> queryPageList(HashMap<String, Object> param);
/** /**
* 列表查询进度反馈审批信息 * 列表查询进度反馈审批信息
*
* @param param 参数map * @param param 参数map
* @return * @return
*/ */
List<PlanFeedbackApproval> queryList(HashMap<String, Object> param); List<PlanFeedbackApproval> queryList(HashMap<String, Object> param);
/** /**
* 添加进度反馈审批信息 * 添加进度反馈审批信息
*
* @param planFeedbackApproval 进度反馈审批 * @param planFeedbackApproval 进度反馈审批
* @return * @return
*/ */
void add(PlanFeedbackApproval planFeedbackApproval); void add(PlanFeedbackApproval planFeedbackApproval);
/** /**
* 编辑进度反馈审批信息 * 编辑进度反馈审批信息
*
* @param planFeedbackApproval 进度反馈审批 * @param planFeedbackApproval 进度反馈审批
* @return * @return
*/ */
void edit(PlanFeedbackApproval planFeedbackApproval); void edit(PlanFeedbackApproval planFeedbackApproval);
/** /**
* 根据id删除进度反馈审批信息 * 根据id删除进度反馈审批信息
*
* @param id 进度反馈审批的id * @param id 进度反馈审批的id
* @return * @return
*/ */
void delete(String id); void delete(String id);
/** /**
* 根据id查询进度反馈审批信息 * 根据id查询进度反馈审批信息
*
* @param id 进度反馈审批的id * @param id 进度反馈审批的id
* @return * @return
*/ */
@ -55,7 +68,14 @@ public interface IPlanFeedbackApprovalService extends IService<PlanFeedbackAppro
void approval(HashMap<String, Object> map); void approval(HashMap<String, Object> map);
void saveInfo(Map<String, Object> param); Result saveInfo(Map<String, Object> param);
PlanFeedbackApproval queryMyApproval(); PlanFeedbackApproval queryMyApproval();
/**
* 查询最新的一条审批
*
* @return
*/
PlanFeedbackApproval queryNewestApproval();
} }

View File

@ -10,9 +10,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gexin.fastjson.JSON; import com.gexin.fastjson.JSON;
import com.gexin.fastjson.TypeReference; import com.gexin.fastjson.TypeReference;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.baotou.plan.entity.*; import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedback;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackApproval;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackApprovalWork;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanRecord;
import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanFeedbackApprovalMapper; import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanFeedbackApprovalMapper;
import com.zhgd.xmgl.modules.baotou.plan.service.IPlanFeedbackApprovalService; import com.zhgd.xmgl.modules.baotou.plan.service.IPlanFeedbackApprovalService;
import com.zhgd.xmgl.modules.baotou.plan.service.IPlanFeedbackApprovalWorkService; import com.zhgd.xmgl.modules.baotou.plan.service.IPlanFeedbackApprovalWorkService;
@ -22,7 +26,6 @@ import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl; import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
import com.zhgd.xmgl.security.entity.UserInfo; import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils; import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil; import com.zhgd.xmgl.util.RefUtil;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
@ -79,7 +82,7 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
QueryWrapper<PlanFeedbackApproval> queryWrapper = QueryGenerator.initPageQueryWrapper(PlanFeedbackApproval.class, param, true); QueryWrapper<PlanFeedbackApproval> queryWrapper = QueryGenerator.initPageQueryWrapper(PlanFeedbackApproval.class, param, true);
Integer isApproval = MapUtils.getInteger(param, "isApproval"); Integer isApproval = MapUtils.getInteger(param, "isApproval");
if (Objects.equals(isApproval, 1)) { if (Objects.equals(isApproval, 1)) {
queryWrapper.ne(RefUtil.fieldNameUlc(PlanFeedbackApproval::getApprovalStatus), -1); queryWrapper.ne(RefUtil.fieldNameUlc(PlanFeedbackApproval::getApprovalStatus), 1);
} }
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(PlanFeedbackApproval::getId)); queryWrapper.orderByDesc(RefUtil.fieldNameUlc(PlanFeedbackApproval::getId));
return queryWrapper; return queryWrapper;
@ -126,6 +129,11 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
if (planFeedbackApproval == null) { if (planFeedbackApproval == null) {
throw new OpenAlertException("未找到对应实体"); throw new OpenAlertException("未找到对应实体");
} }
int count = planFeedbackApprovalWorkService.count(new LambdaQueryWrapper<PlanFeedbackApprovalWork>()
.eq(PlanFeedbackApprovalWork::getApprovalId, id));
if (count > 0) {
throw new OpenAlertException("请先删除反馈记录");
}
baseMapper.deleteById(id); baseMapper.deleteById(id);
} }
@ -156,38 +164,31 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
} }
@Override @Override
// @DistributedLock(keyPrefix = "PlanFeedbackApprovalServiceImplSubmit:", key = "#map.projectSn", tryLok = true, lockTime = 0)
public void submit(HashMap<String, Object> map) { public void submit(HashMap<String, Object> map) {
String projectSn = MapUtils.getString(map, "projectSn");
PlanFeedbackApproval approval = JSON.parseObject(JSON.toJSONString(map.get("approval")), new TypeReference<PlanFeedbackApproval>() { PlanFeedbackApproval approval = JSON.parseObject(JSON.toJSONString(map.get("approval")), new TypeReference<PlanFeedbackApproval>() {
}); });
if (StrUtil.isBlank(approval.getApprovalIds())) {
throw new OpenAlertException("审批人为空");
}
approval.setApprovalStatus(2); approval.setApprovalStatus(2);
this.edit(approval); this.edit(approval);
List<Long> recordIdList = JSON.parseObject(JSON.toJSONString(map.get("recordIdList")), new TypeReference<List<Long>>() {
});
if (CollUtil.isNotEmpty(recordIdList)) {
Map<Long, PlanRecord> fbidMap = planRecordService.list(new LambdaQueryWrapper<PlanRecord>()
.in(PlanRecord::getId, recordIdList)).stream().filter(o -> o.getNewestFeedBackId() != null).collect(Collectors.toMap(PlanRecord::getNewestFeedBackId, Function.identity(), (record, record2) -> record));
if (CollUtil.isNotEmpty(fbidMap)) {
for (Map.Entry<Long, PlanRecord> entry : fbidMap.entrySet()) {
PlanFeedbackApprovalWork fbaw = new PlanFeedbackApprovalWork();
fbaw.setApprovalId(approval.getId());
fbaw.setRecordId(entry.getValue().getId());
fbaw.setFeedbackId(entry.getKey());
planFeedbackApprovalWorkService.add(fbaw);
}
}
}
} }
@Override @Override
public void approval(HashMap<String, Object> map) { public void approval(HashMap<String, Object> map) {
String approvalId = MapUtils.getString(map, "approvalId"); String approvalId = MapUtils.getString(map, "approvalId");
Integer isPass = MapUtils.getInteger(map, "isPass"); Integer isPass = MapUtils.getInteger(map, "isPass");
if (isPass == 1) {
this.update(new LambdaUpdateWrapper<PlanFeedbackApproval>() this.update(new LambdaUpdateWrapper<PlanFeedbackApproval>()
.set(PlanFeedbackApproval::getApprovalStatus, 3) .set(PlanFeedbackApproval::getApprovalStatus, 3)
.eq(PlanFeedbackApproval::getId, approvalId) .eq(PlanFeedbackApproval::getId, approvalId)
); );
} else {
this.update(new LambdaUpdateWrapper<PlanFeedbackApproval>()
.set(PlanFeedbackApproval::getApprovalStatus, 4)
.eq(PlanFeedbackApproval::getId, approvalId)
);
}
List<PlanFeedbackApprovalWork> feedbackApprovalWorks = planFeedbackApprovalWorkService.list(new LambdaQueryWrapper<PlanFeedbackApprovalWork>() List<PlanFeedbackApprovalWork> feedbackApprovalWorks = planFeedbackApprovalWorkService.list(new LambdaQueryWrapper<PlanFeedbackApprovalWork>()
.eq(PlanFeedbackApprovalWork::getApprovalId, approvalId)); .eq(PlanFeedbackApprovalWork::getApprovalId, approvalId));
List<Long> fbids = feedbackApprovalWorks.stream().map(PlanFeedbackApprovalWork::getFeedbackId).collect(Collectors.toList()); List<Long> fbids = feedbackApprovalWorks.stream().map(PlanFeedbackApprovalWork::getFeedbackId).collect(Collectors.toList());
@ -200,13 +201,14 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
.eq(PlanFeedback::getId, fbid) .eq(PlanFeedback::getId, fbid)
); );
//通过就更改计划编制 //通过就更改计划编制
if (Objects.equals(isPass, 1)) { if (isPass == 1) {
PlanFeedback feedback = fbIdMap.get(fbid); PlanFeedback feedback = fbIdMap.get(fbid);
if (feedback != null) { if (feedback != null) {
planRecordService.update(new LambdaUpdateWrapper<PlanRecord>() planRecordService.update(new LambdaUpdateWrapper<PlanRecord>()
.set(PlanRecord::getActualStart, feedback.getActualStart()) .set(PlanRecord::getActualStart, feedback.getActualStart())
.set(PlanRecord::getActualFinish, feedback.getActualFinish()) .set(PlanRecord::getActualFinish, feedback.getActualFinish())
.set(PlanRecord::getExpectedFinish, feedback.getExpectFinish()) .set(PlanRecord::getExpectedFinish, feedback.getExpectFinish())
.set(PlanRecord::getNewestFeedBackId, feedback.getId())
.eq(PlanRecord::getId, feedback.getRecordId()) .eq(PlanRecord::getId, feedback.getRecordId())
); );
} }
@ -216,49 +218,64 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
} }
@Override @Override
public void saveInfo(Map<String, Object> param) { public Result saveInfo(Map<String, Object> param) {
String projectSn = MapUtils.getString(param, "projectSn"); String projectSn = MapUtils.getString(param, "projectSn");
List<Long> recordIdList = JSON.parseObject(JSON.toJSONString(param.get("recordIdList")), new TypeReference<List<Long>>() { List<Long> recordIdList = JSON.parseObject(JSON.toJSONString(param.get("recordIdList")), new TypeReference<List<Long>>() {
}); }).stream().filter(Objects::nonNull).collect(Collectors.toList());
UserInfo user = SecurityUtils.getUser(); UserInfo user = SecurityUtils.getUser();
Long userId = user.getUserId(); Long userId = user.getUserId();
PlanFeedbackApproval approval = planFeedbackApprovalMapper.selectOne(new LambdaQueryWrapper<PlanFeedbackApproval>() PlanFeedbackApproval approval = this.queryNewestApproval();
.eq(PlanFeedbackApproval::getInputWorkerId, userId) Map<Long, PlanFeedback> ridFeedBackMap = new HashMap<>();
.eq(PlanFeedbackApproval::getApprovalStatus, 1) if (CollUtil.isNotEmpty(recordIdList)) {
); ridFeedBackMap = planFeedbackService.getNewestOneByRecordIdList(recordIdList).stream().collect(Collectors.toMap(PlanFeedback::getRecordId, Function.identity(), (planFeedback, planFeedback2) -> planFeedback));
Map<Long, PlanFeedback> ridFeedBackMap = planFeedbackService.getNewestOneByRecordIdList(recordIdList).stream().collect(Collectors.toMap(PlanFeedback::getRecordId, Function.identity(), (planFeedback, planFeedback2) -> planFeedback)); }
if (approval == null) { List<String> failNames = new ArrayList<>();
if (approval == null || approval.getApprovalStatus() != 1) {
approval = new PlanFeedbackApproval(); approval = new PlanFeedbackApproval();
approval.setProjectSn(approval.getProjectSn()); approval.setProjectSn(projectSn);
approval.setInputWorkerId(userId); approval.setInputWorkerId(userId);
approval.setInputWorkerName(user.getRealName()); approval.setInputWorkerName(user.getRealName());
approval.setApprovalStatus(1); approval.setApprovalStatus(1);
approval.setInputDate(new Date()); approval.setInputDate(new Date());
this.add(approval); this.add(approval);
addFeedbackAndWork(recordIdList, approval, ridFeedBackMap); if (CollUtil.isNotEmpty(recordIdList)) {
this.addFeedbackAndWork(recordIdList, approval, ridFeedBackMap);
}
} else { } else {
this.updateById(approval); this.updateById(approval);
if (CollUtil.isNotEmpty(recordIdList)) {
List<PlanFeedbackApprovalWork> works = planFeedbackApprovalWorkService.list(new LambdaQueryWrapper<PlanFeedbackApprovalWork>() List<PlanFeedbackApprovalWork> works = planFeedbackApprovalWorkService.list(new LambdaQueryWrapper<PlanFeedbackApprovalWork>()
.eq(PlanFeedbackApprovalWork::getApprovalId, approval.getId())); .eq(PlanFeedbackApprovalWork::getApprovalId, approval.getId()));
if (CollUtil.isNotEmpty(works)) { if (CollUtil.isNotEmpty(works)) {
Map<Long, PlanRecord> ridMap = planRecordService.list(new LambdaQueryWrapper<PlanRecord>() Map<Long, PlanRecord> ridMap = planRecordService.list(new LambdaQueryWrapper<PlanRecord>()
.in(PlanRecord::getId, works.stream().map(PlanFeedbackApprovalWork::getRecordId).collect(Collectors.toList()))).stream().collect(Collectors.toMap(PlanRecord::getId, Function.identity())); .in(PlanRecord::getId, works.stream().map(PlanFeedbackApprovalWork::getRecordId).collect(Collectors.toList()))).stream().collect(Collectors.toMap(PlanRecord::getId, Function.identity()));
for (Long rid : recordIdList) { Iterator<Long> iterator = recordIdList.iterator();
while (iterator.hasNext()) {
Long rid = iterator.next();
PlanRecord record = ridMap.get(rid); PlanRecord record = ridMap.get(rid);
if (record != null) { if (record != null) {
throw new OpenAlertException(record.getJobName() + "已经提交,请勿重复提交"); failNames.add(record.getJobName());
iterator.remove();
} }
} }
} }
addFeedbackAndWork(recordIdList, approval, ridFeedBackMap); if (CollUtil.isNotEmpty(recordIdList)) {
this.addFeedbackAndWork(recordIdList, approval, ridFeedBackMap);
} }
} }
}
if (CollUtil.isNotEmpty(failNames)) {
return Result.ok(StrUtil.join(",", failNames) + "正在处理中,请勿重复提交");
}
return Result.ok();
}
@Override @Override
public PlanFeedbackApproval queryMyApproval() { public PlanFeedbackApproval queryMyApproval() {
return planFeedbackApprovalMapper.selectOne(new LambdaQueryWrapper<PlanFeedbackApproval>() return planFeedbackApprovalMapper.selectOne(new LambdaQueryWrapper<PlanFeedbackApproval>()
.eq(PlanFeedbackApproval::getInputWorkerId, SecurityUtils.getUser().getUserId()) .eq(PlanFeedbackApproval::getInputWorkerId, SecurityUtils.getUser().getUserId())
.eq(PlanFeedbackApproval::getApprovalStatus, 1) .eq(PlanFeedbackApproval::getApprovalStatus, 1)
.last("limit 1")
); );
} }
@ -268,19 +285,23 @@ public class PlanFeedbackApprovalServiceImpl extends ServiceImpl<PlanFeedbackApp
faw.setApprovalId(approval.getId()); faw.setApprovalId(approval.getId());
faw.setRecordId(rid); faw.setRecordId(rid);
PlanFeedback feedback = ridFeedBackMap.get(rid); PlanFeedback feedback = ridFeedBackMap.get(rid);
if (feedback != null && feedback.getApprovalStatus() == 1) { if (feedback == null || feedback.getApprovalStatus() != 1) {
faw.setFeedbackId(feedback.getId()); feedback = planFeedbackService.getNewest(String.valueOf(rid));
} else { feedback.setRecordId(rid);
//新增一个feedback
PlanFeedback newest = planFeedbackService.getNewest(String.valueOf(rid));
planFeedbackService.add(newest);
//新增period和val
// List<PlanFeedbackPeriod> periodList = planFeedbackService.getPeriodMilestones(new MapBuilder<String, Object>().put("recordId", newest.getRecordId()).build());
// newest.setPeriods(periodList);
// planFeedbackService.saveInfo(newest);
faw.setFeedbackId(newest.getId());
} }
feedback.setProjectSn(approval.getProjectSn());
planFeedbackService.saveInfo(feedback);
faw.setFeedbackId(feedback.getId());
planFeedbackApprovalWorkService.add(faw); planFeedbackApprovalWorkService.add(faw);
} }
} }
@Override
public PlanFeedbackApproval queryNewestApproval() {
Long userId = SecurityUtils.getUser().getUserId();
return planFeedbackApprovalMapper.selectOne(new LambdaQueryWrapper<PlanFeedbackApproval>()
.eq(PlanFeedbackApproval::getInputWorkerId, userId)
.last("order by input_date desc limit 1")
);
}
} }

View File

@ -60,6 +60,8 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
private ISystemUserService systemUserService; private ISystemUserService systemUserService;
@Autowired @Autowired
private IPlanPbsService planPbsService; private IPlanPbsService planPbsService;
@Autowired
private IPlanFeedbackApprovalWorkService planFeedbackApprovalWorkService;
@Override @Override
public IPage<PlanFeedback> queryPageList(HashMap<String, Object> param) { public IPage<PlanFeedback> queryPageList(HashMap<String, Object> param) {
@ -104,7 +106,7 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
.set(PlanRecord::getNewestFeedBackId, feedback.getId()) .set(PlanRecord::getNewestFeedBackId, feedback.getId())
.eq(PlanRecord::getId, feedback.getRecordId()) .eq(PlanRecord::getId, feedback.getRecordId())
); );
addFeedbackPeriodAndVal(feedback); this.addFeedbackPeriodAndVal(feedback);
} }
@Override @Override
@ -122,6 +124,9 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
if (planFeedback == null) { if (planFeedback == null) {
throw new OpenAlertException("未找到对应实体"); throw new OpenAlertException("未找到对应实体");
} }
if (planFeedback.getApprovalStatus() == 3) {
throw new OpenAlertException("已通过的反馈记录不能删除");
}
baseMapper.deleteById(id); baseMapper.deleteById(id);
List<Long> fbpids = planFeedbackPeriodService.list(new LambdaQueryWrapper<PlanFeedbackPeriod>() List<Long> fbpids = planFeedbackPeriodService.list(new LambdaQueryWrapper<PlanFeedbackPeriod>()
@ -132,6 +137,8 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
planMilestoneValService.remove(new LambdaQueryWrapper<PlanMilestoneVal>() planMilestoneValService.remove(new LambdaQueryWrapper<PlanMilestoneVal>()
.in(PlanMilestoneVal::getFeedbackPeriodId, fbpids)); .in(PlanMilestoneVal::getFeedbackPeriodId, fbpids));
} }
planFeedbackApprovalWorkService.remove(new LambdaQueryWrapper<PlanFeedbackApprovalWork>()
.eq(PlanFeedbackApprovalWork::getFeedbackId, id));
} }
@ -147,7 +154,7 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
@Override @Override
public PlanFeedback getNewest(String recordId) { public PlanFeedback getNewest(String recordId) {
PlanRecord record = planRecordService.queryById(recordId); PlanRecord record = planRecordService.queryById(recordId);
PlanFeedback feedback = planFeedbackMapper.queryById(String.valueOf(record.getNewestFeedBackId())); PlanFeedback feedback = this.queryNewestFeedback(Long.valueOf(recordId));
if (feedback == null) { if (feedback == null) {
PlanPbs pbs = planPbsService.queryById(record.getPbsId() + ""); PlanPbs pbs = planPbsService.queryById(record.getPbsId() + "");
feedback = new PlanFeedback(); feedback = new PlanFeedback();
@ -209,12 +216,13 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
} }
PlanRecord record = planRecordService.queryById(recordId); PlanRecord record = planRecordService.queryById(recordId);
if (StrUtil.isBlank(feedbackId)) { if (StrUtil.isBlank(feedbackId)) {
if (record.getNewestFeedBackId() == null) { PlanFeedback newestFeedback = this.queryNewestFeedback(Long.valueOf(recordId));
if (newestFeedback == null) {
feedbackPeriods = getFeedbackPeriodWithoutSave(record); feedbackPeriods = getFeedbackPeriodWithoutSave(record);
} else { } else {
//新增反馈的回显查询最新的数据 //新增反馈的回显
List<PlanFeedbackPeriod> fbPeriods = planFeedbackPeriodService.list(new LambdaQueryWrapper<PlanFeedbackPeriod>() List<PlanFeedbackPeriod> fbPeriods = planFeedbackPeriodService.list(new LambdaQueryWrapper<PlanFeedbackPeriod>()
.eq(PlanFeedbackPeriod::getFeedbackId, record.getNewestFeedBackId())); .eq(PlanFeedbackPeriod::getFeedbackId, newestFeedback.getId()));
List<Long> fpIds = fbPeriods.stream().map(PlanFeedbackPeriod::getId).collect(Collectors.toList()); List<Long> fpIds = fbPeriods.stream().map(PlanFeedbackPeriod::getId).collect(Collectors.toList());
Map<Long, PlanMilestone> milestoneMap = planMilestoneService.getParentMilestones(recordId).stream().collect(Collectors.toMap(PlanMilestone::getId, Function.identity(), (planMilestone, planMilestone2) -> planMilestone)); Map<Long, PlanMilestone> milestoneMap = planMilestoneService.getParentMilestones(recordId).stream().collect(Collectors.toMap(PlanMilestone::getId, Function.identity(), (planMilestone, planMilestone2) -> planMilestone));
if (CollUtil.isNotEmpty(fpIds)) { if (CollUtil.isNotEmpty(fpIds)) {
@ -229,6 +237,7 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
feedbackPeriod.setMilestoneVals(valList.stream().filter(o -> Objects.equals(o.getFeedbackPeriodId(), feedbackPeriod.getId())).collect(Collectors.toList())); feedbackPeriod.setMilestoneVals(valList.stream().filter(o -> Objects.equals(o.getFeedbackPeriodId(), feedbackPeriod.getId())).collect(Collectors.toList()));
} }
} }
feedbackPeriods = fbPeriods;
} }
} else { } else {
feedbackPeriods = this.getExistFeedbackPeriods(Long.valueOf(feedbackId), record); feedbackPeriods = this.getExistFeedbackPeriods(Long.valueOf(feedbackId), record);
@ -290,29 +299,6 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
} }
return fbPeriods; return fbPeriods;
} }
//
// @Override
// public void submit(HashMap<String, Object> map) {
// String projectSn = MapUtils.getString(map, "projectSn");
// List<Long> feedbackIdList = JSON.parseObject(JSON.toJSONString(map.get("feedbackIdList")), new TypeReference<List<Long>>() {
// });
// if (CollUtil.isNotEmpty(feedbackIdList)) {
// for (Long id : feedbackIdList) {
// baseMapper.update(null, new LambdaUpdateWrapper<PlanFeedback>().set(PlanFeedback::getApprovalStatus, 2).eq(PlanFeedback::getId, id));
// }
// List<PlanFeedback> feedbackList = planFeedbackMapper.selectList(new LambdaQueryWrapper<PlanFeedback>()
// .in(PlanFeedback::getId, feedbackIdList));
// PlanRecord record = planRecordService.getOne(new LambdaQueryWrapper<PlanRecord>()
// .eq(PlanRecord::getId, feedbackList.get(0).getRecordId()));
// SystemUser user = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
// .eq(SystemUser::getUserId, record.getChargerId()));
// PlanFeedbackApproval approval = new PlanFeedbackApproval();
// approval.setProjectSn(projectSn);
// approval.setChargerName(user.getRealName());
// approval.setApprovalStatus(2);
// planFeedbackApprovalService.save(approval);
// }
// }
@Override @Override
public void approval(HashMap<String, Object> map) { public void approval(HashMap<String, Object> map) {
@ -347,11 +333,9 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
@Override @Override
public void saveInfo(PlanFeedback feedback) { public void saveInfo(PlanFeedback feedback) {
//最新一条是新增状态的就更新 //最新一条是新增状态的就更新
PlanFeedback feedback1 = planFeedbackMapper.selectOne(new LambdaQueryWrapper<PlanFeedback>() Long recordId = feedback.getRecordId();
.eq(PlanFeedback::getRecordId, feedback.getRecordId()) PlanFeedback feedback1 = queryNewestFeedback(recordId);
.last("order by input_date desc limit 1") PlanRecord record = planRecordService.getById(recordId);
);
PlanRecord record = planRecordService.getById(feedback.getRecordId());
if (record.getWorkType() != 1) { if (record.getWorkType() != 1) {
throw new OpenAlertException("只有作业可以新增反馈内容"); throw new OpenAlertException("只有作业可以新增反馈内容");
} }
@ -360,21 +344,36 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
feedback.setApprovalStatus(1); feedback.setApprovalStatus(1);
baseMapper.updateById(feedback); baseMapper.updateById(feedback);
//更新 //更新
List<Long> fbpids = planFeedbackPeriodService.list(new LambdaQueryWrapper<PlanFeedbackPeriod>() this.updateFeedbackPeriodAndVal(feedback);
.eq(PlanFeedbackPeriod::getFeedbackId, feedback1.getId())).stream().map(PlanFeedbackPeriod::getId).collect(Collectors.toList());
planFeedbackPeriodService.remove(new LambdaQueryWrapper<PlanFeedbackPeriod>()
.eq(PlanFeedbackPeriod::getFeedbackId, feedback1.getId()));
if (CollUtil.isNotEmpty(fbpids)) {
planMilestoneValService.remove(new LambdaQueryWrapper<PlanMilestoneVal>()
.in(PlanMilestoneVal::getFeedbackPeriodId, fbpids));
}
addFeedbackPeriodAndVal(feedback);
} else { } else {
feedback.setId(null); feedback.setId(null);
feedback.setApprovalStatus(1); feedback.setApprovalStatus(1);
baseMapper.insert(feedback); //由于分页这里需要添加没有的传过来的
addFeedbackPeriodAndVal(feedback); List<PlanFeedbackPeriod> periods = feedback.getPeriods();
if (CollUtil.isEmpty(periods)) {
periods = new ArrayList<>();
feedback.setPeriods(periods);
} }
HashMap<String, Object> param = new HashMap<>();
param.put("recordId", recordId);
List<PlanFeedbackPeriod> alls = this.getPeriodMilestones(param);
for (PlanFeedbackPeriod all : alls) {
Optional<PlanFeedbackPeriod> op = periods.stream().filter(o -> Objects.equals(all.getPeriodStart(), o.getPeriodStart())).findAny();
if (!op.isPresent()) {
periods.add(all);
}
}
baseMapper.insert(feedback);
this.addFeedbackPeriodAndVal(feedback);
}
}
private PlanFeedback queryNewestFeedback(Long recordId) {
PlanFeedback feedback1 = planFeedbackMapper.selectOne(new LambdaQueryWrapper<PlanFeedback>()
.eq(PlanFeedback::getRecordId, recordId)
.last("order by input_date desc limit 1")
);
return feedback1;
} }
@Override @Override
@ -389,10 +388,6 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
*/ */
private void addFeedbackPeriodAndVal(PlanFeedback feedback) { private void addFeedbackPeriodAndVal(PlanFeedback feedback) {
List<PlanFeedbackPeriod> periods = feedback.getPeriods(); List<PlanFeedbackPeriod> periods = feedback.getPeriods();
addFeedbackPeriodAndVal(feedback, periods);
}
private void addFeedbackPeriodAndVal(PlanFeedback feedback, List<PlanFeedbackPeriod> periods) {
if (CollUtil.isNotEmpty(periods)) { if (CollUtil.isNotEmpty(periods)) {
for (PlanFeedbackPeriod period : periods) { for (PlanFeedbackPeriod period : periods) {
period.setId(null); period.setId(null);
@ -410,4 +405,25 @@ public class PlanFeedbackServiceImpl extends ServiceImpl<PlanFeedbackMapper, Pla
} }
} }
/**
* 更新periods和val
*
* @param feedback
*/
private void updateFeedbackPeriodAndVal(PlanFeedback feedback) {
List<PlanFeedbackPeriod> periods = feedback.getPeriods();
if (CollUtil.isNotEmpty(periods)) {
for (PlanFeedbackPeriod period : periods) {
period.setFeedbackId(feedback.getId());
planFeedbackPeriodService.updateById(period);
List<PlanMilestoneVal> milestoneVals = period.getMilestoneVals();
if (CollUtil.isNotEmpty(milestoneVals)) {
for (PlanMilestoneVal val : milestoneVals) {
val.setFeedbackPeriodId(period.getId());
planMilestoneValService.updateById(val);
}
}
}
}
}
} }

View File

@ -53,6 +53,7 @@ public class PlanPeriodServiceImpl extends ServiceImpl<PlanPeriodMapper, PlanPer
} }
private List<PlanPeriod> dealList(List<PlanPeriod> list) { private List<PlanPeriod> dealList(List<PlanPeriod> list) {
return list; return list;
} }

View File

@ -27,7 +27,6 @@ import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.xhtmlrenderer.css.parser.property.PrimitivePropertyBuilders;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
@ -181,6 +180,11 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
if (planRecord == null) { if (planRecord == null) {
throw new OpenAlertException("未找到对应实体"); throw new OpenAlertException("未找到对应实体");
} }
int count = planFeedbackService.count(new LambdaQueryWrapper<PlanFeedback>()
.eq(PlanFeedback::getRecordId, id));
if (count > 0) {
throw new OpenAlertException("请先删除反馈数据");
}
baseMapper.deleteById(id); baseMapper.deleteById(id);
} }
@ -229,8 +233,8 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
@Override @Override
public List<PlanFeedbackPeriod> getPlanShares(Map<String, Object> param) { public List<PlanFeedbackPeriod> getPlanShares(Map<String, Object> param) {
String recordId = MapUtils.getString(param, "recordId"); String recordId = MapUtils.getString(param, "recordId");
String beginDate = MapUtils.getString(param, "beginDate"); String beginDate = MapUtils.getString(param, "periodStart");
String endDate = MapUtils.getString(param, "endDate"); String endDate = MapUtils.getString(param, "periodEnd");
List<PlanFeedbackPeriod> feedbackPeriods = new ArrayList<>(); List<PlanFeedbackPeriod> feedbackPeriods = new ArrayList<>();
PlanRecord record = this.getById(recordId); PlanRecord record = this.getById(recordId);
if (record == null) { if (record == null) {
@ -366,10 +370,10 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
pp = NumberUtil.add(pp, NumberUtil.mul(val.getPlanVal(), weight)); pp = NumberUtil.add(pp, NumberUtil.mul(val.getPlanVal(), weight));
ap = NumberUtil.add(ap, NumberUtil.mul(val.getActualVal(), weight)); ap = NumberUtil.add(ap, NumberUtil.mul(val.getActualVal(), weight));
} }
period.setPlanOriginPer(pp); period.setPlanPer(pp);
period.setActualOriginPer(ap); period.setActualPer(ap);
period.setPlanYdz(NumberUtil.mul(period.getPlanPer(), record.getWeight(), 2)); period.setPlanYdz(NumberUtil.mul(period.getPlanPer(), record.getWeight(), new BigDecimal("0.01")));
period.setActualYdz(NumberUtil.mul(period.getActualPer(), record.getWeight(), 2)); period.setActualYdz(NumberUtil.mul(period.getActualPer(), record.getWeight(), new BigDecimal("0.01")));
} }
return feedbackPeriods; return feedbackPeriods;
} }
@ -396,17 +400,19 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
List<PlanRecord> children = record.getChildren(); List<PlanRecord> children = record.getChildren();
Map<Date, PlanFeedbackPeriod> startMap = new HashMap<>(); Map<Date, PlanFeedbackPeriod> startMap = new HashMap<>();
for (PlanRecord child : children) { for (PlanRecord child : children) {
Map<Date, PlanFeedbackPeriod> startMap1;
if (Objects.equals(child.getWorkType(), 1)) { if (Objects.equals(child.getWorkType(), 1)) {
Map<String, Object> param = new HashMap<>();
PlanRecord planRecord = planRecords.stream().filter(o -> Objects.equals(o.getId(), child.getId())).findFirst().get(); PlanRecord planRecord = planRecords.stream().filter(o -> Objects.equals(o.getId(), child.getId())).findFirst().get();
List<PlanFeedbackPeriod> feedbackPeriods1 = this.getPeriodMilestonesForWork(planRecord, planPeriod, milestones); List<PlanFeedbackPeriod> feedbackPeriods1 = this.getPeriodMilestonesForWork(planRecord, planPeriod, milestones);
startMap = feedbackPeriods1.stream().collect(Collectors.toMap(PlanFeedbackPeriod::getPeriodStart, Function.identity(), (planFeedbackPeriod, planFeedbackPeriod2) -> planFeedbackPeriod)); startMap1 = feedbackPeriods1.stream().collect(Collectors.toMap(PlanFeedbackPeriod::getPeriodStart, Function.identity(), (planFeedbackPeriod, planFeedbackPeriod2) -> planFeedbackPeriod));
if (CollUtil.isEmpty(startMap)) {
startMap = startMap1;
} else { } else {
startMap = this.getChildFeedbackPeriodMap(child, planRecords, milestones, planPeriod); //按权重求和
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue(); PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), child.getWeight(), 2); BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), child.getWeight());
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), child.getWeight(), 2); BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), child.getWeight());
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart()); PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) { if (p == null) {
p = ObjectUtil.cloneByStream(fp); p = ObjectUtil.cloneByStream(fp);
@ -416,6 +422,29 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
p.setActualYdz(NumberUtil.add(p.getActualYdz(), aydz)); p.setActualYdz(NumberUtil.add(p.getActualYdz(), aydz));
} }
} }
} else {
startMap1 = this.getChildFeedbackPeriodMap(child, planRecords, milestones, planPeriod);
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), child.getWeight());
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), child.getWeight());
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) {
p = ObjectUtil.cloneByStream(fp);
startMap.put(fp.getPeriodStart(), p);
}
p.setPlanYdz(NumberUtil.add(p.getPlanYdz(), pydz));
p.setActualYdz(NumberUtil.add(p.getActualYdz(), aydz));
}
}
//计算百分比
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) {
PlanFeedbackPeriod period = entry.getValue();
if (BigDecimal.ZERO.compareTo(child.getWeight()) != 0) {
period.setPlanPer(NumberUtil.mul(new BigDecimal("100"), NumberUtil.div(period.getPlanYdz(), child.getWeight(), 2)));
period.setActualPer(NumberUtil.mul(new BigDecimal("100"), NumberUtil.div(period.getActualYdz(), child.getWeight(), 2)));
}
}
} }
return startMap; return startMap;
} }