|
|
@@ -2,10 +2,7 @@ package com.tianhu.system.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.tianhu.common.core.domain.R;
|
|
|
-import com.tianhu.common.core.utils.CommonUtil;
|
|
|
-import com.tianhu.common.core.utils.DateUtils;
|
|
|
-import com.tianhu.common.core.utils.IdUtils;
|
|
|
-import com.tianhu.common.core.utils.SecurityUtils;
|
|
|
+import com.tianhu.common.core.utils.*;
|
|
|
import com.tianhu.common.core.web.controller.BaseController;
|
|
|
import com.tianhu.common.core.web.domain.AjaxResult;
|
|
|
import com.tianhu.common.core.web.page.TableDataInfo;
|
|
|
@@ -13,11 +10,12 @@ import com.tianhu.common.log.annotation.Log;
|
|
|
import com.tianhu.common.log.enums.BusinessType;
|
|
|
import com.tianhu.common.security.annotation.PreAuthorize;
|
|
|
import com.tianhu.common.security.service.TokenService;
|
|
|
-import com.tianhu.system.api.domain.SysDept;
|
|
|
-import com.tianhu.system.api.domain.SysRole;
|
|
|
-import com.tianhu.system.api.domain.SysUser;
|
|
|
+import com.tianhu.system.api.RemoteFileService;
|
|
|
+import com.tianhu.system.api.domain.*;
|
|
|
import com.tianhu.system.api.model.LoginUser;
|
|
|
+import com.tianhu.system.domain.FileInf;
|
|
|
import com.tianhu.system.domain.SysCompany;
|
|
|
+import com.tianhu.system.domain.SysManagementFileRel;
|
|
|
import com.tianhu.system.domain.SysManagementInf;
|
|
|
import com.tianhu.system.domain.SysUserCompanyRel;
|
|
|
import com.tianhu.system.service.*;
|
|
|
@@ -25,10 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 资方管理Controller
|
|
|
@@ -47,10 +42,14 @@ public class OwnManagementInfController extends BaseController
|
|
|
@Autowired
|
|
|
private ISysManagementInfService sysManagementInfService;
|
|
|
@Autowired
|
|
|
+ private ISysManagementFileRelService sysManagementFileRelService;
|
|
|
+ @Autowired
|
|
|
private ISysUserCompanyRelService sysUserCompanyRelService;
|
|
|
@Autowired
|
|
|
private ISysCompanyService sysCompanyService;
|
|
|
@Autowired
|
|
|
+ private IPubFileInfService pubFileInfService;
|
|
|
+ @Autowired
|
|
|
private ISysDeptService deptService;
|
|
|
@Autowired
|
|
|
private ISysRoleService roleService;
|
|
|
@@ -60,6 +59,9 @@ public class OwnManagementInfController extends BaseController
|
|
|
private TokenService tokenService;
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
+ //删除文件的公共方法服务类
|
|
|
+ @Autowired
|
|
|
+ private RemoteFileService remoteFileService;
|
|
|
/**
|
|
|
* 公司状态(正常)
|
|
|
*/
|
|
|
@@ -97,7 +99,6 @@ public class OwnManagementInfController extends BaseController
|
|
|
*/
|
|
|
private String isAuto = "1";
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询资方列表
|
|
|
*/
|
|
|
@@ -105,7 +106,7 @@ public class OwnManagementInfController extends BaseController
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(String scyName,String smiType,String smiManager,String smiContract,String smiContractPhone)
|
|
|
{
|
|
|
- startPage();
|
|
|
+ startPage();
|
|
|
Map map = new HashMap<>();
|
|
|
map.put("scyName",scyName);
|
|
|
map.put("smiType",smiType);
|
|
|
@@ -122,11 +123,26 @@ public class OwnManagementInfController extends BaseController
|
|
|
// @PreAuthorize(hasPermi = "system:company:details")
|
|
|
@GetMapping("details/{scyId}")
|
|
|
public AjaxResult details(@PathVariable("scyId") String scyId)throws Exception {
|
|
|
- LoginUser user = tokenService.getLoginUser();
|
|
|
+ Map map1 = new HashMap();
|
|
|
Map map = new HashMap<>();
|
|
|
map.put("scyId",scyId);
|
|
|
List<Map> list = ownManagementInfService.selectFundSide(map);
|
|
|
- return AjaxResult.success(list);
|
|
|
+ LambdaQueryWrapper<SysManagementFileRel> sysManagementFileRel = new LambdaQueryWrapper();
|
|
|
+ sysManagementFileRel.eq(SysManagementFileRel::getSmfrCompanyId,scyId);
|
|
|
+ List<SysManagementFileRel> managementFile = sysManagementFileRelService.findSysManagementFileRels(sysManagementFileRel);
|
|
|
+ List<Map> dailyResult = new ArrayList();
|
|
|
+ for(int i=0;i<managementFile.size();i++){
|
|
|
+ Map pfi =new HashMap();
|
|
|
+ LambdaQueryWrapper<FileInf> file = new LambdaQueryWrapper();
|
|
|
+ file.eq(FileInf::getPfiFileId,managementFile.get(i).getSmfrFileId());
|
|
|
+ List<FileInf> fileInf = pubFileInfService.findFileInfs(file);
|
|
|
+ pfi.put("file",fileInf.get(0).getPfiFileId());
|
|
|
+ pfi.put("pfiUrl",fileInf.get(0).getPfiUrl());
|
|
|
+ dailyResult.add(pfi);
|
|
|
+ }
|
|
|
+ map1.put("data",dailyResult);
|
|
|
+ map1.put("list",list);
|
|
|
+ return AjaxResult.success(map1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -213,6 +229,9 @@ public class OwnManagementInfController extends BaseController
|
|
|
//获取创建人
|
|
|
SysUser use = userInfo.getSysUser();
|
|
|
company.setCreateBy(use.getUserId()+"");
|
|
|
+ //获取当前时间
|
|
|
+ Date currentTime = DateUtils.getNowDate();
|
|
|
+ company.setCreateTime(currentTime);
|
|
|
sysCompanyService.createSysCompany(company);
|
|
|
//创建部门
|
|
|
SysDept dept = new SysDept();
|
|
|
@@ -231,6 +250,7 @@ public class OwnManagementInfController extends BaseController
|
|
|
sysRole.setCompanyId(scyId);
|
|
|
sysRole.setRoleName(scyName);
|
|
|
sysRole.setRoleSort(defaultOrder);
|
|
|
+ sysRole.setRoleKey(scyName);
|
|
|
sysRole.setDataScope(dataScope);
|
|
|
sysRole.setMenuCheckStrictly(isCheck);
|
|
|
sysRole.setDeptCheckStrictly(isCheck);
|
|
|
@@ -276,6 +296,12 @@ public class OwnManagementInfController extends BaseController
|
|
|
sysUserCompanyRel.setSucrDeptId(deptId);
|
|
|
sysUserCompanyRel.setSucrHandler("1");
|
|
|
sysUserCompanyRelService.createSysUserCompanyRel(sysUserCompanyRel);
|
|
|
+ for(int i=0;i < smiAgreement.size();i++){
|
|
|
+ SysManagementFileRel file =new SysManagementFileRel();
|
|
|
+ file.setSmfrCompanyId(scyId);
|
|
|
+ file.setSmfrFileId(smiAgreement.get(i).get("uid"));
|
|
|
+ sysManagementFileRelService.createSysManagementFileRel(file);
|
|
|
+ }
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@@ -350,6 +376,23 @@ public class OwnManagementInfController extends BaseController
|
|
|
sysManagementInf.setSmiManager(smiManager);
|
|
|
sysManagementInf.setSmiDesc(smiDesc);
|
|
|
sysManagementInfService.updateSysManagementInf(sysManagementInf);
|
|
|
+ //合作协议删除
|
|
|
+ LambdaQueryWrapper<SysManagementFileRel> sysManagementFileRel = new LambdaQueryWrapper();
|
|
|
+ sysManagementFileRel.eq(SysManagementFileRel::getSmfrCompanyId,scyId);
|
|
|
+ List<SysManagementFileRel> managementFile = sysManagementFileRelService.findSysManagementFileRels(sysManagementFileRel);
|
|
|
+ //资源删除
|
|
|
+ for(int j=0;j<managementFile.size();j++){
|
|
|
+ String token = SecurityUtils.getToken(ServletUtils.getRequest());
|
|
|
+ remoteFileService.delete(managementFile.get(j).getSmfrFileId(), scyId,token);
|
|
|
+ }
|
|
|
+ sysManagementFileRelService.deleteSysManagementFileRel(sysManagementFileRel);
|
|
|
+ //新增合作协议
|
|
|
+ for(int i=0;i < smiAgreement.size();i++){
|
|
|
+ SysManagementFileRel file =new SysManagementFileRel();
|
|
|
+ file.setSmfrCompanyId(scyId);
|
|
|
+ file.setSmfrFileId(smiAgreement.get(i).get("uid"));
|
|
|
+ sysManagementFileRelService.createSysManagementFileRel(file);
|
|
|
+ }
|
|
|
return R.ok();
|
|
|
}
|
|
|
}
|