|
@@ -4,13 +4,17 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.newfeifan.mall.framework.common.enums.UserTypeEnum;
|
|
|
import cn.newfeifan.mall.framework.security.core.LoginUser;
|
|
|
import cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
+import cn.newfeifan.mall.module.system.service.user.AdminUserService;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantPageReqVO;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantRespVO;
|
|
|
+import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqByMobileVO;
|
|
|
import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
|
|
|
import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
|
|
|
import cn.newfeifan.mall.sale.service.merchant.MerchantService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -35,6 +39,7 @@ import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
|
|
|
import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
|
import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
|
|
|
+
|
|
|
import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
|
|
|
@@ -44,6 +49,8 @@ import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.
|
|
|
@Validated
|
|
|
public class MerchantController {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AdminUserService adminUserService;
|
|
|
@Resource
|
|
|
private MerchantService merchantService;
|
|
|
|
|
@@ -54,6 +61,15 @@ public class MerchantController {
|
|
|
return success(merchantService.createMerchant(createReqVO));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/createByMobile")
|
|
|
+ @Operation(summary = "通过手机号创建一个用户")
|
|
|
+ @PreAuthorize("@ss.hasPermission('sale:merchant:create')")
|
|
|
+ public CommonResult<String> createByMobile(@RequestBody MerchantSaveReqByMobileVO createReqVO) {
|
|
|
+ adminUserService.createUserByMobile(createReqVO.getContactNumber(), createReqVO.getContact());
|
|
|
+ return success("创建成功");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新商户")
|
|
|
@PreAuthorize("@ss.hasPermission('sale:merchant:update')")
|
|
@@ -89,9 +105,6 @@ public class MerchantController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得商户分页")
|
|
|
@PreAuthorize("@ss.hasPermission('sale:merchant:query')")
|
|
@@ -105,12 +118,12 @@ public class MerchantController {
|
|
|
@PreAuthorize("@ss.hasPermission('sale:merchant:export')")
|
|
|
@OperateLog(type = EXPORT)
|
|
|
public void exportMerchantExcel(@Valid MerchantPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<MerchantDO> list = merchantService.getMerchantPage(pageReqVO).getList();
|
|
|
// 导出 Excel
|
|
|
ExcelUtils.write(response, "商户.xls", "数据", MerchantRespVO.class,
|
|
|
- BeanUtils.toBean(list, MerchantRespVO.class));
|
|
|
+ BeanUtils.toBean(list, MerchantRespVO.class));
|
|
|
}
|
|
|
|
|
|
}
|