Administrator
2023-03-10 8676413693275fa7c8ba77263fb413198d3e56e7
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.service.impl;
A 2
3 import java.util.List;
4
5 import javax.annotation.Resource;
6
7 import org.springframework.stereotype.Service;
8
9 import com.mandi.dao.common.PageResult;
10 import com.mandi.fendan.mapper.Fd_CompanyMapper;
11 import com.mandi.fendan.persist.Fd_Company;
12 import com.mandi.fendan.service.IAreaService;
13
14 @Service
15 public class AreaService implements IAreaService{
16     
17 //    @Resource
18 //    private IDDBMSSQLDao ddao;
19 //    @Resource
20 //    private Fd_ErpconfigMapper erpper;
21     
22     @Resource
23     private Fd_CompanyMapper fdcper;
24     
25     @Override
26     public PageResult<Fd_Company> getallcmList() {
27         PageResult<Fd_Company> prr=new PageResult<Fd_Company>();
28         List<Fd_Company> fcl=fdcper.getall();
29         prr.setCode(0);
30         prr.setList(fcl);
31         return prr;
32     }
33     
34     
35
36 //    @Override
37 //    public PageResult<Map<String, Object>> getList() {
38 //        PageResult<Map<String, Object>> prr=new PageResult<Map<String,Object>>();
39 //        String sql=SqlTxt.FHDQsql+" ORDER BY PP0XSDHDD_BH  ";
40 //        List<Fd_Erpconfig> l=erpper.getall();
41 //        if(l!=null&&l.size()>0){
42 //            Fd_Erpconfig erpdb=l.get(0);
43 //            String url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb();
44 //            Connection con=ddao.open(url, erpdb.getUsername(), erpdb.getPwd(),erpdb.getDbsign());
45 //            if(con==null){
46 //                prr.setCode(1);
47 //                prr.setErrmsg("erp数据库链接失败,请查询erp配置是否正确!");
48 //                return prr;
49 //            }
50 //            List<Map<String, Object>> d=new ArrayList<Map<String,Object>>();
51 //            try {
52 //                d=ddao.getmaps(sql, erpdb.getDbsign());
53 //            } catch (Exception e) {
54 //                e.printStackTrace();
55 //            }finally{
56 //                ddao.close();
57 //            }
58 //            List<Map<String, Object>> rel=new ArrayList<Map<String,Object>>();
59 //            for (Map<String, Object> map : d) {
60 //                String bianhao =map.get("bianhao")+"";//编号
61 //                String name =map.get("name")+"";//名称
62 //                int jishu =Integer.parseInt(map.get("jishu")+"");//层级
63 //                Map<String, Object> rem=new HashMap<String, Object>();
64 //                rem.put("bianhao", bianhao);
65 //                rem.put("name", name);
66 //                rem.put("jishu", jishu);
67 //                rem.put("xsbianhao", bianhao.substring(bianhao.length()-2, bianhao.length()));
68 //                rel.add(rem);
69 //            }
70 //            prr.setCode(0);
71 //            prr.setList(rel);
72 //        }else{
73 //            prr.setCode(1);
74 //            prr.setErrmsg("数据库未配置ERP数据源!");
75 //        }
76 //        return prr;
77 //    }
78 //
79 //    
80 //
81 //    @Override
82 //    public ObjectResult<String> getsecmList(String bianhao) {
83 //        ObjectResult<String> or=new ObjectResult<String>();
84 //        String sql=SqlTxt.FHWLsql+" where XSDQWL_DQBH='"+bianhao+"' ";
85 //        List<Fd_Erpconfig> l=erpper.getall();
86 //        if(l!=null&&l.size()>0){
87 //            Fd_Erpconfig erpdb=l.get(0);
88 //            String url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb();
89 //            Connection con=ddao.open(url, erpdb.getUsername(), erpdb.getPwd(),erpdb.getDbsign());
90 //            if(con==null){
91 //                or.setCode(1);
92 //                or.setErrmsg("erp数据库链接失败,请查询erp配置是否正确!");
93 //                return or;
94 //            }
95 //            List<Map<String, Object>> d=new ArrayList<Map<String,Object>>();
96 //            try {
97 //                d=ddao.getmaps(sql, erpdb.getDbsign());
98 //            } catch (Exception e) {
99 //                e.printStackTrace();
100 //            }finally{
101 //                ddao.close();
102 //            }
103 //            String ss="";
104 //            for (Map<String, Object> map : d) {
105 //                if(map.get("XSDQWL_WLBH")!=null){
106 //                    String XSDQWL_WLBH =map.get("XSDQWL_WLBH")+"";//编号
107 //                    if(StringUtils.isEmpty(ss)){
108 //                        ss=XSDQWL_WLBH;
109 //                    }else{
110 //                        ss=ss+","+XSDQWL_WLBH;
111 //                    }
112 //                }
113 //            }
114 //            or.setCode(0);
115 //            or.setItem(ss);
116 //        }else{
117 //            or.setCode(1);
118 //            or.setErrmsg("数据库未配置ERP数据源!");
119 //        }
120 //        return or;
121 //    }
122 //
123 //    @Override
124 //    @Transactional(rollbackOn=Exception.class)
125 //    public ObjectResult<Boolean> saveItem(String name, String bianhao,int jishu, String companyNos,boolean GLXJ) throws Exception {
126 //        ObjectResult<Boolean> or=new ObjectResult<Boolean>();
127 //        if(StringUtils.isEmpty(name)){
128 //            or.setCode(1);
129 //            or.setErrmsg("地区名称不能为空!");
130 //            return or;
131 //        }
132 //        if(StringUtils.isEmpty(bianhao)){
133 //            or.setCode(1);
134 //            or.setErrmsg("地区编号不能为空!");
135 //            return or;
136 //        }
137 //        if(bianhao.length()!=jishu*2){
138 //            or.setCode(1);
139 //            or.setErrmsg("地区编号不正确,请输入2的倍数的编号!");
140 //            return or;
141 //        }
142 //        List<Fd_Erpconfig> l=erpper.getall();
143 //        if(l==null||l.size()<=0){
144 //            or.setCode(1);
145 //            or.setErrmsg("数据库未配置ERP数据源!");
146 //            return or;
147 //        }
148 //        if(!StringUtils.isEmpty(companyNos)){
149 //            for (String cmstr : companyNos.split(",")) {
150 //                Fd_Company fdc=fdcper.getByCompanyNo(cmstr);
151 //                if(fdc==null){
152 //                    or.setCode(1);
153 //                    or.setErrmsg("物流公司设置不正确!");
154 //                    return or;
155 //                }
156 //            }
157 //        }
158 //        int ismx=1;
159 //        try {
160 //            for (Fd_Erpconfig erpdb : l) {
161 //                String url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb();
162 //                Connection con=ddao.open(url, erpdb.getUsername(), erpdb.getPwd(),erpdb.getDbsign());
163 //                if(con==null){
164 //                    throw new Exception("数据库连接失败!");
165 //                }
166 //                String FHDQsql=SqlTxt.FHDQsql+" where PP0XSDHDD_BH='"+bianhao+"' ";
167 //                Map<String, Object> mm=ddao.getmapnoclose(FHDQsql, erpdb.getDbsign());
168 //                if(mm!=null){
169 //                    FHDQsql=SqlTxt.FHDQsql+" where PP0XSDHDD_BH like '"+bianhao+"%' ";
170 //                    List<Map<String, Object>> cheo=ddao.getmapsnoclose(FHDQsql, erpdb.getDbsign());
171 //                    if(cheo!=null&&cheo.size()>1){
172 //                        ismx=0;
173 //                    }
174 //                    FHDQsql=SqlTxt.XGFHDQsql;
175 //                }else{
176 //                    FHDQsql=SqlTxt.XZFHDQsql;
177 //                }
178 //                List<Object> ll=new ArrayList<Object>();
179 //                ll.add(jishu);
180 //                ll.add(name);
181 //                ll.add(ismx);
182 //                ll.add(bianhao);
183 //                ddao.modifySql(FHDQsql, ll, erpdb.getDbsign());
184 //                
185 //                
186 //                ll.clear();
187 //                ll.add(0);
188 //                ll.add(bianhao.substring(0, bianhao.length()-2));
189 //                ddao.modifySql(SqlTxt.XGFHDQMXsql, ll, erpdb.getDbsign());
190 //                
191 //                String XZFHDQsql=SqlTxt.SCFHWLsql;
192 //                if(!GLXJ){
193 //                    XZFHDQsql+=" where XSDQWL_DQBH='"+bianhao+"' ";
194 //                }else{
195 //                    XZFHDQsql+=" where XSDQWL_DQBH like '"+bianhao+"%' ";
196 //                }
197 //                ddao.modifySql(XZFHDQsql, erpdb.getDbsign());
198 //                
199 //                if(!StringUtils.isEmpty(companyNos)){
200 //                    for (String cmstr : companyNos.split(",")) {
201 //                        if(!GLXJ){
202 //                            XZFHDQsql=SqlTxt.XZFHWLsql;
203 //                            ll.clear();
204 //                            ll.add(bianhao);
205 //                            ll.add(cmstr);
206 //                            ddao.modifySql(XZFHDQsql, ll, erpdb.getDbsign());
207 //                        }else{
208 //                            XZFHDQsql="insert into XSDQWL (XSDQWL_DQBH,XSDQWL_WLBH) select PP0XSDHDD_BH,'"+cmstr+"'  from PP0XSDHDD where PP0XSDHDD_BH LIKE '"+bianhao+"%' ";
209 ////                            ll.clear();
210 ////                            ll.add(bianhao);
211 ////                            ll.add(cmstr);
212 ////                            ddao.modifySql(XZFHDQsql, ll, erpdb.getDbsign());
213 //                            ddao.modifySql(XZFHDQsql, erpdb.getDbsign());
214 //                        }
215 //                    }
216 //                }
217 //            }
218 //        } catch (Exception e) {
219 //            ddao.robackclose();
220 //            throw new Exception(e.getMessage());
221 //        }finally{
222 //            ddao.close();
223 //        }
224 //        or.setCode(0);
225 //        or.setItem(true);
226 //        return or;
227 //    }
228 //
229 //    @Override
230 //    @Transactional(rollbackOn=Exception.class)
231 //    public ObjectResult<Boolean> delItem(String bianhao) throws Exception {
232 //        ObjectResult<Boolean>  or=new ObjectResult<Boolean>();
233 //        if(StringUtils.isEmpty(bianhao)){
234 //            or.setCode(1);
235 //            or.setErrmsg("地区编号不能为空!");
236 //            return or;
237 //        }
238 //        List<Fd_Erpconfig> l=erpper.getall();
239 //        if(l==null||l.size()<=0){
240 //            or.setCode(1);
241 //            or.setErrmsg("数据库未配置ERP数据源!");
242 //            return or;
243 //        }
244 //        
245 //        try {
246 //            for (Fd_Erpconfig erpdb : l) {
247 //                String url="jdbc:jtds:sqlserver://"+erpdb.getUri()+":"+erpdb.getPost()+";databaseName="+erpdb.getDb();
248 //                Connection con=ddao.open(url, erpdb.getUsername(), erpdb.getPwd(),erpdb.getDbsign());
249 //                if(con==null){
250 //                    throw new Exception("数据库连接失败!");
251 //                }
252 //                String FHDQsql=SqlTxt.FHDQsql+" where PP0XSDHDD_BH like '"+bianhao+"%' ";
253 //                List<Map<String, Object>> cheo=ddao.getmapsnoclose(FHDQsql, erpdb.getDbsign());
254 //                if(cheo!=null&&cheo.size()>1){
255 //                    throw new Exception("有下级不能删除!");
256 //                }
257 //                
258 //                String XZFHDQsql=SqlTxt.SCFHWLsql+" where XSDQWL_DQBH='"+bianhao+"' ";
259 //                ddao.modifySql(XZFHDQsql, erpdb.getDbsign());
260 //            
261 //                ddao.modifySql(SqlTxt.SCFHDQsql+" where PP0XSDHDD_BH='"+bianhao+"'", erpdb.getDbsign());
262 //                
263 //                FHDQsql=SqlTxt.FHDQsql+" where PP0XSDHDD_BH like '"+bianhao.substring(0, bianhao.length()-2)+"%' ";
264 //                cheo=ddao.getmapsnoclose(FHDQsql, erpdb.getDbsign());
265 //                if(cheo!=null&&cheo.size()<=1){
266 //                    List<Object> ll=new ArrayList<Object>();
267 //                    ll.add(0);
268 //                    ll.add(bianhao.substring(0, bianhao.length()-2));
269 //                    ddao.modifySql(SqlTxt.XGFHDQMXsql, ll, erpdb.getDbsign());
270 //                }
271 //            }
272 //        } catch (Exception e) {
273 //            ddao.robackclose();
274 //            throw new Exception(e.getMessage());
275 //        }finally{
276 //            ddao.close();
277 //        }
278 //        
279 //        or.setCode(0);
280 //        or.setItem(true);
281 //        return or;
282 //    }
283
284 }