| @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCarPayQueryDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -62,7 +63,8 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @Autowired | |||
| private WxLevelConfigService wxLevelConfigService; | |||
| @Autowired | |||
| WxCarPayRecordService wxCarPayRecordService; | |||
| @Autowired | |||
| StringRedisTemplate stringRedisTemplate; | |||
| @@ -411,4 +413,18 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| return new ResultData(Result.SUCCESS, "查询成功", entries); | |||
| } | |||
| @ApiOperation("进出场车辆分页列表接口") | |||
| @GetMapping("carPayList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "startDate", value = "开始时间", dataType = "string", paramType = "query"), | |||
| @ApiImplicitParam(name = "endDate", value = "结束时间", dataType = "string", paramType = "query"), | |||
| @ApiImplicitParam(name = "isPay", value = "是否缴费 1是", dataType = "int", paramType = "query"), | |||
| }) | |||
| public ResultData carPayList(@ModelAttribute WxCarPayRecord record, Integer pageNum, Integer pageSize){ | |||
| record.setTenantId(super.getTenantId()); | |||
| return new ResultData(wxCarPayRecordService.findCarPayListByPage(record,pageNum,pageSize)); | |||
| } | |||
| } | |||
| @@ -3,9 +3,7 @@ package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.domain.po.WxCUserCar; | |||
| import com.iformall.domain.po.WxCarCmdLog; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumCarCmd; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| @@ -22,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -51,6 +50,12 @@ public class WxCarCallBackController extends BaseController { | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| WxCarPayRecordService wxCarPayRecordService; | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| /** | |||
| * ETCP 车辆入场通知 | |||
| * { | |||
| @@ -98,6 +103,8 @@ public class WxCarCallBackController extends BaseController { | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| String phoneStrs = ""; | |||
| // 停车发券 | |||
| String carNumber = paramMap.get("plateNumber"); | |||
| if (!StringUtils.isBlank(carNumber)) { | |||
| @@ -110,9 +117,31 @@ public class WxCarCallBackController extends BaseController { | |||
| List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ); | |||
| for (WxCUserCar userCar : userCarList) { | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| phoneStrs += cUser.getPhone() + " "; | |||
| } | |||
| } | |||
| } | |||
| try { | |||
| WxCarPayRecord record = new WxCarPayRecord(); | |||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||
| Map<String,String> jsonMap = (Map)JSON.parseObject(wxCarCmdLog.getCmdJson()); | |||
| record.setSynId(jsonMap.get("synId")); | |||
| record.setParkId(jsonMap.get("parkId")); | |||
| record.setParkName(jsonMap.get("parkName")); | |||
| record.setUserType(jsonMap.get("userType")); | |||
| record.setPlateNumber(jsonMap.get("plateNumber")); | |||
| record.setEntranceTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(jsonMap.get("entranceTime"))); | |||
| record.setFixParkingId(jsonMap.get("fixParkingId")); | |||
| record.setRemainingDays(jsonMap.get("remainingDays")); | |||
| record.setPhone(phoneStrs); | |||
| wxCarPayRecordService.saveOrUpdate(record); | |||
| } catch (Exception e) { | |||
| logger.error("WxCarPayRecord: 入库错误 " + paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); | |||
| } | |||
| @@ -0,0 +1,239 @@ | |||
| package com.iformall.domain.po; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| @Table(name = "wx_car_pay_record") | |||
| public class WxCarPayRecord implements Serializable { | |||
| private static final long serialVersionUID = 1243232432423L; | |||
| @Id | |||
| private Long id; | |||
| private String tenantId; | |||
| private Integer vendorType; | |||
| private String synId; | |||
| private String parkId; | |||
| private String parkName; | |||
| private String userType; | |||
| private String plateNumber; | |||
| private Date entranceTime; | |||
| private Date exitTime; | |||
| private String fee; | |||
| private Date feeTime; | |||
| private String coupon; | |||
| private String couponCode; | |||
| private String fixParkingId; | |||
| private String remainingDays; | |||
| private String discountAmount; | |||
| private String paidServiceFee; | |||
| private String phone; | |||
| private Date createDate; | |||
| private Date updateDate; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="开始日期",name="startDate") | |||
| private String startDate; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="结束日期",name="endDate") | |||
| private String endDate; | |||
| @Transient | |||
| @io.swagger.annotations.ApiModelProperty(value="是否缴费",name="isPay") | |||
| private Integer isPay; | |||
| public String getStartDate() { | |||
| return startDate; | |||
| } | |||
| public void setStartDate(String startDate) { | |||
| this.startDate = startDate; | |||
| } | |||
| public String getEndDate() { | |||
| return endDate; | |||
| } | |||
| public void setEndDate(String endDate) { | |||
| this.endDate = endDate; | |||
| } | |||
| public Integer getIsPay() { | |||
| return isPay; | |||
| } | |||
| public void setIsPay(Integer isPay) { | |||
| this.isPay = isPay; | |||
| } | |||
| public String getPhone() { | |||
| return phone; | |||
| } | |||
| public void setPhone(String phone) { | |||
| this.phone = phone; | |||
| } | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String tenantId) { | |||
| this.tenantId = tenantId; | |||
| } | |||
| public Integer getVendorType() { | |||
| return vendorType; | |||
| } | |||
| public void setVendorType(Integer vendorType) { | |||
| this.vendorType = vendorType; | |||
| } | |||
| public String getSynId() { | |||
| return synId; | |||
| } | |||
| public void setSynId(String synId) { | |||
| this.synId = synId; | |||
| } | |||
| public String getParkId() { | |||
| return parkId; | |||
| } | |||
| public void setParkId(String parkId) { | |||
| this.parkId = parkId; | |||
| } | |||
| public String getParkName() { | |||
| return parkName; | |||
| } | |||
| public void setParkName(String parkName) { | |||
| this.parkName = parkName; | |||
| } | |||
| public String getUserType() { | |||
| return userType; | |||
| } | |||
| public void setUserType(String userType) { | |||
| this.userType = userType; | |||
| } | |||
| public String getPlateNumber() { | |||
| return plateNumber; | |||
| } | |||
| public void setPlateNumber(String plateNumber) { | |||
| this.plateNumber = plateNumber; | |||
| } | |||
| public Date getEntranceTime() { | |||
| return entranceTime; | |||
| } | |||
| public void setEntranceTime(Date entranceTime) { | |||
| this.entranceTime = entranceTime; | |||
| } | |||
| public Date getExitTime() { | |||
| return exitTime; | |||
| } | |||
| public void setExitTime(Date exitTime) { | |||
| this.exitTime = exitTime; | |||
| } | |||
| public String getFee() { | |||
| return fee; | |||
| } | |||
| public void setFee(String fee) { | |||
| this.fee = fee; | |||
| } | |||
| public Date getFeeTime() { | |||
| return feeTime; | |||
| } | |||
| public void setFeeTime(Date feeTime) { | |||
| this.feeTime = feeTime; | |||
| } | |||
| public String getCoupon() { | |||
| return coupon; | |||
| } | |||
| public void setCoupon(String coupon) { | |||
| this.coupon = coupon; | |||
| } | |||
| public String getCouponCode() { | |||
| return couponCode; | |||
| } | |||
| public void setCouponCode(String couponCode) { | |||
| this.couponCode = couponCode; | |||
| } | |||
| public String getFixParkingId() { | |||
| return fixParkingId; | |||
| } | |||
| public void setFixParkingId(String fixParkingId) { | |||
| this.fixParkingId = fixParkingId; | |||
| } | |||
| public String getRemainingDays() { | |||
| return remainingDays; | |||
| } | |||
| public void setRemainingDays(String remainingDays) { | |||
| this.remainingDays = remainingDays; | |||
| } | |||
| public String getDiscountAmount() { | |||
| return discountAmount; | |||
| } | |||
| public void setDiscountAmount(String discountAmount) { | |||
| this.discountAmount = discountAmount; | |||
| } | |||
| public String getPaidServiceFee() { | |||
| return paidServiceFee; | |||
| } | |||
| public void setPaidServiceFee(String paidServiceFee) { | |||
| this.paidServiceFee = paidServiceFee; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date createDate) { | |||
| this.createDate = createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date updateDate) { | |||
| this.updateDate = updateDate; | |||
| } | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCarCmdLog; | |||
| import com.iformall.domain.vo.MarkingSceneDataVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| @@ -0,0 +1,14 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCarPayRecord; | |||
| import java.util.List; | |||
| /** | |||
| * @author luozukai | |||
| */ | |||
| public interface WxCarPayRecordMapper extends CommonMapper<WxCarPayRecord, Long> { | |||
| List<WxCarPayRecord> findCarPayListByPage(WxCarPayRecord record); | |||
| } | |||
| @@ -2,8 +2,11 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCarCmdLog; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxCarCmdLogService { | |||
| @@ -16,7 +19,7 @@ public interface WxCarCmdLogService { | |||
| * @return | |||
| */ | |||
| PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| @@ -0,0 +1,18 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.WxCarPayRecord; | |||
| /** | |||
| * @author luozukai | |||
| * @date 2019/1/1617:36 | |||
| */ | |||
| public interface WxCarPayRecordService { | |||
| /** | |||
| * 进出场车辆列表 | |||
| * @return | |||
| */ | |||
| PageInfo<WxCarPayRecord> findCarPayListByPage(WxCarPayRecord record,Integer pageIndex, Integer pageSize); | |||
| void saveOrUpdate(WxCarPayRecord record); | |||
| } | |||
| @@ -20,6 +20,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import java.math.BigDecimal; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @@ -505,6 +506,22 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| } | |||
| } | |||
| // 查询近一周的缴费车辆----start------ | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||
| List<Date> days = DateUtils.dateToWeek(new Date()); | |||
| String oneWeekStartdate = sdf.format(days.get(0)); | |||
| String oneWeekSystemTime = sdf.format(days.get(days.size()-1)); | |||
| List<Map<String, Object>> oneWeekHistorylist = wxCarCmdLogMapper.queryHistory(params); | |||
| Map<Object, Object> oneWeekCollect = oneWeekHistorylist.stream().collect(Collectors.toMap(m -> { | |||
| return m.get("create_date"); | |||
| }, m -> { | |||
| return m.get("carcount"); | |||
| })); | |||
| historymap.put("oneWeekCarCount",oneWeekCollect.get("carcount")); | |||
| historymap.put("oneWeekCarCount",oneWeekCollect.get("carcount")); | |||
| // 查询近一周的缴费车辆----end------ | |||
| Map<String, Object> datamap = new HashMap<>(); | |||
| datamap.put("history", historymap); | |||
| @@ -696,8 +713,6 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| } | |||
| } | |||
| public TreeMap getTimeTreeMap() { | |||
| TreeMap<Object, Object> timemap = new TreeMap(); | |||
| timemap.put("06:00", 0); | |||
| @@ -722,4 +737,5 @@ public class DataTowerServiceImpl implements DataTowerService { | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @Service | |||
| public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCarPayQueryDto; | |||
| import com.iformall.domain.po.WxCarCmdLog; | |||
| import com.iformall.domain.po.WxCarPayRecord; | |||
| import com.iformall.mapper.WxCarPayRecordMapper; | |||
| import com.iformall.service.WxCarPayRecordService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| /** | |||
| * @author luozukai | |||
| * @date 2019/1/16 17:37 | |||
| */ | |||
| @Service | |||
| public class WxCarPayRecordServiceImpl implements WxCarPayRecordService{ | |||
| @Autowired | |||
| private WxCarPayRecordMapper wxCarPayRecordMapper; | |||
| @Override | |||
| public PageInfo<WxCarPayRecord> findCarPayListByPage(WxCarPayRecord record,Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarPayRecordMapper.findCarPayListByPage(record)); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCarPayRecord record) { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| wxCarPayRecordMapper.insertSelective(record); | |||
| } else { | |||
| wxCarPayRecordMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| } | |||
| @@ -936,4 +936,23 @@ public class DateUtils { | |||
| } | |||
| } | |||
| /** | |||
| * 根据日期获得所在周的日期 | |||
| * @param mdate | |||
| * @return | |||
| */ | |||
| @SuppressWarnings("deprecation") | |||
| public static List<Date> dateToWeek(Date mdate) { | |||
| int b = mdate.getDay(); | |||
| Date fdate; | |||
| List<Date> list = new ArrayList<>(); | |||
| Long fTime = mdate.getTime() - b * 24 * 3600000; | |||
| for (int a = 1; a <= 7; a++) { | |||
| fdate = new Date(); | |||
| fdate.setTime(fTime + (a * 24 * 3600000)); | |||
| list.add(a-1, fdate); | |||
| } | |||
| return list; | |||
| } | |||
| } | |||
| @@ -0,0 +1,76 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxCarPayRecordMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCarPayRecord"> | |||
| <id column="id" property="id"/> | |||
| <result column="tenant_id" property="tenantId"/> | |||
| <result column="vendor_type" property="vendorType"/> | |||
| <result column="syn_id" property="synId"/> | |||
| <result column="park_id" property="parkId"/> | |||
| <result column="park_name" property="parkName"/> | |||
| <result column="user_type" property="userType"/> | |||
| <result column="plate_number" property="plateNumber"/> | |||
| <result column="entrance_time" property="entranceTime"/> | |||
| <result column="exit_time" property="exitTime"/> | |||
| <result column="fee" property="fee"/> | |||
| <result column="fee_time" property="feeTime"/> | |||
| <result column="coupon" property="coupon"/> | |||
| <result column="coupon_code" property="couponCode"/> | |||
| <result column="fix_parking_id" property="fixParkingId"/> | |||
| <result column="remaining_days" property="remainingDays"/> | |||
| <result column="discount_amount" property="discountAmount"/> | |||
| <result column="paid_service_fee" property="paidServiceFee"/> | |||
| <result column="phone" property="phone"/> | |||
| <result column="create_date" property="createDate"/> | |||
| <result column="update_date" property="updateDate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`vendor_type`,`create_date`,`update_date`,syn_id,park_id,park_name,user_type, | |||
| plate_number,entrance_time,exit_time,fee,fee_time,coupon,coupon_code,fix_parking_id,remaining_days,discount_amount,phone | |||
| ,paid_service_fee,create_date,update_date | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != vendorType "> | |||
| and `vendor_type` = #{vendorType} | |||
| </if> | |||
| <if test=" null != startDate"> | |||
| and entrance_time >= #{startDate} | |||
| </if> | |||
| <if test=" null != endDate"> | |||
| and exit_time <= #{endDate} | |||
| </if> | |||
| <if test=" 1 == isPay"> | |||
| and fee is not null | |||
| and fee != '' | |||
| </if> | |||
| order by create_date desc | |||
| </sql> | |||
| <select id="findCarPayListByPage" parameterType="com.iformall.domain.po.WxCarPayRecord" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_car_pay_record | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| </mapper> | |||