添加用户校验调整

余额调整bug修改
This commit is contained in:
hejiayang
2025-10-27 09:39:22 +08:00
parent 744017cec9
commit 783cccc9a9
2 changed files with 25 additions and 15 deletions
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description: 子员工信息表
@@ -106,14 +107,23 @@ public class CqBaseEmployeePayController extends JeecgController<CqBaseEmployee,
if(StringUtils.isBlank(sysUserSub.getRealname())){
return Result.error("用户名不能为空");
}
//家庭用户
if(StringUtils.isNotBlank(sysUserSub.getMainUserId()) && StringUtils.isBlank(sysUserSub.getMainUserRelation())){
return Result.error("与主账户关系不能为空");
}
//非正式员工
if(StringUtils.isBlank(sysUserSub.getMainUserId()) && StringUtils.isBlank(sysUserSub.getPhone())){
return Result.error("手机号不能为空");
if(StringUtils.isNotEmpty(sysUserSub.getWorkNo())){
//校验工号是否已存在
LambdaQueryWrapper<SysUserSub> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUserSub::getWorkNo, sysUserSub.getWorkNo());
List<SysUserSub> list = sysUserSubService.list(queryWrapper);
if(CollectionUtils.isNotEmpty(list)){
return Result.error("工号已存在" + list.stream().map(SysUserSub::getRealname).collect(Collectors.toList()));
}
}
// //家庭用户
// if(StringUtils.isNotBlank(sysUserSub.getMainUserId()) && StringUtils.isBlank(sysUserSub.getMainUserRelation())){
// return Result.error("与主账户关系不能为空");
// }
// //非正式员工
// if(StringUtils.isBlank(sysUserSub.getMainUserId()) && StringUtils.isBlank(sysUserSub.getPhone())){
// return Result.error("手机号不能为空");
// }
return cqBaseEmployeeService.saveEmpSub(sysUserSub);
}
@@ -92,37 +92,37 @@
<update id="changeBalanceAndIntegral">
UPDATE st_client_member_balance
<if test="status != null">
<set>
<trim prefix="SET" suffixOverrides=",">
<choose>
<!--余额补录影响累计余额-->
<when test="status == 1">
<if test="topUpBalance != null">
top_up_balance = top_up_balance + #{topUpBalance,jdbcType=DECIMAL},
top_up_total = top_up_total + #{topUpBalance,jdbcType=DECIMAL}
top_up_total = top_up_total + #{topUpBalance,jdbcType=DECIMAL},
</if>
<if test="rewardBalance != null">
reward_balance = reward_balance + #{rewardBalance,jdbcType=DECIMAL}
reward_balance = reward_balance + #{rewardBalance,jdbcType=DECIMAL},
</if>
<if test="integralBalance != null">
integral_balance = integral_balance + #{integralBalance,jdbcType=DECIMAL}
integral_balance = integral_balance + #{integralBalance,jdbcType=DECIMAL},
</if>
</when>
<!--扣减不影响累计余额-->
<when test="status == 2">
<if test="topUpBalance != null">
top_up_balance = top_up_balance - #{topUpBalance,jdbcType=DECIMAL}
top_up_balance = top_up_balance - #{topUpBalance,jdbcType=DECIMAL},
</if>
<if test="rewardBalance != null">
reward_balance = reward_balance - #{rewardBalance,jdbcType=DECIMAL}
reward_balance = reward_balance - #{rewardBalance,jdbcType=DECIMAL},
</if>
<if test="integralBalance != null">
integral_balance = integral_balance - #{integralBalance,jdbcType=DECIMAL}
integral_balance = integral_balance - #{integralBalance,jdbcType=DECIMAL},
</if>
</when>
</choose>
</set>
</trim>
</if>
WHERE id = #{id,jdbcType=INTEGER}
<!--扣减需要余额大于扣减数额-->