|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -11,11 +12,11 @@ import org.apache.commons.lang.StringUtils;
|
|
import org.apache.http.client.utils.DateUtils;
|
|
import org.apache.http.client.utils.DateUtils;
|
|
import org.springblade.business.entity.*;
|
|
import org.springblade.business.entity.*;
|
|
import org.springblade.business.feign.TaskClient;
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
|
+import org.springblade.business.mapper.InformationQueryMapper;
|
|
import org.springblade.business.service.*;
|
|
import org.springblade.business.service.*;
|
|
import org.springblade.business.utils.FileUtils;
|
|
import org.springblade.business.utils.FileUtils;
|
|
import org.springblade.business.vo.FileUserVO;
|
|
import org.springblade.business.vo.FileUserVO;
|
|
import org.springblade.business.vo.InformationQueryVO;
|
|
import org.springblade.business.vo.InformationQueryVO;
|
|
-import org.springblade.business.mapper.InformationQueryMapper;
|
|
|
|
import org.springblade.business.vo.QueryProcessDataVO;
|
|
import org.springblade.business.vo.QueryProcessDataVO;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
@@ -35,6 +36,7 @@ import org.springblade.manager.feign.WbsTreeContractClient;
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springblade.system.cache.ParamCache;
|
|
|
|
+import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -42,7 +44,6 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileNotFoundException;
|
|
@@ -79,6 +80,10 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
private final ContractClient contractClient;
|
|
private final ContractClient contractClient;
|
|
|
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
|
+ //超级管理员的角色id
|
|
|
|
+ private final String SUPER_ADMIN_ROLE_ID ="1123598816738675201";
|
|
|
|
+ //泓创智诚公司的部门id
|
|
|
|
+ private final Long HONGCHENG_DEPT_ID = 1536982621165592577L;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
StringRedisTemplate RedisTemplate;
|
|
StringRedisTemplate RedisTemplate;
|
|
@@ -395,18 +400,114 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
if (StringUtils.isNotEmpty(fileName)) {
|
|
if (StringUtils.isNotEmpty(fileName)) {
|
|
oldData.setName(fileName);
|
|
oldData.setName(fileName);
|
|
}
|
|
}
|
|
|
|
+ //拼接填报人信息
|
|
|
|
+ String fileUser = userId + "-" + userNmae;
|
|
|
|
+ if (StringUtils.isNotEmpty(oldData.getFileUserIdAndName())) {
|
|
|
|
+ if (!oldData.getFileUserIdAndName().contains(userId.toString())) {
|
|
|
|
+ //不包含,拼接
|
|
|
|
+ oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ oldData.setFileUserIdAndName(fileUser);
|
|
|
|
+ }
|
|
|
|
+ oldData.setUpdateTime(new Date());
|
|
|
|
+ oldData.setUpdateUser(userId);
|
|
|
|
|
|
- //拼接填报人信息
|
|
|
|
- String fileUser = userId + "-" + userNmae;
|
|
|
|
- if (StringUtils.isNotEmpty(oldData.getFileUserIdAndName())) {
|
|
|
|
- if (!oldData.getFileUserIdAndName().contains(userId.toString())) {
|
|
|
|
- //不包含,拼接
|
|
|
|
- oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- oldData.setFileUserIdAndName(fileUser);
|
|
|
|
|
|
+ List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
|
+ if (linkIds.size() > 0) {
|
|
|
|
+ oldData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //修改数据
|
|
|
|
+ this.baseMapper.updateById(oldData);
|
|
|
|
+ } else {
|
|
|
|
+ //新增基础数据
|
|
|
|
+ InformationQuery newData = new InformationQuery();
|
|
|
|
+ //设置文件题名
|
|
|
|
+ newData.setName(fileName);
|
|
|
|
+ //设置文件类型
|
|
|
|
+ newData.setCategory(contractTree.getNodeType());
|
|
|
|
+ //项目ID
|
|
|
|
+ newData.setProjectId(Long.parseLong(contractTree.getProjectId()));
|
|
|
|
+ //合同段ID
|
|
|
|
+ newData.setContractId(Long.parseLong(contractTree.getContractId()));
|
|
|
|
+ //施工资料还是质检资料
|
|
|
|
+ newData.setClassify(classify);
|
|
|
|
+ //节点ID
|
|
|
|
+ newData.setWbsId(contractTree.getPKeyId());
|
|
|
|
+
|
|
|
|
+ //1资料填报,2试验,3首件
|
|
|
|
+ newData.setType((contractTree.getIsExpernode() == null || contractTree.getIsExpernode() <= 0) ? 1 : 2);
|
|
|
|
+
|
|
|
|
+ //流程状态,默认未上报
|
|
|
|
+ newData.setStatus(0);
|
|
|
|
+ //填报人ID及姓名
|
|
|
|
+ newData.setFileUserIdAndName(userId + "-" + userNmae);
|
|
|
|
+ //数据源类型
|
|
|
|
+ newData.setSourceType(sourceType);
|
|
|
|
+ newData.setCreateUser(userId);
|
|
|
|
+ newData.setCreateTime(new Date());
|
|
|
|
+
|
|
|
|
+ List<String> linkIds = linkDataList.stream().map(json -> json.getString("id")).distinct().collect(Collectors.toList());
|
|
|
|
+ if (linkIds.size() > 0) {
|
|
|
|
+ newData.setSjRecordIds(StringUtils.join(linkIds, ","));
|
|
|
|
+ }
|
|
|
|
+ //保存数据
|
|
|
|
+ this.baseMapper.insert(newData);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String saveOrUpdateInformationQueryDataReSign(String primaryKeyId, String tableId, String businessId, String fileName, Integer classify, Integer sourceType, String isFirst, String sourceUrl, String pdfUrl, String firstFileName, List<JSONObject> linkDataList) {
|
|
|
|
+ Long userId = 0L;
|
|
|
|
+ String userNmae = "";
|
|
|
|
+
|
|
|
|
+ if (primaryKeyId.indexOf(":") >= 0) {
|
|
|
|
+ String prdata[] = primaryKeyId.split(":");
|
|
|
|
+ primaryKeyId = prdata[0];
|
|
|
|
+ userId = Long.parseLong(prdata[1]);
|
|
|
|
+ R<User> userR = userClient.userInfoById(userId);
|
|
|
|
+ userNmae = userR.getData().getName();
|
|
|
|
+ } else {
|
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
|
+ if (user != null) {
|
|
|
|
+ userId = user.getUserId();
|
|
|
|
+ userNmae = user.getNickName();
|
|
|
|
+ } else {
|
|
|
|
+ /*非客户端调用,request里不一定有用户信息,暂停后续操作*/
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(isFirst) && "true".equals(isFirst)) {
|
|
|
|
+ return this.saveOrUpdateFirstInformationQueryData(primaryKeyId, tableId, businessId, fileName, classify, sourceType, sourceUrl, pdfUrl, firstFileName, linkDataList);
|
|
|
|
+ } else {
|
|
|
|
+ //首先根据wbsId获取合同段ID和项目ID
|
|
|
|
+ WbsTreeContract contractTree = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.parseLong(primaryKeyId));
|
|
|
|
+
|
|
|
|
+ //判断当前填报节点下是否已经存在相应数据
|
|
|
|
+ InformationQuery oldData = this.baseMapper.getInformationQueryByWbsId(contractTree.getPKeyId(), classify);
|
|
|
|
+
|
|
|
|
+ if (oldData != null) {
|
|
|
|
+ //存在记录,修改
|
|
|
|
+ if (StringUtils.isNotEmpty(fileName)) {
|
|
|
|
+ oldData.setName(fileName);
|
|
|
|
+ }
|
|
|
|
+ //判断是否为超级管理员并且所属部门是在泓创智诚的公司下的部门 ture为跳过 false赋值
|
|
|
|
+ if(!judgeRoleIdAndDeptId(userId)){
|
|
|
|
+ //拼接填报人信息
|
|
|
|
+ String fileUser = userId + "-" + userNmae;
|
|
|
|
+ if (StringUtils.isNotEmpty(oldData.getFileUserIdAndName())) {
|
|
|
|
+ if (!oldData.getFileUserIdAndName().contains(userId.toString())) {
|
|
|
|
+ //不包含,拼接
|
|
|
|
+ oldData.setFileUserIdAndName(oldData.getFileUserIdAndName() + "," + fileUser);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ oldData.setFileUserIdAndName(fileUser);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
oldData.setUpdateTime(new Date());
|
|
oldData.setUpdateTime(new Date());
|
|
oldData.setUpdateUser(userId);
|
|
oldData.setUpdateUser(userId);
|
|
|
|
|
|
@@ -455,6 +556,27 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
+ public boolean judgeRoleIdAndDeptId(Long userId ){
|
|
|
|
+ String sqlForUser = "select role_id ,dept_id from blade_user where id = "+userId;
|
|
|
|
+ User user = jdbcTemplate.queryForObject(sqlForUser, new BeanPropertyRowMapper<>(User.class));
|
|
|
|
+ String sqlforSkipDept = "select id from blade_dept where parent_id = "+HONGCHENG_DEPT_ID + " or id = "+HONGCHENG_DEPT_ID;
|
|
|
|
+ List<Dept> depts = jdbcTemplate.query(sqlforSkipDept, new BeanPropertyRowMapper<>(Dept.class));
|
|
|
|
+ String roleId = user.getRoleId();
|
|
|
|
+ String deptId = user.getDeptId();
|
|
|
|
+ //既是超级管理员同时是泓创下面的部门才允许跳过填报人赋值
|
|
|
|
+ if(roleId.contains(SUPER_ADMIN_ROLE_ID)){
|
|
|
|
+ Boolean flag = false;
|
|
|
|
+ for (Dept dept : depts) {
|
|
|
|
+ if(deptId.contains(dept.getId().toString())){
|
|
|
|
+ flag = true;
|
|
|
|
+ return flag;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
|
|
+ }else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<Integer> getReportNumberByContractId(Integer classify, String contractId) {
|
|
public List<Integer> getReportNumberByContractId(Integer classify, String contractId) {
|