Browse Source

预算审批功能补充

v1.0
Yen 2 years ago
parent
commit
8eb021f329
  1. 1
      src/main/java/com/qs/serve/common/model/enums/SystemModule.java
  2. 37
      src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetChangeController.java
  3. 8
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  4. 1
      src/main/java/com/qs/serve/modules/tbs/controller/TbsScheduleItemBudgetController.java
  5. 4
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChange.java
  6. 2
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChangeCondition.java
  7. 2
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetCondition.java
  8. 1
      src/main/java/com/qs/serve/modules/tbs/entity/TbsScheduleItemBudget.java
  9. 1
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeOperationServiceImpl.java
  10. 6
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeServiceImpl.java
  11. 12
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java
  12. 2
      src/main/resources/mapper/tbs/TbsBudgetChangeMapper.xml

1
src/main/java/com/qs/serve/common/model/enums/SystemModule.java

@ -23,6 +23,7 @@ public enum SystemModule {
SYSTEM("sys","系统"), SYSTEM("sys","系统"),
UMS("ums","手机用户"), UMS("ums","手机用户"),
DATA("data","数据"), DATA("data","数据"),
Excel("excel","excel数据"),
Tag("tag","标签"); Tag("tag","标签");
String code; String code;

37
src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetChangeController.java

@ -11,19 +11,14 @@ import com.qs.serve.common.util.PageUtil;
import com.qs.serve.common.util.CopierUtil; import com.qs.serve.common.util.CopierUtil;
import com.qs.serve.common.util.StringUtils; import com.qs.serve.common.util.StringUtils;
import com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo; import com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo;
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition; import com.qs.serve.modules.tbs.entity.*;
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem;
import com.qs.serve.modules.tbs.entity.so.TbsBudgetChangeSo; import com.qs.serve.modules.tbs.entity.so.TbsBudgetChangeSo;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeConditionService; import com.qs.serve.modules.tbs.service.*;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeScheduleItemService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; 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 javax.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -43,6 +38,9 @@ public class TbsBudgetChangeController {
private TbsBudgetChangeService tbsBudgetChangeService; private TbsBudgetChangeService tbsBudgetChangeService;
private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService; private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService;
private TbsBudgetChangeConditionService tbsBudgetChangeConditionService; private TbsBudgetChangeConditionService tbsBudgetChangeConditionService;
private TbsBudgetService tbsBudgetService;
private TbsScheduleItemBudgetService tbsScheduleItemBudgetService;
private TbsBudgetConditionService tbsBudgetConditionService;
/** /**
* 预算审批整合翻页 * 预算审批整合翻页
@ -78,6 +76,31 @@ public class TbsBudgetChangeController {
return R.ok(budgetChange); return R.ok(budgetChange);
} }
/**
* budgetId查询
* @param id
* @return
*/
@GetMapping("/apply/{id}")
public R<TbsBudgetChange> getApplyBudget(@PathVariable("id")Long id ){
TbsBudget budget = tbsBudgetService.getById(id);
LambdaQueryWrapper<TbsBudgetCondition> conditionLqw = new LambdaQueryWrapper<>();
conditionLqw.eq(TbsBudgetCondition::getBudgetId,id);
conditionLqw.isNull(TbsBudgetCondition::getChangeId);
List<TbsBudgetCondition> conditions = tbsBudgetConditionService.list(conditionLqw);
LambdaQueryWrapper<TbsScheduleItemBudget> schItemBudgetLqw = new LambdaQueryWrapper<>();
schItemBudgetLqw.eq(TbsScheduleItemBudget::getBudgetId,id);
List<TbsScheduleItemBudget> scheduleItemBudgetList = tbsScheduleItemBudgetService.list(schItemBudgetLqw);
TbsBudgetChange budgetChange = TbsBudgetChange.toNewObject(budget);
List<TbsBudgetChangeCondition> budgetChangeConditions = conditions.stream()
.map(TbsBudgetChangeCondition::toNewObject).collect(Collectors.toList());
List<TbsBudgetChangeScheduleItem> budgetChangeScheduleItemList = scheduleItemBudgetList.stream()
.map(TbsBudgetChangeScheduleItem::toNewObject).collect(Collectors.toList());
budgetChange.setChangeScheduleItemList(budgetChangeScheduleItemList);
budgetChange.setChangeConditionList(budgetChangeConditions);
return R.ok(budgetChange);
}
/** /**
* 列表 * 列表
* @param param * @param param

8
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java

@ -215,8 +215,16 @@ public class TbsCostApplyController {
@GetMapping("/getById/{id}") @GetMapping("/getById/{id}")
@SysLog(module = SystemModule.Budget, title = "费用申请", biz = BizType.QUERY) @SysLog(module = SystemModule.Budget, title = "费用申请", biz = BizType.QUERY)
@PreAuthorize("hasRole('tbs:costApply:query')") @PreAuthorize("hasRole('tbs:costApply:query')")
@Transactional(rollbackFor = Exception.class)
public R<TbsCostApply> getById(@PathVariable("id") String id){ public R<TbsCostApply> getById(@PathVariable("id") String id){
TbsCostApply tbsCostApply = tbsCostApplyService.getById(id); TbsCostApply tbsCostApply = tbsCostApplyService.getById(id);
if(tbsCostApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())){
try {
tbsCostApplyOperationServiceImpl.runCompensate(id);
} catch (Exception e) {
e.printStackTrace();
}
}
TbsCostContract contract = costContractService.getByCostApplyId(tbsCostApply.getId()); TbsCostContract contract = costContractService.getByCostApplyId(tbsCostApply.getId());
tbsCostApply.setContractInfo(contract); tbsCostApply.setContractInfo(contract);
return R.ok(tbsCostApply); return R.ok(tbsCostApply);

1
src/main/java/com/qs/serve/modules/tbs/controller/TbsScheduleItemBudgetController.java

@ -102,6 +102,7 @@ public class TbsScheduleItemBudgetController {
@SysLog(module = SystemModule.Budget, title = "预算考核期项", biz = BizType.INSERT) @SysLog(module = SystemModule.Budget, title = "预算考核期项", biz = BizType.INSERT)
@PreAuthorize("hasRole('tbs:schedule:insert')") @PreAuthorize("hasRole('tbs:schedule:insert')")
public R<?> save(@RequestBody @Valid TbsScheduleItemBudget param){ public R<?> save(@RequestBody @Valid TbsScheduleItemBudget param){
param.setPreDispatchAmountFirst(param.getPreDispatchAmount());
TbsScheduleItemBudget entity = CopierUtil.copy(param,new TbsScheduleItemBudget()); TbsScheduleItemBudget entity = CopierUtil.copy(param,new TbsScheduleItemBudget());
boolean result = tbsScheduleItemBudgetService.save(entity); boolean result = tbsScheduleItemBudgetService.save(entity);
return R.isTrue(result); return R.isTrue(result);

4
src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChange.java

@ -170,10 +170,10 @@ public class TbsBudgetChange implements Serializable {
public static TbsBudgetChange toNewObject(TbsBudget source){ public static TbsBudgetChange toNewObject(TbsBudget source){
TbsBudgetChange budgetChange = new TbsBudgetChange(); TbsBudgetChange budgetChange = new TbsBudgetChange();
budgetChange.setId(source.getId()); //budgetChange.setId(source.getId());
budgetChange.setBudgetId(source.getId()); budgetChange.setBudgetId(source.getId());
//budgetChange.setChangeCode(source.getChangeCode()); //budgetChange.setChangeCode(source.getChangeCode());
//budgetChange.setBudgetTitle(source.getBudgetTitle()); budgetChange.setBudgetTitle(source.getBudgetCode());
budgetChange.setBudgetNumber(source.getBudgetNumber()); budgetChange.setBudgetNumber(source.getBudgetNumber());
budgetChange.setBudgetCheckState(source.getBudgetCheckState()); budgetChange.setBudgetCheckState(source.getBudgetCheckState());
budgetChange.setSubjectId(source.getSubjectId()); budgetChange.setSubjectId(source.getSubjectId());

2
src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChangeCondition.java

@ -106,7 +106,7 @@ public class TbsBudgetChangeCondition implements Serializable {
public static TbsBudgetChangeCondition toNewObject(TbsBudgetCondition source){ public static TbsBudgetChangeCondition toNewObject(TbsBudgetCondition source){
TbsBudgetChangeCondition budgetChangeCondition = new TbsBudgetChangeCondition(); TbsBudgetChangeCondition budgetChangeCondition = new TbsBudgetChangeCondition();
budgetChangeCondition.setId(source.getId()); //budgetChangeCondition.setId(source.getId());
//budgetChangeCondition.setChangeId(source.getChangeId()); //budgetChangeCondition.setChangeId(source.getChangeId());
budgetChangeCondition.setBudgetId(source.getBudgetId()); budgetChangeCondition.setBudgetId(source.getBudgetId());
budgetChangeCondition.setTargetType(source.getTargetType()); budgetChangeCondition.setTargetType(source.getTargetType());

2
src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetCondition.java

@ -35,6 +35,8 @@ public class TbsBudgetCondition implements Serializable {
@NotNull(message = "预算id不能为空") @NotNull(message = "预算id不能为空")
private Long budgetId; private Long budgetId;
private Long changeId;
/** 目标类型(brand、category、series、spu、sku) */ /** 目标类型(brand、category、series、spu、sku) */
@NotBlank(message = "目标类型(brand、category、series、spu、sku)不能为空") @NotBlank(message = "目标类型(brand、category、series、spu、sku)不能为空")
@Length(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字") @Length(max = 30,message = "目标类型(brand、category、series、spu、sku)长度不能超过30字")

1
src/main/java/com/qs/serve/modules/tbs/entity/TbsScheduleItemBudget.java

@ -70,6 +70,7 @@ public class TbsScheduleItemBudget implements Serializable {
@NotNull(message = "预估发货金额") @NotNull(message = "预估发货金额")
private BigDecimal preDispatchAmount; private BigDecimal preDispatchAmount;
private BigDecimal preDispatchAmountFirst;
/** 备注 */ /** 备注 */
@Length(max = 255,message = "备注长度不能超过255字") @Length(max = 255,message = "备注长度不能超过255字")

1
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeOperationServiceImpl.java

@ -88,6 +88,7 @@ public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationServi
List<TbsBudgetCondition> budgetConditionList = new ArrayList<>(); List<TbsBudgetCondition> budgetConditionList = new ArrayList<>();
for (TbsBudgetChangeCondition changeCondition : changeConditionList) { for (TbsBudgetChangeCondition changeCondition : changeConditionList) {
TbsBudgetCondition budgetCondition = TbsBudgetCondition.toNewObject(changeCondition); TbsBudgetCondition budgetCondition = TbsBudgetCondition.toNewObject(changeCondition);
budgetCondition.setChangeId(budgetChange.getId());
budgetConditionList.add(budgetCondition); budgetConditionList.add(budgetCondition);
} }
if(CollectionUtil.isNotEmpty(budgetConditionList)){ if(CollectionUtil.isNotEmpty(budgetConditionList)){

6
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeServiceImpl.java

@ -27,6 +27,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeService; import com.qs.serve.modules.tbs.service.TbsBudgetChangeService;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -67,11 +68,13 @@ public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMappe
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param) { public TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param) {
seeYonService.testConnection(); seeYonService.testConnection();
TbsBudget budget = tbsBudgetMapper.selectById(param.getId()); TbsBudget budget = tbsBudgetMapper.selectById(param.getId());
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId());
TbsBudgetChange budgetChange = buildBudgetChange(param, budget,sysUser);
TbsBudgetChange budgetChange = this.buildBudgetChange(param, budget,sysUser);
String templateCode = TbsSeeYonConst.BudgetChangeConf.Code(); String templateCode = TbsSeeYonConst.BudgetChangeConf.Code();
Map<String,Object> data = new HashMap<>(); Map<String,Object> data = new HashMap<>();
data.put("exsp5", budgetChange.getChangeCode()); data.put("exsp5", budgetChange.getChangeCode());
@ -132,6 +135,7 @@ public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMappe
budgetChange.setUserId(sysUser.getId()); budgetChange.setUserId(sysUser.getId());
budgetChange.setUserCode(sysUser.getCode()); budgetChange.setUserCode(sysUser.getCode());
budgetChange.setUserName(sysUser.getName()); budgetChange.setUserName(sysUser.getName());
budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_1_apply);
boolean notChangeTitle = param.getBudgetCode()!=null&& param.getBudgetCode().equals(budget.getBudgetCode()); boolean notChangeTitle = param.getBudgetCode()!=null&& param.getBudgetCode().equals(budget.getBudgetCode());
if(!notChangeTitle){ if(!notChangeTitle){
budgetChange.setNewBudgetTitle(param.getBudgetCode()); budgetChange.setNewBudgetTitle(param.getBudgetCode());

12
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java

@ -38,6 +38,7 @@ import com.qs.serve.modules.tbs.entity.bo.TbsBudgetExcelBo;
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetMoveAmountBo; import com.qs.serve.modules.tbs.entity.bo.TbsBudgetMoveAmountBo;
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetUpdateAfterStartBo; import com.qs.serve.modules.tbs.entity.bo.TbsBudgetUpdateAfterStartBo;
import com.qs.serve.modules.tbs.entity.vo.TbsBudgetVo; import com.qs.serve.modules.tbs.entity.vo.TbsBudgetVo;
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeMapper;
import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper; import com.qs.serve.modules.tbs.mapper.TbsBudgetMapper;
import com.qs.serve.modules.tbs.service.*; import com.qs.serve.modules.tbs.service.*;
import com.qs.serve.modules.tzc.entity.TzcPolicyItem; import com.qs.serve.modules.tzc.entity.TzcPolicyItem;
@ -68,6 +69,7 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
private final BmsSubjectService subjectService; private final BmsSubjectService subjectService;
private final TbsScheduleService scheduleService; private final TbsScheduleService scheduleService;
private final TbsBudgetConditionService budgetConditionService; private final TbsBudgetConditionService budgetConditionService;
private final TbsBudgetChangeMapper tbsBudgetChangeMapper;
private final TbsBudgetLogService budgetLogService; private final TbsBudgetLogService budgetLogService;
private final TbsScheduleItemBudgetService scheduleItemBudgetService; private final TbsScheduleItemBudgetService scheduleItemBudgetService;
private final TbsScheduleItemService scheduleItemService; private final TbsScheduleItemService scheduleItemService;
@ -516,6 +518,16 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
List<SysAttach> attachList = attachService.listByIds(attachIds); List<SysAttach> attachList = attachService.listByIds(attachIds);
budgetVo.setAttachList(attachList); budgetVo.setAttachList(attachList);
} }
//有更变时,修改为审批状态
if(budgetVo.getBudgetState().equals(1)&&!budgetVo.getBudgetCheckState().equals(TbsBudgetCheckState.State_1_apply)){
LambdaQueryWrapper<TbsBudgetChange> change_lqw = new LambdaQueryWrapper<>();
change_lqw.eq(TbsBudgetChange::getBudgetId,budgetVo.getId());
change_lqw.eq(TbsBudgetChange::getBudgetCheckState,TbsBudgetCheckState.State_1_apply);
long count = tbsBudgetChangeMapper.selectCount(change_lqw);
if(count>0){
budgetVo.setBudgetCheckState(TbsBudgetCheckState.State_1_apply);
}
}
return budgetVo; return budgetVo;
} }

2
src/main/resources/mapper/tbs/TbsBudgetChangeMapper.xml

@ -56,6 +56,7 @@
tbs_budget.`remark` tbs_budget.`remark`
from tbs_budget from tbs_budget
where tbs_budget.del_flag = 0 and `tbs_budget`.`budget_check_state` != 0 where tbs_budget.del_flag = 0 and `tbs_budget`.`budget_check_state` != 0
<if test="query.budgetId != null"> and `tbs_budget`.`id` = #{query.budgetId}</if>
<if test="query.title != null and query.title != ''"> and `tbs_budget`.`budget_code` like concat('%',#{query.title},'%') </if> <if test="query.title != null and query.title != ''"> and `tbs_budget`.`budget_code` like concat('%',#{query.title},'%') </if>
<if test="query.code != null and query.code != ''"> and `tbs_budget`.`budget_number` like concat('%',#{query.code},'%')</if> <if test="query.code != null and query.code != ''"> and `tbs_budget`.`budget_number` like concat('%',#{query.code},'%')</if>
<if test="query.budgetCheckState != null"> and `tbs_budget`.`budget_check_state` = #{query.budgetCheckState}</if> <if test="query.budgetCheckState != null"> and `tbs_budget`.`budget_check_state` = #{query.budgetCheckState}</if>
@ -98,6 +99,7 @@
and (`tbs_budget_change`.`change_code` like concat('%',#{query.code},'%') and (`tbs_budget_change`.`change_code` like concat('%',#{query.code},'%')
or `tbs_budget_change`.`budget_number` like concat('%',#{query.code},'%') ) or `tbs_budget_change`.`budget_number` like concat('%',#{query.code},'%') )
</if> </if>
<if test="query.budgetId != null"> and `tbs_budget_change`.`budget_id` = #{query.budgetId}</if>
<if test="query.title != null and query.title != ''"> and `tbs_budget_change`.`budget_title` like concat('%',#{query.title},'%') </if> <if test="query.title != null and query.title != ''"> and `tbs_budget_change`.`budget_title` like concat('%',#{query.title},'%') </if>
<if test="query.budgetCheckState != null"> and `tbs_budget_change`.`budget_check_state` = #{query.budgetCheckState}</if> <if test="query.budgetCheckState != null"> and `tbs_budget_change`.`budget_check_state` = #{query.budgetCheckState}</if>
<if test="query.subjectCode != null and query.subjectCode != ''"> and `tbs_budget_change`.`subject_code` like concat('%',#{query.subjectCode},'%') </if> <if test="query.subjectCode != null and query.subjectCode != ''"> and `tbs_budget_change`.`subject_code` like concat('%',#{query.subjectCode},'%') </if>

Loading…
Cancel
Save