购物车小数点
This commit is contained in:
@@ -3,6 +3,7 @@ package com.yxt.yythmall.api.recommendnewuserbag;
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import com.yxt.yythmall.api.appletgiftbag.GiftBagGoods;
|
||||
import com.yxt.yythmall.api.appletgiftbag.RecommendRecord;
|
||||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -34,6 +35,7 @@ public class RecommendNewUserBagVo implements Vo {
|
||||
private String weight="0";//重量
|
||||
private List<GiftBagGoods> giftBagGoods;
|
||||
private List<RecommendRecord> recordList;
|
||||
private List<NewcomerRecoRecordVo> vos;
|
||||
|
||||
public String getPrice() {
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#0.00");
|
||||
|
||||
@@ -81,8 +81,7 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
|
||||
EmpCardGrantLogService empCardGrantLogService;
|
||||
@Autowired
|
||||
EmpCardGiftGoodsService empCardGiftGoodsService;
|
||||
@Autowired
|
||||
private LpkGiftCardMapper lpkGiftCardMapper;
|
||||
|
||||
@Autowired
|
||||
private LpkReserveOrderService lpkReserveOrderService;
|
||||
@Autowired
|
||||
|
||||
@@ -26,6 +26,6 @@ public interface NewcomerRecoRecordMapper extends BaseMapper<NewcomerRecoRecord>
|
||||
List<NewcomerRecoRecord> selInOrderSid(@Param("orderSids") List<String> orderSids);
|
||||
@Select("select *,goodsNumber as num from lpk_reserve_order_goods where orderSid=#{orderSid}")
|
||||
List<NewcomerRecoRecord> selByOrderSids(String orderSid);
|
||||
@Select("select * from newcomer_reco_record r where r.customerSid =#{customerSid} and recommendedSid is not null limit 5")
|
||||
@Select("select * from newcomer_reco_record r where r.recommendSid =#{customerSid} and r.recommendedSid is not null and r.state ='2' limit 5")
|
||||
List<NewcomerRecoRecordVo> recordList(@Param("customerSid")String customerSid);
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
</foreach>
|
||||
GROUP BY s.goodsSid
|
||||
</select>
|
||||
<select id="recordList" resultType="com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo">
|
||||
select
|
||||
from newcomer_reco_record s
|
||||
left join lpk_customer d on d.sid=s.recommendSid
|
||||
left join lpk_customer c on c.sid=s.recommendedSid
|
||||
where orderSid in
|
||||
<!-- <select id="recordList" resultType="com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo">-->
|
||||
<!-- select-->
|
||||
<!-- from newcomer_reco_record s-->
|
||||
<!-- left join lpk_customer d on d.sid=s.recommendSid-->
|
||||
<!-- left join lpk_customer c on c.sid=s.recommendedSid-->
|
||||
<!-- where orderSid in-->
|
||||
|
||||
GROUP BY s.goodsSid
|
||||
</select>
|
||||
<!-- GROUP BY s.goodsSid-->
|
||||
<!-- </select>-->
|
||||
</mapper>
|
||||
@@ -1,37 +1,20 @@
|
||||
package com.yxt.yythmall.biz.newcomerrecorecord;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yxt.common.base.config.component.FileUploadComponent;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import com.yxt.common.base.utils.StringUtils;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yythmall.api.appletgiftbag.AppletGiftBag;
|
||||
import com.yxt.yythmall.api.appletgiftbag.AppletGiftBagVo;
|
||||
import com.yxt.yythmall.api.appletgiftbag.RecommendRecord;
|
||||
import com.yxt.yythmall.api.appletgiftbaggoods.AppletGiftBagGoods;
|
||||
import com.yxt.yythmall.api.empcardgiftgoods.EmpCardGiftGoodsVo;
|
||||
import com.yxt.yythmall.api.lpkcustomer.LpkCustomer;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.AppletVo;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.GoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgoods.LpkGoods;
|
||||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecord;
|
||||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordDto;
|
||||
import com.yxt.yythmall.api.newcomerrecorecord.NewcomerRecoRecordVo;
|
||||
import com.yxt.yythmall.api.recommendnewuserbag.RecommendNewUserBag;
|
||||
import com.yxt.yythmall.api.recommendnewuserbag.RecommendNewUserBagVo;
|
||||
import com.yxt.yythmall.api.recommendnewuserbagdetails.RecommendNewUserBagDetails;
|
||||
import com.yxt.yythmall.api.vegetablecellar.VegetableCellarDto;
|
||||
import com.yxt.yythmall.api.vegetablecellar.vegeVo;
|
||||
import com.yxt.yythmall.biz.appletgiftbag.AppletGiftBagService;
|
||||
import com.yxt.yythmall.biz.appletgiftbaggoods.AppletGiftBagGoodsService;
|
||||
import com.yxt.yythmall.biz.empcardgiftgoods.EmpCardGiftGoodsService;
|
||||
import com.yxt.yythmall.biz.lpkcustomer.LpkCustomerService;
|
||||
import com.yxt.yythmall.biz.lpkgiftcard.LpkGiftCardService;
|
||||
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
|
||||
import com.yxt.yythmall.biz.recommendnewuserbag.RecommendNewUserBagService;
|
||||
import com.yxt.yythmall.biz.recommendnewuserbagdetails.RecommendNewUserBagDetailsService;
|
||||
import com.yxt.yythmall.biz.vegetablecellar.VegetableCellarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -46,20 +29,16 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRecordMapper, NewcomerRecoRecord> {
|
||||
@Autowired
|
||||
AppletGiftBagGoodsService appletGiftBagGoodsService;
|
||||
@Autowired
|
||||
EmpCardGiftGoodsService empCardGiftGoodsService;
|
||||
|
||||
@Autowired
|
||||
LpkCustomerService lpkCustomerService;
|
||||
@Autowired
|
||||
VegetableCellarService vegetableCellarService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
@Autowired
|
||||
RecommendNewUserBagService recommendNewUserBagService;
|
||||
@Autowired
|
||||
RecommendNewUserBagDetailsService recommendNewUserBagDetailsService;
|
||||
@Autowired
|
||||
private FileUploadComponent fileUploadComponent;
|
||||
|
||||
public ResultBean<NewcomerRecoRecord> getReserveByCardSid(String carSid, String goodsSid) {
|
||||
ResultBean rb = new ResultBean();
|
||||
NewcomerRecoRecord goods = baseMapper.getReserveByCardSid(carSid, goodsSid);
|
||||
@@ -127,6 +106,10 @@ public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRe
|
||||
public ResultBean recordList(String customerSid) {
|
||||
ResultBean rb = new ResultBean();
|
||||
RecommendNewUserBagVo vo=new RecommendNewUserBagVo();
|
||||
List<RecommendNewUserBag> bags=recommendNewUserBagService.list(new QueryWrapper<RecommendNewUserBag>().eq("isGrounding","1"));
|
||||
RecommendNewUserBagVo bagVo=new RecommendNewUserBagVo();
|
||||
bagVo.setRemarks(bags.get(0).getRemarks());
|
||||
bagVo.setIconUrl(fileUploadComponent.getUrlPrefix()+bags.get(0).getIconUrl());
|
||||
List<NewcomerRecoRecordVo> vos=baseMapper.recordList(customerSid);
|
||||
for (NewcomerRecoRecordVo newcomerRecoRecordVo : vos) {
|
||||
RecommendNewUserBag r= recommendNewUserBagService.getOne(new QueryWrapper<RecommendNewUserBag>().eq("sid",newcomerRecoRecordVo.getGiftBagSid()));
|
||||
@@ -136,6 +119,7 @@ public class NewcomerRecoRecordService extends MybatisBaseService<NewcomerRecoRe
|
||||
LpkCustomer p=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",newcomerRecoRecordVo.getRecommendSid()));
|
||||
newcomerRecoRecordVo.setRemarks(l.getNick()+"助力您获得"+r.getName());
|
||||
}
|
||||
return rb.success().setData("助力成功");
|
||||
bagVo.setVos(vos);
|
||||
return rb.success().setData(bagVo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +152,8 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
||||
// "3.20-100斤加10%附加额。\n" +
|
||||
// "4.101斤-200斤加5%附加额。");
|
||||
vo.setCustomerSid(query.getCustomerSid());
|
||||
vo.setTotalPrice(removeZeros(String.valueOf(price)));
|
||||
vo.setTotalWeight(removeZeros(String.valueOf(weight)));
|
||||
vo.setTotalPrice(removeZeros(String.valueOf(aa(price))));
|
||||
vo.setTotalWeight(removeZeros(String.valueOf(aa(weight))));
|
||||
vo = price(vo);
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
@@ -164,6 +164,15 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
||||
vo.setRemarks("已减免附加额");
|
||||
if (weight <= 99) {
|
||||
if (weight < 20) {
|
||||
double a = 1.1;
|
||||
double d = Double.valueOf(vo.getTotalPrice());
|
||||
double t = Double.valueOf(vo.getTotalPrice()) * a;
|
||||
BigDecimal bg = new BigDecimal(t);
|
||||
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
// String c =String.valueOf(Double.valueOf(vo.getTotalPrice())-d);
|
||||
double f = Double.valueOf(vo.getTotalPrice()) - d;
|
||||
BigDecimal bgd = new BigDecimal(f);
|
||||
String c = String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
vo.setRemarks("不足20斤");
|
||||
} else {
|
||||
double a = 1.1;
|
||||
@@ -238,4 +247,9 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
||||
}
|
||||
return num;
|
||||
}
|
||||
public String aa(double a){
|
||||
BigDecimal d=new BigDecimal(a);
|
||||
double c= d.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
return String.valueOf(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,13 +42,10 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class TransferRecordsService extends MybatisBaseService<TransferRecordsMapper, TransferRecords> {
|
||||
@Autowired
|
||||
LpkGiftCardService lpkGiftCardService;
|
||||
|
||||
@Autowired
|
||||
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService;
|
||||
@Autowired
|
||||
CustomerStoreService customerStoreService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
|
||||
|
||||
|
||||
@@ -29,13 +29,10 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class TransferRecordsGoodsDetailsService extends MybatisBaseService<TransferRecordsGoodsDetailsMapper, TransferRecordsGoodsDetails> {
|
||||
@Autowired
|
||||
LpkGiftCardService lpkGiftCardService;
|
||||
|
||||
@Autowired
|
||||
VegetableCellarService vegetableCellarService;
|
||||
@Autowired
|
||||
CustomerStoreService customerStoreService;
|
||||
@Autowired
|
||||
LpkGoodsService lpkGoodsService;
|
||||
|
||||
public ResultBean<TransferRecordsGoodsDetails> getReserveByCardSid(String carSid, String goodsSid) {
|
||||
|
||||
@@ -29,8 +29,7 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class VegeCellarReserveDetailsService extends MybatisBaseService<VegeCellarReserveDetailsMapper, VegeCellarReserveDetails> {
|
||||
@Autowired
|
||||
LpkGiftCardService lpkGiftCardService;
|
||||
|
||||
@Autowired
|
||||
VegetableCellarService vegetableCellarService;
|
||||
@Autowired
|
||||
|
||||
Reference in New Issue
Block a user