|
@@ -1,15 +1,35 @@
|
|
|
package com.jtgh.yjpt.webService.gg;
|
|
|
|
|
|
+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.GlobalData;
|
|
|
+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.common.AccessoryEntity;
|
|
|
import com.jtgh.yjpt.entity.gg.GgEntity;
|
|
|
+import com.jtgh.yjpt.entity.gg.GgViewEntity;
|
|
|
+import com.jtgh.yjpt.entity.jyr.JyrEntity;
|
|
|
import com.jtgh.yjpt.service.common.AccessoryService;
|
|
|
+import com.jtgh.yjpt.service.common.CodeService;
|
|
|
import com.jtgh.yjpt.service.gg.GgService;
|
|
|
+import com.jtgh.yjpt.service.gg.GgViewService;
|
|
|
+import com.jtgh.yjpt.service.jyr.JyrService;
|
|
|
/**
|
|
|
* 港口信息接口
|
|
|
*
|
|
@@ -19,13 +39,19 @@ import com.jtgh.yjpt.service.gg.GgService;
|
|
|
@Service
|
|
|
@WebService(targetNamespace = "http://webService.yjpt.com/", serviceName = "ggService")
|
|
|
@HandlerChain(file = "handle-chain.xml")
|
|
|
-public class GgWebService {
|
|
|
+public class GgWebService extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private GgService service;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private GgViewService ggViewService;
|
|
|
@Autowired
|
|
|
private AccessoryService accessoryService;
|
|
|
+ @Autowired
|
|
|
+ private JyrService jyrService;
|
|
|
+ @Autowired
|
|
|
+ private CodeService codeService;
|
|
|
+
|
|
|
|
|
|
public void save(GgEntity entity) {
|
|
|
entity.setSzd(entity.getSzd());
|
|
@@ -34,6 +60,129 @@ public class GgWebService {
|
|
|
service.save(entity);
|
|
|
if (null != entity.getAccessory()) {
|
|
|
accessoryService.save(entity.getAccessory());
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 公告保存
|
|
|
+ * @param entity
|
|
|
+ * @param jyrList
|
|
|
+ * @param jyrDelList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GgEntity saveEntity(GgEntity entity,
|
|
|
+ List<JyrEntity> jyrList, List<JyrEntity> jyrDelList){
|
|
|
+ if (null == entity.getId()) {
|
|
|
+ if (!GlobalData.CITY_CODE.equals("")
|
|
|
+ && GlobalData.DEPLOY_MODE
|
|
|
+ .equals(Constants.DEPLOY_MODE_CITY)) {
|
|
|
+ entity.setSzd(codeService.findOne(Long
|
|
|
+ .parseLong(GlobalData.CITY_CODE)));
|
|
|
+ }
|
|
|
+ entity.setRecordCode("100100100100");
|
|
|
+ entity.setAddUser(Utils.getCurrentUser());
|
|
|
+ entity.setAddDate(new Date());
|
|
|
+ } else {
|
|
|
+ // 修改
|
|
|
+ GgEntity vo = service.findById(entity.getId());
|
|
|
+ entity.setAddDate(vo.getAddDate());
|
|
|
+ entity.setAddUser(vo.getAddUser());
|
|
|
+ entity.setRecordCode(vo.getRecordCode());
|
|
|
+ entity.setRecordStatus(vo.getRecordStatus());
|
|
|
+ entity.setSftb(vo.getSftb());
|
|
|
+ entity.setTbzt(vo.getTbzt());
|
|
|
+ entity.setQylb(vo.getQylb());
|
|
|
+ entity.setTbdyid(vo.getTbdyid());
|
|
|
+ entity.setUpdateDate(new Date());
|
|
|
+ entity.setUpdateUser(Utils.getWebServiceUser());
|
|
|
+ }
|
|
|
+ entity = service.save(entity);
|
|
|
+ if (jyrDelList != null) {
|
|
|
+ for (JyrEntity delEntity : jyrDelList) {
|
|
|
+ ggViewService.logicDelete(ggViewService.findKjByGgidAndQymc(
|
|
|
+ entity, delEntity));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (jyrList != null) {
|
|
|
+ for (JyrEntity jyrEntity : jyrList) {
|
|
|
+ List<GgViewEntity> ggViewEntities = ggViewService.findKjByGgidAndQymc(
|
|
|
+ entity, jyrEntity);
|
|
|
+ GgViewEntity ggViewEntity = new GgViewEntity();
|
|
|
+ if(ggViewEntities!=null && ggViewEntities.size()>0) {
|
|
|
+ ggViewEntity= ggViewEntities.get(0);
|
|
|
+ ggViewEntity.setUpdateDate(new Date());
|
|
|
+ ggViewEntity.setUpdateUser(Utils.getCurrentUser());
|
|
|
+ }else{
|
|
|
+ ggViewEntity.setAddUser(Utils.getCurrentUser());
|
|
|
+ ggViewEntity.setAddDate(new Date());
|
|
|
+ ggViewEntity.setGgid(entity);
|
|
|
+ ggViewEntity.setQymc(jyrEntity);
|
|
|
+ ggViewEntity.setSfkj("Y");
|
|
|
+ }
|
|
|
+ ggViewService.save(ggViewEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询公告信息
|
|
|
+ * @param lkr
|
|
|
+ * @param title
|
|
|
+ * @param n
|
|
|
+ * @param pageCount
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<GgEntity> getGgPageListByParams(String lkr, String title,int n, int pageCount){
|
|
|
+ List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
+ addNotEmptyModel(filterList, "lkr", lkr, PredicateModel.Operator.LIKE);
|
|
|
+ addNotEmptyModel(filterList, "title", title,
|
|
|
+ PredicateModel.Operator.LIKE);
|
|
|
+ // 只检索非删除状态记录
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
+ Specification<GgEntity> spec = SpecificationCreater
|
|
|
+ .searchByPredicateModels(filterList);
|
|
|
+ SinglePageRequest page = new SinglePageRequest(pageCount, n,
|
|
|
+ "desc", "id");
|
|
|
+ Page<GgEntity> pageList = service.findAll(spec, page);
|
|
|
+ if (pageList == null || pageList.getTotalPages() < pageCount) {
|
|
|
+ return new ArrayList<GgEntity>();
|
|
|
+ }
|
|
|
+ for (GgEntity gg : pageList) {
|
|
|
+ List<PredicateModel> filterList2 = new ArrayList<PredicateModel>();
|
|
|
+ addNotEmptyModel(filterList, "entityType.id",
|
|
|
+ Constants.FJSSLX_T_YJPT_GG, Operator.EQ);
|
|
|
+ addNotEmptyModel(filterList, "recordStatus",
|
|
|
+ BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
|
+ addNotEmptyModel(filterList, "entityId", gg.getId(),
|
|
|
+ PredicateModel.Operator.EQ);
|
|
|
+ Specification<AccessoryEntity> accSpec = SpecificationCreater
|
|
|
+ .searchByPredicateModels(filterList2);
|
|
|
+ List<AccessoryEntity> acc = accessoryService.findAll(accSpec);
|
|
|
+ if (acc != null && acc.size() > 0) {
|
|
|
+ gg.setAccessory(acc.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return pageList.getContent();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询公告详细信息
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public GgEntity findById(Long id){
|
|
|
+ GgEntity entity = service.findById(id);
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据公告查询可见的经营人列表
|
|
|
+ * @param entity
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<JyrEntity> findJyrByGg(GgEntity entity){
|
|
|
+ return jyrService.findByGg(entity.getId());
|
|
|
}
|
|
|
}
|