1821349743@qq.com
2023-02-20 146b951e36b7529f4aa9671035a657f651762edc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.product.administration.service;
 
import com.product.administration.config.CmnConst;
import com.product.administration.service.ide.IClaimExpenseService;
import com.product.common.lang.StringUtils;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
import com.product.core.permission.PermissionService;
import com.product.core.service.support.AbstractBaseService;
import com.product.core.service.support.QueryFilterService;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.core.transfer.Transactional;
 
import java.util.Date;
 
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
 
/**
 * Copyright  © LX-BASE
 * @Title: ClaimExpenseService
 * @Project: LX-BASE-SERVER
 * @Date: 2021-06-01 10:27:35
 * @Author: Xin.Luo
 * @Description:  报销申请
 */
@Service
public class ClaimExpenseService extends AbstractBaseService implements IClaimExpenseService {
  @Autowired
  public BaseDao baseDao;
  @Autowired
  PermissionService permissionService;
  @Autowired
  QueryFilterService queryFilterService;
 
  /**
   * @description: 费用报销删除
   * @author: ZhouJie
   * @date: 2021-06-01 11:35
   */
  @Override
  @Transactional
  public boolean delClaimExpense(FieldSetEntity fs) throws BaseException {
    String[] uuids = fs.getString("uuid").split(",");
    baseDao.delete(CmnConst.PRODUCT_OA_EXPENSE_CLAIM_SUB, BaseUtil.buildQuestionMarkFilter("claim_uuid",uuids.length,true),uuids);
    return baseDao.delete(CmnConst.PRODUCT_OA_EXPENSE_CLAIM, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID,uuids.length,true),uuids);
  }
 
  /**
   * @description: 费用报销保存
   * @author: ZhouJie
   * @date: 2021-06-01 11:50
   */
  @Override
  @Transactional
  public String saveClaimExpense(FieldSetEntity fieldSetEntity) throws BaseException {
      fieldSetEntity.setValue("flow_flag", 0);
    if(StringUtils.isEmpty(fieldSetEntity.getString("uuid"))){
      fieldSetEntity.setValue(CmnConst.CREATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
      fieldSetEntity.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
      return baseDao.add(fieldSetEntity,true);
    }else {
      fieldSetEntity.setValue(CmnConst.UPDATED_BY, SpringMVCContextHolder.getCurrentUser().getUser_id());
      fieldSetEntity.setValue(CmnConst.UPDATED_UTC_DATETIME, new Date());
      baseDao.update(fieldSetEntity,true);
      return fieldSetEntity.getString("uuid");
    }
  }
  /**
   * @description: 费用报销列表
   * @author: ZhouJie
   * @date: 2021-06-01 13:57
   */
  public DataTableEntity listExpense(FieldSetEntity fs) throws BaseException {
    String queryFilter=fs.getString("filter");
    if(!BaseUtil.dataTableIsEmpty(fs.getSubDataTable("systemSeniorQueryString"))){
      queryFilter +="AND"+ queryFilterService.getQueryFilter(fs);
    }
    String dataFilter = permissionService.getDataFilter(fs.getTableName(),CmnConst.CREATED_BY);
    if(!StringUtils.isEmpty(dataFilter)){
      queryFilter += " and "+dataFilter;
    }
    DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_EXPENSE_CLAIM,queryFilter,null,null,null,fs.getInteger(CmnConst.PAGESIZE),fs.getInteger(CmnConst.CPAGE));
    baseDao.loadPromptData(dt);
    return dt;
  }
  /**
   * @description: 费用报销申请详情
   * @author: ZhouJie
   * @date: 2021-06-01 14:40
   */
  public FieldSetEntity infoExpense(FieldSetEntity fs) throws BaseException {
    return baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_EXPENSE_CLAIM,fs.getUUID(),true);
  }
 
}