Browse Source

20220125引入sdk

ptos
zy_Java 4 years ago
parent
commit
bea2911258
  1. 6
      src/main/java/com/ccsens/ptccsens/api/finance/FinanceController.java
  2. 6
      src/main/java/com/ccsens/ptccsens/bean/dto/FinanceDto.java
  3. 4
      src/main/java/com/ccsens/ptccsens/bean/vo/FinanceVo.java
  4. 4
      src/main/java/com/ccsens/ptccsens/bean/vo/ProjectFinanceVo.java
  5. 19
      src/main/java/com/ccsens/ptccsens/service/FinanceService.java
  6. 25
      src/main/java/com/ccsens/ptccsens/service/ProjectFinanceService.java
  7. 2
      src/main/java/com/ccsens/ptccsens/util/BasicsCodeError.java
  8. 2
      src/main/java/com/ccsens/ptccsens/util/BasicsConstant.java
  9. 2
      src/main/resources/mapper_dao/FinanceDao.xml
  10. 6
      src/main/resources/mapper_dao/PluFinanceDao.xml

6
src/main/java/com/ccsens/ptccsens/api/finance/FinanceController.java

@ -42,6 +42,7 @@ public class FinanceController {
log.info("通过任务id查看任务关联的财务信息结束:{}", item);
return JsonResponse.newInstance().ok(item);
}
@MustLogin
@ApiOperation(value = "查询费用申请类型", notes = "")
@RequestMapping(value = "/queryType", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<FinanceVo.Type> queryType(@ApiParam @Validated @RequestBody QueryDto<FinanceDto.Type> params) {
@ -50,7 +51,7 @@ public class FinanceController {
log.info("查询数据类型结束:{}", types);
return JsonResponse.newInstance().ok(types);
}
@MustLogin
@ApiOperation(value = "发起申请", notes = "")
@RequestMapping(value = "/apply", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse apply(@ApiParam @Validated @RequestBody QueryDto<FinanceDto.Apply> params) {
@ -59,6 +60,7 @@ public class FinanceController {
log.info("发起申请结束");
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "查询申请详情", notes = "")
@RequestMapping(value = "/getApplyDetail", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<FinanceVo.ApplyDetail> getApplyDetail(@ApiParam @Validated @RequestBody QueryDto<FinanceDto.ApplyId> params) {
@ -67,7 +69,7 @@ public class FinanceController {
log.info("查询申请详情结束:{}", detail);
return JsonResponse.newInstance().ok(detail);
}
@MustLogin
@ApiOperation(value = "审批", notes = "")
@RequestMapping(value = "/audit", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse audit(@ApiParam @Validated @RequestBody QueryDto<FinanceDto.Audit> params) {

6
src/main/java/com/ccsens/ptccsens/bean/dto/FinanceDto.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;
@ -105,7 +107,9 @@ public class FinanceDto {
@ApiModelProperty("审核id")
private Long financeCheckId;
@NotNull
@ApiModelProperty("审核状态 0待审核 1已通过 2驳回")
@Min(value = 1)
@Max(value = 2)
@ApiModelProperty("审核状态 1已通过 2驳回")
private Byte checkStatus;
@ApiModelProperty("备注")
private String remark;

4
src/main/java/com/ccsens/ptccsens/bean/vo/FinanceVo.java

@ -108,9 +108,9 @@ public class FinanceVo {
@ApiModelProperty("检查状态, 0待审核 1已通过 2驳回")
private Byte checkStatus;
@ApiModelProperty("检查的时间")
private Byte time;
private Long time;
@ApiModelProperty("备注")
private Byte remark;
private String remark;
}
@Data

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

@ -53,12 +53,12 @@ public class ProjectFinanceVo {
private Long submitTime;
@ApiModelProperty("审查人和当前记录的关联id")
private Long financeCheckId;
@ApiModelProperty("当前状态")
@ApiModelProperty("当前状态(0未审核 1已通过 2驳回)")
private Byte applyType;
}
@Data
@ApiModel("查看自己需要审批的申请-返参")
@ApiModel("查看项目下的财务信息-返参")
public static class FinanceOfProject {
@ApiModelProperty("任务id")
private Long taskDetailId;

19
src/main/java/com/ccsens/ptccsens/service/FinanceService.java

@ -41,7 +41,8 @@ public class FinanceService implements IFinanceService {
private PluFinanceCheckMapper pluFinanceCheckMapper;
@Resource
private PluFinanceCheckLogMapper pluFinanceCheckLogMapper;
@Resource
private PluFinanceMapper pluFinanceMapper;
@ -85,6 +86,15 @@ public class FinanceService implements IFinanceService {
if (CollectionUtil.isEmpty(proMembers)) {
throw new BaseException(BasicsCodeError.NOT_MEMBER_SHEET);
}
// 查找对应的预算信息
PluFinanceExample financeExample = new PluFinanceExample();
financeExample.createCriteria().andTaskIdEqualTo(param.getTaskDetailId());
financeExample.setOrderByClause("id desc limit 1");
List<PluFinance> pluFinances = pluFinanceMapper.selectByExample(financeExample);
log.info("财务预算信息:{}", pluFinances);
if (CollectionUtil.isEmpty(pluFinances)) {
throw new BaseException(BasicsCodeError.FINANCE_NOT_FOUND);
}
// 计算总金额和发票金额是否一致
if (CollectionUtil.isNotEmpty(param.getInvoiceList())) {
long invoiceTotal = 0L;
@ -100,6 +110,10 @@ public class FinanceService implements IFinanceService {
BeanUtils.copyProperties(param, apply);
apply.setId(snowflake.nextId());
apply.setMemberId(proMembers.get(0).getId());
apply.setTaskId(param.getTaskDetailId());
apply.setFinanceId(pluFinances.get(0).getId());
apply.setApplyTime(System.currentTimeMillis());
apply.setInvoice(CollectionUtil.isEmpty(param.getInvoiceList()) ? BasicsConstant.Finance.INVOICE_UPLOAD_NO : BasicsConstant.Finance.INVOICE_UPLOAD_YES);
pluFinanceApplyMapper.insertSelective(apply);
if (CollectionUtil.isNotEmpty(param.getInvoiceList())) {
List<PluFinanceInvoice> invoices = new ArrayList<>();
@ -153,8 +167,7 @@ public class FinanceService implements IFinanceService {
}
// 判断是否已经审核过
PluFinanceCheckLogExample logExample = new PluFinanceCheckLogExample();
logExample.createCriteria().andCheckIdEqualTo(param.getFinanceCheckId())
.andCheckIdEqualTo(check.getCheckerId());
logExample.createCriteria().andCheckIdEqualTo(param.getFinanceCheckId());
long l = pluFinanceCheckLogMapper.countByExample(logExample);
log.info("{}关于{}的审核数:{}", check.getCheckerId(), check.getId(), l);
if (l > 0) {

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

@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
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.ProTaskDetail;
import com.ccsens.ptccsens.bean.po.ProTaskPlugin;
import com.ccsens.ptccsens.bean.vo.ProjectFinanceVo;
import com.ccsens.ptccsens.persist.dao.ProMemberDao;
@ -59,9 +60,14 @@ public class ProjectFinanceService implements IProjectFinanceService{
List<ProjectFinanceVo.TaskFinance> taskFinanceList = pluFinanceDao.queryAllByTaskId(param.getProjectId());
log.info("项目下的所有任务财务信息:{}",taskFinanceList);
//查询项目下的总计
projectFinanceInfo = pluFinanceDao.queryOfProjectTotal(param.getProjectId());
log.info("项目的总计预算与奖金:{}",projectFinanceInfo);
// projectFinanceInfo = pluFinanceDao.queryOfProjectTotal(param.getProjectId());
// log.info("项目的总计预算与奖金:{}",projectFinanceInfo);
if (CollectionUtil.isNotEmpty(taskFinanceList)) {
//计算预算与奖金总计
long budgetSum = taskFinanceList.stream().mapToLong(ProjectFinanceVo.TaskFinance::getBudget).sum();
projectFinanceInfo.setBudget(budgetSum);
long bonusSum = taskFinanceList.stream().mapToLong(ProjectFinanceVo.TaskFinance::getBonus).sum();
projectFinanceInfo.setBonus(bonusSum);
projectFinanceInfo.setTaskFinanceList(new PageInfo<ProjectFinanceVo.TaskFinance>(taskFinanceList));
}
return projectFinanceInfo;
@ -69,6 +75,10 @@ public class ProjectFinanceService implements IProjectFinanceService{
@Override
public void updateFinance(ProjectFinanceDto.UpdateFinance param, Long userId) {
ProTaskDetail proTaskDetail = proTaskDetailDao.selectByPrimaryKey(param.getTaskDetailId());
if (ObjectUtil.isNull(proTaskDetail)) {
throw new BaseException(BasicsCodeError.TASK_DONT_EXIT);
}
//如果任务没有关联财务条插件,则自动关联财务条插件
//TODO 根据插件code查询是否存在, code暂时写死
Integer num = pluginDao.queryFinancePlugin(param.getTaskDetailId(), "MP-TALL财务条");
@ -92,14 +102,15 @@ public class ProjectFinanceService implements IProjectFinanceService{
//a.如果存在,直接修改预算或奖金
if (ObjectUtil.isNotNull(pluFinance)) {
PluFinance updatePluFinance = new PluFinance();
updatePluFinance.setId(param.getTaskDetailId());
updatePluFinance.setId(param.getTaskFinanceId());
if (ObjectUtil.isNotNull(param.getBonus()) && 0 != param.getBonus()) {
updatePluFinance.setBonus(param.getBonus());
pluFinanceDao.updateByPrimaryKeySelective(updatePluFinance);
}
if (ObjectUtil.isNotNull(param.getBudget()) && 0!= param.getBudget()) {
updatePluFinance.setBudget(param.getBudget());
pluFinanceDao.updateByPrimaryKeySelective(updatePluFinance);
}
pluFinanceDao.updateByPrimaryKeySelective(updatePluFinance);
return;
}
//b.如果不存在,根据任务id新建一个财务信息
@ -133,7 +144,10 @@ public class ProjectFinanceService implements IProjectFinanceService{
List<ProjectFinanceVo.NeedCheckByMe> needCheckByMeList = pluFinanceApplyDao.queryNeedCheckByMeOfTask(param.getTaskDetailId(),userId,projectId);
return new PageInfo<>(needCheckByMeList);
}
return null;
List<ProjectFinanceVo.NeedCheckByMe> needCheckByMeList = new ArrayList<>();
ProjectFinanceVo.NeedCheckByMe needCheckByMe = new ProjectFinanceVo.NeedCheckByMe();
needCheckByMeList.add(needCheckByMe);
return new PageInfo<ProjectFinanceVo.NeedCheckByMe>(needCheckByMeList);
}
@ -178,6 +192,7 @@ public class ProjectFinanceService implements IProjectFinanceService{
Long userOfMemberId = memberDao.findUserOfMemberId(param.getProjectId(), userId);
appendBudget.setMemberId(userOfMemberId);
appendBudget.setOperator(userId);
appendBudget.setAddBudget(param.getAppendBudget());
appendBudgetMapper.insertSelective(appendBudget);
}
}

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

@ -39,6 +39,8 @@ public class BasicsCodeError extends CodeError {
public static final Code TOTAL_MONEY_ERROR = new Code(526,"申请总金额和发票总金额不一致,请检查修改后重新提交。", true);
public static final Code CHECK_NOT_FOUND = new Code(527,"没有找到对应的审核记录,请确认后重新提交。", true);
public static final Code CHECK_EXISTED = new Code(528,"您已经提交过审核结果了,无需重复提交。", true);
public static final Code TASK_DONT_EXIT = new Code(530,"任务不存在请检查后重试", true);
public static final Code FINANCE_NOT_FOUND = new Code(529,"没有找到任务对应的财务预算信息,请修改后重新提交申请。", true);
public static final Code NOT_PERMISSION = new Code(529,"没有权限!", true);
public static final Code ROLE_ERROR = new Code(530,"角色信息错误!", true);

2
src/main/java/com/ccsens/ptccsens/util/BasicsConstant.java

@ -49,5 +49,7 @@ public class BasicsConstant {
public static class Finance{
public static final byte AUDIT_PASS = 1;
public static final byte AUDIT_FAIL = 2;
public static final byte INVOICE_UPLOAD_NO = 0;
public static final byte INVOICE_UPLOAD_YES = 1;
}
}

2
src/main/resources/mapper_dao/FinanceDao.xml

@ -12,7 +12,7 @@
<insert id="batchSaveCheck">
insert into t_plu_finance_check(id, finance_apply_id,checker_id,operator) values
<foreach collection="checks" item="item" separator=",">
(#{id}, #{item.financeApplyId},#{item.checkerId},#{item.operator})
(#{item.id}, #{item.financeApplyId},#{item.checkerId},#{item.operator})
</foreach>
</insert>

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

@ -84,7 +84,7 @@
<id column="fabId" property="fabId"/>
<result column="addBudget" property="appendBudget"/>
</collection>
<collection property="doctors" ofType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$PassMoney">
<collection property="passMoneyList" ofType="com.ccsens.ptccsens.bean.vo.ProjectFinanceVo$PassMoney">
<id column="faId" property="faId"/>
<result column="money" property="passMoney"/>
</collection>
@ -94,10 +94,10 @@
pf.id AS fid,
pf.budget,
pf.bonus,
pf.task_id,
pf.task_id AS taskId,
td.`name`,
fab.id AS fabId,
fab.add_budget,
fab.add_budget AS addBudget,
fa.money,
fa.finance_id AS faId
FROM

Loading…
Cancel
Save