ianService.java~1~
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:11k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package cn.com.ivisions.xfb.service;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashMap;
- import java.util.Iterator;
- import javax.servlet.http.HttpServletRequest;
- import cn.com.ivisions.dipper.Result;
- import cn.com.ivisions.dipper.data.Context;
- import cn.com.ivisions.dipper.data.ContextObject;
- import cn.com.ivisions.dipper.model.Model;
- import cn.com.ivisions.dipper.operation.OperationRunner;
- import cn.com.ivisions.xfb.RequestData;
- public class DianService {
- // 对应tbxTransactEntity表中的dianOnline字段,0表示此办理单位对来电流程是不联网状态.1表示是联网状态.
- private final static String onLineFlag = "1";
- // 对应tbxTransactEntity表中的transactEntityGrade字段,1表示此办理单位级别为区县级,2表示市委办局级.3或空表示为一般的办理单位.
- private final static String weiBanJuFlag = "2";
- private static final Integer SOURCEENTITYID = new Integer(9);
- private static final String SOURCEENTITYCODE = "SXFB-ENT9";
- private static final Integer TRANSFERENTITYID = new Integer(53);
- /**
- *
- * 检查信访件主送单位是否全部联网(只针对来电这种信访形式)
- *
- *
- * @param Integer
- * appealId
- * @return boolean
- */
- public static boolean checkAllOnLineForDian(Integer appealId) {
- return checkAllOnLineForDian(AppealService
- .listAppeal_TransactEntitys(appealId));
- }
- /**
- *
- * 检查指定单位是否全部联网(只针对来电这种信访形式)�
- *
- * @param Collection
- * coll
- * @return boolean
- */
- public static boolean checkAllOnLineForDian(Collection collection) {
- boolean allOnLine = true;
- if (collection == null) {
- allOnLine = false;
- } else if (collection.isEmpty()) {
- allOnLine = false;
- } else {
- for (Iterator iter = collection.iterator(); iter.hasNext();) {
- Model model = (Model) iter.next();
- if (model.getStringValue("dianOnline") == null) {
- allOnLine = false;
- break;
- } else if (model.getStringValue("dianOnline").equals("")) {
- allOnLine = false;
- break;
- } else if (!model.getStringValue("dianOnline").equals(
- onLineFlag)) {
- allOnLine = false;
- break;
- }
- }
- }
- return allOnLine;
- }
- /**
- *
- * 检查信访件主送单位是否全都不联网(只针对来电这种信访形式)
- *
- *
- * @param Integer
- * appealId
- * @return boolean
- */
- public static boolean checkAllOffLineForDian(Integer appealId) {
- return checkAllOffLineForDian(AppealService
- .listAppeal_TransactEntitys(appealId));
- }
- /**
- *
- * 检查指定单位是否全都不联网(只针对来电这种信访形式)�
- *
- * @param Collection
- * coll
- * @return boolean
- */
- public static boolean checkAllOffLineForDian(Collection collection) {
- boolean allOnLine = true;
- if (collection == null) {
- allOnLine = false;
- } else if (collection.isEmpty()) {
- allOnLine = false;
- } else {
- for (Iterator iter = collection.iterator(); iter.hasNext();) {
- Model model = (Model) iter.next();
- if (model.getStringValue("dianOnline") != null
- && model.getStringValue("dianOnline")
- .equals(onLineFlag)) {
- allOnLine = false;
- break;
- }
- }
- }
- return allOnLine;
- }
- /**
- * 根据tbxEntity表中的entityId去查出对应tbxTransactEntity的记录
- *
- * @param int
- * entityId
- *
- * @return Model
- */
- public static Model getTransactEntityByEntityId(int entityId) {
- Model model = null;
- Context ctx = new ContextObject();
- ctx.setAttribute("entityId", new Integer(entityId));
- OperationRunner runner = new OperationRunner(ctx);
- try {
- model = runner.extractModel("getTransactEntityByEntityId");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return model;
- }
- /**
- * 验证此办理单位是否为市委办局级别.
- *
- * @param transactEntity
- * @return
- */
- public static boolean checkShiWeiBanJu(Model transactEntity) {
- boolean result = true;
- if (transactEntity == null) {
- result = false;
- } else if (transactEntity.getStringValue("transactEntityGrade") == null) {
- result = false;
- } else if (!transactEntity.getStringValue("transactEntityGrade")
- .equals(weiBanJuFlag)) {
- result = false;
- }
- return result;
- }
- /**
- * 验证此办理单位是否为市委办局级别.
- *
- * @param entityId
- * @return
- */
- public static boolean checkShiWeiBanJu(int entityId) {
- return checkShiWeiBanJu(getTransactEntityByEntityId(entityId));
- }
- /**
- * 根据办理单位的等级来列出办理单位对应的TBENTITY表的信息
- *
- * @param transactEntityGrade
- * @return
- */
- public static Collection listTransactEntityByGrade(
- String transactEntityGrade) {
- Collection coll = new ArrayList();
- Context ctx = new ContextObject();
- ctx.setAttribute("transactEntityGrade", transactEntityGrade);
- OperationRunner runner = new OperationRunner(ctx);
- try {
- coll = runner.search("listTransactEntityByGrade").getResult();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return coll;
- }
- /**
- * <p>
- * 下转信访件
- *
- *
- * @param HttpServletRequest
- * request
- */
- public static void batchTransferAppeal(HttpServletRequest request) {
- Integer appealId = RequestData.requestInteger("appealId", request);
- String appealCode = RequestData.requestString("appealCode", request);
- Integer appealFormId = RequestData.requestInteger("appealFormId",
- request);
- String transferFlowNode = RequestData.requestString("transferFlowNode",
- request);
- Integer transferFlowRole = RequestData.requestInteger(
- "transferFlowRole", request);
- String sendToUnits = RequestData.requestString("sendToUnits", request);
- Collection coll = listTransactEntityByIds(sendToUnits);
- for (Iterator iter = coll.iterator(); iter.hasNext();) {
- Model model = (Model) iter.next();
- HashMap hmp = new HashMap();
- hmp.put("sourceAppealId", appealId);
- hmp.put("sourceAppealCode", appealCode);
- hmp.put("sourceEntityId", SOURCEENTITYID);
- hmp.put("sourceEntityCode", SOURCEENTITYCODE);
- hmp.put("transferEntityId", TRANSFERENTITYID);
- hmp.put("appealFormId", appealFormId);
- hmp.put("targetEntityId",
- new Integer(model.getIntValue("entityId")));
- hmp.put("targetEntityCode", model
- .getStringValue("transactEntityCode"));
- if (model.getStringValue("dianOnline").equals("1")) {
- if (model.getIntValue("absoluteSystem") == 1) {
- hmp.put("inSide", new Integer(1));
- Model appealModel = transferAppeal(hmp);
- String userIds = UserService.listEntityUserIds(new Integer(
- model.getIntValue("entityId")), new Integer(0),
- transferFlowRole);
- FlowService.startFlow(new Integer(appealModel
- .getIntValue("appealFormId")), transferFlowNode,
- userIds, FlowService.FLOWSTATUSON, null, userIds, null,
- new Integer(appealModel.getIntValue("appealId")));
- }else if (model.getIntValue("absoluteSystem") == 2) {
- hmp.put("inSide", new Integer(0));
- Model appealModel = transferAppeal(hmp);
- DipperService.execute("updateDataCommuteStatus",request);
- }
- }
- }
- /**
- * <p>
- * 根据单位ids取得信息
- *
- * @param String
- * endityIds
- * @return Collection
- */
- public static Collection listTransactEntityByIds(String entityIds) {
- Collection list = new ArrayList();
- Context ctx = new ContextObject();
- ctx.setAttribute("transactEntityIds", entityIds);
- OperationRunner runner = new OperationRunner(ctx);
- try {
- list = runner.search("listTransactEntityByIds").getResult();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return list;
- }
- /**
- * <p>
- * 添加区县信访件并记录下转信息
- *
- * @param HashMap
- * <p>
- * HashMap包含的信息
- *
- * @param sourceAppealId
- * 源信访件id
- * @param sourceAppealCode
- * 源信访件编号
- * @param sourceEntityId
- * 源单位Id
- * @param appealFormId
- * 信访形式
- * @param targetEntityId
- * 目标单位Id
- * @param inSide
- * 是否系统内单位
- *
- */
- public static Model transferAppeal(HashMap hmp) {
- Model model = null;
- Context ctx = new ContextObject();
- ctx.addHashMap(hmp);
- OperationRunner runner = new OperationRunner(ctx);
- try {
- Result rs = runner.operate("transferAppeal");
- model = (Model) rs.getResultValue();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return model;
- }
- /**
- * <p>
- * 检测用户是否具有某个角色
- *
- *
- * @param int
- * userId
- * @param int
- * roleId
- * @param Collection
- * coll
- * @return boolean
- */
- public static boolean checkUserHaveRole(int userId, String roleName,
- Collection coll) {
- boolean haveRole = false;
- Iterator ite = coll.iterator();
- while (ite.hasNext()) {
- Model roleModel = (Model) ite.next();
- if (userId != roleModel.getIntValue("userId"))
- continue;
- if (roleModel.getStringValue("roleName").equals(roleName)) {
- haveRole = true;
- break;
- }
- }
- return haveRole;
- }
- /**
- * 根据appealId和adviceTitle两个字段来取tbxAppeal_advice表中的记录
- *
- * @param int
- * appealId
- * @param String
- * adviceTitle
- * @return Model
- */
- public static Model getAppealAdviceByAppealIdAndTitle(int appealId,
- String adviceTitle) {
- Model model = null;
- Context ctx = new ContextObject();
- ctx.setAttribute("appealId", new Integer(appealId));
- ctx.setAttribute("adviceTitle", adviceTitle);
- OperationRunner runner = new OperationRunner(ctx);
- try {
- model = runner.extractModel("getAdviceByAppealIdTitle");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return model;
- }
- /**
- * 根据appealId和adviceTitle两个字段来更新tbxAppeal_advice表中的adviceContent字段
- *
- * @param int
- * appealId
- * @param String
- * adviceTitle
- * @return Model
- */
- public static void updateAppealAdvice(int appealId, String adviceTitle, String adviceContent) {
- Context ctx = new ContextObject();
- ctx.setAttribute("appealId", new Integer(appealId));
- ctx.setAttribute("adviceTitle", adviceTitle);
- ctx.setAttribute("adviceContent", adviceContent);
- OperationRunner runner = new OperationRunner(ctx);
- try {
- runner.extractModel("updateAppealAdvice");
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }