Compare commits
2 Commits
d27c764583
...
9abc53d878
Author | SHA1 | Date |
---|---|---|
zhangsiqi | 9abc53d878 | 3 months ago |
zhangsiqi | cbcd867a69 | 3 months ago |
13 changed files with 1336 additions and 243 deletions
@ -0,0 +1,101 @@ |
|||||
|
package com.ruoyi.financial.domain.VO; |
||||
|
|
||||
|
import com.ruoyi.financial.domain.FinacialExpense; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class FinacialExpenseVo extends FinacialExpense { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
/** 申请人姓名 */ |
||||
|
private String applyUserName; |
||||
|
/** 任务ID */ |
||||
|
private String taskId; |
||||
|
/** 任务名称 */ |
||||
|
private String taskName; |
||||
|
/** 办理时间 */ |
||||
|
private Date doneTime; |
||||
|
/** 创建人 */ |
||||
|
private String createUserName; |
||||
|
/** 流程实例状态 1 激活 2 挂起 */ |
||||
|
private String suspendState; |
||||
|
/** 待办用户id */ |
||||
|
private String todoUserId; |
||||
|
/** 流程实例类型名称 */ |
||||
|
private String instanceTypeName; |
||||
|
/** |
||||
|
* 关键词 |
||||
|
*/ |
||||
|
private String keyword; |
||||
|
|
||||
|
public String getKeyword() { |
||||
|
return keyword; |
||||
|
} |
||||
|
|
||||
|
public void setKeyword(String keyword) { |
||||
|
this.keyword = keyword; |
||||
|
} |
||||
|
|
||||
|
public String getApplyUserName() { |
||||
|
return applyUserName; |
||||
|
} |
||||
|
|
||||
|
public void setApplyUserName(String applyUserName) { |
||||
|
this.applyUserName = applyUserName; |
||||
|
} |
||||
|
|
||||
|
public String getTaskId() { |
||||
|
return taskId; |
||||
|
} |
||||
|
|
||||
|
public void setTaskId(String taskId) { |
||||
|
this.taskId = taskId; |
||||
|
} |
||||
|
|
||||
|
public String getTaskName() { |
||||
|
return taskName; |
||||
|
} |
||||
|
|
||||
|
public void setTaskName(String taskName) { |
||||
|
this.taskName = taskName; |
||||
|
} |
||||
|
|
||||
|
public Date getDoneTime() { |
||||
|
return doneTime; |
||||
|
} |
||||
|
|
||||
|
public void setDoneTime(Date doneTime) { |
||||
|
this.doneTime = doneTime; |
||||
|
} |
||||
|
|
||||
|
public String getCreateUserName() { |
||||
|
return createUserName; |
||||
|
} |
||||
|
|
||||
|
public void setCreateUserName(String createUserName) { |
||||
|
this.createUserName = createUserName; |
||||
|
} |
||||
|
|
||||
|
public String getSuspendState() { |
||||
|
return suspendState; |
||||
|
} |
||||
|
|
||||
|
public void setSuspendState(String suspendState) { |
||||
|
this.suspendState = suspendState; |
||||
|
} |
||||
|
|
||||
|
public String getTodoUserId() { |
||||
|
return todoUserId; |
||||
|
} |
||||
|
|
||||
|
public void setTodoUserId(String todoUserId) { |
||||
|
this.todoUserId = todoUserId; |
||||
|
} |
||||
|
|
||||
|
public String getInstanceTypeName() { |
||||
|
return instanceTypeName; |
||||
|
} |
||||
|
|
||||
|
public void setInstanceTypeName(String instanceTypeName) { |
||||
|
this.instanceTypeName = instanceTypeName; |
||||
|
} |
||||
|
} |
@ -0,0 +1,189 @@ |
|||||
|
package com.ruoyi.financial.service.impl; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.ruoyi.common.annotation.Excel; |
||||
|
import com.ruoyi.common.core.domain.BaseEntity; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class FinacialExpenseChild extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 报销单分项子表 */ |
||||
|
private Long expenseChildId; |
||||
|
|
||||
|
/** 关联报销单号 */ |
||||
|
@Excel(name = "关联报销单号") |
||||
|
private String expenseCode; |
||||
|
|
||||
|
/** 成本类型 */ |
||||
|
@Excel(name = "成本类型") |
||||
|
private String costType; |
||||
|
|
||||
|
/** 成本小类 */ |
||||
|
@Excel(name = "成本小类") |
||||
|
private String costSmallType; |
||||
|
|
||||
|
/** 用途 */ |
||||
|
@Excel(name = "用途") |
||||
|
private String purpose; |
||||
|
|
||||
|
/** 金额 */ |
||||
|
@Excel(name = "金额") |
||||
|
private String amounts; |
||||
|
|
||||
|
/** 报销时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
@Excel(name = "报销时间", width = 30, dateFormat = "yyyy-MM-dd") |
||||
|
private Date expenseTime; |
||||
|
|
||||
|
/** 出差单号 */ |
||||
|
@Excel(name = "出差单号") |
||||
|
private String evectionCode; |
||||
|
|
||||
|
/** 采购单号 */ |
||||
|
@Excel(name = "采购单号") |
||||
|
private String purchaseCode; |
||||
|
|
||||
|
/** 委外单号 */ |
||||
|
@Excel(name = "委外单号") |
||||
|
private String outsourceCode; |
||||
|
|
||||
|
/** 删除状态 */ |
||||
|
private String delFlag; |
||||
|
|
||||
|
private Integer index; |
||||
|
|
||||
|
public void setExpenseChildId(Long expenseChildId) |
||||
|
{ |
||||
|
this.expenseChildId = expenseChildId; |
||||
|
} |
||||
|
|
||||
|
public Long getExpenseChildId() |
||||
|
{ |
||||
|
return expenseChildId; |
||||
|
} |
||||
|
public void setExpenseCode(String expenseCode) |
||||
|
{ |
||||
|
this.expenseCode = expenseCode; |
||||
|
} |
||||
|
|
||||
|
public String getExpenseCode() |
||||
|
{ |
||||
|
return expenseCode; |
||||
|
} |
||||
|
public void setCostType(String costType) |
||||
|
{ |
||||
|
this.costType = costType; |
||||
|
} |
||||
|
|
||||
|
public String getCostType() |
||||
|
{ |
||||
|
return costType; |
||||
|
} |
||||
|
public void setCostSmallType(String costSmallType) |
||||
|
{ |
||||
|
this.costSmallType = costSmallType; |
||||
|
} |
||||
|
|
||||
|
public String getCostSmallType() |
||||
|
{ |
||||
|
return costSmallType; |
||||
|
} |
||||
|
public void setPurpose(String purpose) |
||||
|
{ |
||||
|
this.purpose = purpose; |
||||
|
} |
||||
|
|
||||
|
public String getPurpose() |
||||
|
{ |
||||
|
return purpose; |
||||
|
} |
||||
|
public void setAmounts(String amounts) |
||||
|
{ |
||||
|
this.amounts = amounts; |
||||
|
} |
||||
|
|
||||
|
public String getAmounts() |
||||
|
{ |
||||
|
return amounts; |
||||
|
} |
||||
|
public void setExpenseTime(Date expenseTime) |
||||
|
{ |
||||
|
this.expenseTime = expenseTime; |
||||
|
} |
||||
|
|
||||
|
public Date getExpenseTime() |
||||
|
{ |
||||
|
return expenseTime; |
||||
|
} |
||||
|
public void setEvectionCode(String evectionCode) |
||||
|
{ |
||||
|
this.evectionCode = evectionCode; |
||||
|
} |
||||
|
|
||||
|
public String getEvectionCode() |
||||
|
{ |
||||
|
return evectionCode; |
||||
|
} |
||||
|
public void setPurchaseCode(String purchaseCode) |
||||
|
{ |
||||
|
this.purchaseCode = purchaseCode; |
||||
|
} |
||||
|
|
||||
|
public String getPurchaseCode() |
||||
|
{ |
||||
|
return purchaseCode; |
||||
|
} |
||||
|
public void setOutsourceCode(String outsourceCode) |
||||
|
{ |
||||
|
this.outsourceCode = outsourceCode; |
||||
|
} |
||||
|
|
||||
|
public String getOutsourceCode() |
||||
|
{ |
||||
|
return outsourceCode; |
||||
|
} |
||||
|
public void setDelFlag(String delFlag) |
||||
|
{ |
||||
|
this.delFlag = delFlag; |
||||
|
} |
||||
|
|
||||
|
public String getDelFlag() |
||||
|
{ |
||||
|
return delFlag; |
||||
|
} |
||||
|
|
||||
|
public Integer getIndex() { |
||||
|
return index; |
||||
|
} |
||||
|
|
||||
|
public void setIndex(Integer index) { |
||||
|
this.index = index; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("expenseChildId", getExpenseChildId()) |
||||
|
.append("expenseCode", getExpenseCode()) |
||||
|
.append("cost type", getCostType()) |
||||
|
.append("costSmallType", getCostSmallType()) |
||||
|
.append("purpose", getPurpose()) |
||||
|
.append("amounts", getAmounts()) |
||||
|
.append("expenseTime", getExpenseTime()) |
||||
|
.append("evectionCode", getEvectionCode()) |
||||
|
.append("purchaseCode", getPurchaseCode()) |
||||
|
.append("outsourceCode", getOutsourceCode()) |
||||
|
.append("createTime", getCreateTime()) |
||||
|
.append("createBy", getCreateBy()) |
||||
|
.append("updateBy", getUpdateBy()) |
||||
|
.append("updateTime", getUpdateTime()) |
||||
|
.append("delFlag", getDelFlag()) |
||||
|
.append("remark", getRemark()) |
||||
|
.toString(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -1,126 +0,0 @@ |
|||||
package com.ruoyi.financial.service.impl; |
|
||||
|
|
||||
import java.util.List; |
|
||||
import com.ruoyi.common.utils.DateUtils; |
|
||||
import com.ruoyi.common.utils.ShiroUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
import com.ruoyi.financial.mapper.FinacialExpenseMapper; |
|
||||
import com.ruoyi.financial.domain.FinacialExpense; |
|
||||
import com.ruoyi.financial.service.IFinacialExpenseService; |
|
||||
import com.ruoyi.common.core.text.Convert; |
|
||||
|
|
||||
/** |
|
||||
* 报销管理Service业务层处理 |
|
||||
* |
|
||||
* @author zhang |
|
||||
* @date 2024-05-31 |
|
||||
*/ |
|
||||
@Service |
|
||||
public class FinacialExpenseServiceImpl implements IFinacialExpenseService |
|
||||
{ |
|
||||
@Autowired |
|
||||
private FinacialExpenseMapper finacialExpenseMapper; |
|
||||
|
|
||||
/** |
|
||||
* 查询报销管理 |
|
||||
* |
|
||||
* @param expenseId 报销管理ID |
|
||||
* @return 报销管理 |
|
||||
*/ |
|
||||
@Override |
|
||||
public FinacialExpense selectFinacialExpenseById(Long expenseId) |
|
||||
{ |
|
||||
return finacialExpenseMapper.selectFinacialExpenseById(expenseId); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 查询报销管理列表 |
|
||||
* |
|
||||
* @param finacialExpense 报销管理 |
|
||||
* @return 报销管理 |
|
||||
*/ |
|
||||
@Override |
|
||||
public List<FinacialExpense> selectFinacialExpenseList(FinacialExpense finacialExpense) |
|
||||
{ |
|
||||
return finacialExpenseMapper.selectFinacialExpenseList(finacialExpense); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 新增报销管理 |
|
||||
* |
|
||||
* @param finacialExpense 报销管理 |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int insertFinacialExpense(FinacialExpense finacialExpense) |
|
||||
{ |
|
||||
String loginName = ShiroUtils.getLoginName(); |
|
||||
finacialExpense.setCreateBy(loginName); |
|
||||
finacialExpense.setCreateTime(DateUtils.getNowDate()); |
|
||||
return finacialExpenseMapper.insertFinacialExpense(finacialExpense); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 修改报销管理 |
|
||||
* |
|
||||
* @param finacialExpense 报销管理 |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int updateFinacialExpense(FinacialExpense finacialExpense) |
|
||||
{ |
|
||||
String loginName = ShiroUtils.getLoginName(); |
|
||||
finacialExpense.setUpdateBy(loginName); |
|
||||
finacialExpense.setUpdateTime(DateUtils.getNowDate()); |
|
||||
return finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 删除报销管理对象 |
|
||||
* |
|
||||
* @param ids 需要删除的数据ID |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int deleteFinacialExpenseByIds(String ids) |
|
||||
{ |
|
||||
return finacialExpenseMapper.deleteFinacialExpenseByIds(Convert.toStrArray(ids)); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 删除报销管理信息 |
|
||||
* |
|
||||
* @param expenseId 报销管理ID |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int deleteFinacialExpenseById(Long expenseId) |
|
||||
{ |
|
||||
return finacialExpenseMapper.deleteFinacialExpenseById(expenseId); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 作废报销管理 |
|
||||
* |
|
||||
* @param expenseId 报销管理ID |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int cancelFinacialExpenseById(Long expenseId) |
|
||||
{ |
|
||||
return finacialExpenseMapper.cancelFinacialExpenseById(expenseId); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 恢复报销管理信息 |
|
||||
* |
|
||||
* @param expenseId 报销管理ID |
|
||||
* @return 结果 |
|
||||
*/ |
|
||||
@Override |
|
||||
public int restoreFinacialExpenseById(Long expenseId) |
|
||||
{ |
|
||||
return finacialExpenseMapper.restoreFinacialExpenseById(expenseId); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,417 @@ |
|||||
|
package com.ruoyi.financial.service.impl; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
import com.github.pagehelper.Page; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.ruoyi.common.core.domain.entity.SysUser; |
||||
|
import com.ruoyi.common.core.page.PageDomain; |
||||
|
import com.ruoyi.common.core.page.TableSupport; |
||||
|
import com.ruoyi.common.core.redis.RedisCache; |
||||
|
import com.ruoyi.common.utils.DateUtils; |
||||
|
import com.ruoyi.common.utils.ShiroUtils; |
||||
|
import com.ruoyi.common.utils.StringUtils; |
||||
|
import com.ruoyi.financial.domain.FinacialExpense; |
||||
|
import com.ruoyi.financial.domain.VO.FinacialExpenseVo; |
||||
|
import com.ruoyi.financial.mapper.FinacialExpenseMapper; |
||||
|
import com.ruoyi.financial.service.IFinacialExpenseService; |
||||
|
import com.ruoyi.financial.service.impl.FinacialExpenseChild; |
||||
|
import com.ruoyi.process.general.service.IProcessService; |
||||
|
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; |
||||
|
import com.ruoyi.system.domain.Vo.BaseExpenseAccountVo; |
||||
|
import com.ruoyi.system.mapper.SysUserMapper; |
||||
|
import com.ruoyi.system.service.ISysRoleService; |
||||
|
import org.activiti.engine.TaskService; |
||||
|
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; |
||||
|
import org.activiti.engine.runtime.ProcessInstance; |
||||
|
import org.activiti.engine.task.Task; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.ruoyi.common.core.text.Convert; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
/** |
||||
|
* 报销单Service业务层处理 |
||||
|
* |
||||
|
* @author zhang |
||||
|
* @date 2024-05-20 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class FinancialExpenseServiceImpl implements IFinacialExpenseService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private FinacialExpenseMapper finacialExpenseMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private RedisCache redisCache; |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserMapper userMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private TaskService taskService; |
||||
|
|
||||
|
@Autowired |
||||
|
private BizTodoItemMapper todoItemMapper; |
||||
|
|
||||
|
@Autowired |
||||
|
private IProcessService processService; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISysRoleService roleService; |
||||
|
|
||||
|
/** |
||||
|
* 查询报销单 |
||||
|
* |
||||
|
* @param expenseId 报销单ID |
||||
|
* @return 报销单 |
||||
|
*/ |
||||
|
@Override |
||||
|
public FinacialExpenseVo selectFinacialExpenseById(Long expenseId) |
||||
|
{ |
||||
|
FinacialExpenseVo finacialExpenseVo = finacialExpenseMapper.selectFinacialExpenseById(expenseId); |
||||
|
SysUser sysUser2 = userMapper.selectUserByLoginName(finacialExpenseVo.getApplyUser()); |
||||
|
if (sysUser2!=null){ |
||||
|
finacialExpenseVo.setApplyUserName(sysUser2.getUserName()); |
||||
|
} |
||||
|
return finacialExpenseVo; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<FinacialExpense> selectFinacialExpenseList(FinacialExpense finacialExpense) { |
||||
|
return finacialExpenseMapper.selectFinacialExpenseList(finacialExpense); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询报销单列表 |
||||
|
* |
||||
|
* @param finacialExpense 报销单 |
||||
|
* @return 报销单 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<FinacialExpenseVo> selectFinacialExpenseList(FinacialExpenseVo finacialExpense) |
||||
|
{ |
||||
|
PageDomain pageDomain = TableSupport.buildPageRequest(); |
||||
|
Integer pageNum = pageDomain.getPageNum(); |
||||
|
Integer pageSize = pageDomain.getPageSize(); |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
//PageHelper 仅对第一List分页有效
|
||||
|
Page<FinacialExpenseVo> list = (Page<FinacialExpenseVo>) selectFinacialExpenseList(finacialExpense); |
||||
|
Page<FinacialExpenseVo> returnList = new Page<>(); |
||||
|
for(FinacialExpenseVo finacialExpenseVo : list){ |
||||
|
SysUser sysUser = userMapper.selectUserByLoginName(finacialExpenseVo.getCreateBy()); |
||||
|
if (sysUser != null) { |
||||
|
finacialExpenseVo.setCreateBy(sysUser.getUserName()); |
||||
|
} |
||||
|
SysUser sysUser2 = userMapper.selectUserByLoginName(finacialExpenseVo.getApplyUser()); |
||||
|
if (sysUser2!=null){ |
||||
|
finacialExpenseVo.setApplyUserName(sysUser2.getUserName()); |
||||
|
} |
||||
|
String instanceId = finacialExpenseVo.getInstanceId(); |
||||
|
// 当前环节
|
||||
|
if (StringUtils.isNotBlank(instanceId)) { |
||||
|
List<Task> taskList = taskService.createTaskQuery() |
||||
|
.processInstanceId(instanceId) |
||||
|
// .singleResult();
|
||||
|
.list(); // 例如请假会签,会同时拥有多个任务
|
||||
|
if (!CollectionUtils.isEmpty(taskList)) { |
||||
|
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0); |
||||
|
String taskId = task.getId(); |
||||
|
finacialExpenseVo.setTaskId(taskId); |
||||
|
// 设置待办用户
|
||||
|
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId); |
||||
|
if(!CollectionUtils.isEmpty(taskList)){ |
||||
|
finacialExpenseVo.setTodoUserId(String.join(",",todoUserList)); |
||||
|
} |
||||
|
if (task.getSuspensionState() == 2) { |
||||
|
finacialExpenseVo.setTaskName("已挂起"); |
||||
|
finacialExpenseVo.setSuspendState("2"); |
||||
|
} else { |
||||
|
finacialExpenseVo.setTaskName(task.getName()); |
||||
|
finacialExpenseVo.setSuspendState("1"); |
||||
|
} |
||||
|
} else { |
||||
|
// 已办结或者已撤销
|
||||
|
finacialExpenseVo.setTaskName("已结束"); |
||||
|
} |
||||
|
} else { |
||||
|
finacialExpenseVo.setTaskName("未启动"); |
||||
|
} |
||||
|
returnList.add(finacialExpenseVo); |
||||
|
} |
||||
|
returnList.setTotal(CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); |
||||
|
returnList.setPageNum(pageNum); |
||||
|
returnList.setPageSize(pageSize); |
||||
|
return returnList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增报销单 |
||||
|
* |
||||
|
* @param finacialExpense 报销单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertFinacialExpense(FinacialExpense finacialExpense) |
||||
|
{ |
||||
|
String loginName = ShiroUtils.getLoginName(); |
||||
|
finacialExpense.setCreateBy(loginName); |
||||
|
finacialExpense.setCreateTime(DateUtils.getNowDate()); |
||||
|
finacialExpense.setDelFlag("0"); |
||||
|
// finacialExpense.setExpenseCode(redisCache.generateBillNo("BX"));
|
||||
|
// List<FinacialExpenseChild> finacialExpenseChildList = finacialExpense.getExpenseAccountChildList();
|
||||
|
// if (!CollectionUtils.isEmpty(finacialExpenseChildList)) {
|
||||
|
// for (FinacialExpenseChild finacialExpenseChild :finacialExpenseChildList) {
|
||||
|
// finacialExpenseChild.setCreateBy(loginName);
|
||||
|
// finacialExpenseChild.setCreateTime(DateUtils.getNowDate());
|
||||
|
// //获取父表的单号
|
||||
|
// finacialExpenseChild.setExpenseCode(finacialExpense.getExpenseCode());
|
||||
|
// finacialExpenseChildService.insertFinacialExpenseChild(finacialExpenseChild);
|
||||
|
// }
|
||||
|
// }
|
||||
|
return finacialExpenseMapper.insertFinacialExpense(finacialExpense); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改报销单 (暂时去掉子表数据,后续添加) |
||||
|
* |
||||
|
* @param finacialExpense 报销单 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateFinacialExpense(FinacialExpense finacialExpense) |
||||
|
{ |
||||
|
String loginName = ShiroUtils.getLoginName(); |
||||
|
finacialExpense.setUpdateBy(loginName); |
||||
|
finacialExpense.setUpdateTime(DateUtils.getNowDate()); |
||||
|
finacialExpense.setDelFlag("0"); |
||||
|
// List<FinacialExpenseChild> finacialExpenseChildList = finacialExpense.getExpenseAccountChildList();
|
||||
|
// if (!CollectionUtils.isEmpty(finacialExpenseChildList)) {
|
||||
|
// finacialExpenseChildService.deleteFinacialExpenseChildByExpenseCode(finacialExpense.getExpenseCode());
|
||||
|
// for (FinacialExpenseChild finacialExpenseChild :finacialExpenseChildList) {
|
||||
|
// finacialExpenseChild.setCreateBy(loginName);
|
||||
|
// finacialExpenseChild.setCreateTime(DateUtils.getNowDate());
|
||||
|
// //获取父表的单号
|
||||
|
// finacialExpenseChild.setExpenseCode(finacialExpense.getExpenseCode());
|
||||
|
// finacialExpenseChildService.insertFinacialExpenseChild(finacialExpenseChild);
|
||||
|
// }
|
||||
|
// }
|
||||
|
return finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除报销单对象 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteFinacialExpenseByIds(String ids) |
||||
|
{ |
||||
|
return finacialExpenseMapper.deleteFinacialExpenseByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除报销单信息 |
||||
|
* |
||||
|
* @param expenseId 报销单ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteFinacialExpenseById(Long expenseId) |
||||
|
{ |
||||
|
return finacialExpenseMapper.deleteFinacialExpenseById(expenseId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 作废报销单 |
||||
|
* |
||||
|
* @param expenseId 报销单ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int cancelFinacialExpenseById(Long expenseId) |
||||
|
{ |
||||
|
return finacialExpenseMapper.cancelFinacialExpenseById(expenseId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 恢复报销单信息 |
||||
|
* |
||||
|
* @param expenseId 报销单ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int restoreFinacialExpenseById(Long expenseId) |
||||
|
{ |
||||
|
return finacialExpenseMapper.restoreFinacialExpenseById(expenseId); |
||||
|
} |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ProcessInstance cancelSysCustomerById(Long id) { |
||||
|
FinacialExpenseVo finacialExpenseVo = finacialExpenseMapper.selectFinacialExpenseById(id); |
||||
|
// 审核状态-待审核
|
||||
|
finacialExpenseVo.setAuditStatus("0"); |
||||
|
SysUser user = ShiroUtils.getSysUser(); |
||||
|
// 启动流程
|
||||
|
String applyTitle = user.getUserName()+"发起了客户信息作废审批-"+ DateUtils.dateTimeNow(); |
||||
|
String instanceType = "cancel"; |
||||
|
FinacialExpense finacialExpense = new FinacialExpense(); |
||||
|
BeanUtils.copyProperties(finacialExpenseVo,finacialExpense); |
||||
|
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,finacialExpense, user); |
||||
|
String processInstanceId = processInstance.getProcessInstanceId(); |
||||
|
// 作废实例id
|
||||
|
finacialExpense.setCancelInstanceId(processInstanceId); |
||||
|
// 存在提交完就流程结束的情况
|
||||
|
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); |
||||
|
if(processIsFinish){ |
||||
|
// 审核状态-审核通过
|
||||
|
finacialExpense.setAuditStatus("1"); |
||||
|
// 使用状态-已作废
|
||||
|
finacialExpense.setUseStatus("2"); |
||||
|
} |
||||
|
finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
||||
|
return processInstance; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ProcessInstance restoreSysCustomerById(Long id) { |
||||
|
FinacialExpenseVo finacialExpenseVo = finacialExpenseMapper.selectFinacialExpenseById(id); |
||||
|
// 审核状态-待审核
|
||||
|
finacialExpenseVo.setAuditStatus("0"); |
||||
|
SysUser user = ShiroUtils.getSysUser(); |
||||
|
// 启动流程
|
||||
|
String applyTitle = user.getUserName()+"发起了客户恢复审批-"+DateUtils.dateTimeNow(); |
||||
|
String instanceType = "restore"; |
||||
|
FinacialExpense finacialExpense = new FinacialExpense(); |
||||
|
BeanUtils.copyProperties(finacialExpenseVo,finacialExpense); |
||||
|
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,finacialExpense, user); |
||||
|
String processInstanceId = processInstance.getProcessInstanceId(); |
||||
|
// 恢复实例id
|
||||
|
finacialExpense.setRestoreInstanceId(processInstanceId); |
||||
|
// 存在提交完就流程结束的情况
|
||||
|
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); |
||||
|
if(processIsFinish){ |
||||
|
// 审核状态-审核通过
|
||||
|
finacialExpense.setAuditStatus("1"); |
||||
|
// 使用状态-是
|
||||
|
finacialExpense.setUseStatus("1"); |
||||
|
} |
||||
|
finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
||||
|
return processInstance; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 提交申请 |
||||
|
* @param finacialExpense |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ProcessInstance submitApply(FinacialExpense finacialExpense) { |
||||
|
SysUser user = ShiroUtils.getSysUser(); |
||||
|
finacialExpense.setApplyUser(user.getLoginName()); |
||||
|
finacialExpense.setApplyTime(DateUtils.getNowDate()); |
||||
|
insertFinacialExpense(finacialExpense); |
||||
|
if (finacialExpense.getExpenseId() == null || finacialExpense.getExpenseId() == 0){ |
||||
|
insertFinacialExpense(finacialExpense); |
||||
|
} |
||||
|
// 启动流程
|
||||
|
String applyTitle = user.getUserName()+"发起了报销管理提交审批-"+DateUtils.dateTimeNow(); |
||||
|
String instanceType = "submit"; |
||||
|
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,finacialExpense, user); |
||||
|
String processInstanceId = processInstance.getProcessInstanceId(); |
||||
|
// 提交实例id
|
||||
|
finacialExpense.setSubmitInstanceId(processInstanceId); |
||||
|
// 存在提交完就流程结束的情况
|
||||
|
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); |
||||
|
if(processIsFinish){ |
||||
|
// 审核状态-审核通过
|
||||
|
finacialExpense.setAuditStatus("1"); |
||||
|
// 使用状态-是
|
||||
|
finacialExpense.setUseStatus("1"); |
||||
|
//设置财务审核状态
|
||||
|
finacialExpense.setFinanceAuditStatus("1"); |
||||
|
|
||||
|
} |
||||
|
finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
||||
|
return processInstance; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, FinacialExpense finacialExpense, SysUser user) { |
||||
|
Long expenseId = finacialExpense.getExpenseId(); |
||||
|
String businessKey = expenseId.toString(); // 实体类 ID,作为流程的业务 key
|
||||
|
String key = "expense"; |
||||
|
Map<String,Object> variables = new HashMap<>(); |
||||
|
// 构造authority传参
|
||||
|
buildAuthority(user, variables); |
||||
|
finacialExpense.setApplyTitle(applyTitle); |
||||
|
// 启动流程
|
||||
|
ProcessInstance processInstance = processService.submitApply(user.getLoginName(), businessKey, applyTitle, |
||||
|
finacialExpense.getExpenseCode(), key, variables); |
||||
|
String processInstanceId = processInstance.getId(); |
||||
|
finacialExpense.setInstanceId(processInstanceId); // 建立双向关系
|
||||
|
finacialExpense.setInstanceType(instanceType); |
||||
|
return processInstance; |
||||
|
} |
||||
|
|
||||
|
private void buildAuthority(SysUser user, Map<String, Object> variables) { |
||||
|
Set<String> roleKeys = roleService.selectRoleKeys(user.getUserId()); |
||||
|
variables.put("authority",1); |
||||
|
//判断请购人的角色,进入相应的逻辑,设置节点审批人变量
|
||||
|
} |
||||
|
@Override |
||||
|
public Object getId() { |
||||
|
return redisCache.generateBillNo("BX"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int insertFinacialExpense(BaseExpenseAccountVo baseExpenseAccountVo) { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
public ProcessInstance submitApply(BaseExpenseAccountVo baseExpenseAccountVo) { |
||||
|
//将对应的baseExpense数据插入到finacial_expense表
|
||||
|
FinacialExpense finacialExpense = new FinacialExpense(); |
||||
|
BeanUtils.copyProperties(baseExpenseAccountVo,finacialExpense); |
||||
|
finacialExpense.setFinanceAuditStatus("1"); |
||||
|
SysUser user = ShiroUtils.getSysUser(); |
||||
|
finacialExpense.setApplyUser(user.getLoginName()); |
||||
|
finacialExpense.setApplyTime(DateUtils.getNowDate()); |
||||
|
insertFinacialExpense(finacialExpense); |
||||
|
if (finacialExpense.getExpenseId() == null || finacialExpense.getExpenseId() == 0){ |
||||
|
insertFinacialExpense(finacialExpense); |
||||
|
} |
||||
|
// 启动流程
|
||||
|
String applyTitle = user.getUserName()+"发起了报销管理提交审批-"+DateUtils.dateTimeNow(); |
||||
|
String instanceType = "submit"; |
||||
|
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,finacialExpense, user); |
||||
|
String processInstanceId = processInstance.getProcessInstanceId(); |
||||
|
// 提交实例id
|
||||
|
finacialExpense.setSubmitInstanceId(processInstanceId); |
||||
|
// 存在提交完就流程结束的情况
|
||||
|
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); |
||||
|
if(processIsFinish){ |
||||
|
// 审核状态-审核通过
|
||||
|
finacialExpense.setAuditStatus("1"); |
||||
|
// 使用状态-是
|
||||
|
finacialExpense.setUseStatus("1"); |
||||
|
//设置财务审核状态
|
||||
|
finacialExpense.setFinanceAuditStatus("1"); |
||||
|
|
||||
|
} |
||||
|
finacialExpenseMapper.updateFinacialExpense(finacialExpense); |
||||
|
return processInstance; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.ruoyi.system.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.ruoyi.system.domain.BaseExpenseConfirmAmount; |
||||
|
|
||||
|
/** |
||||
|
* 报销打款记录Service接口 |
||||
|
* |
||||
|
* @author zhang |
||||
|
* @date 2024-09-06 |
||||
|
*/ |
||||
|
public interface IBaseExpenseConfirmAmountService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询报销打款记录 |
||||
|
* |
||||
|
* @param expenseAmountId 报销打款记录ID |
||||
|
* @return 报销打款记录 |
||||
|
*/ |
||||
|
public BaseExpenseConfirmAmount selectBaseExpenseConfirmAmountById(Long expenseAmountId); |
||||
|
|
||||
|
/** |
||||
|
* 查询报销打款记录列表 |
||||
|
* |
||||
|
* @param baseExpenseConfirmAmount 报销打款记录 |
||||
|
* @return 报销打款记录集合 |
||||
|
*/ |
||||
|
public List<BaseExpenseConfirmAmount> selectBaseExpenseConfirmAmountList(BaseExpenseConfirmAmount baseExpenseConfirmAmount); |
||||
|
|
||||
|
/** |
||||
|
* 新增报销打款记录 |
||||
|
* |
||||
|
* @param baseExpenseConfirmAmount 报销打款记录 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertBaseExpenseConfirmAmount(BaseExpenseConfirmAmount baseExpenseConfirmAmount); |
||||
|
|
||||
|
/** |
||||
|
* 修改报销打款记录 |
||||
|
* |
||||
|
* @param baseExpenseConfirmAmount 报销打款记录 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateBaseExpenseConfirmAmount(BaseExpenseConfirmAmount baseExpenseConfirmAmount); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除报销打款记录 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteBaseExpenseConfirmAmountByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除报销打款记录信息 |
||||
|
* |
||||
|
* @param expenseAmountId 报销打款记录ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteBaseExpenseConfirmAmountById(Long expenseAmountId); |
||||
|
|
||||
|
/** |
||||
|
* 作废报销打款记录 |
||||
|
* @param expenseAmountId 报销打款记录ID |
||||
|
* @return |
||||
|
*/ |
||||
|
int cancelBaseExpenseConfirmAmountById(Long expenseAmountId); |
||||
|
|
||||
|
/** |
||||
|
* 恢复报销打款记录 |
||||
|
* @param expenseAmountId 报销打款记录ID |
||||
|
* @return |
||||
|
*/ |
||||
|
int restoreBaseExpenseConfirmAmountById(Long expenseAmountId); |
||||
|
} |
Loading…
Reference in new issue