|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.gxwebsoft.shop.controller; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.gxwebsoft.common.core.web.BaseController; |
|
|
|
import com.gxwebsoft.shop.entity.ShopDealerUser; |
|
|
|
import com.gxwebsoft.shop.service.ShopDealerApplyService; |
|
|
|
import com.gxwebsoft.shop.entity.ShopDealerApply; |
|
|
|
import com.gxwebsoft.shop.param.ShopDealerApplyParam; |
|
|
@ -10,12 +12,14 @@ import com.gxwebsoft.common.core.web.PageParam; |
|
|
|
import com.gxwebsoft.common.core.web.BatchParam; |
|
|
|
import com.gxwebsoft.common.core.annotation.OperationLog; |
|
|
|
import com.gxwebsoft.common.system.entity.User; |
|
|
|
import com.gxwebsoft.shop.service.ShopDealerUserService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -30,6 +34,8 @@ import java.util.List; |
|
|
|
public class ShopDealerApplyController extends BaseController { |
|
|
|
@Resource |
|
|
|
private ShopDealerApplyService shopDealerApplyService; |
|
|
|
@Resource |
|
|
|
private ShopDealerUserService shopDealerUserService; |
|
|
|
|
|
|
|
@PreAuthorize("hasAuthority('shop:shopDealerApply:list')") |
|
|
|
@Operation(summary = "分页查询分销商申请记录表") |
|
|
@ -63,6 +69,7 @@ public class ShopDealerApplyController extends BaseController { |
|
|
|
// 记录当前登录用户id
|
|
|
|
User loginUser = getLoginUser(); |
|
|
|
if (loginUser != null) { |
|
|
|
shopDealerApply.setApplyTime(LocalDateTime.now()); |
|
|
|
shopDealerApply.setUserId(loginUser.getUserId()); |
|
|
|
} |
|
|
|
if (shopDealerApplyService.save(shopDealerApply)) { |
|
|
@ -76,7 +83,22 @@ public class ShopDealerApplyController extends BaseController { |
|
|
|
@Operation(summary = "修改分销商申请记录表") |
|
|
|
@PutMapping() |
|
|
|
public ApiResult<?> update(@RequestBody ShopDealerApply shopDealerApply) { |
|
|
|
shopDealerApply.setAuditTime(null); |
|
|
|
if (shopDealerApplyService.updateById(shopDealerApply)) { |
|
|
|
if (shopDealerApply.getApplyStatus().equals(20)) { |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
shopDealerApply.setAuditTime(now); |
|
|
|
shopDealerApplyService.updateById(shopDealerApply); |
|
|
|
// 同步添加经销商
|
|
|
|
if (shopDealerUserService.count(new LambdaQueryWrapper<ShopDealerUser>().eq(ShopDealerUser::getUserId, shopDealerApply.getUserId())) == 0) { |
|
|
|
final ShopDealerUser dealerUser = new ShopDealerUser(); |
|
|
|
dealerUser.setUserId(shopDealerApply.getUserId()); |
|
|
|
dealerUser.setRealName(shopDealerApply.getRealName()); |
|
|
|
dealerUser.setMobile(shopDealerApply.getMobile()); |
|
|
|
dealerUser.setRefereeId(shopDealerApply.getRefereeId()); |
|
|
|
shopDealerUserService.save(dealerUser); |
|
|
|
} |
|
|
|
} |
|
|
|
return success("修改成功"); |
|
|
|
} |
|
|
|
return fail("修改失败"); |
|
|
|