feat:增加商户配置

This commit is contained in:
dzc committed 2025-03-10 14:58:21 +08:00
1 parent 4dd31f6734
commit ea6f324092
6 files changed
+134 -122

No files matched your search

+18 -18
View File
@@ -7,24 +7,24 @@ create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_
DROP TABLE IF EXISTS `mch_manage`;
CREATE TABLE mch_manage
(
id bigint NOT NULL COMMENT '主键',
dept_id bigint NOT NULL COMMENT '绑定的部门id',
hard_group_id bigint COMMENT '设备分组id',
name varchar(64) NOT NULL COMMENT '商户名',
types varchar(64) NOT NULL COMMENT '店铺类型,逗号分隔',
logo_pic varchar(256) NOT NULL COMMENT '商户logo图片',
collection_code varchar(256) DEFAULT '' COMMENT '商户收款码,自动生成',
swiper_pic text DEFAULT NULL COMMENT '商户轮播图,逗号分隔',
phone varchar(128) DEFAULT '' COMMENT '商户手机号',
job_start_time time DEFAULT NULL COMMENT '商户开始营业时间',
job_end_time time DEFAULT NULL COMMENT '商户结束营业时间',
address_des varchar(256) DEFAULT NULL COMMENT '商户地址',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
id bigint NOT NULL COMMENT '主键',
dept_id bigint NOT NULL COMMENT '绑定的部门id',
default_wallet_type_id bigint DEFAULT NULL COMMENT '商户默认使用的钱包类型',
hard_group_id bigint COMMENT '设备分组id',
name varchar(64) NOT NULL COMMENT '商户名',
types varchar(64) NOT NULL COMMENT '店铺类型,逗号分隔',
logo_pic varchar(256) NOT NULL COMMENT '商户logo图片',
collection_code varchar(256) DEFAULT '' COMMENT '商户收款码,自动生成',
swiper_pic text DEFAULT NULL COMMENT '商户轮播图,逗号分隔',
phone varchar(128) DEFAULT '' COMMENT '商户手机号',
job_time varchar(256) DEFAULT NULL COMMENT '商户营业时间',
address_des varchar(256) DEFAULT NULL COMMENT '商户地址',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
@@ -10,8 +10,6 @@ import com.bsd.pjcloud.admin.api.entity.SysUserFaceEntity;
import com.bsd.pjcloud.admin.api.vo.SysUserFaceVo;
import com.bsd.pjcloud.admin.service.SysUserFaceService;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
@@ -8,6 +8,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -25,114 +26,113 @@ import java.time.LocalTime;
public class MchManageEntity extends Model<MchManageEntity> {
/**
* 主键
*/
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
@Schema(description = "主键")
private Long id;
/**
* 绑定的部门id - 商户的部门id
*/
@Schema(description="商户的部门id")
/**
* 绑定的部门id - 商户的部门id
*/
@Schema(description = "商户的部门id")
private Long deptId;
/**
* 商户名
*/
@Schema(description="商户名")
/**
* 默认使用的钱包类型
*/
@Schema(description = "默认使用的钱包类型")
private Long defaultWalletTypeId;
/**
* 商户名
*/
@Schema(description = "商户名")
private String name;
/**
* 店铺类型,逗号分隔
*/
@Schema(description="店铺类型,逗号分隔")
/**
* 店铺类型,逗号分隔
*/
@Schema(description = "店铺类型,逗号分隔")
private String types;
/**
* 商户logo图片
*/
@Schema(description="商户logo图片")
/**
* 商户logo图片
*/
@Schema(description = "商户logo图片")
private String logoPic;
/**
* 商户收款码,自动生成
*/
@Schema(description="商户收款码,自动生成")
/**
* 商户收款码,自动生成
*/
@Schema(description = "商户收款码,自动生成")
private String collectionCode;
/**
* 商户轮播图,逗号分隔
*/
@Schema(description="商户轮播图,逗号分隔")
/**
* 商户轮播图,逗号分隔
*/
@Schema(description = "商户轮播图,逗号分隔")
private String swiperPic;
/**
* 商户手机号
*/
@Schema(description="商户手机号")
/**
* 商户手机号
*/
@Schema(description = "商户手机号")
private String phone;
/**
* 商户开始营业时间
*/
@Schema(description="商户开始营业时间")
@JsonFormat(pattern = DatePattern.NORM_TIME_PATTERN)
private LocalTime jobStartTime;
/**
* 商户营业时间
*/
@Schema(description = "商户营业时间")
private String jobTime;
/**
* 商户结束营业时间
*/
@Schema(description="商户结束营业时间")
@JsonFormat(pattern = DatePattern.NORM_TIME_PATTERN)
private LocalTime jobEndTime;
/**
* 商户地址
*/
@Schema(description="商户地址")
/**
* 商户地址
*/
@Schema(description = "商户地址")
private String addressDes;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
/**
* 租户ID
*/
@Schema(description = "租户ID")
private Long tenantId;
}
@@ -57,7 +57,7 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
Page<WalletRechargeApplyCompareVo> resultVo = new Page<>();
List<WalletRechargeApplyCompareVo> resultList = new ArrayList<>();
// 刚刚倒入的数据
// 刚刚导入的数据
String monthTimeStr = LocalDateTimeUtil.format(topUpApplyDetail.getImportTime(), DatePattern.NORM_MONTH_PATTERN);
WalletRechargeImportDto importDto = new WalletRechargeImportDto();
importDto.setApplyId(dto.getId());
@@ -71,23 +71,25 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
// 本月
List<WalletRechargeApplySelectCompareVo> monthList = walletTransactionMapper.selectCompare(dto.getBizType(), monthTimeStr, userIdList);
List<WalletRechargeApplySelectCompareVo> currentMonthList = new ArrayList<>();
for (WalletRechargeImportVo v : userList) {
WalletRechargeApplySelectCompareVo item = new WalletRechargeApplySelectCompareVo();
item.setUserId(v.getUserId());
List<WalletRechargeApplySelectCompareVo> targetList = monthList.stream().filter(i -> ObjectUtil.equals(i.getUserId(), v.getUserId())).toList();
if (ObjectUtil.isNotEmpty(targetList)) {
WalletRechargeApplySelectCompareVo target = targetList.stream().findFirst().get();
if (ObjectUtil.isNotEmpty(target)) {
item.setPrice(v.getPrice());
Integer beforePrice = ObjectUtil.isEmpty(v.getBeforePrice()) ? 0 : v.getBeforePrice();
item.setTotalPrice(v.getPrice() + beforePrice);
if (ObjectUtil.isNotEmpty(monthList)) {
for (WalletRechargeImportVo v : userList) {
WalletRechargeApplySelectCompareVo item = new WalletRechargeApplySelectCompareVo();
item.setUserId(v.getUserId());
List<WalletRechargeApplySelectCompareVo> targetList = monthList.stream().filter(i -> ObjectUtil.equals(i.getUserId(), v.getUserId())).toList();
if (ObjectUtil.isNotEmpty(targetList)) {
WalletRechargeApplySelectCompareVo target = targetList.stream().findFirst().get();
if (ObjectUtil.isNotEmpty(target)) {
item.setPrice(v.getPrice());
Integer beforePrice = ObjectUtil.isEmpty(v.getBeforePrice()) ? 0 : v.getBeforePrice();
item.setTotalPrice(v.getPrice() + beforePrice);
}
}
if (ObjectUtil.isAllEmpty(item.getPrice(), item.getTotalPrice())) {
item.setPrice(v.getPrice());
item.setTotalPrice(v.getPrice());
}
currentMonthList.add(item);
}
if (ObjectUtil.isAllEmpty(item.getPrice(), item.getTotalPrice())) {
item.setPrice(v.getPrice());
item.setTotalPrice(v.getPrice());
}
currentMonthList.add(item);
}
compareMonthMap.put(monthTimeStr, currentMonthList);
@@ -97,7 +99,9 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
List<WalletRechargeApplySelectCompareVo> selectList = walletTransactionMapper.selectCompare(dto.getBizType(), v, userIdList);
selectList.forEach(j -> {
j.setMonthTimeStr(v);
WalletRechargeImportVo target = userList.stream().filter(i -> ObjectUtil.equals(i.getUserId(), j.getUserId())).findFirst().get();
WalletRechargeImportVo target = userList.stream()
.filter(i -> ObjectUtil.equals(i.getUserId(), j.getUserId()))
.findFirst().get();
if (ObjectUtil.isNotEmpty(target) && ObjectUtil.isNotEmpty(target.getPrice())) {
j.setTotalPrice(j.getPrice() + target.getPrice());
} else {
@@ -176,7 +176,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
throw new RuntimeException("请先编辑导入时间等信息");
}
// 判断之前有没有在审核的
if (isCheckData(detail.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
if (isCheckData(detail.getUserId())) throw new RuntimeException("最多提交3个申请,请勿重复提交");
// 查询用户
UserInfo user = userService.getByUserId(detail.getUserId()).getData();
if (ObjectUtil.isEmpty(user)) throw new RuntimeException("发起人不存在");
@@ -202,7 +202,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
updateObj.setProcessId(processId);
updateObj.setProcessStatus(TaskCheckStatusEnum.PADDING.getCode());
baseMapper.updateById(updateObj);
// 更新之间的总金额
// 更新之前的总金额
getSelf().updateBeforePrice(detail);
}
@@ -223,6 +223,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
list = list.stream().filter(v -> !ObjectUtil.isAllEmpty(v.getUsername(), v.getUserMobile(), v.getPrice())).toList();
if (ObjectUtil.isEmpty(list)) return R.failed();
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
List<String> usernameList = list.stream().map(WalletRechargeExcelDto::getUsername).toList();
List<String> userPoneList = list.stream().map(WalletRechargeExcelDto::getUserMobile).toList();
for (WalletRechargeExcelDto v : list) {
Set<String> errors = new LinkedHashSet<>();
if (ObjectUtil.isEmpty(v.getPrice())) {
@@ -255,6 +257,15 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
}
}
}
long userNameCount = usernameList.stream().filter(i -> ObjectUtil.equals(i, v.getUsername())).count();
if (userNameCount > 1) {
errors.add("用户名 <" + v.getUsername() + "> 重复");
}
long userPhone = userPoneList.stream().filter(i -> ObjectUtil.equals(i, v.getUserMobile())).count();
if (userPhone > 1) {
errors.add("用手机号 <" + v.getUserMobile() + "> 重复");
}
if (ObjectUtil.isNotEmpty(errors)) {
errorMessageList.add(new ErrorMessage(v.getLineNum(), errors));
}
@@ -421,7 +432,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
.eq(WalletRechargeApplyEntity::getUserId, walletId)
.eq(WalletRechargeApplyEntity::getProcessStatus, NodeStatusEnum.JXZ.getCode())
);
return count > 0;
return count >= 3;
}
private WalletRechargeApplyServiceImpl getSelf() {
@@ -2,18 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.wallet.mapper.MchManageMapper">
<resultMap id="mchManageMap" type="com.bsd.pjcloud.wallet.api.entity.MchManageEntity">
<resultMap id="mchManageMap" type="com.bsd.pjcloud.wallet.api.entity.MchManageEntity">
<id property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="defaultWalletTypeId" column="default_wallet_type_id"/>
<result property="name" column="name"/>
<result property="types" column="types"/>
<result property="logoPic" column="logo_pic"/>
<result property="collectionCode" column="collection_code"/>
<result property="swiperPic" column="swiper_pic"/>
<result property="phone" column="phone"/>
<result property="jobStartTime" column="job_start_time"/>
<result property="jobEndTime" column="job_end_time"/>
<result property="jobTime" column="job_time"/>
<result property="addressDes" column="address_des"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
@@ -21,5 +20,5 @@
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</resultMap>
</mapper>