Administrator
2023-03-10 1c4e40639d73faae3ba87156e0e4478c50b8ee33
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
package com.mandi.fendan.controller;
 
 
 
import java.util.Map;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
 
import com.mandi.common.Jacksonmethod;
import com.mandi.common.RequestParam;
import com.mandi.common.SessionMethod;
import com.mandi.dao.common.ObjectResult;
import com.mandi.dao.common.PageRequest;
import com.mandi.dao.common.PageResult;
import com.mandi.fendan.persist.Fd_Company;
import com.mandi.fendan.service.Ifd_companyService;
import com.mandi.system.persist.Login;
 
 
 
@Controller("fd_company_con")
@RequestMapping(value="/company",method={RequestMethod.POST})
public class Fd_CompanyController {
 
    @Resource
    private Ifd_companyService ics;
 
    @RequestMapping(value = "/getList.htm", method = {RequestMethod.POST })
    @ResponseBody
    public String getList(HttpServletRequest r,HttpServletResponse re){
        int page=RequestParam.getInt(r, "page");
        int pagesize=RequestParam.getInt(r, "pagesize");
        int pages=RequestParam.getInt(r, "pages");
        String keyword=RequestParam.getSqlString(r, "searchword");
 
        PageRequest pr=new PageRequest(page,pagesize,null);
        if(pages>0)
            pr.setNeedPages(true);
        else
            pr.setNeedPages(false);
 
 
        PageResult<Map<String, Object>> prr = ics.getlist(keyword,  pr);
        SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false));
        return null;
    }
    @RequestMapping(value = "/delItem.htm", method = {RequestMethod.POST})
    @ResponseBody
    public String delItem(HttpServletRequest r,HttpServletResponse re){
        String companyNo=RequestParam.getSqlString(r, "companyNo");
 
        ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
        try {
            orr = ics.delCompany(companyNo);
        } catch (Exception e) {
            orr.setCode(1);
            orr.setErrmsg(e.getMessage());
        }
 
        SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
        return null;
    }
    @RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST })
    @ResponseBody
    public String saveItem(HttpServletRequest r,HttpServletResponse re){
        String id=RequestParam.getSqlString(r, "id");
        String ywdyNos=RequestParam.getSqlString(r, "ywdyNos");
        Fd_Company fdc=new Fd_Company();
        fdc=RequestParam.getobj(r, fdc);
        fdc.setId(id);
        ObjectResult<Fd_Company> orr=new ObjectResult<Fd_Company>();
        try {
            orr =ics.saveCompany(fdc,ywdyNos);
        } catch (Exception e) {
            orr.setCode(1);
            orr.setErrmsg(e.getMessage());
        }
        SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
        return null;
    }
 
    @RequestMapping(value = "/getItem.htm", method = {RequestMethod.POST })
    @ResponseBody
    public String getItem(HttpServletRequest r,HttpServletResponse re){
        String companyNo=RequestParam.getSqlString(r, "companyNo");
 
 
        ObjectResult<Fd_Company> orr=new ObjectResult<Fd_Company>();
        try {
            orr = ics.getByCompanyNo(companyNo);
        } catch (Exception e) {
            orr.setCode(1);
            orr.setErrmsg(e.getMessage());
        }
 
        SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false));
        return null;
    }
 
    /**
     * 根据登录账号获取厂区信息
     * @param r
     * @param re
     * @return
     */
    @RequestMapping(value = "/getcqList.htm", method = {RequestMethod.POST })
    @ResponseBody
    public String getcqList(HttpServletRequest r,HttpServletResponse re){
        Login lg=SessionMethod.getlogin(r.getSession());
        PageResult<Map<String, Object>> prr=new PageResult<Map<String, Object>>();
        if(lg==null){
            prr.setCode(1);
            prr.setErrmsg("请重新登录账号!");
        }else{
            prr=this.ics.getcqList(lg.getDepartno());
        }
        SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false));
        return null;
    }
    /**
     * 根据登录账号获取改变运输公司的厂区信息
     * @param r
     * @param re
     * @return
     */
    @RequestMapping(value = "/getFdCqList.htm", method = {RequestMethod.POST })
    @ResponseBody
    public String getFdCqList(HttpServletRequest r,HttpServletResponse re){
        Login lg=SessionMethod.getlogin(r.getSession());
        PageResult<Map<String, Object>> prr=new PageResult<Map<String, Object>>();
        if(lg==null){
            prr.setCode(1);
            prr.setErrmsg("请重新登录账号!");
        }else{
            prr=this.ics.getFdCqList(lg.getDepartno(),lg);
        }
        SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false));
        return null;
    }
 
 
}