parent
d1062d72f5
commit
cf24a90f84
|
|
@ -0,0 +1,55 @@
|
|||
package com.nflg.mobilebroken.common.pojo.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EditQuotationDiscountRequest {
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private Integer modelId;
|
||||
|
||||
/**
|
||||
* 国内折扣
|
||||
*/
|
||||
private BigDecimal domesticDiscountRate;
|
||||
|
||||
/**
|
||||
* 国内折扣开始时间
|
||||
*/
|
||||
private LocalDateTime domesticBeginTime;
|
||||
|
||||
/**
|
||||
* 国内折扣结束时间
|
||||
*/
|
||||
private LocalDateTime domesticEndTime;
|
||||
|
||||
/**
|
||||
* 国内折扣率
|
||||
*/
|
||||
private BigDecimal overseasDiscountRate;
|
||||
|
||||
/**
|
||||
* 国外折扣开始时间
|
||||
*/
|
||||
private LocalDateTime overseasBeginTime;
|
||||
|
||||
/**
|
||||
* 国外折扣结束时间
|
||||
*/
|
||||
private LocalDateTime overseasEndTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class QuotationDiscountVO {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
@NotNull
|
||||
private Integer modelId;
|
||||
|
||||
/**
|
||||
* 国内折扣
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal domesticDiscountRate;
|
||||
|
||||
/**
|
||||
* 国内折扣开始时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime domesticBeginTime;
|
||||
|
||||
/**
|
||||
* 国内折扣结束时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime domesticEndTime;
|
||||
|
||||
/**
|
||||
* 折扣天数
|
||||
*/
|
||||
@NotNull
|
||||
private Integer domesticDiscountDay;
|
||||
|
||||
/**
|
||||
* 国内折扣率
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal overseasDiscountRate;
|
||||
|
||||
/**
|
||||
* 国外折扣开始时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime overseasBeginTime;
|
||||
|
||||
/**
|
||||
* 国外折扣结束时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDateTime overseasEndTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.mobilebroken.quotation.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface ApiMark {
|
||||
|
||||
String apiName() default "";
|
||||
|
||||
String moduleName() default "";
|
||||
|
||||
String code() default "";
|
||||
|
||||
boolean isPublic() default false;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.nflg.mobilebroken.quotation.controller;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Validated
|
||||
@RestController
|
||||
public class ControllerBase {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.nflg.mobilebroken.quotation.controller;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.request.EditQuotationDiscountRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DepartmentSimpleVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.QuotationDiscountVO;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.quotation.annotation.ApiMark;
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscount;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/discount")
|
||||
@Slf4j
|
||||
public class QuotationModelDiscountController extends ControllerBase {
|
||||
@PostMapping("save")
|
||||
@ApiMark(moduleName = "折扣管理", apiName = "保存设备的折扣信息")
|
||||
public ApiResult<Void> getSimpleDepartments(List<EditQuotationDiscountRequest> requests) {
|
||||
List<QuotationModelDiscount> addDatas = requests.stream()
|
||||
.filter(request -> Objects.isNull(request.getId()))
|
||||
.map(request -> {
|
||||
return new QuotationModelDiscount()
|
||||
.setModelId(request.getModelId())
|
||||
.setDomesticDiscountRate(request.getDomesticDiscountRate())
|
||||
.setDomesticBeginTime(request.getDomesticBeginTime())
|
||||
.setDomesticEndTime(request.getDomesticEndTime())
|
||||
.setDomesticDiscountDay(Math.toIntExact(ChronoUnit.DAYS.between(request.getDomesticBeginTime(), request.getDomesticEndTime())))
|
||||
.setOverseasBeginTime(request.getOverseasBeginTime())
|
||||
.setOverseasEndTime(request.getOverseasEndTime())
|
||||
.setOverseasDiscountRate(request.getOverseasDiscountRate())
|
||||
.setOverseasDiscountDay(Math.toIntExact(ChronoUnit.DAYS.between(request.getOverseasBeginTime(), request.getOverseasEndTime())))
|
||||
.setCreateById(AdminUserUtil.getUserId())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<QuotationModelDiscount> editDatas = requests.stream()
|
||||
.filter(request -> Objects.nonNull(request.getId()))
|
||||
.map(request -> {
|
||||
return new QuotationModelDiscount()
|
||||
.setId(request.getId())
|
||||
.setModelId(request.getModelId())
|
||||
.setDomesticDiscountRate(request.getDomesticDiscountRate())
|
||||
.setDomesticBeginTime(request.getDomesticBeginTime())
|
||||
.setDomesticEndTime(request.getDomesticEndTime())
|
||||
.setDomesticDiscountDay(Math.toIntExact(ChronoUnit.DAYS.between(request.getDomesticBeginTime(), request.getDomesticEndTime())))
|
||||
.setOverseasBeginTime(request.getOverseasBeginTime())
|
||||
.setOverseasEndTime(request.getOverseasEndTime())
|
||||
.setOverseasDiscountRate(request.getOverseasDiscountRate())
|
||||
.setOverseasDiscountDay(Math.toIntExact(ChronoUnit.DAYS.between(request.getOverseasBeginTime(), request.getOverseasEndTime())))
|
||||
.setUpdateById(AdminUserUtil.getUserId())
|
||||
.setUpdateBy(AdminUserUtil.getUserName())
|
||||
.setUpdateTime(LocalDateTime.now());
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// List<QuotationModelDiscount> datas = requests.stream()
|
||||
// .map(request -> {
|
||||
// QuotationModelDiscount discount = new QuotationModelDiscount();
|
||||
// discount.setModelId(request.getId());
|
||||
// discount.setDomesticDiscountRate(request.getDomesticDiscountRate());
|
||||
// discount.setDomesticBeginTime(request.getDomesticBeginTime());
|
||||
// discount.setDomesticEndTime(request.getDomesticEndTime());
|
||||
// discount.setDomesticDiscountDay(request.getDomesticDiscountDay());
|
||||
// })
|
||||
return ApiResult.success(departmentService.getSimpleDepartments());
|
||||
}
|
||||
//分页
|
||||
//保存
|
||||
//导入
|
||||
//导出
|
||||
//设置折扣人信息
|
||||
//查询折扣人信息
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
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_discount")
|
||||
public class QuotationModelDiscount implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 机型编号
|
||||
*/
|
||||
private Integer modelId;
|
||||
|
||||
/**
|
||||
* 国内折扣
|
||||
*/
|
||||
private BigDecimal domesticDiscountRate;
|
||||
|
||||
/**
|
||||
* 国内折扣开始时间
|
||||
*/
|
||||
private LocalDateTime domesticBeginTime;
|
||||
|
||||
/**
|
||||
* 国内折扣结束时间
|
||||
*/
|
||||
private LocalDateTime domesticEndTime;
|
||||
|
||||
/**
|
||||
* 折扣天数
|
||||
*/
|
||||
private Integer domesticDiscountDay;
|
||||
|
||||
/**
|
||||
* 国内折扣率
|
||||
*/
|
||||
private BigDecimal overseasDiscountRate;
|
||||
|
||||
/**
|
||||
* 国外折扣开始时间
|
||||
*/
|
||||
private LocalDateTime overseasBeginTime;
|
||||
|
||||
/**
|
||||
* 国外折扣结束时间
|
||||
*/
|
||||
private LocalDateTime overseasEndTime;
|
||||
|
||||
/**
|
||||
* 国外折扣天数
|
||||
*/
|
||||
private Integer overseasDiscountDay;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 新增人编号
|
||||
*/
|
||||
private Integer createById;
|
||||
|
||||
/**
|
||||
* 修改人编号
|
||||
*/
|
||||
private Integer updateById;
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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_discount_item")
|
||||
public class QuotationModelDiscountItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 折扣ID
|
||||
*/
|
||||
private Integer discountId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 用户类型 0 内部用户;1 代理商用户
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 新增人编号
|
||||
*/
|
||||
private Integer createById;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscountItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface QuotationModelDiscountItemMapper extends BaseMapper<QuotationModelDiscountItem> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscount;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface QuotationModelDiscountMapper extends BaseMapper<QuotationModelDiscount> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscountItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface IQuotationModelDiscountItemService extends IService<QuotationModelDiscountItem> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscount;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
public interface IQuotationModelDiscountService extends IService<QuotationModelDiscount> {
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.mobilebroken.repository.entity.AdminBaseSerialNumber;
|
||||
import com.nflg.mobilebroken.repository.mapper.AdminBaseSerialNumberMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IAdminBaseSerialNumberService;
|
||||
|
|
@ -24,7 +23,7 @@ import java.util.Objects;
|
|||
@Service
|
||||
public class AdminBaseSerialNumberServiceImpl extends ServiceImpl<AdminBaseSerialNumberMapper, AdminBaseSerialNumber> implements IAdminBaseSerialNumberService {
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
private static final int MAX_RETRY = 5; // 最大重试次数
|
||||
//private static final int MAX_RETRY = 5; // 最大重试次数
|
||||
|
||||
@Retryable(
|
||||
maxAttempts = 5, // 最大重试次数(包括第一次调用)
|
||||
|
|
@ -35,7 +34,7 @@ public class AdminBaseSerialNumberServiceImpl extends ServiceImpl<AdminBaseSeria
|
|||
public String generateSerialNumber(Integer businessType, String prefixNumber, String specialNumber,
|
||||
boolean hasTimeStr, Integer serialLength) {
|
||||
String currentDate = "";
|
||||
String serialNo = "";
|
||||
String serialNo ;
|
||||
AdminBaseSerialNumber serialNumber = this.lambdaQuery()
|
||||
.eq(AdminBaseSerialNumber::getBusinessType, businessType)
|
||||
.one();
|
||||
|
|
@ -55,7 +54,7 @@ public class AdminBaseSerialNumberServiceImpl extends ServiceImpl<AdminBaseSeria
|
|||
serialNo = prefixNumber + specialNumber + currentDate + String.format("%0" + serialLength + "d", 1);
|
||||
} else {
|
||||
// 判断是否有时间
|
||||
Integer startSerial = 1;
|
||||
int startSerial = 1;
|
||||
if (hasTimeStr) {
|
||||
if (serialNumber.getCurrentDateStr().equals(currentDate)) {
|
||||
startSerial = serialNumber.getMaxSerial() + 1;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscountItem;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationModelDiscountItemMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationModelDiscountItemService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Service
|
||||
public class QuotationModelDiscountItemServiceImpl extends ServiceImpl<QuotationModelDiscountItemMapper, QuotationModelDiscountItem> implements IQuotationModelDiscountItemService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.nflg.mobilebroken.repository.entity.QuotationModelDiscount;
|
||||
import com.nflg.mobilebroken.repository.mapper.QuotationModelDiscountMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IQuotationModelDiscountService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2026
|
||||
*/
|
||||
@Service
|
||||
public class QuotationModelDiscountServiceImpl extends ServiceImpl<QuotationModelDiscountMapper, QuotationModelDiscount> implements IQuotationModelDiscountService {
|
||||
|
||||
}
|
||||
|
|
@ -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.QuotationModelDiscountItemMapper">
|
||||
|
||||
</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.QuotationModelDiscountMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
, Paths.get(System.getProperty("user.dir")) + "/src/main/resources/mapper"))
|
||||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder.addInclude("t_base_area") //只生成指定表
|
||||
builder.addInclude("quotation_model_discount_item") //只生成指定表
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue