19 changed files with 320 additions and 30 deletions
@ -0,0 +1,77 @@ |
|||||
|
package com.qs.serve.modules.tbs.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.annotation.SysLog; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.model.enums.BizType; |
||||
|
import com.qs.serve.common.model.enums.SystemModule; |
||||
|
import com.qs.serve.common.util.PageUtil; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetChangeConditionService; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetChangeScheduleItemService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetChangeService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 预算 预算更变记录 |
||||
|
* @author YenHex |
||||
|
* @since 2023-08-09 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("tbs/budgetChange") |
||||
|
public class TbsBudgetChangeController { |
||||
|
|
||||
|
private TbsBudgetChangeService tbsBudgetChangeService; |
||||
|
private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService; |
||||
|
private TbsBudgetChangeConditionService tbsBudgetChangeConditionService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R<List<TbsBudgetChange>> getList(TbsBudgetChange param){ |
||||
|
if(param.getBudgetId()==null){ |
||||
|
return R.error("BudgetId不能为空"); |
||||
|
} |
||||
|
LambdaQueryWrapper<TbsBudgetChange> lqw = new LambdaQueryWrapper<>(param); |
||||
|
List<TbsBudgetChange> list = tbsBudgetChangeService.list(lqw); |
||||
|
for (TbsBudgetChange budgetChange : list) { |
||||
|
List<TbsBudgetChangeScheduleItem> changeScheduleItemList = tbsBudgetChangeScheduleItemService.listByChangeId(budgetChange.getId()); |
||||
|
List<TbsBudgetChangeCondition> changeConditionList = tbsBudgetChangeConditionService.listByChangeId(budgetChange.getId()); |
||||
|
budgetChange.setChangeScheduleItemList(changeScheduleItemList); |
||||
|
budgetChange.setChangeConditionList(changeConditionList); |
||||
|
} |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/page")
|
||||
|
public R<PageVo<TbsBudgetChange>> getPage(TbsBudgetChange param){ |
||||
|
LambdaQueryWrapper<TbsBudgetChange> lqw = new LambdaQueryWrapper<>(param); |
||||
|
PageUtil.startPage(); |
||||
|
List<TbsBudgetChange> list = tbsBudgetChangeService.list(lqw); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,81 @@ |
|||||
|
package com.qs.serve.modules.tbs.service.impl; |
||||
|
|
||||
|
import com.qs.serve.common.framework.manager.AsyncFactory; |
||||
|
import com.qs.serve.common.framework.manager.AsyncManager; |
||||
|
import com.qs.serve.common.util.Assert; |
||||
|
import com.qs.serve.modules.seeyon.service.SeeYonOperationService; |
||||
|
import com.qs.serve.modules.tbs.common.TbsBudgetCheckState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudget; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; |
||||
|
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeMapper; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 预算改动的申请 |
||||
|
* @author YenHex |
||||
|
* @since 2023/8/8 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationService { |
||||
|
|
||||
|
private TbsBudgetChangeMapper budgetChangeMapper; |
||||
|
|
||||
|
@Override |
||||
|
public void doCommitBacked(String targetId) { |
||||
|
AsyncManager.me().execute(AsyncFactory.submitBudgetChange(targetId)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getSyFormIdByTargetInfo(TbsAffairCommitBo affairCommit) { |
||||
|
TbsBudgetChange budgetChange = budgetChangeMapper.selectById(affairCommit.getTargetId()); |
||||
|
if(!budgetChange.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
||||
|
Assert.throwEx("操作失败,预算处于非审批状态"); |
||||
|
} |
||||
|
return budgetChange.getSyFormId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doBacked(TbsAffairCommitBo param) { |
||||
|
TbsBudgetChange budgetChange = budgetChangeMapper.selectById(param.getTargetId()); |
||||
|
if(budgetChange.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
||||
|
budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_3_setback); |
||||
|
budgetChangeMapper.updateById(budgetChange); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doFinished(TbsAffairCommitBo param) { |
||||
|
TbsBudgetChange budgetChange = budgetChangeMapper.selectById(param.getTargetId()); |
||||
|
if(budgetChange.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
||||
|
budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_2_finished); |
||||
|
budgetChangeMapper.updateById(budgetChange); |
||||
|
} |
||||
|
//TODO 更新到主表
|
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doRefuse(TbsAffairCommitBo param) { |
||||
|
TbsBudgetChange budgetChange = budgetChangeMapper.selectById(param.getTargetId()); |
||||
|
if(budgetChange.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){ |
||||
|
budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_4_stop); |
||||
|
budgetChangeMapper.updateById(budgetChange); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTemplateCode() { |
||||
|
return TbsSeeYonConst.BudgetApplyConf.Code(); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue