30 changed files with 697 additions and 89 deletions
@ -0,0 +1,113 @@ |
|||||
|
package com.qs.serve.modules.pay.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.web.bind.annotation.*; |
||||
|
|
||||
|
import com.qs.serve.modules.pay.entity.PayWay; |
||||
|
import com.qs.serve.modules.pay.service.PayWayService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 支付 付款方式 |
||||
|
* @author YenHex |
||||
|
* @since 2023-05-23 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("pay/way") |
||||
|
public class PayWayController { |
||||
|
|
||||
|
private PayWayService payWayService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/list") |
||||
|
public R<List<PayWay>> getList(PayWay param){ |
||||
|
LambdaQueryWrapper<PayWay> lqw = new LambdaQueryWrapper<>(param); |
||||
|
PageUtil.startPage(); |
||||
|
List<PayWay> list = payWayService.list(lqw); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
public R<PageVo<PayWay>> getPage(PayWay param){ |
||||
|
LambdaQueryWrapper<PayWay> lqw = new LambdaQueryWrapper<>(param); |
||||
|
PageUtil.startPage(); |
||||
|
List<PayWay> list = payWayService.list(lqw); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.Payment, title = "付款方式", biz = BizType.QUERY) |
||||
|
public R<PayWay> getById(@PathVariable("id") String id){ |
||||
|
PayWay payWay = payWayService.getById(id); |
||||
|
return R.ok(payWay); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.Payment, title = "付款方式", biz = BizType.UPDATE) |
||||
|
public R<?> updateById(@RequestBody @Valid PayWay param){ |
||||
|
boolean result = payWayService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.Payment, title = "付款方式", biz = BizType.INSERT) |
||||
|
public R<PayWay> save(@RequestBody @Valid PayWay param){ |
||||
|
boolean result = payWayService.save(param); |
||||
|
return R.ok(param); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{ids}") |
||||
|
@SysLog(module = SystemModule.Payment, title = "付款方式", biz = BizType.DELETE) |
||||
|
public R<?> deleteById(@PathVariable("ids") String ids){ |
||||
|
List<Long> idsLong = StringUtils.splitIdLong(ids); |
||||
|
boolean result = payWayService.removeByIds(idsLong); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,93 @@ |
|||||
|
package com.qs.serve.modules.pay.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-05-23 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("pay_way") |
||||
|
public class PayWay implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 支付方式 */ |
||||
|
@NotBlank(message = "支付方式不能为空") |
||||
|
@Length(max = 250,message = "支付方式长度不能超过250字") |
||||
|
private String title; |
||||
|
|
||||
|
/** 停用:0->启用;1->停用 */ |
||||
|
private Integer stopState; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@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 PayWay toNewObject(PayWay source){ |
||||
|
PayWay way = new PayWay(); |
||||
|
way.setId(source.getId()); |
||||
|
way.setTitle(source.getTitle()); |
||||
|
way.setStopState(source.getStopState()); |
||||
|
way.setRemark(source.getRemark()); |
||||
|
way.setCreateTime(source.getCreateTime()); |
||||
|
way.setUpdateTime(source.getUpdateTime()); |
||||
|
way.setTenantId(source.getTenantId()); |
||||
|
way.setCreateBy(source.getCreateBy()); |
||||
|
way.setUpdateBy(source.getUpdateBy()); |
||||
|
way.setDelFlag(source.getDelFlag()); |
||||
|
return way; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.pay.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.pay.entity.PayWay; |
||||
|
|
||||
|
/** |
||||
|
* 付款方式 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2023-05-23 |
||||
|
*/ |
||||
|
public interface PayWayMapper extends BaseMapper<PayWay> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,14 @@ |
|||||
|
package com.qs.serve.modules.pay.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.pay.entity.PayWay; |
||||
|
|
||||
|
/** |
||||
|
* 付款方式 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2023-05-23 |
||||
|
*/ |
||||
|
public interface PayWayService extends IService<PayWay> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.qs.serve.modules.pay.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.pay.entity.PayWay; |
||||
|
import com.qs.serve.modules.pay.service.PayWayService; |
||||
|
import com.qs.serve.modules.pay.mapper.PayWayMapper; |
||||
|
|
||||
|
/** |
||||
|
* 付款方式 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2023-05-23 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class PayWayServiceImpl extends ServiceImpl<PayWayMapper,PayWay> implements PayWayService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,17 @@ |
|||||
|
package com.qs.serve.modules.seeyon.enums; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/23 |
||||
|
*/ |
||||
|
public enum SyAffairState { |
||||
|
|
||||
|
//next(审批中)、backed(回退)、finished(完成)、refuse(拒绝)、error(错误)、none(不存在数据)
|
||||
|
next, |
||||
|
backed, |
||||
|
finished, |
||||
|
refuse, |
||||
|
error, |
||||
|
none; |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.qs.serve.modules.seeyon.service; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/23 |
||||
|
*/ |
||||
|
public interface SeeYonBaseService { |
||||
|
|
||||
|
String getTemplateCode(); |
||||
|
|
||||
|
SeeYonRequestService getRequestService(); |
||||
|
|
||||
|
default boolean testConnection(){ |
||||
|
return getRequestService().testConnection(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.qs.serve.modules.seeyon.service; |
||||
|
|
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.modules.seeyon.enums.SyAffairState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/23 |
||||
|
*/ |
||||
|
public interface SeeYonCompensateService extends SeeYonBaseService{ |
||||
|
|
||||
|
/** |
||||
|
* 补偿:审批中 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object compensateNext(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 补偿:审批退回 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object compensateBacked(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 补偿:审批完成 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object compensateFinished(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 补偿:审批拒绝 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object compensateRefuse(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 执行的主要方法 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
default R<?> runCompensate(String targetId){ |
||||
|
testConnection(); |
||||
|
String templateCode = getTemplateCode(); |
||||
|
SyAffairState affairState = checkAffairState(targetId,templateCode); |
||||
|
if(affairState.equals(SyAffairState.next)){ |
||||
|
return R.ok(compensateNext(targetId)); |
||||
|
}else if(affairState.equals(SyAffairState.backed)){ |
||||
|
return R.ok(compensateBacked(targetId)); |
||||
|
}else if(affairState.equals(SyAffairState.finished)){ |
||||
|
return R.ok(compensateFinished(targetId)); |
||||
|
}else if(affairState.equals(SyAffairState.refuse)){ |
||||
|
return R.ok(compensateRefuse(targetId)); |
||||
|
}else if(affairState.equals(SyAffairState.error)){ |
||||
|
return R.error("数据异常请联系管理员"); |
||||
|
}else{ |
||||
|
return R.error("OA无相关审批数据"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 发送请求获取状态 |
||||
|
* @param targetId |
||||
|
* @param templateCode |
||||
|
* @return |
||||
|
*/ |
||||
|
default SyAffairState checkAffairState(String targetId,String templateCode){ |
||||
|
return getRequestService().checkAffairState(targetId,templateCode); |
||||
|
}; |
||||
|
|
||||
|
} |
@ -0,0 +1,121 @@ |
|||||
|
package com.qs.serve.modules.seeyon.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.model.consts.BudgetLogOptFlag; |
||||
|
import com.qs.serve.common.model.consts.BudgetLogRollbackFlag; |
||||
|
import com.qs.serve.common.model.dto.PageVo; |
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.modules.seeyon.entity.CtpAffairQo; |
||||
|
import com.qs.serve.modules.seeyon.enums.SyAffairState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsActivity; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetLog; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
||||
|
import com.qs.serve.modules.tbs.entity.bo.TbsAffairCommitBo; |
||||
|
import com.qs.serve.modules.tbs.entity.vo.CtpAffairVo; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/23 |
||||
|
*/ |
||||
|
public interface SeeYonOperationService extends SeeYonBaseService{ |
||||
|
|
||||
|
/** |
||||
|
* 审批中 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object next(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 审批退回 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object backed(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 审批完成 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object finished(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 审批拒绝 |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
Object refuse(String targetId); |
||||
|
|
||||
|
/** |
||||
|
* 审批列表(用于详情页) |
||||
|
* @param targetId |
||||
|
* @return |
||||
|
*/ |
||||
|
R<List<CtpAffairVo>> pageAffair(Long targetId); |
||||
|
|
||||
|
/** |
||||
|
* 个人审批列表(翻页) |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
R<PageVo<CtpAffairVo>> pageMemberAffair(CtpAffairQo param); |
||||
|
|
||||
|
/** |
||||
|
* 审批提交 |
||||
|
* @param affairCommit |
||||
|
* @return |
||||
|
*/ |
||||
|
default R<?> commitAffair(TbsAffairCommitBo affairCommit){ |
||||
|
String syFormId = this.commitGetSyFormId(affairCommit); |
||||
|
String targetId = getTargetIdFromCommit(affairCommit); |
||||
|
R<String> result = getRequestService().commonCommit(affairCommit, getTemplateCode(),syFormId); |
||||
|
boolean isBackCommit = affairCommit.getState()==2; |
||||
|
if(result.getStatus()==200){ |
||||
|
// 判断是否含有下个节点
|
||||
|
String flag = result.getData(); |
||||
|
//审批中(next)、完成(finish)、拒绝(refused)
|
||||
|
if("finish".equals(flag)){ |
||||
|
this.finished(targetId); |
||||
|
return R.ok(); |
||||
|
}else if ("stop".equals(flag)){ |
||||
|
if(isBackCommit){ |
||||
|
this.backed(targetId); |
||||
|
return R.ok(); |
||||
|
}else { |
||||
|
this.refuse(targetId); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
}else if ("next".equals(flag)){ |
||||
|
this.next(targetId); |
||||
|
return R.ok(); |
||||
|
} |
||||
|
}else if (result.getStatus()==500){ |
||||
|
return result; |
||||
|
} |
||||
|
return R.ok(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取提交的目标ID |
||||
|
* @param affairCommit |
||||
|
* @return |
||||
|
*/ |
||||
|
String getTargetIdFromCommit(TbsAffairCommitBo affairCommit); |
||||
|
|
||||
|
/** |
||||
|
* 检查提交审批是否允许,并返回syFormId |
||||
|
* @param affairCommit |
||||
|
* @return |
||||
|
*/ |
||||
|
String commitGetSyFormId(TbsAffairCommitBo affairCommit); |
||||
|
|
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.qs.serve.modules.tbs.service; |
||||
|
|
||||
|
import com.qs.serve.common.model.dto.R; |
||||
|
import com.qs.serve.common.util.Assert; |
||||
|
import com.qs.serve.modules.seeyon.enums.SyAffairState; |
||||
|
import com.qs.serve.modules.seeyon.service.SeeYonCompensateService; |
||||
|
import com.qs.serve.modules.seeyon.service.SeeYonRequestService; |
||||
|
import com.qs.serve.modules.tbs.common.TbsCostApplyState; |
||||
|
import com.qs.serve.modules.tbs.common.TbsSeeYonConst; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsCostApply; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsCostApplyMapper; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 费用申请补偿实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2023/5/23 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsCostApplyCompensateService implements SeeYonCompensateService { |
||||
|
|
||||
|
private final SeeYonRequestService requestService; |
||||
|
private final TbsCostApplyMapper costApplyMapper; |
||||
|
|
||||
|
@Override |
||||
|
public String getTemplateCode() { |
||||
|
return TbsSeeYonConst.CostApplyConf.Code(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SeeYonRequestService getRequestService() { |
||||
|
return requestService; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object compensateNext(String targetId) { |
||||
|
TbsCostApply costApply = costApplyMapper.selectById(targetId); |
||||
|
if (costApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())) { |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object compensateBacked(String targetId) { |
||||
|
TbsCostApply costApply = costApplyMapper.selectById(targetId); |
||||
|
if (costApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())) { |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object compensateFinished(String targetId) { |
||||
|
TbsCostApply costApply = costApplyMapper.selectById(targetId); |
||||
|
if (costApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())) { |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object compensateRefuse(String targetId) { |
||||
|
TbsCostApply costApply = costApplyMapper.selectById(targetId); |
||||
|
if (costApply.getChargeState().equals(TbsCostApplyState.State_1_apply.getCode())) { |
||||
|
|
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue