Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
commit
05e0c40659
|
@ -7,7 +7,7 @@
|
|||
|
||||
##前端部署
|
||||
修改前端访问后端地址
|
||||
在 yudao-ui-admin 目录下,执行 npm run build:dev 命令,编译前端项目
|
||||
在 yudao-ui-admin 目录下,执行 npm run build:prod 命令,编译前端项目
|
||||
将打包的dist文件内容放nginx服务访问
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.method.Excel;
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderInfoService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -36,6 +40,8 @@ public class RechargeOrderController {
|
|||
|
||||
@Resource
|
||||
private RechargeOrderService rechargeOrderService;
|
||||
@Resource
|
||||
private RechargeOrderInfoService rechargeOrderInfoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建订单")
|
||||
|
@ -87,6 +93,7 @@ public class RechargeOrderController {
|
|||
return success(RechargeOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出订单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:export')")
|
||||
|
@ -94,9 +101,15 @@ public class RechargeOrderController {
|
|||
public void exportRechargeOrderExcel(@Valid RechargeOrderExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<RechargeOrderDO> list = rechargeOrderService.getRechargeOrderList(exportReqVO);
|
||||
ArrayList<String> s = new ArrayList<>();
|
||||
list.forEach(x -> {
|
||||
s.add(x.getOrderId());
|
||||
});
|
||||
List<RechargeOrderInfoDO> infoList = rechargeOrderInfoService.getRechargeOrderInfoList(s);
|
||||
// 导出 Excel
|
||||
List<RechargeOrderExcelVO> datas = RechargeOrderConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "订单.xls", "数据", RechargeOrderExcelVO.class, datas);
|
||||
}
|
||||
List<RechargeOrderInfoExcelVO> infoDatas = RechargeOrderInfoConvert.INSTANCE.convertList02(infoList);
|
||||
|
||||
Excel.orderExport(response, datas, infoDatas);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.method;
|
||||
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderExcelVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderInfoExcelVO;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import com.google.common.net.HttpHeaders;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: ignite
|
||||
* @Date: 2023/5/16 18:25
|
||||
* @Description:
|
||||
*/
|
||||
public class Excel {
|
||||
|
||||
public static ExcelWriter orderExport(HttpServletResponse response, List<RechargeOrderExcelVO> z, List<RechargeOrderInfoExcelVO> x) throws IOException {
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String encodedFileName = URLEncoder.encode(System.currentTimeMillis() + "", StandardCharsets.UTF_8.name()).replaceAll("\\+", "%20");
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename*=utf-8''" + encodedFileName + ".xlsx");
|
||||
|
||||
|
||||
ExcelWriterBuilder writerBuilder = EasyExcel.write(response.getOutputStream())
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy());
|
||||
ExcelWriter excelWriter = writerBuilder.build();
|
||||
|
||||
WriteSheet writeSheet1 = EasyExcel.writerSheet(0, "订单列表").head(RechargeOrderExcelVO.class).build();
|
||||
WriteSheet writeSheet2 = EasyExcel.writerSheet(1, "订单明细表").head(RechargeOrderInfoExcelVO.class).build();
|
||||
|
||||
excelWriter.write(z, writeSheet1);
|
||||
excelWriter.write(x, writeSheet2);
|
||||
|
||||
excelWriter.finish();
|
||||
return excelWriter;
|
||||
}
|
||||
}
|
|
@ -1,21 +1,10 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单 Excel VO
|
||||
|
@ -25,14 +14,23 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||
@Data
|
||||
public class RechargeOrderExcelVO {
|
||||
|
||||
@ExcelProperty("订单ID")
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
private String orderId;
|
||||
|
||||
@ExcelProperty("用户id")
|
||||
private Integer uid;
|
||||
@ExcelProperty("第三方支付流水号")
|
||||
private String paySerialNumber;
|
||||
|
||||
@ExcelProperty("支付时间")
|
||||
private LocalDateTime payTime;
|
||||
//:0-普通订单,1-视频号订单
|
||||
@ExcelProperty("订单类型")
|
||||
private Integer type;
|
||||
//(0:待发货;1:待收货;2:已收货,待评价;3:已完成;)
|
||||
@ExcelProperty("订单状态")
|
||||
private String status;
|
||||
|
||||
@ExcelProperty("配送方式")
|
||||
private String deliveryType;
|
||||
|
||||
@ExcelProperty("用户姓名")
|
||||
private String realName;
|
||||
|
@ -42,89 +40,40 @@ public class RechargeOrderExcelVO {
|
|||
|
||||
@ExcelProperty("确认手机号")
|
||||
private String confirmPhone;
|
||||
|
||||
@ExcelProperty("订单商品总数")
|
||||
private Integer totalNum;
|
||||
|
||||
@ExcelProperty("订单总价")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ExcelProperty("实际支付金额")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ExcelProperty("支付状态")
|
||||
private Byte paid;
|
||||
|
||||
@ExcelProperty("支付截止时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@ExcelProperty("支付截止时间")
|
||||
private LocalDateTime payEndTime;
|
||||
|
||||
@ExcelProperty("支付方式")
|
||||
private String payType;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("订单状态(0:待发货;1:待收货;2:已收货,待评价;3:已完成;)")
|
||||
private Boolean status;
|
||||
|
||||
@ExcelProperty("0 未退款 1 申请中 2 已退款 3 退款中")
|
||||
private Byte refundStatus;
|
||||
|
||||
@ExcelProperty("退款图片")
|
||||
private String refundReasonWapImg;
|
||||
|
||||
@ExcelProperty("退款用户说明")
|
||||
private String refundReasonWapExplain;
|
||||
|
||||
@ExcelProperty("前台退款原因")
|
||||
private String refundReasonWap;
|
||||
|
||||
@ExcelProperty("不退款的理由")
|
||||
private String refundReason;
|
||||
|
||||
@ExcelProperty("退款时间")
|
||||
private LocalDateTime refundReasonTime;
|
||||
|
||||
@ExcelProperty("退款金额")
|
||||
private BigDecimal refundPrice;
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String mark;
|
||||
|
||||
@ExcelProperty("管理员备注")
|
||||
@ExcelProperty("取货地址")
|
||||
private String pickUpAddr;
|
||||
|
||||
@ExcelProperty("自提地址")
|
||||
private String SelfPickupAddr;
|
||||
|
||||
@ExcelProperty("支付方式")
|
||||
private String payType;
|
||||
|
||||
@ExcelProperty("订单备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("成本价")
|
||||
private BigDecimal cost;
|
||||
|
||||
@ExcelProperty("支付渠道(0微信公众号1微信小程序2余额)")
|
||||
private Byte isChannel;
|
||||
|
||||
@ExcelProperty("消息提醒")
|
||||
private Byte isRemind;
|
||||
|
||||
@ExcelProperty("后台是否删除")
|
||||
private Boolean isSystemDel;
|
||||
|
||||
@ExcelProperty("订单类型:0-普通订单,1-视频号订单")
|
||||
private Integer type;
|
||||
|
||||
@ExcelProperty("商品总价")
|
||||
@ExcelProperty("产品合计金额")
|
||||
private BigDecimal proTotalPrice;
|
||||
|
||||
@ExcelProperty("改价前支付金额")
|
||||
private BigDecimal beforePayPrice;
|
||||
@ExcelProperty("运费")
|
||||
private BigDecimal shipPrice;
|
||||
|
||||
@ExcelProperty("是否改价,0-否,1-是")
|
||||
private Boolean isAlterPrice;
|
||||
@ExcelProperty("会员账号")
|
||||
private String vipAccount;
|
||||
|
||||
@ExcelProperty("商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号")
|
||||
private String outTradeNo;
|
||||
@ExcelProperty("会员姓名")
|
||||
private String vipName;
|
||||
|
||||
@ExcelProperty("第三方支付流水号")
|
||||
private String paySerialNumber;
|
||||
@ExcelProperty("推广员")
|
||||
private String promoter;
|
||||
|
||||
@ExcelProperty("组织名称")
|
||||
private Integer depName;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,30 +18,59 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||
@Data
|
||||
public class RechargeOrderInfoExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("充值订单id")
|
||||
private Integer rechargeOrderId;
|
||||
|
||||
@ExcelProperty("充值档位")
|
||||
private Integer rechargeGearId;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
private String orderNo;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
@ExcelProperty("商户名称")
|
||||
private String shopName;
|
||||
|
||||
@ExcelProperty("产品名称")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty("商品价格")
|
||||
@ExcelProperty("购物选项")
|
||||
private String shopOption;
|
||||
|
||||
@ExcelProperty("产品分类")
|
||||
private String productCategory;
|
||||
|
||||
@ExcelProperty("产品价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@ExcelProperty("购买数量")
|
||||
@ExcelProperty("产品数量")
|
||||
private Integer payNum;
|
||||
|
||||
@ExcelProperty("合计金额")
|
||||
private BigDecimal proTotalPrice;
|
||||
|
||||
@ExcelProperty("支付金额")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ExcelProperty("售后状态")
|
||||
private String afterStatus;
|
||||
|
||||
@ExcelProperty("退款金额")
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
@ExcelProperty("会员账号")
|
||||
private String vipAccount;
|
||||
|
||||
@ExcelProperty("会员姓名")
|
||||
private String vipName;
|
||||
//(0:待发货;1:待收货;2:已收货,待评价;3:已完成;)
|
||||
@ExcelProperty("订单状态")
|
||||
private String status;
|
||||
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("订单备注")
|
||||
private String mark;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ExcelProperty("赠送积分")
|
||||
private Integer giveIntegral;
|
||||
|
||||
|
|
|
@ -165,4 +165,8 @@ public class RechargeOrderDO extends BaseDO {
|
|||
*/
|
||||
private String paySerialNumber;
|
||||
|
||||
private String creator;
|
||||
private String updater;
|
||||
private Boolean deleted;
|
||||
|
||||
}
|
||||
|
|
|
@ -70,4 +70,9 @@ public class RechargeOrderInfoDO extends BaseDO {
|
|||
*/
|
||||
private Integer productType;
|
||||
|
||||
private String creator;
|
||||
private String updater;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -49,4 +49,9 @@ public interface RechargeOrderInfoMapper extends BaseMapperX<RechargeOrderInfoDO
|
|||
.orderByDesc(RechargeOrderInfoDO::getId));
|
||||
}
|
||||
|
||||
default List<RechargeOrderInfoDO> selectList(List<String> s) {
|
||||
return selectList(new LambdaQueryWrapperX<RechargeOrderInfoDO>().in(RechargeOrderInfoDO::getOrderNo, s));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,4 +67,6 @@ public interface RechargeOrderInfoService {
|
|||
*/
|
||||
List<RechargeOrderInfoDO> getRechargeOrderInfoList(RechargeOrderInfoExportReqVO exportReqVO);
|
||||
|
||||
List<RechargeOrderInfoDO> getRechargeOrderInfoList(List<String> ids);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.shop.service.recharge;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -79,4 +80,9 @@ public class RechargeOrderInfoServiceImpl implements RechargeOrderInfoService {
|
|||
return rechargeOrderInfoMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrderInfoDO> getRechargeOrderInfoList(List<String> s) {
|
||||
return rechargeOrderInfoMapper.selectList(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@ public interface ErrorCodeConstants {
|
|||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1004001000, "用户不存在");
|
||||
ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1004001001, "密码校验失败");
|
||||
ErrorCode PROMOTER_NOT_EXISTS = new ErrorCode(1004001002, "推广员不存在");
|
||||
|
||||
ErrorCode PROMOTER_EXISTS = new ErrorCode(1004001003, "推广员存在");
|
||||
ErrorCode PROMOTER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1002003004, "导入推广员数据不能为空!");
|
||||
// ========== AUTH 模块 1004003000 ==========
|
||||
ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1004003000, "登录失败,账号密码不正确");
|
||||
ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1004003001, "登录失败,账号被禁用");
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.promoter;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -27,6 +30,7 @@ import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
|
|||
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
|
||||
import cn.iocoder.yudao.module.member.convert.promoter.PromoterConvert;
|
||||
import cn.iocoder.yudao.module.member.service.promoter.PromoterService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "管理后台 - 推广员")
|
||||
@RestController
|
||||
|
@ -98,5 +102,27 @@ public class PromoterController {
|
|||
List<PromoterExcelVO> datas = PromoterConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "推广员.xls", "数据", PromoterExcelVO.class, datas);
|
||||
}
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入推广员模板")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
// 手动创建导出 demo
|
||||
List<PromoterImportExcelVO> list = Arrays.asList(
|
||||
PromoterImportExcelVO.builder().nickName("yunai").orgName("创盈云网络>重庆总公司>研发部门").mobile("15601691300").build()
|
||||
);
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "推广员导入模板.xls", "推广员列表", PromoterImportExcelVO.class, list);
|
||||
}
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入推广员")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
||||
})
|
||||
// @PreAuthorize("@ss.hasPermission('system:user:import')")
|
||||
public CommonResult<PromoterImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
List<PromoterImportExcelVO> list = ExcelUtils.read(file, PromoterImportExcelVO.class);
|
||||
return success(promoterService.importUserList(list, updateSupport));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.promoter.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 推广员 Excel VO
|
||||
*
|
||||
* @author 创盈云
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false)
|
||||
public class PromoterImportExcelVO {
|
||||
|
||||
@ExcelProperty("手机号码")
|
||||
@Mobile
|
||||
@NotEmpty(message = "手机号码不能为空")
|
||||
private String mobile;
|
||||
@ExcelProperty("组织全称")
|
||||
@NotEmpty(message = "组织全称不能为空")
|
||||
private String orgName;
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
@NotEmpty(message = "姓名不能为空")
|
||||
private String nickName;
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package cn.iocoder.yudao.module.member.controller.admin.promoter.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 推广员导入 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
public class PromoterImportRespVO {
|
||||
|
||||
@Schema(description = "导入成功的推广员数组", required = true)
|
||||
private List<String> createUsernames;
|
||||
|
||||
@Schema(description = "更新成功的推广员数组", required = true)
|
||||
private List<String> updateUsernames;
|
||||
|
||||
@Schema(description = "导入失败的推广员", required = true)
|
||||
private Map<String, String> failureUsernames;
|
||||
|
||||
}
|
|
@ -32,7 +32,7 @@ public class PromoterDO implements Serializable {
|
|||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private String orgId;
|
||||
private Long orgId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
|
|
|
@ -67,4 +67,13 @@ public interface PromoterService {
|
|||
*/
|
||||
List<PromoterDO> getPromoterList(PromoterExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 批量导入推广员列表
|
||||
*
|
||||
* @param importUsers 批量导入推广员列表
|
||||
* @param isUpdateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
PromoterImportRespVO importUserList(List<PromoterImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
package cn.iocoder.yudao.module.member.service.promoter;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -18,6 +27,9 @@ import cn.iocoder.yudao.module.member.dal.mysql.promoter.PromoterMapper;
|
|||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_USERNAME_EXISTS;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
/**
|
||||
* 推广员 Service 实现类
|
||||
|
@ -30,10 +42,14 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
|
||||
@Resource
|
||||
private PromoterMapper promoterMapper;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
@Resource
|
||||
private Validator validator;
|
||||
@Resource
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Override
|
||||
public Long createPromoter(PromoterCreateReqVO createReqVO) {
|
||||
|
@ -45,11 +61,16 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
memberUserDO.setNickname(createReqVO.getNickName());
|
||||
memberUserDO.setMobile(createReqVO.getMobile());
|
||||
memberUserDO.setStatus(createReqVO.getStatus());
|
||||
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length()-6));
|
||||
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickName(),getClientIP());
|
||||
}
|
||||
// 插入
|
||||
PromoterDO promoter = PromoterConvert.INSTANCE.convert(createReqVO);
|
||||
promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId()));
|
||||
if(count>0){
|
||||
throw new ServiceException(PROMOTER_EXISTS);
|
||||
}
|
||||
promoter.setUserId(memberUserDO.getId());
|
||||
promoterMapper.insert(promoter);
|
||||
// 返回
|
||||
|
@ -99,4 +120,68 @@ public class PromoterServiceImpl implements PromoterService {
|
|||
return promoterMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入推广员列表
|
||||
*
|
||||
* @param importUsers 批量导入推广员列表
|
||||
* @param isUpdateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
@Override
|
||||
public PromoterImportRespVO importUserList(List<PromoterImportExcelVO> importUsers, boolean isUpdateSupport) {
|
||||
if (CollUtil.isEmpty(importUsers)) {
|
||||
throw exception(PROMOTER_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
PromoterImportRespVO respVO = PromoterImportRespVO.builder().createUsernames(new ArrayList<>())
|
||||
.updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
||||
List<DeptRespDTO> deptRespDTOList = deptApi.getDeptList();
|
||||
Map<String,DeptRespDTO> nameList = deptRespDTOList.stream().collect(toMap(DeptRespDTO::getParentOrganizationName, value -> value,(value1,value2)->value1));
|
||||
importUsers.forEach(importUser -> {
|
||||
try {
|
||||
ValidationUtils.validate(validator,importUser);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), ex.getMessage());
|
||||
return;
|
||||
}
|
||||
//判断手机号是否注册
|
||||
MemberUserDO memberUserDO = memberUserService.getUserByMobile(importUser.getMobile());
|
||||
if(memberUserDO==null){
|
||||
//创建用户
|
||||
memberUserDO = new MemberUserDO();
|
||||
memberUserDO.setNickname(importUser.getNickName());
|
||||
memberUserDO.setMobile(importUser.getMobile());
|
||||
memberUserDO.setPassword(importUser.getMobile().substring(importUser.getMobile().length()-6));
|
||||
memberUserDO.setStatus(1);
|
||||
memberUserService.createUserIfAbsent(importUser.getMobile(),importUser.getNickName(),getClientIP());
|
||||
}
|
||||
// 插入
|
||||
PromoterDO promoter = new PromoterDO();
|
||||
promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
promoter.setUserId(memberUserDO.getId());
|
||||
Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId()));
|
||||
if(count>0){
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), "已经是推广员");
|
||||
return;
|
||||
}
|
||||
DeptRespDTO deptRespDTO = nameList.get(importUser.getOrgName());
|
||||
if(deptRespDTO==null){
|
||||
respVO.getFailureUsernames().put(importUser.getNickName(), "组织不存在");
|
||||
return;
|
||||
}
|
||||
promoter.setOrgId(deptRespDTO.getId());
|
||||
promoterMapper.insert(promoter);
|
||||
respVO.getCreateUsernames().add(importUser.getNickName());
|
||||
return;
|
||||
});
|
||||
return respVO;
|
||||
}
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
* @param password 密码
|
||||
* @return 加密后的密码
|
||||
*/
|
||||
private String encodePassword(String password) {
|
||||
return passwordEncoder.encode(password);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,14 @@ public interface DeptApi {
|
|||
*/
|
||||
List<DeptRespDTO> getDeptList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得部门信息数组
|
||||
*
|
||||
* @param ids 部门编号数组
|
||||
* @return 部门信息数组
|
||||
*/
|
||||
List<DeptRespDTO> getDeptList();
|
||||
|
||||
/**
|
||||
* 校验部门们是否有效。如下情况,视为无效:
|
||||
* 1. 部门编号不存在
|
||||
|
|
|
@ -34,4 +34,14 @@ public class DeptRespDTO {
|
|||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 父级组织链
|
||||
*/
|
||||
private String parentOrganizationIds;
|
||||
|
||||
/**
|
||||
* 父级组织链名称
|
||||
*/
|
||||
private String parentOrganizationName;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.system.api.dept;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||
import cn.iocoder.yudao.module.system.convert.dept.DeptConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
|
@ -32,7 +33,11 @@ public class DeptApiImpl implements DeptApi {
|
|||
List<DeptDO> depts = deptService.getDeptList(ids);
|
||||
return DeptConvert.INSTANCE.convertList03(depts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptRespDTO> getDeptList() {
|
||||
List<DeptDO> depts = deptService.getDeptList(new DeptListReqVO());
|
||||
return DeptConvert.INSTANCE.convertList03(depts);
|
||||
}
|
||||
@Override
|
||||
public void validateDeptList(Collection<Long> ids) {
|
||||
deptService.validateDeptList(ids);
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -24,11 +26,24 @@ public class TenantPageReqVO extends PageParam {
|
|||
private String contactName;
|
||||
|
||||
@Schema(description = "联系手机", example = "15601691300")
|
||||
@Mobile
|
||||
private String contactMobile;
|
||||
|
||||
@Schema(description = "租户状态(0正常 1停用)", example = "1")
|
||||
private Integer status;
|
||||
/**
|
||||
* 销售负责人
|
||||
*/
|
||||
@Schema(description = "销售负责人", example = "https://www.iocoder.cn")
|
||||
@Length( max = 10, message = "销售负责人长度为 {max}位")
|
||||
private String saleContactName;
|
||||
|
||||
/**
|
||||
* 销售负责人联系电话
|
||||
*/
|
||||
@Schema(description = "销售负责人联系电话", example = "https://www.iocoder.cn")
|
||||
@Mobile
|
||||
private String saleContactMobile;
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
|
|
@ -23,6 +23,8 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
|||
.likeIfPresent(TenantDO::getName, reqVO.getName())
|
||||
.likeIfPresent(TenantDO::getContactName, reqVO.getContactName())
|
||||
.likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile())
|
||||
.likeIfPresent(TenantDO::getSaleContactName, reqVO.getSaleContactName())
|
||||
.likeIfPresent(TenantDO::getSaleContactMobile, reqVO.getSaleContactMobile())
|
||||
.eqIfPresent(TenantDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(TenantDO::getId));
|
||||
|
|
|
@ -5,7 +5,7 @@ ENV = 'production'
|
|||
VUE_APP_TITLE = 创盈商户管理系统
|
||||
|
||||
# 创盈管理系统/生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/cyyywl-api'
|
||||
|
||||
# 根据服务器或域名修改
|
||||
PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
|
||||
|
@ -22,4 +22,4 @@ VUE_APP_CAPTCHA_ENABLE = true
|
|||
VUE_APP_DOC_ENABLE = false
|
||||
|
||||
# 百度统计
|
||||
VUE_APP_BAIDU_CODE = fadc1bd5db1a1d6f581df60a1807f8ab
|
||||
VUE_APP_BAIDU_CODE =
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 创建推广员
|
||||
export function createPromoter(data) {
|
||||
return request({
|
||||
url: '/member/promoter/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新推广员
|
||||
export function updatePromoter(data) {
|
||||
return request({
|
||||
url: '/member/promoter/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除推广员
|
||||
export function deletePromoter(id) {
|
||||
return request({
|
||||
url: '/member/promoter/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得推广员
|
||||
export function getPromoter(id) {
|
||||
return request({
|
||||
url: '/member/promoter/get?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获得推广员分页
|
||||
export function getPromoterPage(query) {
|
||||
return request({
|
||||
url: '/member/promoter/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出推广员 Excel
|
||||
export function exportPromoterExcel(query) {
|
||||
return request({
|
||||
url: '/member/promoter/export-excel',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
// 下载用户导入模板
|
||||
export function importTemplate() {
|
||||
return request({
|
||||
url: '/member/promoter/get-import-template',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,289 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="组织id" prop="orgId">
|
||||
<el-input v-model="queryParams.orgId" placeholder="请输入组织id" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员id" prop="userId">
|
||||
<el-input v-model="queryParams.userId" placeholder="请输入会员id" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['member:promoter:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"
|
||||
v-hasPermi="['system:user:import']">导入</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"-->
|
||||
<!-- v-hasPermi="['member:promoter:export']">导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 列表 -->
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
<el-table-column label="组织id" align="center" prop="orgId" />
|
||||
<el-table-column label="会员id" align="center" prop="userId" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['member:promoter:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['member:promoter:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="组织id" prop="orgId">
|
||||
<el-input v-model="form.orgId" placeholder="请输入组织id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="会员id" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入会员id" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 用户导入对话框 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<!-- <div class="el-upload__tip" slot="tip">-->
|
||||
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
|
||||
<!-- </div>-->
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createPromoter, updatePromoter, deletePromoter, getPromoter, getPromoterPage, importTemplate,exportPromoterExcel } from "@/api/member/promoter";
|
||||
import {getBaseHeader} from "@/utils/request";
|
||||
export default {
|
||||
name: "Promoter",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 推广员列表
|
||||
list: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "推广员导入",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: getBaseHeader(),
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import'
|
||||
},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
orgId: null,
|
||||
userId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
orgId: [{ required: true, message: "组织id不能为空", trigger: "blur" }],
|
||||
userId: [{ required: true, message: "会员id不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
getPromoterPage(this.queryParams).then(response => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
orgId: undefined,
|
||||
userId: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加推广员";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getPromoter(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改推广员";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// 修改的提交
|
||||
if (this.form.id != null) {
|
||||
updatePromoter(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
createPromoter(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal.confirm('是否确认删除推广员编号为"' + id + '"的数据项?').then(function() {
|
||||
return deletePromoter(id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.$modal.confirm('是否确认导出所有推广员数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportPromoterExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '推广员.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport() {
|
||||
this.upload.title = "推广员导入";
|
||||
this.upload.open = true;
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate() {
|
||||
importTemplate().then(response => {
|
||||
this.$download.excel(response, '推广员导入模板.xls');
|
||||
});
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response.code !== 0) {
|
||||
this.$modal.msgError(response.msg)
|
||||
return;
|
||||
}
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
// 拼接提示语
|
||||
let data = response.data;
|
||||
let text = '创建成功数量:' + data.createUsernames.length;
|
||||
for (const username of data.createUsernames) {
|
||||
text += '<br /> ' + username;
|
||||
}
|
||||
text += '<br />创建失败数量:' + Object.keys(data.failureUsernames).length;
|
||||
for (const username in data.failureUsernames) {
|
||||
text += '<br /> ' + username + ':' + data.failureUsernames[username];
|
||||
}
|
||||
this.$alert(text, "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.getList();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -2,29 +2,31 @@
|
|||
<div class="app-container">
|
||||
<doc-alert title="SaaS 多租户" url="https://doc.iocoder.cn/saas-tenant/"/>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="租户名" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入租户名" clearable @keyup.enter.native="handleQuery"/>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
|
||||
<el-form-item label="店铺名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入店铺名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="queryParams.contactName" placeholder="请输入联系人" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系手机" prop="contactMobile">
|
||||
<el-input v-model="queryParams.contactMobile" placeholder="请输入联系手机" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="租户状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择租户状态" clearable>
|
||||
<el-form-item label="店铺状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"/>
|
||||
<el-form-item label="店铺负责人" prop="contactName">
|
||||
<el-input v-model="queryParams.contactName" placeholder="请输入" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="店铺负责人手机号" prop="contactMobile">
|
||||
<el-input v-model="queryParams.contactMobile" placeholder="请输入" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售对接人" prop="saleContactName">
|
||||
<el-input v-model="queryParams.saleContactName" placeholder="请输入" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="销售对接人手机号" prop="saleContactMobile">
|
||||
<el-input v-model="queryParams.saleContactMobile" placeholder="请输入" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
|
@ -202,11 +204,12 @@ export default {
|
|||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
contactName: null,
|
||||
contactMobile: null,
|
||||
status: undefined,
|
||||
createTime: []
|
||||
name: '',
|
||||
contactName: '',
|
||||
contactMobile: '',
|
||||
status: '',
|
||||
saleContactName: '',
|
||||
saleContactMobile: ''
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
|
@ -276,17 +279,7 @@ export default {
|
|||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
packageId: undefined,
|
||||
contactName: undefined,
|
||||
contactMobile: undefined,
|
||||
accountCount: undefined,
|
||||
expireTime: undefined,
|
||||
domain: undefined,
|
||||
status: CommonStatusEnum.ENABLE,
|
||||
};
|
||||
this.form = {}
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
|
@ -365,23 +358,14 @@ export default {
|
|||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
// 执行导出
|
||||
this.$modal.confirm('是否确认导出所有租户数据项?').then(() => {
|
||||
this.$modal.confirm('是否确认导出所有店铺数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportTenantExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, '租户.xls');
|
||||
this.$download.excel(response, '店铺.xls');
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 套餐名格式化 */
|
||||
getPackageName(packageId) {
|
||||
for (const item of this.packageList) {
|
||||
if (item.id === packageId) {
|
||||
return item.name;
|
||||
}
|
||||
}
|
||||
return '未知套餐';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue