Forráskód Böngészése

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

ld_jiangxf 8 éve
szülő
commit
ff059af10d

+ 54 - 49
gkjsjy/trunk/src/com/xt/jygl/gkyxtjyfx/hzttltj/ctl/GyhzttlfxCtl.java

@@ -18,26 +18,26 @@ import org.springframework.web.bind.annotation.RequestMapping;
 
 import com.xt.jygl.common.BaseWebCtl;
 import com.xt.jygl.gkyxtjyfx.hzttltj.entity.FlhwttlhjEntity;
-import com.xt.jygl.gkyxtjyfx.hzttltj.entity.FlhwttlhzEntity;
-import com.xt.jygl.gkyxtjyfx.hzttltj.entity.HzttlEntity;
-import com.xt.jygl.gkyxtjyfx.hzttltj.service.GyttlfxService;
-import com.xt.jygl.gkyxtjyfx.hzttltj.service.HzttlfxService;
+import com.xt.jygl.gkyxtjyfx.hzttltj.service.HwttlfxService;
 import com.xtframe.util.StringUtils;
 
 @Controller
 @RequestMapping(value = "/gyhzttlfx")
 public class GyhzttlfxCtl extends BaseWebCtl{
 	
-	@Autowired
+/*	@Autowired
 	private GyttlfxService gyttlfxService;
 	@Autowired
-	private HzttlfxService hzttlfxService;
+	private HzttlfxService hzttlfxService;*/
+	
+	@Autowired
+	private HwttlfxService hwttlfxService;
 	
 	@RequestMapping(value="/gymtttl/main")
 	public String gymtttl(Model model,final HttpServletRequest request,String tjx,String zzbl,final String startDate,final String endDate,final String menuid){
-		Specification<HzttlEntity> spec = new Specification<HzttlEntity>() {
+		Specification<FlhwttlhjEntity> spec = new Specification<FlhwttlhjEntity>() {
 			@Override
-			public Predicate toPredicate(Root<HzttlEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+			public Predicate toPredicate(Root<FlhwttlhjEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
 				List<Predicate> list = new ArrayList<Predicate>();
 				if (StringUtils.isNotEmpty(startDate)&&StringUtils.isNotEmpty(endDate)) {
 					list.add(cb.between(root.get("tj_month").as(String.class), startDate,endDate));
@@ -49,7 +49,7 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 				return cb.and(list.toArray(new Predicate[] {}));
 			}
 		};
-		List<HzttlEntity> entityList = query.findAll(spec, HzttlEntity.class);
+		List<FlhwttlhjEntity> entityList = query.findAll(spec, FlhwttlhjEntity.class);
 		//吞吐量
 		List<String> ttl = new ArrayList<String>();
 		//时间区间
@@ -58,32 +58,32 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 		List<String> bl = new ArrayList<String>();
 		String[] date;
 		int year,month;
-		HzttlEntity temp = null;
-		for(HzttlEntity e : entityList){
+		FlhwttlhjEntity temp = null;
+		for(FlhwttlhjEntity e : entityList){
 			ttl.add(e.getGK03010202000100020000000000()+"");
 		}
 		//比率
 		//同比
 		if(StringUtils.isEmpty(zzbl)||"tb".equals(zzbl)){
-			for(HzttlEntity e : entityList){
-				date = e.getTj_month().split("-");
+			for(FlhwttlhjEntity e : entityList){
+				date = e.gettj_month().split("-");
 				year = Integer.parseInt(date[0])-1;
 				month = Integer.parseInt(date[1]);
 				if(month<10){
-					temp = gyttlfxService.findOne(year+"-0"+month);
+					temp = hwttlfxService.findOne(year+"-0"+month);
 				}else{
-					temp = gyttlfxService.findOne(year+"-"+month);
+					temp = hwttlfxService.findOne(year+"-"+month);
 				}
 				if(temp == null || e.getGK03010202000100020000000000() == 0){
 					bl.add("0");
 				}else{
-					bl.add(""+(int)((e.getGK03010202000100020000000000()-temp.getGK03010202000100020000000000())/e.getGK03010202000100020000000000()*100));
+					bl.add(""+(int)((e.getGK03010202000100020000000000()-temp.getGK03010202000100020000000000())/temp.getGK03010202000100020000000000()*100));
 				}
 			}
 		}else if("hb".equals(zzbl)){
 			for(int i = 0; i < entityList.size(); i++){
 				if(i == 0){
-					date = entityList.get(i).getTj_month().split("-");
+					date = entityList.get(i).gettj_month().split("-");
 					year = Integer.parseInt(date[0]);
 					month = Integer.parseInt(date[1]);
 					if(month == 1){
@@ -92,9 +92,9 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 					}else{
 						month = month - 1;
 						if(month<10){
-							temp = gyttlfxService.findOne(year+"-0"+month);
+							temp = hwttlfxService.findOne(year+"-0"+month);
 						}else{
-							temp = gyttlfxService.findOne(year+"-"+month);
+							temp = hwttlfxService.findOne(year+"-"+month);
 						}
 					}
 					if(temp == null || entityList.get(i).getGK03010202000100020000000000() == 0){
@@ -113,7 +113,7 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 		}else{
 			for(int i = 0; i < entityList.size(); i++){
 				if(i == 0){
-					date = entityList.get(i).getTj_month().split("-");
+					date = entityList.get(i).gettj_month().split("-");
 					year = Integer.parseInt(date[0]);
 					month = Integer.parseInt(date[1]);
 					if(month == 1){
@@ -122,9 +122,9 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 					}else{
 						month = month - 1;
 						if(month<10){
-							temp = gyttlfxService.findOne(year+"-0"+month);
+							temp = hwttlfxService.findOne(year+"-0"+month);
 						}else{
-							temp = gyttlfxService.findOne(year+"-"+month);
+							temp = hwttlfxService.findOne(year+"-"+month);
 						}
 					}
 					if(temp == null || entityList.get(1).getGK03010202000100020000000000() == 0){
@@ -144,8 +144,8 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 			}
 		}
 		//获取时间区间
-		for(HzttlEntity e : entityList){
-			dateList.add("'"+e.getTj_month()+"'");
+		for(FlhwttlhjEntity e : entityList){
+			dateList.add("'"+e.gettj_month()+"'");
 		}
 		model.addAttribute("bl",bl);
 		model.addAttribute("ttl", ttl);
@@ -160,9 +160,9 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 	
 	@RequestMapping(value="/hzmtttl/main")
 	public String hzmtttl(Model model,final HttpServletRequest request,String tjx,String zzbl,final String startDate,final String endDate,final String menuid){
-		Specification<FlhwttlhzEntity> spec = new Specification<FlhwttlhzEntity>() {
+		Specification<FlhwttlhjEntity> spec = new Specification<FlhwttlhjEntity>() {
 			@Override
-			public Predicate toPredicate(Root<FlhwttlhzEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+			public Predicate toPredicate(Root<FlhwttlhjEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
 				List<Predicate> list = new ArrayList<Predicate>();
 				if (StringUtils.isNotEmpty(startDate)&&StringUtils.isNotEmpty(endDate)) {
 					list.add(cb.between(root.get("tj_month").as(String.class), startDate,endDate));
@@ -174,7 +174,7 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 				return cb.and(list.toArray(new Predicate[] {}));
 			}
 		};
-		List<FlhwttlhzEntity> entityList = query.findAll(spec, FlhwttlhzEntity.class);
+		List<FlhwttlhjEntity> entityList = query.findAll(spec, FlhwttlhjEntity.class);
 		//吞吐量
 		List<String> ttl = new ArrayList<String>();
 		//时间区间
@@ -183,30 +183,32 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 		List<String> bl = new ArrayList<String>();
 		String[] date;
 		int year,month;
-		FlhwttlhzEntity temp = null;
-		for(FlhwttlhzEntity e : entityList){
-			ttl.add(e.getGK03010202000200020000000000()+"");
+		FlhwttlhjEntity temp = null;
+		for(FlhwttlhjEntity e : entityList){
+			ttl.add(e.getGK03010202000000000000000000() - e.getGK03010202000100020000000000()+"");
 		}
 		//比率
 		//同比
 		if(StringUtils.isEmpty(zzbl)||"tb".equals(zzbl)){
-			for(FlhwttlhzEntity e : entityList){
+			for(FlhwttlhjEntity e : entityList){
 				date = e.gettj_month().split("-");
 				year = Integer.parseInt(date[0])-1;
 				month = Integer.parseInt(date[1]);
 				if(month<10){
-					temp = hzttlfxService.findOne(year+"-0"+month);
+					temp = hwttlfxService.findOne(year+"-0"+month);
 				}else{
-					temp = hzttlfxService.findOne(year+"-"+month);
+					temp = hwttlfxService.findOne(year+"-"+month);
 				}
-				if(temp == null || e.getGK03010202000200020000000000() == 0){
+				double hz = e.getGK03010202000000000000000000() - e.getGK03010202000100020000000000();
+				if(temp == null || hz == 0){
 					bl.add("0");
 				}else{
-					bl.add(""+(int)((e.getGK03010202000200020000000000()-temp.getGK03010202000200020000000000())/e.getGK03010202000200020000000000()*100));
+					bl.add(""+(int)((hz-(temp.getGK03010202000000000000000000() - temp.getGK03010202000100020000000000()))/(temp.getGK03010202000000000000000000() - temp.getGK03010202000100020000000000())*100));
 				}
 			}
 		}else if("hb".equals(zzbl)){
 			for(int i = 0; i < entityList.size(); i++){
+				double hz = entityList.get(i).getGK03010202000000000000000000() - entityList.get(i).getGK03010202000100020000000000();
 				if(i == 0){
 					date = entityList.get(i).gettj_month().split("-");
 					year = Integer.parseInt(date[0]);
@@ -217,26 +219,28 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 					}else{
 						month = month - 1;
 						if(month<10){
-							temp = hzttlfxService.findOne(year+"-0"+month);
+							temp = hwttlfxService.findOne(year+"-0"+month);
 						}else{
-							temp = hzttlfxService.findOne(year+"-"+month);
+							temp = hwttlfxService.findOne(year+"-"+month);
 						}
 					}
-					if(temp == null || entityList.get(i).getGK03010202000200020000000000() == 0){
+					if(temp == null || hz == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((entityList.get(i).getGK03010202000200020000000000()-temp.getGK03010202000200020000000000())/entityList.get(i).getGK03010202000200020000000000()*100));
+						bl.add(""+(int)((hz-(temp.getGK03010202000000000000000000() - temp.getGK03010202000100020000000000()))/hz*100));
 					}
 				}else{
-					if(entityList.get(i).getGK03010202000200020000000000() == 0){
+					if(hz == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((entityList.get(i).getGK03010202000200020000000000()-entityList.get(i-1).getGK03010202000200020000000000())/entityList.get(i).getGK03010202000200020000000000()*100));
+						double hzqn = entityList.get(i-1).getGK03010202000000000000000000() - entityList.get(i-1).getGK03010202000100020000000000();
+						bl.add(""+(int)((hz-hzqn)/hzqn*100));
 					}
 				}
 			}
 		}else{
 			for(int i = 0; i < entityList.size(); i++){
+				double hz = entityList.get(i).getGK03010202000000000000000000() - entityList.get(i).getGK03010202000100020000000000();
 				if(i == 0){
 					date = entityList.get(i).gettj_month().split("-");
 					year = Integer.parseInt(date[0]);
@@ -247,29 +251,30 @@ public class GyhzttlfxCtl extends BaseWebCtl{
 					}else{
 						month = month - 1;
 						if(month<10){
-							temp = hzttlfxService.findOne(year+"-0"+month);
+							temp = hwttlfxService.findOne(year+"-0"+month);
 						}else{
-							temp = hzttlfxService.findOne(year+"-"+month);
+							temp = hwttlfxService.findOne(year+"-"+month);
 						}
 					}
-					if(temp == null || entityList.get(i).getGK03010202000200020000000000() == 0){
+					if(temp == null || hz == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((entityList.get(i).getGK03010202000200020000000000()-temp.getGK03010202000200020000000000())/temp.getGK03010202000200020000000000()*100));
+						bl.add(""+(int)((hz-(temp.getGK03010202000000000000000000() - temp.getGK03010202000100020000000000()))/(temp.getGK03010202000000000000000000() - temp.getGK03010202000100020000000000())*100));
 					}
 				}else{
-					if(entityList.get(i-1).getGK03010202000200020000000000() == 0 && entityList.get(i).getGK03010202000200020000000000() != 0){
+					double hzqn = entityList.get(i-1).getGK03010202000000000000000000() - entityList.get(i-1).getGK03010202000100020000000000();
+					if(hzqn == 0 && hz != 0){
 						bl.add("100");
-					}else if(entityList.get(i).getGK03010202000200020000000000() == 0){
+					}else if(hzqn == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((entityList.get(i).getGK03010202000200020000000000()-entityList.get(i-1).getGK03010202000200020000000000())/entityList.get(i-1).getGK03010202000200020000000000()*100));
+						bl.add(""+(int)((hz-hzqn)/hzqn*100));
 					}
 				}
 			}
 		}
 		//获取时间区间
-		for(FlhwttlhzEntity e : entityList){
+		for(FlhwttlhjEntity e : entityList){
 			dateList.add("'"+e.gettj_month()+"'");
 		}
 		model.addAttribute("bl",bl);

+ 3 - 6
gkjsjy/trunk/src/com/xt/jygl/gkyxtjyfx/hzttltj/ctl/HwttlfxCtl.java

@@ -3,7 +3,6 @@ package com.xt.jygl.gkyxtjyfx.hzttltj.ctl;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
-import java.util.Map;
 
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
@@ -17,8 +16,6 @@ import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 
-import cache.CacheSearchCondition;
-
 import com.xt.jygl.common.BaseWebCtl;
 import com.xt.jygl.gkyxtjyfx.hzttltj.entity.FlhwttlhjEntity;
 import com.xt.jygl.gkyxtjyfx.hzttltj.service.HwttlfxService;
@@ -84,7 +81,7 @@ public class HwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000000000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000000000000000000()-temp.getGK03010202000000000000000000())/e.getGK03010202000000000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000000000000000000()-temp.getGK03010202000000000000000000())/temp.getGK03010202000000000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){
@@ -171,7 +168,7 @@ public class HwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000010000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000010000000000000()-temp.getGK03010202000010000000000000())/e.getGK03010202000010000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000010000000000000()-temp.getGK03010202000010000000000000())/temp.getGK03010202000010000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){
@@ -258,7 +255,7 @@ public class HwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000020000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000020000000000000()-temp.getGK03010202000020000000000000())/e.getGK03010202000020000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000020000000000000()-temp.getGK03010202000020000000000000())/temp.getGK03010202000020000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){

+ 3 - 6
gkjsjy/trunk/src/com/xt/jygl/gkyxtjyfx/hzttltj/ctl/WmhwttlfxCtl.java

@@ -3,7 +3,6 @@ package com.xt.jygl.gkyxtjyfx.hzttltj.ctl;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
-import java.util.Map;
 
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
@@ -17,8 +16,6 @@ import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 
-import cache.CacheSearchCondition;
-
 import com.xt.jygl.common.BaseWebCtl;
 import com.xt.jygl.gkyxtjyfx.hzttltj.entity.FlhwttlhjEntity;
 import com.xt.jygl.gkyxtjyfx.hzttltj.service.HwttlfxService;
@@ -83,7 +80,7 @@ public class WmhwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000001000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000001000000000000()-temp.getGK03010202000001000000000000())/e.getGK03010202000001000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000001000000000000()-temp.getGK03010202000001000000000000())/temp.getGK03010202000001000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){
@@ -165,7 +162,7 @@ public class WmhwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000021000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000021000000000000()-temp.getGK03010202000021000000000000())/e.getGK03010202000021000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000021000000000000()-temp.getGK03010202000021000000000000())/temp.getGK03010202000021000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){
@@ -247,7 +244,7 @@ public class WmhwttlfxCtl extends BaseWebCtl{
 					if(temp == null || e.getGK03010202000011000000000000() == 0){
 						bl.add("0");
 					}else{
-						bl.add(""+(int)((e.getGK03010202000011000000000000()-temp.getGK03010202000011000000000000())/e.getGK03010202000011000000000000()*100));
+						bl.add(""+(int)((e.getGK03010202000011000000000000()-temp.getGK03010202000011000000000000())/temp.getGK03010202000011000000000000()*100));
 					}
 				}
 			}else if("hb".equals(zzbl)){

+ 8 - 1
gkjsjy/trunk/src/com/xt/jygl/gkyxtjyfx/hzttltj/entity/FlhwttlhjEntity.java

@@ -7,7 +7,7 @@ import javax.persistence.Table;
 import com.xtframe.sec.common.BaseEntity;
 
 @Entity
-@Table(name = "GK_SHARE_JSJY_HJ_FHLTTL")
+@Table(name = "GK_SHARE_JSJY_HJ_FHLTTL_V")
 public class FlhwttlhjEntity extends BaseEntity<String> implements Cloneable{
 	
 	/**
@@ -16,6 +16,7 @@ public class FlhwttlhjEntity extends BaseEntity<String> implements Cloneable{
 	private static final long serialVersionUID = 1L;
 	
 	private String tj_month;//月份
+	private double GK03010202000100020000000000;//公用合计
 	private double GK03010202000000000000000000;//总计合计
 	private double GK03010202000000000000010000;//总计转口
 	private double GK03010202000000000000010100;//总计内:船过船
@@ -411,6 +412,12 @@ public class FlhwttlhjEntity extends BaseEntity<String> implements Cloneable{
 	public void settj_month(String tj_month) {
 		this.tj_month = tj_month;
 	}
+	public double getGK03010202000100020000000000() {
+		return GK03010202000100020000000000;
+	}
+	public void setGK03010202000100020000000000(double gK03010202000100020000000000) {
+		GK03010202000100020000000000 = gK03010202000100020000000000;
+	}
 	public double getGK03010202000000000000000000() {
 		return GK03010202000000000000000000;
 	}