| | |
| | | </parent> |
| | | <packaging>war</packaging> |
| | | |
| | | <properties> |
| | | <hutool.version>5.3.8</hutool.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- hutool工具类--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-core</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-crypto</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <!--<dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | |
| | | "微信unionid","紧急联系人","紧急联系电话","账户余额","用户标签id","状态","添加时间"}; |
| | | EntityWrapper<TAppUser> wrapper = tAppUserService.getUserListWrapper(createTime,nickname,phone,id,status); |
| | | // 是否异常 |
| | | wrapper.eq("is_exception",2); |
| | | List<TAppUser> list = tAppUserService.selectList(wrapper); |
| | | |
| | | String[][] values = new String[list.size()][]; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.controller.req.CouponSendReq; |
| | | import com.stylefeng.guns.modular.system.enums.CouponStatusEnum; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import com.stylefeng.guns.modular.system.model.TCoupon; |
| | | import com.stylefeng.guns.modular.system.service.ITCouponService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | public Object list(Integer couponType,Integer couponServiceType,String createtime) { |
| | | EntityWrapper<TCoupon> wrapper = new EntityWrapper<>(); |
| | | if(StringUtils.hasLength(condition)){ |
| | | wrapper.like("coupon_name",condition); |
| | | if(Objects.nonNull(couponType)){ |
| | | wrapper.eq("coupon_type",couponType); |
| | | } |
| | | if(Objects.nonNull(couponServiceType)){ |
| | | wrapper.eq("coupon_service_type",couponServiceType); |
| | | } |
| | | // 开始,结束时间 |
| | | if(StringUtils.hasLength(createtime)){ |
| | | String[] split = createtime.split(" - "); |
| | | Date startTime = DateUtil.getDate_str4(split[0]); |
| | | Date endTime = DateUtil.getDate_str4(split[1]); |
| | | wrapper.between("createtime",startTime,endTime); |
| | | } |
| | | wrapper.orderBy(true,"createtime",false); |
| | | wrapper.groupBy(true,"coupon_name"); |
| | | wrapper.groupBy(true,"coupon_type"); |
| | | return tCouponService.selectList(wrapper); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(TCoupon tCoupon) { |
| | | // 校验是否添加的是同类型同名称的优惠券 |
| | | Boolean isExit = tCouponService.isExit(tCoupon); |
| | | tCouponService.insert(tCoupon); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserDetailOrderResp; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserDetailOrderResp; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | TAppUserDetailOrderResp tAppUserDetailOrderResp = new TAppUserDetailOrderResp(); |
| | | BeanUtils.copyProperties(tOrder,tAppUserDetailOrderResp); |
| | | |
| | | // TODO 查询里程数等参数 |
| | | // 计算总里程 |
| | | |
| | | |
| | | // 计算总时长 |
| | | long travelTimeSum = DateUtil.between(tAppUserDetailOrderResp.getBoardingTime(), tAppUserDetailOrderResp.getGetoffTime(), DateUnit.MINUTE); |
| | | tAppUserDetailOrderResp.setTravelTimeSum(Integer.valueOf(Long.toString(travelTimeSum))); |
| | | |
| | | list.add(tAppUserDetailOrderResp); |
| | | } |
| | |
| | | @ApiModelProperty(value = "总行驶时间(分)") |
| | | private Integer travelTimeSum; |
| | | |
| | | @ApiModelProperty(value = "基础费用(元)") |
| | | private BigDecimal basicExpenses; |
| | | /*@ApiModelProperty(value = "基础费用(元)") |
| | | private BigDecimal basicExpenses;*/ |
| | | |
| | | // @ApiModelProperty(value = "等待时间(5)分钟") |
| | | // private BigDecimal waitTimePrice; |
| | | |
| | | @ApiModelProperty(value = "里程费(8.0)公里") |
| | | /*@ApiModelProperty(value = "里程费(8.0)公里") |
| | | private BigDecimal mileagePrice; |
| | | |
| | | @ApiModelProperty(value = "恶劣天气") |
| | | private Integer badWeather; |
| | | private Integer badWeather;*/ |
| | | |
| | | public Integer getMileageSum() { |
| | | return mileageSum; |
| | |
| | | this.travelTimeSum = travelTimeSum; |
| | | } |
| | | |
| | | public BigDecimal getBasicExpenses() { |
| | | /*public BigDecimal getBasicExpenses() { |
| | | return basicExpenses; |
| | | } |
| | | |
| | | public void setBasicExpenses(BigDecimal basicExpenses) { |
| | | this.basicExpenses = basicExpenses; |
| | | } |
| | | }*/ |
| | | |
| | | public BigDecimal getMileagePrice() { |
| | | /*public BigDecimal getMileagePrice() { |
| | | return mileagePrice; |
| | | } |
| | | |
| | |
| | | |
| | | public void setBadWeather(Integer badWeather) { |
| | | this.badWeather = badWeather; |
| | | } |
| | | }*/ |
| | | } |
| | |
| | | |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author stylefeng |
| | | * @since 2023-02-15 |
| | | */ |
| | | @Mapper |
| | | public interface TOrderMapper extends BaseMapper<TOrder> { |
| | | |
| | | } |
| | |
| | | <result column="coupon_preferential_amount" property="couponPreferentialAmount" /> |
| | | <result column="coupon_validity" property="couponValidity" /> |
| | | <result column="coupon_send_quantity" property="couponSendQuantity" /> |
| | | <result column="coupon_state" property="couponState" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id,user_id, createtime, coupon_name,coupon_type,coupon_code,coupon_status,coupon_service_type,coupon_conditional_amount, |
| | | coupon_preferential_amount,coupon_validity,coupon_send_quantity |
| | | coupon_preferential_amount,coupon_validity,coupon_send_quantity,coupon_state |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <result column="state" property="state" /> |
| | | <result column="status" property="status" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="startDistance" property="startLng" /> |
| | | <result column="startPrice" property="endAddress" /> |
| | | <result column="overDriveDistance" property="endLat" /> |
| | | <result column="overDrivePrice" property="endLng" /> |
| | | <result column="longDistance" property="boardingTime" /> |
| | | <result column="longDistancePrice" property="getoffTime" /> |
| | | <result column="overLongDistance" property="estimatedPrice" /> |
| | | <result column="overLongDistancePrice" property="orderMoney" /> |
| | | <result column="waitTime" property="payMoney" /> |
| | | <result column="waitTimePrice" property="discountedPrice" /> |
| | | <result column="outWaitTime" property="couponId" /> |
| | | <result column="outWaitTimePrice" property="payType" /> |
| | | <result column="badWeatherDistance" property="payTime" /> |
| | | <result column="badWeatherPrice" property="state" /> |
| | | <result column="overBadWeatherDistance" property="status" /> |
| | | <result column="overBadWeatherPrice" property="createTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, code, userId, driverId, source, agentId, branchOfficeId, startTime, startAddress, startLat, startLng, endAddress, endLat, endLng, boardingTime, getoffTime, estimatedPrice, orderMoney, payMoney, discountedPrice, couponId, payType, payTime, state, status, createTime |
| | | id, code, userId, driverId, source, agentId, branchOfficeId, startTime, startAddress, startLat, startLng, endAddress, endLat, endLng, |
| | | boardingTime, getoffTime, estimatedPrice, orderMoney, payMoney, discountedPrice, couponId, payType, payTime, state, status, createTime, |
| | | startDistance,startPrice,overDriveDistance,overDrivePrice,longDistance,longDistancePrice,overLongDistance,overLongDistancePrice, |
| | | waitTime,waitTimePrice,outWaitTime,outWaitTimePrice,badWeatherDistance,badWeatherPrice,overBadWeatherDistance,overBadWeatherPrice |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.enums; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @Description 订单状态枚举 |
| | | * @Author xiaochen |
| | | * @Date 2023/02/15 9:42 |
| | | */ |
| | | public enum OrderStateEnum { |
| | | |
| | | /*订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待评价,108=已完成,201=转单中,301=已取消)*/ |
| | | |
| | | PENDING_ORDER(101, "待接单"), |
| | | ORDER_RECEIVED(102, "已接单"), |
| | | GO_APPOINTMENT_POINT(103, "前往预约点"), |
| | | ARRIVE_APPOINTMENT_POINT(104, "到达预约点"), |
| | | START_SERVICE(105, "开始服务"), |
| | | ARRIVE_IN(106, "到达目的地"), |
| | | WAIT_EVALUATED(107, "待评价"), |
| | | FINISH(108, "已完成"), |
| | | TRANSFERRING(201, "转单中"), |
| | | CANCELED(301,"已取消"); |
| | | |
| | | private String desc; |
| | | |
| | | |
| | | private int code; |
| | | |
| | | |
| | | OrderStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static OrderStateEnum fromCode(Integer code) { |
| | | OrderStateEnum[] resultTypes = OrderStateEnum.values(); |
| | | for (OrderStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | @TableField("coupon_send_quantity") |
| | | private Integer couponSendQuantity; |
| | | |
| | | @ApiModelProperty(value = "是否冻结 1正常 2冻结") |
| | | @TableField("coupon_state") |
| | | private Integer couponState; |
| | | |
| | | public Integer getCouponState() { |
| | | return couponState; |
| | | } |
| | | |
| | | public void setCouponState(Integer couponState) { |
| | | this.couponState = couponState; |
| | | } |
| | | |
| | | public Integer getCouponValidity() { |
| | | return couponValidity; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Date payTime; |
| | | /** |
| | | * 订单状态(1=待接单,2=已接单,3=) |
| | | * 订单状态(订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待评价,108=已完成,201=转单中,301=已取消)) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | |
| | | */ |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "起步里程(公里)") |
| | | private Double startDistance; |
| | | |
| | | @ApiModelProperty(value = "起步价") |
| | | private BigDecimal startPrice; |
| | | |
| | | @ApiModelProperty(value = "超出起步里程") |
| | | private Double overDriveDistance; |
| | | |
| | | @ApiModelProperty(value = "超出起步里程费") |
| | | private BigDecimal overDrivePrice; |
| | | |
| | | @ApiModelProperty(value = "长途里程") |
| | | private String longDistance; |
| | | |
| | | @ApiModelProperty(value = "长途里程费") |
| | | private BigDecimal longDistancePrice; |
| | | |
| | | @ApiModelProperty(value = "超出长途里程") |
| | | private Double overLongDistance; |
| | | |
| | | @ApiModelProperty(value = "超出长途里程费") |
| | | private BigDecimal overLongDistancePrice; |
| | | |
| | | @ApiModelProperty(value = "等待时长(分钟)") |
| | | private Integer waitTime; |
| | | |
| | | @ApiModelProperty(value = "等待费") |
| | | private BigDecimal waitTimePrice; |
| | | |
| | | @ApiModelProperty(value = "超出等待时长(分钟)") |
| | | private Integer outWaitTime; |
| | | |
| | | @ApiModelProperty(value = "超出等待费") |
| | | private BigDecimal outWaitTimePrice; |
| | | |
| | | @ApiModelProperty(value = "恶劣天气里程") |
| | | private BigDecimal badWeatherDistance; |
| | | |
| | | @ApiModelProperty(value = "恶劣天气费") |
| | | private BigDecimal badWeatherPrice; |
| | | |
| | | @ApiModelProperty(value = "恶劣天气超出里程") |
| | | private Double overBadWeatherDistance; |
| | | |
| | | @ApiModelProperty(value = "恶劣天气超出费") |
| | | private BigDecimal overBadWeatherPrice; |
| | | |
| | | public Double getStartDistance() { |
| | | return startDistance; |
| | | } |
| | | |
| | | public void setStartDistance(Double startDistance) { |
| | | this.startDistance = startDistance; |
| | | } |
| | | |
| | | public BigDecimal getStartPrice() { |
| | | return startPrice; |
| | | } |
| | | |
| | | public void setStartPrice(BigDecimal startPrice) { |
| | | this.startPrice = startPrice; |
| | | } |
| | | |
| | | public Double getOverDriveDistance() { |
| | | return overDriveDistance; |
| | | } |
| | | |
| | | public void setOverDriveDistance(Double overDriveDistance) { |
| | | this.overDriveDistance = overDriveDistance; |
| | | } |
| | | |
| | | public BigDecimal getOverDrivePrice() { |
| | | return overDrivePrice; |
| | | } |
| | | |
| | | public void setOverDrivePrice(BigDecimal overDrivePrice) { |
| | | this.overDrivePrice = overDrivePrice; |
| | | } |
| | | |
| | | public String getLongDistance() { |
| | | return longDistance; |
| | | } |
| | | |
| | | public void setLongDistance(String longDistance) { |
| | | this.longDistance = longDistance; |
| | | } |
| | | |
| | | public BigDecimal getLongDistancePrice() { |
| | | return longDistancePrice; |
| | | } |
| | | |
| | | public void setLongDistancePrice(BigDecimal longDistancePrice) { |
| | | this.longDistancePrice = longDistancePrice; |
| | | } |
| | | |
| | | public Double getOverLongDistance() { |
| | | return overLongDistance; |
| | | } |
| | | |
| | | public void setOverLongDistance(Double overLongDistance) { |
| | | this.overLongDistance = overLongDistance; |
| | | } |
| | | |
| | | public BigDecimal getOverLongDistancePrice() { |
| | | return overLongDistancePrice; |
| | | } |
| | | |
| | | public void setOverLongDistancePrice(BigDecimal overLongDistancePrice) { |
| | | this.overLongDistancePrice = overLongDistancePrice; |
| | | } |
| | | |
| | | public Integer getWaitTime() { |
| | | return waitTime; |
| | | } |
| | | |
| | | public void setWaitTime(Integer waitTime) { |
| | | this.waitTime = waitTime; |
| | | } |
| | | |
| | | public BigDecimal getWaitTimePrice() { |
| | | return waitTimePrice; |
| | | } |
| | | |
| | | public void setWaitTimePrice(BigDecimal waitTimePrice) { |
| | | this.waitTimePrice = waitTimePrice; |
| | | } |
| | | |
| | | public Integer getOutWaitTime() { |
| | | return outWaitTime; |
| | | } |
| | | |
| | | public void setOutWaitTime(Integer outWaitTime) { |
| | | this.outWaitTime = outWaitTime; |
| | | } |
| | | |
| | | public BigDecimal getOutWaitTimePrice() { |
| | | return outWaitTimePrice; |
| | | } |
| | | |
| | | public void setOutWaitTimePrice(BigDecimal outWaitTimePrice) { |
| | | this.outWaitTimePrice = outWaitTimePrice; |
| | | } |
| | | |
| | | public BigDecimal getBadWeatherDistance() { |
| | | return badWeatherDistance; |
| | | } |
| | | |
| | | public void setBadWeatherDistance(BigDecimal badWeatherDistance) { |
| | | this.badWeatherDistance = badWeatherDistance; |
| | | } |
| | | |
| | | public BigDecimal getBadWeatherPrice() { |
| | | return badWeatherPrice; |
| | | } |
| | | |
| | | public void setBadWeatherPrice(BigDecimal badWeatherPrice) { |
| | | this.badWeatherPrice = badWeatherPrice; |
| | | } |
| | | |
| | | public Double getOverBadWeatherDistance() { |
| | | return overBadWeatherDistance; |
| | | } |
| | | |
| | | public void setOverBadWeatherDistance(Double overBadWeatherDistance) { |
| | | this.overBadWeatherDistance = overBadWeatherDistance; |
| | | } |
| | | |
| | | public BigDecimal getOverBadWeatherPrice() { |
| | | return overBadWeatherPrice; |
| | | } |
| | | |
| | | public void setOverBadWeatherPrice(BigDecimal overBadWeatherPrice) { |
| | | this.overBadWeatherPrice = overBadWeatherPrice; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | */ |
| | | public interface ITCouponService extends IService<TCoupon> { |
| | | |
| | | /** |
| | | * 校验是否添加的是同类型同名称的优惠券 |
| | | * @param tCoupon |
| | | * @return |
| | | */ |
| | | Boolean isExit(TCoupon tCoupon); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.dao.TCouponMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TOrderMapper; |
| | | import com.stylefeng.guns.modular.system.enums.CouponStatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.stylefeng.guns.modular.system.dao.TAppUserMapper; |
| | | import com.stylefeng.guns.modular.system.model.TCoupon; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TAppUserMapper tAppUserMapper; |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | @Autowired |
| | | private TOrderMapper tOrderMapper; |
| | | |
| | | @Override |
| | | public void detail(Integer tAppUserId, Model model) { |
| | |
| | | model.addAttribute("id",tAppUser.getId()); |
| | | model.addAttribute("nickname",tAppUser.getNickname()); |
| | | model.addAttribute("remark",tAppUser.getRemark()); |
| | | model.addAttribute("createTime",tAppUser.getCreateTime()); |
| | | model.addAttribute("createTime",DateUtil.formatDate(tAppUser.getCreateTime())); |
| | | // 客户渠道 |
| | | model.addAttribute("customerChannel",""); |
| | | |
| | | // 消费信息:优惠券数据 |
| | | List<TCoupon> tCoupons = tCouponMapper.selectList(new EntityWrapper<TCoupon>().eq("user_id", tAppUserId)); |
| | | List<TCoupon> notUsedList = tCoupons.stream().filter(coupon -> coupon.getCouponStatus().equals(CouponStatusEnum.NOT_USED.getCode())).collect(Collectors.toList()); |
| | |
| | | model.addAttribute("notUsedCount",notUsedList.size()); |
| | | model.addAttribute("usedCount",usedList.size()); |
| | | model.addAttribute("expiredCount",expiredList.size()); |
| | | // 查询订单数据 |
| | | List<TOrder> orders = tOrderMapper.selectList(new EntityWrapper<TOrder>().eq("userId", tAppUserId).orderBy(true,"createTime",false)); |
| | | if(!CollectionUtils.isEmpty(orders)){ |
| | | // 下单次数 |
| | | model.addAttribute("numberOfOrder",orders.size()); |
| | | // 取消次数 |
| | | List<TOrder> collect = orders.stream().filter(order->Objects.nonNull(order.getState())) |
| | | .filter(order -> OrderStateEnum.CANCELED.getCode() == order.getState()).collect(Collectors.toList()); |
| | | model.addAttribute("canceledNumber",collect.size()); |
| | | |
| | | TOrder tOrder = orders.get(0); |
| | | // 最近消费时间 |
| | | model.addAttribute("latelyTime",DateUtil.formatDate(tOrder.getCreateTime())); |
| | | // 最近消费金额 |
| | | model.addAttribute("latelyPrice",tOrder.getPayMoney()); |
| | | |
| | | // 总消费次数 |
| | | List<TOrder> collect1 = orders.stream().filter(order->Objects.nonNull(order.getState())) |
| | | .filter(order -> OrderStateEnum.WAIT_EVALUATED.getCode() == order.getState() || |
| | | OrderStateEnum.FINISH.getCode() == order.getState()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect1)){ |
| | | model.addAttribute("consumeSum",collect1.size()); |
| | | // 总消费金额 |
| | | collect1.stream().map(TOrder::getPayMoney).reduce(BigDecimal::add) |
| | | .ifPresent(consumePrice -> model.addAttribute("consumePrice", consumePrice)); |
| | | }else { |
| | | // 总消费次数 |
| | | model.addAttribute("consumeSum",0); |
| | | // 总消费金额 |
| | | model.addAttribute("consumePrice", 0); |
| | | } |
| | | }else { |
| | | // 下单次数 |
| | | model.addAttribute("numberOfOrder",0); |
| | | // 取消次数 |
| | | model.addAttribute("canceledNumber",0); |
| | | // 最近消费时间 |
| | | model.addAttribute("latelyTime",""); |
| | | // 最近消费金额 |
| | | model.addAttribute("latelyPrice",0); |
| | | // 总消费次数 |
| | | model.addAttribute("consumeSum",0); |
| | | // 总消费金额 |
| | | model.addAttribute("consumePrice", 0); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.model.TCoupon; |
| | | import com.stylefeng.guns.modular.system.dao.TCouponMapper; |
| | | import com.stylefeng.guns.modular.system.service.ITCouponService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.apache.poi.hdf.extractor.TC; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCouponServiceImpl extends ServiceImpl<TCouponMapper, TCoupon> implements ITCouponService { |
| | | |
| | | @Autowired |
| | | private TCouponMapper tCouponMapper; |
| | | |
| | | @Override |
| | | public Boolean isExit(TCoupon tCoupon) { |
| | | |
| | | Integer count = tCouponMapper.selectCount(new EntityWrapper<TCoupon>().eq("coupon_name", tCoupon.getCouponName()) |
| | | .eq("coupon_type",tCoupon.getCouponType())); |
| | | |
| | | if(Objects.nonNull(tCoupon.getId())){ |
| | | // 修改 |
| | | }else { |
| | | // 新增 |
| | | return count>0; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | <script src="${ctxPath}/static/crypto-js/crypto-js.js"></script> |
| | | <script> |
| | | $(function () { |
| | | console.log($("#number").val()) |
| | | if($("#number").val()==5){ |
| | | document.getElementById("verifyNumber").setAttribute("required","") |
| | | $("#verify").show() |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" style="margin-left: 150px"> |
| | | <label class="control-label">客户渠道:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${customerChannel}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" style="margin-left: 150px"> |
| | | <label class="control-label" >下单次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${numberOfOrder}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" style="margin-left: 150px" > |
| | | <label class="control-label" >取消次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${canceledNumber}</label> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px"> |
| | | <label class="control-label">最近消费时间:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${latelyTime}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">未使用:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label" >最近消费金额:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${latelyPrice}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <label class="control-label">已过期:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label">总消费金额:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${consumePrice}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">剩余:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label">总消费次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${consumeSum}</label> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >下单次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${numberOfOrder}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >取消次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${canceledNumber}</label> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px"> |
| | | <label class="control-label">最近消费时间:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${latelyTime}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">未使用:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label" >最近消费金额:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${latelyPrice}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-4 control-label form-group" > |
| | | <label class="control-label">已过期:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label">总消费金额:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${consumePrice}</label> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">剩余:</label> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-4 control-label form-group" style="margin-left: 70px" > |
| | | <label class="control-label">总消费次数:</label> |
| | | <label>${expiredCount}</label> |
| | | <label>${consumeSum}</label> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="condition" name="名称" /> |
| | | <#TimeCon id="createtime" name="发布时间"/> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="col-sm-2"> |
| | | <select class="input-group" id="couponType" style="width: 180px;height: 33px" name="couponType"> |
| | | <option value="">优惠券类型</option> |
| | | <option value="1">活动券</option> |
| | | <option value="2">优惠券</option> |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <select class="input-group" id="couponServiceType" style="width: 180px;height: 33px" name="couponServiceType"> |
| | | <option value="">服务类类型</option> |
| | | <option value="1">通用券</option> |
| | | </select> |
| | | </div> |
| | | <div class="col-sm-1"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TCoupon.search()"/> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tCoupon/tCoupon.js"></script> |
| | | <script type="text/javascript"> |
| | | laydate.render({ |
| | | elem: '#createtime', |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | </script> |
| | | @} |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | <div class="form-horizontal" style="width: "> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | | <#input id="id" name="主键" underline="true"/> |
| | | <#input id="createtime" name="创建时间"/> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">优惠券名称:</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponName" name="couponName" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-6"> |
| | | <#input id="couponName" name="优惠券名称" underline="true"/> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">优惠券类型:</label> |
| | | <select class="input-group col-sm-6" id="couponType" style="width: 180px;height: 33px" name="couponType"> |
| | | <option value="1">活动券</option> |
| | | <option value="2">优惠券</option> |
| | | </select> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">服务类类型:</label> |
| | | <select class="input-group col-sm-6" id="couponServiceType" style="width: 180px;height: 33px" name="couponType"> |
| | | <option value="1">通用型</option> |
| | | </select> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">优惠券数量:</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponCount" name="couponCount" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">条件金额:订单满</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponConditionalAmount" name="couponConditionalAmount" type="text"> |
| | | </div> |
| | | <label class="col-sm-2 control-label">可使用</label> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">优惠金额:</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponPreferentialAmount" name="couponPreferentialAmount" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">有效期:</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponValidity" name="couponValidity" type="text"> |
| | | </div> |
| | | <label class="col-sm-1 control-label">天</label> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">赠送数量:</label> |
| | | <div class="col-sm-6"> |
| | | <input class="form-control" id="couponSendQuantity" name="couponSendQuantity" type="text"> |
| | | </div> |
| | | <label class="col-sm-1 control-label">张</label> |
| | | </div> |
| | | <div class="hr-line-dashed"></div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TCouponInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TCouponInfoDlg.close()"/> |
| | | </div> |
| | |
| | | {title: '用户ID', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '用户昵称', field: 'nickname', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.sex === 1){ |
| | | return '<span>男</span>' |
| | | }else if (row.sex === 2){ |
| | | return '<span>女</span>' |
| | | }else { |
| | | return '<span>未知</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '头像', field: 'avatar', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '微信openid', field: 'openid', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '微信unionid', field: 'unionid', visible: true, align: 'center', valign: 'middle'}, |
| | |
| | | {title: '紧急联系电话', field: 'emergencyPhone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '账户余额', field: 'accountBalance', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '用户标签id', field: 'userTagId', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.status === 1){ |
| | | return '<span>正常</span>' |
| | | }else if (row.status === 2){ |
| | | return '<span>冻结</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, |
| | | // {title: '是否异常', field: 'isException', hidden:true, visible: true, align: 'center', valign: 'middle'}, |
| | | // {title: '启用冻结理由', field: 'remark', hidden:true,visible: true, align: 'center', valign: 'middle'}, |
| | |
| | | $("#createTime").val(''); |
| | | $("#id").val(''); |
| | | $("#status").val(''); |
| | | TAppUser.search(); |
| | | } |
| | | |
| | | $(function () { |
| | |
| | | {title: '目的地', field: 'endAddress', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '总行驶里程(公里)', field: 'mileageSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '总行驶时间(分)', field: 'travelTimeSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '基础费用(元)', field: 'basicExpenses', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '基础费用(元)', field: 'startPrice', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '等待时间(5)分钟', field: 'waitTimePrice', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '里程费(8.0)公里', field: 'mileagePrice', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '恶劣天气', field: 'badWeather', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '里程费(8.0)公里', field: 'longDistancePrice', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '恶劣天气', field: 'badWeatherDistance', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '支付金额', field: 'payMoney', visible: true, align: 'center', valign: 'middle'}, |
| | | ]; |
| | | }; |
| | |
| | | $("#createTime").val(''); |
| | | $("#id").val(''); |
| | | $("#status").val(''); |
| | | this.search(); |
| | | } |
| | | |
| | | $(function () { |
| | |
| | | {title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '创建时间', field: 'createtime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券名称', field: 'couponName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券类型', field: 'couponType', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券类型', field: 'couponType', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.couponType === 1){ |
| | | return '<span>活动券</span>' |
| | | }else if (row.couponType === 2){ |
| | | return '<span>新人券</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '优惠券码', field: 'couponCode', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券状态', field: 'couponStatus', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '服务类型', field: 'couponServiceType', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠券状态', field: 'couponStatus', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.couponType === 1){ |
| | | return '<span>未发放</span>' |
| | | }else if (row.couponType === 2){ |
| | | return '<span>未使用</span>' |
| | | }else if (row.couponType === 3){ |
| | | return '<span>已使用</span>' |
| | | }else if (row.couponType === 4){ |
| | | return '<span>已过期</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '服务类型', field: 'couponServiceType', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | if (row.couponType === 1){ |
| | | return '<span>通用型</span>' |
| | | } |
| | | } |
| | | }, |
| | | {title: '条件金额', field: 'couponConditionalAmount', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '优惠金额', field: 'couponPreferentialAmount', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'couponValidity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '赠送数量', field: 'couponSendQuantity', visible: true, align: 'center', valign: 'middle'} |
| | | {title: '赠送数量', field: 'couponSendQuantity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '操作', visible: true, align: 'center', valign: 'middle',width:150, |
| | | formatter: function (value, row) { |
| | | if (row.state === 1){ |
| | | return '<a href="#" onclick="TCoupon.stop('+row.id+','+row.status+')" style="color:red">停用</a>' +' ' + |
| | | '<a href="#" onclick="TCoupon.delete('+row.id+')" style="color:red">删除</a>' |
| | | }else if (row.state === 2){ |
| | | return '<a href="#" onclick="TCoupon.start('+row.id+','+row.status+')" style="color:green">启用</a>' +' ' + |
| | | '<a href="#" onclick="TCoupon.delete('+row.id+')" style="color:red">删除</a>' |
| | | } |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | |
| | | */ |
| | | TCoupon.search = function () { |
| | | var queryData = {}; |
| | | queryData['condition'] = $("#condition").val(); |
| | | queryData['couponType'] = $("#couponType").val(); |
| | | queryData['couponServiceType'] = $("#couponServiceType").val(); |
| | | queryData['createtime'] = $("#createtime").val(); |
| | | TCoupon.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | |
| | | this |
| | | .set('id') |
| | | .set('createtime') |
| | | .set('couponType') |
| | | .set('couponServiceType') |
| | | .set('couponCount') |
| | | .set('couponConditionalAmount') |
| | | .set('couponPreferentialAmount') |
| | | .set('couponValidity') |
| | | .set('couponSendQuantity') |
| | | .set('couponName'); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 字符串日期转Date yyyy-MM-dd |
| | | * @param dateStr |
| | | * @return |
| | | */ |
| | | public static Date getDate_str4(String dateStr) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | sdf.setTimeZone(tz); |
| | | if ("".equals(dateStr)) { |
| | | dateStr = sdf.format(DateUtil.getDate()); |
| | | } |
| | | Date date = null; |
| | | try { |
| | | date = sdf.parse(dateStr); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * 格式化Date yyyy-MM-dd HH:mm:ss |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String formatDate(Date date) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | return sdf.format(date); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前毫秒数 |
| | | * @return long |
| | | */ |