shicf
2025-03-25 be1b20692e5f0b48cb6b31b1231ef3ac8660e6ea
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
package com.product.mobile.core.service;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.aspose.p6a2feef8.p995e1fda.pbdb106a0.b;
import com.product.common.lang.StringUtils;
import com.product.core.config.CoreConst;
import com.product.core.config.Global;
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.log.SystemLogger;
import com.product.core.service.support.AbstractBaseService;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.mobile.core.config.MobileCoreCode;
import com.product.mobile.core.config.MobileCoreConst;
import com.product.module.sys.entity.SystemUser;
import com.product.util.BaseUtil;
 
/**
 * 手机端,获取用户所有应用
 * @author Administrator
 *
 */
@Component
public class CommonMVCService extends AbstractBaseService{
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //制定输出格式
    
    @Autowired
    public BaseDao baseDao;
    /**
     * 查询数据数据是否有走审批流程
     * @param table
     * @param uuid
     */
    public String getApproveDetailUUID(String table,String uuid) {
          
        DataTableEntity dt = getBaseDao().listTable("product_sys_flow_detail", " record_uuid=? and table_name=? ",new Object[]{uuid,table});
        if(dt.isEmpty()) {
            return null;
        }else {
            return dt.getFieldSetEntity(0).getUUID();
        }
    }
    /**
     *     查出MVC中按钮操作的界面,界面后面的所有按钮
     * @param button  有可能是类型,有可能是uuid
     * @param table
     * @param functionUuid  
     * @return
     * @throws BaseException
     */
    public FieldSetEntity getPageButtons(FieldSetEntity fse) throws BaseException{
        
        String buttonUuid=fse.getString("buttonUuid");
        
        String table=fse.getString(CoreConst.SYSTEM_TABLE_NAME_LABEL);
        if(table==null) table=fse.getTableName();
        String functionUuid=fse.getString("functionUuid");
        String buttonType=fse.getString("buttonType");
        if(StringUtils.isEmpty(functionUuid) && !StringUtils.isEmpty(table)) {
            ///根据表去查功能,如有多个,取第一个
            FieldSetEntity f=baseDao.getFieldSetByFilter("product_sys_functions", "table_uuid=(select uuid from product_sys_datamodel_table where table_name=?) or table_uuid=? ", new String[] {table,table}, false);
            if(!FieldSetEntity.isEmpty(f)) {
                functionUuid=f.getUUID();
            }
        }
        FieldSetEntity page=null;
        
        if(!StringUtils.isEmpty(functionUuid)) {
            //根据按钮类型查出按钮uuid
            if(StringUtils.isEmpty(buttonUuid)&& !StringUtils.isEmpty(buttonType) ) {
                DataTableEntity d=baseDao.listTable("product_sys_function_buttons", " function_uuid=? and button_category_uuid=? ", new String[] {functionUuid,buttonType},"button_type");
                if(!DataTableEntity.isEmpty(d)) {
                    buttonUuid=d.getFieldSetEntity(0).getUUID();//取第一条
                }
            }
            //查出按钮对应界面,可能按钮有多个,取第一个
            if(!StringUtils.isEmpty(buttonUuid)) {
                StringBuilder b=new StringBuilder();
                b.append("select  *  from product_sys_mvc_page where function_uuid=? and uuid in (\r\n")
                .append("select  line_to from product_sys_link  where function_uuid=? and line_from=?\r\n")
                .append(" union all  ")
                .append("select  line_to from product_sys_link  where function_uuid=? and line_from=\r\n")
                .append(" (select  line_to mainUuid from product_sys_link  where function_uuid=? and line_from=?) ")
                .append(")");
                DataTableEntity d=baseDao.listTable(b.toString() , new String[] {functionUuid,functionUuid,buttonUuid,functionUuid,functionUuid,buttonUuid} );
                if(!DataTableEntity.isEmpty(d)) {
                    page=d.getFieldSetEntity(0);//取第一条
                }else {
                    
                }
            }
            if(page!=null) {
                //查界面后的所有按钮
                StringBuilder b=new StringBuilder();
                b.append("select  *  from product_sys_function_buttons where function_uuid=? and uuid in(\r\n")
                .append("select  line_to from product_sys_link  where function_uuid=? and line_from=?\r\n")
                .append(")");
                DataTableEntity d=baseDao.listTable(b.toString() , new String[] {functionUuid,functionUuid,page.getUUID()} );
                page.addSubDataTable(d);
            }else {
                throw new BaseException(MobileCoreCode.GET_ROUTER_FAIL);
            }
            return page;
        }else {
            throw new BaseException(MobileCoreCode.GET_ROUTER_FAIL);
        }
    }
    /**
     * 执行表达式
     * @param exp
     * @return
     */
    public FieldSetEntity excuteExp(String exp) {
       String sql="select "+exp+" expValue";
       FieldSetEntity fs=baseDao.getFieldSetBySQL(sql, null, false);
       return fs;
    }
}