10 changed files with 358 additions and 0 deletions
@ -0,0 +1,92 @@ |
|||||
|
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 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.TbsBudgetBatch; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetBatchService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 预算 批量申请 |
||||
|
* @author YenHex |
||||
|
* @since 2023-08-24 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("tbs/budgetBatch") |
||||
|
public class TbsBudgetBatchController { |
||||
|
|
||||
|
private TbsBudgetBatchService tbsBudgetBatchService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/list")
|
||||
|
//@PreAuthorize("hasRole('tbs:budgetBatch:query')")
|
||||
|
public R<List<TbsBudgetBatch>> getList(TbsBudgetBatch param){ |
||||
|
LambdaQueryWrapper<TbsBudgetBatch> lqw = new LambdaQueryWrapper<>(param); |
||||
|
List<TbsBudgetBatch> list = tbsBudgetBatchService.list(lqw); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/page")
|
||||
|
//@PreAuthorize("hasRole('tbs:budgetBatch:query')")
|
||||
|
public R<PageVo<TbsBudgetBatch>> getPage(TbsBudgetBatch param){ |
||||
|
LambdaQueryWrapper<TbsBudgetBatch> lqw = new LambdaQueryWrapper<>(param); |
||||
|
PageUtil.startPage(); |
||||
|
List<TbsBudgetBatch> list = tbsBudgetBatchService.list(lqw); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.Budget, title = "批量申请", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('tbs:budgetBatch:query')") |
||||
|
public R<TbsBudgetBatch> getById(@PathVariable("id") String id){ |
||||
|
TbsBudgetBatch tbsBudgetBatch = tbsBudgetBatchService.getById(id); |
||||
|
return R.ok(tbsBudgetBatch); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/commit") |
||||
|
@SysLog(module = SystemModule.Budget, title = "批量申请", biz = BizType.INSERT) |
||||
|
public R<?> commit(@RequestBody @Valid TbsBudgetBatch param){ |
||||
|
TbsBudgetBatch entity = CopierUtil.copy(param,new TbsBudgetBatch()); |
||||
|
boolean result = tbsBudgetBatchService.save(entity); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,122 @@ |
|||||
|
package com.qs.serve.modules.tbs.entity; |
||||
|
|
||||
|
import java.time.LocalDate; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* 批量申请项 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2023-08-24 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("tbs_budget_batch_item") |
||||
|
public class TbsBudgetBatchItem implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 批次id */ |
||||
|
private Long batchId; |
||||
|
|
||||
|
/** 预算id */ |
||||
|
@NotNull(message = "预算id不能为空") |
||||
|
private Long budgetId; |
||||
|
|
||||
|
/** 预算更变记录id */ |
||||
|
private Long changeId; |
||||
|
|
||||
|
/** 状态 */ |
||||
|
@NotNull(message = "状态不能为空") |
||||
|
private Integer batchState; |
||||
|
|
||||
|
/** 用户id */ |
||||
|
@Length(max = 255,message = "用户id长度不能超过255字") |
||||
|
private String userId; |
||||
|
|
||||
|
/** 用户编码 */ |
||||
|
@Length(max = 255,message = "用户编码长度不能超过255字") |
||||
|
private String userCode; |
||||
|
|
||||
|
/** 用户 */ |
||||
|
@Length(max = 255,message = "用户长度不能超过255字") |
||||
|
private String userName; |
||||
|
|
||||
|
/** 提交审批时间 */ |
||||
|
@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; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@Length(max = 255,message = "备注长度不能超过255字") |
||||
|
private String remark; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@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; |
||||
|
|
||||
|
|
||||
|
public static TbsBudgetBatchItem toNewObject(TbsBudgetBatchItem source){ |
||||
|
TbsBudgetBatchItem budgetBatchItem = new TbsBudgetBatchItem(); |
||||
|
budgetBatchItem.setId(source.getId()); |
||||
|
budgetBatchItem.setBudgetId(source.getBudgetId()); |
||||
|
budgetBatchItem.setChangeId(source.getChangeId()); |
||||
|
budgetBatchItem.setBatchState(source.getBatchState()); |
||||
|
budgetBatchItem.setUserId(source.getUserId()); |
||||
|
budgetBatchItem.setUserCode(source.getUserCode()); |
||||
|
budgetBatchItem.setUserName(source.getUserName()); |
||||
|
budgetBatchItem.setSubmitTime(source.getSubmitTime()); |
||||
|
budgetBatchItem.setRemark(source.getRemark()); |
||||
|
budgetBatchItem.setCreateTime(source.getCreateTime()); |
||||
|
budgetBatchItem.setUpdateTime(source.getUpdateTime()); |
||||
|
budgetBatchItem.setTenantId(source.getTenantId()); |
||||
|
budgetBatchItem.setCreateBy(source.getCreateBy()); |
||||
|
budgetBatchItem.setUpdateBy(source.getUpdateBy()); |
||||
|
budgetBatchItem.setDelFlag(source.getDelFlag()); |
||||
|
return budgetBatchItem; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,8 @@ |
|||||
|
package com.qs.serve.modules.tbs.entity.bo; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/8/24 |
||||
|
*/ |
||||
|
public class TbsBudgetBatchBo { |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.tbs.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetBatchItem; |
||||
|
|
||||
|
/** |
||||
|
* 批量申请项 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2023-08-24 |
||||
|
*/ |
||||
|
public interface TbsBudgetBatchItemMapper extends BaseMapper<TbsBudgetBatchItem> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.tbs.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetBatchItem; |
||||
|
|
||||
|
/** |
||||
|
* 批量申请项 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2023-08-24 |
||||
|
*/ |
||||
|
public interface TbsBudgetBatchItemService extends IService<TbsBudgetBatchItem> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.tbs.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetBatchItem; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetBatchItemService; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetBatchItemMapper; |
||||
|
|
||||
|
/** |
||||
|
* 批量申请项 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2023-08-24 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsBudgetBatchItemServiceImpl extends ServiceImpl<TbsBudgetBatchItemMapper,TbsBudgetBatchItem> implements TbsBudgetBatchItemService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,71 @@ |
|||||
|
package com.qs.serve.modules.tbs.service.impl; |
||||
|
|
||||
|
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.TbsBudgetBatch; |
||||
|
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetBatchService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 预算导入申请底层方法 |
||||
|
* @author YenHex |
||||
|
* @since 2023/8/24 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsBudgetBatchOperationServiceImpl implements SeeYonOperationService { |
||||
|
|
||||
|
private final TbsBudgetBatchService budgetBatchService; |
||||
|
|
||||
|
@Override |
||||
|
public String getTemplateCode() { |
||||
|
return TbsSeeYonConst.BudgetBatchApplyConf.Code(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getSyFormIdByTargetInfo(TbsAffairCommitBo affairCommit) { |
||||
|
TbsBudgetBatch budgetBatch = budgetBatchService.getById(affairCommit.getTargetId()); |
||||
|
if (!budgetBatch.getBatchState().equals(TbsBudgetCheckState.State_1_apply)) { |
||||
|
Assert.throwEx("操作失败,预算处于非审批状态"); |
||||
|
} |
||||
|
return budgetBatch.getSyFormId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doBacked(TbsAffairCommitBo param) { |
||||
|
//业务待定
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doFinished(TbsAffairCommitBo param) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object doRefuse(TbsAffairCommitBo param) { |
||||
|
TbsBudgetBatch budgetBatch = budgetBatchService.getById(param.getTargetId()); |
||||
|
budgetBatch.setBatchState(TbsBudgetCheckState.State_4_stop); |
||||
|
//退回草稿
|
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean checkSyFormIdIsNotNull(String targetId) { |
||||
|
TbsBudgetBatch budgetBatch = budgetBatchService.getById(targetId); |
||||
|
return budgetBatch.getSyFormId()!=null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void doCommitBacked(String targetId) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue