15 changed files with 545 additions and 4 deletions
@ -0,0 +1,60 @@ |
|||
package com.yxt.anrui.fin.api.fincostapply; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/4 18:07 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class AppFinCostApplyVo implements Vo { |
|||
private static final long serialVersionUID = 7253342244052642678L; |
|||
|
|||
@ApiModelProperty("费用名称") |
|||
private String costTitleValue; |
|||
|
|||
@ApiModelProperty("创建时间") |
|||
private String createTime; |
|||
|
|||
//申请人
|
|||
private String name; |
|||
|
|||
//费用类型
|
|||
private String costTypeValue; |
|||
|
|||
//申请费用
|
|||
private String cost; |
|||
|
|||
//使用方式
|
|||
private String useTypeValue; |
|||
|
|||
//备注
|
|||
private String remarks; |
|||
|
|||
//是否涉及车辆
|
|||
@ApiModelProperty("是否涉及车辆:1是,0否") |
|||
private Boolean isVeh; |
|||
|
|||
//涉及车辆
|
|||
private String vins; |
|||
|
|||
//任务id
|
|||
private String taskId; |
|||
|
|||
//实例id
|
|||
private String procInstId; |
|||
|
|||
private String sid; |
|||
|
|||
@ApiModelProperty("是否需要出门:1是,0否.如果涉及车辆,则选择是否需要出门") |
|||
private String isOutDoor; |
|||
|
|||
@ApiModelProperty("创建人sid") |
|||
private String createBySid; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,57 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply; |
|||
|
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyDto; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyQuery; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyTaskQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.cloud.openfeign.SpringQueryMap; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/4 19:11 |
|||
* @Description |
|||
*/ |
|||
@Api(tags = "费用申请") |
|||
@FeignClient( |
|||
contextId = "terminal-CostApply", |
|||
name = "anrui-terminal", |
|||
path = "/finance/v1/costApply", |
|||
fallback = CostApplyFeignFallback.class) |
|||
public interface CostApplyFeign { |
|||
|
|||
@ApiOperation("费用申请详情") |
|||
@GetMapping("/getCostApply/{sid}") |
|||
@ResponseBody |
|||
ResultBean<CostDetailsVo> getCostApply(@PathVariable("sid") String sid); |
|||
|
|||
@ApiOperation("办理") |
|||
@PutMapping("/agreeCostApplyInfo") |
|||
@ResponseBody |
|||
ResultBean agreeCostApplyInfo(@RequestBody CostApplyDto dto); |
|||
|
|||
@ApiOperation("驳回") |
|||
@PutMapping("/rejectCostApplyInfo") |
|||
@ResponseBody |
|||
ResultBean rejectCostApplyInfo(@RequestBody CostApplyTaskQuery query); |
|||
|
|||
@ApiOperation("撤回") |
|||
@PutMapping("/recallCostApplyInfo") |
|||
@ResponseBody |
|||
ResultBean recallCostApplyInfo(@RequestBody CostApplyTaskQuery query); |
|||
|
|||
@ApiOperation("终止") |
|||
@PutMapping("/stopCostApplyInfo") |
|||
@ResponseBody |
|||
ResultBean stopCostApplyInfo(@RequestBody CostApplyTaskQuery query); |
|||
|
|||
@ApiOperation("获取流程操作标题") |
|||
@GetMapping("/getFlowOperateTitle") |
|||
@ResponseBody |
|||
ResultBean<String> getFlowOperateTitle(@SpringQueryMap CostApplyQuery query); |
|||
|
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/4 19:20 |
|||
* @Description |
|||
*/ |
|||
public class CostApplyFeignFallback { |
|||
} |
@ -0,0 +1,66 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/4 18:58 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class CostDetailsVo implements Vo { |
|||
private static final long serialVersionUID = 4230232069904074647L; |
|||
|
|||
@ApiModelProperty("费用名称") |
|||
@JsonProperty("applyName") |
|||
private String costTitleValue; |
|||
|
|||
@ApiModelProperty("创建时间") |
|||
@JsonProperty("applyDate") |
|||
private String createTime; |
|||
|
|||
//申请人
|
|||
@JsonProperty("applicant") |
|||
private String name; |
|||
|
|||
//费用类型
|
|||
@JsonProperty("costType") |
|||
private String costTypeValue; |
|||
|
|||
//申请费用
|
|||
@JsonProperty("applyPrice") |
|||
private String cost; |
|||
|
|||
//使用方式
|
|||
@JsonProperty("useType") |
|||
private String useTypeValue; |
|||
|
|||
//备注
|
|||
private String remarks; |
|||
|
|||
//是否涉及车辆
|
|||
|
|||
private boolean isVeh; |
|||
|
|||
|
|||
@ApiModelProperty(value = "车架号") |
|||
private String vins; |
|||
|
|||
//任务id
|
|||
private String taskId; |
|||
|
|||
//实例id
|
|||
@JsonProperty("procInsId") |
|||
private String procInstId; |
|||
|
|||
private String sid; |
|||
@ApiModelProperty("是否需要出门") |
|||
@JsonProperty("vinState") |
|||
private String isOutDoor; |
|||
@JsonProperty("userSid") |
|||
private String createBySid; |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply.flowable; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.yxt.common.core.dto.Dto; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/4 18:06 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class CostApplyDto implements Dto { |
|||
private static final long serialVersionUID = -5698304783095155182L; |
|||
|
|||
@ApiModelProperty(value = "任务id") |
|||
@NotBlank(message = "参数错误:taskId") |
|||
private String taskId; |
|||
@ApiModelProperty(value = "流程id") |
|||
@NotBlank(message = "参数错误:procInsId") |
|||
@JsonProperty("procInsId") |
|||
private String instanceId; |
|||
@ApiModelProperty(value = "意见") |
|||
private String comment; |
|||
@ApiModelProperty(value = "业务sid") |
|||
@NotBlank(message = "参数错误:businessSid") |
|||
private String businessSid; |
|||
@ApiModelProperty(value = "用户sid") |
|||
@NotBlank(message = "参数错误:userSid") |
|||
private String userSid; |
|||
@ApiModelProperty(value = "节点id") |
|||
@NotBlank(message = "参数错误:taskDefKey") |
|||
private String taskDefKey; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply.flowable; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/5 15:26 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class CostApplyQuery implements Query { |
|||
private static final long serialVersionUID = 5041782090284095194L; |
|||
|
|||
@ApiModelProperty(value = "节点key") |
|||
private String taskDefKey; |
|||
@ApiModelProperty(value = "业务sid") |
|||
private String businessSid; |
|||
@ApiModelProperty(value = "0 上一环节 1下一环节") |
|||
@NotNull(message = "参数错误:next") |
|||
private Integer next; |
|||
} |
@ -0,0 +1,47 @@ |
|||
package com.yxt.anrui.terminal.api.finance.costapply.flowable; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/5 15:31 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class CostApplyTaskQuery implements Query { |
|||
private static final long serialVersionUID = -3303215603844118072L; |
|||
|
|||
/** |
|||
* 终止、驳回、撤回 |
|||
*/ |
|||
@ApiModelProperty("任务Id") |
|||
@NotBlank(message = "参数错误:taskId") |
|||
private String taskId; |
|||
/** |
|||
* 终止、驳回、撤回 |
|||
*/ |
|||
@ApiModelProperty("业务sid") |
|||
@NotBlank(message = "参数错误:businessSid") |
|||
private String businessSid; |
|||
/** |
|||
* 终止、驳回 |
|||
*/ |
|||
@ApiModelProperty("任务意见") |
|||
private String comment; |
|||
/** |
|||
* 终止、撤回、驳回 |
|||
*/ |
|||
@ApiModelProperty("用户Sid") |
|||
private String userSid; |
|||
/** |
|||
* 终止 |
|||
*/ |
|||
@ApiModelProperty("流程实例Id") |
|||
@JsonProperty("procInsId") |
|||
private String instanceId; |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.yxt.anrui.terminal.biz.finance.costapply; |
|||
|
|||
import com.yxt.anrui.terminal.api.finance.costapply.CostApplyFeign; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.CostDetailsVo; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyDto; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyQuery; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyTaskQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/5 15:12 |
|||
* @Description |
|||
*/ |
|||
@Controller |
|||
@RequestMapping("/finance/v1/costApply") |
|||
public class CostApplyRest implements CostApplyFeign { |
|||
|
|||
@Autowired |
|||
private CostApplyService costApplyService; |
|||
|
|||
@Override |
|||
public ResultBean<CostDetailsVo> getCostApply(String sid) { |
|||
return costApplyService.getCostApply(sid); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean agreeCostApplyInfo(CostApplyDto dto) { |
|||
return costApplyService.agreeCostApplyInfo(dto); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean rejectCostApplyInfo(CostApplyTaskQuery query) { |
|||
return costApplyService.rejectCostApplyInfo(query); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean recallCostApplyInfo(CostApplyTaskQuery query) { |
|||
return costApplyService.recallCostApplyInfo(query); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean stopCostApplyInfo(CostApplyTaskQuery query) { |
|||
return costApplyService.stopCostApplyInfo(query); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean<String> getFlowOperateTitle(CostApplyQuery query) { |
|||
return costApplyService.getFlowOperateTitle(query); |
|||
} |
|||
} |
@ -0,0 +1,136 @@ |
|||
package com.yxt.anrui.terminal.biz.finance.costapply; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.yxt.anrui.fin.api.fincostapply.AppFinCostApplyVo; |
|||
import com.yxt.anrui.fin.api.fincostapply.FinCostapplyFeign; |
|||
import com.yxt.anrui.fin.api.fincostapply.flow.FinCostCompleteDto; |
|||
import com.yxt.anrui.fin.api.fincostapply.flow.FinCostGetNodeQuery; |
|||
import com.yxt.anrui.fin.api.fincostapply.flow.FinCostGetNodeVo; |
|||
import com.yxt.anrui.fin.api.fincostapply.flow.FinCostTaskQuery; |
|||
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|||
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|||
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|||
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.CostDetailsVo; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyDto; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyQuery; |
|||
import com.yxt.anrui.terminal.api.finance.costapply.flowable.CostApplyTaskQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/10/5 15:13 |
|||
* @Description |
|||
*/ |
|||
@Service |
|||
public class CostApplyService { |
|||
|
|||
@Autowired |
|||
private FinCostapplyFeign finCostapplyFeign; |
|||
@Autowired |
|||
private SysUserFeign sysUserFeign; |
|||
@Autowired |
|||
private SysStaffOrgFeign sysStaffOrgFeign; |
|||
|
|||
public ResultBean<CostDetailsVo> getCostApply(String sid) { |
|||
ResultBean<CostDetailsVo> rb = ResultBean.fireFail(); |
|||
ResultBean<AppFinCostApplyVo> resultBean = finCostapplyFeign.appDetails(sid); |
|||
if (!resultBean.getSuccess()) { |
|||
return rb.setMsg(resultBean.getMsg()); |
|||
} |
|||
CostDetailsVo costDetailsVo = new CostDetailsVo(); |
|||
BeanUtil.copyProperties(resultBean.getData(), costDetailsVo); |
|||
return rb.success().setData(costDetailsVo); |
|||
} |
|||
|
|||
public ResultBean agreeCostApplyInfo(CostApplyDto dto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
//根据用户sid获取staffSid
|
|||
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|||
if (!userVoResultBean.getSuccess()) { |
|||
return rb.setMsg(userVoResultBean.getMsg()); |
|||
} |
|||
//根据staffSid获取用户的组织全路径
|
|||
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|||
if (!staffOrgResultBean.getSuccess()) { |
|||
return rb.setMsg(staffOrgResultBean.getMsg()); |
|||
} |
|||
//用户的组织全路径
|
|||
String orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|||
FinCostCompleteDto finCostCompleteDto = new FinCostCompleteDto(); |
|||
BeanUtil.copyProperties(dto, finCostCompleteDto); |
|||
finCostCompleteDto.setOrgSidPath(orgSidPath); |
|||
ResultBean resultBean = finCostapplyFeign.complete(finCostCompleteDto); |
|||
if (!resultBean.getSuccess()) { |
|||
return rb.setMsg(resultBean.getMsg()); |
|||
} |
|||
return rb.success().setData(resultBean.getData()); |
|||
} |
|||
|
|||
public ResultBean rejectCostApplyInfo(CostApplyTaskQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
FinCostTaskQuery finCostTaskQuery = new FinCostTaskQuery(); |
|||
BeanUtil.copyProperties(query, finCostTaskQuery); |
|||
ResultBean resultBean = finCostapplyFeign.taskReject(finCostTaskQuery); |
|||
if (!resultBean.getSuccess()) { |
|||
return rb.setMsg(resultBean.getMsg()); |
|||
} |
|||
return rb.success().setData(resultBean.getData()); |
|||
} |
|||
|
|||
public ResultBean recallCostApplyInfo(CostApplyTaskQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
FinCostTaskQuery finCostTaskQuery = new FinCostTaskQuery(); |
|||
BeanUtil.copyProperties(query, finCostTaskQuery); |
|||
ResultBean resultBean = finCostapplyFeign.revokeProcess(finCostTaskQuery); |
|||
if (!resultBean.getSuccess()) { |
|||
return rb.setMsg(resultBean.getMsg()); |
|||
} |
|||
return rb.success().setData(resultBean.getData()); |
|||
} |
|||
|
|||
public ResultBean stopCostApplyInfo(CostApplyTaskQuery query) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
FinCostTaskQuery finCostTaskQuery = new FinCostTaskQuery(); |
|||
BeanUtil.copyProperties(query, finCostTaskQuery); |
|||
ResultBean resultBean = finCostapplyFeign.breakProcess(finCostTaskQuery); |
|||
if (!resultBean.getSuccess()) { |
|||
return rb.setMsg(resultBean.getMsg()); |
|||
} |
|||
return rb.success().setData(resultBean.getData()); |
|||
} |
|||
|
|||
public ResultBean<String> getFlowOperateTitle(CostApplyQuery query) { |
|||
ResultBean<String> rb = ResultBean.fireFail(); |
|||
//0 上一环节 1下一环节
|
|||
int next = query.getNext(); |
|||
FinCostGetNodeQuery getNodeQuery = new FinCostGetNodeQuery(); |
|||
BeanUtil.copyProperties(query, getNodeQuery); |
|||
String data = ""; |
|||
if (next == 0) { |
|||
ResultBean<List<FinCostGetNodeVo>> getPreviousNodesForReject = finCostapplyFeign.getPreviousNodesForReject(getNodeQuery); |
|||
if (getPreviousNodesForReject.getSuccess()) { |
|||
getPreviousNodesForReject.getData().removeAll(Collections.singleton(null)); |
|||
data = getPreviousNodesForReject.getData().get(0).getName(); |
|||
} else { |
|||
return rb.setMsg(getPreviousNodesForReject.getMsg()); |
|||
} |
|||
} else if (next == 1) { |
|||
ResultBean<List<FinCostGetNodeVo>> getNextNodesForSubmit = finCostapplyFeign.getNextNodesForSubmit(getNodeQuery); |
|||
if (getNextNodesForSubmit.getSuccess()) { |
|||
getNextNodesForSubmit.getData().removeAll(Collections.singleton(null)); |
|||
data = getNextNodesForSubmit.getData().get(0).getName(); |
|||
} else { |
|||
return rb.setMsg(getNextNodesForSubmit.getMsg()); |
|||
} |
|||
} else { |
|||
return rb.setMsg("参数错误:next"); |
|||
} |
|||
return rb.success().setData(data); |
|||
} |
|||
} |
Loading…
Reference in new issue