LeaveApplyServiceImpl.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package jnpf.service.impl;
  2. import com.baomidou.dynamic.datasource.annotation.DSTransactional;
  3. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4. import jnpf.base.service.BillRuleService;
  5. import jnpf.base.service.SuperServiceImpl;
  6. import jnpf.entity.LeaveApplyEntity;
  7. import jnpf.mapper.LeaveApplyMapper;
  8. import jnpf.model.leaveapply.LeaveApplyForm;
  9. import jnpf.service.LeaveApplyService;
  10. import jnpf.util.JsonUtil;
  11. import jnpf.util.StringUtil;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. /**
  15. * 流程表单【请假申请】
  16. *
  17. * @author JNPF开发平台组
  18. * @version V3.1.0
  19. * @copyright 引迈信息技术有限公司
  20. * @date 2019年9月29日 上午9:18
  21. */
  22. @Service
  23. public class LeaveApplyServiceImpl extends SuperServiceImpl<LeaveApplyMapper, LeaveApplyEntity> implements LeaveApplyService {
  24. @Autowired
  25. private BillRuleService billRuleService;
  26. @Override
  27. public LeaveApplyEntity getInfo(String id) {
  28. QueryWrapper<LeaveApplyEntity> queryWrapper = new QueryWrapper<>();
  29. queryWrapper.lambda().eq(LeaveApplyEntity::getId, id);
  30. return getOne(queryWrapper);
  31. }
  32. @Override
  33. @DSTransactional
  34. public void save(String id, LeaveApplyEntity entity, LeaveApplyForm form) {
  35. //表单信息
  36. if (StringUtil.isEmpty(entity.getId())) {
  37. entity.setId(id);
  38. save(entity);
  39. billRuleService.useBillNumber("WF_LeaveApplyNo");
  40. } else {
  41. entity.setId(id);
  42. updateById(entity);
  43. }
  44. }
  45. @Override
  46. @DSTransactional
  47. public void submit(String id, LeaveApplyEntity entity, LeaveApplyForm form) {
  48. //表单信息
  49. if (StringUtil.isEmpty(entity.getId())) {
  50. entity.setId(id);
  51. save(entity);
  52. billRuleService.useBillNumber("WF_LeaveApplyNo");
  53. } else {
  54. entity.setId(id);
  55. updateById(entity);
  56. }
  57. }
  58. @Override
  59. public void data(String id, String data) {
  60. LeaveApplyForm leaveApplyForm = JsonUtil.getJsonToBean(data, LeaveApplyForm.class);
  61. LeaveApplyEntity entity = JsonUtil.getJsonToBean(leaveApplyForm, LeaveApplyEntity.class);
  62. entity.setId(id);
  63. saveOrUpdate(entity);
  64. }
  65. @Override
  66. public void delete(LeaveApplyEntity entity) {
  67. this.removeById(entity);
  68. }
  69. }