Commit 4aecbc43 by 叶立庆

Merge branch 'v5.6.4' into 'master'

上线合并

See merge request !2
2 parents da276aa5 fa23bf3d
Showing 17 changed files with 168 additions and 10 deletions
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
</parent> </parent>
<groupId>cn.com.glsx.scrm</groupId> <groupId>cn.com.glsx.scrm</groupId>
<artifactId>rpc-scrm-shopmall-api</artifactId> <artifactId>rpc-scrm-shopmall-api</artifactId>
<version>5.5.0-SNAPSHOT</version> <version>${shopmall.api.version}</version>
<name>rpc-scrm-shopmall-api</name> <name>rpc-scrm-shopmall-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.shopmall.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.shopmall.remote</deploy.scanPackage>
<shopmall.api.version>5.6.4-SNAPSHOT</shopmall.api.version>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.stoassistant</groupId> <groupId>cn.com.glsx.stoassistant</groupId>
<artifactId>rpc-scrm-stoassistant-api</artifactId> <artifactId>rpc-scrm-stoassistant-api</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>${stoassistant.api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
......
...@@ -28,4 +28,7 @@ public class IntegralTransferOutOperationDTO extends IntegralTransferOutOperatio ...@@ -28,4 +28,7 @@ public class IntegralTransferOutOperationDTO extends IntegralTransferOutOperatio
@ApiModelProperty(notes = "代征主体编码") @ApiModelProperty(notes = "代征主体编码")
private String levyCode; private String levyCode;
@ApiModelProperty(notes = "银行通道编码")
private String levyChannelCode;
} }
package cn.com.glsx.scrm.shopmall.dto.integral.motivation; package cn.com.glsx.scrm.shopmall.dto.integral.motivation;
import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationAuditSourceEnum; import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationAuditSourceEnum;
import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationGenerateTypeEnum;
import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivation; import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivation;
import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation; import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation;
import cn.com.glsx.stoassistant.enums.ScoreInfoNameEnum; import cn.com.glsx.stoassistant.enums.ScoreInfoNameEnum;
...@@ -50,8 +51,13 @@ public class ShopmallStaffMotivationDTO extends ShopmallStaffMotivation implemen ...@@ -50,8 +51,13 @@ public class ShopmallStaffMotivationDTO extends ShopmallStaffMotivation implemen
*/ */
private boolean containDeleted; private boolean containDeleted;
/**
* @see StaffMotivationGenerateTypeEnum
*/
@ApiModelProperty(notes = "生成方式, 默认0 手动抵扣1") @ApiModelProperty(notes = "生成方式, 默认0 手动抵扣1")
private Integer generateType = 0; private Integer generateType;
private List<Integer> generateTypeList;
/** /**
* 审批来源 * 审批来源
......
package cn.com.glsx.scrm.shopmall.dto.integral.motivation;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString(callSuper = true)
public class ShopmallStaffScoreChangeDTO implements Serializable {
@ApiModelProperty(notes = "源员工id")
private Integer sourceStaffId;
@ApiModelProperty(notes = "目标员工id")
private Integer targetStaffId;
@ApiModelProperty(notes = "源员工手机号")
private String sourceStaffPhone;
@ApiModelProperty(notes = "目标员工手机号")
private String targetStaffPhone;
@ApiModelProperty(notes = "源门店号")
private Integer sourceMerchantId;
@ApiModelProperty(notes = "目标门店号")
private Integer targetMerchantId;
@ApiModelProperty(notes = "操作时间")
private Date operateTime;
@ApiModelProperty(notes = "操作人")
private String operator;
@ApiModelProperty(notes = "操作备注")
private String remark;
}
package cn.com.glsx.scrm.shopmall.enums.integral;
import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Objects;
@Getter
@Slf4j
public enum StaffMotivationGenerateTypeEnum {
UNKNOWN(-1, "未知"),
//0待审批、1已审批、2已失效
ORDER(0, "订单收益(系统默认)"),
MANUAL_DEDUCT(1, "手动抵扣/撤销抵扣"),
MANUAL_OPERATE(2, "手动增加/手动扣减"),
;
private final Integer value;
private final String name;
StaffMotivationGenerateTypeEnum(Integer value, String name) {
this.value = value;
this.name = name;
}
public static StaffMotivationGenerateTypeEnum getByValue(Integer value) {
for (StaffMotivationGenerateTypeEnum temp : StaffMotivationGenerateTypeEnum.values()) {
if (Objects.equals(temp.getValue(), value)) {
return temp;
}
}
return UNKNOWN;
}
public static List<Integer> getPageTypes() {
return Lists.newArrayList(ORDER.value, MANUAL_OPERATE.value);
}
}
...@@ -18,6 +18,8 @@ public enum StaffMotivationStatusEnum { ...@@ -18,6 +18,8 @@ public enum StaffMotivationStatusEnum {
FAILURE(2, "已失效"), FAILURE(2, "已失效"),
REJECT(3, "已驳回"),
; ;
private Integer value; private Integer value;
...@@ -63,10 +65,11 @@ public enum StaffMotivationStatusEnum { ...@@ -63,10 +65,11 @@ public enum StaffMotivationStatusEnum {
public List<StaffMotivationStatusEnum> nextStatus() { public List<StaffMotivationStatusEnum> nextStatus() {
switch (this){ switch (this){
case READY_AUDIT: case READY_AUDIT:
return Lists.newArrayList(COMPLETE_AUDIT, FAILURE); return Lists.newArrayList(COMPLETE_AUDIT, FAILURE, REJECT);
case COMPLETE_AUDIT: case COMPLETE_AUDIT:
return Lists.newArrayList(FAILURE); return Lists.newArrayList(FAILURE);
case FAILURE: case FAILURE:
case REJECT:
break; break;
} }
return Lists.newArrayList(); return Lists.newArrayList();
......
...@@ -49,9 +49,13 @@ public class ShopmallStaffMotivationOperation implements Serializable { ...@@ -49,9 +49,13 @@ public class ShopmallStaffMotivationOperation implements Serializable {
/** /**
* 备注 * 备注
*/ */
@ApiModelProperty(notes = "备注") @ApiModelProperty(notes = "系统备注")
private String remark; private String remark;
@Column(name = "operate_remark")
@ApiModelProperty(notes = "操作备注")
private String operateRemark;
/** /**
* 操作时间 * 操作时间
*/ */
......
...@@ -8,6 +8,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination; ...@@ -8,6 +8,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationDTO; import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationDTO;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationOrderScoreDTO; import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationOrderScoreDTO;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffScoreChangeDTO;
import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationStatusEnum; import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationStatusEnum;
import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation; import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation;
...@@ -57,4 +58,7 @@ public interface StaffMotivationRemote { ...@@ -57,4 +58,7 @@ public interface StaffMotivationRemote {
@ApiMethod("查询指定订单的操作记录") @ApiMethod("查询指定订单的操作记录")
RpcResponse<List<ShopmallStaffMotivationOperation>> getOrderOperation(ShopmallStaffMotivationDTO req); RpcResponse<List<ShopmallStaffMotivationOperation>> getOrderOperation(ShopmallStaffMotivationDTO req);
@ApiMethod("变更手机号(积分迁移)")
RpcResponse<Boolean> changeStaffScore(ShopmallStaffScoreChangeDTO dto);
} }
...@@ -10,11 +10,19 @@ ...@@ -10,11 +10,19 @@
<version>4.56.0-SNAPSHOT</version> <version>4.56.0-SNAPSHOT</version>
<name>rpc-scrm-shopmall</name> <name>rpc-scrm-shopmall</name>
<packaging>war</packaging> <packaging>war</packaging>
<properties>
<stoassistant.api.version>5.6.4-SNAPSHOT</stoassistant.api.version>
<shopmall.api.version>5.6.4-SNAPSHOT</shopmall.api.version>
<smartcarlife.api.version>5.6.4-SNAPSHOT</smartcarlife.api.version>
<platform-payment.api.version>5.6.4-SNAPSHOT</platform-payment.api.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.com.glsx.scrm</groupId> <groupId>cn.com.glsx.scrm</groupId>
<artifactId>rpc-scrm-shopmall-api</artifactId> <artifactId>rpc-scrm-shopmall-api</artifactId>
<version>5.5.0-SNAPSHOT</version> <version>${shopmall.api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx.scrm.taskcenter</groupId> <groupId>cn.com.glsx.scrm.taskcenter</groupId>
...@@ -28,7 +36,7 @@ ...@@ -28,7 +36,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.stoassistant</groupId> <groupId>cn.com.glsx.stoassistant</groupId>
<artifactId>rpc-scrm-stoassistant-api</artifactId> <artifactId>rpc-scrm-stoassistant-api</artifactId>
<version>5.0.0-SNAPSHOT</version> <version>${stoassistant.api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
...@@ -38,7 +46,7 @@ ...@@ -38,7 +46,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
<artifactId>rpc-dj-smartcarlife-api</artifactId> <artifactId>rpc-dj-smartcarlife-api</artifactId>
<version>5.5.5-SNAPSHOT</version> <version>${smartcarlife.api.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>rpc-scrm-shopmall-api</artifactId> <artifactId>rpc-scrm-shopmall-api</artifactId>
...@@ -173,7 +181,7 @@ ...@@ -173,7 +181,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
<artifactId>platform-payment-api</artifactId> <artifactId>platform-payment-api</artifactId>
<version>5.5.0-SNAPSHOT</version> <version>${platform-payment.api.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -5,6 +5,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse; ...@@ -5,6 +5,7 @@ import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationDTO; import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationDTO;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationOrderScoreDTO; import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffMotivationOrderScoreDTO;
import cn.com.glsx.scrm.shopmall.dto.integral.motivation.ShopmallStaffScoreChangeDTO;
import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationStatusEnum; import cn.com.glsx.scrm.shopmall.enums.integral.StaffMotivationStatusEnum;
import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation; import cn.com.glsx.scrm.shopmall.model.ShopmallStaffMotivationOperation;
import cn.com.glsx.scrm.shopmall.service.integral.StaffMotivationService; import cn.com.glsx.scrm.shopmall.service.integral.StaffMotivationService;
...@@ -122,4 +123,14 @@ public class StaffMotivationRemoteImpl implements StaffMotivationRemote { ...@@ -122,4 +123,14 @@ public class StaffMotivationRemoteImpl implements StaffMotivationRemote {
return RpcResponse.error(e); return RpcResponse.error(e);
} }
} }
@Override
public RpcResponse<Boolean> changeStaffScore(ShopmallStaffScoreChangeDTO dto) {
try {
return RpcResponse.success(staffMotivationService.changeStaffScore(dto));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
} }
...@@ -447,6 +447,7 @@ public class IntegralTransferOutService { ...@@ -447,6 +447,7 @@ public class IntegralTransferOutService {
listReq.setChannelProvider(null); listReq.setChannelProvider(null);
listReq.setPaymentEntityCode(null); listReq.setPaymentEntityCode(null);
listReq.setLevyCode(null); listReq.setLevyCode(null);
listReq.setLevyChannelCode(null);
List<IntegralTransferOutDTO> list = integralTransferOutMapper.list(listReq); List<IntegralTransferOutDTO> list = integralTransferOutMapper.list(listReq);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
throw new RpcServiceException("没有符合记录的提现记录"); throw new RpcServiceException("没有符合记录的提现记录");
...@@ -466,6 +467,7 @@ public class IntegralTransferOutService { ...@@ -466,6 +467,7 @@ public class IntegralTransferOutService {
operationDTO.setChannelProvider(request.getPayChannelProvider()); operationDTO.setChannelProvider(request.getPayChannelProvider());
operationDTO.setPaymentEntityCode(request.getPaymentEntityCode()); operationDTO.setPaymentEntityCode(request.getPaymentEntityCode());
operationDTO.setLevyCode(request.getLevyCode()); operationDTO.setLevyCode(request.getLevyCode());
operationDTO.setLevyChannelCode(request.getLevyChannelCode());
return thiz.batchPay(operationDTO); return thiz.batchPay(operationDTO);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -797,9 +799,11 @@ public class IntegralTransferOutService { ...@@ -797,9 +799,11 @@ public class IntegralTransferOutService {
.channelProvider(request.getChannelProvider()) .channelProvider(request.getChannelProvider())
.paymentEntityCode(request.getPaymentEntityCode()) .paymentEntityCode(request.getPaymentEntityCode())
.levyCode(request.getLevyCode()) .levyCode(request.getLevyCode())
.levyChannelCode(request.getLevyChannelCode())
.build() .build()
); );
Long allPayAmount = list.stream().mapToLong(IntegralTransferOut::getPayAmount).sum(); Long allPayAmount = list.stream().mapToLong(IntegralTransferOut::getPayAmount).sum();
log.info("账户余额:{}, 批次总金额:{}", balance, allPayAmount);
if (balance < allPayAmount) { if (balance < allPayAmount) {
throw new RpcServiceException("账户余额不足,请确认后重新操作"); throw new RpcServiceException("账户余额不足,请确认后重新操作");
} }
...@@ -851,6 +855,7 @@ public class IntegralTransferOutService { ...@@ -851,6 +855,7 @@ public class IntegralTransferOutService {
.channel(request.getChannel()) .channel(request.getChannel())
.paymentEntityCode(request.getPaymentEntityCode()) .paymentEntityCode(request.getPaymentEntityCode())
.levyCode(request.getLevyCode()) .levyCode(request.getLevyCode())
.levyChannelCode(request.getLevyChannelCode())
.build(); .build();
IntegralChannelAccountDTO detail = integralChannelAccountMapper.getOne(req); IntegralChannelAccountDTO detail = integralChannelAccountMapper.getOne(req);
if (detail == null) { if (detail == null) {
......
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
<if test="levyCode != null and levyCode != ''"> <if test="levyCode != null and levyCode != ''">
and ca.levy_code = #{levyCode} and ca.levy_code = #{levyCode}
</if> </if>
<if test="levyChannelCode != null and levyChannelCode != ''">
and ca.levy_channel_code = #{levyChannelCode}
</if>
</where> </where>
</select> </select>
...@@ -90,6 +93,9 @@ ...@@ -90,6 +93,9 @@
<if test="levyCode != null and levyCode != ''"> <if test="levyCode != null and levyCode != ''">
and ca.levy_code = #{levyCode} and ca.levy_code = #{levyCode}
</if> </if>
<if test="levyChannelCode != null and levyChannelCode != ''">
and ca.levy_channel_code = #{levyChannelCode}
</if>
</where> </where>
order by ca.id desc order by ca.id desc
limit 1 limit 1
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
<resultMap id="TreeLevyDTOResult" type="cn.com.glsx.scrm.shopmall.dto.integral.IntegralTransferChannelConfigTreeDTO"> <resultMap id="TreeLevyDTOResult" type="cn.com.glsx.scrm.shopmall.dto.integral.IntegralTransferChannelConfigTreeDTO">
<result column="levy_code" property="code" jdbcType="VARCHAR" /> <result column="levy_code" property="code" jdbcType="VARCHAR" />
<result column="levy_name" property="name" jdbcType="VARCHAR" /> <result column="levy_name" property="name" jdbcType="VARCHAR" />
<collection property="child" resultMap="TreeLevyChannelDTOResult"/>
</resultMap>
<resultMap id="TreeLevyChannelDTOResult" type="cn.com.glsx.scrm.shopmall.dto.integral.IntegralTransferChannelConfigTreeDTO">
<result column="levy_channel_code" property="code" jdbcType="VARCHAR" />
<result column="levy_channel_name" property="name" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
<!-- <!--
......
...@@ -141,6 +141,9 @@ ...@@ -141,6 +141,9 @@
<if test="levyCode != null and levyCode != ''"> <if test="levyCode != null and levyCode != ''">
and levy_code = #{levyCode} and levy_code = #{levyCode}
</if> </if>
<if test="levyChannelCode != null and levyChannelCode != ''">
and levy_channel_code = #{levyChannelCode}
</if>
<if test="approvalId != null"> <if test="approvalId != null">
and approval_id = #{approvalId} and approval_id = #{approvalId}
</if> </if>
......
...@@ -72,6 +72,12 @@ ...@@ -72,6 +72,12 @@
<if test="generateType != null"> <if test="generateType != null">
and sm.generate_type = #{generateType} and sm.generate_type = #{generateType}
</if> </if>
<if test="generateTypeList != null and generateTypeList.size() > 0">
and sm.generate_type in
<foreach collection="generateTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="merchantId != null"> <if test="merchantId != null">
and sm.merchant_id = #{merchantId} and sm.merchant_id = #{merchantId}
</if> </if>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<result column="result" property="result" jdbcType="INTEGER" /> <result column="result" property="result" jdbcType="INTEGER" />
<result column="remark" property="remark" jdbcType="VARCHAR" /> <result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="operate_time" property="operateTime" jdbcType="TIMESTAMP" /> <result column="operate_time" property="operateTime" jdbcType="TIMESTAMP" />
<result column="operate_remark" property="operateRemark" jdbcType="VARCHAR" />
<result column="operator" property="operator" jdbcType="VARCHAR" /> <result column="operator" property="operator" jdbcType="VARCHAR" />
<result column="operator_id" property="operatorId" jdbcType="VARCHAR" /> <result column="operator_id" property="operatorId" jdbcType="VARCHAR" />
<result column="operator_phone" property="operatorPhone" jdbcType="VARCHAR" /> <result column="operator_phone" property="operatorPhone" jdbcType="VARCHAR" />
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
--> -->
id, staff_motivation_id, type, result, remark, operate_time, operator, created_time, operator_id, operator_phone id, staff_motivation_id, type, result, remark, operate_time, operate_remark, operator, created_time, operator_id, operator_phone,
created_by, updated_time, updated_by, deleted_flag created_by, updated_time, updated_by, deleted_flag
</sql> </sql>
<sql id="Prefix_Column_List" > <sql id="Prefix_Column_List" >
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
${prefix}.result as ${prefix}_result, ${prefix}.result as ${prefix}_result,
${prefix}.remark as ${prefix}_remark, ${prefix}.remark as ${prefix}_remark,
${prefix}.operate_time as ${prefix}_operate_time, ${prefix}.operate_time as ${prefix}_operate_time,
${prefix}.operate_remark as ${prefix}_operate_remark,
${prefix}.operator as ${prefix}_operator, ${prefix}.operator as ${prefix}_operator,
${prefix}.operator_id as ${prefix}_operator_id, ${prefix}.operator_id as ${prefix}_operator_id,
${prefix}.operator_phone as ${prefix}_operator_phone, ${prefix}.operator_phone as ${prefix}_operator_phone,
......
  • @wangxw1
    commented
    Owner

    你好,我是资深 Java 开发工程师。我已对提供的代码变更进行了详细审查。以下是针对功能正确性、数据一致性及性能方面的核心问题分析与评分。


    一、关键问题与优化建议(Top 3)

    1. 严重的功能缺失:changeStaffScore 方法为空实现

    • 问题所在:文件 rpc-scrm-shopmall/src/main/java/cn/com/glsx/scrm/shopmall/service/integral/StaffMotivationService.java 第 798 行。
    • 问题描述:方法 changeStaffScore 的实现仅包含一条注释并直接返回 true,没有任何实际逻辑。
      • 尽管注释提到“审批记录作为快照数据理应不变”,但该方法的命名(变更/迁移积分)及 Commit 信息(“实现员工积分手机号变更及迁移功能”)均暗示应包含积分资产的迁移或关联关系的更新。
      • 目前的实现导致 StaffMotivationRemote.changeStaffScore 接口实际上是一个空壳,调用方会误以为操作成功,但并未产生任何业务影响。
    • 优化建议:
      • 如果该业务确实不需要迁移审批记录,应检查是否需要迁移用户的“当前积分余额”(通常在 MerchantStaffScore 表)。
      • 如果确实无需任何操作,应在接口文档或方法名中明确标注(如 checkMigrationEligibility),或者删除该无用接口,避免误导调用方。

    2. 严重的数据一致性风险:事务提交后执行积分入账 (afterCommit)

    • 问题所在:文件 rpc-scrm-shopmall/src/main/java/cn/com/glsx/scrm/shopmall/service/integral/StaffMotivationService.java 第 602-609 行。
    • 问题描述:代码使用了 TransactionSynchronizationManager.registerSynchronization(...).afterCommit() 来执行 insertStaffScore(积分入账)。
      • 风险:afterCommit 是在数据库事务提交之后执行的。如果 insertStaffScore(通常涉及 RPC 调用或另一张表的写入)执行失败(如网络超时、服务不可用),主事务中的“审批状态”已经更新为“审核通过”并提交。
      • 后果:系统显示审批已通过,但用户实际未收到积分。这将导致严重的数据不一致和客诉。
    • 优化建议:
      • 方案 A(强一致性):将 insertStaffScore 移回主事务内部执行。如果积分入账失败,回滚审批状态。
      • 方案 B(最终一致性):如果必须异步,应使用可靠的消息队列(MQ)发送积分发放消息,并确保消息发送在本地事务中(本地消息表模式),或者保留当前的 afterCommit 但必须增加重试机制/补偿任务(Job)来修复未成功入账的记录。

    3. 性能问题:循环内的分布式锁与事务嵌套

    • 问题所在:文件 rpc-scrm-shopmall/src/main/java/cn/com/glsx/scrm/shopmall/service/integral/StaffMotivationService.java 第 568 行。
    • 问题描述:批量审核接口 audit(requestDTO) 内部使用 forEach 循环遍历待审核列表,并在循环体内调用 thiz.audit(requestDTO, p)。
      • thiz.audit 带有 @GlsxDistributeLockable(分布式锁)。
      • 内部又调用 auditWithTransaction 带有 @Transactional(数据库事务)。
      • 后果:如果批量审核 50 条记录,将触发 50 次分布式锁获取/释放请求和 50 个独立的数据库事务。这会显著增加网络开销和数据库连接占用,降低系统吞吐量。
    • 优化建议:
      • 批量处理:建议重构为批量处理逻辑。先一次性获取所需的所有锁(或调整锁粒度),然后在一个事务中批量更新所有记录的状态,最后批量处理积分入账。
      • 或者,如果必须保持单条隔离,应限制批量操作的大小,防止长循环阻塞系统资源。

    二、评分明细

    维度 评分 扣分理由
    功能正确性 (40分) 20 changeStaffScore 核心功能未实现,属于重大逻辑缺失;手动调整积分逻辑存在隐患。
    安全性 (30分) 20 积分入账逻辑在事务提交后执行,存在极高的数据不一致风险(用户没收到钱但显示已发)。
    可维护性 (20分) 15 存在 N+1 式的循环事务调用;代码中存在硬编码(如 44210895);使用了 thiz 这种非标准的自调用写法(虽然为了 AOP 生效,但建议使用 AopContext 或注入自身)。
    性能 (5分) 3 批量审核接口的循环加锁与事务提交方式效率低下。
    提交信息 (5分) 5 提交信息规范、清晰,能够准确描述变更内容。

    总分:63分

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