| @@ -16,7 +16,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.car.ETCPUtil; | import com.iformall.utils.car.ETCPUtil; | ||||
| import com.iformall.utils.car.TJDCarUtil; | |||||
| import com.iformall.utils.car.TJDUtil; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -37,7 +37,7 @@ public class WxCarController extends BaseController { | |||||
| ETCPUtil etcp = new ETCPUtil(); | ETCPUtil etcp = new ETCPUtil(); | ||||
| TJDCarUtil tjd = new TJDCarUtil(); | |||||
| TJDUtil tjd = new TJDUtil(); | |||||
| @Autowired | @Autowired | ||||
| WxParkService wxParkService; | WxParkService wxParkService; | ||||
| @@ -2,7 +2,6 @@ package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| @@ -21,8 +20,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @@ -51,11 +48,15 @@ public class WxCouponPasswordController extends BaseController { | |||||
| @ApiOperation("可发送卡数据") | @ApiOperation("可发送卡数据") | ||||
| @GetMapping("/findCouponList") | @GetMapping("/findCouponList") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "可发送卡数据") | @SystemControllerLog(description = "可发送卡数据") | ||||
| public ResultData findCouponList() { | |||||
| public ResultData findCouponList(@ModelAttribute WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::findCouponList"); | logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::findCouponList"); | ||||
| List<WxCouponPasswordCountInfoVO> voList = wxCouponPasswordService.findCouponList(getTenantId()); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", voList); | |||||
| wxCouponPassword.setTenantId(getTenantId()); | |||||
| final PageInfo<WxCouponPasswordCountInfoVO> page = wxCouponPasswordService.findCouponList(wxCouponPassword, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | } | ||||
| @@ -129,7 +129,8 @@ public class TenantInfoImpl implements TenantInfo { | |||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxBillPropertyMapper.insertBillAction".equals(ms.getId())) | if ("com.iformall.mapper.WxBillPropertyMapper.insertBillAction".equals(ms.getId())) | ||||
| return true; | return true; | ||||
| if ("com.iformall.mapper.WxCouponPasswordMapper.updateStatus".equals(ms.getId())) | |||||
| return true; | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,2 @@ | |||||
| alter table wx_coupon_password | |||||
| add column present_id bigint(20) default 0 not null comment '发放ID'; | |||||
| @@ -13,7 +13,7 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.car.ETCPUtil; | import com.iformall.utils.car.ETCPUtil; | ||||
| import com.iformall.utils.car.TJDCarUtil; | |||||
| import com.iformall.utils.car.TJDUtil; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -37,7 +37,7 @@ public class WxCarController extends BaseController { | |||||
| ETCPUtil etcp = new ETCPUtil(); | ETCPUtil etcp = new ETCPUtil(); | ||||
| TJDCarUtil tjd = new TJDCarUtil(); | |||||
| TJDUtil tjd = new TJDUtil(); | |||||
| @Autowired | @Autowired | ||||
| WxParkService wxParkService; | WxParkService wxParkService; | ||||
| @@ -241,16 +241,7 @@ public class WxCarController extends BaseController { | |||||
| * @param paramMap | * @param paramMap | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}\n" + | |||||
| "TJD:={\"carNumber\":\"string\",\"carNumColor\":\"string\",\"outCarId\":\"string\"}\n返回\n" + | |||||
| "{\n" + | |||||
| " \"timestamp\": \"1464235239561\",\n" + | |||||
| " \"returnCode\": \"T\",\n" + | |||||
| " \"errorMsg\": \"\",\n" + | |||||
| " \"returnMsg\": \"OK\",\n" + | |||||
| " \"isSuccess\": \"0\",\n" + | |||||
| " \"carId\": \"5836b8b52ada463ebc6199579f029561\"\n" + | |||||
| "}\n") | |||||
| @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}, TJD:={\"carNumber\":\"string\"}") | |||||
| @PostMapping("/bindCar") | @PostMapping("/bindCar") | ||||
| public ResultData bindCar(@RequestBody Map<String, String > paramMap) { | public ResultData bindCar(@RequestBody Map<String, String > paramMap) { | ||||
| // 1, get mall's park | // 1, get mall's park | ||||
| @@ -258,11 +249,10 @@ public class WxCarController extends BaseController { | |||||
| // 2. get vendor params | // 2. get vendor params | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| return etcpBindCar(paramMap, park); | return etcpBindCar(paramMap, park); | ||||
| } else { | |||||
| // 内部操作 | |||||
| return bindCar(paramMap, park); | |||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| return tjdBindCar(paramMap, park); | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "绑车牌失败"); | |||||
| } | } | ||||
| private ResultData etcpBindCar(Map<String, String> paramMap, WxPark park) { | private ResultData etcpBindCar(Map<String, String> paramMap, WxPark park) { | ||||
| @@ -292,7 +282,7 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| addCarInfoToDB(carNumber); | |||||
| addCarInfoToDB(carNumber, EnumCarVendor.CAR_ETCP); | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | JSONObject dataObj = retObj.getJSONObject("data"); | ||||
| return new ResultData(dataObj); | return new ResultData(dataObj); | ||||
| } else { | } else { | ||||
| @@ -302,14 +292,30 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| private void addCarInfoToDB(String carNumber) { | |||||
| private ResultData bindCar(Map<String, String> paramMap, WxPark park) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| try { | |||||
| addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType())); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(500, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private void addCarInfoToDB(String carNumber, EnumCarVendor carVendor) { | |||||
| // 插入车牌 | // 插入车牌 | ||||
| Date curr = new Date(); | Date curr = new Date(); | ||||
| WxCUserCar userCar = new WxCUserCar(); | WxCUserCar userCar = new WxCUserCar(); | ||||
| userCar.setCUserId(getUserId()); | userCar.setCUserId(getUserId()); | ||||
| userCar.setTenantId(getTenantId()); | userCar.setTenantId(getTenantId()); | ||||
| userCar.setCarNumber(carNumber); | userCar.setCarNumber(carNumber); | ||||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCar.setVendorType(carVendor.getCode()); | |||||
| userCar.setCreateDate(curr); | userCar.setCreateDate(curr); | ||||
| userCar.setUpdateDate(curr); | userCar.setUpdateDate(curr); | ||||
| wxCUserCarService.saveOrUpdate(userCar); | wxCUserCarService.saveOrUpdate(userCar); | ||||
| @@ -409,26 +415,16 @@ public class WxCarController extends BaseController { | |||||
| " \"code\": 0,\n" + | " \"code\": 0,\n" + | ||||
| " \"message\": \"ok\"" + | " \"message\": \"ok\"" + | ||||
| "}" + | "}" + | ||||
| "TJD:={\"carNumber\":\"string\",\"carNumColor\":\"string\",\"outCarId\":\"string\"}\n返回:\n" + | |||||
| "{\n" + | |||||
| " \"timestamp\": \"1464235239561\",\n" + | |||||
| " \"returnCode\": \"T\",\n" + | |||||
| " \"errorMsg\": \"\",\n" + | |||||
| " \"returnMsg\": \"OK\",\n" + | |||||
| " \"isSuccess\": \"0\",\n" + | |||||
| "}\n") | |||||
| "TJD:={\"carNumber\":\"string\"}") | |||||
| @PostMapping("/unbindCar") | @PostMapping("/unbindCar") | ||||
| public ResultData unbindCar(@RequestBody Map<String, String > paramMap) { | public ResultData unbindCar(@RequestBody Map<String, String > paramMap) { | ||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(getTenantId()); | WxPark park = getCurrentPark(getTenantId()); | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||||
| return etcpUnbindCar(paramMap, park); | return etcpUnbindCar(paramMap, park); | ||||
| } else { | |||||
| return unbindCar(paramMap, park); | |||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | |||||
| ResultData e = tjdUnbindCar(paramMap, park); | |||||
| if (e != null) return e; | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | |||||
| } | } | ||||
| private ResultData etcpUnbindCar(Map<String, String> paramMap, WxPark park) { | private ResultData etcpUnbindCar(Map<String, String> paramMap, WxPark park) { | ||||
| @@ -478,6 +474,26 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| private ResultData unbindCar(Map<String, String> paramMap, WxPark park) { | |||||
| String carNumber = paramMap.get("carNumber"); | |||||
| if (StringUtils.isBlank(carNumber)) { | |||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||||
| } | |||||
| try { | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setTenantId(getTenantId()); | |||||
| userCar.setCUserId(getUserId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "解绑车牌数据库错误, e:" + e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private ResultData tjdUnbindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | private ResultData tjdUnbindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| @@ -536,7 +552,7 @@ public class WxCarController extends BaseController { | |||||
| " \"paidFee\": 0,\n" + | " \"paidFee\": 0,\n" + | ||||
| " \"verificationInfo\": \"FSED9JvxgAU6XJUd8YRF5YH/LpfQYzCAfcPbAOKPV3BjKSatbgIsh7EBH2JBiRoGBe3btr gzKRMTfIoFuCn1XX7HUsJYlb7JSCBArnNmEVU4JuDLLjzoqB7qhQ8KnP16\"\n" + | " \"verificationInfo\": \"FSED9JvxgAU6XJUd8YRF5YH/LpfQYzCAfcPbAOKPV3BjKSatbgIsh7EBH2JBiRoGBe3btr gzKRMTfIoFuCn1XX7HUsJYlb7JSCBArnNmEVU4JuDLLjzoqB7qhQ8KnP16\"\n" + | ||||
| " }" + | " }" + | ||||
| "TJD:={\"carNumber\":\"string\",\"carNumColor\":\"string\",\"outCarId\":\"string\"}\n输出\n{\n" + | |||||
| "TJD:={\"carNumber\":\"string\"}\n输出\n{\n" + | |||||
| " \"inDt\": \"20160526112000\",\n" + | " \"inDt\": \"20160526112000\",\n" + | ||||
| " \"timestamp\": \"1464235239561\",\n" + | " \"timestamp\": \"1464235239561\",\n" + | ||||
| " \"returnCode\": \"T\",\n" + | " \"returnCode\": \"T\",\n" + | ||||
| @@ -628,13 +644,13 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| JSONObject objParams = JSON.parseObject(params); | JSONObject objParams = JSON.parseObject(params); | ||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String url = objParams.getString(TJDUtil.TJD_URL); | |||||
| String partner = objParams.getString(TJDUtil.TJD_ACCOUNT); | |||||
| String key = objParams.getString(TJDUtil.TJD_ACCOUNT_KEY); | |||||
| String version = objParams.getString(TJDUtil.TJD_VERSION); | |||||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| if (retObj.getString(TJDUtil.TJD_RETURN_CODE).equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||||
| return new ResultData(retObj); | return new ResultData(retObj); | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | return new ResultData(ErrorCode.TJD_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | ||||
| @@ -2,28 +2,23 @@ package com.iformall.controller.callback; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumCarCmd; | import com.iformall.enums.EnumCarCmd; | ||||
| import com.iformall.enums.EnumCarVendor; | import com.iformall.enums.EnumCarVendor; | ||||
| import com.iformall.enums.EnumCouponSendSendType; | import com.iformall.enums.EnumCouponSendSendType; | ||||
| import com.iformall.enums.EnumETCPCode; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.car.TJDCarUtil; | |||||
| import com.iformall.utils.car.TJDUtil; | |||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.text.ParseException; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| @@ -56,9 +51,7 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCUserService wxCUserService; | WxCUserService wxCUserService; | ||||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| /** | |||||
| /** | |||||
| * 注册车牌 | * 注册车牌 | ||||
| * @param paramMap | * @param paramMap | ||||
| * @return | * @return | ||||
| @@ -87,73 +80,132 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| return map; | return map; | ||||
| } | } | ||||
| /** | /** | ||||
| * 进场通知 | * 进场通知 | ||||
| * { | * { | ||||
| * "parkId": "f3f11a46f3a14056953aed97944242d4", "parkName": "测试停车场", | |||||
| * "carNum": "京A12345", | |||||
| * "carNumColor ": "blue", | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outCarId": "", | |||||
| * "inDt": "20170319202020", | |||||
| * "payUrl": | |||||
| * "http://prep.tingjiandan.com/tcweixin/letter/prePay/pagePayInPark?prePayType=16&channel=10001&isShowDetail=true&orderId=5836b8b52ada463ebc6199579f029565&returnUrl=", | |||||
| * "miniProgram": "{ | |||||
| * \"path\": \"pages/pre_pay/index/main\", | |||||
| * \"extraData\": { | |||||
| * \"prePayType\": \"16\", | |||||
| * \"channel\": \"10001\", | |||||
| * \"isShowDetail\": \"true\", | |||||
| * \"orderId\": \"5836b8b52ada463ebc6199579f029565\" | |||||
| * }}", | |||||
| * "canFindCar": "0", | |||||
| * "city": "北京市", | |||||
| * "district": "海淀区", | |||||
| * "address": "五道口", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735" | |||||
| * wLon=116.310335, | |||||
| * lon=116.316813, | |||||
| * outCarId=, | |||||
| * parkId=7715622dff834b34a44448b801c27607, | |||||
| * tradeId=e9e0d5db057f412fa323995fc292f6f7, | |||||
| * carNumColor=blue, | |||||
| * canFindCar=0, | |||||
| * miniProgram={ | |||||
| * "path": "pages/pre_pay/index/main", | |||||
| * "extraData": { | |||||
| * "prePayType": "16", | |||||
| * "channel": "30166", | |||||
| * "isShowDetail": "true", | |||||
| * "partnerId": "", | |||||
| * "orderId": "e9e0d5db057f412fa323995fc292f6f7"} | |||||
| * }, | |||||
| * city=北京市, | |||||
| * parkName=开发停车场25, | |||||
| * address=财智大厦23楼, | |||||
| * carNum=京YTJD01, | |||||
| * wLat=39.93609, | |||||
| * payUrl=https://prep.tingjiandan.com/tcweixin/letter/prePay/pagePayInPark?prePayType=16&channel=30166&isShowDetail=true&partnerId=&orderId=e9e0d5db057f412fa323995fc292f6f7&returnUrl=, | |||||
| * district=海淀区, | |||||
| * lat=39.942078, | |||||
| * inDt=20190920070500 | |||||
| * } | * } | ||||
| */ | */ | ||||
| @RequestMapping(value = "/tjdParkInCallback") | @RequestMapping(value = "/tjdParkInCallback") | ||||
| public Map tjdParkInCallback(@RequestBody Map<String, String> paramMap) { | public Map tjdParkInCallback(@RequestBody Map<String, String> paramMap) { | ||||
| logger.info("["+getIpAddr()+"tjdParkInCallback: " + paramMap.toString()); | logger.info("["+getIpAddr()+"tjdParkInCallback: " + paramMap.toString()); | ||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| Date currentDate = new Date(); | |||||
| String parkId = paramMap.get(TJDUtil.TJD_PARK_ID); | |||||
| String parkName = paramMap.get(TJDUtil.TJD_PARK_NAME); | |||||
| String carNumber = paramMap.get(TJDUtil.TJD_CAR_NUMBER); | |||||
| String tradeId = paramMap.get(TJDUtil.TJD_TRADE_ID); | |||||
| String inDt = paramMap.get(TJDUtil.TJD_IN_DT); | |||||
| String tjdParkId = paramMap.get("parkId"); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_TJD_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| String tenantId = null; | |||||
| WxPark parkQ = new WxPark(); | WxPark parkQ = new WxPark(); | ||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | ||||
| parkQ.setParkId(tjdParkId); | |||||
| parkQ.setParkId(parkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | WxPark park = wxParkService.getByObj(parkQ); | ||||
| if (park == null) { | if (park == null) { | ||||
| logger.error("tjdParkInCallback: 停简单车场未找到" + tjdParkId); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "停简单车场未找到" + tjdParkId); | |||||
| logger.error("tjdParkInCallback: 车场未找到" + parkId); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_1); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "车场未找到" + parkId); | |||||
| return map; | return map; | ||||
| } else { | |||||
| tenantId = park.getTenantId(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| } | } | ||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_TJD_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | try { | ||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("tjdParkInCallback: 入库错误" + paramMap.toString()); | logger.error("tjdParkInCallback: 入库错误" + paramMap.toString()); | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_2); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "入库错误" + paramMap.toString()); | |||||
| return map; | return map; | ||||
| } | } | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| // 停车发券 | |||||
| String phoneStrs = ""; | |||||
| if (StringUtils.isNotBlank(carNumber)) { | |||||
| // 根据车牌查找用户 | |||||
| WxCUserCar userCarQ = new WxCUserCar(); | |||||
| userCarQ.setTenantId(tenantId); | |||||
| userCarQ.setCarNumber(carNumber); | |||||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| // TODO 可能多用户关联同一张车牌 | |||||
| List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ); | |||||
| boolean bFirst = true; | |||||
| for (WxCUserCar userCar : userCarList) { | |||||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||||
| if(cUser != null){ | |||||
| if(bFirst) { | |||||
| phoneStrs = cUser.getPhone(); | |||||
| bFirst = false; | |||||
| } else { | |||||
| phoneStrs += "," + cUser.getPhone(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| try { | |||||
| // 保存WxCarPayRecord | |||||
| WxCarPayRecord record = new WxCarPayRecord(); | |||||
| record.setTenantId(tenantId); | |||||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||||
| record.setSynId(tradeId); | |||||
| record.setParkId(parkId); | |||||
| record.setParkName(parkName); | |||||
| record.setPlateNumber(carNumber); | |||||
| if(StringUtils.isNotBlank(inDt)) { | |||||
| record.setEntranceTime(TJDUtil.dateOutFormat.parse(inDt)); | |||||
| } | |||||
| record.setPhone(phoneStrs); | |||||
| WxCarPayRecord query = new WxCarPayRecord(); | |||||
| query.setTenantId(tenantId); | |||||
| query.setParkId(parkId); | |||||
| query.setSynId(tradeId); | |||||
| PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,1); | |||||
| if(page != null && CollectionUtils.isNotEmpty(page.getList())){ | |||||
| record.setId(page.getList().get(0).getId()); | |||||
| } | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("WxCarPayRecord: 入库错误 "+e.getMessage()+"," + paramMap.toString()); | |||||
| } | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_SUC); | |||||
| return map; | return map; | ||||
| } | } | ||||
| @@ -174,13 +226,18 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| * "wLat": "35.430735" | * "wLat": "35.430735" | ||||
| * } | * } | ||||
| */ | */ | ||||
| @RequestMapping(value = "/tjdParkoutCallback") | |||||
| @RequestMapping(value = "/tjdParkOutCallback") | |||||
| public Map tjdParkOutCallback(@RequestBody Map<String, String> paramMap) { | public Map tjdParkOutCallback(@RequestBody Map<String, String> paramMap) { | ||||
| logger.info("["+getIpAddr()+"tjdParkoutCallback: " + paramMap.toString()); | |||||
| logger.info("["+getIpAddr()+"tjdParkOutCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| String tradeId = paramMap.get("tradeId"); | |||||
| String parkId = paramMap.get(TJDUtil.TJD_PARK_ID); | |||||
| String parkName = paramMap.get(TJDUtil.TJD_PARK_NAME); | |||||
| String carNumber = paramMap.get(TJDUtil.TJD_CAR_NUMBER); | |||||
| String tradeId = paramMap.get(TJDUtil.TJD_TRADE_ID); | |||||
| String inDt = paramMap.get(TJDUtil.TJD_IN_DT); | |||||
| String outDt = paramMap.get(TJDUtil.TJD_OUT_DT); | |||||
| String stopFee = paramMap.get(TJDUtil.TJD_PARK_AMT); | |||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | ||||
| @@ -189,17 +246,65 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | ||||
| wxCarCmdLog.setCreateDate(currentDate); | wxCarCmdLog.setCreateDate(currentDate); | ||||
| wxCarCmdLog.setUpdateDate(currentDate); | wxCarCmdLog.setUpdateDate(currentDate); | ||||
| String tenantId = null; | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(parkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdParkOutCallback: 车场未找到" + parkId); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_1); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "车场未找到" + parkId); | |||||
| return map; | |||||
| } else { | |||||
| tenantId = park.getTenantId(); | |||||
| wxCarCmdLog.setTenantId(tenantId); | |||||
| } | |||||
| try { | try { | ||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("tjdParkoutCallback: 入库错误" + paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||||
| logger.error("tjdParkOutCallback: 入库错误" + paramMap.toString()); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_2); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "入库错误" + paramMap.toString()); | |||||
| return map; | return map; | ||||
| } | } | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| try { | |||||
| // 保存WxCarPayRecord | |||||
| WxCarPayRecord record = new WxCarPayRecord(); | |||||
| record.setTenantId(tenantId); | |||||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||||
| record.setParkId(parkId); | |||||
| record.setParkName(parkName); | |||||
| record.setPlateNumber(carNumber); | |||||
| record.setSynId(tradeId); | |||||
| if(StringUtils.isNotBlank(inDt)) { | |||||
| record.setEntranceTime(TJDUtil.dateOutFormat.parse(inDt)); | |||||
| } | |||||
| if(StringUtils.isNotBlank(outDt)) { | |||||
| record.setExitTime(TJDUtil.dateOutFormat.parse(outDt)); | |||||
| Long stayedTime = (record.getExitTime().getTime() - record.getEntranceTime().getTime())/ 1000; | |||||
| record.setStayedTime(stayedTime); | |||||
| } | |||||
| if (StringUtils.isNotBlank(stopFee)) { | |||||
| record.setFee(stopFee); | |||||
| } | |||||
| WxCarPayRecord query = new WxCarPayRecord(); | |||||
| query.setTenantId(tenantId); | |||||
| query.setParkId(parkId); | |||||
| query.setSynId(tradeId); | |||||
| PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,1); | |||||
| if(page != null && CollectionUtils.isNotEmpty(page.getList())){ | |||||
| record.setId(page.getList().get(0).getId()); | |||||
| } | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } catch (Exception e) { | |||||
| logger.error("WxCarPayRecord: 出场更新错误 " +e.getMessage()+", " +paramMap.toString()); | |||||
| } | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_SUC); | |||||
| return map; | return map; | ||||
| } | } | ||||
| @@ -222,29 +327,94 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| @RequestMapping(value = "/tjdPaidCallback") | @RequestMapping(value = "/tjdPaidCallback") | ||||
| public Map tjdPaidCallback(@RequestBody Map<String, String> paramMap) { | public Map tjdPaidCallback(@RequestBody Map<String, String> paramMap) { | ||||
| logger.info("["+getIpAddr()+"tjdPaidCallback: " + paramMap.toString()); | logger.info("["+getIpAddr()+"tjdPaidCallback: " + paramMap.toString()); | ||||
| Date currentDate = new Date(); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| String parkId = paramMap.get(TJDUtil.TJD_PARK_ID); | |||||
| String parkName = paramMap.get(TJDUtil.TJD_PARK_NAME); | |||||
| String carNumber = paramMap.get(TJDUtil.TJD_CAR_NUMBER); | |||||
| String tradeId = paramMap.get(TJDUtil.TJD_TRADE_ID); | |||||
| String stopFee = paramMap.get(TJDUtil.TJD_PAY_AMT); | |||||
| String stopFeeTime = paramMap.get(TJDUtil.TJD_PAY_DT); | |||||
| String tradeId = paramMap.get("tradeId"); | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | ||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | ||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_TJD_CALLBACK_PAID.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | ||||
| wxCarCmdLog.setCreateDate(currentDate); | wxCarCmdLog.setCreateDate(currentDate); | ||||
| wxCarCmdLog.setUpdateDate(currentDate); | wxCarCmdLog.setUpdateDate(currentDate); | ||||
| String tenantId = null; | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(parkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdPaidCallback: 车场未找到" + parkId); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_1); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "车场未找到" + parkId); | |||||
| return map; | |||||
| } else { | |||||
| tenantId = park.getTenantId(); | |||||
| wxCarCmdLog.setTenantId(tenantId); | |||||
| } | |||||
| try { | try { | ||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("tjdParkoutCallback: 入库错误" + paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||||
| logger.error("tjdPaidCallback: 入库错误" + paramMap.toString()); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_2); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "入库错误" + paramMap.toString()); | |||||
| return map; | return map; | ||||
| } | } | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| try { | |||||
| // 保存WxCarPayRecord | |||||
| WxCarPayRecord record = new WxCarPayRecord(); | |||||
| record.setTenantId(tenantId); | |||||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||||
| record.setParkId(parkId); | |||||
| record.setParkName(parkName); | |||||
| record.setPlateNumber(carNumber); | |||||
| record.setSynId(tradeId); | |||||
| record.setFee(stopFee); | |||||
| if (StringUtils.isNotBlank(stopFeeTime)) { | |||||
| record.setFeeTime(TJDUtil.dateOutFormat.parse(stopFeeTime)); | |||||
| } | |||||
| WxCarPayRecord query = new WxCarPayRecord(); | |||||
| record.setTenantId(tenantId); | |||||
| record.setParkId(parkId); | |||||
| record.setPlateNumber(carNumber); | |||||
| query.setSynId(tradeId); | |||||
| PageInfo<WxCarPayRecord> page = wxCarPayRecordService.findCarPayListByPage(query,1,2); | |||||
| if(page != null && page.getList().size() > 0){ | |||||
| if(page.getList().size() >= 2){ | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } else { | |||||
| WxCarPayRecord r = page.getList().get(0); | |||||
| if(r.getFeeTime() == null) { | |||||
| // 无缴费信息, 更新 | |||||
| record.setId(r.getId()); | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } else { | |||||
| // 缴费时间在15分钟以内,更新之前的数据, ETCP会把之前的缴费自动退款 | |||||
| if(DateUtils.isInDate15Mins(record.getFeeTime(), r.getFeeTime())) { | |||||
| record.setId(r.getId()); | |||||
| } | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } | |||||
| } | |||||
| } else { | |||||
| wxCarPayRecordService.saveOrUpdate(record); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("WxCarPayRecord: 缴费更新错误 " +e.getMessage()+", "+ paramMap.toString()); | |||||
| //return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||||
| } | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_SUC); | |||||
| return map; | return map; | ||||
| } | } | ||||
| @@ -267,29 +437,45 @@ public class WxCarTJDCallBackController extends BaseController { | |||||
| @RequestMapping(value = "/tjdRefundCallback") | @RequestMapping(value = "/tjdRefundCallback") | ||||
| public Map tjdRefundCallback(@RequestBody Map<String, String> paramMap) { | public Map tjdRefundCallback(@RequestBody Map<String, String> paramMap) { | ||||
| logger.info("["+getIpAddr()+"tjdRefundCallback: " + paramMap.toString()); | logger.info("["+getIpAddr()+"tjdRefundCallback: " + paramMap.toString()); | ||||
| Date currentDate = new Date(); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| String tjdParkId = paramMap.get(TJDUtil.TJD_PARK_ID); | |||||
| String carNumber = paramMap.get(TJDUtil.TJD_CAR_NUMBER); | |||||
| String tradeId = paramMap.get(TJDUtil.TJD_TRADE_ID); | |||||
| String tradeId = paramMap.get("tradeId"); | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | ||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | ||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_TJD_CALLBACK_REFUND.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | ||||
| wxCarCmdLog.setCreateDate(currentDate); | wxCarCmdLog.setCreateDate(currentDate); | ||||
| wxCarCmdLog.setUpdateDate(currentDate); | wxCarCmdLog.setUpdateDate(currentDate); | ||||
| String tenantId = null; | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(tjdParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdRefundCallback: 停简单车场未找到" + tjdParkId); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_1); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "车场未找到" + tjdParkId); | |||||
| return map; | |||||
| } else { | |||||
| tenantId = park.getTenantId(); | |||||
| wxCarCmdLog.setTenantId(tenantId); | |||||
| } | |||||
| try { | try { | ||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("tjdRefundCallback: 入库错误" + paramMap.toString()); | logger.error("tjdRefundCallback: 入库错误" + paramMap.toString()); | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_ERR_2); | |||||
| map.put(TJDUtil.TJD_ERR_MSG, "入库错误" + paramMap.toString()); | |||||
| return map; | return map; | ||||
| } | } | ||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| map.put(TJDUtil.TJD_IS_SUC, TJDUtil.TJD_SUC); | |||||
| return map; | return map; | ||||
| } | } | ||||
| @@ -24,8 +24,10 @@ public class WxCouponPassword extends BaseEntity { | |||||
| @Excel(name = "兑换码", width = 20, orderNum = "1") | @Excel(name = "兑换码", width = 20, orderNum = "1") | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户名称",name="password") | @io.swagger.annotations.ApiModelProperty(value="商户名称",name="password") | ||||
| private String password; | private String password; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡密状态: 0初始1信息发出中2信息已发出3已使用",name="status") | |||||
| @Excel(name = "状态", width = 20, replace = {"初始_0", "发送中_1", "已发出_2", "已使用_3", "不可用_4"}, orderNum = "3") | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡密状态: 0初始1信息发出中2信息已发出3已使用4已过期",name="status") | |||||
| private Integer status; | private Integer status; | ||||
| @Excel(name = "发送手机", width = 20, orderNum = "4") | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡密发送到手机",name="sendedPhone") | @io.swagger.annotations.ApiModelProperty(value="卡密发送到手机",name="sendedPhone") | ||||
| private String sendedPhone; | private String sendedPhone; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡包ID(coupon_order_id/card_id)",name="cardId") | @io.swagger.annotations.ApiModelProperty(value="卡包ID(coupon_order_id/card_id)",name="cardId") | ||||
| @@ -34,9 +36,13 @@ public class WxCouponPassword extends BaseEntity { | |||||
| private Date createDate; | private Date createDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @Excel(name="过期时间",width = 20,format="yyyy-MM-dd", orderNum = "2") | |||||
| @io.swagger.annotations.ApiModelProperty(value="过期时间",name="expireDate") | @io.swagger.annotations.ApiModelProperty(value="过期时间",name="expireDate") | ||||
| private Date expireDate; | private Date expireDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "发放ID", name = "presentId") | |||||
| private Long presentId; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String statusStr; | private String statusStr; | ||||
| @@ -11,4 +11,6 @@ public class WxCouponPasswordCountInfoVO { | |||||
| private Long couponId; | private Long couponId; | ||||
| private String couponName; | private String couponName; | ||||
| private Long couponCount; | private Long couponCount; | ||||
| private String price; | |||||
| } | } | ||||
| @@ -30,8 +30,4 @@ public interface WxCreditHistoryMapper extends CommonMapper<WxCreditHistory, Lon | |||||
| long getDecrementCreditAmount(WxCreditHistory wxCreditHistory); | long getDecrementCreditAmount(WxCreditHistory wxCreditHistory); | ||||
| long getPeopleCount(WxCreditHistory wxCreditHistory); | long getPeopleCount(WxCreditHistory wxCreditHistory); | ||||
| List<WxCreditHistory> findListAfter(Integer creditType, String dateTime); | |||||
| List<WxCreditHistory> findListByIds(@Param("userIds") List<Long> userIds); | |||||
| } | } | ||||
| @@ -6,7 +6,6 @@ import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| public interface WxCouponPasswordService { | public interface WxCouponPasswordService { | ||||
| @@ -58,9 +57,6 @@ public interface WxCouponPasswordService { | |||||
| */ | */ | ||||
| void mkPasswords(String tenantId, Long couponId, Integer inventory); | void mkPasswords(String tenantId, Long couponId, Integer inventory); | ||||
| List<WxCouponPasswordCountInfoVO> findCouponList(String tenantId); | |||||
| /** | /** | ||||
| * 导出兑换码 | * 导出兑换码 | ||||
| * @param request | * @param request | ||||
| @@ -69,4 +65,6 @@ public interface WxCouponPasswordService { | |||||
| */ | */ | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword); | void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword); | ||||
| PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize); | |||||
| } | } | ||||
| @@ -11,6 +11,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -91,13 +92,6 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| wxCouponPasswordMapper.deleteById(id); | wxCouponPasswordMapper.deleteById(id); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponPasswordCountInfoVO> findCouponList(String tenantId) { | |||||
| WxCouponPassword wxCouponPassword = new WxCouponPassword(); | |||||
| wxCouponPassword.setTenantId(tenantId); | |||||
| return wxCouponPasswordMapper.findCouponCountInfo(wxCouponPassword); | |||||
| } | |||||
| @Override | @Override | ||||
| public void mkPasswords(String tenantId, Long couponId, Integer inventory) { | public void mkPasswords(String tenantId, Long couponId, Integer inventory) { | ||||
| String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||||
| @@ -146,6 +140,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| newOne.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | newOne.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | ||||
| newOne.setCreateDate(curDate); | newOne.setCreateDate(curDate); | ||||
| newOne.setUpdateDate(curDate); | newOne.setUpdateDate(curDate); | ||||
| newOne.setExpireDate(DateUtils.getTimeAfterDays(30, curDate)); | |||||
| couponPasswords.add(newOne); | couponPasswords.add(newOne); | ||||
| } | } | ||||
| wxCouponPasswordMapper.insertCouponPasswds(couponPasswords); | wxCouponPasswordMapper.insertCouponPasswds(couponPasswords); | ||||
| @@ -161,6 +156,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findCouponCountInfo(record)); | |||||
| } | |||||
| /* | /* | ||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | ||||
| @@ -101,13 +101,14 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||||
| } | } | ||||
| //添加记录 | //添加记录 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | |||||
| long id = idWorker.nextId(); | |||||
| record.setId(id); | |||||
| record.setCouponName(wxCoupon.getTitle()); | record.setCouponName(wxCoupon.getTitle()); | ||||
| record.setSendAmount(phoneSet.size()); | record.setSendAmount(phoneSet.size()); | ||||
| wxCouponPresentMapper.insert(record); | wxCouponPresentMapper.insert(record); | ||||
| //小程序 | //小程序 | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantId); | WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantId); | ||||
| String priceStr = wxCoupon.getPriceStr(); | |||||
| String title = wxCoupon.getTitle(); | |||||
| String name = appInfo.getName(); | String name = appInfo.getName(); | ||||
| List<WxCouponPassword> tempList = wxCouponPasswordMapper.findList(wxCouponPassword); | List<WxCouponPassword> tempList = wxCouponPasswordMapper.findList(wxCouponPassword); | ||||
| //循环发送 | //循环发送 | ||||
| @@ -115,8 +116,9 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||||
| for (String phone : phoneSet) { | for (String phone : phoneSet) { | ||||
| WxCouponPassword couponPassword = list.get(i); | WxCouponPassword couponPassword = list.get(i); | ||||
| //发送 | //发送 | ||||
| sendMsg(tenantId, phone, priceStr, name, couponPassword.getPassword()); | |||||
| sendMsg(tenantId, phone, title, name, couponPassword.getPassword(), couponPassword.getId().toString()); | |||||
| //记录发送数据便于更新状态 | //记录发送数据便于更新状态 | ||||
| couponPassword.setPresentId(id); | |||||
| couponPassword.setSendedPhone(phone); | couponPassword.setSendedPhone(phone); | ||||
| tempList.add(couponPassword); | tempList.add(couponPassword); | ||||
| i++; | i++; | ||||
| @@ -126,14 +128,15 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| private void sendMsg(String tenantId, String phone, String money, String appName, String password) { | |||||
| private void sendMsg(String tenantId, String phone, String title, String appName, String password, String id) { | |||||
| logger.info("》》》》》》》》》》》"); | logger.info("》》》》》》》》》》》"); | ||||
| logger.info("系统发卡发送短信开始"); | logger.info("系统发卡发送短信开始"); | ||||
| logger.info("》》》》》》》》》》》"); | logger.info("》》》》》》》》》》》"); | ||||
| Map<String, String> msgReplaceMap = new HashMap(); | Map<String, String> msgReplaceMap = new HashMap(); | ||||
| msgReplaceMap.put("id", id); | |||||
| msgReplaceMap.put("app", appName); | msgReplaceMap.put("app", appName); | ||||
| msgReplaceMap.put("money", money); | |||||
| msgReplaceMap.put("password", password); | |||||
| msgReplaceMap.put("title", title); | |||||
| msgReplaceMap.put("pw", password); | |||||
| WxMsgRecord wxMsgRecord = new WxMsgRecord(); | WxMsgRecord wxMsgRecord = new WxMsgRecord(); | ||||
| wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | ||||
| wxMsgRecord.setModelType(EnumMsgModel.COUPON_CARD_SEND.getCode()); | wxMsgRecord.setModelType(EnumMsgModel.COUPON_CARD_SEND.getCode()); | ||||
| @@ -28,18 +28,53 @@ import java.util.Map; | |||||
| * 停简单 停车管理 | * 停简单 停车管理 | ||||
| */ | */ | ||||
| @Component | @Component | ||||
| public class TJDCarUtil { | |||||
| public class TJDUtil { | |||||
| private final static Logger logger = LoggerFactory.getLogger(TJDCarUtil.class); | |||||
| public static final String TJD_URL = "url"; | |||||
| public static final String TJD_ACCOUNT = "partner"; | |||||
| public static final String TJD_ACCOUNT_KEY = "key"; | |||||
| public static final String TJD_VERSION = "version"; | |||||
| public static final String TJD_CHARSET = "charset"; | |||||
| public static final String TJD_RETURN_CODE = "returnCode"; | |||||
| public static final String TJD_RETURN_SUCC = "T"; | |||||
| public static final String TJD_RETURN_FAIL = "F"; | |||||
| public static final String TJD_IS_SUC = "isSuccess"; | |||||
| public static final String TJD_ERR_MSG = "errorMSG"; | |||||
| public static final String TJD_SUC = "0"; | |||||
| public static final String TJD_ERR_1 = "1"; // 业务级失败(不进行重发) | |||||
| public static final String TJD_ERR_2 = "2"; // 系统级失败(有重发机制) | |||||
| public static final String TJD_PARK_ID = "parkId"; | |||||
| public static final String TJD_PARK_NAME = "parkName"; | |||||
| public static final String TJD_CAR_NUMBER = "carNum"; | |||||
| public static final String TJD_TRADE_ID = "tradeId"; | |||||
| public static final String TJD_IN_DT = "inDt"; | |||||
| public static final String TJD_OUT_DT = "outDt"; | |||||
| public static final String TJD_PARK_AMT = "parkAmount"; | |||||
| public static final String TJD_PAY_AMT = "payAmount"; | |||||
| public static final String TJD_PAY_DT = "payDt"; | |||||
| public static final String TJD_FREE_MINS = "freeMins"; | |||||
| public static final SimpleDateFormat dateInFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| public static final SimpleDateFormat dateOutFormat = new SimpleDateFormat("yyyyMMddHHmmss"); | |||||
| private final static Logger logger = LoggerFactory.getLogger(TJDUtil.class); | |||||
| private static String baseurl = "http://prep.tingjiandan.com/openapi/gateway"; | private static String baseurl = "http://prep.tingjiandan.com/openapi/gateway"; | ||||
| private static String partner = "7dbc8ec9037d403b822cb60addfdc681"; | |||||
| private static String key = "f356cb1bf5a74fb7a564e86128d2c49f"; | |||||
| private static String partner = "fb21a5b2f7064ff5afb8288d5bb48ca8"; | |||||
| private static String key = "bc2f09be8f5b4227898346cf6fe451c2"; | |||||
| private static String version = "1.0"; | private static String version = "1.0"; | ||||
| // | |||||
| // {"url":"http://prep.tingjiandan.com/openapi/gateway","partnerId":"fb21a5b2f7064ff5afb8288d5bb48ca8","key":"bc2f09be8f5b4227898346cf6fe451c2","parkId":"7715622dff834b34a44448b801c27607", "version":"1.0.0"} | |||||
| // | |||||
| public static void main(String[] args) throws Exception { | public static void main(String[] args) throws Exception { | ||||
| String carNumber = "京HLTT01"; | |||||
| String carNumber = "京XAZMF1"; | |||||
| String result = infoForFreeMins(baseurl, partner, key, version, carNumber); | String result = infoForFreeMins(baseurl, partner, key, version, carNumber); | ||||
| @@ -51,9 +86,9 @@ public class TJDCarUtil { | |||||
| paramMap1.put("deductionAmount", obj.getString("totalAmount")); | paramMap1.put("deductionAmount", obj.getString("totalAmount")); | ||||
| paramMap1.put("outTradeNo", "utf-8"); | paramMap1.put("outTradeNo", "utf-8"); | ||||
| paramMap1.put("accountId", obj.getString("accountId")); | paramMap1.put("accountId", obj.getString("accountId")); | ||||
| paramMap1.put("charset", "utf-8"); | |||||
| paramMap1.put("partner", partner); | |||||
| paramMap1.put("version", version); | |||||
| paramMap1.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap1.put(TJD_ACCOUNT, partner); | |||||
| paramMap1.put(TJD_VERSION, version); | |||||
| deductionNotSettle(baseurl, key, paramMap1); | deductionNotSettle(baseurl, key, paramMap1); | ||||
| */ | */ | ||||
| @@ -85,8 +120,7 @@ public class TJDCarUtil { | |||||
| */ | */ | ||||
| public static String getCurrentDate() { | public static String getCurrentDate() { | ||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| String timestamp = sdf.format(currentDate); | |||||
| String timestamp = dateInFormat.format(currentDate); | |||||
| return timestamp; | return timestamp; | ||||
| } | } | ||||
| @@ -135,7 +169,7 @@ public class TJDCarUtil { | |||||
| String service = "parkhub.car.register"; | String service = "parkhub.car.register"; | ||||
| Map<String, String> paramMap = MapUtil.getOrderMap(); | Map<String, String> paramMap = MapUtil.getOrderMap(); | ||||
| paramMap.put("carNum", carNum); | |||||
| paramMap.put(TJD_CAR_NUMBER, carNum); | |||||
| paramMap.put("carNumColor", carNumColor); | paramMap.put("carNumColor", carNumColor); | ||||
| if (phone != null) { | if (phone != null) { | ||||
| paramMap.put("phone", phone); | paramMap.put("phone", phone); | ||||
| @@ -143,9 +177,9 @@ public class TJDCarUtil { | |||||
| if (outCarId != null) { | if (outCarId != null) { | ||||
| paramMap.put("outCardId", outCarId); | paramMap.put("outCardId", outCarId); | ||||
| } | } | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| @@ -186,9 +220,9 @@ public class TJDCarUtil { | |||||
| Map<String, String> paramMap = MapUtil.getOrderMap(); | Map<String, String> paramMap = MapUtil.getOrderMap(); | ||||
| paramMap.put("carId", carId); | paramMap.put("carId", carId); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| @@ -228,42 +262,32 @@ public class TJDCarUtil { | |||||
| String freeMins = "0"; | String freeMins = "0"; | ||||
| Map<String, String> paramMap = MapUtil.getOrderMap(); | Map<String, String> paramMap = MapUtil.getOrderMap(); | ||||
| paramMap.put("carNum", carNum); | |||||
| paramMap.put(TJD_CAR_NUMBER, carNum); | |||||
| //paramMap.put("carNumColor", ""); | //paramMap.put("carNumColor", ""); | ||||
| //paramMap.put("pmParkId", ""); | //paramMap.put("pmParkId", ""); | ||||
| paramMap.put("freeMins", freeMins); | |||||
| paramMap.put(TJD_FREE_MINS, freeMins); | |||||
| //paramMap.put("tradeId", ""); | //paramMap.put("tradeId", ""); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /* | /* | ||||
| "{ | |||||
| \"wLon\":\"116.310335\", | |||||
| \"returnCode\":\"T\", | |||||
| \"lon\":\"116.316819\", | |||||
| \"accountId\":\"5b3c15e15235486eba9abae41ae3f820\", | |||||
| \"freeThroughTime\":\"30\", | |||||
| \"customerServicePhone\":\"400-001-0606\", | |||||
| \"tradeId\":\"3a3475c501f8464cbb3ff1b6670690d6\", | |||||
| \"returnMsg\":\"OK\", | |||||
| \"outDt\":\"20180609164753\", | |||||
| \"isSuccess\":\"0\", | |||||
| \"pmParkId\":\"7715622dff834b34a44448b801c27607\", | |||||
| \"unPayAmount\":\"12.00\", | |||||
| \"timestamp\":\"1528534070691\", | |||||
| \"errorMSG\":\"\", | |||||
| \"parkTime\":\"107273\", | |||||
| \"wLat\":\"39.93609\", | |||||
| \"totalAmount\":\"12.00\", | |||||
| \"paidAmount\":\"0.00\", | |||||
| \"freeMinsAmount\":\"0\", | |||||
| \"payUrl\":\"https://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=30040&isShowDetail=true&orderId=3a3475c501f8464cbb3ff1b6670690d6\", | |||||
| \"lat\":\"39.942078\", | |||||
| \"inDt\":\"20180608110000\" | |||||
| }\n"; | |||||
| { | |||||
| "wLon":"116.310335", | |||||
| "returnCode":"T", | |||||
| "lon":"116.316813", | |||||
| "accountId":"818a6ac865e841119ec9aab21c5e5a24", | |||||
| "freeThroughTime":"10", | |||||
| "customerServicePhone":"400-001-0606", | |||||
| "tradeId":"2ae003431584495081014428c90173ab", | |||||
| "returnMsg":"OK", | |||||
| "outDt":"20190920110443", | |||||
| "isSuccess":"0", | |||||
| "miniProgram":"{\"path\": \"pages/pre_pay/index/main\",\"extraData\": {\"prePayType\": \"16\",\"channel\": \"30166\",\"isShowDetail\": \"true\",\"partnerId\": \"956ca31ac8464cf7b6a876e8887912f3\",\"orderId\": \"2ae003431584495081014428c90173ab\"}}","pmParkId":"7715622dff834b34a44448b801c27607","unPayAmount":"88.12","timestamp":"1568948681580","errorMSG":"","parkTime":"81629","wLat":"39.93609","totalAmount":"88.12","paidAmount":"0.00","freeMinsAmount":"0.00","payUrl":"https://prep.tingjiandan.com/tcweixin/letter/prePay/pagePayInPark?prePayType=16&channel=30166&isShowDetail=true&partnerId=&orderId=2ae003431584495081014428c90173ab&returnUrl=", | |||||
| "lat":"39.942078", | |||||
| "inDt":"20190919122414"} | |||||
| */ | */ | ||||
| return result; | return result; | ||||
| } | } | ||||
| @@ -304,13 +328,13 @@ public class TJDCarUtil { | |||||
| // 为指定订单抵扣停车费,如果此时车辆已经出场,返回isSuccess错误码为3,停简单系统不再接收此笔抵扣信息,对方系统 需要给用户发起退款。 | // 为指定订单抵扣停车费,如果此时车辆已经出场,返回isSuccess错误码为3,停简单系统不再接收此笔抵扣信息,对方系统 需要给用户发起退款。 | ||||
| String service = "parkhub.order.deductionNotSettle"; | String service = "parkhub.order.deductionNotSettle"; | ||||
| Map<String, String> paramMap = MapUtil.getOrderMap(); | Map<String, String> paramMap = MapUtil.getOrderMap(); | ||||
| paramMap.put("tradeId", tradeId); | |||||
| paramMap.put(TJD_TRADE_ID, tradeId); | |||||
| paramMap.put("deductionAmount", deductionAmount); | paramMap.put("deductionAmount", deductionAmount); | ||||
| paramMap.put("outTradeNo", outTradeNo); | paramMap.put("outTradeNo", outTradeNo); | ||||
| paramMap.put("accountId", accountId); | paramMap.put("accountId", accountId); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /* | /* | ||||
| @@ -356,9 +380,9 @@ public class TJDCarUtil { | |||||
| paramMap.put("deductionAmount", deductionAmount); | paramMap.put("deductionAmount", deductionAmount); | ||||
| paramMap.put("outTradeNo", outTradeNo); | paramMap.put("outTradeNo", outTradeNo); | ||||
| paramMap.put("accountId", accountId); | paramMap.put("accountId", accountId); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /* | /* | ||||
| @@ -407,9 +431,9 @@ public class TJDCarUtil { | |||||
| paramMap.put("prePayType", prePayType); | paramMap.put("prePayType", prePayType); | ||||
| paramMap.put("minutes", minutes); | paramMap.put("minutes", minutes); | ||||
| paramMap.put("memo", memo); | paramMap.put("memo", memo); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /*{ | /*{ | ||||
| @@ -463,9 +487,9 @@ public class TJDCarUtil { | |||||
| paramMap.put("EndDt", EndDt); | paramMap.put("EndDt", EndDt); | ||||
| paramMap.put("expireDt", expireDt); | paramMap.put("expireDt", expireDt); | ||||
| paramMap.put("memo", memo); | paramMap.put("memo", memo); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /*{ | /*{ | ||||
| @@ -506,9 +530,9 @@ public class TJDCarUtil { | |||||
| Map<String, String> paramMap = MapUtil.getOrderMap(); | Map<String, String> paramMap = MapUtil.getOrderMap(); | ||||
| paramMap.put("tradeId", tradeId); | paramMap.put("tradeId", tradeId); | ||||
| paramMap.put("ticketid", ticketid); | paramMap.put("ticketid", ticketid); | ||||
| paramMap.put("charset", "utf-8"); | |||||
| paramMap.put("partner", partner); | |||||
| paramMap.put("version", version); | |||||
| paramMap.put(TJD_CHARSET, "utf-8"); | |||||
| paramMap.put(TJD_ACCOUNT, partner); | |||||
| paramMap.put(TJD_VERSION, version); | |||||
| String result = Proc(url, key, service, paramMap); | String result = Proc(url, key, service, paramMap); | ||||
| /*{ | /*{ | ||||
| @@ -13,10 +13,12 @@ | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| <result column="expire_date" jdbcType="TIMESTAMP" property="expireDate" /> | <result column="expire_date" jdbcType="TIMESTAMP" property="expireDate" /> | ||||
| <result column="present_id" jdbcType="TIMESTAMP" property="presentId"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date` | |||||
| `id`,`tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -54,6 +56,11 @@ | |||||
| <if test=" null != expireDate "> | <if test=" null != expireDate "> | ||||
| and `expire_date` > #{expireDate} | and `expire_date` > #{expireDate} | ||||
| </if> | </if> | ||||
| <if test=" null != presentId "> | |||||
| and `present_id` = #{presentId} | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -77,7 +84,7 @@ | |||||
| <select id="findAvaPasswordListByCouponId" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap"> | <select id="findAvaPasswordListByCouponId" parameterType="com.iformall.domain.po.WxCouponPassword" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> | select <include refid="allColumns" /> | ||||
| from wx_coupon_password | from wx_coupon_password | ||||
| <where> `status` not in (3,4) | |||||
| <where> | |||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| </if> | </if> | ||||
| @@ -119,24 +126,29 @@ | |||||
| <result column="coupon_count" jdbcType="BIGINT" property="couponCount"/> | <result column="coupon_count" jdbcType="BIGINT" property="couponCount"/> | ||||
| <result column="title" jdbcType="VARCHAR" property="couponName"/> | <result column="title" jdbcType="VARCHAR" property="couponName"/> | ||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | ||||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||||
| </resultMap> | </resultMap> | ||||
| <select id="findCouponCountInfo" parameterType="com.iformall.domain.po.WxCouponPassword" | <select id="findCouponCountInfo" parameterType="com.iformall.domain.po.WxCouponPassword" | ||||
| resultMap="CouponCountInfoMap"> | resultMap="CouponCountInfoMap"> | ||||
| select cp.coupon_id,c.title,cp.coupon_count from | |||||
| select cp.coupon_id,c.title,c.price,cp.coupon_count from | |||||
| (select count(*) as coupon_count,coupon_id from wx_coupon_password | (select count(*) as coupon_count,coupon_id from wx_coupon_password | ||||
| where tenant_id#{tenantId} and status=0) cp | |||||
| where tenant_id=#{tenantId} and status=0 group by coupon_id) cp | |||||
| inner join wx_coupon c on cp.coupon_id = c.id | inner join wx_coupon c on cp.coupon_id = c.id | ||||
| where c.tenant_id=#{tenantId} and c.status=1 | |||||
| where c.tenant_id=#{tenantId} and c.status=0 | |||||
| <if test=" null != couponId "> | <if test=" null != couponId "> | ||||
| and cp.`coupon_id` = #{couponId} | and cp.`coupon_id` = #{couponId} | ||||
| </if> | </if> | ||||
| group by cp.coupon_id | group by cp.coupon_id | ||||
| order by c.create_date desc | |||||
| </select> | </select> | ||||
| <update id="updateStatus" parameterType="java.util.List"> | <update id="updateStatus" parameterType="java.util.List"> | ||||
| <foreach collection="list" item="item" index="index" open="" close="" separator=";"> | <foreach collection="list" item="item" index="index" open="" close="" separator=";"> | ||||
| update wx_coupon_password set status=1,send_phone=#{sendPhone},update_date=now() where id = ${item.id} | |||||
| update wx_coupon_password set | |||||
| status=1,sended_phone=#{item.sendedPhone},update_date=now(),expire_date=date_add(now(),interval 30 DAY), | |||||
| present_id=#{item.presentId} | |||||
| where id = #{item.id} | |||||
| </foreach> | </foreach> | ||||
| </update> | </update> | ||||
| @@ -34,10 +34,10 @@ | |||||
| and `phones` like concat('%', #{phones},'%') | and `phones` like concat('%', #{phones},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != sendTimeStart and null!=sendTimeEnd "> | <if test=" null != sendTimeStart and null!=sendTimeEnd "> | ||||
| and `create_date` between #{sendTimeStart} and #{sendTimeEnd} | |||||
| and `create_time` between #{sendTimeStart} and #{sendTimeEnd} | |||||
| </if> | </if> | ||||
| <if test=" null != updateTime "> | <if test=" null != updateTime "> | ||||
| and `update_date` = #{updateTime} | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -210,10 +210,7 @@ | |||||
| <select id="getTotalCreditAmount" parameterType="com.iformall.domain.po.WxCreditHistory" | <select id="getTotalCreditAmount" parameterType="com.iformall.domain.po.WxCreditHistory" | ||||
| resultType="java.lang.Long"> | resultType="java.lang.Long"> | ||||
| select ifnull(sum(credit.amount),0) amount from ( | select ifnull(sum(credit.amount),0) amount from ( | ||||
| select credit.credit_amount as amount,credit.c_user_id from wx_credit_history credit | |||||
| INNER join (select max(create_date) create_date,credit.c_user_id | |||||
| from wx_credit_history credit group by credit.c_user_id) credit_max_id | |||||
| on credit.create_date=credit_max_id.create_date and credit.c_user_id=credit_max_id.c_user_id | |||||
| select basic.credit as amount,credit.c_user_id from wx_credit_history credit | |||||
| INNER JOIN wx_c_user_basic_info basic ON basic.id = credit.c_user_id | INNER JOIN wx_c_user_basic_info basic ON basic.id = credit.c_user_id | ||||
| LEFT JOIN wx_merchant merchant ON credit.merchant_id = merchant.id | LEFT JOIN wx_merchant merchant ON credit.merchant_id = merchant.id | ||||
| <include refid="customWhereConditions"/> | <include refid="customWhereConditions"/> | ||||
| @@ -249,17 +246,4 @@ | |||||
| ) credit | ) credit | ||||
| </select> | </select> | ||||
| <select id="findListAfter" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_credit_history where create_date > #{dateTime} and credit_type = #{creditType} | |||||
| </select> | |||||
| <select id="findListByIds" parameterType="java.util.List" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_credit_history | |||||
| where c_user_id in | |||||
| <foreach collection="userIds" index="index" item="item" open="(" separator="," close=")"> | |||||
| #{item} | |||||
| </foreach> | |||||
| order by create_date desc | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -15,11 +15,12 @@ | |||||
| <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" /> | ||||
| <result column="callback_id" jdbcType="BIGINT" property="callbackId" /> | <result column="callback_id" jdbcType="BIGINT" property="callbackId" /> | ||||
| <result column="msg_id" jdbcType="BIGINT" property="msgId" /> | <result column="msg_id" jdbcType="BIGINT" property="msgId" /> | ||||
| <result column="business_id" jdbcType="BIGINT" property="businessId"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`batch_no`,`phone`,`begintime`,`endtime`,`status`,`status_msg`,`sign`,`createtime`,`updatetime`,`msg_id`,`callback_id` | |||||
| `id`,`tenant_id`,`batch_no`,`phone`,`begintime`,`endtime`,`status`,`status_msg`,`sign`,`createtime`,`updatetime`,`msg_id`,`callback_id`,`business_id` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -1,8 +1,6 @@ | |||||
| package com.iformall.controller.sys; | package com.iformall.controller.sys; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.google.common.base.Function; | |||||
| import com.google.common.collect.*; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| @@ -11,22 +9,18 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumMsgModel; | import com.iformall.enums.EnumMsgModel; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.enums.EnumUserType; | import com.iformall.enums.EnumUserType; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCreditHistoryService; | import com.iformall.service.WxCreditHistoryService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.collections.CollectionUtils; | |||||
| import org.checkerframework.checker.nullness.qual.Nullable; | |||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.atomic.AtomicInteger; | |||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| /** | /** | ||||
| @@ -41,8 +35,6 @@ public class DataInitController extends BaseController { | |||||
| @Resource | @Resource | ||||
| private WxMallMapper mallMapper; | private WxMallMapper mallMapper; | ||||
| @Resource | @Resource | ||||
| private WxMsgSignatureMapper signatureMapper; | |||||
| @Resource | |||||
| private WxMsgValidationcodeModelMapper modelMapper; | private WxMsgValidationcodeModelMapper modelMapper; | ||||
| @Resource | @Resource | ||||
| private WxCreditHistoryMapper creditHistoryMapper; | private WxCreditHistoryMapper creditHistoryMapper; | ||||
| @@ -63,9 +55,23 @@ public class DataInitController extends BaseController { | |||||
| @Resource | @Resource | ||||
| private WxMerchantBUserMapper merchantBUserMapper; | private WxMerchantBUserMapper merchantBUserMapper; | ||||
| @Resource | |||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @PostMapping("/createMsgModel") | |||||
| @ApiImplicitParam(name = "content", value = "content", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData createMsgModel(String content) { | |||||
| try { | |||||
| MallUserInfo userInfo = getUser(); | |||||
| if (userInfo.isFmSuperAdmin()) { | |||||
| addMsgModel(content); | |||||
| return new ResultData(); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| log.error("DataInitController::createMsgModel error ", e); | |||||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("/init") | @GetMapping("/init") | ||||
| public ResultData init() { | public ResultData init() { | ||||
| @@ -84,49 +90,6 @@ public class DataInitController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| /** | |||||
| * 积分数据修复 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("/fixCredit") | |||||
| public ResultData fixCredit() { | |||||
| try { | |||||
| MallUserInfo userInfo = getUser(); | |||||
| if(userInfo.isFmSuperAdmin()) { | |||||
| doFixCredit(); | |||||
| return new ResultData(); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| log.error("DataInitController::fixCredit error ", e); | |||||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| /** | |||||
| * 修复wx_c_user_basic_info积分数据 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("/fixCredit4CUserBasic") | |||||
| public ResultData fixCredit4CUserBasic() { | |||||
| try { | |||||
| MallUserInfo userInfo = getUser(); | |||||
| if (userInfo.isFmSuperAdmin()) { | |||||
| doFixCredit4CUserBasic(); | |||||
| return new ResultData(); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| log.error("DataInitController::fixCredit4CUserBasic error ", e); | |||||
| return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| /** | /** | ||||
| * 核销积分数据修复 | * 核销积分数据修复 | ||||
| * | * | ||||
| @@ -148,105 +111,6 @@ public class DataInitController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public void doFixCredit4CUserBasic() { | |||||
| log.debug("cUserBasic积分更新, begin --------------》"); | |||||
| // 1 查找c_user_basic中c_user不存在且积分为null的用户用户 | |||||
| List<WxCUserBasicInfo> userBasicInfoList = cUserBasicInfoMapper.selectNotCUserList(); | |||||
| List<Long> ids = userBasicInfoList.stream().map(WxCUserBasicInfo::getId).collect(Collectors.toList()); | |||||
| //log.debug("ids {}", JSON.toJSONString(ids)); | |||||
| // 2 获取对应用户的积分记录 | |||||
| List<WxCreditHistory> creditList = creditHistoryMapper.findListByIds(ids); | |||||
| ImmutableListMultimap<Long, WxCreditHistory> userCreditHistory = Multimaps.index(creditList, new Function<WxCreditHistory, Long>() { | |||||
| @Nullable | |||||
| @Override | |||||
| public Long apply(@Nullable WxCreditHistory input) { | |||||
| return input.getCUserId(); | |||||
| } | |||||
| }); | |||||
| //3 将历史记录最好积分重设积分 | |||||
| AtomicInteger count = new AtomicInteger(0); | |||||
| userBasicInfoList.forEach(wxCUserBasicInfo -> { | |||||
| ImmutableList<WxCreditHistory> historyList = userCreditHistory.get(wxCUserBasicInfo.getId()); | |||||
| WxCUserBasicInfo toUpdateUser = new WxCUserBasicInfo(); | |||||
| toUpdateUser.setId(wxCUserBasicInfo.getId()); | |||||
| //用户积分不存在,跳过 | |||||
| if (CollectionUtils.isEmpty(historyList)) { | |||||
| //log.debug("cUserBasic积分更新,id: {} 积分记录不存在", wxCUserBasicInfo.getId()); | |||||
| return; | |||||
| } | |||||
| //积分记录存在,使用最新的总积分重新赋值 | |||||
| WxCreditHistory wxCreditHistory = historyList.get(0); | |||||
| toUpdateUser.setCredit(wxCreditHistory.getCreditAmount()); | |||||
| cUserBasicInfoMapper.updateById(toUpdateUser); | |||||
| log.debug("cUserBasic积分更新,id: {},原积分: {},新积分: {}, 积分时间: {}", wxCUserBasicInfo.getId(), wxCUserBasicInfo.getCredit(), toUpdateUser.getCredit(), DateUtils.format(wxCreditHistory.getCreateDate())); | |||||
| count.getAndIncrement(); | |||||
| }); | |||||
| log.debug("cUserBasic积分更新,更新用户 {}", count.intValue()); | |||||
| log.debug("cUserBasic积分更新, end --------------》"); | |||||
| } | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public void doFixCredit() { | |||||
| // 1 获取积分记录 | |||||
| List<WxCreditHistory> creditList = creditHistoryMapper.findListAfter(10, "2019-09-16 22:00:00"); | |||||
| // 2 重新计算积分,比较是否需要修复 | |||||
| creditList.forEach(wxCreditHistory -> { | |||||
| WxCUser cUser = cUserMapper.selectById(wxCreditHistory.getCUserId()); | |||||
| WxCUserBasicInfo userBasicInfo = cUserBasicInfoMapper.selectById(wxCreditHistory.getCUserId()); | |||||
| //排查不存在的用户 | |||||
| if (Objects.isNull(cUser) && Objects.isNull(userBasicInfo)) { | |||||
| log.debug("用户不存在 id: {}", wxCreditHistory.getId()); | |||||
| return; | |||||
| } | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.setStatus(1); | |||||
| wxMerchant.setId(wxCreditHistory.getMerchantId()); | |||||
| List<WxMerchant> wxMerchantList = wxMerchantMapper.findList(wxMerchant); | |||||
| if (wxMerchantList == null || wxMerchantList.size() == 0) { | |||||
| log.debug(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage()); | |||||
| return; | |||||
| } | |||||
| //根据商户id和花费金额计算需要新增的积分 | |||||
| Map<String, Integer> result = creditHistoryService.findByMerchantIdAndSpend(wxCreditHistory.getMerchantId(), String.valueOf(new BigDecimal(wxCreditHistory.getSpend()/100)), wxCreditHistory.getCUserId(),wxCreditHistory.getTenantId()); | |||||
| //Map<String, Integer> result = creditHistoryService.findByMerchantIdAndSpend(wxCreditHistory.getMerchantId(), String.valueOf(wxCreditHistory.getSpend()), wxCreditHistory.getCUserId(), wxCreditHistory.getTenantId()); | |||||
| Integer creditDB = wxCreditHistory.getCreditNum(); | |||||
| Integer credit = result.get("credit"); | |||||
| if (Objects.equals(credit, creditDB)) { | |||||
| log.debug("本次积分计算:正确, id: {},原积分: {},重新计算积分: {}, 积分时间: {}", wxCreditHistory.getId(), creditDB, credit, DateUtils.format(wxCreditHistory.getCreateDate())); | |||||
| } else { | |||||
| log.debug("本次积分计算:错误, id: {},原积分: {},重新计算积分: {}, 积分时间: {}", wxCreditHistory.getId(), creditDB, credit, DateUtils.format(wxCreditHistory.getCreateDate())); | |||||
| // 3 重新计算积分 | |||||
| //用户新积分 | |||||
| Integer newCredit = wxCreditHistory.getCreditAmount() - creditDB + credit; | |||||
| // 4 更新积分 | |||||
| WxCUser toUpdateCUser = new WxCUser(); | |||||
| toUpdateCUser.setId(wxCreditHistory.getCUserId()); | |||||
| toUpdateCUser.setCredit(newCredit); | |||||
| toUpdateCUser.setUpdateDate(new Date()); | |||||
| cUserMapper.updateById(toUpdateCUser); | |||||
| WxCUserBasicInfo toUpdateBasicInfo = new WxCUserBasicInfo(); | |||||
| toUpdateBasicInfo.setId(wxCreditHistory.getCUserId()); | |||||
| toUpdateBasicInfo.setCredit(newCredit); | |||||
| toUpdateBasicInfo.setUpdateDate(new Date()); | |||||
| cUserBasicInfoMapper.updateById(toUpdateBasicInfo); | |||||
| WxCreditHistory toUpdateCreditHistory = new WxCreditHistory(); | |||||
| toUpdateCreditHistory.setId(wxCreditHistory.getId()); | |||||
| toUpdateCreditHistory.setCreditNum(credit); | |||||
| toUpdateCreditHistory.setCreditAmount(newCredit); | |||||
| creditHistoryMapper.updateById(toUpdateCreditHistory); | |||||
| } | |||||
| }); | |||||
| } | |||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public void doFixVerifyCredit() { | public void doFixVerifyCredit() { | ||||
| // 1 获取券码 | // 1 获取券码 | ||||
| @@ -298,6 +162,12 @@ public class DataInitController extends BaseController { | |||||
| }); | }); | ||||
| } | } | ||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public void addMsgModel(String context) { | |||||
| IdWorker idWorker = IdWorker.get(); | |||||
| addBirthDayMsgModelToMall(EnumMsgModel.COUPON_BIRTHDAY_OPENED, idWorker, context); | |||||
| } | |||||
| /** | /** | ||||
| * 增加会员生日短信模板 | * 增加会员生日短信模板 | ||||
| */ | */ | ||||