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")
@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));
}
}

View File

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

View File

@ -38,11 +38,6 @@ public class PlanSearchItemVO {
@NotNull
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.util.*;
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.QuotationModelRatioVO;
import com.nflg.mobilebroken.repository.entity.*;
@ -61,29 +60,16 @@ public class PlanController extends ControllerBase {
@Resource
private IQuotationModelRatioDirectItemService ratioDirectItemService;
@Resource
private IAdminRoleService adminRoleService;
@Resource
private IDictionaryItemService dictionaryItemService;
/**
* 获取方案默认系数
*/
@GetMapping("/getDefaultRatio")
public ApiResult<List<DefaultRatioVO>> getDefaultRatio() {
return ApiResult.success(
planDefaultService.lambdaQuery()
public ApiResult<BigDecimal> getDefaultRatio() {
QuotationUserPlanDefault planDefault = planDefaultService.lambdaQuery()
.eq(QuotationUserPlanDefault::getCreateByType, AppUserUtil.isAgent() ? 1 : 0)
.eq(QuotationUserPlanDefault::getCreateById, AppUserUtil.getUserId())
.list()
.stream()
.map(pd -> new DefaultRatioVO()
.setAreaId(pd.getAreaId())
.setRatio(pd.getRatio())
)
.collect(Collectors.toList())
);
.one();
return ApiResult.success(Objects.isNull(planDefault) ? null : planDefault.getRatio());
}
/**
@ -134,39 +120,16 @@ public class PlanController extends ControllerBase {
List<PlanSearchItemVO> datas = new ArrayList<>();
pageData.setItems(datas);
vo.setDatas(pageData);
boolean multiRegionQuotations = isMultiRegionQuotationsUser();
List<Long> categoryIds = new ArrayList<>();
if (multiRegionQuotations) {
categoryIds = dictionaryItemService.getListByDictionaryCode("MultiRegionQuotationsSupplier")
.stream()
.map(DictionaryItem::getId)
.collect(Collectors.toList());
} else {
categoryIds.add(getCategoryId());
}
Long categoryId = getCategoryId();
List<ModelPriceVO> prices = priceService.getAllModelPrice();
Map<Long, List<PlanSearchItemVO>> fgroup = items.stream().collect(Collectors.groupingBy(PlanSearchItemVO::getModelId));
for (Map.Entry<Long, List<PlanSearchItemVO>> entry : fgroup.entrySet()) {
if (index >= startIndex && index < endIndex) {
categoryIds.forEach(categoryId -> {
BigDecimal salePrice = getSalePrice(entry.getKey(), categoryId, prices);
List<PlanSearchItemVO> vos = entry.getValue()
.stream()
.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);
});
}
});
}
}
return ApiResult.success(vo);
@ -335,20 +298,4 @@ public class PlanController extends ControllerBase {
planModelItemService.saveBatch(items);
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;
/**
* 区域国内/国外字典id
*/
private Long areaId;
/**
* 用户类型0内部人员1代理商
*/

View File

@ -46,11 +46,6 @@ public class QuotationUserPlanModelItem implements Serializable {
*/
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);
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);
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);
List<AdminUserVO> getAuthorizeUser(Long roleId);
List<AdminUserVO> getAuthorizeUser(Integer roleId);
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) {
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
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());
if (CollectionUtil.isEmpty(userIds)) {
return Collections.emptyList();

View File

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

View File

@ -52,13 +52,4 @@
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}
</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>

View File

@ -10,13 +10,11 @@
</select>
<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
'modelNo',qupmi.`name`,qupmi.ratio,qupmi.is_default,qupmi.area_id
SELECT qupmi.id,qupmi.plan_id,pm.batch_number as 'modelId',pm.`no` as 'modelNo',qupmi.`name`,qupmi.ratio,qupmi.is_default
FROM v_quotation_model_price vqmp
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 qupm on qupmi.plan_id=qupm.id and qupm.`status`=1 and
qupm.create_by_type=#{userType} and qupm.create_by_id=#{userId}
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}
WHERE pm.state=1
<if test="request.no!=null and request.no!=''">
and pm.no like CONCAT('%', #{request.no}, '%')