zm
2025-03-15 84afb0cebcd698f0c1fdb95f02231dc99e9252a9
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
package com.product.contract.service;
 
import com.product.common.lang.StringUtils;
import com.product.contract.config.CmnConst;
import com.product.contract.service.ide.IContractInfoService;
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 com.product.module.sys.entity.SystemUser;
import com.product.util.BaseUtil;
import org.apache.bcel.generic.IF_ACMPEQ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
 
/**
 * Copyright LX
 *
 * @Title: ContractInfoService
 * @Project: product-server
 * @date: 2021-06-22 14:11
 * @author: ZhouJie
 * @Description: 合同管理
 */
@Component
public class ContractInfoService extends AbstractBaseService implements IContractInfoService {
 
    @Autowired
    public BaseDao baseDao;
    @Autowired
    PermissionService permissionService;
    @Autowired
    QueryFilterService queryFilterService;
 
    /**
     * 保存合同信息
     * @param fs
     * @return
     */
    @Override
    @Transactional
    public String saveContractInfo(FieldSetEntity fs) throws BaseException {
        if(StringUtils.isEmpty(fs.getString(CmnConst.UUID))){
            fs.setValue("org_level_uuid", SpringMVCContextHolder.getCurrentUser().getOrg_level_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);
        }
    }
 
    /**
     * 删除合同信息
     * @param fs
     * @return
     */
    @Override
    @Transactional
    public boolean deleteContractInfo(FieldSetEntity fs) {
        String uuid = fs.getUUID();
        String[] uuids = uuid.split(",");
        return baseDao.delete(CmnConst.LX_PROJECT_CONTRACT_INFO, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids);
    }
 
    /**
     * 获取合同列表
     * @param fs
     * @return
     */
    public DataTableEntity listContract(FieldSetEntity fs) {
        String queryFilter=permissionService.getDataFilter(CmnConst.ORG_LEVEL_UUID);
        if(StringUtils.isEmpty(queryFilter)) {
            queryFilter = CmnConst.CREATED_BY + " = " + SpringMVCContextHolder.getCurrentUser().getUser_id();
        }
        if(!BaseUtil.dataTableIsEmpty(fs.getSubDataTable("systemSeniorQueryString"))){
            queryFilter    = queryFilter +" AND "+ queryFilterService.getQueryFilter(fs);
        }
        String filter = fs.getString("filter");
        if(BaseUtil.strIsNull(filter)){
            filter = queryFilter;
        }else {
            filter = filter  + " AND " + queryFilter;
        }
        //DataTableEntity dt = baseDao.listTable(CmnConst.LX_PROJECT_CONTRACT_INFO,filter,new Object[]{},null,null,fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE));
        DataTableEntity dt = baseDao.listTable(CmnConst.LX_PROJECT_CONTRACT_INFO,filter,new Object[]{},null,null,fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE),true);
        if(dt != null){
            for (int i = 0; i < dt.getRows(); i++) {
                FieldSetEntity fsz = dt.getFieldSetEntity(i);
                DataTableEntity dtsub = fsz.getSubDataTable("product_project_contract_info_sub");
                double invoice_amount = 0;//开票金额
                double collection_amount = 0;//回款金额
                if(dtsub!=null){
                    for (int j = 0; j < dtsub.getRows(); j++) {
                        FieldSetEntity fszsub = dtsub.getFieldSetEntity(j);
                        if(fszsub.getDouble("invoiced")!=null){
                            invoice_amount += fszsub.getDouble("invoiced");
                        }
                        if(fszsub.getDouble("payment_received")!=null){
                            collection_amount += fszsub.getDouble("payment_received");
                        }
                    }
                }
                fsz.setValue("invoice_amount",invoice_amount);
                fsz.setValue("collection_amount",collection_amount);
            }
        }
        baseDao.loadPromptData(dt);
        return dt;
    }
 
    /**
     * 查询合同详情
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity findContractInfo(FieldSetEntity fs) throws BaseException {
        FieldSetEntity cfs =baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_INFO,fs.getUUID(),true);
        DataTableEntity sub=cfs.getSubDataTable("product_project_contract_info_sub");
        StringBuilder  filter=new StringBuilder(128);
        filter.append(" uuid='"+cfs.getValues().get("project_uuid")+"'");
        DataTableEntity product_project_business = baseDao.listTable("product_project_business",filter.toString(),new Object[]{});
//        String guarantee_period = product_project_business.getData().get(0).getValues().get("guarantee_period").toString();
        String guarantee_period = product_project_business.getString(0, "guarantee_period");
        StringBuilder  dictFilter=new StringBuilder(128);
        dictFilter.append("dict_name='项目管理项目类型' and dict_value="+product_project_business.getData().get(0).getValues().get("project_type").toString());
        DataTableEntity product_sys_dict = baseDao.listTable("product_sys_dict", dictFilter.toString(), new Object[]{});
       //合同有效期:如果是开发项目、实施项目,从项目信息的质保期带过来
        String dict_label = product_sys_dict.getData().get(0).getValues().get("dict_label").toString();
        if(dict_label.equals("开发项目") ||dict_label.equals("实施项目")){
            cfs.setValue("guarantee_period",guarantee_period);
            cfs.setValue("project_type_now",dict_label);
        }
       //结束日期: 如果是开发项目、实施项目,验收日期+合同有效期,维护合同则是签定日期+合同有效期
        if(dict_label.equals("开发项目") || dict_label.equals("实施项目")){
//            String carefully_check = product_project_business.getData().get(0).getValues().get("carefully_check").toString();
            String carefully_check = product_project_business.getString(0, "carefully_check");
            if (!StringUtils.isEmpty(carefully_check)){
                String[] dateTime = carefully_check.split(" ");
                String time=dateTime[0];
                String date = getDate(time,guarantee_period);
                cfs.setValue("end_time",date);
            }
        }
        return cfs;
    }
 
 
    //日期计算方式
    public String  getDate(String dateTime,String carefully_time){
 
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate date = LocalDate.parse(dateTime, formatter);
        // 加上指定的月份数,例如加3个月
        LocalDate newDate = date.plusMonths(Integer.parseInt(carefully_time));
 
         return  newDate.format(formatter);
    }
 
    /**
     * 根据合同名查询合同详情
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getContractInfoByName(FieldSetEntity fs) throws BaseException {
        FieldSetEntity fss = baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_INFO,fs.getUUID(),true);
        FieldSetEntity fsProject = baseDao.getFieldSetEntity(CmnConst.PRODUCT_PROJECT_BUSINESS,fss.getString("project_uuid"),false);
        FieldSetEntity fsCustomer = baseDao.getFieldSet("product_project_customer", fsProject.getString("customer_name"), false);
        FieldSetEntity contractName = baseDao.getFieldSetEntityBySQL("SELECT sum(invoice_amount) invoice_amount FROM product_project_contract_invoice_info WHERE contract_invoice_uuid in(SELECT uuid FROM product_project_contract_invoice where contract_name=?)", new String[]{fs.getString("uuid")},false);
        if (contractName==null||StringUtils.isEmpty(contractName.getString("invoice_amount"))){
            fss.setValue("invoice_amount",0);
        }else {
            fss.setValue("invoice_amount",contractName.getString("invoice_amount"));
        }
        fss.setValue("customer_name", fsCustomer.getString("customer_name"));
        fss.setValue("collection_amount",0);
        fss.setValue("project_num",fsProject.getString("project_num"));
        fss.setValue("project_name",fsProject.getString("project_name"));
        return fss;
    }
 
    /**
     * 合同详情页面数据查询
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getContractInfo(FieldSetEntity fs) throws BaseException {
        //合同详情
        FieldSetEntity fss = baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_INFO,fs.getUUID(),true);
        //合同变更表
        FieldSetEntity fschange = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_CHANGE," contract_name=? and created_utc_datetime = (select MAX(created_utc_datetime) from "+CmnConst.LX_PROJECT_CONTRACT_CHANGE+" WHERE contract_name=?)  ",new Object[]{fs.getUUID(),fs.getUUID()},true);
        if(fschange!=null){
            fss.setValue("account_manager",fschange.getString("account_manager"));
            fss.setValue("contract_amount",fschange.getString("change_the_amount"));
            fss.setValue("total_investment",fschange.getInteger("change_the_amount"));
        }
        FieldSetEntity fsinvo = null;//开票信息
        FieldSetEntity fspaym = null;//回款信息
        DataTableEntity dtproj = null;//项目信息
        if(fss!=null){
            fsinvo = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_INVOICE,"contract_name=?",new Object[]{fss.getUUID()},true);
            fspaym = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_PAYMENT,"contract_name=?",new Object[]{fss.getUUID()},true);
            dtproj = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BUSINESS," uuid=? ",new Object[]{fss.getString("project_uuid")});
        }
        DataTableEntity dt = fss.getSubDataTable(CmnConst.LX_PROJECT_CONTRACT_INFO_SUB);
        FieldSetEntity fsub = null;
        int invoiced = 0;//已开票金额
        int payment_received = 0;//已回款金额
        if(dt!=null && dt.getRows()>0){
            for (int i = 0; i < dt.getRows(); i++) {
                fsub = dt.getFieldSetEntity(i);
                String invo = fsub.getString("invoiced");
                String paym = fsub.getString("payment_received");
                if(BaseUtil.strIsNull(invo)){
                    invo = "0";
                }
                if(BaseUtil.strIsNull(paym)){
                    paym = "0";
                }
                invoiced += Integer.parseInt(invo);
                payment_received += Integer.parseInt(paym);
            }
        }
        FieldSetEntity fsperf = null;//履约保证金
        int earnest_money = 0;//履约保证金金额
        DataTableEntity dtperf = baseDao.listTable(CmnConst.LX_PROJECT_PERFORMANCE_BOND," project_uuid=? and is_pay=? ",new Object[]{fs.getString("project_uuid"),1});
        if(dtperf != null){
            for (int i = 0; i < dtperf.getRows(); i++) {
                fsperf = dtperf.getFieldSetEntity(i);
                String earn = fsperf.getString("earnest_money");
                if(BaseUtil.strIsNull(earn)){
                    earn = "0";
                }
                earnest_money += Integer.parseInt(earn);
            }
        }
        int projecting = 0;//在建项目
        int projected = 0;//完成项目
        if(dtproj!=null){
            for (int i = 0; i < dtproj.getRows(); i++) {
                FieldSetEntity fsproj = dtproj.getFieldSetEntity(i);
                if(fsproj!=null && "在建".equals(fsproj.getString("project_status"))){
                    projecting++;
                }else{
                    projected++;
                }
            }
        }
        fss.setValue("invoiced",invoiced);//已开票金额
        fss.setValue("uinvoiced",fss.getDouble("contract_amount")-invoiced);//未开票金额
        fss.setValue("payment_received",payment_received);//已回款金额
        fss.setValue("upayment_received",fss.getDouble("contract_amount")-payment_received);//未回款金额
        fss.setValue("project_total",dtproj.getRows());//项目数
        fss.setValue("projecting",projecting);//在建项目
        fss.setValue("projected",projected);//完成项目
        fss.setValue("earnest_money",earnest_money);//已缴纳保证金
        fss.setValue("uearnest_money","10");//已退保证金
        if(fsinvo != null) {
            DataTableEntity invoiceDataTable = fsinvo.getSubDataTable(CmnConst.LX_PROJECT_CONTRACT_INVOICE_INFO);
            if (!BaseUtil.dataTableIsEmpty(invoiceDataTable)) {
                baseDao.loadPromptData(invoiceDataTable);
                fss.addSubDataTable(invoiceDataTable);//开票信息子表
            }
        }
        if(fspaym != null) {
            DataTableEntity paymentDataTable = fspaym.getSubDataTable(CmnConst.LX_PROJECT_CONTRACT_PAYMENT_COLLECTION);
            if (!BaseUtil.dataTableIsEmpty(paymentDataTable)) {
                baseDao.loadPromptData(paymentDataTable);
                fss.addSubDataTable(paymentDataTable);//回款信息子表
            }
        }
        fss.addSubDataTable(dtproj);//项目信息
        return fss;
    }
    /**
     * 项目是否已有合同
     * @param fs
     * @return
     * @throws BaseException
     */
    public String isAddContract(FieldSetEntity fs) throws BaseException {
        String uuid = fs.getUUID();
        DataTableEntity dataTableEntity = baseDao.listTable(" SELECT * FROM product_project_contract_info where   project_uuid = ? ", new String[]{uuid});
        if (BaseUtil.dataTableIsEmpty(dataTableEntity)) {
            return "0";
        } else {
            return "1";
        }
    }
 
    /**
     * 获取合同盖章
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getContractStamp(FieldSetEntity fs) throws BaseException {
        //合同uuid
        String uuid = fs.getUUID();
        //根据条件查询合同盖章
        FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_STAMP, " contract_uuid = ? ", new String[] {uuid}, false);
        FieldSetEntity contractInfoField = this.findContractInfo(fs);
        if(fieldSetEntity != null){
            //盖章时间
            contractInfoField.setValue("stamp_time", fieldSetEntity.getString("stamp_time"));
            //是否盖章
            contractInfoField.setValue("is_stamp", fieldSetEntity.getString("is_stamp"));
            //合同盖章uuid
            contractInfoField.setValue("stamp_uuid", fieldSetEntity.getString("uuid"));
        }
        return contractInfoField;
    }
 
 
    @Override
    @Transactional
    public boolean saveContractStamp(FieldSetEntity fs) throws BaseException {
        String stampUuid = fs.getString("stamp_uuid");
        FieldSetEntity fieldSetEntity = new FieldSetEntity();
        fieldSetEntity.setTableName(CmnConst.LX_PROJECT_CONTRACT_STAMP);
        fieldSetEntity.setValue("stamp_time", fs.getString("stamp_time"));
        fieldSetEntity.setValue("is_stamp", fs.getString("is_stamp"));
        SystemUser user = SpringMVCContextHolder.getCurrentUser();
        //为空新增
        if(BaseUtil.strIsNull(stampUuid)){
            fieldSetEntity.setValue("contract_uuid" ,fs.getString("uuid"));
            fieldSetEntity.setValue(CmnConst.ORG_LEVEL_UUID, user.getOrg_level_uuid());
            fieldSetEntity.setValue(CmnConst.CREATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
            baseDao.add(fieldSetEntity);
            return true;
        //修改
        }else {
            fieldSetEntity.setValue(CmnConst.UUID, stampUuid);
            fieldSetEntity.setValue(CmnConst.UPDATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.UPDATED_UTC_DATETIME, new Date());
            return baseDao.update(fieldSetEntity);
        }
    }
 
    /**
     * 获取合同终止
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getContractTermination(FieldSetEntity fs) throws BaseException {
        //合同uuid
        String uuid = fs.getUUID();
        //根据条件查询合同盖章
        FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_TERMINATION, " contract_uuid = ? ", new String[] {uuid}, false);
        FieldSetEntity contractInfoField = this.findContractInfo(fs);
        if(fieldSetEntity != null){
            //终止时间
            contractInfoField.setValue("termination_time", fieldSetEntity.getString("termination_time"));
            //终止原因
            contractInfoField.setValue("termination_cause", fieldSetEntity.getString("termination_cause"));
            //合同终止uuid
            contractInfoField.setValue("termination_uuid", fieldSetEntity.getString("uuid"));
        }
        return contractInfoField;
    }
 
 
    @Override
    @Transactional
    public boolean saveContractTermination(FieldSetEntity fs) throws BaseException {
        String terminationUuid = fs.getString("termination_uuid");
        FieldSetEntity fieldSetEntity = new FieldSetEntity();
        fieldSetEntity.setTableName(CmnConst.LX_PROJECT_CONTRACT_TERMINATION);
        fieldSetEntity.setValue("termination_time", fs.getString("termination_time"));
        fieldSetEntity.setValue("termination_cause", fs.getString("termination_cause"));
        SystemUser user = SpringMVCContextHolder.getCurrentUser();
        //为空新增
        if(BaseUtil.strIsNull(terminationUuid)){
            fieldSetEntity.setValue("contract_uuid" ,fs.getString("uuid"));
            fieldSetEntity.setValue(CmnConst.ORG_LEVEL_UUID, user.getOrg_level_uuid());
            fieldSetEntity.setValue(CmnConst.CREATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
            baseDao.add(fieldSetEntity);
            return true;
            //修改
        }else {
            fieldSetEntity.setValue(CmnConst.UUID, terminationUuid);
            fieldSetEntity.setValue(CmnConst.UPDATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.UPDATED_UTC_DATETIME, new Date());
            return baseDao.update(fieldSetEntity);
        }
    }
 
 
    /**
     * 获取合同归档
     * @param fs
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getContractFile(FieldSetEntity fs) throws BaseException {
        //合同uuid
        String uuid = fs.getUUID();
        //根据条件查询合同盖章
        FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_FILE, " contract_uuid = ? ", new String[] {uuid}, false);
        FieldSetEntity contractInfoField = this.findContractInfo(fs);
        if(fieldSetEntity != null){
            //收回时间
            contractInfoField.setValue("recovery_time", fieldSetEntity.getString("recovery_time"));
            //是否归档
            contractInfoField.setValue("is_file", fieldSetEntity.getString("is_file"));
            //归档位置
            contractInfoField.setValue("file_location", fieldSetEntity.getString("file_location"));
            //收回类型
            contractInfoField.setValue("recovery_type", fieldSetEntity.getString("recovery_type"));
            //合同归档uuid
            contractInfoField.setValue("file_uuid", fieldSetEntity.getString("uuid"));
            //合同附件uuid
            contractInfoField.setValue("attachment_uuid", fieldSetEntity.getString("attachment_uuid"));
        }
        return contractInfoField;
    }
 
    @Override
    @Transactional
    public boolean saveContractFile(FieldSetEntity fs) throws BaseException {
        String fileUuid = fs.getString("file_uuid");
        FieldSetEntity fieldSetEntity = new FieldSetEntity();
        fieldSetEntity.setTableName(CmnConst.LX_PROJECT_CONTRACT_FILE);
        fieldSetEntity.setValue("recovery_time", fs.getString("recovery_time"));
        fieldSetEntity.setValue("is_file", fs.getString("is_file"));
        //归档位置
        String fileLocation = fs.getString("file_location");
        fieldSetEntity.setValue("file_location", fileLocation);
        fieldSetEntity.setValue("recovery_type", fs.getString("recovery_type"));
        String attachmentUuid = fs.getString("attachment_uuid");
        //附件uuid
        fieldSetEntity.setValue("attachment_uuid", attachmentUuid);
        SystemUser user = SpringMVCContextHolder.getCurrentUser();
        if(!BaseUtil.strIsNull(fileLocation) && !BaseUtil.strIsNull(attachmentUuid)){
            FieldSetEntity attFieldSet = baseDao.getFieldSetEntity("product_sys_attachments", attachmentUuid, false);
            String attachmentTypeUuid = attFieldSet.getString("attachment_type_uuid");
            FieldSetEntity dictField = baseDao.getFieldSetEntity("product_sys_dict", attachmentTypeUuid, false);
            FieldSetEntity documentFse = new FieldSetEntity();
            documentFse.setTableName("product_sys_document");
            documentFse.setValue("attachments_uuid", attachmentUuid);
            documentFse.setValue(CmnConst.CREATED_BY, user.getUser_id());
            documentFse.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
            documentFse.setValue("directory_uuid", fileLocation);
 
            documentFse.setValue("file_name", attFieldSet.getString("file_name"));
            documentFse.setValue("file_size", attFieldSet.getString("attachment_size"));
            documentFse.setValue("file_type", dictField.getString("dict_label"));
            baseDao.add(documentFse);
        }
        //为空新增
        if(BaseUtil.strIsNull(fileUuid)){
            fieldSetEntity.setValue("contract_uuid" ,fs.getString("uuid"));
            fieldSetEntity.setValue(CmnConst.ORG_LEVEL_UUID, user.getOrg_level_uuid());
            fieldSetEntity.setValue(CmnConst.CREATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
            baseDao.add(fieldSetEntity);
            return true;
            //修改
        }else {
            fieldSetEntity.setValue(CmnConst.UUID, fileUuid);
            fieldSetEntity.setValue(CmnConst.UPDATED_BY, user.getUser_id());
            fieldSetEntity.setValue(CmnConst.UPDATED_UTC_DATETIME, new Date());
            return baseDao.update(fieldSetEntity);
        }
    }
}