|
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import javax.jws.WebService;
|
|
|
+import javax.persistence.criteria.CriteriaBuilder.In;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
@@ -26,9 +27,11 @@ import com.xt.jygl.gkjygl.cghzyxxgl.dcsb.service.DcsbService;
|
|
|
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.entity.GkjyrEntity;
|
|
|
+import com.xt.jygl.gkjygl.gkjyr.jyrjbxx.service.GkjyrService;
|
|
|
import com.xtframe.sec.code.entity.CodeEntity;
|
|
|
import com.xtframe.sec.common.BaseEntity;
|
|
|
import com.xtframe.sec.common.PredicateModel;
|
|
|
+import com.xtframe.sec.common.PredicateModel.JoinType;
|
|
|
import com.xtframe.sec.common.PredicateModel.Operator;
|
|
|
import com.xtframe.sec.common.SimplePageRequest;
|
|
|
import com.xtframe.sec.common.SpecificationCreater;
|
|
@@ -50,6 +53,8 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
private GqService gqService;
|
|
|
@Autowired
|
|
|
private BwService bwService;
|
|
|
+ @Autowired
|
|
|
+ private GkjyrService gkjyrService;
|
|
|
|
|
|
public boolean queryUser(String userCode, String pwd) {
|
|
|
pwd = SHA256Encrypt(pwd);
|
|
@@ -66,7 +71,26 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
}
|
|
|
|
|
|
public DcsbEntity findOne(String id) {
|
|
|
- return dcsbService.findOne(id);
|
|
|
+ DcsbEntity dcsb = dcsbService.findOne(id);
|
|
|
+ if (dcsb != null) {
|
|
|
+ MtEntity mt = mtService.findOne(dcsb.getMt());
|
|
|
+ if (mt != null) {
|
|
|
+ dcsb.setMt(mt.getMtmc());
|
|
|
+ }
|
|
|
+ BwEntity bw = bwService.findOne(dcsb.getBw());
|
|
|
+ if (bw != null) {
|
|
|
+ dcsb.setBw(bw.getBwmc());
|
|
|
+ }
|
|
|
+ CodeEntity jcg = securityMgr.codeService().findOne(dcsb.getJcg());
|
|
|
+ if (jcg != null) {
|
|
|
+ dcsb.setJcg(jcg.getText());
|
|
|
+ }
|
|
|
+ CodeEntity mwn = securityMgr.codeService().findOne(dcsb.getNwm());
|
|
|
+ if (mwn != null) {
|
|
|
+ dcsb.setNwm(mwn.getText());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return dcsb;
|
|
|
}
|
|
|
|
|
|
public List<DcsbEntity> query(int start, int pageSize) {
|
|
@@ -88,6 +112,8 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
/**
|
|
|
* 查询单船申报作业信息
|
|
|
*
|
|
|
+ * @param userId
|
|
|
+ * 用户
|
|
|
* @param szdId
|
|
|
* 所在地
|
|
|
* @param szgkId
|
|
@@ -107,7 +133,7 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<DcsbEntity> queryByParam(String szdId, String szgkId, String szgqId, String gkjyr, String cm, String zypmc, String bgsj1, String bgsj2, int pageSize) {
|
|
|
+ public List<DcsbEntity> queryByParam(String userId, String szdId, String szgkId, String szgqId, String gkjyr, String cm, String zypmc, String bgsj1, String bgsj2, int pageSize) {
|
|
|
List<PredicateModel> filterList = new ArrayList<PredicateModel>();
|
|
|
// 只检索非删除状态记录
|
|
|
addNotEmptyModel(filterList, "recordStatus", BaseEntity.RECORD_STATE_DELETE, Operator.NEQ);
|
|
@@ -116,6 +142,19 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
addNotEmptyModel(filterList, "ssjyr.gkjyr", gkjyr, Operator.LIKE);
|
|
|
addNotEmptyModel(filterList, "cm", cm, Operator.LIKE);
|
|
|
addNotEmptyModel(filterList, "zypmc", zypmc, Operator.LIKE);
|
|
|
+ UserEntity user = securityMgr.userService().findById(userId);
|
|
|
+ // 经营人只能查看自己企业下的数据,非经营人只能查看自己所在地的数据
|
|
|
+ if (user.getSsjyr() != null) {
|
|
|
+ addNotEmptyModel(filterList, "ssjyr.id", user.getSsjyr().getId(), Operator.EQ);
|
|
|
+ } else {
|
|
|
+ addNotEmptyModel(filterList, "recordStatus", BaseEntity.RECORD_STATE_VALID, Operator.NEQ);
|
|
|
+ List<String> gqList = gqService.findGqListByUserId(user.getId());
|
|
|
+ if (gqList != null) {
|
|
|
+ for (String id : gqList) {
|
|
|
+ addNotEmptyModel(filterList, "szgq.id", id, Operator.EQ, JoinType.OR);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d");
|
|
|
try {
|
|
|
if (!StringUtils.isEmpty(bgsj1))
|
|
@@ -134,20 +173,20 @@ public class DcsbWebService extends BaseWebCtl {
|
|
|
}
|
|
|
|
|
|
public boolean submit(DcsbEntity entity) {
|
|
|
- UserEntity user = getWebServiceUser();
|
|
|
- if (user == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- GkjyrEntity jyr = user.getSsjyr();
|
|
|
- if (jyr == null) {
|
|
|
- return false;
|
|
|
+ if (entity != null && entity.getSsjyr() != null && entity.getSsjyr().getId() != null) {
|
|
|
+ GkjyrEntity jyr = gkjyrService.findOne(entity.getSsjyr().getId());
|
|
|
+ if (jyr == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ entity.setSsjyr(jyr);
|
|
|
+ entity.setSzgk(jyr.getSzgk());
|
|
|
+ entity.setSzgq(jyr.getSzgq());
|
|
|
+ entity.setSzd(jyr.getSzd());
|
|
|
}
|
|
|
- entity.setSsjyr(jyr);
|
|
|
- entity.setSzgk(jyr.getSzgk());
|
|
|
- entity.setSzgq(jyr.getSzgq());
|
|
|
try {
|
|
|
entity = dcsbService.submit(entity);
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|