建模列表接口

This commit is contained in:
钱涛 2024-11-21 10:25:37 +08:00
parent 2fe7b7dc03
commit 7ea1e5fc80
3 changed files with 159 additions and 0 deletions

View File

@ -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<Map<String, Object>> {
private FormModeConfig formModeConfig = new FormModeConfig();
public GetModeList(Map<String, Object> params, User user){
this.params = params;
this.user = user;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> result = new HashMap<String,Object>();
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<Map<String, Object>> list;
int currentSubCompanyId = Util.getIntValue(Util.null2String(params.get("currentSubCompanyId")), -1);
if(user.getUID()==1&&isUseFmManageDetach&&currentSubCompanyId<1){
isUseFmManageDetach = false;
}
if(isUseFmManageDetach) {
Map<String, Object> 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<Map<String, String>> modeList = new ArrayList<Map<String, String>>();
String vsql = "SELECT m.formid,m.virtualformtype,m.vformtype FROM ModeFormExtend m WHERE m.isvirtualform=1";
RecordSet rs = new RecordSet();
rs.execute(vsql);
Map<String,String> map = new HashMap<String,String>();
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<String, Object> mode : list) {
Map<String,String> newMode = new HashMap<String, String>();
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;
}
}
}

View File

@ -41,6 +41,14 @@ public class PushController {
return new ResponseResult<PushSettingQueryParam, PageInfo<PushSettingDTO>>(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<String, Object>(user).run(getPushWrapper(user)::modeList);
}
@POST
@Path("/setting/save")
@Produces(MediaType.APPLICATION_JSON)

View File

@ -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<String, Object> map = new HashMap<>();
map.put("appid", 1);
map.put("appidForAppname", 2);
map.put("aLLorCurrentKey", 1);
Map<String, Object> execute = commandExecutor.execute(new GetModeList(map, user));
return execute;
}
}