|
|
@@ -25,10 +25,12 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import com.gubersail.shop.app.annotation.VersionControl;
|
|
|
import com.gubersail.shop.app.api.claim.entity.ShopAppClaim;
|
|
|
import com.gubersail.shop.app.api.claim.vo.ShopAppClaimVO;
|
|
|
+import com.gubersail.shop.app.api.corps.entity.ShopAppPjCorpsAttn;
|
|
|
import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceFiles;
|
|
|
import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceRecord;
|
|
|
import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceRegister;
|
|
|
import com.gubersail.shop.app.claim.service.IShopAppClaimService;
|
|
|
+import com.gubersail.shop.app.corp.service.IShopAppCorpsAttnService;
|
|
|
import com.gubersail.shop.app.insurance.service.IShopAppTireInsuranceFilesService;
|
|
|
import com.gubersail.shop.app.insurance.service.IShopAppTireInsuranceRecordService;
|
|
|
import com.gubersail.shop.app.wrapper.ShopAppClaimWrapper;
|
|
|
@@ -40,6 +42,7 @@ import org.springblade.common.enums.CommonEnum;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
@@ -68,9 +71,7 @@ public class ShopAppClaimController extends BladeController {
|
|
|
|
|
|
private final IUserClient userClient;
|
|
|
|
|
|
- private final IShopAppTireInsuranceFilesService shopAppTireInsuranceFilesService;
|
|
|
-
|
|
|
- private final IShopAppTireInsuranceRecordService shopAppTireInsuranceRecordService;
|
|
|
+ private final IShopAppCorpsAttnService shopAppCorpsAttnService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -90,6 +91,7 @@ public class ShopAppClaimController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入bladeClaim")
|
|
|
public R<IPage<ShopAppClaimVO>> list(ShopAppClaimVO bladeClaim, Query query) {
|
|
|
+ BladeUser nowSelectedUser = AuthUtil.getUser();
|
|
|
LambdaQueryWrapper<ShopAppClaim> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(ShopAppClaim::getIsDeleted, 0)
|
|
|
.eq(ObjectUtils.isNotNull(bladeClaim.getAuditStatus()), ShopAppClaim::getAuditStatus, bladeClaim.getAuditStatus())
|
|
|
@@ -103,11 +105,25 @@ public class ShopAppClaimController extends BladeController {
|
|
|
)
|
|
|
.orderByDesc(ShopAppClaim::getCreateTime);
|
|
|
if (AuthUtil.getUserRole().contains("store")) {
|
|
|
- lambdaQueryWrapper.eq(ShopAppClaim::getStoreId, AuthUtil.getUserId());
|
|
|
+ ShopAppPjCorpsAttn shopAppCorpsAttn = shopAppCorpsAttnService.getOne(new LambdaQueryWrapper<ShopAppPjCorpsAttn>()
|
|
|
+ .eq(ShopAppPjCorpsAttn::getUserId, nowSelectedUser.getUserId())
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ if (Objects.isNull(shopAppCorpsAttn)) {
|
|
|
+ throw new RuntimeException("未查门店联系人信息");
|
|
|
+ }
|
|
|
+ List<ShopAppPjCorpsAttn> shopAppCorpsAttnList = shopAppCorpsAttnService.list(new LambdaQueryWrapper<ShopAppPjCorpsAttn>()
|
|
|
+ .eq(ShopAppPjCorpsAttn::getPid, shopAppCorpsAttn.getPid()));
|
|
|
+ List<Long> userIdList = shopAppCorpsAttnList.stream().map(ShopAppPjCorpsAttn::getUserId).collect(Collectors.toList());
|
|
|
+ lambdaQueryWrapper.in(ShopAppClaim::getStoreId, userIdList);
|
|
|
}else{
|
|
|
- lambdaQueryWrapper.eq(ShopAppClaim::getCreateUser, AuthUtil.getUserId());
|
|
|
+ // 车主
|
|
|
+ R<User> userR = userClient.userInfoById(nowSelectedUser.getUserId());
|
|
|
+ if (!userR.isSuccess() || org.springframework.util.ObjectUtils.isEmpty(userR.getData())) {
|
|
|
+ return R.fail("未查询到该用户的注册信息");
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.eq(ShopAppClaim::getConsumerPhone, userR.getData().getPhone());
|
|
|
}
|
|
|
- lambdaQueryWrapper.eq(ShopAppClaim::getCreateDept, AuthUtil.getDeptId());
|
|
|
+ lambdaQueryWrapper.eq(ShopAppClaim::getCreateDept, nowSelectedUser.getDeptId());
|
|
|
IPage<ShopAppClaim> pages = bladeClaimService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
IPage<ShopAppClaimVO> voPage = new Page<>();
|
|
|
if (!pages.getRecords().isEmpty()) {
|