Преглед изворни кода

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

ld_liufl пре 8 година
родитељ
комит
6bb781a521

+ 74 - 16
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/controller/zysqbp/ZysqbpController.java

@@ -32,6 +32,7 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
 import org.activiti.engine.ActivitiException;
 import org.activiti.engine.task.Task;
 import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@@ -133,6 +134,8 @@ import flex.messaging.io.amf.ASObject;
 @SuppressWarnings("unchecked")
 @Log(menuCode = "004001", menuCodeJyr = "004001_c")
 public class ZysqbpController extends BaseController {
+	private final static Logger LOGGER = Logger
+			.getLogger(ZysqbpController.class);
 	@Autowired
 	private ThreadPoolTaskExecutor threadPool;
 	@Autowired
@@ -236,6 +239,11 @@ public class ZysqbpController extends BaseController {
 			final Date bgsj2, final Date kgsj1, final Date kgsj2,
 			final Date wgsj1, final Date wgsj2, final String name,
 			final String gkdw) {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
+
 		BusinessContext bc = new BusinessContext();
 		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
 		try {
@@ -319,6 +327,10 @@ public class ZysqbpController extends BaseController {
 				}
 			};
 			Page<ZysqbpEntity> pageList = zysqbpService.findAll(spec, pageable);
+			long cost = System.currentTimeMillis() - startTime;
+			// System.err.println(url + ",cost:"+cost);
+			LOGGER.info(url + "<SUCCESS> (findAll()) cost:" + cost);
+			//
 			List<Boolean> sfsbList = new ArrayList<Boolean>();
 			for (ZysqbpEntity ba : pageList) {
 				sfsbList.add(zysqbpService.doCheckJyrAndWxp(ba.getZydw()
@@ -378,10 +390,17 @@ public class ZysqbpController extends BaseController {
 			}
 			bc = createBusinessContext(pageList);
 			bc.setAttribute("sfsbList", sfsbList);
+			cost = System.currentTimeMillis() - startTime;
+			// System.err.println(url + ",cost:"+cost);
+			LOGGER.info(url + "<SUCCESS> cost:" + cost);
 			return bc;
 		} catch (Exception e) {
+			LOGGER.error("error occured,url:" + url);
 			e.printStackTrace();
 		}
+		long cost = System.currentTimeMillis() - startTime;
+		System.err.println(url + ",cost:" + cost);
+		LOGGER.info(url + "<ERROR> cost:" + cost);
 		return null;
 
 	}
@@ -569,6 +588,7 @@ public class ZysqbpController extends BaseController {
 			bc.setAttribute("ths", zysqbpService.count(spec2));
 			return bc;
 		} catch (Exception e) {
+
 			e.printStackTrace();
 		}
 
@@ -1010,6 +1030,10 @@ public class ZysqbpController extends BaseController {
 			ZysqbpEntity entity, String lcStatus, final Date bgsj1,
 			final Date bgsj2, final Date kgsj1, final Date kgsj2,
 			final Date wgsj1, final Date wgsj2) {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		try {
 			BusinessContext bc = new BusinessContext();
 			// zysqbpService.wxhwSqValid();
@@ -1040,6 +1064,9 @@ public class ZysqbpController extends BaseController {
 			Specification<ZysqbpEntity> spec = SpecificationCreater
 					.searchByPredicateModels(filterList);
 			Page<ZysqbpEntity> pageList = zysqbpService.findAll(spec, pageable);
+			long cost = System.currentTimeMillis() - startTime;
+			// System.err.println(url + ",cost:"+cost);
+			LOGGER.info(url + " <SUCCESS> (findAll()) cost:" + cost);
 			List<Boolean> sfsbList = new ArrayList<Boolean>();
 			for (ZysqbpEntity ba : pageList) {
 				sfsbList.add(zysqbpService.doCheckJyrAndWxp(ba.getZydw()
@@ -1047,10 +1074,16 @@ public class ZysqbpController extends BaseController {
 			}
 			bc = createBusinessContext(pageList);
 			bc.setAttribute("sfsbList", sfsbList);
+			cost = System.currentTimeMillis() - startTime;
+			LOGGER.info(url + "<SUCCESS>cost:" + cost);
 			return bc;
 		} catch (Exception e) {
+			LOGGER.error("error occured,url:" + url);
 			e.printStackTrace();
 		}
+		long cost = System.currentTimeMillis() - startTime;
+		System.err.println(url + ",cost:" + cost);
+		LOGGER.info(url + " <ERROR> cost:" + cost);
 		return null;
 	}
 
@@ -1142,33 +1175,23 @@ public class ZysqbpController extends BaseController {
 	}
 
 	public BusinessContext save(ZysqbpEntity vo, Long functionId, Long accId) {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		try {
 			BusinessContext bc = createBusinessContext();
 			if (null == vo.getId() || vo.getId().equals(0l)) {
 				vo.setAddDate(new Date());
 				vo.setAddUser(Utils.getCurrentUser());
 				vo.setRecordCode(getCurrentRoleCode(functionId));
-				// SimpleDateFormat sdf = new SimpleDateFormat(
-				// "yyyy-MM-dd");
-				// StringBuffer bf=new StringBuffer();
-				// CodeEntity codeEntiy;
-				// if(Constants.DEPLOY_MODE_CITY.equals(GlobalData.DEPLOY_MODE)){
-				// codeEntiy=codeService.findOne(Long.parseLong(GlobalData.CITY_CODE));
-				// bf.append(codeEntiy.getByzd1());
-				// }
-				// String str = sdf.format(vo.getAddDate());
-				// bf.append(str);
-				// int count=zysqbpService.countTodaEntities();
-				// for (int i = 0; i < 4-(count+1+"").length(); i++) {
-				// bf.append("0");
-				// }
-				// bf.append(count+1+"");
-
 			} else {
 				vo.setUpdateDate(new Date());
 				vo.setUpdateUser(Utils.getCurrentUser());
 			}
 			vo = zysqbpService.saveEntity(vo);
+			long cost = System.currentTimeMillis() - startTime;
+			LOGGER.info(url + "<SUCCESS> (save ) cost:" + cost);
 			bc.setResult(vo);
 			AccessoryEntity acc = accessoryService.findOne(accId);
 			if (acc != null) {
@@ -1176,14 +1199,24 @@ public class ZysqbpController extends BaseController {
 				accessoryService.save(acc);
 			}
 			bc.addMsg("save.success", "common", MsgLevel.INFO);
+			cost = System.currentTimeMillis() - startTime;
+			LOGGER.info(url + "<SUCCESS> cost:" + cost);
 			return bc;
 		} catch (Exception e) {
+			LOGGER.error("error occured,url:" + url);
 			e.printStackTrace();
 		}
+		long cost = System.currentTimeMillis() - startTime;
+		System.err.println(url + ",cost:" + cost);
+		LOGGER.info(url + "<ERROR> cost:" + cost);
 		return null;
 	}
 
 	public BusinessContext save(ZysqbpEntity vo) {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		BusinessContext bc = createBusinessContext();
 		vo = zysqbpService.saveKgwg(vo);
 		// 同步到省级
@@ -1216,6 +1249,9 @@ public class ZysqbpController extends BaseController {
 		}
 		bc.setResult(vo);
 		bc.addMsg("save.success", "common", MsgLevel.INFO);
+		long cost = System.currentTimeMillis() - startTime;
+		// System.err.println(url + ",cost:"+cost);
+		LOGGER.info(url + "<SUCCESS> cost:" + cost);
 		return bc;
 	}
 
@@ -1412,6 +1448,10 @@ public class ZysqbpController extends BaseController {
 	}
 
 	public BusinessContext submit(ZysqbpEntity vo, Long functionId, Long accId) {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		BusinessContext bc = createBusinessContext();
 		int nsns = 0;
 		Date fzDate = vo.getZyddqybh().getFzsq().getYxqkssj();
@@ -1491,6 +1531,8 @@ public class ZysqbpController extends BaseController {
 		// vo = compareService.doCompare(vo.getId().toString());
 		// }
 		bc.setResult(vo);
+		long cost = System.currentTimeMillis() - startTime;
+		LOGGER.info(url + "<SUCCESS>  (submit)  cost:" + cost);
 		AccessoryEntity acc = accessoryService.findOne(accId);
 		if (acc != null) {
 			acc.setEntityId(vo.getId());
@@ -1528,6 +1570,7 @@ public class ZysqbpController extends BaseController {
 						zysqbpService.save(vo);
 					}
 				} catch (Exception e) {
+					LOGGER.error("error occured,url:" + url +" (ZysqbpWebService.save) ");
 					e.printStackTrace();
 					vo.setTbzt(Constants.NO);
 					zysqbpService.save(vo);
@@ -1541,6 +1584,7 @@ public class ZysqbpController extends BaseController {
 							acc.setTbzt(Constants.YES);
 							accessoryService.save(acc);
 						} catch (Exception e) {
+							LOGGER.error("error occured,url:" + url +" (AccessoryWebService.save) ");
 							e.printStackTrace();
 							acc.setTbzt(Constants.NO);
 							accessoryService.save(acc);
@@ -1599,6 +1643,8 @@ public class ZysqbpController extends BaseController {
 
 		}
 		bc.addMsg("save.success", "common", MsgLevel.INFO);
+		cost = System.currentTimeMillis() - startTime - cost;
+		LOGGER.info(url + "<ERROR> ( tb )cost:" + cost);
 		return bc;
 	}
 
@@ -1740,6 +1786,10 @@ public class ZysqbpController extends BaseController {
 	 */
 	public void aduit(String shyj, Date shsj, boolean auditflag,
 			ZysqbpEntity entity) throws CloneNotSupportedException {
+		long startTime = System.currentTimeMillis();
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		if (zysqbpService
 				.getCandidateTaskByUserAndBusKey(Utils.getCurrentUser().getId()
 						.toString(), entity.getId().toString()) != null) {
@@ -1768,6 +1818,11 @@ public class ZysqbpController extends BaseController {
 				.getId().toString(), entity.getId().toString().toString(),
 				ZysqbpEntity.PROCESS_DEFINITION_KEY);
 		zysqbpService.audit(param, variables, task);
+
+		// 审批
+		long cost = System.currentTimeMillis() - startTime;
+		LOGGER.info(url + "<SUCCESS> (audit ) cost:" + cost);
+
 		// 查询任务表中否还存在状态值为3 的数据,不存在则修改实体的recordStatus
 		List<TaskInfoEntity> list = taskService
 				.findByBusIdAndBusKeyAndRecordStatus(entity.getId().toString(),
@@ -1857,6 +1912,9 @@ public class ZysqbpController extends BaseController {
 				threadPool.execute(thread);
 			}
 		}
+		// 审批
+		cost = System.currentTimeMillis() - startTime - cost;
+		LOGGER.info(url + "<SUCCESS>  (tb ) cost:" + cost);
 		// if (auditflag == false) {
 		// ZysqbpEntity entity1 = zysqbpService.findOne(entity.getId());
 		// entity1.setRecordStatus(ZysqbpEntity.RECORD_STATE_REJECT);

+ 44 - 15
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/service/impl/zysqbp/ZysqbpServiceImpl.java

@@ -20,6 +20,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.activiti.engine.task.Task;
+import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -63,7 +64,8 @@ import com.yjpt.util.DateUtil;
 @Service
 public class ZysqbpServiceImpl extends
 		BaseWorkFlowServiceImpl<ZysqbpEntity, Long> implements ZysqbpService {
-
+	private final static Logger LOGGER = Logger
+			.getLogger(ZysqbpServiceImpl.class);
 	@Autowired
 	private ZysqbpDao zysqbpDao;
 	@Autowired
@@ -212,8 +214,10 @@ public class ZysqbpServiceImpl extends
 
 	@Override
 	public <S extends ZysqbpEntity> S submit(String currentRoleCode, S data) {
+		String url = Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		String zyddString;
-
 		if (data.getZyddqybh() != null)
 			zyddString = data.getZyddqybh().getQynbmc() != null ? data
 					.getZyddqybh().getQynbmc() : "";
@@ -244,9 +248,14 @@ public class ZysqbpServiceImpl extends
 			// }
 			workService.complete(param, variables, task);
 		} else {
-			data.setBh(generateNoByNoRule(GlobalData.CITY_CODE));
-			data.setRecordStatus(BaseEntity.RECORD_STATE_SUBMIT);
-			data = this.save(data);
+			try{
+				data.setBh(generateNoByNoRule(GlobalData.CITY_CODE));
+				data.setRecordStatus(BaseEntity.RECORD_STATE_SUBMIT);
+				data = this.save(data);
+			}catch (Exception e){
+				LOGGER.equals(url + "<EORROR> 获取编号 generateNoByNoRule  ");
+				e.printStackTrace();
+			}
 			if (Constants.YES.equals(GlobalData.QLYG_SYNC)) {
 				// 同步生成办件信息
 				this.saveApply(data);
@@ -2222,18 +2231,38 @@ public class ZysqbpServiceImpl extends
 
 	@Override
 	public ZysqbpEntity saveKgwg(ZysqbpEntity entity) {
+		long startTime = System.currentTimeMillis();
+		String url =  Thread.currentThread().getStackTrace()[2].getClassName()
+				+ "."
+				+ Thread.currentThread().getStackTrace()[2].getMethodName();
 		entity = this.save(entity);
 		// 同步到省级
-//		if (Constants.YES.equals(GlobalData.JAXWS_SYNC)) {
-//			ZysqbpWebService webServce = getWebService();
-//			if (webServce != null) {
-//				try {
-//					webServce.save(entity);
-//				} catch (Exception e) {
-//					e.printStackTrace();
-//				}
-//			}
-//		}
+		if (Constants.YES.equals(GlobalData.JAXWS_SYNC)) {
+			ZysqbpWebService webServce = getWebService();
+			if (webServce != null) {
+				try {
+					webServce.save(entity);
+				} catch (Exception e) {
+					LOGGER.error("error occured,url:" + url + " (ZysqbpWebService.save) ");
+					e.printStackTrace();
+				}
+				long cost =  System.currentTimeMillis() - startTime;
+				System.err.println(url + ",cost:"+cost);
+				LOGGER.info(url + "<ERROR> cost:"+cost);
+			}
+		}
+		if (Constants.YES.equals(GlobalData.JAXWS_SYNC)) {
+			ZysqbpWebService webServce = getWebService();
+			if (webServce != null) {
+				try {
+					webServce.save(entity);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		long cost =  System.currentTimeMillis() - startTime;
+		LOGGER.info(url + "<SUCCESS> cost:"+cost);
 		return entity;
 	}