Browse Source

git-svn-id: https://192.168.57.71/svn/lyggkj@25 1a6f6e3a-4066-fe46-b609-79c204482ece

ld_liufl 9 years ago
parent
commit
9f027dba8f

+ 0 - 344
gkaq/yjpt-java/trunk/java_src/com/jtgh/yjpt/webService/external/yjgl/cg/CgxxglWebService.java

@@ -1,344 +0,0 @@
-package com.jtgh.yjpt.webService.external.yjgl.cg;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.jws.HandlerChain;
-import javax.jws.WebService;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-
-import com.jtgh.yjpt.common.Constants;
-import com.jtgh.yjpt.common.PredicateModel;
-import com.jtgh.yjpt.common.PredicateModel.Operator;
-import com.jtgh.yjpt.common.SinglePageRequest;
-import com.jtgh.yjpt.common.SpecificationCreater;
-import com.jtgh.yjpt.common.Utils;
-import com.jtgh.yjpt.controller.BaseController;
-import com.jtgh.yjpt.entity.BaseEntity;
-import com.jtgh.yjpt.entity.auth.UserEntity;
-import com.jtgh.yjpt.entity.jyr.JyrEntity;
-import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgEntity;
-import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgsyEntity;
-import com.jtgh.yjpt.entity.yjgl.zdwxyfb.CgztEntity;
-import com.jtgh.yjpt.service.yjgl.zdwxyfb.CgService;
-import com.jtgh.yjpt.service.yjgl.zdwxyfb.CgsyService;
-import com.jtgh.yjpt.service.yjgl.zdwxyfb.CgztService;
-import com.jtgh.yjpt.service.yjgl.zdwxyfb.ZbhjjbqkService;
-import com.jtgh.yjpt.webService.WsResult;
-/**
- * 储罐接口WebService
- * 
- * @author chenkf
- * 
- */
-@Service
-@WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "cgxxglService")
-@HandlerChain(file="handle-chain.xml")
-public class CgxxglWebService extends BaseController {
-
-	@Autowired
-	private CgService cgService;
-	@Autowired
-	private ZbhjjbqkService zbhjjbqkService;
-	@Autowired
-	private CgztService cgztService;
-	@Autowired
-	private CgsyService cgsyService;
-
-	/**
-	 * 储罐保存
-	 * @param entity
-	 * @return
-	 */
-	public CgEntity save(CgEntity entity) {
-		if (null == entity.getId() || entity.getId().equals(0l)) {
-			entity.setAddDate(new Date());
-			entity.setAddUser(Utils.getWebServiceUser());
-			entity.setRecordCode("90");
-		} else {
-			entity.setUpdateDate(new Date());
-			entity.setUpdateUser(Utils.getWebServiceUser());
-		}
-		entity = cgService.save(entity);
-		cgService.savetb(entity, null, null);
-		return entity;
-	}
-	
-	/**
-	 * 删除
-	 * @param entity
-	 * @return
-	 */
-	public WsResult delete(CgEntity entity) {
-		WsResult ws = new WsResult();
-		try {
-			cgService.logicDelete(entity.getId());
-			zbhjjbqkService.logicDelete(zbhjjbqkService.findBySscg(entity));
-			ws.setResultCode(WsResult.SUCCESS);
-		} catch (Exception e) {
-			e.printStackTrace();
-			ws.setResultCode(WsResult.FAILURE);
-		}
-		return ws;
-	}
-	
-	/**
-	 * 根据企业和名称查询
-	 * @param jyr
-	 * @param name
-	 * @return
-	 */
-	public CgEntity findByJyrAndName(JyrEntity jyr ,String name){
-		List<CgEntity> list = cgService.findByJyrAndName(jyr,name);
-		if(list!=null&&list.size()>0){
-			return list.get(0);
-		}
-		return null;
-	}
-	
-	/**
-	 * 查询储罐信息
-	 * @param szd
-	 * @param szgq
-	 * @param gkjyr
-	 * @param cgmc
-	 * @return
-	 */
-	public List<CgEntity> findCgByParams(final Long szd,
-			final Long szgq,  final String gkjyr,final String cgmc){
-		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
-		addNotEmptyModel(filterList, "szd.id", szd,
-					Operator.LIKE_R);
-		addNotEmptyModel(filterList, "gq", szgq, Operator.EQ);
-		addNotEmptyModel(filterList, "dwmc", gkjyr, Operator.EQ);
-		addNotEmptyModel(filterList, "cgmc", cgmc, Operator.LIKE);
-		addNotEmptyModel(filterList, "recordStatus",
-				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-		if (Utils.getWebServiceUser() != null) {
-			UserEntity user = Utils.getWebServiceUser();
-			// 经营人只能查自己的
-			if (Constants.YES.equals(user.getSfjyr())
-					&& user.getJyrjcxx() != null) {
-				addNotEmptyModel(filterList, "dwmc", user.getJyrjcxx(),
-						Operator.EQ);
-			} else {
-				// 行政人员根据权限过滤(危货列表菜单ID=26)
-				addRecordCodeFilter(19l, filterList);
-			}
-		}
-		Specification<CgEntity> spec = SpecificationCreater
-				.searchByPredicateModels(filterList);
-		List<CgEntity> list= cgService.findAll(spec);
-		return list;
-	}
-	
-	/**
-	 * 分页查询储罐信息
-	 * @param szd
-	 * @param szgq
-	 * @param gkjyr
-	 * @param cgmc
-	 * @param n
-	 * @param pageCount
-	 * @return
-	 */
-	public List<CgEntity> getCgPageListByParams(final Long szd,
-			final Long szgq,  final String gkjyr,final String cgmc,int n, int pageCount){
-		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
-		addNotEmptyModel(filterList, "szd.id", szd,
-					Operator.LIKE_R);
-		addNotEmptyModel(filterList, "gq", szgq, Operator.EQ);
-		addNotEmptyModel(filterList, "dwmc", gkjyr, Operator.EQ);
-		addNotEmptyModel(filterList, "cgmc", cgmc, Operator.LIKE);
-		addNotEmptyModel(filterList, "recordStatus",
-				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-		if (Utils.getWebServiceUser() != null) {
-			UserEntity user = Utils.getWebServiceUser();
-			// 经营人只能查自己的
-			if (Constants.YES.equals(user.getSfjyr())
-					&& user.getJyrjcxx() != null) {
-				addNotEmptyModel(filterList, "dwmc", user.getJyrjcxx(),
-						Operator.EQ);
-			} else {
-				// 行政人员根据权限过滤(危货列表菜单ID=26)
-				addRecordCodeFilter(19l, filterList);
-			}
-		}
-		Specification<CgEntity> spec = SpecificationCreater
-				.searchByPredicateModels(filterList);
-		SinglePageRequest page = new SinglePageRequest(pageCount, n, "desc",
-				"id");
-		Page<CgEntity> list= cgService.findAll(spec,page);
-		if(list==null||list.getTotalPages()<pageCount){
-			return  new ArrayList<CgEntity>();
-		}
-		return list.getContent();
-	}
-	
-	
-	/**
-	 * 保存储罐状态
-	 * @param entity
-	 * @return
-	 */
-	public CgztEntity saveCgzt(CgztEntity entity)
-	{
-		if (null == entity.getId() || entity.getId().equals(0l)) {
-			entity.setAddDate(new Date());
-			entity.setAddUser(Utils.getWebServiceUser());
-			entity.setRecordCode("90");
-		} else {
-			entity.setUpdateDate(new Date());
-			entity.setUpdateUser(Utils.getWebServiceUser());
-		}
-		entity.setZt("1");
-		if(entity.getCg()!=null){
-			CgsyEntity cgsy = cgsyService.findByCg(entity.getCg());
-			if(cgsy!=null){
-				if (null != cgsy.getZdwd()
-						&& !"".equals(cgsy.getZdwd().trim())
-						&& null != entity.getWd()
-						&& !"".equals(cgsy.getZdwd().trim())
-						&& Double.parseDouble(entity.getWd()) > Double
-								.parseDouble(cgsy.getZdwd())) {
-					entity.setZt("2");
-				}
-				if (null != cgsy.getZxwd()
-						&& !"".equals(cgsy.getZxwd().trim())
-						&& null != entity.getWd()
-						&& !"".equals(cgsy.getZxwd().trim())
-						&& Double.parseDouble(entity.getWd()) < Double
-								.parseDouble(cgsy.getZxwd())) {
-					entity.setZt("2");
-				}
-				if (null != cgsy.getZdyl()
-						&& !"".equals(cgsy.getZdyl().trim())
-						&& null != entity.getYl()
-						&& !"".equals(cgsy.getZdyl().trim())
-						&& Double.parseDouble(entity.getYl()) > Double
-								.parseDouble(cgsy.getZdyl())) {
-					entity.setZt("2");
-				}
-				if (null != cgsy.getZxyl()
-						&& !"".equals(cgsy.getZxyl().trim())
-						&& null != entity.getYl()
-						&& !"".equals(cgsy.getZxyl().trim())
-						&& Double.parseDouble(entity.getYl()) <Double
-								.parseDouble(cgsy.getZxyl())) {
-					entity.setZt("2");
-				}
-				if (null != cgsy.getZdyw()
-						&& !"".equals(cgsy.getZdyw().trim())
-						&& null != entity.getYw()
-						&& !"".equals(cgsy.getZdyw().trim())
-						&& Double.parseDouble(entity.getYw()) > Double
-								.parseDouble(cgsy.getZdyw())) {
-					entity.setZt("2");
-				}
-				if (null != cgsy.getZxyw()
-						&& !"".equals(cgsy.getZxyw().trim())
-						&& null != entity.getYw()
-						&& !"".equals(cgsy.getZxyw().trim())
-						&& Double.parseDouble(entity.getYw()) < Double
-								.parseDouble(cgsy.getZxyw())) {
-					entity.setZt("2");
-				}
-			}
-		}
-		entity = cgztService.save(entity);
-		return entity;
-	}
-	
-	
-	/**
-	 * 获取储罐 
-	 * @param entity
-	 * @param hz
-	 * @param tbsj1
-	 * @param tbsj2
-	 * @return
-	 */
-	public List<CgztEntity> findCgztByParams(CgEntity entity,String hz,Date tbsj1,Date tbsj2){
-		List<PredicateModel> filterList = new ArrayList<PredicateModel>();
-		//所属储罐
-		addNotEmptyModel(filterList, "cg", entity.getId(), Operator.EQ);
-		//货种
-		addNotEmptyModel(filterList, "hz", hz, Operator.LIKE);
-		//填报时间
-		if(tbsj1!=null){
-			addNotEmptyModel(filterList, "tbsj", Utils.getDateFirstTime(tbsj1), Operator.GTE);
-		}
-		if(tbsj2!=null){
-			addNotEmptyModel(filterList, "tbsj", Utils.getDateLastTime(tbsj2), Operator.LTE);
-		}
-		addNotEmptyModel(filterList, "recordStatus",
-				BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
-		Specification<CgztEntity> spec = SpecificationCreater
-				.searchByPredicateModels(filterList);
-		List<CgztEntity> list= cgztService.findAll(spec);
-		return  list;
-	}
-	
-	/**
-	 * 获取最新状态
-	 * @param cg
-	 * @return
-	 */
-	public CgztEntity findCgztByCg(CgEntity cg){
-		return cgztService.findByCg(cg);
-	}
-	
-	/**
-	 * 保存储罐适用范围
-	 * @param entity
-	 * @return
-	 */
-	public  CgsyEntity saveCgsy(CgsyEntity entity){
-		if (null == entity.getId() || entity.getId().equals(0l)) {
-			entity.setAddDate(new Date());
-			entity.setAddUser(Utils.getWebServiceUser());
-			entity.setRecordCode("90");
-		} else {
-			entity.setUpdateDate(new Date());
-			entity.setUpdateUser(Utils.getWebServiceUser());
-		}
-		entity = cgsyService.save(entity);
-		return entity;
-	}
-	
-	/**
-	 * 获取储罐的适用范围
-	 * @param cg
-	 * @return
-	 */
-	public CgsyEntity findCgsyByCg(CgEntity cg){
-		return  cgsyService.findByCg(cg);
-	}
-
-	/**
-	 * 储罐保存
-	 * @param entity
-	 * @return
-	 */
-	public CgEntity saveCg(CgEntity entity,CgsyEntity cgsy) {
-		entity = save(entity);
-		cgsy.setCg(entity);
-		saveCgsy(cgsy);
-		return entity;
-	}
-	
-	/**
-	 * 获取储罐详细信息
-	 * @param id
-	 * @return
-	 */
-	public CgEntity findCgById(Long id){
-		return cgService.findOne(id);
-	}	
-	
-}