cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
package cn.ksource.web.facade.bpbj;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
 
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import cn.ksource.beans.CMDB_CI_CATEGORY;
import cn.ksource.beans.GG_RECORD;
import cn.ksource.beans.SC_WORKFLOW_RELEASE;
import cn.ksource.beans.SPARE_PART;
import cn.ksource.beans.SPARE_PART_STORAGE;
import cn.ksource.beans.WORKFLOW_BASE;
import cn.ksource.beans.WORKFLOW_NODE;
import cn.ksource.core.dao.BaseDao;
import cn.ksource.core.dao.SqlParameter;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.AjaxUtil;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.util.JsonUtil;
import cn.ksource.core.util.OrderCodeUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.util.TwoDimensionCode;
import cn.ksource.core.web.SysInfoMsg;
import cn.ksource.core.web.WebUtil;
import cn.ksource.core.workflow.NodeDealEntity;
import cn.ksource.core.workflow.NodeFinishEntity;
import cn.ksource.core.workflow.WorkflowBusinessService;
import cn.ksource.core.workflow.WorkflowCoreService;
import cn.ksource.web.Constants;
import cn.ksource.web.entity.WorkFlowSupportEntity;
import cn.ksource.web.service.WorkOrderCodeService;
import cn.ksource.web.service.record.RecordService;
import cn.ksource.web.service.workFlowSupport.WorkFlowSupportService;
 
@Service("SpareQueryFacade")
public class SpareQueryFacadeImpl implements SpareQueryFacade {
    
    @Resource
    private BaseDao baseDao;
    /**
     * 备件申请列表信息
     * @return
     */
    @Override
    public List<Map> getSpareList() {
        return baseDao.queryForList(" select * from SPARE_PART_APPLY where STATE=1 ");
    }
    /**
     * 备件申请列表信息
     * @param pageInfo
     * @param params
     * @return
     */
    @Override
    public PageInfo  getSpareListData(Map<String, String> params,PageInfo pageInfo){
        StringBuilder sql = new StringBuilder();
        Map paramMap = new HashMap();
        sql.append(" select * from SPARE_PART_APPLY  where 1=1 AND STATE>=3 ");
        String order_code=params.get("order_code");
        String order_name=params.get("order_name");
        String state=params.get("state");
        String start_time=params.get("start_time");
        String end_time=params.get("end_time");
        String customer_id=params.get("customer_id");
        //项目
        if (StringUtil.isNotBlank(customer_id)) {
               sql.append(" and PROJECT_ID=:project_id ");
               paramMap.put("project_id", customer_id);
          }
         //工单编号
         if (StringUtil.isNotBlank(order_code)) {
               sql.append(" and order_code like :order_code ");
               paramMap.put("order_code","%"+order_code.trim()+"%");
          }
         //工单名称
         if (StringUtil.isNotBlank(order_name)) {
               sql.append(" and order_name like:order_name ");
               paramMap.put("order_name", "%"+order_name.trim()+"%");
          }
         //工单状态
         if (StringUtil.isNotBlank(state)) {
               sql.append(" and state=:state ");
               paramMap.put("state", state);
          }
        //开始时间
        if(StringUtil.isNotBlank(start_time)){
                sql.append(" AND gmt_create>=:start_time");
                paramMap.put("start_time", start_time+"000000");
        }
         //结束时间
         if(StringUtil.isNotBlank(end_time)){
                sql.append(" and gmt_create<=:end_time");
                paramMap.put("end_time", end_time+"235959");
            }
         sql.append(" order by gmt_create desc ");
        return  baseDao.queryforSplitPageInfo(pageInfo,sql.toString(), paramMap);
    }
    /**
     * 备件申请列表数量信息
     * @param pageInfo
     * @param params
     * @return
     */
    @Override
    public int  getSpareListCount(Map<String, String> params) {
        StringBuilder sql = new StringBuilder();
        Map paramMap = new HashMap();
        sql.append(" select count(*) from SPARE_PART_APPLY where 1=1 AND STATE>=3");
        String order_code=params.get("order_code");
        String order_name=params.get("order_name");
        String state=params.get("state");
        String start_time=params.get("start_time");
        String end_time=params.get("end_time");
        String customer_id=params.get("customer_id");
        //项目
        if (StringUtil.isNotBlank(customer_id)) {
               sql.append(" and PROJECT_ID=:project_id ");
               paramMap.put("project_id", customer_id);
          }
         //工单编号
         if (StringUtil.isNotBlank(order_code)) {
               sql.append(" and order_code like :order_code ");
               paramMap.put("order_code","%"+order_code.trim()+"%");
          }
         //工单名称
         if (StringUtil.isNotBlank(order_name)) {
               sql.append(" and order_name like:order_name ");
               paramMap.put("order_name", "%"+order_name.trim()+"%");
          }
         //工单状态
         if (StringUtil.isNotBlank(state)) {
               sql.append(" and state=:state ");
               paramMap.put("state", state);
          }
        //开始时间
            if(StringUtil.isNotBlank(start_time)){
                    sql.append(" AND gmt_create>=:start_time");
                    paramMap.put("start_time", start_time+"000000");
            }
         //结束时间
         if(StringUtil.isNotBlank(end_time)){
                sql.append(" and gmt_create<=:end_time");
                paramMap.put("end_time", end_time+"235959");
            }
           int count = baseDao.queryForInteger(sql.toString(), paramMap);
           return count;
           
    }
    
            
}