Browse Source

git-svn-id: https://192.168.57.71/svn/jsgkj@181 931142cf-59ea-a443-aa0e-51397b428577

ld_xuhx 9 năm trước cách đây
mục cha
commit
bdcc12aee5

+ 87 - 64
gkjsjy/trunk/src/com/xt/jygl/gkjsgl/jsjdcbsj/webservice/JsjdcbsjWebService.java

@@ -10,20 +10,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 
 import com.xt.jygl.accessory.entity.AccessoryEntity;
+import com.xt.jygl.accessory.service.AccessoryService;
 import com.xt.jygl.common.Constants;
-import com.xt.jygl.gkjsgl.jgbg.entity.JgbgEntity;
-import com.xt.jygl.gkjsgl.jgbg.entity.JgbgfjEntity;
-import com.xt.jygl.gkjsgl.jgsq.entity.JgsqEntity;
-import com.xt.jygl.gkjsgl.jgzx.entity.JgzxEntity;
-import com.xt.jygl.gkjsgl.jgzx.entity.JgzxfjEntity;
-import com.xt.jygl.gkjsgl.jsjdbg.entity.JsjdbgEntity;
-import com.xt.jygl.gkjsgl.jsjdbg.entity.JsjdbgfjEntity;
+import com.xt.jygl.common.GlobalData;
+import com.xt.jygl.ftp.Ftp;
+import com.xt.jygl.ftp.FtpUtil;
 import com.xt.jygl.gkjsgl.jsjdcbsj.entity.JsjdcbsjEntity;
 import com.xt.jygl.gkjsgl.jsjdcbsj.entity.JsjdcbsjfjEntity;
 import com.xt.jygl.gkjsgl.jsjdcbsj.service.JsjdcbsjService;
 import com.xt.jygl.gkjsgl.jsjdcbsj.service.JsjdcbsjfjService;
-import com.xt.jygl.gkjsgl.jsjdzx.entity.JsjdzxEntity;
-import com.xt.jygl.gkjsgl.jsjdzx.entity.JsjdzxfjEntity;
 
 @Controller
 @WebService(targetNamespace = "http://webService.jsjy.com/", serviceName = "jsjdcbsjService")
@@ -33,72 +28,100 @@ public class JsjdcbsjWebService {
 	private JsjdcbsjService jsjdcbsjService;
 	@Autowired
 	private JsjdcbsjfjService jsjdcbsjfjService;
-
+	@Autowired
+	private AccessoryService accessoryService;
 	/**
 	 * 保存信息
 	 */
-	public JsjdcbsjEntity saveJsjdcbsj(JsjdcbsjEntity entity,List<JsjdcbsjfjEntity> fjlist,List<AccessoryEntity> acclist) {
+	public JsjdcbsjEntity saveJsjdcbsj(JsjdcbsjEntity entity, List<JsjdcbsjfjEntity> fjlist, List<AccessoryEntity> acclist) {
 		JsjdcbsjEntity newjsjdcbsj = new JsjdcbsjEntity();
 		BeanUtils.copyProperties(entity, newjsjdcbsj);
 		entity.setTbzt(Constants.NO);
 		newjsjdcbsj.setId(entity.getId());
-
 		newjsjdcbsj = jsjdcbsjService.save(newjsjdcbsj);
 
+		Ftp f = new Ftp();
+		f.setIpAddr("127.0.0.1");
+		f.setPort(21);
+		f.setUserName("test");
+		f.setPwd("test");
+		try {
+			if (fjlist != null && fjlist.size() > 0) {
+				for (JsjdcbsjfjEntity fj : fjlist) {
+					if (acclist != null && acclist.size() > 0) {
+						for (AccessoryEntity acc : acclist) {
+							if (acc.getId().equals(fj.getFjid())) {
+								acc = accessoryService.save(acc);
+								fj.setFjid(acc.getId());
+								if (GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY)) {// 市下载ftp从省下载到市
+									// 本地目录
+									String localBaseDir = GlobalData.UPLOAD_FILE_PATH + acc.getFilepath();
+									// 远程目录
+									String remoteBaseDir = "/jsjdcbsj/";
+									// 下载ftp文件
+									boolean downflag = FtpUtil.startDown(f, localBaseDir, remoteBaseDir, acc.getFilename());
+
+									if (downflag) {
+										System.out.println("ok");
+									}
+								} else {// 省上传ftp从市上传到省
+
+								}
+							}
+						}
+
+					}
+
+					jsjdcbsjfjService.save(fj);
+				}
+			}
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
 		return newjsjdcbsj;
 	}
-	
-	/*public JsjdbgEntity saveJsjdbg(JsjdbgEntity entity,List<JsjdbgfjEntity> fjlist,List<AccessoryEntity> acclist) {
-		JsjdbgEntity newjsjdcbsj = new JsjdbgEntity();
-		BeanUtils.copyProperties(entity, newjsjdcbsj);
-		entity.setTbzt(Constants.NO);
-		newjsjdcbsj.setId(entity.getId());
-
-
-		return newjsjdcbsj;
-	}
-	
-	public JsjdzxEntity saveJsjdzx(JsjdzxEntity entity,List<JsjdzxfjEntity> fjlist,List<AccessoryEntity> acclist) {
-		JsjdzxEntity newjsjdcbsj = new JsjdzxEntity();
-		BeanUtils.copyProperties(entity, newjsjdcbsj);
-		entity.setTbzt(Constants.NO);
-		newjsjdcbsj.setId(entity.getId());
-
-
-		return newjsjdcbsj;
-	}
-	
-	public JgsqEntity saveJgsq(JsjdcbsjEntity entity,List<JgzxfjEntity> fjlist,List<AccessoryEntity> acclist) {
-		JgsqEntity newjsjdcbsj = new JgsqEntity();
-		BeanUtils.copyProperties(entity, newjsjdcbsj);
-		entity.setTbzt(Constants.NO);
-		newjsjdcbsj.setId(entity.getId());
-
-
-		return newjsjdcbsj;
-	}
-	
-	public JgbgEntity saveJgbg(JgbgEntity entity,List<JgbgfjEntity> fjlist,List<AccessoryEntity> acclist) {
-		JgbgEntity newjsjdcbsj = new JgbgEntity();
-		BeanUtils.copyProperties(entity, newjsjdcbsj);
-		entity.setTbzt(Constants.NO);
-		newjsjdcbsj.setId(entity.getId());
 
-
-		return newjsjdcbsj;
-	}
-	
-	public JgzxEntity saveJgzx(JgzxEntity entity,List<JsjdzxfjEntity> fjlist,List<AccessoryEntity> acclist) {
-		JgzxEntity newjsjdcbsj = new JgzxEntity();
-		BeanUtils.copyProperties(entity, newjsjdcbsj);
-		entity.setTbzt(Constants.NO);
-		newjsjdcbsj.setId(entity.getId());
-
-
-		return newjsjdcbsj;
-	}
-	*/
-	
-	
+	/*
+	 * public JsjdbgEntity saveJsjdbg(JsjdbgEntity entity,List<JsjdbgfjEntity>
+	 * fjlist,List<AccessoryEntity> acclist) { JsjdbgEntity newjsjdcbsj = new
+	 * JsjdbgEntity(); BeanUtils.copyProperties(entity, newjsjdcbsj);
+	 * entity.setTbzt(Constants.NO); newjsjdcbsj.setId(entity.getId());
+	 * 
+	 * 
+	 * return newjsjdcbsj; }
+	 * 
+	 * public JsjdzxEntity saveJsjdzx(JsjdzxEntity entity,List<JsjdzxfjEntity>
+	 * fjlist,List<AccessoryEntity> acclist) { JsjdzxEntity newjsjdcbsj = new
+	 * JsjdzxEntity(); BeanUtils.copyProperties(entity, newjsjdcbsj);
+	 * entity.setTbzt(Constants.NO); newjsjdcbsj.setId(entity.getId());
+	 * 
+	 * 
+	 * return newjsjdcbsj; }
+	 * 
+	 * public JgsqEntity saveJgsq(JsjdcbsjEntity entity,List<JgzxfjEntity>
+	 * fjlist,List<AccessoryEntity> acclist) { JgsqEntity newjsjdcbsj = new
+	 * JgsqEntity(); BeanUtils.copyProperties(entity, newjsjdcbsj);
+	 * entity.setTbzt(Constants.NO); newjsjdcbsj.setId(entity.getId());
+	 * 
+	 * 
+	 * return newjsjdcbsj; }
+	 * 
+	 * public JgbgEntity saveJgbg(JgbgEntity entity,List<JgbgfjEntity>
+	 * fjlist,List<AccessoryEntity> acclist) { JgbgEntity newjsjdcbsj = new
+	 * JgbgEntity(); BeanUtils.copyProperties(entity, newjsjdcbsj);
+	 * entity.setTbzt(Constants.NO); newjsjdcbsj.setId(entity.getId());
+	 * 
+	 * 
+	 * return newjsjdcbsj; }
+	 * 
+	 * public JgzxEntity saveJgzx(JgzxEntity entity,List<JsjdzxfjEntity>
+	 * fjlist,List<AccessoryEntity> acclist) { JgzxEntity newjsjdcbsj = new
+	 * JgzxEntity(); BeanUtils.copyProperties(entity, newjsjdcbsj);
+	 * entity.setTbzt(Constants.NO); newjsjdcbsj.setId(entity.getId());
+	 * 
+	 * 
+	 * return newjsjdcbsj; }
+	 */
 
 }