فهرست منبع

git-svn-id: https://192.168.57.71/svn/jsgkj@474 931142cf-59ea-a443-aa0e-51397b428577

ld_liqk 9 سال پیش
والد
کامیت
e0efda64a0

+ 18 - 3
gkjsjy/trunk/src/com/xt/jygl/common/BaseWebCtl.java

@@ -46,6 +46,7 @@ import com.xtframe.core.utils.CoreConstants;
 import com.xtframe.core.webService.AuthHandler;
 import com.xtframe.sec.common.BaseVo;
 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.QueryService;
 import com.xtframe.sec.common.SimplePageRequest;
@@ -65,8 +66,6 @@ public class BaseWebCtl extends BaseCtl {
 	private GkjyrService gkjyrService;
 	@Autowired
 	protected QueryService query;
-	@Autowired
-	private GqService gqService;
 
 	public static final String ALGORITHM = "SHA-256";
 	public static JsonConfig config = new JsonConfig();
@@ -252,6 +251,22 @@ public class BaseWebCtl extends BaseCtl {
 	}
 
 	/**
+	 * 判断PredicateModel的value是否为空,只添加非空数据
+	 * 
+	 * @param filterList
+	 * @param model
+	 */
+	protected void addNotEmptyModel(List<PredicateModel> filterList, String fieldName, Object value, Operator operator, JoinType type) {
+		if (null == value || "".equals(value) || "null".equals(value)) {
+			return;
+		}
+		if (null == filterList) {
+			throw new BizException("List<PredicateModel> filterList can't be null!");
+		}
+		filterList.add(new PredicateModel(fieldName, value, operator, type));
+	}
+
+	/**
 	 * List参数判断
 	 * 
 	 * @param filterList
@@ -419,7 +434,7 @@ public class BaseWebCtl extends BaseCtl {
 	public boolean getTbStatus(String uStr) {
 		boolean flag = false;
 		try {
-			String str = "http://192.168.57.74:9090/xtdsp/task/run";
+			String str = "http://10.1.30.118:9701/xtdsp/task/run";
 			URL url = new URL(str + uStr);
 			HttpURLConnection con = (HttpURLConnection) url.openConnection();
 			con.connect();

+ 22 - 7
gkjsjy/trunk/src/com/xt/jygl/gkjygl/cghzyxxgl/dcsb/service/impl/DcsbServiceImpl.java

@@ -20,6 +20,7 @@ import com.xt.jygl.workflow.service.impl.BaseWorkFlowServiceImpl;
 import com.xtframe.core.support.SecurityMgr;
 import com.xtframe.sec.common.BaseEntity;
 import com.xtframe.sec.common.SecRepository;
+import com.xtframe.sec.user.entity.UserEntity;
 import com.xtframe.sec.utils.SecUtils;
 import com.xtframe.util.StringUtils;
 
@@ -81,9 +82,14 @@ public class DcsbServiceImpl extends BaseWorkFlowServiceImpl<DcsbEntity, String>
 			entity.setRecordStatus(BaseEntity.RECORD_STATE_SUBMIT);
 			entity = this.save(entity);
 			String gqid = "";
-			if (securityMgr.getCurrUser().getSfjyr().getText().equals("是")) {
+			if (securityMgr.getCurrUser() != null) {
+				if (securityMgr.getCurrUser().getSfjyr().getText().equals("是")) {
+					gqid = entity.getSzgq().getId();
+				}
+			} else {
 				gqid = entity.getSzgq().getId();
 			}
+
 			Map<String, Object> variables = new HashMap<String, Object>();
 			variables.put("role_sc", Constants.ROLE_DCSBSC + ":" + gqid);
 			WorkFlowParam param = new WorkFlowParam();
@@ -91,7 +97,16 @@ public class DcsbServiceImpl extends BaseWorkFlowServiceImpl<DcsbEntity, String>
 
 			// 设置流程发起人
 			if (StringUtils.isEmpty(param.getString(WorkFlowParam.AUDIT_USER))) {
-				param.put(WorkFlowParam.AUDIT_USER, SecUtils.getCurrUser().getId().toString());
+				if (SecUtils.getCurrUser() != null) {
+					param.put(WorkFlowParam.AUDIT_USER, SecUtils.getCurrUser().getId().toString());
+				} else {
+					String jyrId = entity.getSsjyr().getId();
+					UserEntity user = securityMgr.userService().findByssjyr(jyrId);
+					if (user != null) {
+						param.put(WorkFlowParam.AUDIT_USER, user.getId());
+					}
+				}
+
 			}
 			param.put(WorkFlowParam.BUSINESS_KEY, entity.getId());
 			// 提交流程
@@ -135,15 +150,15 @@ public class DcsbServiceImpl extends BaseWorkFlowServiceImpl<DcsbEntity, String>
 	}
 
 	@Override
-	public List<Object> tongjiproValue(String startDate, String endDate, String hwzl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid,String dedlid) {
+	public List<Object> tongjiproValue(String startDate, String endDate, String hwzl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid, String dedlid) {
 
-		return dao.tongjiproValue(startDate, endDate, hwzl, nwmid, szdid, szgkid, szgqid, jcgid,dedlid);
+		return dao.tongjiproValue(startDate, endDate, hwzl, nwmid, szdid, szgkid, szgqid, jcgid, dedlid);
 	}
 
 	@Override
-	public List<Object> tongjicityValue(String startDate, String endDate, String hwzl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid,String dedlid) {
+	public List<Object> tongjicityValue(String startDate, String endDate, String hwzl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid, String dedlid) {
 
-		return dao.tongjicityValue(startDate, endDate, hwzl, nwmid, szdid, szgkid, szgqid, jcgid,dedlid);
+		return dao.tongjicityValue(startDate, endDate, hwzl, nwmid, szdid, szgkid, szgqid, jcgid, dedlid);
 	}
 
 	@Override
@@ -194,7 +209,7 @@ public class DcsbServiceImpl extends BaseWorkFlowServiceImpl<DcsbEntity, String>
 	public List<Object> dcsbtjbg(String sTime, String eTime, String hwzl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid) {
 		return dao.dcsbtjbg(sTime, eTime, hwzl, nwmid, szdid, szgkid, szgqid, jcgid);
 	}
-	
+
 	@Override
 	public List<Object> dcsbtjbg2(String sTime, String eTime, String hwzldedl, String nwmid, String szdid, String szgkid, String szgqid, String jcgid) {
 		return dao.dcsbtjbg2(sTime, eTime, hwzldedl, nwmid, szdid, szgkid, szgqid, jcgid);

+ 51 - 12
gkjsjy/trunk/src/com/xt/jygl/gkjygl/cghzyxxgl/dcsb/webservice/DcsbWebService.java

@@ -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;

+ 2 - 0
gkjsjy/trunk/src/com/xtframe/core/user/service/UserService.java

@@ -89,4 +89,6 @@ public interface UserService {
 	public void logicDelete(String id);
 	
 	public UserEntity findByssry(String ssryid);
+	
+	public UserEntity findByssjyr(String ssjyrid);
 }

+ 15 - 1
gkjsjy/trunk/src/com/xtframe/sec/user/service/impl/UserServiceImpl.java

@@ -123,7 +123,21 @@ public class UserServiceImpl extends BaseSecurityService implements UserService
 		sqlBuilder.append("select u.* from GK_BASIC_JSJY_USER u where u.ssglry=:ssglry and u.record_status<>9");
 		List<UserEntity> mes = dao.nativeQuery(sqlBuilder.toString(), UserEntity.class, params);
 		UserEntity ms = null;
-		if(mes.size()>0){
+		if (mes.size() > 0) {
+			ms = mes.get(0);
+		}
+		return ms;
+	}
+
+	@Override
+	public UserEntity findByssjyr(String ssjyrid) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		params.put("ssjyr", ssjyrid);
+		StringBuilder sqlBuilder = new StringBuilder();
+		sqlBuilder.append("select u.* from GK_BASIC_JSJY_USER u where u.ssjyr=:ssjyr and u.record_status<>9");
+		List<UserEntity> mes = dao.nativeQuery(sqlBuilder.toString(), UserEntity.class, params);
+		UserEntity ms = null;
+		if (mes.size() > 0) {
 			ms = mes.get(0);
 		}
 		return ms;