Compare commits

..

No commits in common. "dd1eebafaaf0fa816df0e7a28356208e6dc34bce" and "08fa8e80848e24bdead6b549ddd0f12333375154" have entirely different histories.

15 changed files with 19 additions and 134 deletions

View File

@ -145,7 +145,7 @@ public class RoleController extends ControllerBase {
*/ */
@GetMapping("getAuthorizeUser") @GetMapping("getAuthorizeUser")
@ApiMark(moduleName = "角色管理", apiName = "获取已授权人员") @ApiMark(moduleName = "角色管理", apiName = "获取已授权人员")
public ApiResult<List<AdminUserVO>> getAuthorizeUser(@RequestParam Long roleId) { public ApiResult<List<AdminUserVO>> getAuthorizeUser(@RequestParam Integer roleId) {
return ApiResult.success(adminUserRoleMapService.getAuthorizeUser(roleId)); return ApiResult.success(adminUserRoleMapService.getAuthorizeUser(roleId));
} }
} }

View File

@ -96,10 +96,5 @@ public class AdminUserVO {
*/ */
private String categoryName; private String categoryName;
/**
* 区域id列表
*/
private List<Integer> areaIds;
private List<AdminUserVO> children = new ArrayList<>(); private List<AdminUserVO> children = new ArrayList<>();
} }

View File

@ -38,11 +38,6 @@ public class PlanSearchItemVO {
@NotNull @NotNull
private BigDecimal ratio; private BigDecimal ratio;
/**
* 区域国内/国外字典id
*/
private Long areaId;
/** /**
* 是否默认 * 是否默认
*/ */

View File

@ -11,7 +11,6 @@ import com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO;
import com.nflg.mobilebroken.common.pojo.vo.PlanSearchItemVO; import com.nflg.mobilebroken.common.pojo.vo.PlanSearchItemVO;
import com.nflg.mobilebroken.common.util.*; import com.nflg.mobilebroken.common.util.*;
import com.nflg.mobilebroken.quotation.controller.ControllerBase; import com.nflg.mobilebroken.quotation.controller.ControllerBase;
import com.nflg.mobilebroken.quotation.pojo.vo.DefaultRatioVO;
import com.nflg.mobilebroken.quotation.pojo.vo.PlanSearchVO; import com.nflg.mobilebroken.quotation.pojo.vo.PlanSearchVO;
import com.nflg.mobilebroken.quotation.pojo.vo.QuotationModelRatioVO; import com.nflg.mobilebroken.quotation.pojo.vo.QuotationModelRatioVO;
import com.nflg.mobilebroken.repository.entity.*; import com.nflg.mobilebroken.repository.entity.*;
@ -61,29 +60,16 @@ public class PlanController extends ControllerBase {
@Resource @Resource
private IQuotationModelRatioDirectItemService ratioDirectItemService; private IQuotationModelRatioDirectItemService ratioDirectItemService;
@Resource
private IAdminRoleService adminRoleService;
@Resource
private IDictionaryItemService dictionaryItemService;
/** /**
* 获取方案默认系数 * 获取方案默认系数
*/ */
@GetMapping("/getDefaultRatio") @GetMapping("/getDefaultRatio")
public ApiResult<List<DefaultRatioVO>> getDefaultRatio() { public ApiResult<BigDecimal> getDefaultRatio() {
return ApiResult.success( QuotationUserPlanDefault planDefault = planDefaultService.lambdaQuery()
planDefaultService.lambdaQuery() .eq(QuotationUserPlanDefault::getCreateByType, AppUserUtil.isAgent() ? 1 : 0)
.eq(QuotationUserPlanDefault::getCreateByType, AppUserUtil.isAgent() ? 1 : 0) .eq(QuotationUserPlanDefault::getCreateById, AppUserUtil.getUserId())
.eq(QuotationUserPlanDefault::getCreateById, AppUserUtil.getUserId()) .one();
.list() return ApiResult.success(Objects.isNull(planDefault) ? null : planDefault.getRatio());
.stream()
.map(pd -> new DefaultRatioVO()
.setAreaId(pd.getAreaId())
.setRatio(pd.getRatio())
)
.collect(Collectors.toList())
);
} }
/** /**
@ -134,38 +120,15 @@ public class PlanController extends ControllerBase {
List<PlanSearchItemVO> datas = new ArrayList<>(); List<PlanSearchItemVO> datas = new ArrayList<>();
pageData.setItems(datas); pageData.setItems(datas);
vo.setDatas(pageData); vo.setDatas(pageData);
boolean multiRegionQuotations = isMultiRegionQuotationsUser(); Long categoryId = getCategoryId();
List<Long> categoryIds = new ArrayList<>();
if (multiRegionQuotations) {
categoryIds = dictionaryItemService.getListByDictionaryCode("MultiRegionQuotationsSupplier")
.stream()
.map(DictionaryItem::getId)
.collect(Collectors.toList());
} else {
categoryIds.add(getCategoryId());
}
List<ModelPriceVO> prices = priceService.getAllModelPrice(); List<ModelPriceVO> prices = priceService.getAllModelPrice();
Map<Long, List<PlanSearchItemVO>> fgroup = items.stream().collect(Collectors.groupingBy(PlanSearchItemVO::getModelId)); Map<Long, List<PlanSearchItemVO>> fgroup = items.stream().collect(Collectors.groupingBy(PlanSearchItemVO::getModelId));
for (Map.Entry<Long, List<PlanSearchItemVO>> entry : fgroup.entrySet()) { for (Map.Entry<Long, List<PlanSearchItemVO>> entry : fgroup.entrySet()) {
if (index >= startIndex && index < endIndex) { if (index >= startIndex && index < endIndex) {
categoryIds.forEach(categoryId -> { BigDecimal salePrice = getSalePrice(entry.getKey(), categoryId, prices);
BigDecimal salePrice = getSalePrice(entry.getKey(), categoryId, prices); entry.getValue().forEach(item -> {
List<PlanSearchItemVO> vos = entry.getValue() item.setStandardPrice(salePrice);
.stream() datas.add(item);
.filter(pv -> Objects.equals(pv.getAreaId(), categoryId))
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(vos)) {
entry.getValue().forEach(item -> {
item.setStandardPrice(salePrice);
item.setAreaId(categoryId);
datas.add(item);
});
} else {
vos.forEach(item -> {
item.setStandardPrice(salePrice);
datas.add(item);
});
}
}); });
} }
} }
@ -272,8 +235,8 @@ public class PlanController extends ControllerBase {
List<QuotationUserPlanModelItem> items = Objects.isNull(planId) List<QuotationUserPlanModelItem> items = Objects.isNull(planId)
? new ArrayList<>() ? new ArrayList<>()
: planModelItemService.lambdaQuery() : planModelItemService.lambdaQuery()
.eq(QuotationUserPlanModelItem::getPlanId, planId) .eq(QuotationUserPlanModelItem::getPlanId, planId)
.list(); .list();
if (Objects.nonNull(planId)) { if (Objects.nonNull(planId)) {
QuotationUserPlanModel oldPlan = planModelService.getById(planId); QuotationUserPlanModel oldPlan = planModelService.getById(planId);
planModelService.lambdaUpdate() planModelService.lambdaUpdate()
@ -335,20 +298,4 @@ public class PlanController extends ControllerBase {
planModelItemService.saveBatch(items); planModelItemService.saveBatch(items);
return ApiResult.success(); return ApiResult.success();
} }
/**
* 当前用户是否可以多区域报价
*/
@GetMapping("/canMultiRegionQuotations")
public ApiResult<Boolean> canMultiRegionQuotations() {
return ApiResult.success(isMultiRegionQuotationsUser());
}
private Boolean isMultiRegionQuotationsUser() {
if (AppUserUtil.isAgent() || AppUserUtil.isEndUser()) {
return false;
} else {
return adminRoleService.hasBindCode(AppUserUtil.getUserId(), "MultiRegionQuotationsSupplier");
}
}
} }

View File

@ -1,21 +0,0 @@
package com.nflg.mobilebroken.quotation.pojo.vo;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
@Data
@Accessors(chain = true)
public class DefaultRatioVO {
/**
* 比例
*/
private BigDecimal ratio;
/**
* 区域国内/国外字典id
*/
private Long areaId;
}

View File

@ -31,11 +31,6 @@ public class QuotationUserPlanDefault implements Serializable {
*/ */
private BigDecimal ratio; private BigDecimal ratio;
/**
* 区域国内/国外字典id
*/
private Long areaId;
/** /**
* 用户类型0内部人员1代理商 * 用户类型0内部人员1代理商
*/ */

View File

@ -46,11 +46,6 @@ public class QuotationUserPlanModelItem implements Serializable {
*/ */
private BigDecimal ratio; private BigDecimal ratio;
/**
* 区域国内/国外字典id
*/
private Long areaId;
/** /**
* 是否默认 * 是否默认
*/ */

View File

@ -28,6 +28,4 @@ public interface AdminRoleMapper extends BaseMapper<AdminRole> {
IPage<RoleVO> search(RoleSearchRequest request, Page<?> page); IPage<RoleVO> search(RoleSearchRequest request, Page<?> page);
List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId); List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId);
Boolean hasBindCode(Integer userId, String roleCode);
} }

View File

@ -36,6 +36,4 @@ public interface IAdminRoleService extends IService<AdminRole> {
IPage<RoleVO> search(RoleSearchRequest request); IPage<RoleVO> search(RoleSearchRequest request);
List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId); List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId);
Boolean hasBindCode(Integer userId, String roleCode);
} }

View File

@ -20,7 +20,7 @@ public interface IAdminUserRoleMapService extends IService<AdminUserRoleMap> {
void authorize(AuthorizeUserRequest request); void authorize(AuthorizeUserRequest request);
List<AdminUserVO> getAuthorizeUser(Long roleId); List<AdminUserVO> getAuthorizeUser(Integer roleId);
List<RoleVO> getRoleList(Integer id); List<RoleVO> getRoleList(Integer id);
} }

View File

@ -113,9 +113,4 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole
public List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId) { public List<ButtonVO> getButtonsByMenuId(Integer userId,Long menuId) {
return baseMapper.getButtonsByMenuId(userId,menuId); return baseMapper.getButtonsByMenuId(userId,menuId);
} }
@Override
public Boolean hasBindCode(Integer userId, String roleCode) {
return baseMapper.hasBindCode(userId, roleCode);
}
} }

View File

@ -48,7 +48,7 @@ public class AdminUserRoleMapServiceImpl extends ServiceImpl<AdminUserRoleMapMap
} }
@Override @Override
public List<AdminUserVO> getAuthorizeUser(Long roleId) { public List<AdminUserVO> getAuthorizeUser(Integer roleId) {
List<Integer> userIds = lambdaQuery().eq(AdminUserRoleMap::getRoleId, roleId).list().stream().map(AdminUserRoleMap::getUserId).collect(Collectors.toList()); List<Integer> userIds = lambdaQuery().eq(AdminUserRoleMap::getRoleId, roleId).list().stream().map(AdminUserRoleMap::getUserId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(userIds)) { if (CollectionUtil.isEmpty(userIds)) {
return Collections.emptyList(); return Collections.emptyList();

View File

@ -255,8 +255,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
.filter(r -> rmaps.contains(r.getId())) .filter(r -> rmaps.contains(r.getId()))
.map(r -> new RoleSimpleVO().setId(r.getId()).setName(r.getName())) .map(r -> new RoleSimpleVO().setId(r.getId()).setName(r.getName()))
.collect(Collectors.toSet()) .collect(Collectors.toSet())
) );
.setAreaIds(Arrays.stream(StrUtil.splitToInt(u.getAreaIds(),",")).boxed().collect(Collectors.toList()));
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
return pageData; return pageData;
} }

View File

@ -52,13 +52,4 @@
INNER JOIN admin_user_role_map urm ON urm.role_id=r.id INNER JOIN admin_user_role_map urm ON urm.role_id=r.id
WHERE mb.`enable`=1 AND mb.menu_id=#{menuId} AND urm.user_id=#{userId} WHERE mb.`enable`=1 AND mb.menu_id=#{menuId} AND urm.user_id=#{userId}
</select> </select>
<select id="hasBindCode" resultType="java.lang.Boolean">
SELECT EXISTS(
SELECT 1
FROM admin_user_role_map aurm
INNER JOIN admin_role ar ON aurm.role_id=ar.id
WHERE aurm.user_id=#{userId} AND ar.code=#{roleCode}
)
</select>
</mapper> </mapper>

View File

@ -10,13 +10,11 @@
</select> </select>
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.PlanSearchItemVO"> <select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.PlanSearchItemVO">
SELECT qupmi.id,qupmi.plan_id,pm.batch_number as 'modelId',pm.`no` as SELECT qupmi.id,qupmi.plan_id,pm.batch_number as 'modelId',pm.`no` as 'modelNo',qupmi.`name`,qupmi.ratio,qupmi.is_default
'modelNo',qupmi.`name`,qupmi.ratio,qupmi.is_default,qupmi.area_id
FROM v_quotation_model_price vqmp FROM v_quotation_model_price vqmp
inner join product_model pm on vqmp.model_id=pm.batch_number inner join product_model pm on vqmp.model_id=pm.batch_number
LEFT JOIN quotation_user_plan_model_item qupmi ON qupmi.model_id=pm.batch_number LEFT JOIN quotation_user_plan_model_item qupmi ON qupmi.model_id=pm.batch_number
left join quotation_user_plan_model qupm on qupmi.plan_id=qupm.id and qupm.`status`=1 and left join quotation_user_plan_model qupm on qupmi.plan_id=qupm.id and qupm.`status`=1 and qupm.create_by_type=#{userType} and qupm.create_by_id=#{userId}
qupm.create_by_type=#{userType} and qupm.create_by_id=#{userId}
WHERE pm.state=1 WHERE pm.state=1
<if test="request.no!=null and request.no!=''"> <if test="request.no!=null and request.no!=''">
and pm.no like CONCAT('%', #{request.no}, '%') and pm.no like CONCAT('%', #{request.no}, '%')