|
@@ -0,0 +1,294 @@
|
|
|
|
+package com.jtgh.yjpt.webService.jyr;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+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.PredicateModel;
|
|
|
|
+import com.jtgh.yjpt.common.PredicateModel.Operator;
|
|
|
|
+import com.jtgh.yjpt.common.Constants;
|
|
|
|
+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.BwEntity;
|
|
|
|
+import com.jtgh.yjpt.entity.jyr.JyrEntity;
|
|
|
|
+import com.jtgh.yjpt.entity.jyrxxgl.JyrckxxEntity;
|
|
|
|
+import com.jtgh.yjpt.entity.jyrxxgl.JyrdcxxEntity;
|
|
|
|
+import com.jtgh.yjpt.entity.jyrxxgl.RyjbxxEntity;
|
|
|
|
+import com.jtgh.yjpt.entity.jyrxxgl.RyjbxxZSEntity;
|
|
|
|
+import com.jtgh.yjpt.service.jyr.BwService;
|
|
|
|
+import com.jtgh.yjpt.service.jyr.JyrService;
|
|
|
|
+import com.jtgh.yjpt.service.jyrxxgl.RyjbxxService;
|
|
|
|
+import com.jtgh.yjpt.webService.WsResult;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 经营人WebService
|
|
|
|
+ *
|
|
|
|
+ * @author chenkf
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+@WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "jyrxxglService")
|
|
|
|
+@HandlerChain(file = "handle-chain.xml")
|
|
|
|
+public class JyrxxglWebService extends BaseController {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private JyrService service;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RyjbxxService ryjbxxService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BwService bwService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 保存信息
|
|
|
|
+ */
|
|
|
|
+ public void save(JyrEntity jyrEntity, List<JyrdcxxEntity> dcxxeditlist,
|
|
|
|
+ List<JyrdcxxEntity> dcxxdeletelist, List<BwEntity> bw_add_list,
|
|
|
|
+ List<BwEntity> bw_del_list, List<JyrckxxEntity> ckList,
|
|
|
|
+ List<JyrckxxEntity> delCkList) {
|
|
|
|
+ jyrEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
|
+ jyrEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
|
+ for (JyrdcxxEntity dcEntity : dcxxeditlist) {
|
|
|
|
+ dcEntity.setAddUser(Utils.getWebServiceUser());
|
|
|
|
+ dcEntity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
|
+ if (jyrEntity != null) {
|
|
|
|
+ dcEntity.setSzd(jyrEntity.getSzd());
|
|
|
|
+ dcEntity.setSzgq(jyrEntity.getSzgq());
|
|
|
|
+ dcEntity.setQymc(jyrEntity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+ for (BwEntity entity : bw_add_list) {
|
|
|
|
+ entity.setAddUser(Utils.getWebServiceUser());
|
|
|
|
+ entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
|
+ if (jyrEntity != null) {
|
|
|
|
+ entity.setSzd(jyrEntity.getSzd());
|
|
|
|
+ entity.setSzgq(jyrEntity.getSzgq());
|
|
|
|
+ entity.setQymc(jyrEntity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (JyrckxxEntity entity : ckList) {
|
|
|
|
+ entity.setAddUser(Utils.getWebServiceUser());
|
|
|
|
+ entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
|
+ if (jyrEntity != null) {
|
|
|
|
+ entity.setSzd(jyrEntity.getSzd());
|
|
|
|
+ entity.setGq(jyrEntity.getSzgq());
|
|
|
|
+ entity.setSsjyr(jyrEntity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ service.save(jyrEntity, dcxxeditlist, dcxxdeletelist, bw_add_list,
|
|
|
|
+ bw_del_list, ckList, delCkList, "tb");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除
|
|
|
|
+ */
|
|
|
|
+ public WsResult delete(JyrEntity jyr) {
|
|
|
|
+ WsResult ws = new WsResult();
|
|
|
|
+ try {
|
|
|
|
+ service.delete(jyr, "tb");
|
|
|
|
+ ws.setResultCode(WsResult.SUCCESS);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ ws.setResultCode(WsResult.FAILURE);
|
|
|
|
+ }
|
|
|
|
+ return ws;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分页查询
|
|
|
|
+ *
|
|
|
|
+ * @param szd
|
|
|
|
+ * @param szgq
|
|
|
|
+ * @param gkjyr
|
|
|
|
+ * @param fddbr
|
|
|
|
+ * @param sfwhqy
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<JyrEntity> getJyrPageListByParams(String szd, String szgq,
|
|
|
|
+ String gkjyr, String fddbr, String sfwhqy, int n, int pageCount) {
|
|
|
|
+ try {
|
|
|
|
+ List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
|
+ BaseEntity.RECORD_STATE_DRAFT, Operator.NEQ);
|
|
|
|
+ // 根据所在地过滤
|
|
|
|
+ if (szd != null)
|
|
|
|
+ addNotEmptyModel(filterList, "szd.id", szd, Operator.EQ);
|
|
|
|
+ // 根据港区过滤
|
|
|
|
+ if (szgq != null && !szgq.equals("")) {
|
|
|
|
+ addNotEmptyModel(filterList, "szgq.id", szgq, Operator.EQ);
|
|
|
|
+ }
|
|
|
|
+ if (gkjyr != null && !gkjyr.equals("")) {
|
|
|
|
+ addNotEmptyModel(filterList, "gkjyr", gkjyr, Operator.EQ);
|
|
|
|
+ }
|
|
|
|
+ if (sfwhqy != null && !sfwhqy.equals("")) {
|
|
|
|
+ addNotEmptyModel(filterList, "sfwhqy", sfwhqy, Operator.EQ);
|
|
|
|
+ }
|
|
|
|
+ if (fddbr != null && !fddbr.equals("")) {
|
|
|
|
+ addNotEmptyModel(filterList, "fddbr", fddbr, Operator.LIKE);
|
|
|
|
+ }
|
|
|
|
+ Specification<JyrEntity> spec = SpecificationCreater
|
|
|
|
+ .searchByPredicateModels(filterList);
|
|
|
|
+ SinglePageRequest page = new SinglePageRequest(pageCount, n,
|
|
|
|
+ "desc", "id");
|
|
|
|
+ Page<JyrEntity> pageList = service.findAll(spec, page);
|
|
|
|
+ if (pageList == null || pageList.getTotalPages() < pageCount) {
|
|
|
|
+ return new ArrayList<JyrEntity>();
|
|
|
|
+ }
|
|
|
|
+ for (JyrEntity jyrEntity : pageList) {
|
|
|
|
+ if (jyrEntity.getParentJyr() != null) {
|
|
|
|
+ jyrEntity.getParentJyr().getId();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return pageList.getContent();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取经营人信息
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public JyrEntity findById(Long id) {
|
|
|
|
+ return service.findById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取人员分页信息
|
|
|
|
+ * @param entity
|
|
|
|
+ * @param n
|
|
|
|
+ * @param pageCount
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<RyjbxxEntity> getRyjbxxPageListByJyr(JyrEntity entity, int n, int pageCount) {
|
|
|
|
+ try {
|
|
|
|
+ //entity = findById(entity.getId());
|
|
|
|
+ List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
|
+ // 根据所在地过滤
|
|
|
|
+ if (entity != null&& entity.getSzd()!=null)
|
|
|
|
+ addNotEmptyModel(filterList, "szd.id", entity.getSzd().getId(), Operator.LIKE);
|
|
|
|
+ // 根据港区过滤
|
|
|
|
+ if (entity != null && entity.getSzgq()!=null) {
|
|
|
|
+ addNotEmptyModel(filterList, "ssgq.id", entity.getSzgq().getId(), Operator.EQ);
|
|
|
|
+ }
|
|
|
|
+ if(entity!=null&& entity.getId()!=null){
|
|
|
|
+ addNotEmptyModel(filterList, "ssjyr", entity,
|
|
|
|
+ Operator.EQ);
|
|
|
|
+ }
|
|
|
|
+ if (Utils.getWebServiceUser() != null) {
|
|
|
|
+ UserEntity user = Utils.getWebServiceUser();
|
|
|
|
+ // 经营人只能查自己的
|
|
|
|
+ if (Constants.YES.equals(user.getSfjyr())
|
|
|
|
+ && user.getJyrjcxx() != null) {
|
|
|
|
+ addNotEmptyModel(filterList, "ssjyr", user.getJyrjcxx(),
|
|
|
|
+ Operator.EQ);
|
|
|
|
+ } else {
|
|
|
|
+ // 行政人员根据权限过滤(人员列表菜单ID=3100)
|
|
|
|
+ addRecordCodeFilter(3100l, filterList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Specification<RyjbxxEntity> spec = SpecificationCreater
|
|
|
|
+ .searchByPredicateModels(filterList);
|
|
|
|
+ SinglePageRequest page = new SinglePageRequest(pageCount, n,
|
|
|
|
+ "desc", "id");
|
|
|
|
+ Page<RyjbxxEntity> pageList = ryjbxxService.findAll(spec, page);
|
|
|
|
+ if (pageList == null || pageList.getTotalPages() < pageCount) {
|
|
|
|
+ return new ArrayList<RyjbxxEntity>();
|
|
|
|
+ }
|
|
|
|
+ for (RyjbxxEntity ryjbxxEntity : pageList) {
|
|
|
|
+ List<RyjbxxZSEntity> zsEntities = ryjbxxService.findZsBySfzh(
|
|
|
|
+ ryjbxxEntity.getSfzh(), sort);
|
|
|
|
+ if (zsEntities.size() > 0) {
|
|
|
|
+ ryjbxxEntity.setFirstZs(zsEntities.get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return pageList.getContent();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取单条人员信息
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public RyjbxxEntity findRyjbxxById(Long id){
|
|
|
|
+ RyjbxxEntity ryjbxxEntity = ryjbxxService.findOne(id);
|
|
|
|
+ if(ryjbxxEntity != null){
|
|
|
|
+ List<RyjbxxZSEntity> zsEntities = ryjbxxService.findZsBySfzh(
|
|
|
|
+ ryjbxxEntity.getSfzh(), sort);
|
|
|
|
+ if (zsEntities.size() > 0) {
|
|
|
|
+ ryjbxxEntity.setFirstZs(zsEntities.get(0));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ryjbxxEntity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据人员查证书
|
|
|
|
+ * @param entity
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<RyjbxxZSEntity> findZsByRy(RyjbxxEntity entity){
|
|
|
|
+ if(entity!=null){
|
|
|
|
+ entity = ryjbxxService.findById(entity.getId());
|
|
|
|
+ return ryjbxxService.findZsBySfzh(
|
|
|
|
+ entity.getSfzh(), sort);
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取泊位分页信息
|
|
|
|
+ * @param entity
|
|
|
|
+ * @param n
|
|
|
|
+ * @param pageCount
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<BwEntity> findBwPageListByJyr(JyrEntity entity, int n, int pageCount){
|
|
|
|
+ List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
|
+ addNotEmptyModel(filterList, "qymc", entity,
|
|
|
|
+ Operator.EQ);
|
|
|
|
+ Specification<BwEntity> spec = SpecificationCreater
|
|
|
|
+ .searchByPredicateModels(filterList);
|
|
|
|
+ SinglePageRequest page = new SinglePageRequest(pageCount, n,
|
|
|
|
+ "desc", "id");
|
|
|
|
+ Page<BwEntity> pageList = bwService.findAll(spec, page);
|
|
|
|
+ if (pageList == null || pageList.getTotalPages() < pageCount) {
|
|
|
|
+ return new ArrayList<BwEntity>();
|
|
|
|
+ }
|
|
|
|
+ return pageList.getContent();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取泊位详细信息
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public BwEntity findBwById(Long id){
|
|
|
|
+ return bwService.findOne(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|