| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.BaseParamMapper; |
| | | import com.doumee.dao.business.PricingDetailMapper; |
| | | import com.doumee.dao.business.join.PricingDetailJoinMapper; |
| | | import com.doumee.dao.business.model.BaseParam; |
| | | import com.doumee.dao.business.model.PricingDetail; |
| | | import com.doumee.service.business.BaseParamService; |
| | | import com.doumee.service.business.PricingDetailService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.collections.MapUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import sun.text.resources.et.CollationData_et; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 定价方案明细配置Service实现 |
| | |
| | | |
| | | @Autowired |
| | | PricingDetailJoinMapper pricingDetailJoinMapper; |
| | | |
| | | @Autowired |
| | | BaseParamMapper baseParamMapper; |
| | | |
| | | |
| | | @Override |
| | | public String create(PricingDetail pricingDetail) { |
| | |
| | | @Override |
| | | public List<PricingDetail> findList(PricingDetail pricingDetail) { |
| | | MPJLambdaWrapper<PricingDetail> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.leftJoin(BaseParam.class,BaseParam::getId,PricingDetail::getBikeTypeId) |
| | | .eq(PricingDetail::getPricePramId,pricingDetail.getPricePramId()) |
| | | .eq(BaseParam::getType,Constants.THREE); |
| | | wrapper.selectAll(PricingDetail.class) |
| | | .selectAs(BaseParam::getName,PricingDetail::getBikeTypeName); |
| | | List<PricingDetail> result = pricingDetailJoinMapper.selectJoinList(PricingDetail.class,wrapper); |
| | | if(result!=null){ |
| | | for(PricingDetail model :result){ |
| | | model.setBasePrice(Constants.translateMoney(model.getBasePrice())); |
| | | model.setHolidayBasePrice(Constants.translateMoney(model.getHolidayBasePrice())); |
| | | model.setUnitPrice(Constants.translateMoney(model.getUnitPrice())); |
| | | model.setHolidayUnitPrice(Constants.translateMoney(model.getHolidayUnitPrice())); |
| | | } |
| | | wrapper.eq(PricingDetail::getPricePramId,pricingDetail.getPricePramId()) |
| | | .eq(PricingDetail::getIsdeleted,Constants.ZERO); |
| | | wrapper.selectAll(PricingDetail.class); |
| | | List<PricingDetail> result = pricingDetailMapper.selectList(wrapper); |
| | | |
| | | Map<String, PricingDetail> stringPricingDetailMap = Optional.ofNullable(result) |
| | | .map(s -> s.stream().collect(Collectors.toMap(p -> p.getBikeTypeId(), p -> p))) |
| | | .orElse(new HashMap<>()); |
| | | QueryWrapper<BaseParam> baseParamQuery = new QueryWrapper(); |
| | | baseParamQuery.lambda() |
| | | .eq(BaseParam::getIsdeleted,Constants.ZERO) |
| | | .eq(BaseParam::getType,Constants.THREE) |
| | | .orderByAsc(BaseParam::getSortnum); |
| | | List<BaseParam> list = baseParamMapper.selectList(baseParamQuery); |
| | | if (CollectionUtils.isEmpty(list)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"内置数据确实"); |
| | | } |
| | | return result; |
| | | |
| | | List<PricingDetail> collect = list.stream().map(s -> { |
| | | PricingDetail put = stringPricingDetailMap.getOrDefault(s.getId(), new PricingDetail()); |
| | | put.setBikeTypeId(s.getId()); |
| | | put.setBikeTypeName(s.getName()); |
| | | return put; |
| | | }).collect(Collectors.toList()); |
| | | // if(result!=null){ |
| | | // for(PricingDetail model :result){ |
| | | // model.setBasePrice(Constants.translateMoney(model.getBasePrice())); |
| | | // model.setHolidayBasePrice(Constants.translateMoney(model.getHolidayBasePrice())); |
| | | // model.setUnitPrice(Constants.translateMoney(model.getUnitPrice())); |
| | | // model.setHolidayUnitPrice(Constants.translateMoney(model.getHolidayUnitPrice())); |
| | | // } |
| | | // } |
| | | return collect; |
| | | } |
| | | |
| | | @Override |