Browse Source

Merge remote-tracking branch 'origin/v1.0' into v1.0

v1.0
15989082884@163.com 2 years ago
parent
commit
c1f9591492
  1. 16
      src/main/java/com/qs/serve/modules/seeyon/SeeYonController.java
  2. 2
      src/main/java/com/qs/serve/modules/seeyon/service/CommonCheckService.java
  3. 10
      src/main/java/com/qs/serve/modules/seeyon/service/impl/CommonCheckServiceImpl.java
  4. 4
      src/main/java/com/qs/serve/modules/tbs/common/TbsSeeYonConst.java
  5. 125
      src/main/java/com/qs/serve/modules/tbs/common/dto/TbsBudgetChangeVo.java
  6. 7
      src/main/java/com/qs/serve/modules/tbs/controller/TbsActivitySubjectYarnController.java
  7. 47
      src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetChangeController.java
  8. 77
      src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetCheckController.java
  9. 4
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChange.java
  10. 3
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChangeCondition.java
  11. 5
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChangeScheduleItem.java
  12. 14
      src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetCondition.java
  13. 43
      src/main/java/com/qs/serve/modules/tbs/entity/so/TbsBudgetChangeSo.java
  14. 104
      src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java
  15. 9
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsBudgetChangeMapper.java
  16. 9
      src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetChangeService.java
  17. 82
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeOperationServiceImpl.java
  18. 28
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetChangeServiceImpl.java
  19. 156
      src/main/resources/mapper/tbs/TbsBudgetChangeMapper.xml

16
src/main/java/com/qs/serve/modules/seeyon/SeeYonController.java

@ -71,21 +71,21 @@ public class SeeYonController {
} }
/** /**
* 我的审批退回列表 * 我的审批退回列表page
* @return * @return
*/ */
@GetMapping("listMyCallback") @GetMapping("pageMyCallback")
public R<List<TodoVO>> listCallbackList(){ public R<PageVo<TodoVO>> pageCallbackList(){
return R.ok(commonCheckService.listCallbackList()); return R.ok(commonCheckService.pageCallback(new TodoVoQuery()));
} }
/** /**
* 我的审批退回列表 * 我的审批退回统计count
* @return * @return
*/ */
@GetMapping("pageMyCallback") @GetMapping("countMyCallback")
public R<PageVo<TodoVO>> pageCallbackList(){ public R<Long> countCallback(){
return R.ok(commonCheckService.pageCallback(new TodoVoQuery())); return R.ok(commonCheckService.countCallback(new TodoVoQuery()));
} }
/** /**

2
src/main/java/com/qs/serve/modules/seeyon/service/CommonCheckService.java

@ -14,6 +14,8 @@ public interface CommonCheckService {
PageVo<TodoVO> pageCallback(TodoVoQuery query); PageVo<TodoVO> pageCallback(TodoVoQuery query);
Long countCallback(TodoVoQuery query);
/** /**
* 退回列表 * 退回列表
* @return * @return

10
src/main/java/com/qs/serve/modules/seeyon/service/impl/CommonCheckServiceImpl.java

@ -73,6 +73,16 @@ public class CommonCheckServiceImpl implements CommonCheckService {
return pageVo; return pageVo;
} }
@Override
public Long countCallback(TodoVoQuery query) {
int pageSize = PageUtil.getPageSize();
int startRow = PageUtil.getStartRow();
query.setUserId(AuthContextUtils.getSysUserId());
query.setPageSize(pageSize);
query.setStartRow(startRow);
return commonCheckMapper.countCallback(query);
}
/** /**
* 初始化TargetInfo * 初始化TargetInfo
* @param todoVOList * @param todoVOList

4
src/main/java/com/qs/serve/modules/tbs/common/TbsSeeYonConst.java

@ -41,14 +41,14 @@ public interface TbsSeeYonConst {
/** 预算申请 */ /** 预算申请 */
class BudgetApplyConf{ class BudgetApplyConf{
public static String Code(){ public static String Code(){
return DevEnvironmentConfig.isDev()?"budgetAdjust":"budgetAdjust_Test"; return DevEnvironmentConfig.isDev()?"budgetAdjust_Test":"budgetAdjust";
} }
} }
class BudgetChangeConf{ class BudgetChangeConf{
public static String Code(){ public static String Code(){
return DevEnvironmentConfig.isDev()?"budgetAdjust":"budgetAdjust_Test"; return DevEnvironmentConfig.isDev()?"budgetAdjust2_Test":"budgetAdjust2";
} }
} }

125
src/main/java/com/qs/serve/modules/tbs/common/dto/TbsBudgetChangeVo.java

@ -0,0 +1,125 @@
package com.qs.serve.modules.tbs.common.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
* @author YenHex
* @since 2023/8/11
*/
@Data
public class TbsBudgetChangeVo {
/** 类型:apply,change */
private String type;
/** 预算id */
private Long budgetId;
/** 预算更变id */
private Long budgetChangeId;
/** 更变记录编码 */
@Length(max = 30,message = "更变记录编码长度不能超过30字")
private String changeCode;
/** 名称 */
@NotBlank(message = "名称不能为空")
@Length(max = 30,message = "名称长度不能超过30字")
private String budgetTitle;
/** 名称 */
private String newBudgetTitle;
/** 编码 */
@Length(max = 30,message = "编码长度不能超过30字")
private String budgetNumber;
/** 审批状态 */
@NotNull(message = "审批状态不能为空")
private Integer budgetCheckState;
/** 科目id */
@NotNull(message = "科目id不能为空")
private Long subjectId;
/** 科目编码 */
@Length(max = 30,message = "科目编码长度不能超过30字")
private String subjectCode;
/** 科目名称 */
@Length(max = 30,message = "科目名称长度不能超过30字")
private String subjectName;
/** 成本中心类型 */
@NotBlank(message = "成本中心类型不能为空")
@Length(max = 20,message = "成本中心类型长度不能超过20字")
private String centerType;
/** 成本中心id */
@NotBlank(message = "成本中心id不能为空")
@Length(max = 32,message = "成本中心id长度不能超过32字")
private String centerId;
/** 成本中心编码 */
@NotBlank(message = "成本中心编码不能为空")
@Length(max = 30,message = "成本中心编码长度不能超过30字")
private String centerCode;
/** 成本中心名称 */
@NotBlank(message = "成本中心名称不能为空")
@Length(max = 30,message = "成本中心名称长度不能超过30字")
private String centerName;
/** 考核期id */
@NotNull(message = "考核期id不能为空")
private Long scheduleId;
/** 考核期编码 */
@NotBlank(message = "考核期编码不能为空")
@Length(max = 30,message = "考核期编码长度不能超过30字")
private String scheduleCode;
/** 考核期名称 */
@NotBlank(message = "考核期名称不能为空")
@Length(max = 30,message = "考核期名称长度不能超过30字")
private String scheduleName;
/** 致远表单id */
private String syFormId;
/** 提交审批时间 */
@Length(max = 0,message = "提交审批时间长度不能超过0字")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime submitTime;
/** 申请人 */
@NotBlank(message = "申请人不能为空")
@Length(max = 32,message = "申请人长度不能超过32字")
private String userId;
/** 用户编码 */
@Length(max = 32,message = "长度不能超过32字")
private String userCode;
/** 用户名称 */
@Length(max = 32,message = "长度不能超过32字")
@TableField(condition = SqlCondition.LIKE)
private String userName;
/** 备注 */
@Length(max = 255,message = "备注长度不能超过255字")
private String remark;
}

7
src/main/java/com/qs/serve/modules/tbs/controller/TbsActivitySubjectYarnController.java

@ -35,12 +35,13 @@ public class TbsActivitySubjectYarnController {
/** /**
* 列表 * 列表
* @param param * @param id
* @return * @return
*/ */
@GetMapping("/list") @GetMapping("/list")
public R<List<TbsActivitySubjectYarn>> getList(TbsActivitySubjectYarn param){ public R<List<TbsActivitySubjectYarn>> getList(Long id){
LambdaQueryWrapper<TbsActivitySubjectYarn> lqw = new LambdaQueryWrapper<>(param); LambdaQueryWrapper<TbsActivitySubjectYarn> lqw = new LambdaQueryWrapper<>();
lqw.eq(TbsActivitySubjectYarn::getCostApplyId,id);
List<TbsActivitySubjectYarn> list = tbsActivitySubjectYarnService.list(lqw); List<TbsActivitySubjectYarn> list = tbsActivitySubjectYarnService.list(lqw);
return R.ok(list); return R.ok(list);
} }

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

@ -6,11 +6,14 @@ import com.qs.serve.common.model.dto.PageVo;
import com.qs.serve.common.model.dto.R; import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.model.enums.BizType; import com.qs.serve.common.model.enums.BizType;
import com.qs.serve.common.model.enums.SystemModule; import com.qs.serve.common.model.enums.SystemModule;
import com.qs.serve.common.util.AuthContextUtils;
import com.qs.serve.common.util.PageUtil; 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.entity.TbsBudgetChangeCondition; import com.qs.serve.modules.tbs.entity.TbsBudgetChangeCondition;
import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem; import com.qs.serve.modules.tbs.entity.TbsBudgetChangeScheduleItem;
import com.qs.serve.modules.tbs.entity.so.TbsBudgetChangeSo;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeConditionService; import com.qs.serve.modules.tbs.service.TbsBudgetChangeConditionService;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeScheduleItemService; import com.qs.serve.modules.tbs.service.TbsBudgetChangeScheduleItemService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -23,6 +26,8 @@ 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.stream.Collectors;
/** /**
* 预算 预算更变记录 * 预算 预算更变记录
@ -39,12 +44,46 @@ public class TbsBudgetChangeController {
private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService; private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService;
private TbsBudgetChangeConditionService tbsBudgetChangeConditionService; private TbsBudgetChangeConditionService tbsBudgetChangeConditionService;
/**
* 预算审批整合翻页
* @param query
* @return
*/
@GetMapping("/comboPage")
public R<PageVo<TbsBudgetChangeVo>> selectComboPage(TbsBudgetChangeSo query){
Long count = tbsBudgetChangeService.countChangeVo(query);
PageVo<TbsBudgetChangeVo> pageVo = new PageVo<>();
pageVo.initPageByTotal(count);
if(count>0){
List<TbsBudgetChangeVo> list = tbsBudgetChangeService.selectChangeVoList(query);
pageVo.setList(list);
}
return R.ok(pageVo);
}
/**
* changeId查询
* @param id
* @return
*/
@GetMapping("/{id}")
public R<TbsBudgetChange> getList(@PathVariable("id")Long id ){
TbsBudgetChange budgetChange = tbsBudgetChangeService.getById(id);
List<TbsBudgetChangeScheduleItem> changeScheduleItemList = tbsBudgetChangeScheduleItemService.listByChangeId(budgetChange.getId());
List<TbsBudgetChangeCondition> changeConditionList = tbsBudgetChangeConditionService.listByChangeId(budgetChange.getId());
Map<Integer,List<TbsBudgetChangeCondition>> map = changeConditionList.stream().collect(Collectors.groupingBy(TbsBudgetChangeCondition::getSourceFlag));
budgetChange.setChangeScheduleItemList(changeScheduleItemList);
budgetChange.setChangeConditionList(map.get(0));
budgetChange.setOrgConditionList(map.get(1));
return R.ok(budgetChange);
}
/** /**
* 列表 * 列表
* @param param * @param param
* @return * @return
*/ */
@GetMapping("/list") //@GetMapping("/list")
public R<List<TbsBudgetChange>> getList(TbsBudgetChange param){ public R<List<TbsBudgetChange>> getList(TbsBudgetChange param){
if(param.getBudgetId()==null){ if(param.getBudgetId()==null){
return R.error("BudgetId不能为空"); return R.error("BudgetId不能为空");
@ -70,6 +109,12 @@ public class TbsBudgetChangeController {
LambdaQueryWrapper<TbsBudgetChange> lqw = new LambdaQueryWrapper<>(param); LambdaQueryWrapper<TbsBudgetChange> lqw = new LambdaQueryWrapper<>(param);
PageUtil.startPage(); PageUtil.startPage();
List<TbsBudgetChange> list = tbsBudgetChangeService.list(lqw); 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.byPageHelperList(list); return R.byPageHelperList(list);
} }

77
src/main/java/com/qs/serve/modules/tbs/controller/TbsBudgetCheckController.java

@ -1,8 +1,14 @@
package com.qs.serve.modules.tbs.controller; package com.qs.serve.modules.tbs.controller;
import com.qs.serve.common.model.annotation.LimitSubmit;
import com.qs.serve.common.model.annotation.SysLog;
import com.qs.serve.common.model.dto.R; 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.modules.seeyon.entity.bo.CtpAddNodeParam;
import com.qs.serve.modules.tbs.entity.TbsBudget; import com.qs.serve.modules.tbs.entity.TbsBudget;
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; import com.qs.serve.modules.tbs.entity.TbsBudgetChange;
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo;
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.CtpAffairVo; import com.qs.serve.modules.tbs.entity.vo.CtpAffairVo;
import com.qs.serve.modules.tbs.service.TbsBudgetChangeService; import com.qs.serve.modules.tbs.service.TbsBudgetChangeService;
@ -11,8 +17,10 @@ import com.qs.serve.modules.tbs.service.impl.TbsBudgetApplyOperationServiceImpl;
import com.qs.serve.modules.tbs.service.impl.TbsBudgetChangeOperationServiceImpl; import com.qs.serve.modules.tbs.service.impl.TbsBudgetChangeOperationServiceImpl;
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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List; import java.util.List;
/** /**
@ -53,7 +61,7 @@ public class TbsBudgetCheckController {
} }
/** /**
* 审批列表-预算申请 * 审批结果-预算申请
* @param budgetId * @param budgetId
* @return * @return
*/ */
@ -64,7 +72,7 @@ public class TbsBudgetCheckController {
/** /**
* 审批列表-预算修改 * 审批结果-修改预算申请
* @param changeId * @param changeId
* @return * @return
*/ */
@ -73,5 +81,70 @@ public class TbsBudgetCheckController {
return tbsBudgetChangeOperationService.pageAffair(changeId); return tbsBudgetChangeOperationService.pageAffair(changeId);
} }
/**
* 提交审批节点-预算申请
* @return
*/
@LimitSubmit
@PostMapping("/commitAffair")
@SysLog(module = SystemModule.Budget, title = "预算申请", biz = BizType.OTHER)
public R<?> commitAffair(@RequestBody @Valid TbsAffairCommitBo affairCommit){
return tbsBudgetApplyOperationService.commitAffair(affairCommit);
}
/**
* 提交审批节点-修改预算申请
* @return
*/
@LimitSubmit
@PostMapping("/commitChangeAffair")
@SysLog(module = SystemModule.Budget, title = "修改预算申请", biz = BizType.OTHER)
public R<?> commitChangeAffair(@RequestBody @Valid TbsAffairCommitBo affairCommit){
return tbsBudgetChangeOperationService.commitAffair(affairCommit);
}
/**
* 加签-预算申请
* @param param
* @return
*/
@LimitSubmit
@PostMapping("/addNode")
@SysLog(module = SystemModule.Budget, title = "费用申请", biz = BizType.OTHER)
public R<String> addNode(@RequestBody CtpAddNodeParam param){
return tbsBudgetApplyOperationService.addNode(param);
}
/**
* 加签-修改预算申请
* @param param
* @return
*/
@LimitSubmit
@PostMapping("/addChangeNode")
@SysLog(module = SystemModule.Budget, title = "修改预算申请", biz = BizType.OTHER)
public R<String> addChangeNode(@RequestBody CtpAddNodeParam param){
return tbsBudgetChangeOperationService.addNode(param);
}
/**
* 个人未完成审批统计-预算申请
* @return
*/
@PostMapping("/getUnfinished")
public R<Long> getUnfinished(){
return tbsBudgetApplyOperationService.getUnfinished();
}
/**
* 个人未完成审批统计-修改预算申请
* @return
*/
@PostMapping("/getChangeUnfinished")
public R<Long> getChangeUnfinished(){
return tbsBudgetChangeOperationService.getUnfinished();
}
} }

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

@ -158,6 +158,10 @@ public class TbsBudgetChange implements Serializable {
@JsonProperty @JsonProperty
private String delFlag; private String delFlag;
/** 原来的条件 */
@TableField(exist = false)
private List<?> orgConditionList;
@TableField(exist = false) @TableField(exist = false)
private List<?> changeScheduleItemList; private List<?> changeScheduleItemList;

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

@ -39,6 +39,9 @@ public class TbsBudgetChangeCondition implements Serializable {
@NotNull(message = "预算id不能为空") @NotNull(message = "预算id不能为空")
private Long budgetId; private Long budgetId;
/** 是否原来的 */
private Integer sourceFlag;
/** 目标类型(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字")

5
src/main/java/com/qs/serve/modules/tbs/entity/TbsBudgetChangeScheduleItem.java

@ -34,6 +34,9 @@ public class TbsBudgetChangeScheduleItem implements Serializable {
/** 更变记录id */ /** 更变记录id */
private Long changeId; private Long changeId;
/** TbsScheduleItemBudget.id */
private Long sourceId;
/** 考核id */ /** 考核id */
@NotNull(message = "考核id不能为空") @NotNull(message = "考核id不能为空")
private Long scheduleId; private Long scheduleId;
@ -115,7 +118,7 @@ public class TbsBudgetChangeScheduleItem implements Serializable {
public static TbsBudgetChangeScheduleItem toNewObject(TbsScheduleItemBudget source){ public static TbsBudgetChangeScheduleItem toNewObject(TbsScheduleItemBudget source){
TbsBudgetChangeScheduleItem budgetChangeScheduleItem = new TbsBudgetChangeScheduleItem(); TbsBudgetChangeScheduleItem budgetChangeScheduleItem = new TbsBudgetChangeScheduleItem();
budgetChangeScheduleItem.setId(source.getId()); budgetChangeScheduleItem.setSourceId(source.getId());
//budgetChangeScheduleItem.setChangeId(source.getChangeId()); //budgetChangeScheduleItem.setChangeId(source.getChangeId());
budgetChangeScheduleItem.setScheduleId(source.getScheduleId()); budgetChangeScheduleItem.setScheduleId(source.getScheduleId());
budgetChangeScheduleItem.setScheduleItemId(source.getScheduleItemId()); budgetChangeScheduleItem.setScheduleItemId(source.getScheduleItemId());

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

@ -101,5 +101,19 @@ public class TbsBudgetCondition implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String skuName; private String skuName;
public static TbsBudgetCondition toNewObject(TbsBudgetChangeCondition source){
TbsBudgetCondition budgetCondition = new TbsBudgetCondition();
budgetCondition.setBudgetId(source.getBudgetId());
budgetCondition.setTargetType(source.getTargetType());
budgetCondition.setTargetId(source.getTargetId());
budgetCondition.setTargetCode(source.getTargetCode());
budgetCondition.setTargetName(source.getTargetName());
budgetCondition.setTargetLevelPathIds(source.getTargetLevelPathIds());
budgetCondition.setTargetLevelPathNames(source.getTargetLevelPathNames());
budgetCondition.setRemark(source.getRemark());
return budgetCondition;
}
} }

43
src/main/java/com/qs/serve/modules/tbs/entity/so/TbsBudgetChangeSo.java

@ -0,0 +1,43 @@
package com.qs.serve.modules.tbs.entity.so;
import lombok.Data;
/**
* @author YenHex
* @since 2023/8/11
*/
@Data
public class TbsBudgetChangeSo {
/** 审批状态:0=未发布;1=审批中;2=完成;3-被驳回;4-中止 */
private Integer budgetCheckState;
/** 编码 */
private String code;
private String title;
/** 预算ID */
private Long budgetId;
private String budgetNumber;
private String userId;
private String userName;
private String userCode;
private String subjectName;
private String subjectCode;
private String centerCode;
private String centerName;
private Integer startRow;
private Integer pageSize;
}

104
src/main/java/com/qs/serve/modules/tbs/entity/vo/TbsBudgetVo.java

@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler;
import com.qs.serve.modules.tbs.entity.TbsBudgetCondition; import com.qs.serve.modules.tbs.entity.TbsBudgetCondition;
import com.qs.serve.modules.tbs.entity.TbsScheduleItemBudget; import com.qs.serve.modules.tbs.entity.TbsScheduleItemBudget;
import lombok.Data; import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@ -27,47 +29,140 @@ public class TbsBudgetVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */ /** id */
@TableId(type = IdType.AUTO)
private Long id; private Long id;
/** 预算编码 */ /** 预算名称 */
private String budgetCode; private String budgetCode;
/** 预算编码 */
private String budgetNumber;
/** 费用启用状态 0/1 */
private Integer budgetState;
/** 审批流程状态 */
private Integer budgetCheckState;
/** 科目id */ /** 科目id */
@NotNull(message = "科目id不能为空")
private Long subjectId; private Long subjectId;
/** 科目编码 */ /** 科目编码 */
@NotBlank(message = "科目编码不能为空")
@Length(max = 30,message = "科目编码长度不能超过30字")
private String subjectCode; private String subjectCode;
/** 科目名称 */ /** 科目名称 */
@NotBlank(message = "科目名称不能为空")
@Length(max = 30,message = "科目名称长度不能超过30字")
private String subjectName; private String subjectName;
/** 成本中心id */ /** 成本中心id */
@NotNull(message = "成本中心id不能为空")
private String centerId; private String centerId;
@NotNull(message = "成本中心类型不能为空")
private String centerType; private String centerType;
/** 成本中心编码 */ /** 成本中心编码 */
@NotBlank(message = "成本中心编码不能为空")
@Length(max = 30,message = "成本中心编码长度不能超过30字")
private String centerCode; private String centerCode;
/** 成本中心名称 */ /** 成本中心名称 */
@NotBlank(message = "成本中心名称不能为空")
@Length(max = 30,message = "成本中心名称长度不能超过30字")
private String centerName; private String centerName;
/** 考核期id */ /** 考核期id */
@NotNull(message = "考核期id不能为空")
private Long scheduleId; private Long scheduleId;
/** 考核期编码 */ /** 考核期编码 */
@NotBlank(message = "考核期编码不能为空")
@Length(max = 30,message = "考核期编码长度不能超过30字")
private String scheduleCode; private String scheduleCode;
/** 考核期名称 */ /** 考核期名称 */
@NotBlank(message = "考核期名称不能为空")
@Length(max = 30,message = "考核期名称长度不能超过30字")
private String scheduleName; private String scheduleName;
/** 费用启用状态 */
private Integer budgetState;
/** 备注 */ /** 备注 */
@Length(max = 255,message = "备注长度不能超过255字")
private String remark; private String remark;
/** 条件标识 */
private Integer conditionFlag;
/** 生成底表标识:默认0;同步成功为1 */
private Integer birFlag;
/** 申请人 */
@NotBlank(message = "申请人不能为空")
@Length(max = 32,message = "申请人长度不能超过32字")
private String userId;
/** 用户编码 */
@Length(max = 32,message = "长度不能超过32字")
private String userCode;
/** 用户名称 */
@Length(max = 32,message = "长度不能超过32字")
@TableField(condition = SqlCondition.LIKE)
private String userName;
/** 致远表单id */
private String syFormId;
/** 提交审批时间 */
private LocalDateTime submitTime;
/** 创建时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
/** 最后更新时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime updateTime;
/** 所属租户 */
@JsonIgnore
@JsonProperty
private String tenantId;
/** 创建人 */
@TableField(fill = FieldFill.INSERT)
private String createBy;
/** 更新人 */
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
/** 逻辑删除标记(0:显示;1:隐藏) */
@JsonIgnore
@JsonProperty
private String delFlag;
/** 附件id */
@TableField(typeHandler = SplitStringTypeHandler.class,jdbcType= JdbcType.VARCHAR)
private String[] attachIds;
/** 后端传输dto */
@TableField(exist = false)
private List<TbsBudgetCondition> budgetConditionList;
@TableField(exist = false)
private List<?> attachList;
private List<?> brandConditions; private List<?> brandConditions;
private List<?> categoryConditions; private List<?> categoryConditions;
private List<?> seriesConditions; private List<?> seriesConditions;
@ -75,7 +170,6 @@ public class TbsBudgetVo implements Serializable {
private List<?> spuConditions; private List<?> spuConditions;
private List<?> scheduleItem; private List<?> scheduleItem;
private List<TbsScheduleItemBudget> scheduleItemBudgets; private List<TbsScheduleItemBudget> scheduleItemBudgets;
private List<?> attachList;
/** 变更列表 */ /** 变更列表 */
private List<?> changeList; private List<?> changeList;

9
src/main/java/com/qs/serve/modules/tbs/mapper/TbsBudgetChangeMapper.java

@ -1,7 +1,12 @@
package com.qs.serve.modules.tbs.mapper; package com.qs.serve.modules.tbs.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo;
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; import com.qs.serve.modules.tbs.entity.TbsBudgetChange;
import com.qs.serve.modules.tbs.entity.so.TbsBudgetChangeSo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 预算更变记录 Mapper * 预算更变记录 Mapper
@ -10,5 +15,9 @@ import com.qs.serve.modules.tbs.entity.TbsBudgetChange;
*/ */
public interface TbsBudgetChangeMapper extends BaseMapper<TbsBudgetChange> { public interface TbsBudgetChangeMapper extends BaseMapper<TbsBudgetChange> {
List<TbsBudgetChangeVo> selectChangeVoList(@Param("query") TbsBudgetChangeSo query);
Long countChangeVo(@Param("query") TbsBudgetChangeSo query);
} }

9
src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetChangeService.java

@ -1,10 +1,15 @@
package com.qs.serve.modules.tbs.service; package com.qs.serve.modules.tbs.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo;
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; import com.qs.serve.modules.tbs.entity.TbsBudgetChange;
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.so.TbsBudgetChangeSo;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/** /**
* 预算更变记录 服务接口 * 预算更变记录 服务接口
* @author YenHex * @author YenHex
@ -18,5 +23,9 @@ public interface TbsBudgetChangeService extends IService<TbsBudgetChange> {
*/ */
TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param); TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param);
List<TbsBudgetChangeVo> selectChangeVoList(TbsBudgetChangeSo query);
Long countChangeVo(TbsBudgetChangeSo query);
} }

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

@ -1,20 +1,33 @@
package com.qs.serve.modules.tbs.service.impl; package com.qs.serve.modules.tbs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qs.serve.common.framework.manager.AsyncFactory; import com.qs.serve.common.framework.manager.AsyncFactory;
import com.qs.serve.common.framework.manager.AsyncManager; import com.qs.serve.common.framework.manager.AsyncManager;
import com.qs.serve.common.model.dto.R;
import com.qs.serve.common.model.enums.BudgetLogOptFlag;
import com.qs.serve.common.util.Assert; import com.qs.serve.common.util.Assert;
import com.qs.serve.common.util.CollectionUtil;
import com.qs.serve.modules.seeyon.service.SeeYonOperationService; import com.qs.serve.modules.seeyon.service.SeeYonOperationService;
import com.qs.serve.modules.sys.entity.SysUser;
import com.qs.serve.modules.tbs.common.TbsBudgetCheckState; import com.qs.serve.modules.tbs.common.TbsBudgetCheckState;
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; import com.qs.serve.modules.tbs.common.TbsSeeYonConst;
import com.qs.serve.modules.tbs.entity.TbsBudget; import com.qs.serve.modules.tbs.common.util.TbsBudgetLogBuildUtil;
import com.qs.serve.modules.tbs.entity.TbsBudgetChange; import com.qs.serve.modules.tbs.entity.*;
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo;
import com.qs.serve.modules.tbs.mapper.TbsBudgetChangeMapper; 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 lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 预算改动的申请 * 预算改动的申请
* @author YenHex * @author YenHex
@ -25,7 +38,14 @@ import org.springframework.stereotype.Service;
@AllArgsConstructor @AllArgsConstructor
public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationService { public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationService {
private TbsBudgetMapper budgetMapper;
private TbsBudgetChangeMapper budgetChangeMapper; private TbsBudgetChangeMapper budgetChangeMapper;
private TbsBudgetConditionService tbsBudgetConditionService;
private TbsBudgetChangeScheduleItemService tbsBudgetChangeScheduleItemService;
private TbsBudgetChangeConditionService tbsBudgetChangeConditionService;
private TbsBudgetLogService tbsBudgetLogService;
private TbsScheduleItemBudgetService tbsScheduleItemBudgetService;
@Override @Override
public void doCommitBacked(String targetId) { public void doCommitBacked(String targetId) {
@ -58,11 +78,65 @@ public class TbsBudgetChangeOperationServiceImpl implements SeeYonOperationServi
budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_2_finished); budgetChange.setBudgetCheckState(TbsBudgetCheckState.State_2_finished);
budgetChangeMapper.updateById(budgetChange); budgetChangeMapper.updateById(budgetChange);
} }
//TODO 更新到主表 TbsBudget tbsBudget = budgetMapper.selectById(budgetChange.getBudgetId());
SysUser sysUser = getSysUserService().getBySyId(budgetChange.getUserId());
//更新条件
List<TbsBudgetChangeCondition> allChangeConditionList = tbsBudgetChangeConditionService.listByChangeId(budgetChange.getId());
Map<Integer,List<TbsBudgetChangeCondition>> map = allChangeConditionList.stream().collect(Collectors.groupingBy(TbsBudgetChangeCondition::getSourceFlag));
List<TbsBudgetChangeCondition> changeConditionList = map.get(0);
if(changeConditionList!=null&&changeConditionList.size()>0){
List<TbsBudgetCondition> budgetConditionList = new ArrayList<>();
for (TbsBudgetChangeCondition changeCondition : changeConditionList) {
TbsBudgetCondition budgetCondition = TbsBudgetCondition.toNewObject(changeCondition);
budgetConditionList.add(budgetCondition);
}
if(CollectionUtil.isNotEmpty(budgetConditionList)){
tbsBudgetConditionService.saveBatch(budgetConditionList);
}
}
//更新金额
List<TbsBudgetChangeScheduleItem> changeScheduleItemList = tbsBudgetChangeScheduleItemService.listByChangeId(budgetChange.getId());
if(CollectionUtil.isNotEmpty(changeConditionList)){
List<Long> scheduleItemBudgetIds = changeScheduleItemList.stream().map(TbsBudgetChangeScheduleItem::getSourceId).collect(Collectors.toList());
List<TbsScheduleItemBudget> scheduleItemBudgetList = tbsScheduleItemBudgetService.listByIds(scheduleItemBudgetIds);
for (TbsScheduleItemBudget item : scheduleItemBudgetList) {
for (TbsBudgetChangeScheduleItem changeItem : changeScheduleItemList) {
if(item.getId().equals(changeItem.getSourceId())){
//更新具体方法
this.updateScheduleAmtAndBudgetLog(sysUser,tbsBudget,item, changeItem);
}
}
}
}
return null; return null;
} }
/**
* 更新金额和预算日志
* @param item
* @param changeItem
*/
private void updateScheduleAmtAndBudgetLog(SysUser sysUser,TbsBudget budget,TbsScheduleItemBudget item, TbsBudgetChangeScheduleItem changeItem) {
boolean changeAmtIsNotNull = changeItem.getBudgetAmount()!=null&&changeItem.getNewBudgetAmount()!=null;
if(changeAmtIsNotNull && changeItem.getBudgetAmount().compareTo(changeItem.getNewBudgetAmount())!=0){
BudgetLogOptFlag optType;
BigDecimal amount = changeItem.getBudgetAmount().subtract(changeItem.getNewBudgetAmount());
if(amount.compareTo(BigDecimal.ZERO)>0){
optType = BudgetLogOptFlag.State_2;
}else if(amount.compareTo(BigDecimal.ZERO)<0){
optType = BudgetLogOptFlag.State_3;
}else{
return;
}
TbsBudgetLog budgetLog = TbsBudgetLogBuildUtil.toTbsBudgetLog(sysUser,budget,item,optType, amount);
tbsBudgetLogService.save(budgetLog);
}
if(changeItem.getNewPreDispatchAmount()!=null){
item.setPreDispatchAmount(changeItem.getPreDispatchAmount());
tbsScheduleItemBudgetService.updateById(item);
}
}
@Override @Override
public Object doRefuse(TbsAffairCommitBo param) { public Object doRefuse(TbsAffairCommitBo param) {
TbsBudgetChange budgetChange = budgetChangeMapper.selectById(param.getTargetId()); TbsBudgetChange budgetChange = budgetChangeMapper.selectById(param.getTargetId());

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

@ -1,5 +1,6 @@
package com.qs.serve.modules.tbs.service.impl; package com.qs.serve.modules.tbs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qs.serve.common.config.properties.ProjectProperties; import com.qs.serve.common.config.properties.ProjectProperties;
import com.qs.serve.common.framework.manager.AsyncFactory; import com.qs.serve.common.framework.manager.AsyncFactory;
@ -14,11 +15,13 @@ import com.qs.serve.modules.sys.entity.SysUser;
import com.qs.serve.modules.sys.service.SysUserService; import com.qs.serve.modules.sys.service.SysUserService;
import com.qs.serve.modules.tbs.common.TbsBudgetCheckState; import com.qs.serve.modules.tbs.common.TbsBudgetCheckState;
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; import com.qs.serve.modules.tbs.common.TbsSeeYonConst;
import com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo;
import com.qs.serve.modules.tbs.common.util.TbsBudgetConditionUtil; import com.qs.serve.modules.tbs.common.util.TbsBudgetConditionUtil;
import com.qs.serve.modules.tbs.entity.*; import com.qs.serve.modules.tbs.entity.*;
import com.qs.serve.modules.tbs.entity.bo.TbsBudgetAmtBo; import com.qs.serve.modules.tbs.entity.bo.TbsBudgetAmtBo;
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.dto.TbsBudgetLogWithAmount; import com.qs.serve.modules.tbs.entity.dto.TbsBudgetLogWithAmount;
import com.qs.serve.modules.tbs.entity.so.TbsBudgetChangeSo;
import com.qs.serve.modules.tbs.mapper.*; import com.qs.serve.modules.tbs.mapper.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -44,12 +47,25 @@ public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMappe
private final TbsBudgetMapper tbsBudgetMapper; private final TbsBudgetMapper tbsBudgetMapper;
private final TbsBudgetChangeConditionMapper tbsBudgetChangeConditionMapper; private final TbsBudgetChangeConditionMapper tbsBudgetChangeConditionMapper;
private final TbsBudgetConditionMapper tbsBudgetConditionMapper;
private final TbsScheduleItemBudgetMapper tbsScheduleItemBudgetMapper; private final TbsScheduleItemBudgetMapper tbsScheduleItemBudgetMapper;
private final TbsBudgetChangeScheduleItemMapper tbsBudgetChangeScheduleItemMapper; private final TbsBudgetChangeScheduleItemMapper tbsBudgetChangeScheduleItemMapper;
private final SysUserService sysUserService; private final SysUserService sysUserService;
private final SeeYonRequestService seeYonService; private final SeeYonRequestService seeYonService;
private final ProjectProperties projectProperties; private final ProjectProperties projectProperties;
@Override
public List<TbsBudgetChangeVo> selectChangeVoList(TbsBudgetChangeSo query) {
query.setPageSize(PageUtil.getPageSize());
query.setStartRow(PageUtil.getStartRow());
return baseMapper.selectChangeVoList(query);
}
@Override
public Long countChangeVo(TbsBudgetChangeSo query) {
return baseMapper.countChangeVo(query);
}
@Override @Override
public TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param) { public TbsBudgetChange commitApply(TbsBudgetUpdateAfterStartBo param) {
seeYonService.testConnection(); seeYonService.testConnection();
@ -122,7 +138,7 @@ public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMappe
} }
this.save(budgetChange); this.save(budgetChange);
Long changeId = budgetChange.getId(); Long changeId = budgetChange.getId();
//设置条件 //设置条件
List<TbsBudgetCondition> budgetConditionList = TbsBudgetConditionUtil.buildCondition( List<TbsBudgetCondition> budgetConditionList = TbsBudgetConditionUtil.buildCondition(
budget.getId(), param.getBrandIds(), param.getCategoryIds(), param.getSeriesIds(), param.getSpuIds(), param.getSkuIds()); budget.getId(), param.getBrandIds(), param.getCategoryIds(), param.getSeriesIds(), param.getSpuIds(), param.getSkuIds());
List<TbsBudgetChangeCondition> changeConditionList = budgetConditionList.stream().map(cond->{ List<TbsBudgetChangeCondition> changeConditionList = budgetConditionList.stream().map(cond->{
@ -133,6 +149,16 @@ public class TbsBudgetChangeServiceImpl extends ServiceImpl<TbsBudgetChangeMappe
for (TbsBudgetChangeCondition changeCondition : changeConditionList) { for (TbsBudgetChangeCondition changeCondition : changeConditionList) {
tbsBudgetChangeConditionMapper.insert(changeCondition); tbsBudgetChangeConditionMapper.insert(changeCondition);
} }
//记录旧条件
LambdaQueryWrapper<TbsBudgetCondition> conditionLambdaQueryWrapper = new LambdaQueryWrapper<>();
conditionLambdaQueryWrapper.eq(TbsBudgetCondition::getBudgetId,budget.getId());
List<TbsBudgetCondition> orgBudgetCondition = tbsBudgetConditionMapper.selectList(conditionLambdaQueryWrapper);
for (TbsBudgetCondition budgetCondition : orgBudgetCondition) {
TbsBudgetChangeCondition changeCondition = TbsBudgetChangeCondition.toNewObject(budgetCondition);
changeCondition.setChangeId(changeId);
changeCondition.setSourceFlag(1);
tbsBudgetChangeConditionMapper.insert(changeCondition);
}
//设置金额 //设置金额
List<TbsBudgetAmtBo> budgetAmtUpdateList = param.getBudgetAmtUpdateList(); List<TbsBudgetAmtBo> budgetAmtUpdateList = param.getBudgetAmtUpdateList();
if(CollectionUtil.isNotEmpty(budgetAmtUpdateList)){ if(CollectionUtil.isNotEmpty(budgetAmtUpdateList)){

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

@ -0,0 +1,156 @@
<?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.qs.serve.modules.tbs.mapper.TbsBudgetChangeMapper">
<resultMap id="tbsBudgetChangeMap" type="com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo" >
<result property="budgetId" column="budget_id"/>
<result property="budgetChangeId" column="budget_change_id"/>
<result property="changeCode" column="change_code"/>
<result property="budgetTitle" column="budget_title"/>
<result property="newBudgetTitle" column="new_budget_title"/>
<result property="budgetNumber" column="budget_number"/>
<result property="budgetCheckState" column="budget_check_state"/>
<result property="subjectId" column="subject_id"/>
<result property="subjectCode" column="subject_code"/>
<result property="subjectName" column="subject_name"/>
<result property="centerType" column="center_type"/>
<result property="centerId" column="center_id"/>
<result property="centerCode" column="center_code"/>
<result property="centerName" column="center_name"/>
<result property="scheduleId" column="schedule_id"/>
<result property="scheduleCode" column="schedule_code"/>
<result property="scheduleName" column="schedule_name"/>
<result property="submitTime" column="submit_time"/>
<result property="syFormId" column="sy_form_id"/>
<result property="remark" column="remark"/>
<result property="userId" column="user_id"/>
<result property="userCode" column="user_code"/>
<result property="userName" column="user_name"/>
</resultMap>
<select id="selectChangeVoList" resultType="com.qs.serve.modules.tbs.common.dto.TbsBudgetChangeVo">
select
'apply' as type,
null as `budget_change_id`,
tbs_budget.`id` as budget_id,
null as `change_code`,
tbs_budget.`budget_code` as budget_title,
null as `new_budget_title`,
tbs_budget.`budget_number`,
tbs_budget.`budget_state`,
tbs_budget.`budget_check_state`,
tbs_budget.`subject_id`,
tbs_budget.`subject_code`,
tbs_budget.`subject_name`,
tbs_budget.`center_type`,
tbs_budget.`center_id`,
tbs_budget.`center_code`,
tbs_budget.`center_name`,
tbs_budget.`schedule_id`,
tbs_budget.`schedule_code`,
tbs_budget.`schedule_name`,
tbs_budget.`submit_time`,
tbs_budget.`user_id`,
tbs_budget.`user_code`,
tbs_budget.`user_name`,
tbs_budget.`remark`
from tbs_budget
where tbs_budget.del_flag = 0 and `tbs_budget`.`budget_check_state` != 0
<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.budgetCheckState != null"> and `tbs_budget`.`budget_check_state` = #{query.budgetCheckState}</if>
<if test="query.subjectCode != null and query.subjectCode != ''"> and `tbs_budget`.`subject_code` like concat('%',#{query.subjectCode},'%') </if>
<if test="query.subjectName != null and query.subjectName != ''"> and `tbs_budget`.`subject_name` like concat('%',#{query.subjectName},'%') </if>
<if test="query.centerCode != null and query.centerCode != ''"> and `tbs_budget`.`center_code` like concat('%',#{query.centerCode},'%') </if>
<if test="query.centerName != null and query.centerName != ''"> and `tbs_budget`.`center_name` like concat('%',#{query.centerName},'%') </if>
<if test="query.userId != null and query.userId != ''"> and `tbs_budget`.`user_id` = #{query.userId}</if>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_budget`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `tbs_budget`.`user_name` like concat('%',#{query.userName},'%')</if>
union
select
'change' as type,
tbs_budget_change.`id` as budget_change_id,
tbs_budget_change.`budget_id`,
tbs_budget_change.`change_code`,
tbs_budget_change.`budget_title`,
tbs_budget_change.`new_budget_title`,
tbs_budget_change.`budget_number`,
null as budget_state,
tbs_budget_change.`budget_check_state`,
tbs_budget_change.`subject_id`,
tbs_budget_change.`subject_code`,
tbs_budget_change.`subject_name`,
tbs_budget_change.`center_type`,
tbs_budget_change.`center_id`,
tbs_budget_change.`center_code`,
tbs_budget_change.`center_name`,
tbs_budget_change.`schedule_id`,
tbs_budget_change.`schedule_code`,
tbs_budget_change.`schedule_name`,
tbs_budget_change.`submit_time`,
tbs_budget_change.`remark`,
tbs_budget_change.`user_id`,
tbs_budget_change.`user_code`,
tbs_budget_change.`user_name`
from tbs_budget_change
where tbs_budget_change.del_flag = 0
<if test="query.code != null and query.code != ''">
and (`tbs_budget_change`.`change_code` like concat('%',#{query.code},'%')
or `tbs_budget_change`.`budget_number` like concat('%',#{query.code},'%') )
</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.subjectCode != null and query.subjectCode != ''"> and `tbs_budget_change`.`subject_code` like concat('%',#{query.subjectCode},'%') </if>
<if test="query.subjectName != null and query.subjectName != ''"> and `tbs_budget_change`.`subject_name` like concat('%',#{query.subjectName},'%') </if>
<if test="query.centerCode != null and query.centerCode != ''"> and `tbs_budget_change`.`center_code` like concat('%',#{query.centerCode},'%') </if>
<if test="query.centerName != null and query.centerName != ''"> and `tbs_budget_change`.`center_name` like concat('%',#{query.centerName},'%') </if>
<if test="query.userId != null and query.userId != ''"> and `tbs_budget_change`.`user_id` = #{query.userId}</if>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_budget_change`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `tbs_budget_change`.`user_name` like concat('%',#{query.userName},'%')</if>
limit #{query.startRow},#{query.pageSize}
</select>
<select id="countChangeVo" resultType="java.lang.Long">
select count(0) from (
select
null as `budget_change_id`,
tbs_budget.`id` as budget_id
from tbs_budget
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.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.subjectCode != null and query.subjectCode != ''"> and `tbs_budget`.`subject_code` like concat('%',#{query.subjectCode},'%') </if>
<if test="query.subjectName != null and query.subjectName != ''"> and `tbs_budget`.`subject_name` like concat('%',#{query.subjectName},'%') </if>
<if test="query.centerCode != null and query.centerCode != ''"> and `tbs_budget`.`center_code` like concat('%',#{query.centerCode},'%') </if>
<if test="query.centerName != null and query.centerName != ''"> and `tbs_budget`.`center_name` like concat('%',#{query.centerName},'%') </if>
<if test="query.userId != null and query.userId != ''"> and `tbs_budget`.`user_id` = #{query.userId}</if>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_budget`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `tbs_budget`.`user_name` like concat('%',#{query.userName},'%')</if>
union
select
tbs_budget_change.`id` as budget_change_id,
tbs_budget_change.`budget_id`
from tbs_budget_change
where tbs_budget_change.del_flag = 0
<if test="query.code != null and query.code != ''">
and (`tbs_budget_change`.`change_code` like concat('%',#{query.code},'%')
or `tbs_budget_change`.`budget_number` like concat('%',#{query.code},'%') )
</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.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.subjectName != null and query.subjectName != ''"> and `tbs_budget_change`.`subject_name` like concat('%',#{query.subjectName},'%') </if>
<if test="query.centerCode != null and query.centerCode != ''"> and `tbs_budget_change`.`center_code` like concat('%',#{query.centerCode},'%') </if>
<if test="query.centerName != null and query.centerName != ''"> and `tbs_budget_change`.`center_name` like concat('%',#{query.centerName},'%') </if>
<if test="query.userId != null and query.userId != ''"> and `tbs_budget_change`.`user_id` = #{query.userId}</if>
<if test="query.userCode != null and query.userCode != ''"> and `tbs_budget_change`.`user_code` like concat('%',#{query.userCode},'%')</if>
<if test="query.userName != null and query.userName != ''"> and `tbs_budget_change`.`user_name` like concat('%',#{query.userName},'%')</if>
) tmp_tbs_budget
</select>
</mapper>
Loading…
Cancel
Save