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
package cn.ksource.web.facade.wechat.uwyw;
 
import java.util.HashMap;
import java.util.Map;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import cn.ksource.core.dao.BaseDao;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
 
@Service("uorderFacade")
public class UorderFacadeImpl implements UorderFacade {
 
    @Autowired
    private BaseDao baseDao;
 
    @Override
    public int umyorderCount(Map<String, String> params) {
        
        String orderStatus = params.get("flowstate");
        StringBuilder builder = new StringBuilder("SELECT COUNT(A.ID) FROM WORKFLOW_BASE A   ");
        if(orderStatus.equals("11")){
            builder.append(", WORKFLOW_NODE C ");
        }
        builder.append(" WHERE A.WFSTATE != :ysc  ");
        if(orderStatus.equals("11")){
            builder.append(" AND  C.FLOWID = A.ID AND C.FLOWSTATE = 1  AND C.CURRENT_DEALER_ID IS NOT NULL ");
        }
        params.put("ysc", ConvertUtil.obj2StrBlank(Constants.WORKFLOW_BASE_WFSTATE_DELETE));
        
        builder.append(" AND A.CUSTOMER_ID = :cusId ");
        
        String type = params.get("type");
        if(StringUtil.notEmpty(type)) {
            builder.append(" AND A.BUSINESSTYPE = :businessType");
            params.put("businessType", type);
        }
        
        
        if(StringUtil.notEmpty(orderStatus)&& !orderStatus.equals("11")) {
            builder.append(" AND A.WFSTATE = :orderStatus ");
            params.put("orderStatus", orderStatus);
        }
        
        return baseDao.queryForInteger(builder.toString(),params);
    }
 
    @Override
    public PageInfo umyorderData(PageInfo pageInfo,Map<String, String> params) {
 
        String orderStatus = params.get("flowstate");
        StringBuilder builder = new StringBuilder("SELECT A.* FROM WORKFLOW_BASE A  ");
        if(orderStatus.equals("11")){
            builder.append(", WORKFLOW_NODE C ");
        }
        builder.append("WHERE A.WFSTATE != :ysc  ");
        if(orderStatus.equals("11")){
            builder.append(" AND  C.FLOWID = A.ID AND C.FLOWSTATE = 1  AND C.CURRENT_DEALER_ID IS NOT NULL ");
        }
        params.put("ysc", ConvertUtil.obj2StrBlank(Constants.WORKFLOW_BASE_WFSTATE_DELETE));
        
        builder.append(" AND A.CUSTOMER_ID = :cusId ");
 
        String type = params.get("type");
        if(StringUtil.notEmpty(type)) {
            builder.append(" AND A.BUSINESSTYPE = :businessType");
            params.put("businessType", type);
        }
        
        
        if(StringUtil.notEmpty(orderStatus)&& !orderStatus.equals("11")) {
            builder.append(" AND A.WFSTATE = :orderStatus ");
            params.put("orderStatus", orderStatus);
        }
        
        
        builder.append(" ORDER BY A.CREATETIME DESC ");
        
        return baseDao.queryforSplitPageInfo(pageInfo, builder.toString(), params);
    }
}