Browse Source

查看项目下的所有任务对应的财务信息、修改任务或项目的预算和奖金信息、查看自己需要审批的申请、查看项目下的财务信息、追加预算

ptos
lucky 4 years ago
parent
commit
0b4f575f00
  1. 86
      src/main/java/com/ccsens/ptccsens/api/ProjectFinanceController.java
  2. 81
      src/main/java/com/ccsens/ptccsens/bean/dto/ProjectFinanceDto.java
  3. 11
      src/main/java/com/ccsens/ptccsens/bean/po/ProTaskPlugin.java
  4. 70
      src/main/java/com/ccsens/ptccsens/bean/po/ProTaskPluginExample.java
  5. 111
      src/main/java/com/ccsens/ptccsens/bean/vo/ProjectFinanceVo.java
  6. 32
      src/main/java/com/ccsens/ptccsens/persist/dao/PluFinanceApplyDao.java
  7. 45
      src/main/java/com/ccsens/ptccsens/persist/dao/PluFinanceDao.java
  8. 22
      src/main/java/com/ccsens/ptccsens/persist/dao/PluginDao.java
  9. 49
      src/main/java/com/ccsens/ptccsens/service/IProjectFinanceService.java
  10. 183
      src/main/java/com/ccsens/ptccsens/service/ProjectFinanceService.java
  11. 1
      src/main/java/com/ccsens/ptccsens/util/BasicsCodeError.java
  12. 65
      src/main/resources/mapper_dao/PluFinanceApplyDao.xml
  13. 130
      src/main/resources/mapper_dao/PluFinanceDao.xml
  14. 17
      src/main/resources/mapper_dao/PluginDao.xml
  15. 27
      src/main/resources/mapper_raw/ProTaskPluginMapper.xml
  16. 66
      src/main/resources/mbg.xml

86
src/main/java/com/ccsens/ptccsens/api/ProjectFinanceController.java

@ -0,0 +1,86 @@
package com.ccsens.ptccsens.api;
import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.ptccsens.bean.dto.ProjectFinanceDto;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.ccsens.ptccsens.service.IProjectFinanceService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author AUSU
*/
@Api(tags = "项目财务信息")
@RestController
@RequestMapping("/projectFinance")
@Slf4j
public class ProjectFinanceController {
@Resource
private IProjectFinanceService projectFinanceService;
@MustLogin
@ApiOperation(value = "查看项目下的所有任务对应的财务信息", notes = "")
@RequestMapping(value = "/queryProjectFinance", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<ProjectFinanceVo.ProjectFinanceInfo> queryProjectFinance(@ApiParam @Validated @RequestBody QueryDto<ProjectFinanceDto.QueryProjectFinance> params) throws Exception{
log.info("查看项目下的所有任务对应的财务信息开始{}",params);
ProjectFinanceVo.ProjectFinanceInfo projectFinance = projectFinanceService.queryProjectFinance(params.getParam(),params.getUserId());
log.info("查看项目下的所有任务对应的财务信息结束:{}",projectFinance);
return JsonResponse.newInstance().ok(projectFinance);
}
@MustLogin
@ApiOperation(value = "修改任务或项目的预算和奖金信息", notes = "")
@RequestMapping(value = "/updateFinance", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse updateFinance(@ApiParam @Validated @RequestBody QueryDto<ProjectFinanceDto.UpdateFinance> params) throws Exception{
log.info("修改任务或项目的预算和奖金信息开始{}",params);
projectFinanceService.updateFinance(params.getParam(),params.getUserId());
log.info("修改任务或项目的预算和奖金信息结束");
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "查看自己需要审批的申请", notes = "")
@RequestMapping(value = "/queryNeedCheckByMe", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<PageInfo<ProjectFinanceVo.NeedCheckByMe>> queryNeedCheckByMe(@ApiParam @Validated @RequestBody QueryDto<ProjectFinanceDto.QueryNeedCheckByMe> params) throws Exception{
log.info("查看自己需要审批的申请开始{}",params);
PageInfo<ProjectFinanceVo.NeedCheckByMe> needCheckByMeList = projectFinanceService.queryNeedCheckByMe(params.getParam(),params.getUserId());
log.info("查看自己需要审批的申请结束:{}",needCheckByMeList);
return JsonResponse.newInstance().ok(needCheckByMeList);
}
@MustLogin
@ApiOperation(value = "查看项目下的财务信息", notes = "")
@RequestMapping(value = "/queryFinanceOfProject", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<PageInfo<ProjectFinanceVo.FinanceOfProject>> queryFinanceOfProject(@ApiParam @Validated @RequestBody QueryDto<ProjectFinanceDto.QueryFinanceOfProject> params) throws Exception{
log.info("查看项目下的财务信息开始{}",params);
PageInfo<ProjectFinanceVo.FinanceOfProject> financeOfProjectList = projectFinanceService.queryFinanceOfProject(params.getParam(),params.getUserId());
log.info("查看项目下的财务信息结束:{}",financeOfProjectList);
return JsonResponse.newInstance().ok(financeOfProjectList);
}
@MustLogin
@ApiOperation(value = "追加预算", notes = "")
@RequestMapping(value = "/addBudget", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse addBudget(@ApiParam @Validated @RequestBody QueryDto<ProjectFinanceDto.AddBudget> params) throws Exception{
log.info("追加预算开始{}",params);
projectFinanceService.addBudget(params.getParam(),params.getUserId());
log.info("追加预算结束");
return JsonResponse.newInstance().ok();
}
}

81
src/main/java/com/ccsens/ptccsens/bean/dto/ProjectFinanceDto.java

@ -0,0 +1,81 @@
package com.ccsens.ptccsens.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author AUSU
*/
@Data
public class ProjectFinanceDto {
@Data
@ApiModel("查看项目下的所有任务对应的财务信息-入参")
public static class QueryProjectFinance {
@NotNull
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("任务名称")
private String name;
@ApiModelProperty("页数")
private Integer pageNum = 1;
@ApiModelProperty("每页的数量")
private Integer pageSize = 10;
}
@Data
@ApiModel("修改任务或项目的预算和奖金信息-入参")
public static class UpdateFinance {
@NotNull
@ApiModelProperty("任务详情id")
private Long taskDetailId;
@NotNull
@ApiModelProperty("任务财务信息id")
private Long taskFinanceId;
@ApiModelProperty("预算")
private Long budget;
@ApiModelProperty("奖金")
private Long bonus;
}
@Data
@ApiModel("查看自己需要审批的申请-入参")
public static class QueryNeedCheckByMe {
@NotNull
@ApiModelProperty("任务详情id")
private Long taskDetailId;
@ApiModelProperty("页数")
private Integer pageNum = 1;
@ApiModelProperty("每页的数量")
private Integer pageSize = 10;
}
@Data
@ApiModel("查看项目下的财务信息-入参")
public static class QueryFinanceOfProject {
@NotNull
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("页数")
private Integer pageNum = 1;
@ApiModelProperty("每页的数量")
private Integer pageSize = 10;
}
@Data
@ApiModel("追加预算-入参")
public static class AddBudget {
@NotNull
@ApiModelProperty("财务信息id")
private Long financeId;
@NotNull
@ApiModelProperty("项目id")
private Long projectId;
@ApiModelProperty("追加预算")
private Long appendBudget;
}
}

11
src/main/java/com/ccsens/ptccsens/bean/po/ProTaskPlugin.java

@ -26,6 +26,8 @@ public class ProTaskPlugin implements Serializable {
private Integer rowspan;
private String code;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -116,6 +118,14 @@ public class ProTaskPlugin implements Serializable {
this.rowspan = rowspan;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -133,6 +143,7 @@ public class ProTaskPlugin implements Serializable {
sb.append(", recStatus=").append(recStatus);
sb.append(", colspan=").append(colspan);
sb.append(", rowspan=").append(rowspan);
sb.append(", code=").append(code);
sb.append("]");
return sb.toString();
}

70
src/main/java/com/ccsens/ptccsens/bean/po/ProTaskPluginExample.java

@ -774,6 +774,76 @@ public class ProTaskPluginExample {
addCriterion("rowspan not between", value1, value2, "rowspan");
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

111
src/main/java/com/ccsens/ptccsens/bean/vo/ProjectFinanceVo.java

@ -0,0 +1,111 @@
package com.ccsens.ptccsens.bean.vo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author AUSU
*/
@Data
public class ProjectFinanceVo {
@Data
@ApiModel("查看项目下的所有任务对应的财务信息-返参")
public static class ProjectFinanceInfo {
@ApiModelProperty("项目财务信息id")
private Long projectFinanceId;
@ApiModelProperty("预算")
private Long budget;
@ApiModelProperty("奖金")
private Long bonus;
@ApiModelProperty("任务财务信息")
private PageInfo<TaskFinance> taskFinanceList;
}
@Data
@ApiModel("任务财务信息")
public static class TaskFinance {
@ApiModelProperty("任务id")
private Long taskDetailId;
@ApiModelProperty("任务名")
private String name;
@ApiModelProperty("任务财务信息id")
private Long taskFinanceId;
@ApiModelProperty("预算")
private Long budget;
@ApiModelProperty("奖金")
private Long bonus;
}
@Data
@ApiModel("查看自己需要审批的申请-返参")
public static class NeedCheckByMe {
@ApiModelProperty("申请记录id")
private Long applyId;
@ApiModelProperty("提交人姓名")
private String submitName;
@ApiModelProperty("金额")
private Long money;
@ApiModelProperty("申请时间")
private Long submitTime;
@ApiModelProperty("审查人和当前记录的关联id")
private Long financeCheckId;
@ApiModelProperty("当前状态")
private Byte applyType;
}
@Data
@ApiModel("查看自己需要审批的申请-返参")
public static class FinanceOfProject {
@ApiModelProperty("任务id")
private Long taskDetailId;
@ApiModelProperty("任务名")
private String taskName;
@ApiModelProperty("财务信息id")
private Long financeId;
@ApiModelProperty("预算")
private Long budget;
@ApiModelProperty("追加预算")
private Long appendBudget;
@ApiModelProperty("支出")
private Long expend;
@ApiModelProperty("结余")
private Long surplus;
}
@Data
public static class FinanceInfo {
@ApiModelProperty("财务信息id")
private Long fid;
@ApiModelProperty("预算")
private Long budget;
@ApiModelProperty("奖金")
private Long bonus;
@ApiModelProperty("任务id")
private Long taskDetailId;
@ApiModelProperty("任务名")
private String taskName;
@ApiModelProperty("追加预算列表")
private List<AppendBudget> appendBudgetList;
@ApiModelProperty("任务名")
private List<PassMoney> passMoneyList;
}
@Data
public static class AppendBudget {
@ApiModelProperty("财务信息id")
private Long fabId;
@ApiModelProperty("追加预算")
private Long appendBudget;
}
@Data
public static class PassMoney {
@ApiModelProperty("财务信息id")
private Long faId;
@ApiModelProperty("审核通过的钱")
private Long passMoney;
}
}

32
src/main/java/com/ccsens/ptccsens/persist/dao/PluFinanceApplyDao.java

@ -0,0 +1,32 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.ccsens.ptccsens.persist.mapper.PluFinanceMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface PluFinanceApplyDao extends PluFinanceMapper {
/**
* 查询项目下需要我申请的费用
* @param projectId 项目id
* @param userId 用户id
* @return 项目下需要我申请的费用
*/
List<ProjectFinanceVo.NeedCheckByMe> queryNeedCheckByMeOfProject(@Param("projectId") Long projectId,@Param("userId") Long userId);
/**
* 查询项目下需要我申请的费用
* @param taskDetailId 任务id
* @param userId 用户id
* @param projectId 项目id
* @return 项目下需要我申请的费用
*/
List<ProjectFinanceVo.NeedCheckByMe> queryNeedCheckByMeOfTask(@Param("taskDetailId") Long taskDetailId,@Param("userId") Long userId,@Param("projectId") Long projectId);
}

45
src/main/java/com/ccsens/ptccsens/persist/dao/PluFinanceDao.java

@ -0,0 +1,45 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.ptccsens.bean.dto.ProjectFinanceDto;
import com.ccsens.ptccsens.bean.po.PluFinance;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.ccsens.ptccsens.persist.mapper.PluFinanceMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author AUSU
*/
@Repository
public interface PluFinanceDao extends PluFinanceMapper {
/**
* 查询项目下所有任务的预算和奖金
* @param projectId 项目id
* @return 项目下所有任务的预算和奖金
*/
List<ProjectFinanceVo.TaskFinance> queryAllByTaskId(@Param("projectId") Long projectId);
/**
* 查询项目下的总计预算与奖金
* @param projectId 项目id
* @return 项目下的总计预算与奖金
*/
ProjectFinanceVo.ProjectFinanceInfo queryOfProjectTotal(@Param("projectId") Long projectId);
/**
* 根据任务id查询财务信息
* @param taskDetailId 任务id
* @return 财务信息
*/
PluFinance queryByTaskId(@Param("taskDetailId") Long taskDetailId);
/**
* 查询项目下任务的预算使用情况
* @param projectId 项目id
* @return 项目下任务的预算使用情况
*/
List<ProjectFinanceVo.FinanceInfo> queryFinanceOfProject(@Param("projectId") Long projectId);
}

22
src/main/java/com/ccsens/ptccsens/persist/dao/PluginDao.java

@ -0,0 +1,22 @@
package com.ccsens.ptccsens.persist.dao;
import com.ccsens.common.persist.dao.ProTaskPluginDao;
import com.ccsens.ptccsens.bean.po.ProTaskPlugin;
import com.ccsens.ptccsens.persist.mapper.ProTaskPluginMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author AUSU
*/
@Repository
public interface PluginDao extends ProTaskPluginMapper {
/**
* 查询是否绑定了指定插件
* @param taskDetailId 任务id
* @param code 插件code
* @return 0无 1有
*/
Integer queryFinancePlugin(@Param("taskDetailId") Long taskDetailId,@Param("code") String code);
}

49
src/main/java/com/ccsens/ptccsens/service/IProjectFinanceService.java

@ -0,0 +1,49 @@
package com.ccsens.ptccsens.service;
import com.ccsens.ptccsens.bean.dto.ProjectFinanceDto;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
/**
* @author AUSU
*/
public interface IProjectFinanceService {
/**
* 查看项目下的所有任务对应的财务信息
* @param param 入参
* @param userId 用户id
* @return 项目下的所有任务对应的财务信息
*/
ProjectFinanceVo.ProjectFinanceInfo queryProjectFinance(ProjectFinanceDto.QueryProjectFinance param, Long userId);
/**
* 修改任务或项目的预算和奖金信息
* @param param 入参
* @param userId userId
*/
void updateFinance(ProjectFinanceDto.UpdateFinance param, Long userId);
/**
* 查询需要我审批的申请
* @param param 入参
* @param userId 用户id
* @return 需要我审批的申请
*/
PageInfo<ProjectFinanceVo.NeedCheckByMe> queryNeedCheckByMe(ProjectFinanceDto.QueryNeedCheckByMe param, Long userId);
/**
* 查看项目下的财务信息
* @param param 入参
* @param userId 用户id
* @return 项目下的财务信息
*/
PageInfo<ProjectFinanceVo.FinanceOfProject> queryFinanceOfProject(ProjectFinanceDto.QueryFinanceOfProject param, Long userId);
/**
* 追加预算
* @param param 入参
* @param userId 用户id
*/
void addBudget(ProjectFinanceDto.AddBudget param, Long userId);
}

183
src/main/java/com/ccsens/ptccsens/service/ProjectFinanceService.java

@ -0,0 +1,183 @@
package com.ccsens.ptccsens.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.common.persist.dao.ProMemberDao;
import com.ccsens.common.persist.dao.ProTaskDetailDao;
import com.ccsens.ptccsens.bean.dto.ProjectFinanceDto;
import com.ccsens.ptccsens.bean.po.PluFinance;
import com.ccsens.ptccsens.bean.po.PluFinanceAppendBudget;
import com.ccsens.ptccsens.bean.po.ProTaskPlugin;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.ccsens.ptccsens.persist.dao.PluFinanceApplyDao;
import com.ccsens.ptccsens.persist.dao.PluFinanceDao;
import com.ccsens.ptccsens.persist.dao.PluginDao;
import com.ccsens.ptccsens.persist.mapper.PluFinanceAppendBudgetMapper;
import com.ccsens.ptccsens.util.BasicsCodeError;
import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @author AUSU
*/
@Service
@Slf4j
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ProjectFinanceService implements IProjectFinanceService{
@Resource
private PluFinanceDao pluFinanceDao;
@Resource
private PluginDao pluginDao;
@Resource
private PluFinanceApplyDao pluFinanceApplyDao;
@Resource
private PluFinanceAppendBudgetMapper appendBudgetMapper;
@Resource
private ProTaskDetailDao proTaskDetailDao;
@Resource
private ProMemberDao memberDao;
@Resource
private Snowflake snowflake;
@Override
public ProjectFinanceVo.ProjectFinanceInfo queryProjectFinance(ProjectFinanceDto.QueryProjectFinance param, Long userId) {
ProjectFinanceVo.ProjectFinanceInfo projectFinanceInfo = new ProjectFinanceVo.ProjectFinanceInfo();
PageHelper.startPage(param.getPageNum(),param.getPageSize());
//查询项目下的所有任务财务信息
List<ProjectFinanceVo.TaskFinance> taskFinanceList = pluFinanceDao.queryAllByTaskId(param.getProjectId());
log.info("项目下的所有任务财务信息:{}",taskFinanceList);
//查询项目下的总计
projectFinanceInfo = pluFinanceDao.queryOfProjectTotal(param.getProjectId());
log.info("项目的总计预算与奖金:{}",projectFinanceInfo);
if (CollectionUtil.isNotEmpty(taskFinanceList)) {
projectFinanceInfo.setTaskFinanceList(new PageInfo<ProjectFinanceVo.TaskFinance>(taskFinanceList));
}
return projectFinanceInfo;
}
@Override
public void updateFinance(ProjectFinanceDto.UpdateFinance param, Long userId) {
//如果任务没有关联财务条插件,则自动关联财务条插件
//TODO 根据插件code查询是否存在, code暂时写死
Integer num = pluginDao.queryFinancePlugin(param.getTaskDetailId(), "MP-TALL财务条");
if (num < 1) {
//不存在则关联插件
ProTaskPlugin proTaskPlugin = new ProTaskPlugin();
proTaskPlugin.setId(snowflake.nextId());
proTaskPlugin.setCode("MP-TALL财务条");
proTaskPlugin.setPlginCol(1);
proTaskPlugin.setPlginRow(1);
proTaskPlugin.setColspan(1);
proTaskPlugin.setRowspan(1);
proTaskPlugin.setTaskDetailId(param.getTaskDetailId());
//TODO 插件id
proTaskPlugin.setPluginId(123456L);
proTaskPlugin.setCode("MP-TALL财务条");
pluginDao.insertSelective(proTaskPlugin);
}
//根据任务财务信息id查找财务表
PluFinance pluFinance = pluFinanceDao.selectByPrimaryKey(param.getTaskFinanceId());
//a.如果存在,直接修改预算或奖金
if (ObjectUtil.isNotNull(pluFinance)) {
PluFinance updatePluFinance = new PluFinance();
updatePluFinance.setId(param.getTaskDetailId());
if (ObjectUtil.isNotNull(param.getBonus()) && 0 != param.getBonus()) {
updatePluFinance.setBonus(param.getBonus());
}
if (ObjectUtil.isNotNull(param.getBudget()) && 0!= param.getBudget()) {
updatePluFinance.setBudget(param.getBudget());
}
pluFinanceDao.updateByPrimaryKeySelective(updatePluFinance);
return;
}
//b.如果不存在,根据任务id新建一个财务信息
PluFinance newPluFinance = new PluFinance();
newPluFinance.setId(snowflake.nextId());
if (ObjectUtil.isNotNull(param.getBonus()) && 0 != param.getBonus()) {
newPluFinance.setBonus(param.getBonus());
}
if (ObjectUtil.isNotNull(param.getBudget()) && 0!= param.getBudget()) {
newPluFinance.setBudget(param.getBudget());
}
newPluFinance.setTaskId(param.getTaskDetailId());
newPluFinance.setType((byte) 1);
newPluFinance.setOperator(userId);
pluFinanceDao.insertSelective(newPluFinance);
}
@Override
public PageInfo<ProjectFinanceVo.NeedCheckByMe> queryNeedCheckByMe(ProjectFinanceDto.QueryNeedCheckByMe param, Long userId) {
PluFinance pluFinance = pluFinanceDao.queryByTaskId(param.getTaskDetailId());
log.info("根据任务id查询到的财务信息:{}",pluFinance);
PageHelper.startPage(param.getPageNum(),param.getPageSize());
if (ObjectUtil.isNotNull(pluFinance)) {
if (0 == pluFinance.getType()) {
List<ProjectFinanceVo.NeedCheckByMe> needCheckByMeList = pluFinanceApplyDao.queryNeedCheckByMeOfProject(param.getTaskDetailId(),userId);
return new PageInfo<>(needCheckByMeList);
}
//查询任务的项目id
Long projectId = proTaskDetailDao.projectIdByTaskDetailId(param.getTaskDetailId());
List<ProjectFinanceVo.NeedCheckByMe> needCheckByMeList = pluFinanceApplyDao.queryNeedCheckByMeOfTask(param.getTaskDetailId(),userId,projectId);
return new PageInfo<>(needCheckByMeList);
}
return null;
}
@Override
public PageInfo<ProjectFinanceVo.FinanceOfProject> queryFinanceOfProject(ProjectFinanceDto.QueryFinanceOfProject param, Long userId) {
PageHelper.startPage(param.getPageNum(),param.getPageSize());
List<ProjectFinanceVo.FinanceOfProject> financeOfProjectList = new ArrayList<>();
List<ProjectFinanceVo.FinanceInfo> financeInfoList = pluFinanceDao.queryFinanceOfProject(param.getProjectId());
if (CollectionUtil.isNotEmpty(financeInfoList)) {
for (ProjectFinanceVo.FinanceInfo financeInfo : financeInfoList) {
ProjectFinanceVo.FinanceOfProject financeOfProject = new ProjectFinanceVo.FinanceOfProject();
financeOfProject.setTaskDetailId(financeInfo.getTaskDetailId());
financeOfProject.setTaskName(financeInfo.getTaskName());
financeOfProject.setFinanceId(financeInfo.getFid());
financeOfProject.setBudget(financeInfo.getBudget());
long appendBudgetSum = 0L;
if (CollectionUtil.isNotEmpty(financeInfo.getAppendBudgetList())) {
appendBudgetSum = financeInfo.getAppendBudgetList().stream().mapToLong(ProjectFinanceVo.AppendBudget::getAppendBudget).sum();
}
financeOfProject.setAppendBudget(appendBudgetSum);
long passMoneySum = 0L;
if (CollectionUtil.isNotEmpty(financeInfo.getPassMoneyList())) {
passMoneySum = financeInfo.getPassMoneyList().stream().mapToLong(ProjectFinanceVo.PassMoney::getPassMoney).sum();
}
financeOfProject.setExpend(passMoneySum);
financeOfProject.setSurplus(financeInfo.getBudget()+appendBudgetSum-passMoneySum);
financeOfProjectList.add(financeOfProject);
}
}
return new PageInfo<>(financeOfProjectList);
}
@Override
public void addBudget(ProjectFinanceDto.AddBudget param, Long userId) {
PluFinance pluFinance = pluFinanceDao.selectByPrimaryKey(param.getFinanceId());
if (ObjectUtil.isNull(pluFinance)) {
throw new BaseException(BasicsCodeError.FINANCE_ERROR);
}
PluFinanceAppendBudget appendBudget = new PluFinanceAppendBudget();
appendBudget.setId(snowflake.nextId());
appendBudget.setFinanceId(param.getFinanceId());
Long userOfMemberId = memberDao.findUserOfMemberId(param.getProjectId(), userId);
appendBudget.setMemberId(userOfMemberId);
appendBudget.setOperator(userId);
appendBudgetMapper.insertSelective(appendBudget);
}
}

1
src/main/java/com/ccsens/ptccsens/util/BasicsCodeError.java

@ -33,6 +33,7 @@ public class BasicsCodeError extends CodeError {
public static final Code NOT_PLAYER_APPLY = new Code(523,"未找到报名信息信息", true);
public static final Code ID_CODE_ERROR = new Code(524,"请输入正确的身份证", true);
public static final Code NOT_FILE = new Code(525,"找不到文件", true);
public static final Code FINANCE_ERROR = new Code(526,"财务信息错误", true);
public static final Code TOTAL_MONEY_ERROR = new Code(526,"申请总金额和发票总金额不一致,请检查修改后重新提交。", true);
public static final Code CHECK_NOT_FOUND = new Code(527,"没有找到对应的审核记录,请确认后重新提交。", true);

65
src/main/resources/mapper_dao/PluFinanceApplyDao.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ptccsens.persist.dao.PluFinanceApplyDao">
<select id="queryNeedCheckByMeOfProject"
resultType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$NeedCheckByMe">
SELECT
fa.id AS applyId,
fa.submit_name AS submitName,
fa.money AS money,
fa.apply_time AS submitTime,
fc.id AS financeCheckId,
fcl.check_status AS applyType
FROM
t_plu_finance_apply AS fa
LEFT JOIN t_plu_finance_check AS fc ON fa.id = fc.finance_apply_id
LEFT JOIN (SELECT id,rec_status FROM t_pro_member WHERE rec_status = 0 AND user_id = #{userId} AND project_id = #{projectId}) AS member ON member.id = fc.checker_id
LEFT JOIN t_plu_finance_check_log AS fcl ON fcl.check_id = fc.id AND fcl.rec_status = 0
WHERE
fa.rec_status = 0
AND fa.task_id IN (
SELECT
pt2.task_detail_id
FROM
t_pro_parent_task AS pt2
WHERE
pt2.rec_status = 0
AND pt2.parent_task_detail_id IN (
SELECT
pt1.task_detail_id
FROM
t_pro_parent_task AS pt1
WHERE
pt1.rec_status = 0
AND pt1.parent_task_detail_id = #{projectId}
)
)
AND fa.rec_status = 0
AND member.rec_status = 0
</select>
<select id="queryNeedCheckByMeOfTask"
resultType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$NeedCheckByMe">
SELECT
fa.id AS applyId,
fa.submit_name AS submitName,
fa.money AS money,
fa.apply_time AS submitTime,
fc.id AS financeCheckId,
fcl.check_status AS applyType
FROM
t_plu_finance_apply AS fa
LEFT JOIN t_plu_finance_check AS fc ON fa.id = fc.finance_apply_id
LEFT JOIN (SELECT id,rec_status FROM t_pro_member WHERE rec_status = 0 AND user_id = #{userId} AND project_id = #{projectId}) AS member ON member.id = fc.checker_id
LEFT JOIN t_plu_finance_check_log AS fcl ON fcl.check_id = fc.id AND fcl.rec_status = 0
WHERE
fa.rec_status = 0
AND fa.task_id = #{taskDetailId}
AND fa.rec_status = 0
AND member.rec_status = 0
</select>
</mapper>

130
src/main/resources/mapper_dao/PluFinanceDao.xml

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ptccsens.persist.dao.PluFinanceDao">
<select id="queryAllByTaskId" resultType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$TaskFinance">
SELECT
task.taskId AS taskDetailId,
task.`name`,
pf.id AS taskFinanceId,
pf.budget,
pf.bonus
FROM
t_plu_finance AS pf
LEFT JOIN (
SELECT
ppt2.task_detail_id AS taskId,
td.`name`,
td.rec_status
FROM
t_pro_parent_task AS ppt2
LEFT JOIN t_pro_task_detail AS td ON td.id = ppt2.task_detail_id
WHERE
ppt2.rec_status = 0
AND ppt2.parent_task_detail_id IN (
SELECT
task_detail_id
FROM
t_pro_parent_task AS ppt1
WHERE
ppt1.parent_task_detail_id = #{projectId}
AND ppt1.rec_status = 0
)
AND td.rec_status = 0
) AS task ON pf.task_id = task.taskId
WHERE
pf.rec_status = 0
AND task.rec_status = 0
AND pf.type = 1
</select>
<select id="queryOfProjectTotal"
resultType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$ProjectFinanceInfo">
SELECT
f.id AS projectFinanceId,
(
f.budget + ifNull(sum(b.add_budget), 0)
) AS budge,
f.bonus
FROM
t_plu_finance f
LEFT JOIN t_plu_finance_append_budget b ON f.id = b.finance_id
AND b.rec_status = 0
WHERE
f.task_id = #{projectId}
AND f.rec_status = 0
AND f.type = 0
GROUP BY
f.id
</select>
<select id="queryByTaskId" resultType="com.ccsens.ptccsens.bean.po.PluFinance">
SELECT
id,
type,
budget,
bonus,
task_id,
operator
FROM
t_plu_finance AS pf
WHERE
pf.rec_status = 0
AND pf.task_id = #{taskDetailId}
</select>
<resultMap id="FinanceOfProject" type="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$FinanceInfo">
<id column="fid" property="fid"/>
<result column="budget" property="budget"/>
<result column="bonus" property="bonus"/>
<result column="taskId" property="taskDetailId"/>
<result column="name" property="taskName"/>
<collection property="appendBudgetList" ofType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$AppendBudget">
<id column="fabId" property="fabId"/>
<result column="addBudget" property="appendBudget"/>
</collection>
<collection property="doctors" ofType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$PassMoney">
<id column="faId" property="faId"/>
<result column="money" property="passMoney"/>
</collection>
</resultMap>
<select id="queryFinanceOfProject" resultMap="FinanceOfProject">
SELECT
pf.id AS fid,
pf.budget,
pf.bonus,
pf.task_id,
td.`name`,
fab.id AS fabId,
fab.add_budget,
fa.money,
fa.finance_id AS faId
FROM
t_plu_finance AS pf
LEFT JOIN t_pro_task_detail As td ON pf.task_id = td.id
LEFT JOIN t_plu_finance_append_budget AS fab ON pf.id = fab.finance_id AND fab.rec_status = 0
LEFT JOIN t_plu_finance_apply AS fa ON pf.id = fa.finance_id AND fa.rec_status = 0 AND fa.apply_type = 5
WHERE
pf.rec_status = 0
AND pf.task_id IN (
SELECT
pt2.task_detail_id
FROM
t_pro_parent_task AS pt2
WHERE
pt2.rec_status = 0
AND pt2.parent_task_detail_id IN (
SELECT
pt1.task_detail_id
FROM
t_pro_parent_task AS pt1
WHERE
pt1.rec_status = 0
AND pt1.parent_task_detail_id = #{projectId}
)
)
AND td.rec_status = 0
</select>
</mapper>

17
src/main/resources/mapper_dao/PluginDao.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.ptccsens.persist.dao.PluginDao">
<select id="queryFinancePlugin" resultType="Integer">
SELECT
COUNT(tp.id)
FROM
t_pro_task_plugin AS tp
WHERE
tp.rec_status = 0
AND tp.`code` = #{code}
AND tp.task_detail_id = #{taskDetailId}
</select>
</mapper>

27
src/main/resources/mapper_raw/ProTaskPluginMapper.xml

@ -13,6 +13,7 @@
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="colspan" jdbcType="INTEGER" property="colspan" />
<result column="rowspan" jdbcType="INTEGER" property="rowspan" />
<result column="code" jdbcType="VARCHAR" property="code" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -74,7 +75,7 @@
</sql>
<sql id="Base_Column_List">
id, param, plgin_row, plgin_col, task_detail_id, plugin_id, created_at, updated_at,
rec_status, colspan, rowspan
rec_status, colspan, rowspan, code
</sql>
<select id="selectByExample" parameterType="com.ccsens.ptccsens.bean.po.ProTaskPluginExample" resultMap="BaseResultMap">
select
@ -110,11 +111,13 @@
insert into t_pro_task_plugin (id, param, plgin_row,
plgin_col, task_detail_id, plugin_id,
created_at, updated_at, rec_status,
colspan, rowspan)
colspan, rowspan, code
)
values (#{id,jdbcType=BIGINT}, #{param,jdbcType=VARCHAR}, #{plginRow,jdbcType=INTEGER},
#{plginCol,jdbcType=INTEGER}, #{taskDetailId,jdbcType=BIGINT}, #{pluginId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{colspan,jdbcType=INTEGER}, #{rowspan,jdbcType=INTEGER})
#{colspan,jdbcType=INTEGER}, #{rowspan,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.ptccsens.bean.po.ProTaskPlugin">
insert into t_pro_task_plugin
@ -152,6 +155,9 @@
<if test="rowspan != null">
rowspan,
</if>
<if test="code != null">
code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -187,6 +193,9 @@
<if test="rowspan != null">
#{rowspan,jdbcType=INTEGER},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.ptccsens.bean.po.ProTaskPluginExample" resultType="java.lang.Long">
@ -231,6 +240,9 @@
<if test="record.rowspan != null">
rowspan = #{record.rowspan,jdbcType=INTEGER},
</if>
<if test="record.code != null">
code = #{record.code,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -248,7 +260,8 @@
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
colspan = #{record.colspan,jdbcType=INTEGER},
rowspan = #{record.rowspan,jdbcType=INTEGER}
rowspan = #{record.rowspan,jdbcType=INTEGER},
code = #{record.code,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -286,6 +299,9 @@
<if test="rowspan != null">
rowspan = #{rowspan,jdbcType=INTEGER},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -300,7 +316,8 @@
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
colspan = #{colspan,jdbcType=INTEGER},
rowspan = #{rowspan,jdbcType=INTEGER}
rowspan = #{rowspan,jdbcType=INTEGER},
code = #{code,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

66
src/main/resources/mbg.xml

@ -56,39 +56,39 @@
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table tableName="t_constant" domainObjectName="Constant"></table>
<table tableName="t_label" domainObjectName="Label"></table>
<table tableName="t_label_business" domainObjectName="LabelBusiness"></table>
<table tableName="t_label_type" domainObjectName="LabelType"></table>
<table tableName="t_plu_finance" domainObjectName="PluFinance"></table>
<table tableName="t_plu_finance_append_budget" domainObjectName="PluFinanceAppendBudget"></table>
<table tableName="t_plu_finance_apply" domainObjectName="PluFinanceApply"></table>
<table tableName="t_plu_finance_check" domainObjectName="PluFinanceCheck"></table>
<table tableName="t_plu_finance_check_log" domainObjectName="PluFinanceCheckLog"></table>
<table tableName="t_plu_finance_invoice" domainObjectName="PluFinanceInvoice"></table>
<table tableName="t_plu_finance_type" domainObjectName="PluFinanceType"></table>
<table tableName="t_pro_member" domainObjectName="ProMember"></table>
<table tableName="t_pro_member_stakeholder" domainObjectName="ProMemberStakeholder"></table>
<table tableName="t_pro_parent_task" domainObjectName="ProParentTask"></table>
<table tableName="t_pro_project_share" domainObjectName="ProProjectShare"></table>
<table tableName="t_pro_role" domainObjectName="ProRole"></table>
<table tableName="t_pro_role_member" domainObjectName="ProRoleMember"></table>
<table tableName="t_pro_role_repulsion" domainObjectName="ProRoleRepulsion"></table>
<table tableName="t_pro_role_show" domainObjectName="ProRoleShow"></table>
<table tableName="t_pro_role_task" domainObjectName="ProRoleTask"></table>
<table tableName="t_pro_share_member" domainObjectName="ProShareMember"></table>
<table tableName="t_pro_task_detail" domainObjectName="ProTaskDetail"></table>
<table tableName="t_pro_task_flow" domainObjectName="ProTaskFlow"></table>
<table tableName="t_pro_task_notify" domainObjectName="ProTaskNotify"></table>
<table tableName="t_pro_task_panel_info" domainObjectName="ProTaskPanelInfo"></table>
<table tableName="t_pro_task_plugin" domainObjectName="ProTaskPlugin"></table>
<table tableName="t_pro_task_process" domainObjectName="ProTaskProcess"></table>
<table tableName="t_pro_task_share" domainObjectName="ProTaskShare"></table>
<table tableName="t_pro_task_status_record" domainObjectName="ProTaskStatusRecord"></table>
<table tableName="t_pro_task_sub" domainObjectName="ProTaskSub"></table>
<table tableName="t_pro_task_version" domainObjectName="ProTaskVersion"></table>
<table tableName="t_sys_log" domainObjectName="SysLog"></table>
<!-- <table tableName="t_constant" domainObjectName="Constant"></table>-->
<!-- <table tableName="t_label" domainObjectName="Label"></table>-->
<!-- <table tableName="t_label_business" domainObjectName="LabelBusiness"></table>-->
<!-- <table tableName="t_label_type" domainObjectName="LabelType"></table>-->
<!-- <table tableName="t_plu_finance" domainObjectName="PluFinance"></table>-->
<!-- <table tableName="t_plu_finance_append_budget" domainObjectName="PluFinanceAppendBudget"></table>-->
<!-- <table tableName="t_plu_finance_apply" domainObjectName="PluFinanceApply"></table>-->
<!-- <table tableName="t_plu_finance_check" domainObjectName="PluFinanceCheck"></table>-->
<!-- <table tableName="t_plu_finance_check_log" domainObjectName="PluFinanceCheckLog"></table>-->
<!-- <table tableName="t_plu_finance_invoice" domainObjectName="PluFinanceInvoice"></table>-->
<!-- <table tableName="t_plu_finance_type" domainObjectName="PluFinanceType"></table>-->
<!-- -->
<!-- <table tableName="t_pro_member" domainObjectName="ProMember"></table>-->
<!-- <table tableName="t_pro_member_stakeholder" domainObjectName="ProMemberStakeholder"></table>-->
<!-- <table tableName="t_pro_parent_task" domainObjectName="ProParentTask"></table>-->
<!-- <table tableName="t_pro_project_share" domainObjectName="ProProjectShare"></table>-->
<!-- <table tableName="t_pro_role" domainObjectName="ProRole"></table>-->
<!-- <table tableName="t_pro_role_member" domainObjectName="ProRoleMember"></table>-->
<!-- <table tableName="t_pro_role_repulsion" domainObjectName="ProRoleRepulsion"></table>-->
<!-- <table tableName="t_pro_role_show" domainObjectName="ProRoleShow"></table>-->
<!-- <table tableName="t_pro_role_task" domainObjectName="ProRoleTask"></table>-->
<!-- <table tableName="t_pro_share_member" domainObjectName="ProShareMember"></table>-->
<!-- <table tableName="t_pro_task_detail" domainObjectName="ProTaskDetail"></table>-->
<!-- <table tableName="t_pro_task_flow" domainObjectName="ProTaskFlow"></table>-->
<!-- <table tableName="t_pro_task_notify" domainObjectName="ProTaskNotify"></table>-->
<!-- <table tableName="t_pro_task_panel_info" domainObjectName="ProTaskPanelInfo"></table>-->
<table tableName="t_pro_task_plugin" domainObjectName="ProTaskPlugin"> </table>
<!-- <table tableName="t_pro_task_process" domainObjectName="ProTaskProcess"></table>-->
<!-- <table tableName="t_pro_task_share" domainObjectName="ProTaskShare"></table>-->
<!-- <table tableName="t_pro_task_status_record" domainObjectName="ProTaskStatusRecord"></table>-->
<!-- <table tableName="t_pro_task_sub" domainObjectName="ProTaskSub"></table>-->
<!-- <table tableName="t_pro_task_version" domainObjectName="ProTaskVersion"></table>-->
<!-- <table tableName="t_sys_log" domainObjectName="SysLog"></table>-->

Loading…
Cancel
Save