标签
This commit is contained in:
@ -32,4 +32,6 @@ public class MemberGroupBaseVO {
|
|||||||
@Schema(description = "食堂Id", example = "1")
|
@Schema(description = "食堂Id", example = "1")
|
||||||
private Long carteenId;
|
private Long carteenId;
|
||||||
|
|
||||||
|
@Schema(description = "类型", example = "1")
|
||||||
|
private Integer type;
|
||||||
}
|
}
|
||||||
|
@ -91,4 +91,9 @@ public class OrderDetailsRespVO {
|
|||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
private String faceData;
|
private String faceData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补贴金额
|
||||||
|
*/
|
||||||
|
private BigDecimal subsidyAmount;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ public class MemberTagBaseVO {
|
|||||||
* 减免类型:1-比例,2-固定金额
|
* 减免类型:1-比例,2-固定金额
|
||||||
*/
|
*/
|
||||||
@Schema(description = "减免类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "减免类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
@NotNull(message = "减免类型不能为空")
|
|
||||||
private String type;
|
private String type;
|
||||||
/**
|
/**
|
||||||
* 比例
|
* 比例
|
||||||
@ -52,5 +51,28 @@ public class MemberTagBaseVO {
|
|||||||
* 晚
|
* 晚
|
||||||
*/
|
*/
|
||||||
private BigDecimal night;
|
private BigDecimal night;
|
||||||
|
/**
|
||||||
|
* 早餐比例
|
||||||
|
*/
|
||||||
|
private Integer morningProportion;
|
||||||
|
/**
|
||||||
|
* 午餐比例
|
||||||
|
*/
|
||||||
|
private Integer noonProportion;
|
||||||
|
/**
|
||||||
|
* 晚餐比例
|
||||||
|
*/
|
||||||
|
private Integer nightProportion;
|
||||||
|
/**
|
||||||
|
* 早上基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal morningBase;
|
||||||
|
/**
|
||||||
|
* 中午基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal noonBase;
|
||||||
|
/**
|
||||||
|
* 晚上基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal nightBase;
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,9 @@ public class AppOrderRespVO {
|
|||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
private String faceData;
|
private String faceData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补贴金额
|
||||||
|
*/
|
||||||
|
private BigDecimal subsidyAmount;
|
||||||
}
|
}
|
@ -50,4 +50,9 @@ public class MemberGroupDO extends BaseDO {
|
|||||||
* 食堂Id
|
* 食堂Id
|
||||||
*/
|
*/
|
||||||
private Long carteenId;
|
private Long carteenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-行政服务中心,2-区管单位,3-盈创力和,4-私人,5-其他单位
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
}
|
}
|
||||||
|
@ -109,4 +109,9 @@ public class DishOrderDO extends BaseDO {
|
|||||||
private Boolean billingExist;
|
private Boolean billingExist;
|
||||||
|
|
||||||
private String billingNum;
|
private String billingNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补贴金额
|
||||||
|
*/
|
||||||
|
private BigDecimal subsidyAmount;
|
||||||
}
|
}
|
@ -66,4 +66,29 @@ public class MemberTagDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal night;
|
private BigDecimal night;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 早餐比例
|
||||||
|
*/
|
||||||
|
private Integer morningProportion;
|
||||||
|
/**
|
||||||
|
* 午餐比例
|
||||||
|
*/
|
||||||
|
private Integer noonProportion;
|
||||||
|
/**
|
||||||
|
* 晚餐比例
|
||||||
|
*/
|
||||||
|
private Integer nightProportion;
|
||||||
|
/**
|
||||||
|
* 早上基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal morningBase;
|
||||||
|
/**
|
||||||
|
* 中午基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal noonBase;
|
||||||
|
/**
|
||||||
|
* 晚上基础价钱
|
||||||
|
*/
|
||||||
|
private BigDecimal nightBase;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,12 @@ public class DeductionServiceImpl implements DeductionService {
|
|||||||
//BigDecimal money = user.getMoney();
|
//BigDecimal money = user.getMoney();
|
||||||
//计算减免价格
|
//计算减免价格
|
||||||
BigDecimal reductionAmount = BigDecimal.ZERO;
|
BigDecimal reductionAmount = BigDecimal.ZERO;
|
||||||
|
//补贴
|
||||||
|
BigDecimal subsidyAmount = BigDecimal.ZERO;
|
||||||
if (total.compareTo(BigDecimal.ZERO) > 0) {
|
if (total.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
reductionAmount = userService.getReductionAmount(userId, total, dishOrderDO.getCreateTime());
|
subsidyAmount = userService.getReductionAmount(userId, total, dishOrderDO.getCreateTime());
|
||||||
}
|
}
|
||||||
|
dishOrderDO.setSubsidyAmount(subsidyAmount);
|
||||||
if (dishOrderDO.getReductionAmount().compareTo(BigDecimal.ZERO) > 0) {
|
if (dishOrderDO.getReductionAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
reductionAmount = reductionAmount.add(dishOrderDO.getReductionAmount());
|
reductionAmount = reductionAmount.add(dishOrderDO.getReductionAmount());
|
||||||
dishOrderDO.setReductionAmount(reductionAmount);
|
dishOrderDO.setReductionAmount(reductionAmount);
|
||||||
@ -90,6 +93,7 @@ public class DeductionServiceImpl implements DeductionService {
|
|||||||
}
|
}
|
||||||
dishOrderDO.setReductionState(reductionAmount.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
|
dishOrderDO.setReductionState(reductionAmount.compareTo(BigDecimal.ZERO) > 0 ? "1" : "0");
|
||||||
//计算减免后的总价
|
//计算减免后的总价
|
||||||
|
reductionAmount = reductionAmount.add(subsidyAmount);
|
||||||
if (total.compareTo(reductionAmount) < 0) {
|
if (total.compareTo(reductionAmount) < 0) {
|
||||||
total = BigDecimal.ZERO;
|
total = BigDecimal.ZERO;
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,6 +65,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -582,6 +583,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
return suggestion(userId, startDate, endDate, Boolean.TRUE, null);
|
return suggestion(userId, startDate, endDate, Boolean.TRUE, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map> suggestion(Long userId, LocalDateTime startDate, LocalDateTime endDate, Boolean bol, Long orderId) {
|
public List<Map> suggestion(Long userId, LocalDateTime startDate, LocalDateTime endDate, Boolean bol, Long orderId) {
|
||||||
//查询今天的订单
|
//查询今天的订单
|
||||||
List<Long> collect = new ArrayList<>();
|
List<Long> collect = new ArrayList<>();
|
||||||
@ -678,10 +680,10 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @return
|
||||||
* @Description: 根据营养名称进行分组计算值
|
* @Description: 根据营养名称进行分组计算值
|
||||||
* @Author: qjq
|
* @Author: qjq
|
||||||
* @Date: 2024/4/12 下午2:44
|
* @Date: 2024/4/12 下午2:44
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public List<DishesNutritionRespDTO> groupingBy(List<DishesNutritionRespDTO> list) {
|
public List<DishesNutritionRespDTO> groupingBy(List<DishesNutritionRespDTO> list) {
|
||||||
List<DishesNutritionRespDTO> list1 = new ArrayList<>();
|
List<DishesNutritionRespDTO> list1 = new ArrayList<>();
|
||||||
@ -701,6 +703,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
}
|
}
|
||||||
return list1;
|
return list1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void computePercentage(List<DishesNutritionRespDTO> list) {
|
public void computePercentage(List<DishesNutritionRespDTO> list) {
|
||||||
//获取所有营养数量
|
//获取所有营养数量
|
||||||
BigDecimal sum = list.stream()
|
BigDecimal sum = list.stream()
|
||||||
@ -831,6 +834,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
public MemberUserDO getByFaceId(Long faceId) {
|
public MemberUserDO getByFaceId(Long faceId) {
|
||||||
return memberUserMapper.selectOne(new LambdaQueryWrapper<MemberUserDO>().eq(MemberUserDO::getFaceId, faceId).last("limit 1"));
|
return memberUserMapper.selectOne(new LambdaQueryWrapper<MemberUserDO>().eq(MemberUserDO::getFaceId, faceId).last("limit 1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberUserDO getByMobile(Long mobile) {
|
public MemberUserDO getByMobile(Long mobile) {
|
||||||
return memberUserMapper.selectOne(new LambdaQueryWrapper<MemberUserDO>().eq(MemberUserDO::getMobile, mobile).last("limit 1"));
|
return memberUserMapper.selectOne(new LambdaQueryWrapper<MemberUserDO>().eq(MemberUserDO::getMobile, mobile).last("limit 1"));
|
||||||
@ -865,56 +869,93 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public BigDecimal countAmount(MemberTagDO memberTagDO, BigDecimal money, String timePeriod ){
|
||||||
|
// if(memberTagDO.getType().equals("1")){
|
||||||
|
// if (memberTagDO.getTimeFlag().equals("0")){
|
||||||
|
// return money.multiply(memberTagDO.getProportion()).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
// }else {
|
||||||
|
// BigDecimal bigDecimal;
|
||||||
|
// switch (timePeriod){
|
||||||
|
// case "2":
|
||||||
|
// bigDecimal = money.multiply(memberTagDO.getMorning()).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
// break;
|
||||||
|
// case "3":
|
||||||
|
// bigDecimal = money.multiply(memberTagDO.getNoon()).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
// break;
|
||||||
|
// case "4":
|
||||||
|
// bigDecimal = money.multiply(memberTagDO.getNight()).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// bigDecimal = BigDecimal.ZERO;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return bigDecimal;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// if(memberTagDO.getType().equals("2")){
|
||||||
|
// if (memberTagDO.getTimeFlag().equals("0")){
|
||||||
|
// return memberTagDO.getAmount();
|
||||||
|
// }else {
|
||||||
|
// BigDecimal bigDecimal;
|
||||||
|
// switch (timePeriod){
|
||||||
|
// case "2":
|
||||||
|
// bigDecimal = memberTagDO.getMorning();
|
||||||
|
// break;
|
||||||
|
// case "3":
|
||||||
|
// bigDecimal = memberTagDO.getNoon();
|
||||||
|
// break;
|
||||||
|
// case "4":
|
||||||
|
// bigDecimal = memberTagDO.getNight();
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// bigDecimal = BigDecimal.ZERO;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// return bigDecimal;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// return BigDecimal.ZERO;
|
||||||
|
// }
|
||||||
|
|
||||||
public BigDecimal countAmount(MemberTagDO memberTagDO, BigDecimal money, String timePeriod) {
|
public BigDecimal countAmount(MemberTagDO memberTagDO, BigDecimal money, String timePeriod) {
|
||||||
if(memberTagDO.getType().equals("1")){
|
BigDecimal bigDecimal= BigDecimal.ZERO;
|
||||||
if (memberTagDO.getTimeFlag().equals("0")){
|
BigDecimal oneHundred = new BigDecimal("100");
|
||||||
return money.multiply(memberTagDO.getProportion()).setScale(2, RoundingMode.HALF_UP);
|
|
||||||
}else {
|
|
||||||
BigDecimal bigDecimal;
|
|
||||||
switch (timePeriod) {
|
switch (timePeriod) {
|
||||||
case "2":
|
case "2":
|
||||||
bigDecimal = money.multiply(memberTagDO.getMorning()).setScale(2, RoundingMode.HALF_UP);
|
if(money.compareTo(memberTagDO.getMorningBase())>0){
|
||||||
|
BigDecimal subsidy = money.multiply(new BigDecimal(memberTagDO.getMorningProportion())).divide(oneHundred, 2, RoundingMode.HALF_UP);
|
||||||
|
if(subsidy.compareTo(memberTagDO.getMorning())>0){
|
||||||
|
subsidy = memberTagDO.getMorning();
|
||||||
|
}
|
||||||
|
bigDecimal = subsidy;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
bigDecimal = money.multiply(memberTagDO.getNoon()).setScale(2, RoundingMode.HALF_UP);
|
if(money.compareTo(memberTagDO.getNoonBase())>0){
|
||||||
|
BigDecimal subsidy = money.multiply(new BigDecimal(memberTagDO.getNoonProportion())).divide(oneHundred, 2, RoundingMode.HALF_UP);
|
||||||
|
if(subsidy.compareTo(memberTagDO.getNoon())>0){
|
||||||
|
subsidy = memberTagDO.getNoon();
|
||||||
|
}
|
||||||
|
bigDecimal = subsidy;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
bigDecimal = money.multiply(memberTagDO.getNight()).setScale(2, RoundingMode.HALF_UP);
|
if(money.compareTo(memberTagDO.getNightBase())>0){
|
||||||
|
BigDecimal subsidy = money.multiply(new BigDecimal(memberTagDO.getNightProportion())).divide(oneHundred, 2, RoundingMode.HALF_UP);
|
||||||
|
if(subsidy.compareTo(memberTagDO.getNight())>0){
|
||||||
|
subsidy = memberTagDO.getNight();
|
||||||
|
}
|
||||||
|
bigDecimal = subsidy;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bigDecimal = BigDecimal.ZERO;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return bigDecimal;
|
return bigDecimal;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if(memberTagDO.getType().equals("2")){
|
|
||||||
if (memberTagDO.getTimeFlag().equals("0")){
|
|
||||||
return memberTagDO.getAmount();
|
|
||||||
}else {
|
|
||||||
BigDecimal bigDecimal;
|
|
||||||
switch (timePeriod){
|
|
||||||
case "2":
|
|
||||||
bigDecimal = memberTagDO.getMorning();
|
|
||||||
break;
|
|
||||||
case "3":
|
|
||||||
bigDecimal = memberTagDO.getNoon();
|
|
||||||
break;
|
|
||||||
case "4":
|
|
||||||
bigDecimal = memberTagDO.getNight();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bigDecimal = BigDecimal.ZERO;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return bigDecimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return BigDecimal.ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean delete(Long userId) {
|
public boolean delete(Long userId) {
|
||||||
@ -959,7 +1000,8 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
try {
|
try {
|
||||||
// 读取 JSON 文件并转换为 List<Person>
|
// 读取 JSON 文件并转换为 List<Person>
|
||||||
List<UserJson> people = objectMapper.readValue(new File(filePath), new TypeReference<List<UserJson>>() {});
|
List<UserJson> people = objectMapper.readValue(new File(filePath), new TypeReference<List<UserJson>>() {
|
||||||
|
});
|
||||||
|
|
||||||
ArrayList<MemberUserDO> updateList = new ArrayList<>();
|
ArrayList<MemberUserDO> updateList = new ArrayList<>();
|
||||||
for (UserJson userJson : people) {
|
for (UserJson userJson : people) {
|
||||||
|
Reference in New Issue
Block a user