package com.changhong.epc.tenant.controller.system.budget;
|
|
import com.changhong.epc.bean.tenant.system.budget.BudgetOrg;
|
import com.changhong.epc.bean.tenant.system.budget.extend.BudgetOrgExtend;
|
import com.changhong.epc.bean.tenant.system.budget.extend.BudgetOrgListExtend;
|
import com.changhong.epc.constter.base.BaseConst;
|
import com.changhong.epc.constter.system.UserInfo;
|
import com.changhong.epc.constter.tenant.TenantUrlConst;
|
import com.changhong.epc.rely.api.bean.Organization;
|
import com.changhong.epc.rely.api.bean.Organizations;
|
import com.changhong.epc.rely.api.bean.TenantsAndCompanys;
|
import com.changhong.epc.tenant.service.system.budget.BudgetConfigService;
|
import com.iemsoft.framework.cloud.core.thread.ThreadData;
|
import com.iemsoft.framework.cloud.core.tools.JSONTool;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 预算控制层
|
* @author liush
|
*
|
*/
|
@RestController
|
public class BudgetConfigController implements TenantUrlConst,BaseConst {
|
@Resource
|
private BudgetConfigService budgetConfigService;
|
|
/**
|
* 获取组织机构树
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETTREE)
|
public List<Organization> getAll() {
|
return budgetConfigService.getAll();
|
}
|
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETUSER)
|
public TenantsAndCompanys getOrgAndTenant(@RequestBody Map<String,String> map) {
|
ThreadData.set(OPEN_ID, map.get("openId"));
|
return budgetConfigService.findTenantsAndCompanys();
|
}
|
|
/**
|
* 批量插入预算
|
* @param budgetList
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_INSERTLIST)
|
public Integer insertBudgetList(@RequestBody BudgetOrgExtend budgetList) {
|
return budgetConfigService.insertBudgetList(budgetList.getBudgetList());
|
}
|
|
/**
|
* 获取预算列表
|
* @param budgetOrg
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETLIST)
|
public List<BudgetOrgExtend> getBudgetOrgList(@RequestBody BudgetOrg budgetOrg) {
|
return budgetConfigService.getBudgetOrgList(budgetOrg);
|
}
|
|
/**
|
* 批量物理删除预算
|
* @param map
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_DELETELIST)
|
public Integer deleteBudgetList(@RequestBody Map<String,Object> map) {
|
return budgetConfigService.deleteBudgetList(map);
|
}
|
|
/**
|
* 批量逻辑删除预算
|
* @param map
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_DELETEBYDATASTART)
|
public Integer deleteBudgetListByDataStart(@RequestBody Map<String,Object> map) {
|
return budgetConfigService.deleteBudgetListByDataStart(map);
|
}
|
|
/**
|
* 预算回显信息获取
|
* @param budgetOrg
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETBUDGETS)
|
public BudgetOrgListExtend getBudgetList(@RequestBody BudgetOrg budgetOrg) {
|
BudgetOrgListExtend budgetOrgListExtend = new BudgetOrgListExtend();
|
List<Integer> cIdList = budgetConfigService.getCidList(budgetOrg);
|
List<String> orgCodeList = budgetConfigService.getOrgCodeList(budgetOrg);
|
List<String> parentOrgCodeList = budgetConfigService.getParentOrgCodeList(budgetOrg);
|
budgetOrgListExtend.setCIdList(cIdList);
|
budgetOrgListExtend.setOrgCodeList(orgCodeList);
|
budgetOrgListExtend.setParentOrgCodeList(parentOrgCodeList);
|
return budgetOrgListExtend;
|
}
|
|
/**
|
* 依据部门orgCode和费用类型cId查询对应的占用预算部门
|
* @param budgetOrg
|
* @return
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETPARENTORG)
|
public List<String> getParentBudgetOrg(@RequestBody BudgetOrg budgetOrg) {
|
return budgetConfigService.getParentBudgetOrg(budgetOrg);
|
|
}
|
|
/**
|
* 根据当前组织机构查询所有下级
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_GETPARENTORGS)
|
public Organizations getOrgsOfTree(@RequestBody Organization org ){
|
return budgetConfigService.getOrgsOfTree(org.getCode());
|
}
|
|
/**
|
* 查询当前用户所有信息
|
* @return
|
*/
|
@PostMapping(REST_ORG_GETTENANT)
|
public UserInfo findOrganizationByTenantId(){
|
return budgetConfigService.findOrganizationByTenantId();
|
}
|
|
/**
|
* 查询租户多公司多租户
|
*/
|
@PostMapping(RESR_ORG_TENANTORCOMPANY)
|
public TenantsAndCompanys findTenantsAndCompanys(){
|
// String a = "{\"tenants\":[{\"code\":\"RS0003\",\"companys\":[{\"code\":\"8600\",\"hotInfoCompanyId\":\"61\",\"id\":7,\"name\":\"国务院\",\"orgCode\":\"010210001\",\"tenantId\":100000001}],\"id\":100000001,\"name\":\"费用云演示\",\"orgCode\":\"01021\"}]}";
|
// return JSONTool.toObj(a,TenantsAndCompanys.class);
|
return budgetConfigService.findTenantsAndCompanys();
|
}
|
|
/**
|
* 查询所有一级部门
|
*/
|
@PostMapping(RESR_ORG_GETONE)
|
public List<Organization> getOne(@RequestBody Map<String ,Object > map ) {
|
ThreadData.set(COMPANY_ID, Integer.parseInt(java.util.Objects.toString(map.get("companyId"),"0")));
|
return budgetConfigService.getOne();
|
}
|
|
@PostMapping(RESR_GETUSERCODE)
|
public UserInfo getUserCode(@RequestBody UserInfo userInfo) {
|
return budgetConfigService.getUserCode(userInfo);
|
}
|
|
/**
|
* 添加人员
|
*/
|
@PostMapping(ADD_USERINFO)
|
public int addUserInfo(@RequestBody Map<String,Object> user){
|
budgetConfigService.addUserInfo(user);
|
return 1;
|
}
|
|
/**
|
* 修改用户姓名
|
*/
|
@PostMapping(UPDATE_USERINFO)
|
public int updateUserName(@RequestBody Map<String,Object> user){
|
return budgetConfigService.updateUserName(user);
|
}
|
|
/**
|
* 同步组织机构
|
*/
|
@PostMapping(REST_TENANT_SYNORG)
|
public int synOrg(@RequestBody Map<String,Object> user){
|
return budgetConfigService.synOrg();
|
}
|
|
/**
|
* 判断当前部门是否可以占用上级预算
|
*/
|
@PostMapping(REST_TENANT_SYSTEM_BUDGETCONFIG_CHECKOCCUPATION)
|
public Integer checkOccupation(@RequestBody BudgetOrg budgetOrg){
|
return budgetConfigService.checkOccupation(budgetOrg);
|
}
|
|
}
|