zm
2024-11-04 9d22bf2b596d8f5627f671f009b3f42d71d73bf4
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
package com.product.administration.service;
 
import com.product.administration.config.CmnConst;
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.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.Date;
 
/**
 * Copyright LX
 *
 * @Title: BusinessTripService
 * @Project: product-server
 * @date: 2021年03月29日 14:24
 * @author: ZhouJie
 * @Description: 出差申请
 */
@Component
public class BusinessTripService extends AbstractBaseService {
    @Autowired
    public BaseDao baseDao;
    @Autowired
    PermissionService permissionService;
    @Autowired
    QueryFilterService queryFilterService;
 
    /**
     * @Date: 2020-03-29 14:10
     * @Author: ZhouJie
     * 出差申请列表
     */
    public DataTableEntity getBusinessTripList(FieldSetEntity fs) throws BaseException {
        String filter=fs.getString("filter");
        String dataFilter = permissionService.getDataFilter(fs.getTableName(),CmnConst.CREATED_BY);
        if(!StringUtils.isEmpty(dataFilter)){
            filter += " and "+dataFilter;
        }
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_SYS_BUSINESS_TRIP,filter,null,null,"created_utc_datetime desc",fs.getInteger(CmnConst.PAGESIZE),fs.getInteger(CmnConst.CPAGE));
        baseDao.loadPromptData(dt);
        return dt;
    }
    /**
     * @Date: 2020-03-29 14:46
     * @Author: ZhouJie
     * 出差申请详情
     */
    public FieldSetEntity getBusinessTripInfo(FieldSetEntity fs) throws BaseException {
        return baseDao.listInternationDataTable(baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_BUSINESS_TRIP, fs.getString(CmnConst.UUID), true),null);
    }
    /**
     * @Date: 2020-03-29 15:32
     * @Author: ZhouJie
     * 出差申请保存
     */
    public String saveBusinessTrip(FieldSetEntity fs) throws BaseException {
        fs.setValue("documengt_number", "测试编号001");//单据编号(自动生成)
        fs.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_uuid());//公司
        fs.setValue("applicant", SpringMVCContextHolder.getCurrentUser().getUser_id());//申请人员
        fs.setValue("application_time", new Date());//申请时间
        fs.setValue("department", SpringMVCContextHolder.getCurrentUser().getDept_uuid());//申请部门
        //fs.setValue("post", SpringMVCContextHolder.getCurrentUser().getPost());//职务
        fs.setValue("flow_flag", 0);//状态
        if(StringUtils.isEmpty(fs.getString(CmnConst.UUID))){
            fs.setValue("created_by",SpringMVCContextHolder.getCurrentUser().getUser_id());
            fs.setValue("created_utc_datetime",new Date());
            return baseDao.add(fs);
        }else {
            fs.setValue("updated_by",SpringMVCContextHolder.getCurrentUser().getUser_id());
            fs.setValue("updated_utc_datetime",new Date());
            baseDao.update(fs);
            return fs.getString(CmnConst.UUID);
        }
    }
    /**
     * @Date: 2020-03-29 16:43
     * @Author: ZhouJie
     * 删除出差申请
     */
    public boolean deleteBusinessTrip(FieldSetEntity fs) throws BaseException {
        String uuid = fs.getUUID();
        String[] uuids = uuid.split(",");
        return baseDao.delete(CmnConst.PRODUCT_SYS_BUSINESS_TRIP, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids);
    }
 
}