Compare commits
2 Commits
6b4ce63ff4
...
8c12488b2d
| Author | SHA1 | Date |
|---|---|---|
|
|
8c12488b2d | |
|
|
6e5a1375cd |
|
|
@ -13,7 +13,7 @@ import java.util.Objects;
|
|||
@Accessors(chain = true)
|
||||
public class ModelPriceConfigVO {
|
||||
|
||||
private Long id;
|
||||
// private Long id;
|
||||
|
||||
/**
|
||||
* 机型表batch_number
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ModelPriceVO {
|
||||
|
||||
/**
|
||||
* 机型表batch_number
|
||||
*/
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* 价格区域,字典id
|
||||
*/
|
||||
private Long areaId;
|
||||
|
||||
/**
|
||||
* 价格,单位:元
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
}
|
||||
|
|
@ -29,6 +29,11 @@ public class PermissionRoleApiMapVO {
|
|||
*/
|
||||
private Long apiId;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 功能名称
|
||||
*/
|
||||
|
|
@ -40,22 +45,27 @@ public class PermissionRoleApiMapVO {
|
|||
private Integer type;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 是否选中
|
||||
*/
|
||||
private String createBy;
|
||||
private Boolean selected=false;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
// /**
|
||||
// * 创建人
|
||||
// */
|
||||
// private String createBy;
|
||||
//
|
||||
// /**
|
||||
// * 创建时间
|
||||
// */
|
||||
// private LocalDateTime createTime;
|
||||
//
|
||||
// /**
|
||||
// * 最后更新人
|
||||
// */
|
||||
// private String updateBy;
|
||||
//
|
||||
// /**
|
||||
// * 最后更新时间
|
||||
// */
|
||||
// private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,11 @@ public class NumberUtil {
|
|||
}
|
||||
return df.format(number);
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
if (Objects.isNull(num1) || Objects.isNull(num2)) {
|
||||
return null;
|
||||
}
|
||||
return num1.multiply(num2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,6 +304,8 @@ public class PriceConfigController extends ControllerBase {
|
|||
List<QuotationModelPriceItem> itemsForAdd = new ArrayList<>();
|
||||
price.setId(IdUtil.getSnowflakeNextId());
|
||||
price.setConfigId(null);
|
||||
price.setPriceVersion(null);
|
||||
price.setPriceStatus(0);
|
||||
price.setUpdateById(AdminUserUtil.getUserId());
|
||||
price.setUpdateBy(AdminUserUtil.getUserName());
|
||||
price.setUpdateTime(LocalDateTime.now());
|
||||
|
|
@ -328,7 +330,6 @@ public class PriceConfigController extends ControllerBase {
|
|||
area.setId(IdUtil.getSnowflakeNextId());
|
||||
area.setPriceId(price.getId());
|
||||
area.setAmount(new BigDecimal(map.get(category.getCode())));
|
||||
areasForAdd.add(area);
|
||||
} else {
|
||||
areasForAdd.add(new QuotationModelPriceItemArea()
|
||||
.setAreaId(category.getId())
|
||||
|
|
@ -370,12 +371,23 @@ public class PriceConfigController extends ControllerBase {
|
|||
.orElse(null);
|
||||
if (Objects.nonNull(area)) {
|
||||
area.setAmount(new BigDecimal(map.get(category.getCode())));
|
||||
areasForAdd.add(area);
|
||||
}else {
|
||||
areasForAdd.add(new QuotationModelPriceItemArea()
|
||||
.setAreaId(category.getId())
|
||||
.setPriceId(price.getId())
|
||||
.setPriceItemId(0L)
|
||||
.setAmount(new BigDecimal(map.get(category.getCode())))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
priceService.save(price);
|
||||
if (CollectionUtil.isNotEmpty(itemsForAdd)) {
|
||||
priceItemService.saveBatch(itemsForAdd);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dbItems)) {
|
||||
for (QuotationModelPriceItem item : dbItems) {
|
||||
Long itemId = IdUtil.getSnowflakeNextId();
|
||||
item.setUpdateById(AdminUserUtil.getUserId());
|
||||
|
|
@ -387,14 +399,13 @@ public class PriceConfigController extends ControllerBase {
|
|||
.forEach(area -> area.setPriceItemId(itemId));
|
||||
item.setId(itemId);
|
||||
}
|
||||
priceService.save(price);
|
||||
if (CollectionUtil.isNotEmpty(itemsForAdd)) {
|
||||
priceItemService.saveBatch(itemsForAdd);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(dbItems)) {
|
||||
priceItemService.saveBatch(dbItems);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(areasForAdd)) {
|
||||
for (QuotationModelPriceItemArea area : areasForAdd) {
|
||||
area.setId(IdUtil.getSnowflakeNextId());
|
||||
area.setPriceId(price.getId());
|
||||
}
|
||||
priceItemAreaService.saveBatch(areasForAdd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,276 @@
|
|||
package com.nflg.mobilebroken.quotation.controller.admin;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.constant.Constant;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DynamicHeaderVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelSimpleVO;
|
||||
import com.nflg.mobilebroken.common.util.*;
|
||||
import com.nflg.mobilebroken.quotation.controller.ControllerBase;
|
||||
import com.nflg.mobilebroken.quotation.pojo.vo.RatioAgentSearchVO;
|
||||
import com.nflg.mobilebroken.repository.entity.*;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 代理商配置系数
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ratio/agent")
|
||||
public class RatioAgentController extends ControllerBase {
|
||||
|
||||
@Resource
|
||||
private IAppUserService appUserService;
|
||||
|
||||
@Resource
|
||||
private ITBaseCustomerService customerService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
@Resource
|
||||
private IQuotationModelRatioAgentService ratioAgentService;
|
||||
|
||||
@Resource
|
||||
private IQuotationModelRatioAgentItemService ratioAgentItemService;
|
||||
|
||||
@Resource
|
||||
private IQuotationModelPriceService priceService;
|
||||
|
||||
/**
|
||||
* 获取动态表头
|
||||
*/
|
||||
@GetMapping("/headers")
|
||||
public ApiResult<List<DynamicHeaderVO>> getHeaders() {
|
||||
List<DynamicHeaderVO> vos = new ArrayList<>();
|
||||
vos.add(new DynamicHeaderVO()
|
||||
.setProp("appUser")
|
||||
.setLabel("代理商账号")
|
||||
.setChildren(new ArrayList<>() {
|
||||
{
|
||||
add(new DynamicHeaderVO().setProp("modelNo").setLabel("机型"));
|
||||
}
|
||||
})
|
||||
);
|
||||
List<TBaseCustomer> customers = customerService.lambdaQuery()
|
||||
.select(TBaseCustomer::getId, TBaseCustomer::getCategoryId)
|
||||
.eq(TBaseCustomer::getDelIs, 0)
|
||||
.eq(TBaseCustomer::getEnableState, 1)
|
||||
.list();
|
||||
List<DictionaryItem> categories = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_DIRECT_SALES_CATEGORY);
|
||||
List<AppUser> users = appUserService.lambdaQuery()
|
||||
.eq(AppUser::getIsDel, false)
|
||||
.eq(AppUser::getIsPrimary, true)
|
||||
.list();
|
||||
users.forEach(user -> {
|
||||
TBaseCustomer customer = customers.stream()
|
||||
.filter(cit -> StrUtil.split(user.getCompanyId(), ',').contains(cit.getId().toString()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
String categoryName;
|
||||
if (Objects.nonNull(customer)) {
|
||||
DictionaryItem category = categories.stream()
|
||||
.filter(cit -> cit.getId().equals(customer.getCategoryId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(category)) {
|
||||
categoryName = category.getName();
|
||||
} else {
|
||||
categoryName = null;
|
||||
}
|
||||
} else {
|
||||
categoryName = null;
|
||||
}
|
||||
if (StrUtil.isNotBlank(categoryName)) {
|
||||
DynamicHeaderVO avo = new DynamicHeaderVO()
|
||||
.setProp(user.getId().toString())
|
||||
.setLabel(user.getName())
|
||||
.setChildren(new ArrayList<>() {
|
||||
{
|
||||
add(new DynamicHeaderVO().setProp(user.getId().toString() + "-standardPrice").setLabel("标配价(" + categoryName + ")"));
|
||||
add(new DynamicHeaderVO().setProp(user.getId().toString() + "-standardRatio").setLabel("标配系数"));
|
||||
add(new DynamicHeaderVO().setProp(user.getId().toString() + "-optionalRatio").setLabel("选配系数"));
|
||||
add(new DynamicHeaderVO().setProp(user.getId().toString() + "-salePrice").setLabel("市场价(" + categoryName + ")"));
|
||||
}
|
||||
});
|
||||
vos.add(avo);
|
||||
}
|
||||
});
|
||||
return ApiResult.success(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
@PostMapping("/search")
|
||||
public ApiResult<RatioAgentSearchVO> search(@Valid @RequestBody ModelConfigSearchRequest request) {
|
||||
RatioAgentSearchVO vo = new RatioAgentSearchVO();
|
||||
QuotationModelRatioAgent ratioAgent = ratioAgentService.lambdaQuery()
|
||||
.eq(QuotationModelRatioAgent::getStatus, 1)
|
||||
.one();
|
||||
vo.setInfo(ratioAgent);
|
||||
IPage<ProductModelSimpleVO> pdatas = ratioAgentService.search(request);
|
||||
if (CollectionUtil.isEmpty(pdatas.getRecords())) {
|
||||
vo.setPageData(PageData.empty());
|
||||
return ApiResult.success(vo);
|
||||
}
|
||||
List<TBaseCustomer> customers = customerService.lambdaQuery()
|
||||
.select(TBaseCustomer::getId, TBaseCustomer::getCategoryId)
|
||||
.eq(TBaseCustomer::getDelIs, 0)
|
||||
.eq(TBaseCustomer::getEnableState, 1)
|
||||
.list();
|
||||
List<DictionaryItem> categories = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_DIRECT_SALES_CATEGORY);
|
||||
List<AppUser> users = appUserService.lambdaQuery()
|
||||
.eq(AppUser::getIsDel, false)
|
||||
.eq(AppUser::getIsPrimary, true)
|
||||
.list();
|
||||
List<QuotationModelRatioAgentItem> items = Objects.isNull(ratioAgent) ? Collections.emptyList() : ratioAgentItemService.lambdaQuery()
|
||||
.eq(QuotationModelRatioAgentItem::getRatioId, ratioAgent.getId())
|
||||
.list();
|
||||
List<ModelPriceVO> prices = priceService.getAllModelPrice();
|
||||
PageData<Map<String, Object>> mdatas = new PageData<>();
|
||||
mdatas.setPage((int) pdatas.getCurrent());
|
||||
mdatas.setPageSize((int) pdatas.getSize());
|
||||
mdatas.setTotal((int) pdatas.getTotal());
|
||||
mdatas.setItems(pdatas.getRecords()
|
||||
.stream()
|
||||
.map(data -> {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("modelId", data.getBatchNumber());
|
||||
map.put("modelNo", data.getNo());
|
||||
ModelPriceVO modelPrice = prices.stream()
|
||||
.filter(it -> it.getModelId().equals(data.getBatchNumber()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
users.forEach(user -> {
|
||||
TBaseCustomer customer = customers.stream()
|
||||
.filter(cit -> StrUtil.split(user.getCompanyId(), ',').contains(cit.getId().toString()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(customer)) {
|
||||
DictionaryItem category = categories.stream()
|
||||
.filter(cit -> cit.getId().equals(customer.getCategoryId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(category)) {
|
||||
QuotationModelRatioAgentItem item = items.stream()
|
||||
.filter(it -> it.getModelId().equals(data.getBatchNumber())
|
||||
&& it.getUserId().equals(user.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
BigDecimal price = Objects.nonNull(modelPrice) ? modelPrice.getAmount() : null;
|
||||
BigDecimal standardRatio = Objects.nonNull(item) ? item.getStandardRatio() : null;
|
||||
map.put(user.getId().toString() + "-standardPrice", NumberUtil.format(price));
|
||||
map.put(user.getId().toString() + "-standardRatio", NumberUtil.format(standardRatio));
|
||||
map.put(user.getId().toString() + "-optionalRatio", NumberUtil.format(Objects.nonNull(item) ? item.getOptionalRatio() : null));
|
||||
map.put(user.getId().toString() + "-salePrice", NumberUtil.format(NumberUtil.multiply(price, standardRatio)));
|
||||
}
|
||||
}
|
||||
});
|
||||
return map;
|
||||
}).collect(Collectors.toList())
|
||||
);
|
||||
vo.setPageData(mdatas);
|
||||
return ApiResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Transactional
|
||||
@PostMapping("/save")
|
||||
public ApiResult<Void> save(@RequestBody @NotEmpty List<Map<String, Object>> datas) {
|
||||
VUtils.trueThrowBusinessError(CollectionUtil.isEmpty(datas)).throwMessage("请选择要保存的数据!");
|
||||
List<Long> modelIds = datas.stream().map(data -> Long.parseLong(data.get("modelId").toString())).collect(Collectors.toList());
|
||||
QuotationModelRatioAgent ratioAgent = ratioAgentService.lambdaQuery()
|
||||
.eq(QuotationModelRatioAgent::getStatus, 1)
|
||||
.one();
|
||||
List<QuotationModelRatioAgentItem> items = Objects.isNull(ratioAgent) ? new ArrayList<>() : ratioAgentItemService.lambdaQuery()
|
||||
.eq(QuotationModelRatioAgentItem::getRatioId, ratioAgent.getId())
|
||||
.in(QuotationModelRatioAgentItem::getModelId, modelIds)
|
||||
.list();
|
||||
Long id = IdUtil.getId();
|
||||
if (Objects.nonNull(ratioAgent)) {
|
||||
ratioAgent.setId(id);
|
||||
ratioAgent.setYear(String.valueOf(LocalDateTime.now().getYear()));
|
||||
String version = ratioAgent.getVersion().substring(2);
|
||||
String day = version.split("-")[0];
|
||||
int index = Integer.parseInt(version.split("-")[1]);
|
||||
String today = DateTimeUtil.format(LocalDate.now(), "yyMMdd");
|
||||
if (today.equals(day)) {
|
||||
ratioAgent.setVersion("BP" + day + "-" + StrUtil.padPre(String.valueOf(index + 1), 2, '0'));
|
||||
} else {
|
||||
ratioAgent.setVersion("BP" + today + "-01");
|
||||
}
|
||||
} else {
|
||||
ratioAgent = new QuotationModelRatioAgent()
|
||||
.setId(id)
|
||||
.setYear(String.valueOf(LocalDateTime.now().getYear()))
|
||||
.setVersion("BP" + DateTimeUtil.format(LocalDate.now(), "yyMMdd") + "-01")
|
||||
.setStatus(1)
|
||||
.setCreateByType(0)
|
||||
.setCreateById(AdminUserUtil.getUserId())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
datas.forEach(data -> {
|
||||
Long modelId = Long.parseLong(data.get("modelId").toString());
|
||||
data.remove("modelId");
|
||||
data.remove("modelNo");
|
||||
data.forEach((key, value) -> {
|
||||
if (Objects.nonNull(value)) {
|
||||
Integer userId = Integer.parseInt(key.split("-")[0]);
|
||||
String type = key.split("-")[1];
|
||||
if ("standardRatio".equals(type) || "optionalRatio".equals(type)) {
|
||||
QuotationModelRatioAgentItem item = items.stream()
|
||||
.filter(it -> it.getUserId().equals(userId)
|
||||
&& it.getModelId().equals(modelId))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (Objects.isNull(item)) {
|
||||
item = new QuotationModelRatioAgentItem()
|
||||
.setModelId(modelId)
|
||||
.setUserId(userId);
|
||||
items.add(item);
|
||||
}
|
||||
if ("standardRatio".equals(type)) {
|
||||
item.setStandardRatio(new BigDecimal(value.toString()));
|
||||
}
|
||||
if ("optionalRatio".equals(type)) {
|
||||
item.setOptionalRatio(new BigDecimal(value.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
ratioAgentService.lambdaUpdate()
|
||||
.set(QuotationModelRatioAgent::getStatus, 2)
|
||||
.eq(QuotationModelRatioAgent::getStatus, 1)
|
||||
.update();
|
||||
ratioAgentService.save(ratioAgent);
|
||||
if (CollectionUtil.isNotEmpty(items)) {
|
||||
items.forEach(item -> {
|
||||
item.setId(IdUtil.getId());
|
||||
item.setRatioId(id);
|
||||
});
|
||||
ratioAgentItemService.saveBatch(items);
|
||||
}
|
||||
return ApiResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nflg.mobilebroken.quotation.pojo.vo;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgent;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RatioAgentSearchVO {
|
||||
|
||||
private QuotationModelRatioAgent info;
|
||||
|
||||
private PageData<Map<String, Object>> pageData;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("quotation_model_ratio_agent")
|
||||
public class QuotationModelRatioAgent implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 状态,0:草稿;1:已发布;2:已废弃
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人类型,0:内部用户;1:代理商账号
|
||||
*/
|
||||
private Integer createByType;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Integer createById;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数-子项
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("quotation_model_ratio_agent_item")
|
||||
public class QuotationModelRatioAgentItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 系数id
|
||||
*/
|
||||
private Long ratioId;
|
||||
|
||||
/**
|
||||
* 机型id
|
||||
*/
|
||||
private Long modelId;
|
||||
|
||||
/**
|
||||
* 代理商账号id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 标配系数
|
||||
*/
|
||||
private BigDecimal standardRatio;
|
||||
|
||||
/**
|
||||
* 选配系数
|
||||
*/
|
||||
private BigDecimal optionalRatio;
|
||||
}
|
||||
|
|
@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceConfigVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelPrice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelPriceItemArea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -18,4 +22,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
public interface QuotationModelPriceMapper extends BaseMapper<QuotationModelPrice> {
|
||||
|
||||
IPage<ModelPriceConfigVO> search(ModelConfigSearchRequest request, Page<?> page);
|
||||
|
||||
List<ModelPriceVO> getAllModelPrice();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgentItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数-子项 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface QuotationModelRatioAgentItemMapper extends BaseMapper<QuotationModelRatioAgentItem> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelSimpleVO;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgent;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface QuotationModelRatioAgentMapper extends BaseMapper<QuotationModelRatioAgent> {
|
||||
|
||||
IPage<ProductModelSimpleVO> search(ModelConfigSearchRequest request, Page<?> page);
|
||||
}
|
||||
|
|
@ -3,10 +3,13 @@ package com.nflg.mobilebroken.repository.service;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceConfigVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelPrice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelPriceItemArea;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -19,4 +22,6 @@ import javax.validation.Valid;
|
|||
public interface IQuotationModelPriceService extends IService<QuotationModelPrice> {
|
||||
|
||||
IPage<ModelPriceConfigVO> search(ModelConfigSearchRequest request);
|
||||
|
||||
List<ModelPriceVO> getAllModelPrice();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgentItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数-子项 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface IQuotationModelRatioAgentItemService extends IService<QuotationModelRatioAgentItem> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelSimpleVO;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgent;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface IQuotationModelRatioAgentService extends IService<QuotationModelRatioAgent> {
|
||||
|
||||
IPage<ProductModelSimpleVO> search(ModelConfigSearchRequest request);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import com.nflg.mobilebroken.common.constant.Constant;
|
|||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceConfigAreaVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceConfigVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO;
|
||||
import com.nflg.mobilebroken.repository.entity.*;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationModelPriceMapper;
|
||||
import com.nflg.mobilebroken.repository.service.*;
|
||||
|
|
@ -101,6 +102,11 @@ public class QuotationModelPriceServiceImpl extends ServiceImpl<QuotationModelPr
|
|||
return pdata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelPriceVO> getAllModelPrice() {
|
||||
return baseMapper.getAllModelPrice();
|
||||
}
|
||||
|
||||
private ModelPriceConfigVO generateVO(Long modelId, QuotationModelConfigItem configItem, List<QuotationModelConfigItem> items
|
||||
, List<QuotationModelPriceItem> priceItems, List<QuotationModelPriceItemArea> areaPrices, List<DictionaryItem> areas) {
|
||||
ModelPriceConfigVO vo = new ModelPriceConfigVO()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgentItem;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationModelRatioAgentItemMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationModelRatioAgentItemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数-子项 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Service
|
||||
public class QuotationModelRatioAgentItemServiceImpl extends ServiceImpl<QuotationModelRatioAgentItemMapper, QuotationModelRatioAgentItem> implements IQuotationModelRatioAgentItemService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.request.ModelConfigSearchRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.ProductModelSimpleVO;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelRatioAgent;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationModelRatioAgentMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationModelRatioAgentService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 报价-代理商系数 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Service
|
||||
public class QuotationModelRatioAgentServiceImpl extends ServiceImpl<QuotationModelRatioAgentMapper, QuotationModelRatioAgent> implements IQuotationModelRatioAgentService {
|
||||
|
||||
@Override
|
||||
public IPage<ProductModelSimpleVO> search(ModelConfigSearchRequest request) {
|
||||
return baseMapper.search(request,new Page<>(request.getPage(),request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
@ -3,15 +3,17 @@
|
|||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.AdminPermissionRoleApiMapMapper">
|
||||
|
||||
<select id="getList" resultType="com.nflg.mobilebroken.common.pojo.vo.PermissionRoleApiMapVO">
|
||||
SELECT map.*, t.table_name, api.api_name
|
||||
SELECT map.*, t.table_name,aa.module_name,api.api_name,true as 'selected'
|
||||
FROM admin_permission_role_api_map map
|
||||
INNER JOIN admin_permission_table t ON map.table_id = t.id
|
||||
INNER JOIN admin_permission_api api ON api.table_id = map.table_id
|
||||
INNER JOIN admin_api aa ON aa.id=api.api_id
|
||||
WHERE map.role_id = #{id}
|
||||
</select>
|
||||
<select id="getApiList" resultType="com.nflg.mobilebroken.common.pojo.vo.PermissionRoleApiMapVO">
|
||||
SELECT t.id AS 'table_id', api.id as 'api_id', null AS 'type', t.table_desc AS 'table_name', api.api_name
|
||||
SELECT t.id AS 'table_id', api.id as 'api_id', null AS 'type', t.table_desc AS 'table_name',aa.module_name, api.api_name
|
||||
FROM admin_permission_api api
|
||||
INNER JOIN admin_permission_table t ON api.table_id = t.id
|
||||
INNER JOIN admin_api aa ON aa.id=api.api_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -29,4 +29,11 @@
|
|||
</if>
|
||||
order by qmp.price_status,qmp.update_time desc,pm.id
|
||||
</select>
|
||||
|
||||
<select id="getAllModelPrice" resultType="com.nflg.mobilebroken.common.pojo.vo.ModelPriceVO">
|
||||
SELECT qmp.model_id,qmpia.area_id,qmpia.amount
|
||||
FROM quotation_model_price qmp
|
||||
INNER JOIN quotation_model_price_item_area qmpia ON qmpia.price_id=qmp.id AND qmpia.price_item_id=0
|
||||
WHERE qmp.price_status=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.QuotationModelRatioAgentItemMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.QuotationModelRatioAgentMapper">
|
||||
|
||||
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.ProductModelSimpleVO">
|
||||
SELECT pm.batch_number,pm.no
|
||||
FROM product_model pm
|
||||
LEFT JOIN product_type pt on pm.type_number=pt.batch_number AND pt.state=1
|
||||
LEFT JOIN product_series ps ON pm.series_number=ps.batch_number AND ps.state=1
|
||||
LEFT JOIN dictionary_item di ON di.id=pm.module_id
|
||||
WHERE pm.state=1
|
||||
<if test="request.moduleId!=null">
|
||||
AND pm.module_id=#{request.moduleId}
|
||||
</if>
|
||||
<if test="request.seriesNumber!=null">
|
||||
AND pm.series_number=#{request.seriesNumber}
|
||||
</if>
|
||||
<if test="request.typeNumber!=null">
|
||||
AND pm.type_number=#{request.typeNumber}
|
||||
</if>
|
||||
<if test="request.no!=null and request.no!=''">
|
||||
AND pm.`no` like concat('%', #{request.no}, '%')
|
||||
</if>
|
||||
order by pm.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
, Paths.get(System.getProperty("user.dir")) + "/src/main/resources/mapper"))
|
||||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude("quotation_model_forbid") //只生成指定表
|
||||
builder.addInclude("quotation_model_ratio_agent_item") //只生成指定表
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue