diff --git a/src/com/engine/salary/remote/mode/cmd/GetModeList.java b/src/com/engine/salary/remote/mode/cmd/GetModeList.java new file mode 100644 index 000000000..bbb70bf6f --- /dev/null +++ b/src/com/engine/salary/remote/mode/cmd/GetModeList.java @@ -0,0 +1,139 @@ +package com.engine.salary.remote.mode.cmd; + +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import com.engine.cube.biz.AppHelper; +import com.engine.cube.biz.DetachHelper; +import com.weaver.formmodel.util.StringHelper; +import weaver.conn.RecordSet; +import weaver.formmode.FormModeConfig; +import weaver.formmode.service.ModelInfoService; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.company.SubCompanyComInfo; +import weaver.hrm.moduledetach.ManageDetachComInfo; +import weaver.workflow.workflow.WorkflowBillComInfo; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GetModeList extends AbstractCommonCommand> { + private FormModeConfig formModeConfig = new FormModeConfig(); + public GetModeList(Map params, User user){ + this.params = params; + this.user = user; + } + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map result = new HashMap(); + ManageDetachComInfo ManageDetachComInfo = new ManageDetachComInfo(); + boolean isUseFmManageDetach=ManageDetachComInfo.isUseFmManageDetach(); + int appid = Util.getIntValue(Util.null2String(params.get("appid")),1) ; + String aLLorCurrentKey = Util.null2String(params.get("aLLorCurrentKey")); + int appidForAppname =Util.getIntValue(Util.null2String(this.params.get("appidForAppname")),1); + ModelInfoService modelInfoService = new ModelInfoService(); + modelInfoService.setUser(user); + List> list; + int currentSubCompanyId = Util.getIntValue(Util.null2String(params.get("currentSubCompanyId")), -1); + if(user.getUID()==1&&isUseFmManageDetach&¤tSubCompanyId<1){ + isUseFmManageDetach = false; + } + if(isUseFmManageDetach) { + Map detach=DetachHelper.getUserDetachInfo(user, currentSubCompanyId, "FORMMODEAPP:ALL"); + if(currentSubCompanyId<1){ + currentSubCompanyId=Util.getIntValue(Util.null2String(detach.get("defaultSubCompanyId"))); + } + list = modelInfoService.getModelInfoByAppIdDetach(appid, currentSubCompanyId); + } else { + list = modelInfoService.getModelInfoByAppId(appid); + } + WorkflowBillComInfo workflowBillComInfo = new WorkflowBillComInfo(); + ArrayList> modeList = new ArrayList>(); + + String vsql = "SELECT m.formid,m.virtualformtype,m.vformtype FROM ModeFormExtend m WHERE m.isvirtualform=1"; + RecordSet rs = new RecordSet(); + rs.execute(vsql); + Map map = new HashMap(); + while(rs.next()){ + String formid = rs.getString("formid"); + String virtualformtype = rs.getString("virtualformtype"); + String vformtype = rs.getString("vformtype"); + map.put(formid, virtualformtype+"_"+vformtype); + } + FormModeConfig formModeConfig = new FormModeConfig(); + String VirtualFormPermissions = formModeConfig.getVirtualFormPermissions(); + String modeids = formModeConfig.getModeid(); + for(Map mode : list) { + Map newMode = new HashMap(); + String key = Util.null2String(mode.get("id")); + String formid = Util.null2String(mode.get("formid")); + String isvirtualform = Util.null2String(mode.get("isvirtualform")); + String virtualrightopen = Util.null2String(mode.get("virtualrightopen")); + if(StringHelper.isEmpty(isvirtualform)){ + isvirtualform = "0"; + } + String tableName = Util.null2String(workflowBillComInfo.getTablename(formid)); + String virtualformtype = ""; + String vformtype = ""; + if("1".equals(isvirtualform)){ + continue; + } + newMode.put("key",key ); + newMode.put("domid",key ); + newMode.put("name", Util.null2String(mode.get("modename"))); + newMode.put("subname", tableName); + newMode.put("isvirtualform", isvirtualform); + newMode.put("virtualformtype", virtualformtype); + newMode.put("vformtype", vformtype); + modeList.add(newMode); + } + result.put("appid",appid+""); + String appsubcompanyid = ""; + String appsubcompanyidname = ""; + if(appid>0){ + String sql = "SELECT subcompanyid FROM modetreefield WHERE id="+appid; + rs.execute(sql); + if(rs.next()){ + int subcompanyid = rs.getInt("subcompanyid"); + if(subcompanyid>0){ + appsubcompanyid = subcompanyid+""; + SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); + appsubcompanyidname = subCompanyComInfo.getSubcompanyname(appsubcompanyid); + } + } + } + String appName = AppHelper.getAppName(appidForAppname+""); + boolean issysadmin = user.getUID() == 1; + result.put("appName",appName); + result.put("issysadmin",issysadmin); + result.put("aLLorCurrentKey",aLLorCurrentKey); + result.put("appsubcompanyid",appsubcompanyid); + result.put("appsubcompanyidname",appsubcompanyidname); + result.put("modeList",modeList); + result.put("canDeleteModeInfo",formModeConfig.isCanDeleteModeInfo()); + return result; + } + + + public boolean isHadRight(String modeid){ + RecordSet rs = new RecordSet(); + rs.executeQuery("select count(1) as rightcount from moderightinfo where modeid=? and ((righttype=0 and (sharetype<80 or sharetype>100)) or (righttype in (1,2,3) and (sharetype<80 or sharetype>100)))",modeid); + int rightcount=0; + if(rs.next()){ + rightcount = Util.getIntValue(rs.getString("rightcount"),0); + } + if(rightcount>0){ + return true; + }else{ + return false; + } + } +} diff --git a/src/com/engine/salary/web/PushController.java b/src/com/engine/salary/web/PushController.java index 616a9f656..f57703312 100644 --- a/src/com/engine/salary/web/PushController.java +++ b/src/com/engine/salary/web/PushController.java @@ -41,6 +41,14 @@ public class PushController { return new ResponseResult>(user).run(getPushWrapper(user)::settingList, param); } + @GET + @Path("/mode/list") + @Produces(MediaType.APPLICATION_JSON) + public String modeList(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getPushWrapper(user)::modeList); + } + @POST @Path("/setting/save") @Produces(MediaType.APPLICATION_JSON) diff --git a/src/com/engine/salary/wrapper/PushWrapper.java b/src/com/engine/salary/wrapper/PushWrapper.java index c2b42bf65..002092e13 100644 --- a/src/com/engine/salary/wrapper/PushWrapper.java +++ b/src/com/engine/salary/wrapper/PushWrapper.java @@ -7,11 +7,15 @@ import com.engine.salary.entity.push.dto.PushSettingItemDTO; import com.engine.salary.entity.push.param.*; import com.engine.salary.entity.push.po.PushSettingItemPO; import com.engine.salary.entity.push.po.PushSettingPO; +import com.engine.salary.remote.mode.cmd.GetModeList; import com.engine.salary.service.PushService; import com.engine.salary.service.impl.PushServiceImpl; import com.engine.salary.util.page.PageInfo; import weaver.hrm.User; +import java.util.HashMap; +import java.util.Map; + public class PushWrapper extends Service { @@ -48,5 +52,13 @@ public class PushWrapper extends Service { getPushService(user).pushOneRecord(pushParam.getSalaryAcctRecordId()); } + public Object modeList() { + Map map = new HashMap<>(); + map.put("appid", 1); + map.put("appidForAppname", 2); + map.put("aLLorCurrentKey", 1); + Map execute = commandExecutor.execute(new GetModeList(map, user)); + return execute; + } }