| @@ -2,6 +2,7 @@ package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -15,7 +16,7 @@ import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCUserCars") | |||||
| @RequestMapping("wxCUserCar") | |||||
| public class WxCUserCarController extends BaseController | public class WxCUserCarController extends BaseController | ||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| @@ -28,16 +29,16 @@ public class WxCUserCarController extends BaseController | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | ||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCar(); | |||||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCar,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCar) wxCUserCar = new WxCUserCar(); | |||||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCar, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | ||||
| //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | |||||
| //Assert.notNull(wxCUserCar.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | wxCUserCarService.saveOrUpdate(wxCUserCar); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -45,8 +46,8 @@ public class WxCUserCarController extends BaseController | |||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCars) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCars); | |||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCar) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -2,52 +2,51 @@ package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import com.simple.domain.po.WxCarCmdLog; | |||||
| import com.simple.service.WxCarCmdLogService; | |||||
| 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; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCarCmdLogs") | @RequestMapping("wxCarCmdLogs") | ||||
| public class WxCarCmdLogsController extends BaseController | |||||
| public class WxCarCmdLogController extends BaseController | |||||
| { | { | ||||
| @Autowired | |||||
| private WxCarCmdLogsService wxCarCmdLogsService; | |||||
| private Logger logger = Logger.getLogger(WxCarCmdLogController.class); | |||||
| private Logger logger = Logger.getLogger(WxCarCmdLogsController.class); | |||||
| @Autowired | |||||
| private WxCarCmdLogService wxCarCmdLogService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | ||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCarCmdLogs wxCarCmdLogs,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLogs(); | |||||
| final PageInfo<WxCarCmdLogs> page = wxCarCmdLogsService.listAsPage(wxCarCmdLogs, pageNum, pageSize); | |||||
| public ResultData list(@ModelAttribute WxCarCmdLog wxCarCmdLogs,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLog(); | |||||
| final PageInfo<WxCarCmdLog> page = wxCarCmdLogService.listAsPage(wxCarCmdLogs, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCarCmdLogs wxCarCmdLogs) { | |||||
| public ResultData add(@RequestBody WxCarCmdLog wxCarCmdLog) { | |||||
| //Assert.notNull(wxCarCmdLogs.getName(), "角色名不能为空"); | //Assert.notNull(wxCarCmdLogs.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCarCmdLogsService.saveOrUpdate(wxCarCmdLogs); | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCarCmdLogs wxCarCmdLogs) { | |||||
| wxCarCmdLogsService.saveOrUpdate(wxCarCmdLogs); | |||||
| public ResultData update(@RequestBody WxCarCmdLog wxCarCmdLog) { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -55,7 +54,7 @@ public class WxCarCmdLogsController extends BaseController | |||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| wxCarCmdLogsService.deleteById(id); | |||||
| wxCarCmdLogService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -63,7 +62,7 @@ public class WxCarCmdLogsController extends BaseController | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCarCmdLogsService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCarCmdLogService.getById(id)); | |||||
| } | } | ||||
| @@ -7,8 +7,10 @@ import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.*; | import com.simple.domain.po.*; | ||||
| import com.simple.enums.EnumCarCmd; | |||||
| import com.simple.enums.EnumCarVendor; | import com.simple.enums.EnumCarVendor; | ||||
| import com.simple.service.WxCUserCarService; | import com.simple.service.WxCUserCarService; | ||||
| import com.simple.service.WxCarCmdLogService; | |||||
| import com.simple.service.WxMerchantService; | import com.simple.service.WxMerchantService; | ||||
| import com.simple.service.WxParkService; | import com.simple.service.WxParkService; | ||||
| import com.simple.utils.ETCPUtil; | import com.simple.utils.ETCPUtil; | ||||
| @@ -25,7 +27,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/car") | |||||
| @RequestMapping("/car") | |||||
| public class WxCarController extends BaseController | public class WxCarController extends BaseController | ||||
| { | { | ||||
| private Logger logger = Logger.getLogger(WxCarController.class); | private Logger logger = Logger.getLogger(WxCarController.class); | ||||
| @@ -43,14 +45,19 @@ public class WxCarController extends BaseController | |||||
| @Autowired | @Autowired | ||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| WxCarCmdLogService wxCarCmdLogService; | |||||
| private WxPark getCurrentPark(MallUserInfo user) { | private WxPark getCurrentPark(MallUserInfo user) { | ||||
| WxPark wxPark = wxParkService.getByTenantId(user.getTenantId()); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setTenantId(user.getTenantId()); | |||||
| WxPark wxPark = wxParkService.getByObj(parkQ); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| // future use redis to optimize | // future use redis to optimize | ||||
| return wxPark; | return wxPark; | ||||
| } | } | ||||
| @ApiOperation(value = "获取车场支持的厂家",notes="") | |||||
| @ApiOperation(value = "获取车场支持的厂家",notes="{}") | |||||
| @GetMapping("/getVendor") | @GetMapping("/getVendor") | ||||
| public ResultData getVendor() { | public ResultData getVendor() { | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| @@ -102,6 +109,7 @@ public class WxCarController extends BaseController | |||||
| " ]}}\n") | " ]}}\n") | ||||
| @PostMapping("/quanTemplate") | @PostMapping("/quanTemplate") | ||||
| public ResultData quanTemplate(Map<String, String > paramMap) { | public ResultData quanTemplate(Map<String, String > paramMap) { | ||||
| logger.info("quanTemplate: " + paramMap.toString()); | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| /// 1, get mall's park | /// 1, get mall's park | ||||
| WxPark park = getCurrentPark(user); | WxPark park = getCurrentPark(user); | ||||
| @@ -109,6 +117,7 @@ public class WxCarController extends BaseController | |||||
| String merchantIdStr = paramMap.get("merchantId"); | String merchantIdStr = paramMap.get("merchantId"); | ||||
| if (StringUtils.isBlank(merchantIdStr)) { | if (StringUtils.isBlank(merchantIdStr)) { | ||||
| // 优先从从商户表里取 | // 优先从从商户表里取 | ||||
| logger.error("quanTemplate failed, merchantId为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "merchantId为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "merchantId为空"); | ||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| @@ -117,7 +126,7 @@ public class WxCarController extends BaseController | |||||
| String merchantNo = objParams.getString("merchantNo"); | String merchantNo = objParams.getString("merchantNo"); | ||||
| String merchantKey = objParams.getString("merchantKey"); | String merchantKey = objParams.getString("merchantKey"); | ||||
| String version = objParams.getString("version"); | String version = objParams.getString("version"); | ||||
| String parkId = objParams.getString("parkId"); | |||||
| String parkId = park.getParkId(); | |||||
| // bussinessId from 参数信息 | // bussinessId from 参数信息 | ||||
| String businessId = ""; | String businessId = ""; | ||||
| // 优先从从商户表里取 | // 优先从从商户表里取 | ||||
| @@ -131,6 +140,7 @@ public class WxCarController extends BaseController | |||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| return new ResultData(retObj.getJSONObject("data")); | return new ResultData(retObj.getJSONObject("data")); | ||||
| } else { | } else { | ||||
| logger.error("quanTemplate failed, 优免券模板未发现"); | |||||
| return new ResultData(ErrorCode.ETCP_QUAN_TEMP_FAIL.getCode(), "优免券模板未发现"); | return new ResultData(ErrorCode.ETCP_QUAN_TEMP_FAIL.getCode(), "优免券模板未发现"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -154,105 +164,232 @@ public class WxCarController extends BaseController | |||||
| /** | /** | ||||
| * ETCP 车辆入场通知 | * ETCP 车辆入场通知 | ||||
| * { | |||||
| * "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-20 12:59:54", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 12:59:57", | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "11" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/etcpParkInCallback") | @RequestMapping(value = "/etcpParkInCallback") | ||||
| public Result etcpParkInCallback(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||||
| "plateNumber": "渝 ATX061", | |||||
| "parkName": "ETCP 智慧停车场", | |||||
| "parkId": "1", | |||||
| "entranceTime": "2017-08-20 12:59:54", | |||||
| "userType": "76", | |||||
| "pushTime": "2017-08-20 12:59:57", | |||||
| "fixParkingId": "U7", | |||||
| "remainingDays": "11" } | |||||
| */ | |||||
| public Result etcpParkInCallback(@RequestBody Map<String,String> paramMap) { | |||||
| logger.info("etcpParkInCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到"+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | return new Result(0, "ok"); | ||||
| } | } | ||||
| /** | /** | ||||
| * ETCP 车辆出场通知 | * ETCP 车辆出场通知 | ||||
| * { | |||||
| * "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "parkName": "ETCP 智慧停车场", | |||||
| * "parkId": "1", | |||||
| * "entranceTime": "2017-08-17 18:44:19", | |||||
| * "userType": "76", | |||||
| * "pushTime": "2017-08-20 11:57:51", | |||||
| * "exitTime": "2017-08-19 12:07:19", | |||||
| * "stayedTime": 148980, | |||||
| * "receivableFee": 0, | |||||
| * "paidServiceFee": 0, | |||||
| * "fixParkingId": "U7", | |||||
| * "remainingDays": "12" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/etcpParkOutCallback") | @RequestMapping(value = "/etcpParkOutCallback") | ||||
| public Result etcpParkOutCallback(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| "plateNumber": "渝 ATX061", | |||||
| "parkName": "ETCP 智慧停车场", | |||||
| "parkId": "1", | |||||
| "entranceTime": "2017-08-17 18:44:19", | |||||
| "userType": "76", | |||||
| "pushTime": "2017-08-20 11:57:51", | |||||
| "exitTime": "2017-08-19 12:07:19", | |||||
| "stayedTime": 148980, | |||||
| "receivableFee": 0, | |||||
| "paidServiceFee": 0, | |||||
| "fixParkingId": "U7", | |||||
| "remainingDays": "12" | |||||
| } | |||||
| */ | |||||
| public Result etcpParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpParkOutCallback: " + paramMap.toString()); | |||||
| String etcpParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| parkQ.setParkId(etcpParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("etcpParkInCallback: ETCP车场未找到 "+ etcpParkId); | |||||
| return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| // TODO 发起 营销 -- 短信 | |||||
| return new Result(0, "ok"); | return new Result(0, "ok"); | ||||
| } | } | ||||
| /** | /** | ||||
| * ETCP 车辆解绑通知 | * ETCP 车辆解绑通知 | ||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/etcpUnbindCarCallBack") | @RequestMapping(value = "/etcpUnbindCarCallBack") | ||||
| public Result etcpUnbindCarCallBack(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "plateNumber": "渝 ATX061", | |||||
| "time": "2017-08-20 11:57:51" | |||||
| public Result etcpUnbindCarCallBack(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpUnbindCarCallBack: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_UNBIND.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | |||||
| WxCUserCar userCarQ = new WxCUserCar(); | |||||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCarQ.setCarNumber(carNumber); | |||||
| // 数据库里删除,保持同步 | |||||
| try { | |||||
| wxCUserCarService.deleteByObj(userCarQ); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | } | ||||
| */ | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | return new Result(0, "ok"); | ||||
| } | } | ||||
| /** | /** | ||||
| * ETCP 主动支付结果通知 | * ETCP 主动支付结果通知 | ||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| * "fee": 7.65, | |||||
| * "paidServiceFee": 0.07, | |||||
| * "coupon": 0, | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/etcpPaidCallback") | @RequestMapping(value = "/etcpPaidCallback") | ||||
| public Result etcpPaidCallback(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "plateNumber": "渝 ATX061", | |||||
| "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||||
| "fee": 7.65, | |||||
| "paidServiceFee": 0.07, | |||||
| "coupon": 0, | |||||
| "time": "2017-08-20 11:57:51" | |||||
| public Result etcpPaidCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("etcpPaidCallback: " + paramMap.toString()); | |||||
| String carNumber = paramMap.get("plateNumber"); | |||||
| // TODO how to get the parkId | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||||
| } | } | ||||
| */ | |||||
| // 营销 - 短信 | |||||
| return new Result(0, "ok"); | return new Result(0, "ok"); | ||||
| } | } | ||||
| /** | /** | ||||
| * TJD 车辆入场通知 | * TJD 车辆入场通知 | ||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outCarId": "45454545454", | |||||
| * "carNum": "京A45413", | |||||
| * "carNumColor ": "blue", | |||||
| * "inDt": "20170319202020", | |||||
| * "parkName": "测试停车场", | |||||
| * "parkId": "5836b8b52ada463ebc6199579f029561", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||||
| * "canFindCar": "0" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/tjdParkInCallback") | @RequestMapping(value = "/tjdParkInCallback") | ||||
| public Map tjdParkInCallback(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| "outCarId": "45454545454", | |||||
| "carNum": "京A45413", | |||||
| "carNumColor ": "blue", | |||||
| "inDt": "20170319202020", | |||||
| "parkName": "测试停车场", | |||||
| "parkId": "5836b8b52ada463ebc6199579f029561", | |||||
| "lon": "74.000272", | |||||
| "lat": "159.768703", | |||||
| "wLon": "123.523032", | |||||
| "wLat": "35.430735", | |||||
| "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||||
| "canFindCar": "0" | |||||
| } | |||||
| */ | |||||
| public Map tjdParkInCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| String tjdParkId = paramMap.get("parkId"); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| parkQ.setParkId(tjdParkId); | |||||
| WxPark park = wxParkService.getByObj(parkQ); | |||||
| if (park == null) { | |||||
| logger.error("tjdParkInCallback: 停简单车场未找到"+ tjdParkId); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "停简单车场未找到"+ tjdParkId); | |||||
| return map; | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkInCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | map.put("isSuccess", "0"); | ||||
| map.put("errorMsg", ""); | map.put("errorMsg", ""); | ||||
| return map; | return map; | ||||
| @@ -260,21 +397,40 @@ public class WxCarController extends BaseController | |||||
| /** | /** | ||||
| * TJD 车辆出场通知 | * TJD 车辆出场通知 | ||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outDt": "20170319232020", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "parkAmount": "5.20" | |||||
| * } | |||||
| */ | */ | ||||
| @RequestMapping(value = "/tjdParkoutCallback") | @RequestMapping(value = "/tjdParkoutCallback") | ||||
| public Map tjdParkOutCallback(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| "outDt": "20170319232020", | |||||
| "lon": "74.000272", | |||||
| "lat": "159.768703", | |||||
| "wLon": "123.523032", | |||||
| "wLat": "35.430735", | |||||
| "parkAmount": "5.20" | |||||
| } | |||||
| */ | |||||
| public Map tjdParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| String tradeId = paramMap.get("tradeId"); | |||||
| Date currentDate = new Date(); | |||||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||||
| wxCarCmdLog.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| wxCarCmdLog.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_OUT.getCode()); | |||||
| wxCarCmdLog.setCmdJson(JSON.toJSONString(paramMap)); | |||||
| wxCarCmdLog.setCreateDate(currentDate); | |||||
| wxCarCmdLog.setUpdateDate(currentDate); | |||||
| try { | |||||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||||
| } catch (Exception e) { | |||||
| logger.error("tjdParkoutCallback: 入库错误"+ paramMap.toString()); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||||
| return map; | |||||
| } | |||||
| map.put("isSuccess", "0"); | map.put("isSuccess", "0"); | ||||
| map.put("errorMsg", ""); | map.put("errorMsg", ""); | ||||
| return map; | return map; | ||||
| @@ -1,71 +0,0 @@ | |||||
| package com.simple.controller; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxCarCmdLogs") | |||||
| public class WxCarCmdLogsController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private WxCarCmdLogsService wxCarCmdLogsService; | |||||
| private Logger logger = Logger.getLogger(WxCarCmdLogsController.class); | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData list(@ModelAttribute WxCarCmdLogs wxCarCmdLogs,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLogs(); | |||||
| final PageInfo<WxCarCmdLogs> page = wxCarCmdLogsService.listAsPage(wxCarCmdLogs, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxCarCmdLogs wxCarCmdLogs) { | |||||
| //Assert.notNull(wxCarCmdLogs.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxCarCmdLogsService.saveOrUpdate(wxCarCmdLogs); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCarCmdLogs wxCarCmdLogs) { | |||||
| wxCarCmdLogsService.saveOrUpdate(wxCarCmdLogs); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| wxCarCmdLogsService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData findById(Long id) { | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCarCmdLogsService.getById(id)); | |||||
| } | |||||
| } | |||||
| @@ -9,7 +9,6 @@ import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.*; | import com.simple.domain.po.*; | ||||
| import com.simple.enums.EnumCarVendor; | import com.simple.enums.EnumCarVendor; | ||||
| import com.simple.service.WxCUserCarService; | import com.simple.service.WxCUserCarService; | ||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import com.simple.service.WxMerchantService; | import com.simple.service.WxMerchantService; | ||||
| import com.simple.service.WxParkService; | import com.simple.service.WxParkService; | ||||
| import com.simple.utils.ETCPUtil; | import com.simple.utils.ETCPUtil; | ||||
| @@ -28,7 +27,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/car") | |||||
| @RequestMapping("/car") | |||||
| public class WxCarController extends BaseController | public class WxCarController extends BaseController | ||||
| { | { | ||||
| private Logger logger = Logger.getLogger(WxCarController.class); | private Logger logger = Logger.getLogger(WxCarController.class); | ||||
| @@ -47,13 +46,15 @@ public class WxCarController extends BaseController | |||||
| WxMerchantService wxMerchantService; | WxMerchantService wxMerchantService; | ||||
| private WxPark getCurrentPark(WxCUser user) { | private WxPark getCurrentPark(WxCUser user) { | ||||
| WxPark wxPark = wxParkService.getByTenantId(user.getTenantId()); | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setTenantId(user.getTenantId()); | |||||
| WxPark wxPark = wxParkService.getByObj(parkQ); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| // future use redis to optimize | // future use redis to optimize | ||||
| return wxPark; | return wxPark; | ||||
| } | } | ||||
| @ApiOperation(value = "获取车场支持的厂家",notes="") | |||||
| @ApiOperation(value = "获取车场支持的厂家",notes="返回\n{\"vendor\":integer}") | |||||
| @GetMapping("/getVendor") | @GetMapping("/getVendor") | ||||
| public ResultData getVendor() { | public ResultData getVendor() { | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| @@ -52,9 +52,11 @@ public enum ErrorCode{ | |||||
| COUPON_IS_EMPTY(2020, "券不存在"), | COUPON_IS_EMPTY(2020, "券不存在"), | ||||
| /** | /** | ||||
| * 车流 2050 | |||||
| * 车流 2040 | |||||
| */ | */ | ||||
| CAR_PARK_NOT_FOUND(2049, "车场未找到"), | |||||
| CAR_VENDOR_NOT_SUPPORT(2050, "不支持的停车厂家"), | CAR_VENDOR_NOT_SUPPORT(2050, "不支持的停车厂家"), | ||||
| ETCP_LOGIN_FAIL(2051, "ETCP共同登录失败"), | ETCP_LOGIN_FAIL(2051, "ETCP共同登录失败"), | ||||
| ETCP_BIND_FAIL(2052, "ETCP绑车牌失败"), | ETCP_BIND_FAIL(2052, "ETCP绑车牌失败"), | ||||
| ETCP_UNBIND_FAIL(2053, "ETCP解绑车牌失败"), | ETCP_UNBIND_FAIL(2053, "ETCP解绑车牌失败"), | ||||
| @@ -68,6 +70,7 @@ public enum ErrorCode{ | |||||
| TJD_DEDUCE_FEE_FAIL(2063, "TJD停车费抵扣失败"), | TJD_DEDUCE_FEE_FAIL(2063, "TJD停车费抵扣失败"), | ||||
| /** | /** | ||||
| * 订单 | * 订单 | ||||
| */ | */ | ||||
| @@ -8,15 +8,15 @@ import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @Table(name = "wx_car_cmd_logs") | |||||
| public class WxCarCmdLogs implements Serializable { | |||||
| @Table(name = "wx_car_cmd_log") | |||||
| public class WxCarCmdLog implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @Transient | @Transient | ||||
| protected List<String> ids; | |||||
| protected List<Long> ids; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -32,10 +32,11 @@ public class WxCarCmdLogs implements Serializable { | |||||
| return sortColumns; | return sortColumns; | ||||
| } | } | ||||
| public List<String> getIds() { | |||||
| public List<Long> getIds() { | |||||
| return ids; | return ids; | ||||
| } | } | ||||
| public void setIds(List<String> ids) { | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @@ -45,11 +46,11 @@ public class WxCarCmdLogs implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*停车厂家,1. ETCP,2.停简单**/ | /*停车厂家,1. ETCP,2.停简单**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家,1. ETCP,2.停简单",name="supportVendor") | |||||
| private Integer supportVendor; | |||||
| /*厂家命令名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="厂家命令名",name="cmdType") | |||||
| private String cmdType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家,1. ETCP,2.停简单",name="vendorType") | |||||
| private Integer vendorType; | |||||
| /*停车厂家命令**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家命令",name="cmdType") | |||||
| private Integer cmdType; | |||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -65,16 +66,16 @@ public class WxCarCmdLogs implements Serializable { | |||||
| public void setTenantId(String _tenantId) { | public void setTenantId(String _tenantId) { | ||||
| tenantId = _tenantId; | tenantId = _tenantId; | ||||
| } | } | ||||
| public Integer getSupportVendor() { | |||||
| return supportVendor; | |||||
| public Integer getVendorType() { | |||||
| return vendorType; | |||||
| } | } | ||||
| public void setSupportVendor(Integer _supportVendor) { | |||||
| supportVendor = _supportVendor; | |||||
| public void setVendorType(Integer _vendorType) { | |||||
| vendorType = _vendorType; | |||||
| } | } | ||||
| public String getCmdType() { | |||||
| public Integer getCmdType() { | |||||
| return cmdType; | return cmdType; | ||||
| } | } | ||||
| public void setCmdType(String _cmdType) { | |||||
| public void setCmdType(Integer _cmdType) { | |||||
| cmdType = _cmdType; | cmdType = _cmdType; | ||||
| } | } | ||||
| public Date getCreateDate() { | public Date getCreateDate() { | ||||
| @@ -102,7 +103,7 @@ public class WxCarCmdLogs implements Serializable { | |||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ||||
| ,SupportVendor_ASC("`supportVendor` ASC"),SupportVendor_DESC("`supportVendor` DESC") | |||||
| ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") | |||||
| ,CmdType_ASC("`cmdType` ASC"),CmdType_DESC("`cmdType` DESC") | ,CmdType_ASC("`cmdType` ASC"),CmdType_DESC("`cmdType` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ||||
| @@ -124,7 +125,7 @@ public class WxCarCmdLogs implements Serializable { | |||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(WxCarCmdLogs.Field... fields) | |||||
| public void setSortColumns(WxCarCmdLog.Field... fields) | |||||
| { | { | ||||
| if (fields == null || fields.length == 0) { | if (fields == null || fields.length == 0) { | ||||
| return; | return; | ||||
| @@ -16,7 +16,7 @@ public class WxPark implements Serializable { | |||||
| protected Long id; | protected Long id; | ||||
| @Transient | @Transient | ||||
| protected List<String> ids; | |||||
| protected List<Long> ids; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -32,10 +32,11 @@ public class WxPark implements Serializable { | |||||
| return sortColumns; | return sortColumns; | ||||
| } | } | ||||
| public List<String> getIds() { | |||||
| public List<Long> getIds() { | |||||
| return ids; | return ids; | ||||
| } | } | ||||
| public void setIds(List<String> ids) { | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @@ -59,6 +60,9 @@ public class WxPark implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*第三方停车场ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="第三方停车场ID",name="parkId") | |||||
| private String parkId; | |||||
| /*厂商类型(1:ETCP,2:停简单)**/ | /*厂商类型(1:ETCP,2:停简单)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="厂商类型(1:ETCP,2:停简单)",name="vendorType") | @io.swagger.annotations.ApiModelProperty(value="厂商类型(1:ETCP,2:停简单)",name="vendorType") | ||||
| private Integer vendorType; | private Integer vendorType; | ||||
| @@ -101,6 +105,12 @@ public class WxPark implements Serializable { | |||||
| public void setUpdateDate(Date _updateDate) { | public void setUpdateDate(Date _updateDate) { | ||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public String getParkId() { | |||||
| return parkId; | |||||
| } | |||||
| public void setParkId(String _parkId) { | |||||
| parkId = _parkId; | |||||
| } | |||||
| public Integer getVendorType() { | public Integer getVendorType() { | ||||
| return vendorType; | return vendorType; | ||||
| } | } | ||||
| @@ -125,6 +135,7 @@ public class WxPark implements Serializable { | |||||
| ,EntryExit_ASC("`entryExit` ASC"),EntryExit_DESC("`entryExit` DESC") | ,EntryExit_ASC("`entryExit` ASC"),EntryExit_DESC("`entryExit` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | ||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | ||||
| ,ParkId_ASC("`parkId` ASC"),ParkId_DESC("`parkId` DESC") | |||||
| ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") | ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") | ||||
| ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") | ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") | ||||
| ; | ; | ||||
| @@ -0,0 +1,41 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumCarCmd { | |||||
| CAR_ETCP_LOGIN(600, "ETCP"), | |||||
| CAR_ETCP_CALLBACK_PARK_IN(601, "ETCP入场通知"), | |||||
| CAR_ETCP_CALLBACK_PARK_OUT(602, "ETCP出场通知"), | |||||
| CAR_ETCP_CALLBACK_UNBIND(603, "ETCP车辆解绑通知"), | |||||
| CAR_ETCP_CALLBACK_PAY_MANUAL(604, "主动支付结果通知"), | |||||
| CAR_TJD_CALLBACK_PARK_IN(610, "停简单入场通知"), | |||||
| CAR_TJD_CALLBACK_PARK_OUT(611, "停简单出场通知"), | |||||
| ; | |||||
| public static EnumCarCmd getEnum(Integer code) { | |||||
| for (EnumCarCmd value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumCarCmd(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.simple.mapper; | |||||
| import java.util.*; | |||||
| import com.simple.common.CommonMapper; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.simple.domain.po.WxCarCmdLog; | |||||
| public interface WxCarCmdLogMapper extends CommonMapper<WxCarCmdLog, Long> { | |||||
| List<WxCarCmdLog> findList(WxCarCmdLog wxCarCmdLog); | |||||
| } | |||||
| @@ -1,17 +0,0 @@ | |||||
| package com.simple.mapper; | |||||
| import java.util.*; | |||||
| import com.simple.common.CommonMapper; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| public interface WxCarCmdLogsMapper extends CommonMapper<WxCarCmdLogs, String> { | |||||
| List<WxCarCmdLogs> findList(WxCarCmdLogs wxCarCmdLogs); | |||||
| } | |||||
| @@ -2,19 +2,19 @@ package com.simple.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| import com.simple.domain.po.WxCarCmdLog; | |||||
| public interface WxCarCmdLogsService { | |||||
| public interface WxCarCmdLogService { | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCarCmdLogs> listAsPage(WxCarCmdLogs record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -22,14 +22,14 @@ public interface WxCarCmdLogsService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCarCmdLogs getById(Long id); | |||||
| WxCarCmdLog getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCarCmdLogs record); | |||||
| void saveOrUpdate(WxCarCmdLog record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -25,12 +25,12 @@ public interface WxParkService { | |||||
| WxPark getById(Long id); | WxPark getById(Long id); | ||||
| /** | /** | ||||
| * 根据tenantId获得实体 | |||||
| * 根据WxPark获得实体 | |||||
| * | * | ||||
| * @param tenantId | |||||
| * @param record | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxPark getByTenantId(String tenantId); | |||||
| WxPark getByObj(WxPark record); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -3,45 +3,45 @@ package com.simple.service.impl; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| import com.simple.mapper.WxCarCmdLogsMapper; | |||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import com.simple.domain.po.WxCarCmdLog; | |||||
| import com.simple.mapper.WxCarCmdLogMapper; | |||||
| import com.simple.service.WxCarCmdLogService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| @Service | @Service | ||||
| public class WxCarCmdLogsServiceImpl implements WxCarCmdLogsService { | |||||
| public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { | |||||
| @Autowired | @Autowired | ||||
| WxCarCmdLogsMapper wxCarCmdLogsMapper; | |||||
| WxCarCmdLogMapper wxCarCmdLogMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCarCmdLogs> listAsPage(WxCarCmdLogs record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarCmdLogsMapper.findList(record)); | |||||
| public PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarCmdLogMapper.findList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCarCmdLogs getById(Long id) { | |||||
| return wxCarCmdLogsMapper.selectByPrimaryKey(id); | |||||
| public WxCarCmdLog getById(Long id) { | |||||
| return wxCarCmdLogMapper.selectByPrimaryKey(id); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxCarCmdLogs record) { | |||||
| public void saveOrUpdate(WxCarCmdLog record) { | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxCarCmdLogsMapper.insertSelective(record); | |||||
| wxCarCmdLogMapper.insertSelective(record); | |||||
| } else { | } else { | ||||
| wxCarCmdLogsMapper.updateByPrimaryKeySelective(record); | |||||
| wxCarCmdLogMapper.updateByPrimaryKeySelective(record); | |||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCarCmdLogsMapper.deleteByPrimaryKey(id); | |||||
| wxCarCmdLogMapper.deleteByPrimaryKey(id); | |||||
| } | } | ||||
| @@ -28,10 +28,8 @@ public class WxParkServiceImpl implements WxParkService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxPark getByTenantId(String tenantId) { | |||||
| WxPark wxPark = new WxPark(); | |||||
| wxPark.setTenantId(tenantId); | |||||
| return wxParkMapper.selectOne(wxPark); | |||||
| public WxPark getByObj(WxPark record) { | |||||
| return wxParkMapper.selectOne(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1,18 +1,18 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
| <mapper namespace="com.simple.mapper.WxCarCmdLogsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCarCmdLogs"> | |||||
| <mapper namespace="com.simple.mapper.WxCarCmdLogMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCarCmdLog"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="support_vendor" jdbcType="INTEGER" property="supportVendor" /> | |||||
| <result column="cmd_type" jdbcType="VARCHAR" property="cmdType" /> | |||||
| <result column="vendor_type" jdbcType="INTEGER" property="vendorType" /> | |||||
| <result column="cmd_type" jdbcType="INTEGER" property="cmdType" /> | |||||
| <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="cmd_json" jdbcType="VARCHAR" property="cmdJson" /> | <result column="cmd_json" jdbcType="VARCHAR" property="cmdJson" /> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`support_vendor`,`cmd_type`,`create_date`,`update_date`,`cmd_json` | |||||
| `id`,`tenant_id`,`vendor_type`,`cmd_type`,`create_date`,`update_date`,`cmd_json` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -28,13 +28,13 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != supportVendor "> | |||||
| and `support_vendor` = #{supportVendor} | |||||
| <if test=" null != vendorType "> | |||||
| and `vendor_type` = #{vendorType} | |||||
| </if> | </if> | ||||
| <if test=" null != cmdType "> | <if test=" null != cmdType "> | ||||
| and `cmd_type` like concat('%', #{cmdType},'%') | |||||
| and `cmd_type` = #{cmdType} | |||||
| </if> | </if> | ||||
| @@ -61,8 +61,8 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.simple.domain.po.WxCarCmdLogs" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_car_cmd_logs | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCarCmdLog" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_car_cmd_log | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| @@ -9,12 +9,13 @@ | |||||
| <result column="entry_exit" jdbcType="INTEGER" property="entryExit" /> | <result column="entry_exit" jdbcType="INTEGER" property="entryExit" /> | ||||
| <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="park_id" jdbcType="VARCHAR" property="parkId" /> | |||||
| <result column="vendor_type" jdbcType="INTEGER" property="vendorType" /> | <result column="vendor_type" jdbcType="INTEGER" property="vendorType" /> | ||||
| <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" /> | <result column="vendor_params" jdbcType="VARCHAR" property="vendorParams" /> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`addr`,`number`,`entry_exit`,`create_date`,`update_date`,`vendor_type`,`vendor_params` | |||||
| `id`,`tenant_id`,`addr`,`number`,`entry_exit`,`create_date`,`update_date`,`park_id`,`vendor_type`,`vendor_params` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -55,6 +56,11 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != parkId "> | |||||
| and `park_id` like concat('%', #{parkId},'%') | |||||
| </if> | |||||
| <if test=" null != vendorType "> | <if test=" null != vendorType "> | ||||
| and `vendor_type` = #{vendorType} | and `vendor_type` = #{vendorType} | ||||