diff --git a/oms_web/oms_vue/src/views/project/info/ProjectDetailDrawer.vue b/oms_web/oms_vue/src/views/project/info/ProjectDetailDrawer.vue
index 28e71378..c1eba6d7 100644
--- a/oms_web/oms_vue/src/views/project/info/ProjectDetailDrawer.vue
+++ b/oms_web/oms_vue/src/views/project/info/ProjectDetailDrawer.vue
@@ -85,6 +85,13 @@
+
+
+
+
+
+
+
diff --git a/oms_web/oms_vue/src/views/project/info/ProjectForm.vue b/oms_web/oms_vue/src/views/project/info/ProjectForm.vue
index 06e2e0d7..f30c569e 100644
--- a/oms_web/oms_vue/src/views/project/info/ProjectForm.vue
+++ b/oms_web/oms_vue/src/views/project/info/ProjectForm.vue
@@ -175,6 +175,11 @@
+
+
+
+
+
@@ -670,6 +675,7 @@ export default {
agentName: null,
agentCode: null,
projectStage: null,
+ constructionType: null,
projectGraspDegree: null,
hzSupportUserName: null,
hzSupportUser: null,
diff --git a/oms_web/oms_vue/src/views/project/info/index.vue b/oms_web/oms_vue/src/views/project/info/index.vue
index b76bbb03..86f8e591 100644
--- a/oms_web/oms_vue/src/views/project/info/index.vue
+++ b/oms_web/oms_vue/src/views/project/info/index.vue
@@ -70,6 +70,14 @@
/>
+
+
+
+
@@ -346,6 +355,7 @@ export default {
collect: null,
projectGraspDegree: null,
projectStage: [],
+ constructionType: null,
hzSupportUserName: null,
poc: null,
timeType: '0', // Default to 预计下单时间
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ExternalController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ExternalController.java
index df206421..85a8135d 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ExternalController.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ExternalController.java
@@ -1,14 +1,29 @@
package com.ruoyi.sip.controller;
import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.sip.domain.ProjectInfo;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.dto.ApiDataQueryDto;
+import com.ruoyi.sip.dto.ApiProjectAddDto;
+import com.ruoyi.sip.dto.ApiUserAddDto;
+import com.ruoyi.sip.dto.ApiUserInfo;
import com.ruoyi.sip.service.*;
+import com.ruoyi.framework.shiro.service.SysPasswordService;
+import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.List;
+
/**
@@ -37,6 +52,12 @@ public class ExternalController {
private IInventoryDeliveryService deliveryService;
@Autowired
private IProjectOrderInfoRecallService projectOrderInfoRecallService;
+ @Autowired
+ private IProjectInfoService projectInfoService;
+ @Autowired
+ private ISysUserService userService;
+ @Autowired
+ private SysPasswordService passwordService;
private final static String API_KEY = "c7f858d0-30b8-4b7f-9ea1-0ccf5ceb1c54";
@@ -77,4 +98,102 @@ public class ExternalController {
return AjaxResult.success(projectOrderInfoRecallService.getOrderRecallInfo(dto));
}
-}
\ No newline at end of file
+ @GetMapping("/v1/user/info")
+ @Anonymous
+ public AjaxResult getUserInfo(@RequestParam(value = "userCode", required = false) String userCode,
+ @RequestParam(value = "roleName", required = false) String roleName,
+ @RequestHeader(value = "apiKey", required = false) String apiKey) {
+ if (StringUtils.isEmpty(apiKey)) {
+ return AjaxResult.error("apiKey不能为空");
+ }
+ if (!API_KEY.equals(apiKey)) {
+ return AjaxResult.error("鉴权失败");
+ }
+ if (StringUtils.isEmpty(userCode) && StringUtils.isEmpty(roleName)) {
+ return AjaxResult.error("用户code或角色名称不能为空");
+ }
+ if (StringUtils.isNotEmpty(userCode)) {
+ SysUser user = userService.selectUserByLoginName(userCode);
+ List userList = new ArrayList<>();
+ if (user != null) {
+ userList.add(convertToApiUserInfo(user));
+ }
+ return AjaxResult.success(userList);
+ }
+ return AjaxResult.success(convertToApiUserInfoList(userService.listByRoleName(roleName)));
+ }
+
+ private List convertToApiUserInfoList(List userList) {
+ List result = new ArrayList<>();
+ if (userList == null || userList.isEmpty()) {
+ return result;
+ }
+ for (SysUser user : userList) {
+ result.add(convertToApiUserInfo(user));
+ }
+ return result;
+ }
+
+ private ApiUserInfo convertToApiUserInfo(SysUser user) {
+ ApiUserInfo apiUserInfo = new ApiUserInfo();
+ BeanUtils.copyProperties(user, apiUserInfo);
+ return apiUserInfo;
+ }
+
+ @PostMapping("/v1/user/add")
+ @Anonymous
+ public AjaxResult addUserInfo(@RequestBody ApiUserAddDto dto,
+ @RequestHeader(value = "apiKey", required = false) String apiKey) {
+ if (StringUtils.isEmpty(apiKey)) {
+ return AjaxResult.error("apiKey不能为空");
+ }
+ if (!API_KEY.equals(apiKey)) {
+ return AjaxResult.error("鉴权失败");
+ }
+ if (StringUtils.isEmpty(dto.getUserName())) {
+ return AjaxResult.error("userName不能为空");
+ }
+ if (StringUtils.isEmpty(dto.getLoginName())) {
+ return AjaxResult.error("loginName不能为空");
+ }
+ SysUser sysUser = new SysUser();
+ sysUser.setUserName(dto.getUserName());
+ sysUser.setLoginName(dto.getLoginName());
+ if (dto.getRoleIds() != null && dto.getRoleIds().length > 0) {
+ sysUser.setRoleIds(dto.getRoleIds());
+ }
+ if (!userService.checkLoginNameUnique(sysUser)) {
+ return AjaxResult.error("新增用户'" + dto.getLoginName() + "'失败,登录账号已存在");
+ }
+ String rawPassword = StringUtils.isEmpty(dto.getPassword()) ? "123456" : dto.getPassword();
+ sysUser.setSalt(ShiroUtils.randomSalt());
+ sysUser.setPassword(passwordService.encryptPassword(dto.getLoginName(), rawPassword, sysUser.getSalt()));
+ sysUser.setUserType(UserConstants.SYSTEM_USER_TYPE);
+ sysUser.setStatus(UserConstants.NORMAL);
+ sysUser.setPwdUpdateDate(DateUtils.getNowDate());
+ sysUser.setCreateBy("external-api");
+ userService.insertUser(sysUser);
+ return AjaxResult.success(convertToApiUserInfo(sysUser));
+ }
+
+ @PostMapping("/v1/project/add")
+ @Anonymous
+ public AjaxResult addProjectInfo(@RequestBody ApiProjectAddDto dto,
+ @RequestHeader(value = "apiKey", required = false) String apiKey) {
+ if (StringUtils.isEmpty(apiKey)) {
+ return AjaxResult.error("apiKey不能为空");
+ }
+ if (!API_KEY.equals(apiKey)) {
+ return AjaxResult.error("鉴权失败");
+ }
+ if (dto == null) {
+ return AjaxResult.error("请求参数不能为空");
+ }
+ if (StringUtils.isEmpty(dto.getProjectName())) {
+ return AjaxResult.error("projectName不能为空");
+ }
+ ProjectInfo projectInfo = projectInfoService.insertProjectInfoForApi(dto);
+ return ObjectUtils.isEmpty(projectInfo) ? AjaxResult.error("新增项目失败") : AjaxResult.success(projectInfo);
+ }
+
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java
index 9500abd9..e1f20ac5 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/ProjectInfoController.java
@@ -120,7 +120,7 @@ public class ProjectInfoController extends BaseController
@ResponseBody
public AjaxResult addSave(ProjectInfo projectInfo)
{
- return toAjax(projectInfoService.insertProjectInfo(projectInfo));
+ return toAjax(projectInfoService.insertProjectInfo(projectInfo, false));
}
/**
@@ -168,7 +168,7 @@ public class ProjectInfoController extends BaseController
@ResponseBody
public AjaxResult editSave(ProjectInfo projectInfo)
{
- return toAjax(projectInfoService.updateProjectInfo(projectInfo));
+ return toAjax(projectInfoService.updateProjectInfo(projectInfo, false));
}
/**
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/vue/VueProjectInfoController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/vue/VueProjectInfoController.java
index c39f0259..c1522438 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/vue/VueProjectInfoController.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/vue/VueProjectInfoController.java
@@ -92,7 +92,7 @@ public class VueProjectInfoController extends BaseController {
@Log(title = "项目管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProjectInfo projectInfo) {
- return toAjax(projectInfoService.insertProjectInfo(projectInfo));
+ return toAjax(projectInfoService.insertProjectInfo(projectInfo, false));
}
/**
@@ -102,7 +102,7 @@ public class VueProjectInfoController extends BaseController {
@Log(title = "项目管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProjectInfo projectInfo) {
- return toAjax(projectInfoService.updateProjectInfo(projectInfo));
+ return toAjax(projectInfoService.updateProjectInfo(projectInfo, false));
}
@RequiresPermissions("sip:project:edit")
@Log(title = "会审", businessType = BusinessType.UPDATE)
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java
index e29c925e..2e1df01c 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectInfo.java
@@ -56,6 +56,7 @@ public class ProjectInfo extends BaseEntity
*/
@Excel(name = "项目阶段", dictType = "project_stage")
private String projectStage;
+ private String constructionType;
/** 项目把握度 */
@Excel(name = "项目把握度")
private String projectGraspDegree;
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiProjectAddDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiProjectAddDto.java
new file mode 100644
index 00000000..1a2c3f77
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiProjectAddDto.java
@@ -0,0 +1,65 @@
+package com.ruoyi.sip.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class ApiProjectAddDto {
+
+ /** 项目编号 */
+ private String projectCode;
+ /** 项目名称 */
+ private String projectName;
+ /** 客户名称 */
+ private String customerName;
+ /** 运作机构 */
+ private String operateInstitution;
+ /** 新华三联系人 */
+ private String h3cPerson;
+ /** 新华三TEL */
+ private String h3cPhone;
+ /** 预计金额 */
+ private BigDecimal estimatedAmount;
+ /** 预计下单时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+ private Date estimatedOrderTime;
+ /** 项目把握度 */
+ private String projectGraspDegree;
+ /** 项目阶段 */
+ private String projectStage;
+ /** 竞争对手 */
+ private List competitorList;
+ /** 汇智负责人 */
+ private String hzSupportUser;
+ /** 创建人 */
+ private String createBy;
+ /** 建设类型 */
+ private String constructionType;
+ /** 代理商 */
+ private Partner partner;
+
+ @Data
+ public static class Partner {
+ /** 代理商编码 */
+ private String partnerCode;
+ /** 代理商名称 */
+ private String partnerName;
+ /** 省 */
+ private String province;
+ /** 市 */
+ private String city;
+ /** 地址 */
+ private String address;
+ /** 联系人姓名 */
+ private String contactPerson;
+ /** 联系人电话 */
+ private String contactPhone;
+ /** 认证级别 */
+ private String level;
+ }
+
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserAddDto.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserAddDto.java
new file mode 100644
index 00000000..f7dc60aa
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserAddDto.java
@@ -0,0 +1,13 @@
+package com.ruoyi.sip.dto;
+
+import lombok.Data;
+
+@Data
+public class ApiUserAddDto {
+
+ private String userName;
+ private String loginName;
+ private String password;
+ private Long[] roleIds;
+
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserInfo.java
new file mode 100644
index 00000000..81923f3a
--- /dev/null
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/dto/ApiUserInfo.java
@@ -0,0 +1,12 @@
+package com.ruoyi.sip.dto;
+
+import lombok.Data;
+
+@Data
+public class ApiUserInfo {
+
+ private Long userId;
+ private String loginName;
+ private String userName;
+
+}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
index 3bdc746e..e5219ebe 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/llm/tools/ProjectOrderInfoToolProvider.java
@@ -181,7 +181,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
item.put("customerName", orderInfo.getCustomerName());
item.put("bgName", DictUtils.getDictLabel("bg_type", orderInfo.getBgProperty()));
item.put("industryType", getIndustryTypeName(orderInfo));
- item.put("constructionType", "");
+ item.put("constructionType", projectInfo == null ? "" : projectInfo.getConstructionType());
item.put("projectPartnerName", orderInfo.getProjectPartnerName());
item.put("businessContactName", orderInfo.getBusinessPerson());
item.put("businessContactPhone", orderInfo.getBusinessPhone());
@@ -725,7 +725,7 @@ public class ProjectOrderInfoToolProvider extends AbstractMcpToolProvider {
metadata.put("customerName", "最终客户");
metadata.put("bgName", "BG");
metadata.put("industryType", "行业");
- metadata.put("constructionType", "建设类型(预留)");
+ metadata.put("constructionType", "建设类型");
metadata.put("projectPartnerName", "运作方");
metadata.put("businessContactName", "进货商接口人");
metadata.put("businessContactPhone", "联系方式");
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java
index 1a927dd4..0997b7b8 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IProjectInfoService.java
@@ -3,6 +3,7 @@ package com.ruoyi.sip.service;
import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.sip.domain.ProjectInfo;
+import com.ruoyi.sip.dto.ApiProjectAddDto;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.StatisticsDto;
@@ -36,7 +37,7 @@ public interface IProjectInfoService
* @param projectInfo 项目管理
* @return 结果
*/
- public int insertProjectInfo(ProjectInfo projectInfo);
+ public int insertProjectInfo(ProjectInfo projectInfo, boolean isApi);
/**
* 修改项目管理
@@ -44,7 +45,7 @@ public interface IProjectInfoService
* @param projectInfo 项目管理
* @return 结果
*/
- public int updateProjectInfo(ProjectInfo projectInfo);
+ public int updateProjectInfo(ProjectInfo projectInfo, boolean isApi);
/**
* 批量删除项目管理
@@ -74,4 +75,7 @@ public interface IProjectInfoService
byte[] exportSingleJoinTrial(ProjectInfo projectInfo);
String exportJoinTrial(ProjectInfo projectInfo);
+
+ ProjectInfo insertProjectInfoForApi(ApiProjectAddDto dto);
+
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
index e158cf76..941c93f2 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
@@ -84,7 +84,9 @@ public class PartnerInfoServiceImpl implements IPartnerInfoService
@Override
public int insertPartnerInfo(PartnerInfo partnerInfo)
{
- partnerInfo.setCreateBy(ShiroUtils.getUserId().toString());
+ if (StringUtils.isEmpty(partnerInfo.getCreateBy())) {
+ partnerInfo.setCreateBy(ShiroUtils.getUserId().toString());
+ }
// 生成编码时加锁,确保线程安全
lock.lock();
try {
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java
index 44ecc4c4..8645ff5f 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProjectInfoServiceImpl.java
@@ -22,6 +22,7 @@ import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.sip.domain.*;
+import com.ruoyi.sip.dto.ApiProjectAddDto;
import com.ruoyi.sip.dto.HomepageQueryDto;
import com.ruoyi.sip.dto.StatisticsDetailDto;
import com.ruoyi.sip.dto.StatisticsDto;
@@ -29,6 +30,8 @@ import com.ruoyi.sip.mapper.ProjectInfoMapper;
import com.ruoyi.sip.service.*;
import liquibase.hub.model.Project;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xwpf.usermodel.*;
@@ -77,8 +80,8 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
private IProjectPocInfoService pocInfoService;
@Autowired
private ICustomerInfoService customerInfoService;
-
-
+ @Autowired
+ private IPartnerInfoService partnerInfoService;
@Autowired
private IOmsFileLogService omsFileLogService;
@Autowired
@@ -123,7 +126,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
//查询操作日志信息
List projectOperateLogs = operateLogService.selectProjectOperateLogListByProjectId(projectInfo.getId());
projectOperateLogs = projectOperateLogs.stream().filter(item -> {
- if (ShiroUtils.getSysUser().isAdmin()) {
+ if (ObjectUtils.isNotEmpty(ShiroUtils.getSysUser()) && ShiroUtils.getSysUser().isAdmin()) {
return ProjectOperateLog.LogTypeEnum.DETAIL.getValue().equals(item.getLogType());
}
return ProjectOperateLog.LogTypeEnum.BRIEF.getValue().equals(item.getLogType());
@@ -195,15 +198,20 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
* 新增项目管理
*
* @param projectInfo 项目管理
+ * @param isApi 数据来源是否对外api接口
* @return 结果
*/
@Override
- public int insertProjectInfo(ProjectInfo projectInfo) {
+ public int insertProjectInfo(ProjectInfo projectInfo, boolean isApi) {
//生成项目编码
setProjectCode(projectInfo);
projectInfo.setCreateTime(DateUtils.getNowDate());
projectInfo.setUpdateTime(DateUtils.getNowDate());
- projectInfo.setCreateBy(ShiroUtils.getUserId().toString());
+ if (isApi) {
+ projectInfo.setCreateBy(projectInfo.getCreateBy());
+ } else {
+ projectInfo.setCreateBy(ShiroUtils.getUserId().toString());
+ }
if (CollUtil.isNotEmpty(projectInfo.getCompetitorList())) {
projectInfo.setCompetitor(projectInfo.getCompetitorList().stream().filter(StringUtils::isNotEmpty).collect(Collectors.joining(",")));
}
@@ -265,7 +273,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
* @return 结果
*/
@Override
- public int updateProjectInfo(ProjectInfo projectInfo) {
+ public int updateProjectInfo(ProjectInfo projectInfo, boolean isApi) {
// 获取更新前的项目信息
ProjectInfo oldProjectInfo = this.selectProjectInfoById(projectInfo.getId());
if (CollUtil.isNotEmpty(projectInfo.getCompetitorList())) {
@@ -273,7 +281,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
}
//变更属地校验
List projectOrderInfos = orderInfoService.selectProjectOrderInfoByProjectId(Collections.singletonList(projectInfo.getId()));
- if (!oldProjectInfo.getAgentCode().equals(projectInfo.getAgentCode())) {
+ if (!isApi && !oldProjectInfo.getAgentCode().equals(projectInfo.getAgentCode())) {
//查询订单信息 如果有抛出异常
if (CollUtil.isNotEmpty(projectOrderInfos)) {
throw new ServiceException("该项目存在订单流转,无法更改代表处");
@@ -283,7 +291,9 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
}
// 更新项目信息
projectInfo.setUpdateTime(DateUtils.getNowDate());
- projectInfo.setUpdateBy(ShiroUtils.getUserId().toString());
+ if (!isApi) {
+ projectInfo.setUpdateBy(ShiroUtils.getUserId().toString());
+ }
int result = projectInfoMapper.updateProjectInfo(projectInfo);
//变更其它信息
saveOtherInfo(projectInfo);
@@ -324,6 +334,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
logIndex = compareField(logContent, logIndex, "代表处", oldProjectInfo.getAgentName(), projectInfo.getAgentName());
logIndex = compareField(logContent, logIndex, "项目阶段", DictUtils.getDictLabel(PROJECT_STAGE_DICT_TYPE, oldProjectInfo.getProjectStage())
, DictUtils.getDictLabel(PROJECT_STAGE_DICT_TYPE, projectInfo.getProjectStage()));
+ logIndex = compareField(logContent, logIndex, "建设类型", oldProjectInfo.getConstructionType(), projectInfo.getConstructionType());
logIndex = compareField(logContent, logIndex, "项目把握度", oldProjectInfo.getProjectGraspDegree(), projectInfo.getProjectGraspDegree());
if (oldProjectInfo.getHzSupportUser() != null || projectInfo.getHzSupportUser() != null) {
List sysUsers = projectInfoMapper.selectUserById(Stream.of(oldProjectInfo.getHzSupportUser(), projectInfo.getHzSupportUser()).filter(Objects::nonNull).collect(Collectors.toList()));
@@ -390,7 +401,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
operateLog.setProjectId(projectInfo.getId());
operateLog.setOperateLog(logContent.toString());
operateLog.setOperateTime(DateUtils.getNowDate());
- operateLog.setOperateUser(ShiroUtils.getUserId().toString());
+ operateLog.setOperateUser(StringUtils.isNotEmpty(projectInfo.getUpdateBy()) ? projectInfo.getUpdateBy() : ShiroUtils.getUserId().toString());
operateLog.setLogType(ProjectOperateLog.LogTypeEnum.DETAIL.getValue());
operateLogService.insertProjectOperateLog(operateLog);
//记录type
@@ -400,7 +411,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
operateLog.setProjectId(projectInfo.getId());
operateLog.setOperateLog(logSimpleContent.toString());
operateLog.setOperateTime(DateUtils.getNowDate());
- operateLog.setOperateUser(ShiroUtils.getUserId().toString());
+ operateLog.setOperateUser(StringUtils.isNotEmpty(projectInfo.getUpdateBy()) ? projectInfo.getUpdateBy() : ShiroUtils.getUserId().toString());
operateLog.setLogType(ProjectOperateLog.LogTypeEnum.BRIEF.getValue());
operateLogService.insertProjectOperateLog(operateLog);
}
@@ -933,6 +944,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
headerList.add(Collections.singletonList("行业"));
headerList.add(Collections.singletonList("代表处"));
headerList.add(Collections.singletonList("项目阶段"));
+ headerList.add(Collections.singletonList("建设类型"));
headerList.add(Collections.singletonList("项目把握度"));
headerList.add(Collections.singletonList("汇智负责人"));
headerList.add(Collections.singletonList("最终客户"));
@@ -1003,6 +1015,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
row.add(info.getIndustryType());
row.add(info.getAgentName());
row.add(DictUtils.getDictLabel("project_stage", info.getProjectStage()));
+ row.add(info.getConstructionType());
row.add(info.getProjectGraspDegree());
row.add(info.getHzSupportUserName());
row.add(info.getCustomerName());
@@ -1100,4 +1113,82 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
}
return totalPrice;
}
+
+ @Override
+ public ProjectInfo insertProjectInfoForApi(ApiProjectAddDto dto) {
+ ProjectInfo projectInfo = new ProjectInfo();
+ projectInfo.setProjectCode(dto.getProjectCode());
+ projectInfo.setProjectName(dto.getProjectName());
+ projectInfo.setCustomerName(dto.getCustomerName());
+ projectInfo.setOperateInstitution(dto.getOperateInstitution());
+ projectInfo.setH3cPerson(dto.getH3cPerson());
+ projectInfo.setH3cPhone(dto.getH3cPhone());
+ projectInfo.setEstimatedAmount(dto.getEstimatedAmount());
+ projectInfo.setEstimatedOrderTime(dto.getEstimatedOrderTime());
+ projectInfo.setProjectGraspDegree(dto.getProjectGraspDegree());
+ projectInfo.setProjectStage(dto.getProjectStage());
+ projectInfo.setConstructionType(dto.getConstructionType());
+ projectInfo.setCompetitorList(dto.getCompetitorList());
+ projectInfo.setHzSupportUser(dto.getHzSupportUser());
+ projectInfo.setCreateBy(dto.getCreateBy());
+ projectInfo.setConstructionType(dto.getConstructionType());
+ projectInfo.setUpdateBy(dto.getCreateBy());
+ //处理代理商信息,不存在的代理商做新增操作
+ if ("h3c".equals(dto.getOperateInstitution())) {
+ projectInfo.setPartnerCode("");
+ projectInfo.setPartnerName("新华三");
+ projectInfo.setPartnerUserName("");
+ projectInfo.setContactWay("");
+ } else {
+ PartnerInfo queryPartnerInfo = new PartnerInfo();
+ queryPartnerInfo.setPartnerName(dto.getPartner().getPartnerName());
+ List partnerInfoList = partnerInfoService.selectPartnerInfoList(queryPartnerInfo);
+ PartnerInfo partnerInfo = new PartnerInfo();
+ if (CollectionUtils.isEmpty(partnerInfoList)) {
+ partnerInfo.setPartnerName(dto.getPartner().getPartnerName());
+ partnerInfo.setProvince(dto.getPartner().getProvince());
+ partnerInfo.setCity(dto.getPartner().getCity());
+ partnerInfo.setAddress(dto.getPartner().getAddress());
+ partnerInfo.setContactPerson(dto.getPartner().getContactPerson());
+ partnerInfo.setContactPhone(dto.getPartner().getContactPhone());
+ partnerInfo.setLevel(dto.getPartner().getLevel());
+ partnerInfo.setCreateBy(dto.getCreateBy());
+ int rows = partnerInfoService.insertPartnerInfo(partnerInfo);
+ if (rows == 0) {
+ return null;
+ }
+ partnerInfoList = partnerInfoService.selectPartnerInfoList(queryPartnerInfo);
+ partnerInfo = partnerInfoList.get(0);
+ } else {
+ partnerInfo = partnerInfoList.get(0);
+ }
+ projectInfo.setPartnerCode(partnerInfo.getPartnerCode());
+ projectInfo.setPartnerName(partnerInfo.getPartnerName());
+ projectInfo.setPartnerUserName(partnerInfo.getContactPerson());
+ projectInfo.setContactWay(partnerInfo.getContactPhone());
+ }
+ //处理项目信息
+ ProjectInfo oldProjectInfo = null;
+ if (StringUtils.isNotEmpty(projectInfo.getProjectCode())) {
+ ProjectInfo queryProjectInfo = new ProjectInfo();
+ queryProjectInfo.setProjectCode(projectInfo.getProjectCode());
+ List projectInfoList = projectInfoMapper.selectProjectInfoList(queryProjectInfo);
+ if (CollectionUtils.isNotEmpty(projectInfoList)) {
+ oldProjectInfo = projectInfoList.get(0);
+ }
+ }
+ int rows = 0;
+ //不存在的项目走新增流程,已存在的项目走修改流程
+ if (null == oldProjectInfo) {
+ rows = this.insertProjectInfo(projectInfo, true);
+ } else {
+ projectInfo.setId(oldProjectInfo.getId());
+ rows = this.updateProjectInfo(projectInfo, true);
+ }
+ if (rows > 0) {
+ return projectInfo;
+ }
+ return null;
+ }
+
}
diff --git a/ruoyi-sip/src/main/resources/mapper/sip/ProjectInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/sip/ProjectInfoMapper.xml
index 31435bf0..45bdb342 100644
--- a/ruoyi-sip/src/main/resources/mapper/sip/ProjectInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/sip/ProjectInfoMapper.xml
@@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
@@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- select id, project_code, project_name,bg_property, customer_code, customer_name, industry_type, agent_code, project_stage, project_grasp_degree, hz_support_user, operate_institution
+ select id, project_code, project_name,bg_property, customer_code, customer_name, industry_type, agent_code, project_stage, construction_type, project_grasp_degree, hz_support_user, operate_institution
, partner_code, partner_name, contact_way, estimated_amount, currency_type, estimated_order_time, estimated_deliver_time, competitor, country_product, server_configuration,file_id
, key_problem, project_desc, create_by, create_time, update_by, update_time,customer_user_name,customer_phone,partner_email,partner_user_name,h3c_person,h3c_phone,poc,joint_trial,software_info,hardware_info,terminal_peripheral,management_version,desktop_vm_os_version,vm_spec_quantity,joint_trial_result,quotation_id from project_info t1
@@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.industry_type,
t1.agent_code,
t1.project_stage,
+ t1.construction_type,
t1.project_grasp_degree,
t1.hz_support_user,
t1.operate_institution,
@@ -141,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and find_in_set(t1.project_stage , #{projectStage})
+ and t1.construction_type = #{constructionType}
and t1.project_grasp_degree = #{projectGraspDegree}
and t1.hz_support_user = #{hzSupportUser}
and t3.user_name like concat('%', #{hzSupportUserName}, '%')
@@ -261,6 +264,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.industry_type,
t1.agent_code,
t1.project_stage,
+ t1.construction_type,
t1.project_grasp_degree,
t1.hz_support_user,
t1.operate_institution,
@@ -333,6 +337,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bg_property,
agent_code,
project_stage,
+ construction_type,
project_grasp_degree,
hz_support_user,
operate_institution,
@@ -378,6 +383,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{bgProperty},
#{agentCode},
#{projectStage},
+ #{constructionType},
#{projectGraspDegree},
#{hzSupportUser},
#{operateInstitution},
@@ -429,6 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
industry_type = #{industryType},
agent_code = #{agentCode},
project_stage = #{projectStage},
+ construction_type = #{constructionType},
project_grasp_degree = #{projectGraspDegree},
hz_support_user = #{hzSupportUser},
operate_institution = #{operateInstitution},
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
index 5469e4aa..8d6447f1 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
@@ -213,4 +213,6 @@ public interface ISysUserService
public int changeStatus(SysUser user);
List listByRoleId(String l);
+
+ List listByRoleName(String roleName);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index d0568f7d..57a9c0f3 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -571,4 +571,9 @@ public class SysUserServiceImpl implements ISysUserService
public List listByRoleId(String roleId) {
return userMapper.listUserByRoleId(roleId);
}
+
+ @Override
+ public List listByRoleName(String roleName) {
+ return userMapper.listUserByRoleName(roleName);
+ }
}