| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxCardDailyLog; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.service.WxCardDailyLogService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -41,6 +42,7 @@ public class WxCardDailyLogController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::list"); | |||
| if (wxCardDailyLog == null) wxCardDailyLog = new WxCardDailyLog(); | |||
| wxCardDailyLog.updateTenantInfo(getTenantInfo()); | |||
| wxCardDailyLog.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| PageInfo<WxCardDailyLog> info = wxCardDailyLogService.listAsPage(wxCardDailyLog, pageNum, pageSize); | |||
| return new ResultData(info); | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| @@ -42,4 +43,8 @@ public class WxCardDailyLog extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="卡卷总数",name="count") | |||
| private Integer count; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡卷总数",name="count") | |||
| @TableField(exist = false) | |||
| private String title; | |||
| } | |||
| @@ -309,4 +309,6 @@ public interface WxCouponService { | |||
| void addManyCouponMerchants(TenantEntity tenantInfo, List<Long> couponIds, List<Long> merchantIds); | |||
| void delManyCouponMerchants(TenantEntity tenantInfo, List<Long> couponIds, List<Long> merchantIds); | |||
| List<WxCoupon> getByIdList(List<Long> collect, String tenantId); | |||
| } | |||
| @@ -6,12 +6,14 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| @Service | |||
| public class WxCardDailyLogServiceImpl implements WxCardDailyLogService { | |||
| @@ -21,10 +23,26 @@ public class WxCardDailyLogServiceImpl implements WxCardDailyLogService { | |||
| @Autowired | |||
| WxCardDailyLogMapper wxCardDailyLogMapper; | |||
| @Autowired | |||
| WxCouponService wxCouponService; | |||
| @Override | |||
| public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardDailyLogMapper.findList(record)); | |||
| PageInfo<WxCardDailyLog> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardDailyLogMapper.findList(record)); | |||
| if (CollectionUtils.isEmpty(pageInfo.getList())){ | |||
| return pageInfo; | |||
| } | |||
| List<Long> couponIds = pageInfo.getList().parallelStream().map(WxCardDailyLog::getCouponId).collect(Collectors.toList()); | |||
| List<WxCoupon> list = wxCouponService.getByIdList(couponIds, record.getTenantId()); | |||
| if (CollectionUtils.isEmpty(list)){ | |||
| return pageInfo; | |||
| } | |||
| Map<Long, String> map = list.parallelStream().collect(Collectors.toMap(WxCoupon::getId, WxCoupon::getTitle)); | |||
| for (WxCardDailyLog log : pageInfo.getList()) { | |||
| log.setTitle(map.get(log.getCouponId())); | |||
| } | |||
| return pageInfo; | |||
| } | |||
| @Override | |||
| @@ -520,7 +520,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!"); | |||
| } | |||
| String remark = user.getUsername() + "给卡密[" + wxCardInfo.getId() + "]" + "充值,金额:" + wxCardInfo.getAmount() + "分"; | |||
| String remark = user.getUsername() + "给卡密[" + wxCardInfo.getId() + "]" + "充值,金额:" + cardInfo.getAmount() + "分"; | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark, cardInfo.getAmount()); | |||
| if(record.getCardBeforeAmount().equals(0)){ | |||
| @@ -392,6 +392,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| cardSetPrice.setCardPasswordId(wxCouponPasswordUpd.getId()); | |||
| cardSetPrice.setPrice(wxCouponPasswordUpd.getPrice()); | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setCouponId(wxCouponPasswordUpd.getCouponId()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| cardSetPrice.setCouponId(wxCoupon.getCouponId()); | |||
| @@ -3,6 +3,7 @@ package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| @@ -2104,5 +2105,13 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxCoupon> getByIdList(List<Long> couponIds, String tenantId) { | |||
| return wxCouponMapper.selectList(new LambdaQueryWrapper<WxCoupon>() | |||
| .eq(WxCoupon::getIsDel, 0) | |||
| .in(WxCoupon::getId, couponIds) | |||
| .eq(TenantEntity::getTenantId, tenantId)); | |||
| } | |||
| } | |||
| @@ -145,7 +145,7 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| private ParkStopFee jieshunCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||
| //下订单; | |||
| String retCode = dahua.createOrder(park, carNumber, getCacheToken(park)); | |||
| String retCode = dahua.getCarStopFee(park, carNumber, getCacheToken(park)); | |||
| if (StringUtils.isBlank(retCode)) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "dahua createOrder error. has no result"); | |||
| } | |||
| @@ -153,66 +153,24 @@ public class DaHuaParkService extends BaseParkService implements ParkAdapterServ | |||
| JSONObject result = JSON.parseObject(retCode); | |||
| if (!result.getBoolean("success") ) { | |||
| String message = result.getString("errMsg"); | |||
| throw new MallinkException(result.getInteger("code"), "dahua createOrder error."+message); | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "dahua createOrder error."+message); | |||
| } | |||
| JSONObject arrays = result.getJSONObject("data"); | |||
| if (null == arrays || arrays.size() == 0) { | |||
| throw new MallinkException(result.getInteger("resultCode"), "jieshun createOrder error. no order result"+carNumber); | |||
| JSONObject attribute = result.getJSONObject("data"); | |||
| if (null == attribute ) { | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "dahua createOrder error. no order result"+carNumber); | |||
| } | |||
| Double totalFee = attribute.getDouble("totalFee"); | |||
| String appId = "wxe01cc0f34a5c70dc"; | |||
| String parkOrderId = attribute.getString("orderNo"); | |||
| Integer freeMinute = (Integer)park.getVendorParamsByKey("freeMinute"); | |||
| // JSONObject attribute = arrays.getJSONObject(0).getJSONObject("attributes"); | |||
| // Double totalFee = attribute.getDouble("totalFee"); | |||
| // String appId = "wx24b70f0ad2a9a89a"; | |||
| // String parkOrderId = attribute.getString("orderNo"); | |||
| // Integer freeMinute = (Integer)park.getVendorParamsByKey("freeMinute"); | |||
| // if (totalFee <= 0 ) { | |||
| // String _createTime = attribute.getString("startTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| // String _endTime = attribute.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| // String msg = attribute.getString("retmsg"); | |||
| // if (!StringUtils.isBlank(msg)) { | |||
| // if (msg.contains("未入场")) { | |||
| // return new ParkStopFee(null,jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| // "0.00",appId,"payPath",null,msg,null); | |||
| // }else { | |||
| // //0元订单结清,查询是否用过打折方案,如果用过,则需要调用接口结清订单 | |||
| // Integer used = ParkCacheUtils.getCarCouponUseCacheLock(redisTemplate, EnumCarVendor.CAR_JIESHUN_V2.getMessage(), carNumber); | |||
| // if (null == used || (null != used && used.intValue() < 1)) { | |||
| // //未使用停车券 | |||
| // return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| // "0.00",appId,"payPath",null,msg,null); | |||
| // }else { | |||
| // return new ParkStopFee("-999",jieshun.utcToLocal(_createTime),jieshun.utcToLocal(_endTime), | |||
| // "0.00",appId,"payPath",null,msg,"用券抵扣后账单为0,获得"+freeMinute+"分钟免费出场时间"); | |||
| // } | |||
| // } | |||
| // } | |||
| // } | |||
| // | |||
| // | |||
| // String ret = jieshun.getCarStopFee(park, parkOrderId, getCacheToken(park)); | |||
| // JSONObject retObj = JSON.parseObject(ret); | |||
| // if (retObj.getIntValue("resultCode") == 0){ | |||
| // JSONArray retArrays = retObj.getJSONArray("dataItems"); | |||
| // if (null == retArrays || retArrays.size() == 0 ) { | |||
| // throw new MallinkException(result.getInteger("resultCode"), "jieshun getCarStopFee error. no order result"+carNumber); | |||
| // } | |||
| // | |||
| // JSONObject retObject = retArrays.getJSONObject(0).getJSONObject("attributes"); | |||
| // String createTime = retObject.getString("startTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| // String endTime = retObject.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| // String payPath = "pages/thirdPayOrderByNo/payOrder?orderNo="+parkOrderId+"&freeMinute="+freeMinute; | |||
| // //String payPath = "pages/thirdPayOrder/payOrder?carNo="+jieshun.handleCarNumber(carNumber)+"&parkCode="+park.getParkingId(); | |||
| // return new ParkStopFee(parkOrderId,jieshun.utcToLocal(createTime),jieshun.utcToLocal(endTime), | |||
| // String.valueOf(retObject.getDouble("totalFee")),appId,payPath,null,null,"请支付后"+freeMinute+"分钟内离场"); | |||
| // }else { | |||
| // logger.error("jieshunCarStopFee error. paramMap: {} . jieshunResult: {}",JSON.toJSONString(paramMap),ret); | |||
| // String msg = retObj.getString("message"); | |||
| // throw new MallinkException(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "停车费获取失败:"+msg); | |||
| // } | |||
| return null; | |||
| String createTime = attribute.getString("startTime");//计费时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String endTime = attribute.getString("endTime");//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||
| String payPath = "pages/parkingPay/parkingPay?orderNo="+parkOrderId+"&freeMinute="+freeMinute; | |||
| //String payPath = "pages/thirdPayOrder/payOrder?carNo="+jieshun.handleCarNumber(carNumber)+"&parkCode="+park.getParkingId(); | |||
| return new ParkStopFee(parkOrderId,dahua.utcToLocal(createTime),dahua.utcToLocal(endTime), | |||
| String.valueOf(totalFee),appId,payPath,null,null,"请支付后"+freeMinute+"分钟内离场"); | |||
| } | |||
| /** | |||