zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
package cn.autoform.factory.impl;
 
import java.util.List;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import cn.autoform.factory.FormFactory;
import cn.autoform.factory.product.ProductMethod;
import cn.autoform.factory.product.ProductMethod.IOType;
import cn.autoform.util.thread.Keys;
import cn.autoform.util.thread.ThreadData;
import cn.autoform.util.tool.RequestContext;
import cn.autoform.web.mapper.formset.FormSetMapper;
 
@Component
public class ServicesFormFactoryImpl implements FormFactory {
 
    @Autowired
    FormSetMapper FormSetMapper;
    
    @Autowired
    private List<ProductMethod> productMethods;
    
    @Override
    public ProductMethod createFormMethod(IOType type) {
        for (ProductMethod productMethod : productMethods) {
            if (productMethod.getProductMethodThod().ordinal() == type.ordinal()) {
                return productMethod;
            }
        }
        return null;
    }
 
    @Override
    public ProductMethod createFormMethod() {
        return createFormMethod(getFlag());
    }
    
    private IOType getFlag(){
//        String flag = FormSetMapper.getFlagByFormID(RequestContext.getFormId(), RequestContext.getTenantId());
//        return "services".equals(flag) ? IOType.services : IOType.cloud;
        return IOType.services;
    }
}