|
@@ -11,8 +11,6 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -21,14 +19,23 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.cxfws.gkjcxx.service.IGqxxService;
|
|
|
import com.xt.jygl.common.BaseWebCtl;
|
|
|
-import com.xt.jygl.ggfwxxgl.tzgg.ggxx.vo.GgxxVo;
|
|
|
+import com.xt.jygl.common.Constants;
|
|
|
+import com.xt.jygl.common.Utils;
|
|
|
+import com.xt.jygl.gkjcxx.gk.entity.GkEntity;
|
|
|
+import com.xt.jygl.gkjcxx.gk.service.GkService;
|
|
|
import com.xt.jygl.gkjcxx.gq.dao.GqDao;
|
|
|
import com.xt.jygl.gkjcxx.gq.entity.GqEntity;
|
|
|
+import com.xt.jygl.gkjcxx.gq.service.GqService;
|
|
|
import com.xt.jygl.gkjcxx.gq.vo.GqVo;
|
|
|
+import com.xt.jygl.gkjcxx.xzdwxxgl.xzglbmxx.entity.XzglbmxxEntity;
|
|
|
+import com.xtframe.core.base.ctl.WebJsonResult;
|
|
|
+import com.xtframe.sec.code.entity.CodeEntity;
|
|
|
import com.xtframe.sec.common.BaseEntity;
|
|
|
import com.xtframe.sec.common.QueryService;
|
|
|
import com.xtframe.sec.common.SimplePageRequest;
|
|
|
import com.xtframe.util.StringUtils;
|
|
|
+
|
|
|
+import net.sf.json.JSONArray;
|
|
|
/**
|
|
|
* 港区信息查询
|
|
|
*
|
|
@@ -40,6 +47,10 @@ public class GqxxService extends BaseWebCtl implements IGqxxService{
|
|
|
private QueryService query;
|
|
|
@Autowired
|
|
|
private GqDao dao;
|
|
|
+ @Autowired
|
|
|
+ private GqService gqService;
|
|
|
+ @Autowired
|
|
|
+ private GkService gkService;
|
|
|
@Override
|
|
|
@WebMethod(operationName = "findGq", action = "http://service.web.jsjty.com/excTable")
|
|
|
@WebResult(name = "result", targetNamespace = "http://service.web.jsjty.com/")
|
|
@@ -109,5 +120,121 @@ public class GqxxService extends BaseWebCtl implements IGqxxService{
|
|
|
JSONArray jsons=JSONArray.fromObject(vo);
|
|
|
return jsons.toString();
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public String save(GqEntity code, String szdid, String szgkid, String ssgkglbmid, String gqszsylxid) {
|
|
|
+
|
|
|
+ // how:如果是新增直接保存,如果更新,先取出数据库中记录,然后更新页面传过来的字段
|
|
|
+ // why:这样的话一些在前台无需显示的字段保证不会丢失,同时一个个字段设置有助于bug排查
|
|
|
+ WebJsonResult wr = success();
|
|
|
+ if (!this.checkUser()){
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage(BaseWebCtl.NOLOGIN);
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(szdid)) {
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage("请选择所在地");
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(ssgkglbmid)) {
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage("请选择港口所属管理部门");
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(szgkid)) {
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage("请选择所在港口");
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
+ GqEntity entity = new GqEntity();
|
|
|
+ try {
|
|
|
+ if (!StringUtils.isEmpty(code.getId())) {
|
|
|
+ entity = gqService.findOne(code.getId());
|
|
|
+ entity.setTbzt(Constants.NO);
|
|
|
+ }
|
|
|
+ entity.setGqmc(code.getGqmc());
|
|
|
+ if (!StringUtils.isEmpty(gqszsylxid)) {
|
|
|
+ CodeEntity gqszsylx = new CodeEntity(gqszsylxid);
|
|
|
+ entity.setGqszsylx(gqszsylx);
|
|
|
+ }
|
|
|
+ entity.setGqmj(code.getGqmj());
|
|
|
+ entity.setLymj(code.getLymj());
|
|
|
+ entity.setSyfw(code.getSyfw());
|
|
|
+ entity.setSymj(code.getSymj());
|
|
|
+ entity.setGqghmj(code.getGqghmj());
|
|
|
+ entity.setGhlymj(code.getGhlymj());
|
|
|
+ entity.setLymj(code.getLymj());
|
|
|
+ entity.setFgyscydghmj(code.getFgyscydghmj());
|
|
|
+ entity.setGhsymj(code.getGhsymj());
|
|
|
+ entity.setGqzraxcd(code.getGqzraxcd());
|
|
|
+ entity.setGymtaxcd(code.getGymtaxcd());
|
|
|
+ entity.setGqgkaxcd(code.getGqgkaxcd());
|
|
|
+ entity.setGkssysyaxcd(code.getGkssysyaxcd());
|
|
|
+ entity.setGqdmbdzdz(code.getGqdmbdzdz());
|
|
|
+ entity.setBz(code.getBz());
|
|
|
+ GkEntity szgk = new GkEntity();
|
|
|
+ szgk.setId(szgkid);
|
|
|
+ entity.setSzgk(szgk);
|
|
|
+ XzglbmxxEntity ssgkglbm = new XzglbmxxEntity();
|
|
|
+ ssgkglbm.setId(ssgkglbmid);
|
|
|
+ entity.setSsgkglbm(ssgkglbm);
|
|
|
+ entity.setGqdm(code.getGqdm());
|
|
|
+ entity.setGqnhhddm(code.getGqnhhddm());
|
|
|
+ entity.setDlwzwd(code.getDlwzwd());
|
|
|
+ entity.setDlwzjd(code.getDlwzjd());
|
|
|
+ entity.setGqms(code.getGqms());
|
|
|
+ CodeEntity szd = new CodeEntity(szdid);
|
|
|
+ entity.setSzd(szd);
|
|
|
+ entity.setZyid(code.getZyid());
|
|
|
+ gqService.save(entity);
|
|
|
+
|
|
|
+ List<String> gqList = gqService.findGqListByUserId(securityMgr.getCurrUser().getId());
|
|
|
+ Utils.getSession().setAttribute("gqList", gqList);
|
|
|
+ if (gqList != null && gqList.size() > 0) {
|
|
|
+ Utils.getSession().setAttribute("gkList", gkService.findByGqList(gqList));
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage("操作失败!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public String delete(String id) {
|
|
|
+ WebJsonResult wr = success();
|
|
|
+ if (!this.checkUser()){
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage(BaseWebCtl.NOLOGIN);
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // 子类一并删除
|
|
|
+ gqService.logicDelete(id);
|
|
|
+ // 如果是市级刪除,省级也刪除
|
|
|
+ GqEntity gq = gqService.findOne(id);
|
|
|
+ // 港口管理人员的权限设置,取得有权限的港区
|
|
|
+ List<String> gqList = gqService.findGqListByUserId(securityMgr.getCurrUser().getId());
|
|
|
+ Utils.getSession().setAttribute("gqList", gqList);
|
|
|
+ if (gqList != null && gqList.size() > 0) {
|
|
|
+ Utils.getSession().setAttribute("gkList", gkService.findByGqList(gqList));
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * try { if
|
|
|
+ * (GlobalData.DEPLOY_MODE.equals(Constants.DEPLOY_MODE_CITY) &&
|
|
|
+ * needWS()) { GqWebService webService =
|
|
|
+ * gqService.getWebService(null); webService.delete(id);
|
|
|
+ * gq.setTbzt(Constants.YES); gqService.save(gq); } } catch
|
|
|
+ * (Exception e) { gq.setTbzt(Constants.NO); gqService.save(gq); }
|
|
|
+ */
|
|
|
+ } catch (Exception e) {
|
|
|
+ wr.setSuccess(false);
|
|
|
+ wr.setMessage("删除失败!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return Object2JsonStr(wr);
|
|
|
+ }
|
|
|
|
|
|
}
|