123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- package com.cxfws.jyrxxgl.service.impl;
- import java.util.ArrayList;
- import java.util.List;
- import javax.annotation.Resource;
- import javax.jws.WebMethod;
- import javax.jws.WebResult;
- import javax.jws.WebService;
- import javax.persistence.criteria.CriteriaBuilder;
- import javax.persistence.criteria.CriteriaBuilder.In;
- import javax.persistence.criteria.CriteriaQuery;
- import javax.persistence.criteria.Predicate;
- import javax.persistence.criteria.Root;
- import javax.xml.ws.WebServiceContext;
- import net.sf.json.JSONArray;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.data.jpa.domain.Specification;
- import org.springframework.stereotype.Service;
- import com.cxfws.config.utils.CxfwsUtils;
- import com.cxfws.jyrxxgl.service.IBwxxService;
- import com.xt.jygl.common.BaseWebCtl;
- import com.xt.jygl.gkjcxx.gk.service.GkService;
- import com.xt.jygl.gkjcxx.gq.service.GqService;
- import com.xt.jygl.gkjygl.gkjyr.jyrbw.service.BwService;
- import com.xt.jygl.gkjygl.gkjyr.jyrjbxx.entity.BwEntity;
- import com.xt.jygl.gkjygl.gkjyr.jyrjbxx.service.GkjyrService;
- import com.xt.jygl.gkjygl.gkjyr.jyrjbxx.vo.BwVo;
- import com.xt.jygl.gkjygl.gkjyr.xkzxx.service.XkzglbService;
- import com.xtframe.sec.code.entity.CodeEntity;
- import com.xtframe.sec.common.BaseEntity;
- import com.xtframe.sec.common.QueryService;
- import com.xtframe.sec.user.dao.UserDao;
- import com.xtframe.sec.user.entity.UserEntity;
- import com.xtframe.util.StringUtils;
- /**
- * 泊位信息
- *
- */
- @Service("bwWebService")
- @WebService(targetNamespace = "http://service.web.jsjty.com/", portName = "bwWebServicePort", serviceName = "bwWebService")
- public class BwxxService extends BaseWebCtl implements IBwxxService{
- @Autowired
- private QueryService query;
- @Autowired
- private BwService bwService;
- @Autowired
- private GkService gkService;
- @Autowired
- private GqService gqService;
- @Autowired
- private GkjyrService gkjyrService;
- @Autowired
- private XkzglbService xkzglbService;
- @Resource
- private WebServiceContext wscontext;
- @Autowired
- private UserDao userdao;
- @Override
- @WebMethod(operationName = "findBw", action = "http://service.web.jsjty.com/findBw")
- @WebResult(name = "result", targetNamespace = "http://service.web.jsjty.com/")
- public String findBw(final String szdid,final String szgkid,final String szgqid, final String ssjyr, final String bwmc,final String wxpbwid,final String sfdwkfid, final String fwlxid, final String bwbwyt) {
- if (!this.checkUser()){
- return BaseWebCtl.NOLOGIN;
- }
- // 查詢條件
- Specification<BwEntity> spec = new Specification<BwEntity>() {
- @Override
- public Predicate toPredicate(Root<BwEntity> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
- List<Predicate> list = new ArrayList<Predicate>();
-
-
- if (StringUtils.isNotEmpty(szdid)) {
- list.add(cb.like(root.get("szd").get("id").as(String.class), "%" + szdid + "%"));
- }
- if (StringUtils.isNotEmpty(szgkid)) {
- list.add(cb.like(root.get("szgk").get("id").as(String.class), "%" + szgkid + "%"));
- }
-
- if (StringUtils.isNotEmpty(szgqid)) {
- list.add(cb.like(root.get("szgq").get("id").as(String.class), "%" + szgqid + "%"));
- }
- if (StringUtils.isNotEmpty(ssjyr)) {
- list.add(cb.like(root.get("ssjyr").get("gkjyr").as(String.class), "%" + ssjyr + "%"));
- }
-
- if (StringUtils.isNotEmpty(bwmc)) {
- list.add(cb.like(root.get("bwmc").as(String.class), "%" + bwmc + "%"));
- }
- if (StringUtils.isNotEmpty(wxpbwid)) {
- list.add(cb.like(root.get("wxpbw").get("id").as(String.class), "%" + wxpbwid + "%"));
- }
- if (StringUtils.isNotEmpty(fwlxid)) {
- list.add(cb.like(root.get("fwlx").get("id").as(String.class), "%" + fwlxid + "%"));
- }
-
- if (StringUtils.isNotEmpty(sfdwkfid)) {
- list.add(cb.like(root.get("sfdwkf").get("id").as(String.class), "%" + sfdwkfid + "%"));
- }
-
- if (StringUtils.isNotEmpty(bwbwyt)) {
- list.add(cb.like(root.get("bwyt").as(String.class), "%" + bwbwyt + "%"));
- }
- String userName=CxfwsUtils.userNameFromHeaderInfo(wscontext);
- UserEntity userEntity = userdao.findByUname(userName);
- if (userEntity.getSsjyr()!=null) {
- list.add(cb.like(root.get("ssjyr").get("id").as(String.class), "%" + getSsjyr().getId() + "%"));
- } else {
- In<String> in = cb.in(root.get("szgq").get("id").as(String.class));
- List<String> gqlist = gqService.findGqListByUserId(userEntity.getId());
- if (gqlist != null && gqlist.size() > 0) {
- for (int i = 0; i < gqlist.size(); i++) {
- in.value(gqlist.get(i));
- }
- list.add(in);
- }
-
- }
- // 状态为0,9,10,11不显示
- list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_COPY));
- list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORD_STATE_DELETE));
- list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_BGFLAG));
- list.add(cb.notEqual(root.get("recordStatus").as(Integer.class), BaseEntity.RECORE_STATE_ZXFLAG));
- return cb.and(list.toArray(new Predicate[] {}));
- }
- };
- List<BwEntity> bwlist = query.findAll(spec, BwEntity.class);
- return Object2JsonStr(bwlist);
- }
- @Override
- public String findOne(String id) {
- if (!this.checkUser()){
- return BaseWebCtl.NOLOGIN;
- }
- BwEntity entity = bwService.findOne(id);
- BwVo vo = new BwVo();
- if (entity != null) {
- BeanUtils.copyProperties(entity, vo);
- vo.setSzdzw(entity.getSzd() != null ? entity.getSzd().getText() : "");
- vo.setSzgkzw(entity.getSzgk() != null ? entity.getSzgk().getGkmc() : "");
- vo.setSzgqzw(entity.getSzgq() != null ? entity.getSzgq().getGqmc() : "");
- vo.setSsjyrzw(entity.getSsjyr() != null ? entity.getSsjyr().getGkjyr() : "");
- vo.setSsmtzw(entity.getSsmt() != null ? entity.getSsmt().getMtmc() : "");
- vo.setBwsxzw(entity.getBwsx() != null ? entity.getBwsx().getText() : "");
- vo.setFwlxzw(entity.getFwlx() != null ? entity.getFwlx().getText() : "");
- vo.setWxpbwzw(entity.getWxpbw() != null ? entity.getWxpbw().getText() : "");
- vo.setZyhbwflzw(entity.getZyhbwfl() != null ? entity.getZyhbwfl().getText() : "");
- vo.setSffzzw(entity.getSffz() != null ? entity.getSffz().getText() : "");
- vo.setSfdwkfzw(entity.getSfdwkf() != null ? entity.getSfdwkf().getText() : "");
- vo.setBwszsxzw(entity.getBwszsx() != null ? entity.getBwszsx().getText() : "");
- vo.setSclxzw(entity.getSclx() != null ? entity.getSclx().getText() : "");
- vo.setJgxszw(entity.getJgxs() != null ? entity.getJgxs().getText() : "");
- vo.setKbcblxzw(entity.getKbcblx() != null ? entity.getKbcblx().getText() : "");
- vo.setSszyq(entity.getSszyq() != null ? entity.getSszyq().getId() : "");
- vo.setSszyqzw(entity.getSszyq() != null ? entity.getSszyq().getZyqmc() : "");
- vo.setZls(entity.getZls() != null ? entity.getZls().getId() : "");
- vo.setZlszw(entity.getZls() != null ? entity.getZls().getText() : "");
- vo.setXp(entity.getXp() != null ? entity.getXp().getId() : "");
- vo.setXpzw(entity.getXp() != null ? entity.getXp().getText() : "");
- vo.setBwszhd(entity.getBwszhd() != null ? entity.getBwszhd().getText() : "");
- if (entity.getBwyt() != null) {
- String bwytzw = "";
- String[] s = entity.getBwyt().split(",");
- /*
- * for (String string : s) { bwytzw +=
- * securityMgr.codeService().findOne(string).getText(); }
- */
- for (int i = 0; i < s.length; i++) {
- CodeEntity ce = securityMgr.codeService().findOne(s[i]);
- if (ce != null) {
- bwytzw += ce.getText();
- if (i != s.length - 1) {
- bwytzw += ",";
- }
- }
- }
- vo.setBwytzw(bwytzw);
- }
- vo.setSzd(entity.getSzd() != null ? entity.getSzd().getId() : "");
- vo.setSzgk(entity.getSzgk() != null ? entity.getSzgk().getId() : "");
- vo.setSzgq(entity.getSzgq() != null ? entity.getSzgq().getId() : "");
- vo.setSsjyr(entity.getSsjyr() != null ? entity.getSsjyr().getId() : "");
- vo.setSsmt(entity.getSsmt() != null ? entity.getSsmt().getId() : "");
- vo.setBwsx(entity.getBwsx() != null ? entity.getBwsx().getId() : "");
- vo.setFwlx(entity.getFwlx() != null ? entity.getFwlx().getId() : "");
- vo.setWxpbw(entity.getWxpbw() != null ? entity.getWxpbw().getId() : "");
- vo.setZyhbwfl(entity.getZyhbwfl() != null ? entity.getZyhbwfl().getId() : "");
- vo.setSffz(entity.getSffz() != null ? entity.getSffz().getId() : "");
- vo.setSfdwkf(entity.getSfdwkf() != null ? entity.getSfdwkf().getId() : "");
- vo.setBwszsx(entity.getBwszsx() != null ? entity.getBwszsx().getId() : "");
- vo.setSclx(entity.getSclx() != null ? entity.getSclx().getId() : "");
- vo.setJgxs(entity.getJgxs() != null ? entity.getJgxs().getId() : "");
- }
- JSONArray jsons=JSONArray.fromObject(vo);
- return jsons.toString();
- }
- }
|