| | |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.system.vo.BusinessDataCountVO; |
| | | import com.doumee.dao.system.vo.CountDataVO; |
| | | import com.doumee.dao.system.vo.NumberDataCountVO; |
| | | import com.doumee.dao.web.dto.CollectDTO; |
| | | import com.doumee.dao.web.dto.MemberDTO; |
| | | import com.doumee.dao.web.dto.MultiFileDTO; |
| | |
| | | public class WorkbenchServiceImpl implements WorkbenchService { |
| | | @Autowired |
| | | private GoodsorderMapper goodsorderMapper; |
| | | @Autowired |
| | | private MemberCouponMapper memberCouponMapper; |
| | | @Autowired |
| | | private InviteRecordMapper inviteRecordMapper; |
| | | @Autowired |
| | | private IntegralMapper integralMapper; |
| | | @Autowired |
| | | private GoodsorderDetailMapper goodsorderDetailMapper; |
| | | @Override |
| | |
| | | return list1; |
| | | } |
| | | @Override |
| | | public NumberDataCountVO couponData(CountDataDTO param){ |
| | | NumberDataCountVO data = new NumberDataCountVO(); |
| | | //发放类型统计 |
| | | List<MemberCoupon> r1 = memberCouponMapper.selectList(new MPJLambdaWrapper<MemberCoupon>() |
| | | .select("(select count(t.id) )",MemberCoupon::getNum) |
| | | .select( MemberCoupon::getCouponType) |
| | | .apply(param.getYear()!=null,"YEAR ( t.CREATE_DATE )="+param.getYear() ) |
| | | .eq(MemberCoupon::getIsdeleted,Constants.ZERO) |
| | | .groupBy(MemberCoupon::getCouponType)); |
| | | if(r1!=null){ |
| | | for(MemberCoupon c : r1){ |
| | | if(Constants.equalsInteger(c.getCouponType(),Constants.ZERO)){ |
| | | data.setNum(Constants.formatLongNum(c.getNum()));//满减券 |
| | | }else{ |
| | | data.setNum1(Constants.formatLongNum(c.getNum()));//满减券 |
| | | } |
| | | } |
| | | } |
| | | //已使用 |
| | | Long r2 = memberCouponMapper.selectCount(new MPJLambdaWrapper<MemberCoupon>() |
| | | .apply(param.getYear()!=null,"YEAR ( t.use_Date )="+param.getYear() ) |
| | | .eq(MemberCoupon::getIsdeleted,Constants.ZERO)); |
| | | data.setUseNum(Constants.formatLongNum(r2)); |
| | | //优惠金额和交易金额 |
| | | Goodsorder r3 = goodsorderMapper.selectOne(new MPJLambdaWrapper<Goodsorder>() |
| | | .select("(select sum(t.total_price) )",Goodsorder::getTotalPrice) |
| | | .select("(select sum(t.coupon_price) )",Goodsorder::getCouponPrice) |
| | | .apply(param.getYear()!=null,"YEAR ( t.CREATE_DATE )="+param.getYear() ) |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) ); |
| | | if(r3!=null){ |
| | | data.setPrice(Constants.formatBigdecimal(r3.getCouponPrice())); |
| | | data.setOrderPrice(Constants.formatBigdecimal(r3.getTotalPrice())); |
| | | } |
| | | return data; |
| | | |
| | | } |
| | | @Override |
| | | public NumberDataCountVO integralData(CountDataDTO param){ |
| | | NumberDataCountVO data = new NumberDataCountVO(); |
| | | //发放积分类型统计 |
| | | List<Integral> r1 = integralMapper.selectList(new MPJLambdaWrapper<Integral>() |
| | | .select("(select sum(t.num) )",Integral::getNum) |
| | | .select( Integral::getObjType) |
| | | .apply(param.getYear()!=null,"YEAR ( t.CREATE_DATE )="+param.getYear() ) |
| | | .eq(Integral::getIsdeleted,Constants.ZERO) |
| | | .eq(Integral::getType,Constants.ZERO) |
| | | .in(Integral::getObjType,Constants.IntegralObjType.REGISTER.getKey(), |
| | | Constants.IntegralObjType.INVITENEWUSER.getKey(), |
| | | Constants.IntegralObjType.ORDER_DONATE.getKey(), |
| | | Constants.IntegralObjType.SYSTEM_RECHARGE.getKey()) |
| | | .groupBy(Integral::getObjType)); |
| | | if(r1!=null){ |
| | | for(Integral c : r1){ |
| | | if(Constants.equalsInteger(c.getObjType(),Constants.IntegralObjType.SYSTEM_RECHARGE.getKey())){ |
| | | data.setNum(Constants.formatBigdecimal(c.getNum()).longValue());//平台添加 |
| | | }else if(Constants.equalsInteger(c.getObjType(),Constants.IntegralObjType.INVITENEWUSER.getKey())){ |
| | | data.setNum1(Constants.formatBigdecimal(c.getNum()).longValue());//邀请 |
| | | }else if(Constants.equalsInteger(c.getObjType(),Constants.IntegralObjType.ORDER_DONATE.getKey())){ |
| | | data.setNum2(Constants.formatBigdecimal(c.getNum()).longValue());//消费返利 |
| | | }else if(Constants.equalsInteger(c.getObjType(),Constants.IntegralObjType.REGISTER.getKey())){ |
| | | data.setNum3(Constants.formatBigdecimal(c.getNum()).longValue());//注册 |
| | | } |
| | | } |
| | | } |
| | | //优惠金额和交易金额 |
| | | Goodsorder r3 = goodsorderMapper.selectOne(new MPJLambdaWrapper<Goodsorder>() |
| | | .select("(select sum(t.integral) )",Goodsorder::getIntegral) |
| | | .select("(select sum(t.use_integral) )",Goodsorder::getUseIntegral) |
| | | .apply(param.getYear()!=null,"YEAR ( t.CREATE_DATE )="+param.getYear() ) |
| | | .eq(Goodsorder::getIsdeleted,Constants.ZERO) |
| | | .in(Goodsorder::getStatus,Constants.OrderStatus.DONE.getKey(),Constants.OrderStatus.REFUND.getKey()) ); |
| | | if(r3!=null){ |
| | | data.setUseNum(Constants.formatBigdecimal(r3.getUseIntegral()).longValue()); |
| | | data.setPrice(Constants.formatBigdecimal(r3.getIntegral())); |
| | | } |
| | | return data; |
| | | |
| | | } |
| | | @Override |
| | | public BusinessDataCountVO businessData(CountDataDTO param) { |
| | | BusinessDataCountVO data = new BusinessDataCountVO(); |
| | | int dataType = param.getDateType();//0今日 1近七日 2近30日 3近1年 |