Commit 86f71daa by 杨卫

feat:1047852:我的事项,添加事项

1 parent 69f5fd73
package cn.com.glsx.dj.config.dubbo;
import cn.com.glsx.dj.peanalysis.remote.BiAnalyseBackgroundRemote;
import lombok.RequiredArgsConstructor;
import org.oreframework.boot.autoconfigure.dubbo.reference.ReferenceBuilderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* rpc pe analysis dubbo 配置
* @author yangwei
* @version 1.0
* @since 2025/12/22 17:17
*/
@Configuration
@RequiredArgsConstructor
public class PeAnalysisDubboConfig {
private final ReferenceBuilderFactory factory;
@Bean
public BiAnalyseBackgroundRemote biAnalyseBackgroundRemote(){
return factory
.builder(BiAnalyseBackgroundRemote.class)
.check(false)
.timeout(30000)
.build();
}
}
package cn.com.glsx.dj.controller;
import cn.com.glsx.dj.peanalysis.dto.analysis.MerchantBiMatterAddDTO;
import cn.com.glsx.dj.peanalysis.dto.analysis.MerchantBiMatterHandleDTO;
import cn.com.glsx.dj.peanalysis.enums.BiErrorEnum;
import cn.com.glsx.dj.peanalysis.remote.BiAnalyseBackgroundRemote;
import cn.com.glsx.dj.request.biAnalyse.MerchantBiMatterAddReq;
import cn.com.glsx.dj.request.biAnalyse.MerchantBiMatterHandleReq;
import cn.com.glsx.dj.response.LoginUserInfoResponse;
import cn.com.glsx.dj.util.CommonUtil;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.hutool.core.bean.BeanUtil;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.Optional;
/**
* BI事项处理控制器
* @author yangwei
* @version 1.0
* @since 2025/12/22 11:12
*/
@Slf4j
@Api("BI事项处理控制器")
@RequiredArgsConstructor
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class BiMatterController {
private final BiAnalyseBackgroundRemote biAnalyseBackgroundRemote;
@ApiOperation("bi事项管理-新增待跟进事项")
@ServiceMethod(method = "dj.api.pe.analysis.merchant.bi.matter.add", needInSession = NeedInSessionType.YES)
public RopResponse<Boolean> merchantBiMatterAdd(MerchantBiMatterAddReq request) {
try {
LoginUserInfoResponse loginUserDTO = Optional.ofNullable(CommonUtil.getLoginUserInfo())
.orElseThrow(() -> new RpcServiceException(BiErrorEnum.LOGIN_USER_NOT_EXIST));
MerchantBiMatterAddDTO merchantBiMatterAddDTO = BeanUtil.copyProperties(request, MerchantBiMatterAddDTO.class);
merchantBiMatterAddDTO.setCreator(loginUserDTO.getName());
merchantBiMatterAddDTO.setCreatorUnique(loginUserDTO.getUuid());
RpcResponse<Boolean> response = biAnalyseBackgroundRemote.merchantBiMatterAdd(merchantBiMatterAddDTO);
if (response.isFailed()) {
throw new RpcServiceException(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.info("dj.api.pe.analysis.merchant.bi.matter.add occur error!", e);
return RopResponse.error(e);
} catch (Exception e) {
log.info("dj.api.pe.analysis.merchant.bi.matter.add occur error!", e);
return RopResponse.result(DefaultErrorEnum.SERVICE_ERROR);
}
}
@ApiOperation("BI-事项管理处理")
@ServiceMethod(method = "dj.api.script.merchant.bi.matter.handle", needInSession = NeedInSessionType.YES)
public RopResponse<Boolean> merchantBiMatterHandle(MerchantBiMatterHandleReq request) {
try {
LoginUserInfoResponse loginUserDTO = Optional.ofNullable(CommonUtil.getLoginUserInfo())
.orElseThrow(() -> new RpcServiceException(BiErrorEnum.LOGIN_USER_NOT_EXIST));
String userName = loginUserDTO.getName();
String uuid = loginUserDTO.getUuid();
MerchantBiMatterHandleDTO merchantBiMatterHandleDTO = BeanUtil.copyProperties(request, MerchantBiMatterHandleDTO.class);
merchantBiMatterHandleDTO.setOperator(userName);
merchantBiMatterHandleDTO.setOperatorUniqueKey(uuid);
RpcResponse<Boolean> rpcResponse = biAnalyseBackgroundRemote.merchantBiMatterHandle(merchantBiMatterHandleDTO);
if (rpcResponse.isFailed()) {
throw new RpcServiceException(rpcResponse.getError(), rpcResponse.getMessage());
}
return RopResponse.success(rpcResponse.getResult());
} catch (RpcServiceException e) {
log.info("dj.api.script.merchant.bi.matter.handle occur error!", e);
return RopResponse.error(e);
} catch (Exception e) {
log.info("dj.api.script.merchant.bi.matter.handle occur error!", e);
return RopResponse.result(DefaultErrorEnum.SERVICE_ERROR);
}
}
}
package cn.com.glsx.dj.request.biAnalyse;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.io.Serializable;
import java.util.List;
/**
* 添加待处理事项
* @author yangwei
* @version 1.0
* @since 2025/12/22 11:16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "BI-添加待处理事项")
public class MerchantBiMatterAddReq extends AbstractRopRequest implements Serializable {
private static final long serialVersionUID = 336924771080593364L;
@ApiModelProperty(
name = "storeNo",
notes = "门店编号",
example = "金秋销售冲刺",
required = true
)
private String storeNo;
@ApiModelProperty(
name = "storeName",
notes = "门店名称",
example = "金秋销售冲刺",
required = true
)
private String storeName;
@ApiModelProperty(
name = "businessType",
notes = "bi侧业务类型,1.延保 2.轻改 3.权益 4.二手车",
example = "金秋销售冲刺",
required = true
)
private String businessType;
@ApiModelProperty(
name = "description",
notes = "事项描述",
example = "金秋销售冲刺",
required = true
)
private String description;
@ApiModelProperty(
name = "onlineOperator",
notes = "线上运营",
example = "金秋销售冲刺"
)
private List<OperatorReq> onlineOperator;
@ApiModelProperty(
name = "areaOperator",
notes = "区域运营",
example = "金秋销售冲刺"
)
private List<OperatorReq> areaOperator;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "BI-运营人员")
public static class OperatorReq implements Serializable {
private static final long serialVersionUID = -4455475523396000759L;
/**
* 员工uuid
*/
@ApiModelProperty(
name = "uuid",
notes = "员工uuid",
example = "12345"
)
private String uuid;
/**
* 运营人员名称
*/
@ApiModelProperty(
name = "username",
notes = "运营人员名称",
example = "人民"
)
private String username;
}
}
package cn.com.glsx.dj.request.biAnalyse;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* BI-事项管理处理请求对象
* @author yangwei
* @version 1.0
* @since 2025/12/12 14:32
*/
@Data
@ApiModel("BI-事项管理处理请求对象")
@EqualsAndHashCode(callSuper = true)
public class MerchantBiMatterHandleReq extends AbstractRopRequest implements Serializable {
private static final long serialVersionUID = 8189206294528780125L;
@ApiModelProperty(
name = "handlingStrategy",
notes = "处理策略",
example = "1",
required = true
)
private String handlingStrategy;
@ApiModelProperty(
name = "id",
notes = "主键id",
example = "1",
required = true
)
private Long id;
}
package cn.com.glsx.dj.controller;
import org.junit.Test;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* @author yangwei
* @version 1.0
* @since 2025/12/22 14:52
*/
public class BiMatterControllerTest extends BaseControllerTest {
@Test
public void merchantBiMatterAddTest() throws Exception {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
params.add("v", "1.0.0");
params.add("method", "dj.api.pe.analysis.merchant.bi.matter.add");
params.add("storeNo", "44211668");
params.add("storeName", "明明长岭4s店B222");
params.add("businessType", "1");
params.add("description", "当个事做,上报联合国");
params.add("onlineOperator[0].uuid", "8104840424a0455db573c5fb84ab7383");
params.add("onlineOperator[0].username", "区域督导天天");
params.add("onlineOperator[0].uuid", "17f70bc28c8f40ef9c260d05dbe28787");
params.add("onlineOperator[0].username", "陈希");
params.add("areaOperator[0].uuid", "c359e4838e2547aaa140d9a67ec0b165");
params.add("areaOperator[0].username", "狗蛋");
params.add("sessionId", "9551b3d6-4486-45ee-9141-ee91f3de604b");
System.out.println(post(params));
}
@Test
public void testMerchantBiMatterHandle() throws Exception {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
params.add("v", "1.0.0");
params.add("method", "dj.api.script.merchant.bi.matter.handle");
params.add("id", "2");
params.add("handlingStrategy", "giaogiaogiaogiao,hahahaha,nika lufu");
params.add("sessionId", "6daef60d-58aa-4503-a4b8-d7d55785f452");
System.out.println(post(params));
}
}
\ No newline at end of file \ No newline at end of file
  • @wangxw1
    commented
    Master

    Auto Review Result:

    代码审查报告

    问题描述和优化建议

    PeAnalysisDubboConfig.java

    1. 功能实现的正确性与健壮性:

      • check(false):在生产环境中禁用检查可能会导致潜在的问题未被及时发现。建议在生产环境中启用检查,或者通过配置文件控制此行为。
      • timeout(30000):超时时间设置为30秒,需要根据实际业务场景调整,确保不会因为超时导致用户体验不佳。
    2. 安全性与潜在风险:

      • 无明显安全问题,但需确保ReferenceBuilderFactory的实现是安全的,没有已知的安全漏洞。
    3. 是否符合最佳实践:

      • 类命名和方法命名清晰,符合Java命名规范。
      • 使用了@RequiredArgsConstructor简化构造函数的编写,符合最佳实践。
      • 注释详细,有助于理解代码的功能。
    4. 性能与资源利用效率:

      • 无明显的性能问题,但需监控实际运行中的性能表现,确保满足业务需求。
    5. Commits信息的清晰性与准确性:

      • 提交信息不够详细,建议增加更多关于代码变更的具体内容,例如解决了哪些问题,实现了哪些功能。

    BiMatterController.java

    1. 功能实现的正确性与健壮性:

      • CommonUtil.getLoginUserInfo():如果CommonUtil.getLoginUserInfo()返回null,则会抛出RpcServiceException,这种处理方式合理,但需确保CommonUtil.getLoginUserInfo()在所有情况下都能正常工作。
      • 异常处理:捕获了RpcServiceException和其他异常,但日志级别应改为error而不是info,以便更容易地发现和解决问题。
    2. 安全性与潜在风险:

      • 没有明显的安全问题,但需确保biAnalyseBackgroundRemote的远程调用是安全的,防止潜在的中间人攻击或其他安全威胁。
    3. 是否符合最佳实践:

      • 类命名和方法命名清晰,符合Java命名规范。
      • 使用了@RequiredArgsConstructor简化构造函数的编写,符合最佳实践。
      • 注释详细,有助于理解代码的功能。
    4. 性能与资源利用效率:

      • 无明显的性能问题,但需监控实际运行中的性能表现,确保满足业务需求。
    5. Commits信息的清晰性与准确性:

      • 提交信息不够详细,建议增加更多关于代码变更的具体内容,例如解决了哪些问题,实现了哪些功能。

    MerchantBiMatterAddReq.java 和 MerchantBiMatterHandleReq.java

    1. 功能实现的正确性与健壮性:

      • 无明显问题,但需确保所有字段的验证逻辑在其他地方已经实现,避免数据不一致。
    2. 安全性与潜在风险:

      • 没有明显的安全问题,但需确保字段值的有效性和合法性,防止恶意输入。
    3. 是否符合最佳实践:

      • 类命名和字段命名清晰,符合Java命名规范。
      • 使用了@Data和@Builder等Lombok注解,简化了代码,符合最佳实践。
      • 注释详细,有助于理解代码的功能。
    4. 性能与资源利用效率:

      • 无明显的性能问题,但需监控实际运行中的性能表现,确保满足业务需求。
    5. Commits信息的清晰性与准确性:

      • 提交信息不够详细,建议增加更多关于代码变更的具体内容,例如解决了哪些问题,实现了哪些功能。

    BiMatterControllerTest.java

    1. 功能实现的正确性与健壮性:

      • 测试用例覆盖了基本的增删改查操作,但可以增加更多的边界条件测试,例如空值测试、异常测试等。
    2. 安全性与潜在风险:

      • 无明显安全问题,但需确保测试环境的安全性,防止敏感信息泄露。
    3. 是否符合最佳实践:

      • 测试类命名和方法命名清晰,符合Java命名规范。
      • 测试用例简单明了,符合最佳实践。
      • 注释较少,但考虑到是测试代码,可以适当减少注释。
    4. 性能与资源利用效率:

      • 无明显的性能问题,但需监控实际运行中的性能表现,确保满足业务需求。
    5. Commits信息的清晰性与准确性:

      • 提交信息不够详细,建议增加更多关于代码变更的具体内容,例如解决了哪些问题,实现了哪些功能。

    评分明细

    1. 功能实现的正确性与健壮性:36/40 分
    2. 安全性与潜在风险:28/30 分
    3. 是否符合最佳实践:18/20 分
    4. 性能与资源利用效率:5/5 分
    5. Commits信息的清晰性与准确性:3/5 分

    总分:90分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!