| @@ -9,45 +9,45 @@ 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.WxCUserCars; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| 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("wxCUserCars") | |||||
| public class WxCUserCarsController extends BaseController | |||||
| @RequestMapping("wxCUserCar") | |||||
| public class WxCUserCarController extends BaseController | |||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCUserCarsService wxCUserCarsService; | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| private Logger logger = Logger.getLogger(WxCUserCarsController.class); | |||||
| private Logger logger = Logger.getLogger(WxCUserCarController.class); | |||||
| @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 WxCUserCars wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCars(); | |||||
| final PageInfo<WxCUserCars> page = wxCUserCarsService.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 WxCUserCars wxCUserCars) { | |||||
| //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | |||||
| public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | |||||
| //Assert.notNull(wxCUserCar.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserCars wxCUserCars) { | |||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCar) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -55,7 +55,7 @@ public class WxCUserCarsController 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) { | ||||
| wxCUserCarsService.deleteById(id); | |||||
| wxCUserCarService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -63,7 +63,7 @@ public class WxCUserCarsController 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,"查询成功",wxCUserCarsService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarService.getById(id)); | |||||
| } | } | ||||
| @@ -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)); | |||||
| } | } | ||||
| @@ -0,0 +1,439 @@ | |||||
| package com.simple.controller; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.enums.EnumCarCmd; | |||||
| import com.simple.enums.EnumCarVendor; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import com.simple.service.WxCarCmdLogService; | |||||
| import com.simple.service.WxMerchantService; | |||||
| import com.simple.service.WxParkService; | |||||
| import com.simple.utils.ETCPUtil; | |||||
| import com.simple.utils.TJDCarUtil; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/car") | |||||
| public class WxCarController extends BaseController | |||||
| { | |||||
| private Logger logger = Logger.getLogger(WxCarController.class); | |||||
| ETCPUtil etcp = new ETCPUtil(); | |||||
| TJDCarUtil tjd = new TJDCarUtil(); | |||||
| @Autowired | |||||
| WxParkService wxParkService; | |||||
| @Autowired | |||||
| WxCUserCarService wxCUserCarService; | |||||
| @Autowired | |||||
| WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| WxCarCmdLogService wxCarCmdLogService; | |||||
| private WxPark getCurrentPark(MallUserInfo user) { | |||||
| WxPark parkQ = new WxPark(); | |||||
| parkQ.setTenantId(user.getTenantId()); | |||||
| WxPark wxPark = wxParkService.getByObj(parkQ); | |||||
| // 1, get mall's park | |||||
| // future use redis to optimize | |||||
| return wxPark; | |||||
| } | |||||
| @ApiOperation(value = "获取车场支持的厂家",notes="{}") | |||||
| @GetMapping("/getVendor") | |||||
| public ResultData getVendor() { | |||||
| MallUserInfo user = getUser(); | |||||
| // 1, get mall's park | |||||
| WxPark park = getCurrentPark(user); | |||||
| Map map = new HashMap(); | |||||
| map.put("vendor", park.getVendorType()); | |||||
| return new ResultData(map); | |||||
| } | |||||
| // 优免券模板 | |||||
| /* | |||||
| { | |||||
| "id": 4974, //优免券模板 ID | |||||
| "parkId": "fbqXUlfVvfc=", //车场标识 | |||||
| "businessId": "ZcWQ26TeJuQ=", //商家标识 | |||||
| title -- "businessName": "天洋广场", //商家名称 | |||||
| subtitle -- "name": "商家 1 小时优免券", //优免券名称 | |||||
| "category": "1", //优免券类型 1:小时优惠券,2:金额优惠券,3:折扣优惠券,4:免费券 | |||||
| price -- "categoryValue": "1.00", //优免券价值 | |||||
| total -- "amount": 100000, //优免券数量 | |||||
| valid_start_date -- "effectiveStart": "2018-02-01", //生效开始时间 | |||||
| valid_end_date -- "effectiveEnd": "2028-02-01",//生效结束时间 | |||||
| -"couponType": "0",//优惠券类型 | |||||
| number 库存 -- "avaliavleNum": 99993 //可用优惠券 | |||||
| }, | |||||
| */ | |||||
| @ApiOperation(value = "优免券模板", notes = "{\"merchantId\":\"商户ID\"}\n输出\n" + | |||||
| "{\n" + | |||||
| "\"data\":{" + | |||||
| "\"count\": 4," + | |||||
| "\"couponPlatformModels\": [\n" + | |||||
| " {\n" + | |||||
| " \"id\": 4974, //优免券模板 ID\n" + | |||||
| " \"parkId\": \"fbqXUlfVvfc=\", //车场标识" + | |||||
| " \"businessId\": \"ZcWQ26TeJuQ=\", //商家标识" + | |||||
| " \"businessName\": \"天洋广场\", //商家名称" + | |||||
| " \"name\": \"商家 1 小时优免券\", //优免券名称" + | |||||
| " \"category\": \"1\", //优免券类型\n 1:小时优惠券,2:金额优惠券,3:折扣优惠券,4:免费券" + | |||||
| " \"categoryValue\": \"1.00\", //优免券价值\n" + | |||||
| " \"amount\": 100000, //优免券数量\n" + | |||||
| " \"effectiveStart\": \"2018-02-01\", //生效开始时间\n" + | |||||
| " \"effectiveEnd\": \"2028-02-01\",//生效结束时间\n" + | |||||
| " \"couponType\": \"0\",//优惠券类型\n" + | |||||
| " \"avaliavleNum\": 99993 //可用优惠券\n" + | |||||
| " },\n" + | |||||
| " {...},\n" + | |||||
| " {...}\n" + | |||||
| " ]}}\n") | |||||
| @PostMapping("/quanTemplate") | |||||
| public ResultData quanTemplate(Map<String, String > paramMap) { | |||||
| logger.info("quanTemplate: " + paramMap.toString()); | |||||
| MallUserInfo user = getUser(); | |||||
| /// 1, get mall's park | |||||
| WxPark park = getCurrentPark(user); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||||
| String merchantIdStr = paramMap.get("merchantId"); | |||||
| if (StringUtils.isBlank(merchantIdStr)) { | |||||
| // 优先从从商户表里取 | |||||
| logger.error("quanTemplate failed, merchantId为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "merchantId为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String parkId = park.getParkId(); | |||||
| // bussinessId from 参数信息 | |||||
| String businessId = ""; | |||||
| // 优先从从商户表里取 | |||||
| businessId = getETCPBusinessID(merchantIdStr); | |||||
| if (StringUtils.isBlank(businessId)) { | |||||
| // 1期只有一个虚拟商户,可以写在商场配置里 | |||||
| businessId = objParams.getString("businessId"); | |||||
| } | |||||
| String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| return new ResultData(retObj.getJSONObject("data")); | |||||
| } else { | |||||
| logger.error("quanTemplate failed, 优免券模板未发现"); | |||||
| return new ResultData(ErrorCode.ETCP_QUAN_TEMP_FAIL.getCode(), "优免券模板未发现"); | |||||
| } | |||||
| } | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券模板失败"); | |||||
| } | |||||
| private String getETCPBusinessID(String merchantIdStr) { | |||||
| String businessId; | |||||
| Long merchantId = 0L; | |||||
| try { | |||||
| merchantId = Long.valueOf(merchantIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| WxMerchant wxMerchant = wxMerchantService.getById(merchantId); | |||||
| String carParams = wxMerchant.getCarParams(); | |||||
| JSONObject objParams1 = JSON.parseObject(carParams); | |||||
| businessId = objParams1.getString("businessId"); | |||||
| return businessId; | |||||
| } | |||||
| /** | |||||
| * 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") | |||||
| 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"); | |||||
| } | |||||
| /** | |||||
| * 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") | |||||
| 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"); | |||||
| } | |||||
| /** | |||||
| * ETCP 车辆解绑通知 | |||||
| * { | |||||
| * "plateNumber": "渝 ATX061", | |||||
| * "time": "2017-08-20 11:57:51" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/etcpUnbindCarCallBack") | |||||
| 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"); | |||||
| } | |||||
| /** | |||||
| * 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") | |||||
| 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"); | |||||
| } | |||||
| /** | |||||
| * 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") | |||||
| public Map tjdParkInCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||||
| 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("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| /** | |||||
| * TJD 车辆出场通知 | |||||
| * { | |||||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||||
| * "outDt": "20170319232020", | |||||
| * "lon": "74.000272", | |||||
| * "lat": "159.768703", | |||||
| * "wLon": "123.523032", | |||||
| * "wLat": "35.430735", | |||||
| * "parkAmount": "5.20" | |||||
| * } | |||||
| */ | |||||
| @RequestMapping(value = "/tjdParkoutCallback") | |||||
| public Map tjdParkOutCallback(@RequestParam Map<String,String> paramMap) { | |||||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||||
| 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("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| } | |||||
| @@ -17,8 +17,7 @@ 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; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCouponChannel") | @RequestMapping("wxCouponChannel") | ||||
| @@ -81,7 +80,6 @@ public class WxCouponChannelController extends BaseController | |||||
| public ResultData findById(@RequestBody WxCouponChannelDto wxCouponChannelDto) { | public ResultData findById(@RequestBody WxCouponChannelDto wxCouponChannelDto) { | ||||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | String[] ids = wxCouponChannelDto.getCouponIds().split(","); | ||||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | String[] channelId = wxCouponChannelDto.getChannelId().split(","); | ||||
| List<WxCouponChannel> list = new ArrayList<>(); | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCouponChannelService.addBatch(ids,channelId,user.getTenantId()); | wxCouponChannelService.addBatch(ids,channelId,user.getTenantId()); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -117,7 +117,22 @@ public class WxCouponController extends BaseController | |||||
| dto.setWxMerchant(merchant); | dto.setWxMerchant(merchant); | ||||
| return new ResultData(Result.SUCCESS,"查询成功",dto); | return new ResultData(Result.SUCCESS,"查询成功",dto); | ||||
| } | } | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("send/list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setStatus(1); | |||||
| PageInfo<WxCoupon> page = null; | |||||
| page = wxCouponService.findCanSendList(wxCoupon, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -64,14 +64,4 @@ public class WxCouponOrderController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponOrderService.getById(id)); | return new ResultData(Result.SUCCESS,"查询成功",wxCouponOrderService.getById(id)); | ||||
| } | } | ||||
| @ApiOperation("核销接口") | |||||
| @PostMapping("verify") | |||||
| public ResultData verify(@RequestBody WxCouponOrder wxCouponOrder) { | |||||
| wxCouponOrderService.verify(wxCouponOrder.getId(),getUser()); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.service.WxCouponService; | |||||
| 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.util.Assert; | ||||
| @@ -15,12 +17,17 @@ 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; | ||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCouponSend") | @RequestMapping("wxCouponSend") | ||||
| public class WxCouponSendController extends BaseController | public class WxCouponSendController extends BaseController | ||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCouponSendService wxCouponSendService; | private WxCouponSendService wxCouponSendService; | ||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | |||||
| private Logger logger = Logger.getLogger(WxCouponSendController.class); | private Logger logger = Logger.getLogger(WxCouponSendController.class); | ||||
| @@ -31,6 +38,7 @@ public class WxCouponSendController extends BaseController | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | ||||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | ||||
| wxCouponSend.setTenantId(getTenantId()); | |||||
| final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -38,6 +46,21 @@ public class WxCouponSendController extends BaseController | |||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCouponSend wxCouponSend) { | public ResultData add(@RequestBody WxCouponSend wxCouponSend) { | ||||
| List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend,1,1).getList(); | |||||
| if(wxCouponSendList!=null&&!wxCouponSendList.isEmpty()){ | |||||
| return new ResultData(Result.ERROR,"已经添加过该券"); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | |||||
| if(wxCoupon.getSendEndDate().before(new Date())){ | |||||
| return new ResultData(Result.ERROR,"发放日期异常"); | |||||
| } | |||||
| wxCouponSend.setMerchantId(wxCoupon.getMerchantId()); | |||||
| wxCouponSend.setType(wxCoupon.getType()); | |||||
| wxCouponSend.setTenantId(wxCoupon.getTenantId()); | |||||
| wxCouponSend.setTitle(wxCoupon.getTitle()); | |||||
| wxCouponSend.setSendStartTime(wxCoupon.getSendStartDate()); | |||||
| wxCouponSend.setSendEndTime(wxCoupon.getSendEndDate()); | |||||
| //Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); | //Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | wxCouponSendService.saveOrUpdate(wxCouponSend); | ||||
| @@ -47,6 +70,7 @@ public class WxCouponSendController extends BaseController | |||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | ||||
| wxCouponSend.setTenantId(getTenantId()); | |||||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | wxCouponSendService.saveOrUpdate(wxCouponSend); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -34,11 +34,11 @@ public class WxMerchantController extends BaseController | |||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@ModelAttribute WxMerchant wxMerchant,String shopids, String userids) { | |||||
| public ResultData add(@RequestBody WxMerchant wxMerchant) { | |||||
| //Assert.notNull(wxMerchant.getName(), "角色名不能为空"); | //Assert.notNull(wxMerchant.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxMerchant.setTenantId(getTenantId()); | wxMerchant.setTenantId(getTenantId()); | ||||
| wxMerchantService.saveOrUpdate(wxMerchant,shopids,userids); | |||||
| wxMerchantService.saveOrUpdate(wxMerchant); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -63,7 +63,13 @@ public class WxMerchantController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantService.getById(id)); | return new ResultData(Result.SUCCESS,"查询成功",wxMerchantService.getById(id)); | ||||
| } | } | ||||
| @ApiOperation("停用") | |||||
| @GetMapping("disable") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData disable(Long id) { | |||||
| wxMerchantService.disable(id); | |||||
| return new ResultData(Result.SUCCESS,"停用成功"); | |||||
| } | |||||
| } | } | ||||
| @@ -1,19 +1,17 @@ | |||||
| package com.simple.controller; | 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.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.WxMerchantShop; | import com.simple.domain.po.WxMerchantShop; | ||||
| import com.simple.domain.po.WxShop; | |||||
| import com.simple.service.WxMerchantShopService; | import com.simple.service.WxMerchantShopService; | ||||
| 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; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxMerchantShop") | @RequestMapping("wxMerchantShop") | ||||
| @@ -35,6 +33,18 @@ public class WxMerchantShopController extends BaseController | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("获取关联商铺信息") | |||||
| @GetMapping("queryShopList") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData queryShopList(@ModelAttribute WxMerchantShop wxMerchantShop,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||||
| final PageInfo<WxShop> page = wxMerchantShopService.queryShopList(wxMerchantShop, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxMerchantShop wxMerchantShop) { | public ResultData add(@RequestBody WxMerchantShop wxMerchantShop) { | ||||
| @@ -72,7 +72,7 @@ public class WxMsgController extends BaseController | |||||
| @RequestMapping("/excleupload") | @RequestMapping("/excleupload") | ||||
| public ResultData courseplanimport(@RequestParam("file") MultipartFile file) { | |||||
| public ResultData excleupload(@RequestParam("file") MultipartFile file) { | |||||
| if (file.isEmpty()) { | if (file.isEmpty()) { | ||||
| return new ResultData(Result.SUCCESS,"上传文件不能为空"); | return new ResultData(Result.SUCCESS,"上传文件不能为空"); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.service.WxProfitSharingOrderService; | |||||
| 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.util.Assert; | ||||
| @@ -66,7 +67,17 @@ public class WxPayOrderController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxPayOrderService.getById(id)); | return new ResultData(Result.SUCCESS,"查询成功",wxPayOrderService.getById(id)); | ||||
| } | } | ||||
| @Autowired | |||||
| private WxProfitSharingOrderService xProfitSharingOrderService; | |||||
| @ApiOperation("测试分账") | |||||
| @GetMapping("/sharing") | |||||
| public ResultData test() { | |||||
| xProfitSharingOrderService.test(); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -15,27 +15,29 @@ 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; | ||||
| import java.util.Map; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxRefundOrder") | |||||
| public class WxRefundOrderController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| @RequestMapping("/api/refund") | |||||
| public class WxRefundOrderController extends BaseController { | |||||
| @Autowired | |||||
| private WxRefundOrderService wxRefundOrderService; | private WxRefundOrderService wxRefundOrderService; | ||||
| private Logger logger = Logger.getLogger(WxRefundOrderController.class); | private Logger logger = Logger.getLogger(WxRefundOrderController.class); | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | @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 WxRefundOrder wxRefundOrder,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxRefundOrder) wxRefundOrder = new WxRefundOrder(); | |||||
| @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 WxRefundOrder wxRefundOrder, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxRefundOrder) wxRefundOrder = new WxRefundOrder(); | |||||
| final PageInfo<WxRefundOrder> page = wxRefundOrderService.listAsPage(wxRefundOrder, pageNum, pageSize); | final PageInfo<WxRefundOrder> page = wxRefundOrderService.listAsPage(wxRefundOrder, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxRefundOrder wxRefundOrder) { | public ResultData add(@RequestBody WxRefundOrder wxRefundOrder) { | ||||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | ||||
| @@ -53,19 +55,18 @@ public class WxRefundOrderController extends BaseController | |||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @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) { | ||||
| wxRefundOrderService.deleteById(id); | wxRefundOrderService.deleteById(id); | ||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @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,"查询成功",wxRefundOrderService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxRefundOrderService.getById(id)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,14 +1,20 @@ | |||||
| package com.simple.config; | package com.simple.config; | ||||
| import com.alibaba.fastjson.serializer.SerializeConfig; | |||||
| import com.alibaba.fastjson.serializer.ToStringSerializer; | |||||
| import com.alibaba.fastjson.support.config.FastJsonConfig; | |||||
| import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; | |||||
| import com.simple.interceptor.AuthorizationInterceptor; | import com.simple.interceptor.AuthorizationInterceptor; | ||||
| import com.simple.resolver.LoginUserHandlerMethodArgumentResolver; | import com.simple.resolver.LoginUserHandlerMethodArgumentResolver; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Configuration; | import org.springframework.context.annotation.Configuration; | ||||
| import org.springframework.http.converter.HttpMessageConverter; | |||||
| import org.springframework.web.method.support.HandlerMethodArgumentResolver; | import org.springframework.web.method.support.HandlerMethodArgumentResolver; | ||||
| import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||||
| import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | ||||
| import java.math.BigInteger; | |||||
| import java.util.List; | import java.util.List; | ||||
| /** | /** | ||||
| @@ -44,4 +50,19 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { | |||||
| //registry.addResourceHandler("/app/**").addResourceLocations("classpath:/app/"); | //registry.addResourceHandler("/app/**").addResourceLocations("classpath:/app/"); | ||||
| } | } | ||||
| @Override | |||||
| public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | |||||
| FastJsonHttpMessageConverter fastConverter = | |||||
| new FastJsonHttpMessageConverter(); | |||||
| FastJsonConfig fastJsonConfig = new FastJsonConfig(); | |||||
| SerializeConfig serializeConfig = SerializeConfig.globalInstance; | |||||
| serializeConfig.put(BigInteger.class, ToStringSerializer.instance); | |||||
| serializeConfig.put(Long.class, ToStringSerializer.instance); | |||||
| serializeConfig.put(Long.TYPE, ToStringSerializer.instance); | |||||
| fastJsonConfig.setSerializeConfig(serializeConfig); | |||||
| fastConverter.setFastJsonConfig(fastJsonConfig); | |||||
| converters.add(fastConverter); | |||||
| } | |||||
| } | } | ||||
| @@ -88,4 +88,17 @@ public class BaseController { | |||||
| service.setWxMaConfig(config); | service.setWxMaConfig(config); | ||||
| return service; | return service; | ||||
| } | } | ||||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | |||||
| WxMaInMemoryConfig config = new WxMaInMemoryConfig(); | |||||
| config.setAppid(appinfo.getAppId()); | |||||
| config.setSecret(appinfo.getSecret()); | |||||
| config.setToken(appinfo.getToken()); | |||||
| config.setAesKey(appinfo.getAesKey()); | |||||
| config.setMsgDataFormat(appinfo.getMsgDataFormat()); | |||||
| WxMaService service = new WxMaServiceImpl(); | |||||
| service.setWxMaConfig(config); | |||||
| return service; | |||||
| } | |||||
| } | } | ||||
| @@ -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.WxCUserCars; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| 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("wxCUserCars") | @RequestMapping("wxCUserCars") | ||||
| public class WxCUserCarsController extends BaseController | |||||
| public class WxCUserCarController extends BaseController | |||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCUserCarsService wxCUserCarsService; | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| private Logger logger = Logger.getLogger(WxCUserCarsController.class); | |||||
| private Logger logger = Logger.getLogger(WxCUserCarController.class); | |||||
| @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 WxCUserCars wxCUserCars,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCUserCars) wxCUserCars = new WxCUserCars(); | |||||
| final PageInfo<WxCUserCars> page = wxCUserCarsService.listAsPage(wxCUserCars, pageNum, pageSize); | |||||
| 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); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCUserCars wxCUserCars) { | |||||
| public ResultData add(@RequestBody WxCUserCar wxCUserCars) { | |||||
| //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | //Assert.notNull(wxCUserCars.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCars); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCUserCars wxCUserCars) { | |||||
| wxCUserCarsService.saveOrUpdate(wxCUserCars); | |||||
| public ResultData update(@RequestBody WxCUserCar wxCUserCar) { | |||||
| wxCUserCarService.saveOrUpdate(wxCUserCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -55,7 +54,7 @@ public class WxCUserCarsController 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) { | ||||
| wxCUserCarsService.deleteById(id); | |||||
| wxCUserCarService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -63,7 +62,7 @@ public class WxCUserCarsController 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,"查询成功",wxCUserCarsService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarService.getById(id)); | |||||
| } | } | ||||
| @@ -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)); | |||||
| } | |||||
| } | |||||
| @@ -19,11 +19,11 @@ import io.swagger.annotations.ApiOperation; | |||||
| @RequestMapping("wxCoupon") | @RequestMapping("wxCoupon") | ||||
| public class WxCouponController extends BaseController | public class WxCouponController extends BaseController | ||||
| { | { | ||||
| private Logger logger = Logger.getLogger(WxCouponController.class); | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| private Logger logger = Logger.getLogger(WxCouponController.class); | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -0,0 +1,111 @@ | |||||
| package com.simple.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCouponOrder; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.service.WxCouponOrderService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/api/couponOrder") | |||||
| @Api(description = "核销和用户卡券查询接口") | |||||
| public class WxCouponOrderController extends BaseController { | |||||
| private Logger logger = Logger.getLogger(WxCouponOrderController.class); | |||||
| @Autowired | |||||
| private WxCouponOrderService wxCouponOrderService; | |||||
| @ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}") | |||||
| @PostMapping("verify") | |||||
| public ResultData verify(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info(paramMap.toString()); | |||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| couponOrderId = 0L; | |||||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||||
| } | |||||
| try { | |||||
| ResultData rd = wxCouponOrderService.verify(couponOrderId, getUser().getId()); | |||||
| return rd; | |||||
| } catch (MallinkException e) { | |||||
| logger.error("核销异常: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error("核销异常: " + e.getMessage()); | |||||
| return new ResultData(ErrorCode.VERIFY_ERROR, e.getMessage()); | |||||
| } | |||||
| } | |||||
| @ApiOperation(value = "退券接口", notes = "{\"couponOrderId\":\"string\"}") | |||||
| @PostMapping("refund") | |||||
| public ResultData refund(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info(paramMap.toString()); | |||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||||
| } | |||||
| try { | |||||
| ResultData rd = wxCouponOrderService.refund(couponOrderId, getUser().getId()); | |||||
| return rd; | |||||
| } catch (MallinkException e) { | |||||
| logger.error("退券异常: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error("退券异常: " + e.getMessage()); | |||||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR, e.getMessage()); | |||||
| } | |||||
| } | |||||
| @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 WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCouponOrder) wxCouponOrder = new WxCouponOrder(); | |||||
| final PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(wxCouponOrder, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCouponOrder wxCouponOrder) { | |||||
| wxCouponOrderService.saveOrUpdate(wxCouponOrder); | |||||
| return new ResultData(); | |||||
| } | |||||
| @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, "查询成功", wxCouponOrderService.getById(id)); | |||||
| } | |||||
| } | |||||
| @@ -1,7 +1,11 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.domain.po.WxMerchantBUser; | |||||
| import com.simple.domain.vo.OrderVo; | import com.simple.domain.vo.OrderVo; | ||||
| import com.simple.enums.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| import io.swagger.models.auth.In; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| 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.util.Assert; | ||||
| @@ -32,45 +36,71 @@ public class WxOrderController 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), | ||||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | |||||
| @ApiImplicitParam(name = "orderStatus", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | |||||
| @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | ||||
| }) | }) | ||||
| public ResultData list(@ModelAttribute OrderVo orderVo, Integer pageNum, Integer pageSize) { | |||||
| public ResultData list(Integer orderStatus, Integer couponStatus, Integer pageNum, Integer pageSize) { | |||||
| WxMerchantBUser user = getUser(); | |||||
| OrderVo orderVo = new OrderVo(); | |||||
| orderVo.setbUserId(user.getId()); | |||||
| if (orderStatus != -1) | |||||
| orderVo.setOrderStatus(orderStatus); | |||||
| if (couponStatus != -1) | |||||
| orderVo.setCouponStatus(couponStatus); | |||||
| final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(orderVo, pageNum, pageSize); | final PageInfo<Map<String,Object>> page = wxOrderService.bQueryListMap(orderVo, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("订单详情") | |||||
| @ApiOperation(value = "订单详情", notes = "{\"couponOrderId\":\"String\",\"orderId\":\"String\",\"couponId\":\"String\"}") | |||||
| @GetMapping("detail") | @GetMapping("detail") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "merchantId", value = "B端用户ID", dataType = "Long", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "cUserId", value = "C端用户ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "couponId", value = "券ID", dataType = "Long", paramType = "query", required = false), | |||||
| @ApiImplicitParam(name = "status", value = "订单状态:-1全部;0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败", required = false, dataType = "Integer"), | |||||
| @ApiImplicitParam(name = "couponStatus", value = "券状态:-1全部;3:已领取/已购买/未核销/未使用,4:已核销/已使用,5:已过期,6:已退券", required = false, dataType = "Integer") | |||||
| }) | |||||
| public ResultData orderDetail(@ModelAttribute OrderVo orderVo) { | |||||
| public ResultData orderDetail(@RequestBody Map<String, String> paramMap) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| String couponIdStr = paramMap.get("couponId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(couponIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L, orderId = 0L, couponId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| couponId = Long.valueOf(couponIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("couponOrderId " + couponOrderIdStr + ", e:" + e.getMessage()); | |||||
| } | |||||
| WxMerchantBUser user = getUser(); | |||||
| OrderVo orderVo = new OrderVo(); | |||||
| orderVo.setbUserId(user.getId()); | |||||
| orderVo.setOrderId(orderId); | |||||
| orderVo.setCouponId(couponId); | |||||
| Map<String,Object> map = wxOrderService.queryObject(orderVo); | Map<String,Object> map = wxOrderService.queryObject(orderVo); | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @ApiOperation("手工退款") | |||||
| @ApiOperation(value = "手工退款", notes = "{\"orderId\":\"string\"}") | |||||
| @PostMapping("refund") | @PostMapping("refund") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long") | |||||
| }) | |||||
| public ResultData expiringOrder(@RequestBody WxOrder wxOrder) { | |||||
| public ResultData expiringOrder(@RequestBody Map<String, String> paramMap) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| // 1. | |||||
| //wxOrderService.updateOrderStatus(wxOrder.getId(), EnumOrderStatus.ORDER_STATUS_PENDING_REFUND); | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("orderId " + orderIdStr + ", e:" + e.getMessage()); | |||||
| } | |||||
| wxOrderService.updateOrderStatus(orderId, EnumOrderStatus.ORDER_STATUS_PENDING_REFUND); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,115 @@ | |||||
| package com.simple.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.enums.EnumPayWay; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.service.WxRefundOrderService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/api/refund") | |||||
| public class WxRefundOrderController extends BaseController | |||||
| { | |||||
| private Logger logger = Logger.getLogger(WxRefundOrderController.class); | |||||
| @Autowired | |||||
| private WxRefundOrderService wxRefundOrderService; | |||||
| @ApiOperation(value = "发起退款", notes = "{\"orderId\":,\"string\", \"payOrderId\":\"string\"}") | |||||
| @PostMapping("/create") | |||||
| public ResultData create(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info("/api/refund/create" + paramMap.toString()); | |||||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| String payOrderIdStr = paramMap.get("payOrderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| logger.error("orderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(payOrderIdStr)) { | |||||
| logger.error("payOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("orderId参数不正确: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||||
| } | |||||
| WxRefundOrder refundOrder = new WxRefundOrder(); | |||||
| refundOrder.setPayOrderNo(payOrderIdStr); | |||||
| refundOrder.setOrderId(orderId); | |||||
| WxMerchantBUser bUser = getUser(); | |||||
| WxAppinfo appinfo = getAppInfo(bUser.getAppId()); | |||||
| try { | |||||
| wxRefundOrderService.createRefundOrder(appinfo, refundOrder, EnumPayWay.PAY_WAY_WEAPP); | |||||
| return new ResultData(); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.REFUND_ORDER_ERROR); | |||||
| } | |||||
| } | |||||
| @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 WxRefundOrder wxRefundOrder,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxRefundOrder) wxRefundOrder = new WxRefundOrder(); | |||||
| final PageInfo<WxRefundOrder> page = wxRefundOrderService.listAsPage(wxRefundOrder, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxRefundOrder wxRefundOrder) { | |||||
| //Assert.notNull(wxRefundOrder.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxRefundOrderService.saveOrUpdate(wxRefundOrder); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxRefundOrder wxRefundOrder) { | |||||
| wxRefundOrderService.saveOrUpdate(wxRefundOrder); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| wxRefundOrderService.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,"查询成功",wxRefundOrderService.getById(id)); | |||||
| } | |||||
| } | |||||
| @@ -3,14 +3,13 @@ package com.simple.controller; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | 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.WxCarCmdLogs; | |||||
| import com.simple.domain.po.WxPark; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.enums.EnumCarVendor; | import com.simple.enums.EnumCarVendor; | ||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| 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; | ||||
| import com.simple.utils.TJDCarUtil; | import com.simple.utils.TJDCarUtil; | ||||
| @@ -22,11 +21,13 @@ import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| 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); | ||||
| @@ -38,24 +39,27 @@ public class WxCarController extends BaseController | |||||
| @Autowired | @Autowired | ||||
| WxParkService wxParkService; | WxParkService wxParkService; | ||||
| @Autowired | |||||
| WxCUserCarService wxCUserCarService; | |||||
| @Autowired | |||||
| WxMerchantService wxMerchantService; | |||||
| private WxPark getCurrentPark() { | |||||
| private WxPark getCurrentPark(WxCUser user) { | |||||
| 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 | ||||
| final PageInfo<WxPark> wxParkList = wxParkService.listAsPage(new WxPark(), 1, 1); | |||||
| if (wxParkList.getSize() <= 0) { | |||||
| return null; | |||||
| } | |||||
| WxPark park = wxParkList.getList().get(0); | |||||
| return park; | |||||
| return wxPark; | |||||
| } | } | ||||
| @ApiOperation(value = "获取车场支持的厂家",notes="") | |||||
| @ApiOperation(value = "获取车场支持的厂家",notes="返回\n{\"vendor\":integer}") | |||||
| @GetMapping("/getVendor") | @GetMapping("/getVendor") | ||||
| public ResultData getVendor() { | public ResultData getVendor() { | ||||
| WxCUser user = getUser(); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| Map map = new HashMap(); | Map map = new HashMap(); | ||||
| map.put("vendor", park.getVendorType()); | map.put("vendor", park.getVendorType()); | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| @@ -69,12 +73,14 @@ public class WxCarController extends BaseController | |||||
| @ApiOperation(value = "初始化/etcp共同登录",notes="{\"phone\":\"string\"}") | @ApiOperation(value = "初始化/etcp共同登录",notes="{\"phone\":\"string\"}") | ||||
| @PostMapping("/init") | @PostMapping("/init") | ||||
| public ResultData init(Map<String, String > paramMap) { | public ResultData init(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| // 2. get vendor params | // 2. get vendor params | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String phone = paramMap.get("phone"); | String phone = paramMap.get("phone"); | ||||
| if (StringUtils.isBlank(phone)) { | if (StringUtils.isBlank(phone)) { | ||||
| logger.error("手机号为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "phone为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "phone为空"); | ||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| @@ -91,31 +97,13 @@ public class WxCarController extends BaseController | |||||
| // 获取绑定的车牌 | // 获取绑定的车牌 | ||||
| JSONObject dataObj = retObj.getJSONObject("data"); | JSONObject dataObj = retObj.getJSONObject("data"); | ||||
| String etcpToken = dataObj.getString("token"); | String etcpToken = dataObj.getString("token"); | ||||
| // TODO 异步 | |||||
| ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | |||||
| /* | |||||
| { | |||||
| "code": 0, | |||||
| "msg": "ok", | |||||
| "data": { | |||||
| "number": 3, | |||||
| "carList": [ | |||||
| "晋 BMZ105", | |||||
| "云 C12345" | |||||
| ] | |||||
| } | |||||
| } | |||||
| */ | |||||
| retObj = JSON.parseObject(ret); | |||||
| JSONObject dataObj1 = retObj.getJSONObject("data"); | |||||
| dataObj1.put("vendor", park.getVendorType()); | |||||
| JSONArray arr = dataObj1.getJSONArray("carList"); | |||||
| for(int i=0;i<arr.size();i++) { | |||||
| // TODO save car | |||||
| } | |||||
| JSONObject dataObj1 = syncCarNumbers(user.getId(), user.getTenantId(), park.getVendorType(), | |||||
| url, merchantNo, merchantKey, version, | |||||
| etcpToken); | |||||
| // c端必须保存此token | // c端必须保存此token | ||||
| return new ResultData(dataObj1); | return new ResultData(dataObj1); | ||||
| } else { | } else { | ||||
| logger.error("共同登录失败: "+phone); | |||||
| return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | return new ResultData(ErrorCode.ETCP_LOGIN_FAIL.getCode(), "共同登录失败"); | ||||
| } | } | ||||
| } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | } else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()){ | ||||
| @@ -126,25 +114,102 @@ public class WxCarController extends BaseController | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "登录失败"); | ||||
| } | } | ||||
| private JSONObject syncCarNumbers(Long cUserId, String tenantId, int iVendorType, | |||||
| String url, String merchantNo, String merchantKey, String version, | |||||
| String etcpToken) { | |||||
| String ret; | |||||
| JSONObject retObj; | |||||
| ret = etcp.carNum(url, merchantNo, merchantKey, version, etcpToken); | |||||
| /*{"code": 0,"msg": "ok","data": {"number": 3,"carList": ["晋 BMZ105","云 C12345"]}} */ | |||||
| retObj = JSON.parseObject(ret); | |||||
| JSONObject dataObj1 = retObj.getJSONObject("data"); | |||||
| dataObj1.put("vendor", iVendorType); | |||||
| JSONArray arr = dataObj1.getJSONArray("carList"); | |||||
| WxCUserCar queryUserCar = new WxCUserCar(); | |||||
| queryUserCar.setCUserId(cUserId); | |||||
| List<WxCUserCar> uclist = wxCUserCarService.getList(queryUserCar); | |||||
| // 删除ETCP不存在 | |||||
| for(WxCUserCar userCar: uclist) { | |||||
| boolean bExist = isExistInArray(arr, userCar.getCarNumber()); | |||||
| if (!bExist) { | |||||
| wxCUserCarService.deleteById(userCar.getId()); | |||||
| uclist.remove(userCar); | |||||
| } | |||||
| } | |||||
| // 添加ETCP的 | |||||
| for(int i=0;i<arr.size();i++) { | |||||
| String _carNum = arr.getString(i); | |||||
| boolean bExist = isExistInList(uclist, _carNum); | |||||
| if(!bExist) { | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(cUserId); | |||||
| userCar.setTenantId(tenantId); | |||||
| userCar.setCarNumber(_carNum); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| } | |||||
| } | |||||
| return dataObj1; | |||||
| } | |||||
| private boolean isExistInArray(JSONArray arr, String carNumber) { | |||||
| boolean bExist = false; | |||||
| for(int i=0;i<arr.size();i++) { | |||||
| // check carNum+cUserId是否存在, 不存在新建 | |||||
| String _carNum = arr.getString(i); | |||||
| if (carNumber.equals(_carNum)) { | |||||
| bExist = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return bExist; | |||||
| } | |||||
| private boolean isExistInList(List<WxCUserCar> list, String carNumber) { | |||||
| boolean bExist = false; | |||||
| for(WxCUserCar userCar: list) { | |||||
| if(carNumber.equals(userCar.getCarNumber())) { | |||||
| bExist = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return bExist; | |||||
| } | |||||
| /** | /** | ||||
| * 绑车牌 | * 绑车牌 | ||||
| * @param paramMap | * @param paramMap | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}\n" + | @ApiOperation(value = "绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}\n" + | ||||
| "TJD:={\"carNumber\":\"string\",\"carNumColor\":\"string\",\"outCarId\":\"string\"}") | |||||
| "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") | |||||
| @PostMapping("/bindCar") | @PostMapping("/bindCar") | ||||
| public ResultData bindCar(Map<String, String > paramMap) { | public ResultData bindCar(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| // 2. get vendor params | // 2. get vendor params | ||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | String etcpToken = paramMap.get("etcpToken"); | ||||
| if (StringUtils.isBlank(etcpToken)) { | if (StringUtils.isBlank(etcpToken)) { | ||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | ||||
| } | } | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | ||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| @@ -157,28 +222,40 @@ public class WxCarController extends BaseController | |||||
| String ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | String ret = etcp.bindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber, null); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| // TODO insert carNumber | |||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| JSONObject dataObj = retObj.getJSONObject("data"); | JSONObject dataObj = retObj.getJSONObject("data"); | ||||
| dataObj.put("vendor", park.getVendorType()); | dataObj.put("vendor", park.getVendorType()); | ||||
| return new ResultData(dataObj); | return new ResultData(dataObj); | ||||
| } else { | } else { | ||||
| logger.error("绑车牌失败: " + carNumber); | |||||
| return new ResultData(ErrorCode.ETCP_BIND_FAIL.getCode(), "绑车牌失败"); | return new ResultData(ErrorCode.ETCP_BIND_FAIL.getCode(), "绑车牌失败"); | ||||
| } | } | ||||
| } | } | ||||
| else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | else if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | ||||
| } | } | ||||
| String carNumColor = paramMap.get("carNumColor"); | String carNumColor = paramMap.get("carNumColor"); | ||||
| if (StringUtils.isBlank(carNumColor)) { | if (StringUtils.isBlank(carNumColor)) { | ||||
| logger.error("carNumColor为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumColor为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumColor为空"); | ||||
| } | } | ||||
| String outCarId = paramMap.get("outCarId"); | String outCarId = paramMap.get("outCarId"); | ||||
| if (StringUtils.isBlank(outCarId)) { | if (StringUtils.isBlank(outCarId)) { | ||||
| logger.error("outCarId为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "outCarId为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "outCarId为空"); | ||||
| } | } | ||||
| // TODO insert carNumber | |||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| JSONObject objParams = JSON.parseObject(params); | JSONObject objParams = JSON.parseObject(params); | ||||
| String url = objParams.getString("url"); | String url = objParams.getString("url"); | ||||
| @@ -187,21 +264,23 @@ public class WxCarController extends BaseController | |||||
| String version = objParams.getString("version"); | String version = objParams.getString("version"); | ||||
| String ret = tjd.registerCar(url, partner, key, version, | String ret = tjd.registerCar(url, partner, key, version, | ||||
| carNumber, carNumColor, null, outCarId); | carNumber, carNumColor, null, outCarId); | ||||
| /* | |||||
| { | |||||
| "timestamp": "1464235239561", | |||||
| "returnCode": "T", | |||||
| "errorMsg": "", | |||||
| "returnMsg": "OK", | |||||
| "isSuccess": "0", | |||||
| "carId": "5836b8b52ada463ebc6199579f029561" | |||||
| } | |||||
| */ | |||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| retObj.put("vendor", park.getVendorType()); | retObj.put("vendor", park.getVendorType()); | ||||
| if (retObj.getString("returnCode") == "T") { | if (retObj.getString("returnCode") == "T") { | ||||
| // TODO save car id | |||||
| String carId = retObj.getString("carId"); | String carId = retObj.getString("carId"); | ||||
| // 插入车牌 | |||||
| Date curr = new Date(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("carId", carId); | |||||
| userCar.setVendorParams(JSON.toJSONString(jo)); | |||||
| userCar.setCreateDate(curr); | |||||
| userCar.setUpdateDate(curr); | |||||
| wxCUserCarService.saveOrUpdate(userCar); | |||||
| return new ResultData(retObj); | return new ResultData(retObj); | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | return new ResultData(ErrorCode.TJD_BIND_FAIL.getCode(), "绑车牌失败", retObj); | ||||
| @@ -215,19 +294,33 @@ 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\"}") | |||||
| @ApiOperation(value = "解绑车牌", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}\n返回:\n" + | |||||
| "{\n" + | |||||
| " \"code\": 0,\n" + | |||||
| " \"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") | |||||
| @PostMapping("/unbindCar") | @PostMapping("/unbindCar") | ||||
| public ResultData unbindCar(Map<String, String > paramMap) { | public ResultData unbindCar(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | String etcpToken = paramMap.get("etcpToken"); | ||||
| if (StringUtils.isBlank(etcpToken)) { | if (StringUtils.isBlank(etcpToken)) { | ||||
| logger.error("etcpToken为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | ||||
| } | } | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| logger.error("carNumber为空"); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | ||||
| } | } | ||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| @@ -237,13 +330,17 @@ public class WxCarController extends BaseController | |||||
| String merchantKey = objParams.getString("merchantKey"); | String merchantKey = objParams.getString("merchantKey"); | ||||
| String version = objParams.getString("version"); | String version = objParams.getString("version"); | ||||
| String ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | String ret = etcp.unbindCar(url, merchantNo, merchantKey, version, etcpToken, carNumber); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| // TODO delete carNumber | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setCUserId(user.getId()); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCarNumber(carNumber); | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| logger.error("解绑车牌失败"); | |||||
| return new ResultData(ErrorCode.ETCP_UNBIND_FAIL.getCode(), "解绑车牌失败"); | return new ResultData(ErrorCode.ETCP_UNBIND_FAIL.getCode(), "解绑车牌失败"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -252,35 +349,31 @@ public class WxCarController extends BaseController | |||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | ||||
| } | } | ||||
| String carId = paramMap.get("carId"); | |||||
| if (StringUtils.isBlank(carId)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carId为空"); | |||||
| } | |||||
| // TODO to get TJD carId | |||||
| String params = park.getVendorParams(); | |||||
| 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 ret = tjd.writeOffCar(url, partner, key, version, carId); | |||||
| /* | |||||
| { | |||||
| "timestamp": "1464235239561", | |||||
| "returnCode": "T", | |||||
| "errorMsg": "", | |||||
| "returnMsg": "OK", | |||||
| "isSuccess": "0", | |||||
| "carId": "5836b8b52ada463ebc6199579f029561" | |||||
| } | |||||
| */ | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getString("returnCode") == "T") { | |||||
| // TODO remove carNumber | |||||
| return new ResultData(); | |||||
| } else { | |||||
| return new ResultData(500, "解绑车牌失败"); | |||||
| WxCUserCar queryOne = new WxCUserCar(); | |||||
| queryOne.setCarNumber(carNumber); | |||||
| queryOne.setTenantId(user.getTenantId()); | |||||
| queryOne.setCUserId(user.getId()); | |||||
| WxCUserCar userCar = wxCUserCarService.getOne(queryOne); | |||||
| if (userCar != null) { | |||||
| String params = userCar.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String carId = objParams.getString("carId"); | |||||
| params = park.getVendorParams(); | |||||
| String url = objParams.getString("url"); | |||||
| String partner = objParams.getString("partner"); | |||||
| String key = objParams.getString("key"); | |||||
| String version = objParams.getString("version"); | |||||
| String ret = tjd.writeOffCar(url, partner, key, version, carId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getString("returnCode") == "T") { | |||||
| wxCUserCarService.deleteByObj(userCar); | |||||
| return new ResultData(); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.TJD_UNBIND_FAIL, "解绑车牌失败"); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "解绑车牌失败"); | ||||
| } | } | ||||
| @@ -290,12 +383,46 @@ 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\"}") | |||||
| @ApiOperation(value = "停车费", notes = "ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\"}\n输出\n{\n" + | |||||
| " \"carNumber\": \"渝****87\",\n" + | |||||
| " \"entranceTime\": \"2017-06-11 11:19:27\",\n" + | |||||
| " \"exitTime\": \"2017-06-11 11:59:47\",\n" + | |||||
| " \"orderId\": \"B9466E26-7420-4BDF-958D-E90106AB5F20\", \"parkingFee\": 2.00,\n" + | |||||
| " \"remainingServiceFee\": 0,\n" + | |||||
| " \"payedServiceFee\": 0,\n" + | |||||
| " \"remainingParkFee\": 2.00,\n" + | |||||
| " \"discountAmount\": 0,\n" + | |||||
| " \"parkingId\": 3126,\n" + | |||||
| " \"parkingName\": \"ETCP 停车场\",\n" + | |||||
| " \"remainingFee\": 2.00,\n" + | |||||
| " \"paidFee\": 0,\n" + | |||||
| " \"verificationInfo\": \"FSED9JvxgAU6XJUd8YRF5YH/LpfQYzCAfcPbAOKPV3BjKSatbgIsh7EBH2JBiRoGBe3btr gzKRMTfIoFuCn1XX7HUsJYlb7JSCBArnNmEVU4JuDLLjzoqB7qhQ8KnP16\"\n" + | |||||
| " }" + | |||||
| "TJD:={\"carNumber\":\"string\",\"carNumColor\":\"string\",\"outCarId\":\"string\"}\n输出\n{\n" + | |||||
| " \"inDt\": \"20160526112000\",\n" + | |||||
| " \"timestamp\": \"1464235239561\",\n" + | |||||
| " \"returnCode\": \"T\",\n" + | |||||
| " \"errorMsg\": \"\",\n" + | |||||
| " \"tradeId\": \"d49aeaedcf144f1faf569846d6b1667e\",\n" + | |||||
| " \"parkTime\": \"2439593\",\n" + | |||||
| " \"returnMsg\": \"OK\",\n" + | |||||
| " \"totalAmount\": \"0.03\",\n" + | |||||
| " \"isSuccess\": \"0\",\n" + | |||||
| " \"unPayAmount\": \"0.03\",\n" + | |||||
| " \"paidAmount\": \"0.00\",\n" + | |||||
| " \"freeThroughTime\": \"15\",\n" + | |||||
| " \"outDt\": \"20170321121212\",\n" + | |||||
| " \"payUrl\": \"http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?\n" + | |||||
| " prePayType=16&channel=10001\",\n" + | |||||
| " \"accountId\": \"d49aeaedcf144f1faf569846d6b16671\",\n" + | |||||
| " \"freeMinsAmount\": \"0.00\",\n" + | |||||
| " \"pmParkId\": \"d49aeaedcf144f1faf569846d6b16670\"\n" + | |||||
| " }") | |||||
| @PostMapping("/getCarStopFee") | @PostMapping("/getCarStopFee") | ||||
| public ResultData getCarStopFee(Map<String, String > paramMap) { | public ResultData getCarStopFee(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| // 1, get mall's park | // 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | String etcpToken = paramMap.get("etcpToken"); | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| @@ -316,27 +443,9 @@ public class WxCarController extends BaseController | |||||
| String ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | String ret = etcp.orderUnpay(url, appId, merchantNo, merchantKey, version, etcpToken, carNumber); | ||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| // TODO 停车费 | |||||
| /* | |||||
| { | |||||
| "carNumber": "渝****87", | |||||
| "entranceTime": "2017-06-11 11:19:27", | |||||
| "exitTime": "2017-06-11 11:59:47", | |||||
| "orderId": "B9466E26-7420-4BDF-958D-E90106AB5F20", "parkingFee": 2.00, | |||||
| "remainingServiceFee": 0, | |||||
| "payedServiceFee": 0, | |||||
| "remainingParkFee": 2.00, | |||||
| "discountAmount": 0, | |||||
| "parkingId": 3126, | |||||
| "parkingName": "ETCP 停车场", | |||||
| "remainingFee": 2.00, | |||||
| "paidFee": 0, | |||||
| "verificationInfo": "FSED9JvxgAU6XJUd8YRF5YH/LpfQYzCAfcPbAOKPV3BjKSatbgIsh7EBH2JBiRoGBe3btr gzKRMTfIoFuCn1XX7HUsJYlb7JSCBArnNmEVU4JuDLLjzoqB7qhQ8KnP16" | |||||
| } | |||||
| */ | |||||
| JSONObject feeObj = retObj.getJSONArray("data").getJSONObject(0); | JSONObject feeObj = retObj.getJSONArray("data").getJSONObject(0); | ||||
| feeObj.put("vendor", park.getVendorType()); | feeObj.put("vendor", park.getVendorType()); | ||||
| return new ResultData(feeObj); | |||||
| return new ResultData(Result.SUCCESS, "停车费获取成功", feeObj); | |||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.ETCP_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | return new ResultData(ErrorCode.ETCP_STOP_FEE_FAIL.getCode(), "停车费获取失败"); | ||||
| } | } | ||||
| @@ -346,7 +455,6 @@ public class WxCarController extends BaseController | |||||
| if (StringUtils.isBlank(carNumber)) { | if (StringUtils.isBlank(carNumber)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | ||||
| } | } | ||||
| // TODO to get TJD carId | |||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| JSONObject objParams = JSON.parseObject(params); | JSONObject objParams = JSON.parseObject(params); | ||||
| String url = objParams.getString("url"); | String url = objParams.getString("url"); | ||||
| @@ -354,31 +462,8 @@ public class WxCarController extends BaseController | |||||
| String key = objParams.getString("key"); | String key = objParams.getString("key"); | ||||
| String version = objParams.getString("version"); | String version = objParams.getString("version"); | ||||
| String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | String ret = tjd.infoForFreeMins(url, partner, key, version, carNumber); | ||||
| /* | |||||
| { | |||||
| "inDt": "20160526112000", | |||||
| "timestamp": "1464235239561", | |||||
| "returnCode": "T", | |||||
| "errorMsg": "", | |||||
| "tradeId": "d49aeaedcf144f1faf569846d6b1667e", | |||||
| "parkTime": "2439593", | |||||
| "returnMsg": "OK", | |||||
| "totalAmount": "0.03", | |||||
| "isSuccess": "0", | |||||
| "unPayAmount": "0.03", | |||||
| "paidAmount": "0.00", | |||||
| "freeThroughTime": "15", | |||||
| "outDt": "20170321121212", | |||||
| "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html? | |||||
| prePayType=16&channel=10001", | |||||
| "accountId": "d49aeaedcf144f1faf569846d6b16671", | |||||
| "freeMinsAmount": "0.00", | |||||
| "pmParkId": "d49aeaedcf144f1faf569846d6b16670" | |||||
| } | |||||
| */ | |||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getString("returnCode") == "T") { | if (retObj.getString("returnCode") == "T") { | ||||
| // TODO remove carNumber | |||||
| 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(), "停车费获取失败"); | ||||
| @@ -391,29 +476,36 @@ public class WxCarController extends BaseController | |||||
| * 停车费抵扣 | * 停车费抵扣 | ||||
| * | * | ||||
| */ | */ | ||||
| @ApiOperation("停车费抵扣") | |||||
| @ApiOperation(value = "停车费抵扣", notes = "{\"tradeId\":\"string\",\"deductionAmount\":\"string\",\"accountId\":\"string\",\"orderId\":\"string\"}\nresult\n{\n" + | |||||
| " \"timestamp\": \"1464235239561\",\n" + | |||||
| " \"returnCode\": \"T\",\n" + | |||||
| " \"errorMsg\": \"\",\n" + | |||||
| " \"returnMsg\": \"OK\",\n" + | |||||
| " \"isSuccess\": \"0\",\n" + | |||||
| " \"carId\": \"5836b8b52ada463ebc6199579f029561\"\n" + | |||||
| " }") | |||||
| @PostMapping("/deductionFee") | @PostMapping("/deductionFee") | ||||
| public ResultData deductionFee(Map<String, String > paramMap) { | public ResultData deductionFee(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| /// 1, get mall's park | /// 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_TJD.getCode()) { | ||||
| String tradeId = paramMap.get("tradeId"); | String tradeId = paramMap.get("tradeId"); | ||||
| String deductionAmount = paramMap.get("deductionAmount"); | String deductionAmount = paramMap.get("deductionAmount"); | ||||
| // TODO out wx_records id | |||||
| String outTradeNo = paramMap.get("outTradeNo"); | |||||
| String accountId = paramMap.get("accountId"); | String accountId = paramMap.get("accountId"); | ||||
| String outTradeNo = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(tradeId)) { | if (StringUtils.isBlank(tradeId)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "tradeId为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "tradeId为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(deductionAmount)) { | if (StringUtils.isBlank(deductionAmount)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "deductionAmount为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "deductionAmount为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(outTradeNo)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "outTradeNo为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(accountId)) { | if (StringUtils.isBlank(accountId)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "accountId为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "accountId为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(outTradeNo)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| JSONObject objParams = JSON.parseObject(params); | JSONObject objParams = JSON.parseObject(params); | ||||
| String url = objParams.getString("url"); | String url = objParams.getString("url"); | ||||
| @@ -421,19 +513,8 @@ public class WxCarController extends BaseController | |||||
| String key = objParams.getString("key"); | String key = objParams.getString("key"); | ||||
| String version = objParams.getString("version"); | String version = objParams.getString("version"); | ||||
| String ret = tjd.deductionNotSettle(url, partner, key, version, tradeId, deductionAmount, outTradeNo, accountId); | String ret = tjd.deductionNotSettle(url, partner, key, version, tradeId, deductionAmount, outTradeNo, accountId); | ||||
| /* | |||||
| { | |||||
| "timestamp": "1464235239561", | |||||
| "returnCode": "T", | |||||
| "errorMsg": "", | |||||
| "returnMsg": "OK", | |||||
| "isSuccess": "0", | |||||
| "carId": "5836b8b52ada463ebc6199579f029561" | |||||
| } | |||||
| */ | |||||
| JSONObject retObj = JSON.parseObject(ret); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getString("returnCode") == "T") { | if (retObj.getString("returnCode") == "T") { | ||||
| // TODO remove carNumber | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } else { | } else { | ||||
| return new ResultData(ErrorCode.TJD_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | return new ResultData(ErrorCode.TJD_DEDUCE_FEE_FAIL.getCode(), "停车费抵扣失败"); | ||||
| @@ -442,83 +523,36 @@ public class WxCarController extends BaseController | |||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费抵扣失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "停车费抵扣失败"); | ||||
| } | } | ||||
| // 优免券模板 | |||||
| /* | |||||
| { | |||||
| "id": 4974, //优免券模板 ID | |||||
| "parkId": "fbqXUlfVvfc=", //车场标识 | |||||
| "businessId": "ZcWQ26TeJuQ=", //商家标识 | |||||
| title -- "businessName": "天洋广场", //商家名称 | |||||
| subtitle -- "name": "商家 1 小时优免券", //优免券名称 | |||||
| "category": "1", //优免券类型 1:小时优惠券,2:金额优惠券,3:折扣优惠券,4:免费券 | |||||
| price -- "categoryValue": "1.00", //优免券价值 | |||||
| total -- "amount": 100000, //优免券数量 | |||||
| valid_start_date -- "effectiveStart": "2018-02-01", //生效开始时间 | |||||
| valid_end_date -- "effectiveEnd": "2028-02-01",//生效结束时间 | |||||
| -"couponType": "0",//优惠券类型 | |||||
| number 库存 -- "avaliavleNum": 99993 //可用优惠券 | |||||
| }, | |||||
| */ | |||||
| @ApiOperation("优免券模板") | |||||
| @PostMapping("/quanTemplate") | |||||
| public ResultData quanTemplate(Map<String, String > paramMap) { | |||||
| /// 1, get mall's park | |||||
| WxPark park = getCurrentPark(); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||||
| String params = park.getVendorParams(); | |||||
| JSONObject objParams = JSON.parseObject(params); | |||||
| String url = objParams.getString("url"); | |||||
| String merchantNo = objParams.getString("merchantNo"); | |||||
| String merchantKey = objParams.getString("merchantKey"); | |||||
| String version = objParams.getString("version"); | |||||
| String parkId = objParams.getString("parkId"); | |||||
| // bussinessId from 参数信息 | |||||
| String businessId = paramMap.get("businessId"); | |||||
| if (StringUtils.isBlank(businessId)) { | |||||
| // TODO 1期只有一个虚拟商户,可以写在商场配置里 | |||||
| businessId = objParams.getString("businessId"); | |||||
| } | |||||
| String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if (retObj.getIntValue("code") == 0) { | |||||
| /* | |||||
| "data": { | |||||
| "count": 4, "couponPlatformModels": [ | |||||
| { | |||||
| "id": 4974, //优免券模板 ID | |||||
| "parkId": "fbqXUlfVvfc=", //车场标识 "businessId": "ZcWQ26TeJuQ=", //商家标识 "businessName": "天洋广场", //商家名称 "name": "商家 1 小时优免券", //优免券名称 "category": "1", //优免券类型 | |||||
| 1:小时优惠券,2:金额优惠券,3:折扣优惠券,4:免费券 "categoryValue": "1.00", //优免券价值 | |||||
| "amount": 100000, //优免券数量 | |||||
| "effectiveStart": "2018-02-01", //生效开始时间 | |||||
| "effectiveEnd": "2028-02-01",//生效结束时间 | |||||
| "couponType": "0",//优惠券类型 | |||||
| "avaliavleNum": 99993 //可用优惠券 | |||||
| }, | |||||
| {...}, | |||||
| {...} | |||||
| ] | |||||
| */ | |||||
| return new ResultData(retObj.getJSONObject("data")); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.ETCP_QUAN_TEMP_FAIL.getCode(), "优免券模板未发现"); | |||||
| } | |||||
| private String getETCPBusinessID(String merchantIdStr) { | |||||
| String businessId; | |||||
| Long merchantId = 0L; | |||||
| try { | |||||
| merchantId = Long.valueOf(merchantIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券模板失败"); | |||||
| WxMerchant wxMerchant = wxMerchantService.getById(merchantId); | |||||
| String carParams = wxMerchant.getCarParams(); | |||||
| JSONObject objParams1 = JSON.parseObject(carParams); | |||||
| businessId = objParams1.getString("businessId"); | |||||
| return businessId; | |||||
| } | } | ||||
| /** | /** | ||||
| * 优免券领取 | * 优免券领取 | ||||
| * 优免券不可退 | * 优免券不可退 | ||||
| */ | */ | ||||
| @ApiOperation(value = "优免券领取", notes="ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\",\"couponFreeId\":\"string\"}") | |||||
| @ApiOperation(value = "优免券领取", notes="ETCP:={\"etcpToken\":\"string\",\"carNumber\":\"string\",\"couponFreeId\":\"string\"},输出\n{}") | |||||
| @PostMapping("/getCoupon") | @PostMapping("/getCoupon") | ||||
| public ResultData getCoupon(Map<String, String > paramMap) { | public ResultData getCoupon(Map<String, String > paramMap) { | ||||
| WxCUser user = getUser(); | |||||
| /// 1, get mall's park | /// 1, get mall's park | ||||
| WxPark park = getCurrentPark(); | |||||
| WxPark park = getCurrentPark(user); | |||||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | ||||
| String etcpToken = paramMap.get("etcpToken"); | String etcpToken = paramMap.get("etcpToken"); | ||||
| String carNumber = paramMap.get("carNumber"); | String carNumber = paramMap.get("carNumber"); | ||||
| String couponFreeId = paramMap.get("couponFreeId"); | String couponFreeId = paramMap.get("couponFreeId"); | ||||
| String merchantIdStr = paramMap.get("merchantId"); | |||||
| if (StringUtils.isBlank(etcpToken)) { | if (StringUtils.isBlank(etcpToken)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "etcpToken为空"); | ||||
| } | } | ||||
| @@ -531,6 +565,9 @@ public class WxCarController extends BaseController | |||||
| if (StringUtils.isBlank(couponFreeId)) { | if (StringUtils.isBlank(couponFreeId)) { | ||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponFreeId为空"); | return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponFreeId为空"); | ||||
| } | } | ||||
| if (StringUtils.isBlank(merchantIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "merchantId为空"); | |||||
| } | |||||
| String params = park.getVendorParams(); | String params = park.getVendorParams(); | ||||
| JSONObject objParams = JSON.parseObject(params); | JSONObject objParams = JSON.parseObject(params); | ||||
| String url = objParams.getString("url"); | String url = objParams.getString("url"); | ||||
| @@ -538,9 +575,11 @@ public class WxCarController extends BaseController | |||||
| 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 = objParams.getString("parkId"); | ||||
| String businessId = paramMap.get("businessId"); | |||||
| String businessId = ""; | |||||
| // 优先从从商户表里取 | |||||
| businessId = getETCPBusinessID(merchantIdStr); | |||||
| if (StringUtils.isBlank(businessId)) { | if (StringUtils.isBlank(businessId)) { | ||||
| // TODO 1期只有一个虚拟商户,可以写在商场配置里 | |||||
| // 1期只有一个虚拟商户,可以写在商场配置里 | |||||
| businessId = objParams.getString("businessId"); | businessId = objParams.getString("businessId"); | ||||
| } | } | ||||
| @@ -555,116 +594,4 @@ public class WxCarController extends BaseController | |||||
| } | } | ||||
| return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券领取失败"); | return new ResultData(ErrorCode.CAR_VENDOR_NOT_SUPPORT.getCode(), "优免券领取失败"); | ||||
| } | } | ||||
| // callback | |||||
| // ETCP 车辆入场通知 | |||||
| @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" } | |||||
| */ | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| // ETCP 车辆出场通知 | |||||
| @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" | |||||
| } | |||||
| */ | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| // ETCP 车辆解绑通知 | |||||
| @RequestMapping(value = "/etcpUnbindCarCallBack") | |||||
| public Result etcpUnbindCarCallBack(@RequestParam Map<String,String> param) { | |||||
| /* | |||||
| { | |||||
| "plateNumber": "渝 ATX061", | |||||
| "time": "2017-08-20 11:57:51" | |||||
| } | |||||
| */ | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| // ETCP 主动支付结果通知 | |||||
| @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" | |||||
| } | |||||
| */ | |||||
| return new Result(0, "ok"); | |||||
| } | |||||
| // TJD 车辆入场通知 | |||||
| @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" | |||||
| } | |||||
| */ | |||||
| Map map = new HashMap(); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| // TJD 车辆出场通知 | |||||
| @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" | |||||
| } | |||||
| */ | |||||
| Map map = new HashMap(); | |||||
| map.put("isSuccess", "0"); | |||||
| map.put("errorMsg", ""); | |||||
| return map; | |||||
| } | |||||
| } | } | ||||
| @@ -17,55 +17,29 @@ import io.swagger.annotations.ApiOperation; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCoupon") | @RequestMapping("wxCoupon") | ||||
| public class WxCouponController extends BaseController | |||||
| { | |||||
| public class WxCouponController extends BaseController { | |||||
| private Logger logger = Logger.getLogger(WxCouponController.class); | private Logger logger = Logger.getLogger(WxCouponController.class); | ||||
| @Autowired | |||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("/list") | @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 WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||||
| @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 WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||||
| final PageInfo<WxCoupon> page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); | final PageInfo<WxCoupon> page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxCoupon wxCoupon) { | |||||
| //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxCouponService.saveOrUpdate(wxCoupon); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxCoupon wxCoupon) { | |||||
| wxCouponService.saveOrUpdate(wxCoupon); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| wxCouponService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @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,"查询成功",wxCouponService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponService.getById(id)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,67 @@ | |||||
| package com.simple.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCUser; | |||||
| import com.simple.domain.po.WxCouponOrder; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.service.WxCouponOrderService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| @RestController | |||||
| @RequestMapping("/api/couponOrder") | |||||
| @Api(description = "用户卡券查询接口") | |||||
| public class WxCouponOrderController extends BaseController { | |||||
| private Logger logger = Logger.getLogger(WxCouponOrderController.class); | |||||
| @Autowired | |||||
| private WxCouponOrderService wxCouponOrderService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "couponOrderStatus", value="券状态状态:0,待使用 1,已核销 2,已过期 3,已作废", dataType="int", paramType = "query",required=false) | |||||
| }) | |||||
| public ResultData list(Integer couponOrderStatus, Integer pageNum, Integer pageSize) { | |||||
| WxCUser user = getUser(); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(user.getTenantId()); | |||||
| wxCouponOrder.setCouponOrderStatus(couponOrderStatus); | |||||
| final PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(wxCouponOrder, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation(value = "根据id查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||||
| @GetMapping("/findById") | |||||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info(paramMap.toString()); | |||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| couponOrderId = 0L; | |||||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(couponOrderId)); | |||||
| } | |||||
| } | |||||
| @@ -4,6 +4,7 @@ import com.simple.common.ErrorCode; | |||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| import com.simple.enums.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| import io.swagger.models.auth.In; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -51,64 +52,77 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("取消订单") | |||||
| @ApiOperation(value = "取消订单", notes = "{\"orderId\":\"string\"}") | |||||
| @PostMapping("cancel") | @PostMapping("cancel") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), | |||||
| @ApiImplicitParam(name = "cUserId", value = "用户ID", required = true, dataType = "Long") | |||||
| }) | |||||
| public ResultData cancelOrder(@RequestBody WxOrder wxOrder) { | |||||
| public ResultData cancelOrder(@RequestBody Map<String, String> paramMap) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxOrderService.updateOrderStatus(wxOrder.getId(), EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("订单过期") | |||||
| @PostMapping("expiring") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), | |||||
| @ApiImplicitParam(name = "cUserId", value = "用户ID", required = true, dataType = "Long") | |||||
| }) | |||||
| public ResultData expiringOrder(@RequestBody WxOrder wxOrder) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxOrderService.updateOrderStatus(wxOrder.getId(), EnumOrderStatus.ORDER_STATUS_PENDING_REFUND); | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| WxCUser user = getUser(); | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| wxOrderService.updateOrderStatus(orderId, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("订单已过期") | |||||
| @ApiOperation(value = "订单已过期", notes = "{\"orderId\":\"string\"}") | |||||
| @PostMapping("expired") | @PostMapping("expired") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "Long"), | |||||
| @ApiImplicitParam(name = "cUserId", value = "用户ID", required = true, dataType = "Long") | |||||
| }) | |||||
| public ResultData expiredOrder(@RequestBody WxOrder wxOrder) { | |||||
| public ResultData expiredOrder(@RequestBody Map<String, String> paramMap) { | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxOrderService.updateOrderStatus(wxOrder.getId(), EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS); | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| WxCUser user = getUser(); | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| wxOrderService.updateOrderStatus(orderId, EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @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)}) | |||||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxOrder) wxOrder = new WxOrder(); | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="orderStatus",value="订单状态0-已下单/待付款;1-已支付;2-已取消",dataType="int", paramType = "query",required=false) | |||||
| }) | |||||
| public ResultData list(Integer orderStatus, Integer pageNum, Integer pageSize) { | |||||
| // c端用户应该只能看到自己的订单 | // c端用户应该只能看到自己的订单 | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| wxOrder.setCUserId(user.getId()); | |||||
| final PageInfo<WxOrder> page = wxOrderService.listAsPage(wxOrder, pageNum, pageSize); | |||||
| WxOrder wxOrderQ = new WxOrder(); | |||||
| wxOrderQ.setCUserId(user.getId()); | |||||
| wxOrderQ.setOrderStatus(orderStatus); | |||||
| final PageInfo<WxOrder> page = wxOrderService.listAsPage(wxOrderQ, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | |||||
| @ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(id)); | |||||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("parse orderId failed"); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(orderId)); | |||||
| } | } | ||||
| @@ -27,6 +27,7 @@ import com.simple.service.WxPayOrderService; | |||||
| 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; | ||||
| import sun.rmi.runtime.Log; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.nio.charset.Charset; | import java.nio.charset.Charset; | ||||
| @@ -41,7 +42,7 @@ public class WxPayOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxPayOrderService wxPayOrderService; | private WxPayOrderService wxPayOrderService; | ||||
| @ApiOperation(value = "发起微信小程序支付订单") | |||||
| @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | |||||
| @RequestMapping(value = "/create", method = RequestMethod.POST) | @RequestMapping(value = "/create", method = RequestMethod.POST) | ||||
| public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | ||||
| logger.info("/api/pay/create" + paramMap.toString()); | logger.info("/api/pay/create" + paramMap.toString()); | ||||
| @@ -54,7 +55,13 @@ public class WxPayOrderController extends BaseController { | |||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| WxAppinfo appInfo = getAppInfo(user.getAppId()); | WxAppinfo appInfo = getAppInfo(user.getAppId()); | ||||
| Long orderId = Long.valueOf(orderIdStr); | |||||
| Long orderId = 0L; | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| orderId = 0L; | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||||
| } | |||||
| WxPayOrder record = new WxPayOrder(); | WxPayOrder record = new WxPayOrder(); | ||||
| record.setOrderId(orderId); | record.setOrderId(orderId); | ||||
| @@ -70,54 +77,55 @@ public class WxPayOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR); | return new ResultData(ErrorCode.PAY_ORDER_ERROR); | ||||
| } | } | ||||
| /** | |||||
| * | |||||
| * @return 接收微信异步通知 | |||||
| * @throws Exception 可能产生的任何异常 | |||||
| */ | |||||
| @AuthIgnore | |||||
| @RequestMapping(value = "/notify/pay", method = RequestMethod.POST) | |||||
| public String __doNotify(HttpServletRequest request) throws Exception { | |||||
| Map<String, String> paramMap = null; | |||||
| String response; | |||||
| @ApiOperation(value = "更新支付订单状态", notes = "{\"id\":\"string\",\"orderId\":\"string\",\"status\":integer,\"reason\":\"string\"}") | |||||
| @PostMapping("/updatePayOrder") | |||||
| public ResultData updatePayOrder(@RequestBody Map<String, Object> paramMap) { | |||||
| logger.info("/api/pay/updatePayOrder" + paramMap.toString()); | |||||
| String payOrderIdStr = (String)paramMap.get("payOrderId"); | |||||
| String orderIdStr = (String)paramMap.get("orderId"); | |||||
| String reasonStr = (String)paramMap.get("reason"); | |||||
| Integer status = (Integer)paramMap.get("status"); | |||||
| if (StringUtils.isBlank(payOrderIdStr)) { | |||||
| logger.info("payOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId不能为空"); | |||||
| } | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| logger.info("orderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long payOrderId = 0L, orderId = 0L; | |||||
| try { | |||||
| payOrderId = Long.valueOf(payOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| payOrderId = 0L; | |||||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "payOrderId参数不正确"); | |||||
| } | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| orderId = 0L; | |||||
| logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||||
| } | |||||
| WxPayOrder payOrder = new WxPayOrder(); | |||||
| payOrder.setId(payOrderId); | |||||
| payOrder.setOrderId(orderId); | |||||
| payOrder.setPayOrderStatus(status); | |||||
| payOrder.setFailReason(reasonStr); | |||||
| try { | try { | ||||
| String xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||||
| paramMap = WxPayment.xmlToMap(xml); | |||||
| logger.info("payment wxpay, notify, param: " + paramMap.toString() ); | |||||
| response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | |||||
| logger.info("payment wxpay, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||||
| return response; | |||||
| } catch (BizMessageException e) { | |||||
| logger.error("payment wxpay, notify error, req: " + paramMap.toString() + ", e:" + e.getLocalizedMessage()); | |||||
| return e.getMessage(); | |||||
| wxPayOrderService.handlePayOrderStatusUpdate(payOrder); | |||||
| return new ResultData(Result.SUCCESS, "支付状态更新成功"); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("payment wxpay, notify error, req: " + paramMap.toString() + ", e:" +e.getLocalizedMessage()); | |||||
| return e.getMessage(); | |||||
| logger.error("支付状态更新失败2: " + payOrder.toString() + ", e:" + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| return e.getMessage(); | |||||
| logger.error("支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||||
| } | } | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR); | |||||
| } | } | ||||
| /** | |||||
| * | |||||
| * @return 同步回调(订单状态主动检查) | |||||
| * @throws Exception 可能产生的任何异常 | |||||
| */ | |||||
| @RequestMapping(value = "/callback", method = {RequestMethod.GET, RequestMethod.POST}) | |||||
| public String __doCallback(HttpServletRequest request) throws Exception { | |||||
| logger.info("payment wxpay, callback,request:" + request.toString()); | |||||
| return "\n" + | |||||
| "\n" + | |||||
| "<xml>\n" + | |||||
| "\n" + | |||||
| " <return_code><![CDATA[SUCCESS]]></return_code>\n" + | |||||
| " <return_msg><![CDATA[OK]]></return_msg>\n" + | |||||
| "</xml>\n"; | |||||
| } | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("/list") | @GetMapping("/list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -14,7 +14,9 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxAppinfo; | import com.simple.domain.po.WxAppinfo; | ||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxAppinfoService; | import com.simple.service.WxAppinfoService; | ||||
| import com.simple.service.WxCUserCarService; | |||||
| import com.simple.service.WxCUserService; | import com.simple.service.WxCUserService; | ||||
| import com.simple.utils.IPUtil; | import com.simple.utils.IPUtil; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -31,6 +33,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @@ -41,6 +44,9 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @Autowired | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| /** | /** | ||||
| * 用户登录 | * 用户登录 | ||||
| * @param map | * @param map | ||||
| @@ -227,11 +233,23 @@ public class WxUserGrantController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("获取用户信息") | |||||
| @GetMapping("/findById") | |||||
| @ApiOperation("获取当前用户信息") | |||||
| @GetMapping("/userinfo") | |||||
| public ResultData getUserInfo() { | public ResultData getUserInfo() { | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| return new ResultData(Result.SUCCESS,"查询成功",user); | return new ResultData(Result.SUCCESS,"查询成功",user); | ||||
| } | } | ||||
| @ApiOperation("获取当前用户车牌列表") | |||||
| @GetMapping("/carlist") | |||||
| public ResultData getCarList() { | |||||
| WxCUser user = getUser(); | |||||
| WxCUserCar userCar = new WxCUserCar(); | |||||
| userCar.setTenantId(user.getTenantId()); | |||||
| userCar.setCUserId(user.getId()); | |||||
| List<WxCUserCar> list = wxCUserCarService.getList(userCar); | |||||
| return new ResultData(Result.SUCCESS,"获取查询成功", list); | |||||
| } | |||||
| } | } | ||||
| @@ -1,9 +1,9 @@ | |||||
| spring: | spring: | ||||
| # JDBC | # JDBC | ||||
| datasource: | datasource: | ||||
| url: jdbc:mysql://localhost:3306/mallink?characterEncoding=UTF-8&useSSL=false | |||||
| username: userone | |||||
| password: 123456 | |||||
| url: jdbc:mysql://202.165.179.86:3306/mallink?characterEncoding=UTF-8&useSSL=false | |||||
| username: mallone | |||||
| password: m@1l0ne123@# | |||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | driver-class-name: com.mysql.jdbc.Driver | ||||
| filters: stat | filters: stat | ||||
| @@ -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停车费抵扣失败"), | ||||
| /** | /** | ||||
| * 订单 | * 订单 | ||||
| */ | */ | ||||
| @@ -80,9 +83,11 @@ public enum ErrorCode{ | |||||
| /** | /** | ||||
| * 卡券 | * 卡券 | ||||
| */ | */ | ||||
| COUPON_ORDER_IS_USED(4000, "卡券已核销"), | |||||
| COUPON_ORDER_IS_OVER_TIME(4001, "卡券已过期"), | |||||
| COUPON_ORDER_IS_INVALID(4002, "卡券已经作废"), | |||||
| COUPON_ORDER_IS_NULL(4000, "卡券不存在"), | |||||
| COUPON_ORDER_IS_USED(4001, "卡券已核销"), | |||||
| COUPON_ORDER_IS_OVER_TIME(4002, "卡券已过期"), | |||||
| COUPON_ORDER_IS_INVALID(4003, "卡券已经作废"), | |||||
| /** | /** | ||||
| * 微信 | * 微信 | ||||
| @@ -108,6 +113,18 @@ public enum ErrorCode{ | |||||
| APP_ID_NOT_FOUND(12020, "APPID没找到"), | APP_ID_NOT_FOUND(12020, "APPID没找到"), | ||||
| MCH_INFO_NOT_FOUND(12021, "商户信息没找到"), | MCH_INFO_NOT_FOUND(12021, "商户信息没找到"), | ||||
| MCH_INFO_NOT_EQUAL(12022, "商户信息不对应"), | MCH_INFO_NOT_EQUAL(12022, "商户信息不对应"), | ||||
| API_KEY_NOT_FOUND(12023, "支付密钥未配置"), | |||||
| CERT_PATH_NOT_FOUND(12024, "双向证书未配置"), | |||||
| PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"), | |||||
| PROFIT_SHARING_APPLY_FAILED(12031, "分账请求业务失败"), | |||||
| PROFIT_SHARING_RETURN_INVALID(12032, "分账请求返回校验失败"), | |||||
| PROFIT_SHARING_RECEIVER_INVALID(12033, "分账接受方查寻无效"), | |||||
| /** | |||||
| * 核销 | |||||
| */ | |||||
| VERIFY_ERROR(12050, "核销异常") | |||||
| ; | ; | ||||
| @@ -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_c_user_cars") | |||||
| public class WxCUserCars implements Serializable { | |||||
| @Table(name = "wx_c_user_car") | |||||
| public class WxCUserCar 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 WxCUserCars 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; | ||||
| } | } | ||||
| @@ -56,6 +57,12 @@ public class WxCUserCars implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*停车厂家(2:TJD)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家(2:TJD)",name="vendorType") | |||||
| private Integer vendorType; | |||||
| /*停车厂家参数**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂家参数",name="vendorParams") | |||||
| private String vendorParams; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -86,6 +93,18 @@ public class WxCUserCars implements Serializable { | |||||
| public void setUpdateDate(Date _updateDate) { | public void setUpdateDate(Date _updateDate) { | ||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public Integer getVendorType() { | |||||
| return vendorType; | |||||
| } | |||||
| public void setVendorType(Integer _vendorType) { | |||||
| vendorType = _vendorType; | |||||
| } | |||||
| public String getVendorParams() { | |||||
| return vendorParams; | |||||
| } | |||||
| public void setVendorParams(String _vendorParams) { | |||||
| vendorParams = _vendorParams; | |||||
| } | |||||
| @@ -97,6 +116,8 @@ public class WxCUserCars implements Serializable { | |||||
| ,CarNumber_ASC("`carNumber` ASC"),CarNumber_DESC("`carNumber` DESC") | ,CarNumber_ASC("`carNumber` ASC"),CarNumber_DESC("`carNumber` 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") | ||||
| ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") | |||||
| ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -114,7 +135,7 @@ public class WxCUserCars implements Serializable { | |||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(WxCUserCars.Field... fields) | |||||
| public void setSortColumns(WxCUserCar.Field... fields) | |||||
| { | { | ||||
| if (fields == null || fields.length == 0) { | if (fields == null || fields.length == 0) { | ||||
| return; | return; | ||||
| @@ -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; | ||||
| @@ -11,15 +11,15 @@ import java.io.Serializable; | |||||
| @Table(name = "wx_coupon_send") | @Table(name = "wx_coupon_send") | ||||
| public class WxCouponSend implements Serializable { | public class WxCouponSend implements Serializable { | ||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @Id | @Id | ||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<String> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -27,20 +27,21 @@ public class WxCouponSend implements Serializable { | |||||
| public void setId(Long id) { | public void setId(Long id) { | ||||
| this.id = id; | this.id = id; | ||||
| } | } | ||||
| public String getSortColumns() { | public String getSortColumns() { | ||||
| 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; | ||||
| } | } | ||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -59,6 +60,15 @@ public class WxCouponSend implements Serializable { | |||||
| /*发券方式(1.主动领取,2.停车发券,3.核销发券)**/ | /*发券方式(1.主动领取,2.停车发券,3.核销发券)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="发券方式(1.主动领取,2.停车发券,3.核销发券)",name="sendType") | @io.swagger.annotations.ApiModelProperty(value="发券方式(1.主动领取,2.停车发券,3.核销发券)",name="sendType") | ||||
| private Integer sendType; | private Integer sendType; | ||||
| /*0:有效 1:无效**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="0:有效 1:无效",name="status") | |||||
| private Integer status; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="sendStartTime") | |||||
| private Date sendStartTime; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="sendEndTime") | |||||
| private Date sendEndTime; | |||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -101,6 +111,24 @@ public class WxCouponSend implements Serializable { | |||||
| public void setSendType(Integer _sendType) { | public void setSendType(Integer _sendType) { | ||||
| sendType = _sendType; | sendType = _sendType; | ||||
| } | } | ||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer _status) { | |||||
| status = _status; | |||||
| } | |||||
| public Date getSendStartTime() { | |||||
| return sendStartTime; | |||||
| } | |||||
| public void setSendStartTime(Date _sendStartTime) { | |||||
| sendStartTime = _sendStartTime; | |||||
| } | |||||
| public Date getSendEndTime() { | |||||
| return sendEndTime; | |||||
| } | |||||
| public void setSendEndTime(Date _sendEndTime) { | |||||
| sendEndTime = _sendEndTime; | |||||
| } | |||||
| public Date getCreateDate() { | public Date getCreateDate() { | ||||
| return createDate; | return createDate; | ||||
| } | } | ||||
| @@ -119,15 +147,18 @@ public class WxCouponSend implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ; | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||||
| ,SendStartTime_ASC("`sendStartTime` ASC"),SendStartTime_DESC("`sendStartTime` DESC") | |||||
| ,SendEndTime_ASC("`sendEndTime` ASC"),SendEndTime_DESC("`sendEndTime` DESC") | |||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ; | |||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| this.value = value; | this.value = value; | ||||
| @@ -143,7 +174,7 @@ public class WxCouponSend implements Serializable { | |||||
| return this.getValue(); | return this.getValue(); | ||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(WxCouponSend.Field... fields) | public void setSortColumns(WxCouponSend.Field... fields) | ||||
| { | { | ||||
| if (fields == null || fields.length == 0) { | if (fields == null || fields.length == 0) { | ||||
| @@ -159,9 +190,9 @@ public class WxCouponSend implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| { | { | ||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | if (sortColumns == null || "".equals(sortColumns.trim())) { | ||||
| @@ -37,9 +37,18 @@ public class WxMerchant implements Serializable { | |||||
| public void setIds(List<Long> ids) { | public void setIds(List<Long> ids) { | ||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| @Transient | |||||
| private List<Long> userids; | |||||
| @Transient | |||||
| private List<Long> shopids; | |||||
| @Transient | |||||
| private List<WxShop> shops; | |||||
| @Transient | |||||
| private List<WxMerchantBUser> bUsers; | |||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| @@ -152,6 +161,38 @@ public class WxMerchant implements Serializable { | |||||
| this.status = status; | this.status = status; | ||||
| } | } | ||||
| public List<Long> getUserids() { | |||||
| return userids; | |||||
| } | |||||
| public void setUserids(List<Long> userids) { | |||||
| this.userids = userids; | |||||
| } | |||||
| public List<Long> getShopids() { | |||||
| return shopids; | |||||
| } | |||||
| public void setShopids(List<Long> shopids) { | |||||
| this.shopids = shopids; | |||||
| } | |||||
| public List<WxShop> getShops() { | |||||
| return shops; | |||||
| } | |||||
| public void setShops(List<WxShop> shops) { | |||||
| this.shops = shops; | |||||
| } | |||||
| public List<WxMerchantBUser> getbUsers() { | |||||
| return bUsers; | |||||
| } | |||||
| public void setbUsers(List<WxMerchantBUser> bUsers) { | |||||
| this.bUsers = bUsers; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -51,6 +51,9 @@ public class WxOrder implements Serializable { | |||||
| /*c端用户id**/ | /*c端用户id**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*操作券B端小程序用户ID**/ | /*操作券B端小程序用户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | ||||
| private Long bUserId; | private Long bUserId; | ||||
| @@ -93,6 +96,12 @@ public class WxOrder implements Serializable { | |||||
| public void setCUserId(Long _cUserId) { | public void setCUserId(Long _cUserId) { | ||||
| cUserId = _cUserId; | cUserId = _cUserId; | ||||
| } | } | ||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Long getBUserId() { | public Long getBUserId() { | ||||
| return bUserId; | return bUserId; | ||||
| } | } | ||||
| @@ -150,6 +159,7 @@ public class WxOrder implements Serializable { | |||||
| ,OrderNumber_ASC("`orderNumber` ASC"),OrderNumber_DESC("`orderNumber` DESC") | ,OrderNumber_ASC("`orderNumber` ASC"),OrderNumber_DESC("`orderNumber` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | ||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | ||||
| ,PaymentType_ASC("`paymentType` ASC"),PaymentType_DESC("`paymentType` DESC") | ,PaymentType_ASC("`paymentType` ASC"),PaymentType_DESC("`paymentType` DESC") | ||||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ||||
| @@ -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") | ||||
| ; | ; | ||||
| @@ -16,7 +16,7 @@ public class WxPayOrder 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,17 +32,18 @@ public class WxPayOrder 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; | ||||
| } | } | ||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||||
| /*租户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||||
| private String tenantId; | private String tenantId; | ||||
| /*创建时间**/ | /*创建时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | ||||
| @@ -62,12 +63,12 @@ public class WxPayOrder implements Serializable { | |||||
| /*支付金额(分)**/ | /*支付金额(分)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | @io.swagger.annotations.ApiModelProperty(value="支付金额(分)",name="payAmount") | ||||
| private Integer payAmount; | private Integer payAmount; | ||||
| /*支付发起时间(秒)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付发起时间(秒)",name="payTimeStart") | |||||
| private Integer payTimeStart; | |||||
| /*支付结束时间(秒)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付结束时间(秒)",name="payTimeEnd") | |||||
| private Integer payTimeEnd; | |||||
| /*支付发起时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付发起时间",name="payTimeStart") | |||||
| private Date payTimeStart; | |||||
| /*支付结束时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付结束时间",name="payTimeEnd") | |||||
| private Date payTimeEnd; | |||||
| /*微信生成的订单号**/ | /*微信生成的订单号**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="微信生成的订单号",name="transactionId") | @io.swagger.annotations.ApiModelProperty(value="微信生成的订单号",name="transactionId") | ||||
| private String transactionId; | private String transactionId; | ||||
| @@ -125,16 +126,16 @@ public class WxPayOrder implements Serializable { | |||||
| public void setPayAmount(Integer _payAmount) { | public void setPayAmount(Integer _payAmount) { | ||||
| payAmount = _payAmount; | payAmount = _payAmount; | ||||
| } | } | ||||
| public Integer getPayTimeStart() { | |||||
| public Date getPayTimeStart() { | |||||
| return payTimeStart; | return payTimeStart; | ||||
| } | } | ||||
| public void setPayTimeStart(Integer _payTimeStart) { | |||||
| public void setPayTimeStart(Date _payTimeStart) { | |||||
| payTimeStart = _payTimeStart; | payTimeStart = _payTimeStart; | ||||
| } | } | ||||
| public Integer getPayTimeEnd() { | |||||
| public Date getPayTimeEnd() { | |||||
| return payTimeEnd; | return payTimeEnd; | ||||
| } | } | ||||
| public void setPayTimeEnd(Integer _payTimeEnd) { | |||||
| public void setPayTimeEnd(Date _payTimeEnd) { | |||||
| payTimeEnd = _payTimeEnd; | payTimeEnd = _payTimeEnd; | ||||
| } | } | ||||
| public String getTransactionId() { | public String getTransactionId() { | ||||
| @@ -0,0 +1,222 @@ | |||||
| package com.simple.domain.po; | |||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import java.math.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | |||||
| import java.io.Serializable; | |||||
| @Table(name = "wx_profit_sharing_order") | |||||
| public class WxProfitSharingOrder implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /*接收方(商场租户id)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="接收方(商场租户id)",name="tenantId") | |||||
| private String tenantId; | |||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private String merchantId; | |||||
| /*订单ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | |||||
| private String orderId; | |||||
| /*分账总金额(分)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账总金额(分)",name="payAmount") | |||||
| private Integer payAmount; | |||||
| /*分账结束时间(秒)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账结束时间(秒)",name="payTimeEnd") | |||||
| private Date payTimeEnd; | |||||
| /*分账发起时间(秒)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账发起时间(秒)",name="payTimeStart") | |||||
| private Date payTimeStart; | |||||
| /*微信生成的支付单号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信生成的支付单号",name="transactionId") | |||||
| private String transactionId; | |||||
| /*微信生成分账单号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信生成分账单号",name="sharingOrderId") | |||||
| private String sharingOrderId; | |||||
| /*分账申请失败原因**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账申请失败原因",name="errorMsg") | |||||
| private String errorMsg; | |||||
| /*分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回",name="sharingStatus") | |||||
| private Integer sharingStatus; | |||||
| /*更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||||
| private Date updateTime; | |||||
| /*创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||||
| private Date createTime; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(String _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public String getOrderId() { | |||||
| return orderId; | |||||
| } | |||||
| public void setOrderId(String _orderId) { | |||||
| orderId = _orderId; | |||||
| } | |||||
| public Integer getPayAmount() { | |||||
| return payAmount; | |||||
| } | |||||
| public void setPayAmount(Integer _payAmount) { | |||||
| payAmount = _payAmount; | |||||
| } | |||||
| public Date getPayTimeEnd() { | |||||
| return payTimeEnd; | |||||
| } | |||||
| public void setPayTimeEnd(Date _payTimeEnd) { | |||||
| payTimeEnd = _payTimeEnd; | |||||
| } | |||||
| public Date getPayTimeStart() { | |||||
| return payTimeStart; | |||||
| } | |||||
| public void setPayTimeStart(Date _payTimeStart) { | |||||
| payTimeStart = _payTimeStart; | |||||
| } | |||||
| public String getTransactionId() { | |||||
| return transactionId; | |||||
| } | |||||
| public void setTransactionId(String _transactionId) { | |||||
| transactionId = _transactionId; | |||||
| } | |||||
| public String getSharingOrderId() { | |||||
| return sharingOrderId; | |||||
| } | |||||
| public void setSharingOrderId(String _sharingOrderId) { | |||||
| sharingOrderId = _sharingOrderId; | |||||
| } | |||||
| public String getErrorMsg() { | |||||
| return errorMsg; | |||||
| } | |||||
| public void setErrorMsg(String _errorMsg) { | |||||
| errorMsg = _errorMsg; | |||||
| } | |||||
| public Integer getSharingStatus() { | |||||
| return sharingStatus; | |||||
| } | |||||
| public void setSharingStatus(Integer _sharingStatus) { | |||||
| sharingStatus = _sharingStatus; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,OrderId_ASC("`orderId` ASC"),OrderId_DESC("`orderId` DESC") | |||||
| ,PayAmount_ASC("`payAmount` ASC"),PayAmount_DESC("`payAmount` DESC") | |||||
| ,PayTimeEnd_ASC("`payTimeEnd` ASC"),PayTimeEnd_DESC("`payTimeEnd` DESC") | |||||
| ,PayTimeStart_ASC("`payTimeStart` ASC"),PayTimeStart_DESC("`payTimeStart` DESC") | |||||
| ,TransactionId_ASC("`transactionId` ASC"),TransactionId_DESC("`transactionId` DESC") | |||||
| ,SharingOrderId_ASC("`sharingOrderId` ASC"),SharingOrderId_DESC("`sharingOrderId` DESC") | |||||
| ,ErrorMsg_ASC("`errorMsg` ASC"),ErrorMsg_DESC("`errorMsg` DESC") | |||||
| ,SharingStatus_ASC("`sharingStatus` ASC"),SharingStatus_DESC("`sharingStatus` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxProfitSharingOrder.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,202 @@ | |||||
| package com.simple.domain.po; | |||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import java.math.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | |||||
| import java.io.Serializable; | |||||
| @Table(name = "wx_profit_sharing_receiver") | |||||
| public class WxProfitSharingReceiver implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private String merchantId; | |||||
| /*分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))",name="receiverType") | |||||
| private Integer receiverType; | |||||
| /*分账接收方账号,见接收方类型**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账接收方账号,见接收方类型",name="receiverAccount") | |||||
| private String receiverAccount; | |||||
| /*分款接受方说明**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分款接受方说明",name="receiverComments") | |||||
| private String receiverComments; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||||
| private Date createTime; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||||
| private Date updateTime; | |||||
| /*分账类型:1-服务商户分账,2-商户转入银行卡**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") | |||||
| private Integer sharingType; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="bankNo") | |||||
| private String bankNo; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="trueName") | |||||
| private String trueName; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="bankCode") | |||||
| private String bankCode; | |||||
| public String getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(String _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Integer getReceiverType() { | |||||
| return receiverType; | |||||
| } | |||||
| public void setReceiverType(Integer _receiverType) { | |||||
| receiverType = _receiverType; | |||||
| } | |||||
| public String getReceiverAccount() { | |||||
| return receiverAccount; | |||||
| } | |||||
| public void setReceiverAccount(String _receiverAccount) { | |||||
| receiverAccount = _receiverAccount; | |||||
| } | |||||
| public String getReceiverComments() { | |||||
| return receiverComments; | |||||
| } | |||||
| public void setReceiverComments(String _receiverComments) { | |||||
| receiverComments = _receiverComments; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public Integer getSharingType() { | |||||
| return sharingType; | |||||
| } | |||||
| public void setSharingType(Integer _sharingType) { | |||||
| sharingType = _sharingType; | |||||
| } | |||||
| public String getBankNo() { | |||||
| return bankNo; | |||||
| } | |||||
| public void setBankNo(String _bankNo) { | |||||
| bankNo = _bankNo; | |||||
| } | |||||
| public String getTrueName() { | |||||
| return trueName; | |||||
| } | |||||
| public void setTrueName(String _trueName) { | |||||
| trueName = _trueName; | |||||
| } | |||||
| public String getBankCode() { | |||||
| return bankCode; | |||||
| } | |||||
| public void setBankCode(String _bankCode) { | |||||
| bankCode = _bankCode; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,ReceiverType_ASC("`receiverType` ASC"),ReceiverType_DESC("`receiverType` DESC") | |||||
| ,ReceiverAccount_ASC("`receiverAccount` ASC"),ReceiverAccount_DESC("`receiverAccount` DESC") | |||||
| ,ReceiverComments_ASC("`receiverComments` ASC"),ReceiverComments_DESC("`receiverComments` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,SharingType_ASC("`sharingType` ASC"),SharingType_DESC("`sharingType` DESC") | |||||
| ,BankNo_ASC("`bankNo` ASC"),BankNo_DESC("`bankNo` DESC") | |||||
| ,TrueName_ASC("`trueName` ASC"),TrueName_DESC("`trueName` DESC") | |||||
| ,BankCode_ASC("`bankCode` ASC"),BankCode_DESC("`bankCode` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxProfitSharingReceiver.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,182 @@ | |||||
| package com.simple.domain.po; | |||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import java.math.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | |||||
| import java.io.Serializable; | |||||
| @Table(name = "wx_profit_sharing_result") | |||||
| public class WxProfitSharingResult implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /*分账订单号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账订单号",name="sharingOrderId") | |||||
| private String sharingOrderId; | |||||
| /*分账接收方id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账接收方id",name="sharingReceiverId") | |||||
| private String sharingReceiverId; | |||||
| /*分账金额(分)**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="payAmount") | |||||
| private Integer payAmount; | |||||
| /*更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||||
| private Date updateTime; | |||||
| /*创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||||
| private Date createTime; | |||||
| /*分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 **/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 ",name="sharingStatus") | |||||
| private Integer sharingStatus; | |||||
| /*微信返回的分账完成时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信返回的分账完成时间",name="finishTime") | |||||
| private String finishTime; | |||||
| /*微信返回的失败原因**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="微信返回的失败原因",name="failedReason") | |||||
| private String failedReason; | |||||
| public String getSharingOrderId() { | |||||
| return sharingOrderId; | |||||
| } | |||||
| public void setSharingOrderId(String _sharingOrderId) { | |||||
| sharingOrderId = _sharingOrderId; | |||||
| } | |||||
| public String getSharingReceiverId() { | |||||
| return sharingReceiverId; | |||||
| } | |||||
| public void setSharingReceiverId(String _sharingReceiverId) { | |||||
| sharingReceiverId = _sharingReceiverId; | |||||
| } | |||||
| public Integer getPayAmount() { | |||||
| return payAmount; | |||||
| } | |||||
| public void setPayAmount(Integer _payAmount) { | |||||
| payAmount = _payAmount; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date _updateTime) { | |||||
| updateTime = _updateTime; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date _createTime) { | |||||
| createTime = _createTime; | |||||
| } | |||||
| public Integer getSharingStatus() { | |||||
| return sharingStatus; | |||||
| } | |||||
| public void setSharingStatus(Integer _sharingStatus) { | |||||
| sharingStatus = _sharingStatus; | |||||
| } | |||||
| public String getFinishTime() { | |||||
| return finishTime; | |||||
| } | |||||
| public void setFinishTime(String _finishTime) { | |||||
| finishTime = _finishTime; | |||||
| } | |||||
| public String getFailedReason() { | |||||
| return failedReason; | |||||
| } | |||||
| public void setFailedReason(String _failedReason) { | |||||
| failedReason = _failedReason; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,SharingOrderId_ASC("`sharingOrderId` ASC"),SharingOrderId_DESC("`sharingOrderId` DESC") | |||||
| ,SharingReceiverId_ASC("`sharingReceiverId` ASC"),SharingReceiverId_DESC("`sharingReceiverId` DESC") | |||||
| ,PayAmount_ASC("`payAmount` ASC"),PayAmount_DESC("`payAmount` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,SharingStatus_ASC("`sharingStatus` ASC"),SharingStatus_DESC("`sharingStatus` DESC") | |||||
| ,FinishTime_ASC("`finishTime` ASC"),FinishTime_DESC("`finishTime` DESC") | |||||
| ,FailedReason_ASC("`failedReason` ASC"),FailedReason_DESC("`failedReason` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxProfitSharingResult.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -71,10 +71,10 @@ public class WxRefundOrder implements Serializable { | |||||
| private Integer refundFee; | private Integer refundFee; | ||||
| /*退款发起时间(秒)**/ | /*退款发起时间(秒)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="退款发起时间(秒)",name="refundTimeStart") | @io.swagger.annotations.ApiModelProperty(value="退款发起时间(秒)",name="refundTimeStart") | ||||
| private Integer refundTimeStart; | |||||
| private Date refundTimeStart; | |||||
| /*退款结束时间(秒)**/ | /*退款结束时间(秒)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="退款结束时间(秒)",name="refundTimeEnd") | @io.swagger.annotations.ApiModelProperty(value="退款结束时间(秒)",name="refundTimeEnd") | ||||
| private Integer refundTimeEnd; | |||||
| private Date refundTimeEnd; | |||||
| /*支付渠道: 0-微信 1-支付宝 2-银联 **/ | /*支付渠道: 0-微信 1-支付宝 2-银联 **/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="支付渠道: 0-微信 1-支付宝 2-银联 ",name="refundVendor") | @io.swagger.annotations.ApiModelProperty(value="支付渠道: 0-微信 1-支付宝 2-银联 ",name="refundVendor") | ||||
| private Integer refundVendor; | private Integer refundVendor; | ||||
| @@ -141,16 +141,16 @@ public class WxRefundOrder implements Serializable { | |||||
| public void setRefundFee(Integer _refundFee) { | public void setRefundFee(Integer _refundFee) { | ||||
| refundFee = _refundFee; | refundFee = _refundFee; | ||||
| } | } | ||||
| public Integer getRefundTimeStart() { | |||||
| public Date getRefundTimeStart() { | |||||
| return refundTimeStart; | return refundTimeStart; | ||||
| } | } | ||||
| public void setRefundTimeStart(Integer _refundTimeStart) { | |||||
| public void setRefundTimeStart(Date _refundTimeStart) { | |||||
| refundTimeStart = _refundTimeStart; | refundTimeStart = _refundTimeStart; | ||||
| } | } | ||||
| public Integer getRefundTimeEnd() { | |||||
| public Date getRefundTimeEnd() { | |||||
| return refundTimeEnd; | return refundTimeEnd; | ||||
| } | } | ||||
| public void setRefundTimeEnd(Integer _refundTimeEnd) { | |||||
| public void setRefundTimeEnd(Date _refundTimeEnd) { | |||||
| refundTimeEnd = _refundTimeEnd; | refundTimeEnd = _refundTimeEnd; | ||||
| } | } | ||||
| public Integer getRefundVendor() { | public Integer getRefundVendor() { | ||||
| @@ -1,12 +1,12 @@ | |||||
| package com.simple.domain.po; | package com.simple.domain.po; | ||||
| import javax.persistence.*; | |||||
| import java.util.*; | |||||
| import java.math.*; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_shop") | @Table(name = "wx_shop") | ||||
| public class WxShop implements Serializable { | public class WxShop implements Serializable { | ||||
| @@ -86,6 +86,10 @@ public class WxShop implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| @io.swagger.annotations.ApiModelProperty(value="图片",name="imgUrl") | |||||
| private String imgUrl; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -177,7 +181,13 @@ public class WxShop implements Serializable { | |||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public String getImgUrl() { | |||||
| return imgUrl; | |||||
| } | |||||
| public void setImgUrl(String imgUrl) { | |||||
| this.imgUrl = imgUrl; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| @@ -8,49 +8,60 @@ public class OrderVo implements Serializable { | |||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*订单ID**/ | /*订单ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") | ||||
| private Long orderId; | private Long orderId; | ||||
| /*卡券ID**/ | /*卡券ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*c端用户id**/ | /*c端用户id**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| /*b端用户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b端用户id",name="bUserId") | |||||
| private Long bUserId; | |||||
| /*订单状态**/ | /*订单状态**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="订单状态",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单状态",name="orderStatus") | |||||
| private Integer orderStatus; | |||||
| /*券状态**/ | /*券状态**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="券状态",name="status") | @io.swagger.annotations.ApiModelProperty(value="券状态",name="status") | ||||
| private Integer couponStatus; | private Integer couponStatus; | ||||
| public String getTenantId() { | |||||
| public String getTenantId() { | |||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | } | ||||
| public Long getOrderId() { | |||||
| return orderId; | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | } | ||||
| public void setOrderId(Long _orderId) { | |||||
| orderId = _orderId; | |||||
| public void setMerchantId(Long merchantId) { | |||||
| this.merchantId = merchantId; | |||||
| } | } | ||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| public Long getOrderId() { | |||||
| return orderId; | |||||
| } | } | ||||
| public void setCouponId(Long _couponId) { | |||||
| couponId = _couponId; | |||||
| public void setOrderId(Long orderId) { | |||||
| this.orderId = orderId; | |||||
| } | } | ||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| } | } | ||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| public void setCouponId(Long couponId) { | |||||
| this.couponId = couponId; | |||||
| } | } | ||||
| public Long getcUserId() { | public Long getcUserId() { | ||||
| return cUserId; | return cUserId; | ||||
| } | } | ||||
| @@ -59,12 +70,20 @@ public class OrderVo implements Serializable { | |||||
| this.cUserId = cUserId; | this.cUserId = cUserId; | ||||
| } | } | ||||
| public Integer getStatus() { | |||||
| return status; | |||||
| public Long getbUserId() { | |||||
| return bUserId; | |||||
| } | |||||
| public void setbUserId(Long bUserId) { | |||||
| this.bUserId = bUserId; | |||||
| } | |||||
| public Integer getOrderStatus() { | |||||
| return orderStatus; | |||||
| } | } | ||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| public void setOrderStatus(Integer orderStatus) { | |||||
| this.orderStatus = orderStatus; | |||||
| } | } | ||||
| public Integer getCouponStatus() { | public Integer getCouponStatus() { | ||||
| @@ -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,35 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumPayDomain { | |||||
| PAY_DOMAIN_MASTER_ACCOUNT_ID(8, ""), | |||||
| PAY_DOMAIN_MASTER_APPINFO_ID(8, ""); | |||||
| public static EnumPayDomain getEnum(Integer code) { | |||||
| for (EnumPayDomain value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumPayDomain(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -8,6 +8,7 @@ public enum EnumPayStatus { | |||||
| PAY_WAY_WAIT(0, "支付中"), | PAY_WAY_WAIT(0, "支付中"), | ||||
| PAY_WAY_SUCCESS(1, "支付成功"), | PAY_WAY_SUCCESS(1, "支付成功"), | ||||
| PAY_WAY_FAIL(2, "支付失败"), | PAY_WAY_FAIL(2, "支付失败"), | ||||
| PAY_WAY_CANCEL(3, "取消支付") | |||||
| ; | ; | ||||
| public static EnumPayStatus getEnum(Integer code) { | public static EnumPayStatus getEnum(Integer code) { | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumProfitSharingReceiverType { | |||||
| PROFIT_SHARING_RECEIVER_MERCHANT_ID(1, "MERCHANT_ID"), | |||||
| PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(2, "PERSONAL_WECHATID"), | |||||
| PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(3, "PERSONAL_OPENID"), | |||||
| PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(4, "PERSONAL_SUB_OPENID"), | |||||
| ; | |||||
| public static EnumProfitSharingReceiverType getEnum(Integer code) { | |||||
| for (EnumProfitSharingReceiverType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumProfitSharingReceiverType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,40 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumProfitSharingStatus { | |||||
| PROFIT_SHARING_UNKNOWN(-1, "未知"), | |||||
| PROFIT_SHARING_REQ_FAILED(1, "提交订单失败"), | |||||
| PROFIT_SHARING_APPLY_FAILED(2, "提交业务失败"), | |||||
| PROFIT_SHARING_ACCEPTED(3, "受理成功"), | |||||
| PROFIT_SHARING_PROCESSING(4, "处理中"), | |||||
| PROFIT_SHARING_DONE(5, "处理完成"), | |||||
| PROFIT_SHARING_FAILED(6, "处理失败"), | |||||
| ; | |||||
| public static EnumProfitSharingStatus getEnum(Integer code) { | |||||
| for (EnumProfitSharingStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumProfitSharingStatus(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.WxCUserCar; | |||||
| public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||||
| List<WxCUserCar> findList(WxCUserCar wxCUserCar); | |||||
| } | |||||
| @@ -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.WxCUserCars; | |||||
| public interface WxCUserCarsMapper extends CommonMapper<WxCUserCars, String> { | |||||
| List<WxCUserCars> findList(WxCUserCars wxCUserCars); | |||||
| } | |||||
| @@ -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); | |||||
| } | |||||
| @@ -12,6 +12,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findEnableList(WxCoupon wxCoupon); | List<WxCoupon> findEnableList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findCanSendList(WxCoupon record); | |||||
| @@ -8,10 +8,4 @@ import com.simple.domain.po.WxCouponOrder; | |||||
| public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | ||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | ||||
| } | } | ||||
| @@ -5,7 +5,7 @@ import com.simple.common.CommonMapper; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxPayOrder; | import com.simple.domain.po.WxPayOrder; | ||||
| public interface WxPayOrderMapper extends CommonMapper<WxPayOrder, String> { | |||||
| public interface WxPayOrderMapper extends CommonMapper<WxPayOrder, Long> { | |||||
| List<WxPayOrder> findList(WxPayOrder wxPayOrder); | List<WxPayOrder> findList(WxPayOrder wxPayOrder); | ||||
| @@ -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.WxProfitSharingOrder; | |||||
| public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> { | |||||
| List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | |||||
| } | |||||
| @@ -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.WxProfitSharingReceiver; | |||||
| public interface WxProfitSharingReceiverMapper extends CommonMapper<WxProfitSharingReceiver, Long> { | |||||
| List<WxProfitSharingReceiver> findList(WxProfitSharingReceiver wxProfitSharingReceiver); | |||||
| } | |||||
| @@ -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.WxProfitSharingResult; | |||||
| public interface WxProfitSharingResultMapper extends CommonMapper<WxProfitSharingResult, Long> { | |||||
| List<WxProfitSharingResult> findList(WxProfitSharingResult wxProfitSharingResult); | |||||
| } | |||||
| @@ -153,6 +153,26 @@ public class WxPayment { | |||||
| } | } | ||||
| /** | |||||
| * 小程序统一下单后二次签名 | |||||
| * | |||||
| * @param appId | |||||
| * @param timestamp | |||||
| * @param prepay_id | |||||
| * @param paternerKey | |||||
| * @return | |||||
| */ | |||||
| public static Map<String, String> buildWeappSecondSignMap(String appId, String timestamp, String prepay_id, String paternerKey) { | |||||
| Map<String, String> params = new HashMap<String, String>(); | |||||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||||
| sighMap.put("appId", appId); | |||||
| sighMap.put("timeStamp", timestamp); | |||||
| sighMap.put("package", "prepay_id="+prepay_id); | |||||
| sighMap.put("signType", "MD5"); | |||||
| return buildSignAfterParasMap(params, paternerKey); | |||||
| } | |||||
| /** | /** | ||||
| * 关闭订单 | * 关闭订单 | ||||
| * | * | ||||
| @@ -0,0 +1,48 @@ | |||||
| package com.simple.pay; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| import com.simple.utils.HttpUtil; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| public class WxProfitSharing { | |||||
| protected static Logger log = LoggerFactory.getLogger(WxProfitSharing.class); | |||||
| // 分账接口 | |||||
| private static final String PROFIT_SHARING_URL = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; | |||||
| // 查询接口 | |||||
| private static final String PROFIT_SHARING_QUERY_URL = "https://api.mch.weixin.qq.com/pay/profitsharingquery"; | |||||
| // 添加分账账户 | |||||
| private static final String RPOFIT_SHARING_ADD_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; | |||||
| // 删除分账账户 | |||||
| private static final String RPOFIT_SHARING_REMOVE_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver"; | |||||
| private WxProfitSharing() { | |||||
| } | |||||
| /** | |||||
| * 分账下单 | |||||
| * @param params | |||||
| * @return | |||||
| */ | |||||
| public static String pushOrder(Map<String, String> params) { | |||||
| return doPost(PROFIT_SHARING_URL, params); | |||||
| } | |||||
| /** | |||||
| * 分账查询 | |||||
| * @param params 请求参数 | |||||
| * @return | |||||
| */ | |||||
| public static String queryOrder(Map<String, String> params) { | |||||
| return doPost(PROFIT_SHARING_URL, params); | |||||
| } | |||||
| public static String doPost(String url, Map<String, String> params) { | |||||
| return HttpUtil.payPost(url, WxPayment.toXml(params)); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,89 @@ | |||||
| package com.simple.pay; | |||||
| import java.io.Serializable; | |||||
| /** | |||||
| * Created by Peng on 2018/8/10. | |||||
| */ | |||||
| public class WxProfitSharingP implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private String mch_id; // 商户号 | |||||
| private String sub_mch_id; // 子商户号 | |||||
| private String appid; // 公众账号ID | |||||
| private String sub_appid; // 子公众账号ID | |||||
| private String nonce_str; // 随机字符串 | |||||
| private String sign; // 签名 | |||||
| private String transaction_id ; // 支付订单号 | |||||
| private String out_trade_no; // 商户订单号 | |||||
| private String receivers; // 分账接收方 | |||||
| public String getMch_id() { | |||||
| return mch_id; | |||||
| } | |||||
| public void setMch_id(String mch_id) { | |||||
| this.mch_id = mch_id; | |||||
| } | |||||
| public String getSub_mch_id() { return sub_mch_id; } | |||||
| public void setSub_mch_id(String sub_mch_id) { | |||||
| this.sub_mch_id = sub_mch_id; | |||||
| } | |||||
| public String getAppid() { | |||||
| return appid; | |||||
| } | |||||
| public void setAppid(String appid) { | |||||
| this.appid = appid; | |||||
| } | |||||
| public String getSub_appid() { | |||||
| return sub_appid; | |||||
| } | |||||
| public void setSub_appid(String sub_appid) { | |||||
| this.sub_appid = sub_appid; | |||||
| } | |||||
| public String getNonce_str() { | |||||
| return nonce_str; | |||||
| } | |||||
| public void setNonce_str(String nonce_str) { | |||||
| this.nonce_str = nonce_str; | |||||
| } | |||||
| public String getSign() { | |||||
| return sign; | |||||
| } | |||||
| public void setSign(String sign) { | |||||
| this.sign = sign; | |||||
| } | |||||
| public String getTransaction_id() { | |||||
| return transaction_id; | |||||
| } | |||||
| public void setTransaction_id(String transaction_id) { | |||||
| this.transaction_id = transaction_id; | |||||
| } | |||||
| public String getOut_trade_no() { return out_trade_no; } | |||||
| public void setOut_trade_no(String out_trade_no) { | |||||
| this.out_trade_no = out_trade_no; | |||||
| } | |||||
| public String getReceivers() { | |||||
| return receivers; | |||||
| } | |||||
| public void setReceivers(String receivers) { | |||||
| this.receivers = receivers; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,63 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| public interface WxCUserCarService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据实体查询列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxCUserCar> getList(WxCUserCar record); | |||||
| /** | |||||
| * 根据实体查询 | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| WxCUserCar getOne(WxCUserCar record); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxCUserCar getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxCUserCar record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 根据WxCUserCar删除实体 | |||||
| * @param record | |||||
| */ | |||||
| void deleteByObj(WxCUserCar record); | |||||
| } | |||||
| @@ -2,9 +2,9 @@ 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.WxCUserCars; | |||||
| import com.simple.domain.po.WxCarCmdLog; | |||||
| public interface WxCUserCarsService { | |||||
| public interface WxCarCmdLogService { | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| @@ -14,7 +14,7 @@ public interface WxCUserCarsService { | |||||
| * @param limit | * @param limit | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCUserCars> listAsPage(WxCUserCars record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -22,14 +22,14 @@ public interface WxCUserCarsService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCUserCars getById(Long id); | |||||
| WxCarCmdLog getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCUserCars record); | |||||
| void saveOrUpdate(WxCarCmdLog record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.MallUserInfo; | import com.simple.domain.po.MallUserInfo; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.po.WxMerchantBUser; | |||||
| public interface WxCouponOrderService { | public interface WxCouponOrderService { | ||||
| @@ -12,8 +13,8 @@ public interface WxCouponOrderService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize); | ||||
| @@ -40,20 +41,20 @@ public interface WxCouponOrderService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | /** | ||||
| * 根据主键Id(券码)核销 | |||||
| * 根据主键couponOrderId(券码)核销 | |||||
| * | * | ||||
| * @param id | |||||
| * @param mallUserInfo 核销人(登录用户) | |||||
| * @param couponOrderId | |||||
| * @param bUserId 核销人(登录用户) | |||||
| */ | */ | ||||
| ResultData verify(Long id, MallUserInfo mallUserInfo); | |||||
| ResultData verify(Long couponOrderId, Long bUserId); | |||||
| /** | /** | ||||
| * 根据主键Id(券码)退券(款) | |||||
| * 根据主键couponOrderId(券码)退券(款) | |||||
| * | * | ||||
| * @param id | |||||
| * @param mallUserInfo 退券(款)人(登录用户) | |||||
| * @param couponOrderId | |||||
| * @param bUserId 退券(款)人(登录用户) | |||||
| */ | */ | ||||
| ResultData refund(Long id, MallUserInfo mallUserInfo); | |||||
| ResultData refund(Long couponOrderId, Long bUserId); | |||||
| @@ -48,7 +48,10 @@ public interface WxCouponService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * | |||||
| */ | |||||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| @@ -39,6 +39,6 @@ public interface WxMerchantService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| void saveOrUpdate(WxMerchant wxMerchant, String shopids, String userids); | |||||
| void disable(Long id); | |||||
| } | } | ||||
| @@ -1,8 +1,8 @@ | |||||
| package com.simple.service; | package com.simple.service; | ||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxMerchantShop; | import com.simple.domain.po.WxMerchantShop; | ||||
| import com.simple.domain.po.WxShop; | |||||
| public interface WxMerchantShopService { | public interface WxMerchantShopService { | ||||
| @@ -37,12 +37,11 @@ public interface WxMerchantShopService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| PageInfo<WxShop> queryShopList(WxMerchantShop record, Integer pageIndex, Integer pageSize); | |||||
| } | } | ||||
| @@ -10,8 +10,8 @@ public interface WxParkService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxPark> listAsPage(WxPark record, Integer pageIndex, Integer pageSize); | PageInfo<WxPark> listAsPage(WxPark record, Integer pageIndex, Integer pageSize); | ||||
| @@ -23,6 +23,14 @@ public interface WxParkService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxPark getById(Long id); | WxPark getById(Long id); | ||||
| /** | |||||
| * 根据WxPark获得实体 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| WxPark getByObj(WxPark record); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -13,7 +13,8 @@ public interface WxPayOrderService { | |||||
| /** | /** | ||||
| * 创建支付订单 | * 创建支付订单 | ||||
| * @param record 支付订单请求 | |||||
| * | |||||
| * @param record 支付订单请求 | |||||
| * @param payWay | * @param payWay | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| @@ -21,28 +22,45 @@ public interface WxPayOrderService { | |||||
| /** | /** | ||||
| * 异步通知 | * 异步通知 | ||||
| * @param paramMap 异步通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * | |||||
| * @param paramMap 异步通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| String notify(Map<String, String> paramMap, EnumPayWay payWay); | String notify(Map<String, String> paramMap, EnumPayWay payWay); | ||||
| /** | /** | ||||
| * 支付成功处理 | * 支付成功处理 | ||||
| * | |||||
| * @param record | * @param record | ||||
| * @param transactionId | * @param transactionId | ||||
| */ | */ | ||||
| void handleOrderPaySuccess(WxPayOrder record, String transactionId); | void handleOrderPaySuccess(WxPayOrder record, String transactionId); | ||||
| /** | |||||
| * 支付状态处理 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void handlePayOrderStatusUpdate(WxPayOrder record); | |||||
| /** | /** | ||||
| * 页面回调 | * 页面回调 | ||||
| * @param paramMap 页面通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * | |||||
| * @param paramMap 页面通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| void callback(Map<String, String> paramMap, EnumPayWay payWay); | void callback(Map<String, String> paramMap, EnumPayWay payWay); | ||||
| /** | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxPayOrder record); | |||||
| /** | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| @@ -50,22 +68,17 @@ public interface WxPayOrderService { | |||||
| * @param pageSize | * @param pageSize | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxPayOrder> listAsPage(WxPayOrder record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| PageInfo<WxPayOrder> listAsPage(WxPayOrder record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxPayOrder getById(Long id); | WxPayOrder getById(Long id); | ||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxPayOrder record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -73,12 +86,6 @@ public interface WxPayOrderService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| } | } | ||||
| @@ -0,0 +1,58 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxAppinfo; | |||||
| import com.simple.domain.po.WxPayOrder; | |||||
| import com.simple.domain.po.WxProfitSharingOrder; | |||||
| public interface WxProfitSharingOrderService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxProfitSharingOrder> listAsPage(WxProfitSharingOrder record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxProfitSharingOrder getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxProfitSharingOrder record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 临时测试 | |||||
| */ | |||||
| public void test(); | |||||
| /** | |||||
| * 创建分账订单 | |||||
| */ | |||||
| public ResultData createSharingOrder(WxAppinfo appInfo, WxPayOrder wxPayOrder); | |||||
| } | |||||
| @@ -0,0 +1,48 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxProfitSharingReceiver; | |||||
| public interface WxProfitSharingReceiverService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxProfitSharingReceiver> listAsPage(WxProfitSharingReceiver record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxProfitSharingReceiver getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxProfitSharingReceiver record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| } | |||||
| @@ -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.WxProfitSharingResult; | |||||
| public interface WxCarCmdLogsService { | |||||
| public interface WxProfitSharingResultService { | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCarCmdLogs> listAsPage(WxCarCmdLogs record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxProfitSharingResult> listAsPage(WxProfitSharingResult record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -22,14 +22,14 @@ public interface WxCarCmdLogsService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCarCmdLogs getById(Long id); | |||||
| WxProfitSharingResult getById(Long id); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCarCmdLogs record); | |||||
| void saveOrUpdate(WxProfitSharingResult record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -32,7 +32,8 @@ public class MallPermissionServiceImpl implements MallPermissionService { | |||||
| public void saveOrUpdate(MallPermission record) { | public void saveOrUpdate(MallPermission record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| record.setId(new IdWorker(0, 0).nextId()); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| mallPermissionMapper.insertSelective(record); | mallPermissionMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| mallPermissionMapper.updateByPrimaryKeySelective(record); | mallPermissionMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -31,7 +31,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| public void saveOrUpdate(WxCUserBasicInfo record) { | public void saveOrUpdate(WxCUserBasicInfo record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxCUserBasicInfoMapper.insertSelective(record); | wxCUserBasicInfoMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| @@ -0,0 +1,69 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.mapper.WxCUserCarMapper; | |||||
| import com.simple.service.WxCUserCarService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxCUserCarServiceImpl implements WxCUserCarService { | |||||
| @Autowired | |||||
| WxCUserCarMapper wxCUserCarMapper; | |||||
| @Override | |||||
| public PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public List<WxCUserCar> getList(WxCUserCar record) { | |||||
| return wxCUserCarMapper.findList(record); | |||||
| } | |||||
| @Override | |||||
| public WxCUserCar getOne(WxCUserCar record) { | |||||
| return wxCUserCarMapper.selectOne(record); | |||||
| } | |||||
| @Override | |||||
| public WxCUserCar getById(Long id) { | |||||
| return wxCUserCarMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCUserCar record) { | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCUserCarMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCUserCarMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCUserCarMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void deleteByObj(WxCUserCar record) { | |||||
| wxCUserCarMapper.delete(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.WxCUserCars; | |||||
| import com.simple.mapper.WxCUserCarsMapper; | |||||
| import com.simple.service.WxCUserCarsService; | |||||
| 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 WxCUserCarsServiceImpl implements WxCUserCarsService { | |||||
| public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { | |||||
| @Autowired | @Autowired | ||||
| WxCUserCarsMapper wxCUserCarsMapper; | |||||
| WxCarCmdLogMapper wxCarCmdLogMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCUserCars> listAsPage(WxCUserCars record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarsMapper.findList(record)); | |||||
| public PageInfo<WxCarCmdLog> listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarCmdLogMapper.findList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCUserCars getById(Long id) { | |||||
| return wxCUserCarsMapper.selectByPrimaryKey(id); | |||||
| public WxCarCmdLog getById(Long id) { | |||||
| return wxCarCmdLogMapper.selectByPrimaryKey(id); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxCUserCars 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()); | ||||
| wxCUserCarsMapper.insertSelective(record); | |||||
| wxCarCmdLogMapper.insertSelective(record); | |||||
| } else { | } else { | ||||
| wxCUserCarsMapper.updateByPrimaryKeySelective(record); | |||||
| wxCarCmdLogMapper.updateByPrimaryKeySelective(record); | |||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCUserCarsMapper.deleteByPrimaryKey(id); | |||||
| wxCarCmdLogMapper.deleteByPrimaryKey(id); | |||||
| } | } | ||||
| @@ -1,54 +0,0 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCarCmdLogs; | |||||
| import com.simple.mapper.WxCarCmdLogsMapper; | |||||
| import com.simple.service.WxCarCmdLogsService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxCarCmdLogsServiceImpl implements WxCarCmdLogsService { | |||||
| @Autowired | |||||
| WxCarCmdLogsMapper wxCarCmdLogsMapper; | |||||
| @Override | |||||
| public PageInfo<WxCarCmdLogs> listAsPage(WxCarCmdLogs record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCarCmdLogsMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxCarCmdLogs getById(Long id) { | |||||
| return wxCarCmdLogsMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCarCmdLogs record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCarCmdLogsMapper.insertSelective(record); | |||||
| } else { | |||||
| wxCarCmdLogsMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxCarCmdLogsMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -8,9 +8,16 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.MallUserInfo; | import com.simple.domain.po.MallUserInfo; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.po.WxMerchantBUser; | |||||
| import com.simple.domain.po.WxOrder; | |||||
| import com.simple.enums.EnumCouponOrderStatus; | import com.simple.enums.EnumCouponOrderStatus; | ||||
| import com.simple.enums.EnumCouponStatus; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.mapper.WxOrderMapper; | |||||
| import com.simple.mapper.WxCouponOrderMapper; | import com.simple.mapper.WxCouponOrderMapper; | ||||
| import com.simple.mapper.WxMerchantBUserMapper; | |||||
| import com.simple.service.WxCouponOrderService; | import com.simple.service.WxCouponOrderService; | ||||
| import org.apache.log4j.Logger; | |||||
| 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 org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| @@ -20,10 +27,17 @@ import java.util.Date; | |||||
| @Service | @Service | ||||
| public class WxCouponOrderServiceImpl implements WxCouponOrderService { | public class WxCouponOrderServiceImpl implements WxCouponOrderService { | ||||
| private Logger logger = Logger.getLogger(WxCouponOrderServiceImpl.class); | |||||
| @Autowired | @Autowired | ||||
| WxCouponOrderMapper wxCouponOrderMapper; | WxCouponOrderMapper wxCouponOrderMapper; | ||||
| @Autowired | |||||
| WxOrderMapper wxOrderMapper; | |||||
| @Autowired | |||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | ||||
| @@ -38,7 +52,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| public void saveOrUpdate(WxCouponOrder record) { | public void saveOrUpdate(WxCouponOrder record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxCouponOrderMapper.insertSelective(record); | wxCouponOrderMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| @@ -52,48 +66,98 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData verify(Long id, MallUserInfo mallUserInfo) { | |||||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(id); | |||||
| if (wxCouponOrder.getCouponOrderStatus() == 2) { | |||||
| return new ResultData(Result.ERROR, "已过期"); | |||||
| public ResultData verify(Long couponOrderId, Long bUserId) { | |||||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(couponOrderId); | |||||
| if(wxCouponOrder == null){ | |||||
| logger.error("券ID不存在:"+ couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId.longValue()); | |||||
| if(wxMerchantBUser == null){ | |||||
| logger.error("核销员ID不存在:"+ bUserId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxCouponOrder.getOrderId()); | |||||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())){ | |||||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId()+"核销: couponMerchantId-"+wxMerchantBUser.getMerchantId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode()) { | |||||
| logger.error("已过期: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||||
| } | |||||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()) { | |||||
| logger.error("已退款: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_INVALID); | |||||
| } | } | ||||
| if (wxCouponOrder.getCouponOrderStatus() == 3) { | |||||
| return new ResultData(Result.ERROR, "已退款"); | |||||
| if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()) { | |||||
| logger.error("已经核销过的券: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_USED); | |||||
| } | } | ||||
| if (wxCouponOrder.getCouponOrderStatus() == 1) { | |||||
| return new ResultData(Result.ERROR, "已经核销过的券"); | |||||
| try { | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 | |||||
| wxCouponOrder.setBUserId(bUserId); | |||||
| wxCouponOrder.setUpdateDate(new Date()); | |||||
| wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder); | |||||
| } catch (Exception e) { | |||||
| logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | } | ||||
| wxCouponOrder.setCouponOrderStatus(1); //1核销 | |||||
| wxCouponOrder.setBUserId(mallUserInfo.getId()); | |||||
| wxCouponOrder.setUpdateDate(new Date()); | |||||
| wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder); | |||||
| return new ResultData(); | |||||
| return new ResultData(wxCouponOrder); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData refund(Long id, MallUserInfo mallUserInfo) { | |||||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(id); | |||||
| public ResultData refund(Long couponOrderId, Long bUserId) { | |||||
| WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectByPrimaryKey(couponOrderId); | |||||
| if(wxCouponOrder == null){ | |||||
| logger.error("券ID不存在:"+ couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId.longValue()); | |||||
| if(wxMerchantBUser == null){ | |||||
| logger.error("操作员ID不存在:"+ bUserId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxCouponOrder.getOrderId()); | |||||
| if (!wxOrder.getMerchantId().equals(wxMerchantBUser.getMerchantId())){ | |||||
| logger.error("券: couponMerchantId-" + wxOrder.getMerchantId()+"核销: couponMerchantId-"+wxMerchantBUser.getMerchantId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | |||||
| } | |||||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode())) { | if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_OVER_TIME.getCode())) { | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||||
| logger.error("已过期: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||||
| } | } | ||||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode())) { | if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode())) { | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_INVALID); | |||||
| logger.error("已退款: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_OVER_TIME); | |||||
| } | } | ||||
| if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode())) { | if (wxCouponOrder.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode())) { | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_USED); | |||||
| logger.error("已经核销过的券: couponOrder-" + couponOrderId); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_USED); | |||||
| } | |||||
| try { | |||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||||
| wxCouponOrder.setBUserId(bUserId); | |||||
| wxCouponOrder.setUpdateDate(new Date()); | |||||
| wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder); | |||||
| } catch (Exception e) { | |||||
| logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | |||||
| } | } | ||||
| wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 | |||||
| wxCouponOrder.setBUserId(mallUserInfo.getId()); | |||||
| wxCouponOrder.setUpdateDate(new Date()); | |||||
| wxCouponOrderMapper.updateByPrimaryKeySelective(wxCouponOrder); | |||||
| return new ResultData(wxCouponOrder); | return new ResultData(wxCouponOrder); | ||||
| } | } | ||||
| @@ -50,12 +50,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCouponMapper.deleteByPrimaryKey(id); | wxCouponMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCanSendList(record)); | |||||
| } | |||||
| } | } | ||||
| @@ -31,7 +31,7 @@ public class WxDateAmountRecordServiceImpl implements WxDateAmountRecordService | |||||
| public void saveOrUpdate(WxDateAmountRecord record) { | public void saveOrUpdate(WxDateAmountRecord record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxDateAmountRecordMapper.insertSelective(record); | wxDateAmountRecordMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| @@ -37,9 +37,16 @@ public class WxMerchantBUserServiceImpl implements WxMerchantBUserService { | |||||
| 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()); | |||||
| long id = idWorker.nextId(); | |||||
| record.setId(id); | |||||
| record.setBUserId(id); | |||||
| Date date = new Date(); | |||||
| record.setCreateDate(date); | |||||
| record.setUpdateDate(date); | |||||
| wxMerchantBUserMapper.insertSelective(record); | wxMerchantBUserMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| Date date = new Date(); | |||||
| record.setUpdateDate(date); | |||||
| wxMerchantBUserMapper.updateByPrimaryKeySelective(record); | wxMerchantBUserMapper.updateByPrimaryKeySelective(record); | ||||
| } | } | ||||
| } | } | ||||
| @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -42,31 +43,43 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Override | @Override | ||||
| public WxMerchant getById(Long id) { | public WxMerchant getById(Long id) { | ||||
| return wxMerchantMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); | |||||
| WxMerchantShop wxMerchantShop=new WxMerchantShop(); | |||||
| wxMerchantShop.setMerchantId(wxMerchant.getId()); | |||||
| List<WxShop> shops = new ArrayList<>(); | |||||
| List<WxMerchantShop> wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); | |||||
| for(WxMerchantShop merchantShop:wxMerchantShopList){ | |||||
| WxShop wxShop = WxShopMapper.selectByPrimaryKey(merchantShop.getShopId()); | |||||
| if(wxShop!=null) | |||||
| shops.add(wxShop); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxMerchant record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateDate(new Date()); | |||||
| wxMerchant.setShops(shops); | |||||
| wxMerchantMapper.insertSelective(record); | |||||
| } else { | |||||
| wxMerchantMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | |||||
| wxMerchantBUser.setMerchantId(wxMerchant.getId()); | |||||
| List<WxMerchantBUser> bUserList = wxMerchantBUserMapper.findList(wxMerchantBUser); | |||||
| wxMerchant.setbUsers(bUserList); | |||||
| return wxMerchant; | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxMerchantMapper.deleteByPrimaryKey(id); | wxMerchantMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public void disable(Long id) { | |||||
| WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(id); | |||||
| wxMerchant.setStatus(0); | |||||
| wxMerchantMapper.updateByPrimaryKeySelective(wxMerchant); | |||||
| } | |||||
| @Transactional | @Transactional | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxMerchant wxMerchant, String shopids, String userids) { | |||||
| public void saveOrUpdate(WxMerchant wxMerchant) { | |||||
| if (wxMerchant.getId() == null) { | if (wxMerchant.getId() == null) { | ||||
| @@ -74,12 +87,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| long merchantid = idWorker.nextId(); | long merchantid = idWorker.nextId(); | ||||
| wxMerchant.setId(merchantid); | wxMerchant.setId(merchantid); | ||||
| Date date = new Date(); | Date date = new Date(); | ||||
| wxMerchant.setStatus(1); | |||||
| wxMerchant.setUpdateDate(date); | wxMerchant.setUpdateDate(date); | ||||
| wxMerchant.setCreateDate(date); | wxMerchant.setCreateDate(date); | ||||
| wxMerchantMapper.insertSelective(wxMerchant); | wxMerchantMapper.insertSelective(wxMerchant); | ||||
| //保存商户商铺的关联 | //保存商户商铺的关联 | ||||
| List<Long> shopidlist = JSONArray.parseArray(shopids, Long.class); | |||||
| List<Long> shopidlist = wxMerchant.getShopids(); | |||||
| for(Long shopid:shopidlist){ | for(Long shopid:shopidlist){ | ||||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | WxMerchantShop wxMerchantShop = new WxMerchantShop(); | ||||
| wxMerchantShop.setId(idWorker.nextId()); | wxMerchantShop.setId(idWorker.nextId()); | ||||
| @@ -101,7 +115,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| //保存商户关联用户 | //保存商户关联用户 | ||||
| List<Long> useridlist = JSONArray.parseArray(userids, Long.class); | |||||
| List<Long> useridlist = wxMerchant.getUserids(); | |||||
| for(Long userid:useridlist){ | for(Long userid:useridlist){ | ||||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | ||||
| wxMerchantBUser.setId(userid); | wxMerchantBUser.setId(userid); | ||||
| @@ -133,13 +147,13 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| //更新商铺状态 | //更新商铺状态 | ||||
| WxShop wxShop = new WxShop(); | WxShop wxShop = new WxShop(); | ||||
| wxShop.setId(merchantShop.getShopId()); | wxShop.setId(merchantShop.getShopId()); | ||||
| wxShop.setStatus(0);//已出租 | |||||
| wxShop.setStatus(0);//未出租 | |||||
| WxShopMapper.updateByPrimaryKeySelective(wxShop); | WxShopMapper.updateByPrimaryKeySelective(wxShop); | ||||
| } | } | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| //保存商户商铺的关联 | //保存商户商铺的关联 | ||||
| List<Long> shopidlist = JSONArray.parseArray(shopids, Long.class); | |||||
| List<Long> shopidlist = wxMerchant.getShopids(); | |||||
| for(Long shopid:shopidlist){ | for(Long shopid:shopidlist){ | ||||
| WxMerchantShop wxMerchantShop = new WxMerchantShop(); | WxMerchantShop wxMerchantShop = new WxMerchantShop(); | ||||
| wxMerchantShop.setId(idWorker.nextId()); | wxMerchantShop.setId(idWorker.nextId()); | ||||
| @@ -162,7 +176,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| //保存商户关联用户 | //保存商户关联用户 | ||||
| List<Long> useridlist = JSONArray.parseArray(userids, Long.class); | |||||
| List<Long> useridlist = wxMerchant.getUserids(); | |||||
| for(Long userid:useridlist){ | for(Long userid:useridlist){ | ||||
| WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); | ||||
| wxMerchantBUser.setId(userid); | wxMerchantBUser.setId(userid); | ||||
| @@ -1,14 +1,22 @@ | |||||
| package com.simple.service.impl; | package com.simple.service.impl; | ||||
| import java.util.*; | |||||
| import com.github.pagehelper.ISelect; | |||||
| import com.github.pagehelper.Page; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.IdWorker; | |||||
| import com.simple.domain.po.WxMerchantShop; | import com.simple.domain.po.WxMerchantShop; | ||||
| import com.simple.domain.po.WxShop; | |||||
| import com.simple.mapper.WxMerchantShopMapper; | import com.simple.mapper.WxMerchantShopMapper; | ||||
| import com.simple.mapper.WxShopMapper; | |||||
| import com.simple.service.WxMerchantShopService; | import com.simple.service.WxMerchantShopService; | ||||
| 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 java.util.ArrayList; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class WxMerchantShopServiceImpl implements WxMerchantShopService { | public class WxMerchantShopServiceImpl implements WxMerchantShopService { | ||||
| @@ -16,12 +24,33 @@ public class WxMerchantShopServiceImpl implements WxMerchantShopService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantShopMapper wxMerchantShopMapper; | WxMerchantShopMapper wxMerchantShopMapper; | ||||
| @Autowired | |||||
| WxShopMapper wxShopMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchantShop> listAsPage(WxMerchantShop record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMerchantShop> listAsPage(WxMerchantShop record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantShopMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantShopMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxShop> queryShopList(WxMerchantShop record, Integer pageIndex, Integer pageSize) { | |||||
| List<WxShop> resultlist=new ArrayList<>(); | |||||
| List<WxMerchantShop> merchantShops = wxMerchantShopMapper.findList(record); | |||||
| for(WxMerchantShop merchantShop:merchantShops){ | |||||
| WxShop wxShop = new WxShop(); | |||||
| wxShop.setId(merchantShop.getShopId()); | |||||
| List<WxShop> shopList = wxShopMapper.findList(wxShop); | |||||
| if(shopList.size()>0){ | |||||
| resultlist.add(shopList.get(0)); | |||||
| } | |||||
| } | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| PageInfo<WxShop> pageInfo = new PageInfo<>(resultlist); | |||||
| return pageInfo; | |||||
| } | |||||
| @Override | @Override | ||||
| public WxMerchantShop getById(Long id) { | public WxMerchantShop getById(Long id) { | ||||
| return wxMerchantShopMapper.selectByPrimaryKey(id); | return wxMerchantShopMapper.selectByPrimaryKey(id); | ||||
| @@ -145,7 +145,7 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| wxMsgValidationcode.setExpiretime(expiredate); | wxMsgValidationcode.setExpiretime(expiredate); | ||||
| wxMsgValidationcode.setCreatetime(createtime); | wxMsgValidationcode.setCreatetime(createtime); | ||||
| wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); | wxMsgValidationcodeMapper.insertSelective(wxMsgValidationcode); | ||||
| return new ResultData(200,"发送成功"); | |||||
| return new ResultData(Result.SUCCESS,"发送成功"); | |||||
| } | } | ||||
| return new ResultData(500,"发送失败"); | return new ResultData(500,"发送失败"); | ||||
| @@ -103,22 +103,25 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| // check 购买是否超限 | // check 购买是否超限 | ||||
| int count = 0; | |||||
| try { | try { | ||||
| WxCouponOrder query = new WxCouponOrder(); | WxCouponOrder query = new WxCouponOrder(); | ||||
| query.setCouponId(couponId); | query.setCouponId(couponId); | ||||
| query.setCUserId(user.getId()); | |||||
| query.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | query.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | ||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findList(query); | |||||
| if (list.size() >= coupon.getUseLimitQuantity()) { | |||||
| //解锁 | |||||
| redisLock.unlock(couponIdStr, timeStr); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); | |||||
| } | |||||
| count = wxCouponOrderMapper.selectCount(query); | |||||
| }catch (Exception e) { | }catch (Exception e) { | ||||
| //解锁 | //解锁 | ||||
| redisLock.unlock(couponIdStr, timeStr); | redisLock.unlock(couponIdStr, timeStr); | ||||
| logger.error("此券购买数量检查出问题了, couponId: " + couponIdStr); | |||||
| logger.error("购买是否超限-DB, couponId: " + couponIdStr + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | ||||
| } | } | ||||
| if (count > coupon.getUseLimitQuantity()) { | |||||
| //解锁 | |||||
| redisLock.unlock(couponIdStr, timeStr); | |||||
| logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_LIMITED); | |||||
| } | |||||
| try { | try { | ||||
| // 减库存 | // 减库存 | ||||
| @@ -155,6 +158,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| record.setTenantId(user.getTenantId()); | record.setTenantId(user.getTenantId()); | ||||
| record.setOrderNumber(orderNumber); | record.setOrderNumber(orderNumber); | ||||
| record.setCUserId(user.getId()); | record.setCUserId(user.getId()); | ||||
| record.setMerchantId(coupon.getMerchantId()); | |||||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| @@ -171,6 +175,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| WxCouponOrder couponOrder = new WxCouponOrder(); | WxCouponOrder couponOrder = new WxCouponOrder(); | ||||
| couponOrder.setId(idWorker.nextId()); | couponOrder.setId(idWorker.nextId()); | ||||
| couponOrder.setTenantId(user.getTenantId()); | |||||
| couponOrder.setCouponId(couponId); | couponOrder.setCouponId(couponId); | ||||
| couponOrder.setCUserId(user.getId()); | couponOrder.setCUserId(user.getId()); | ||||
| couponOrder.setOrderId(orderNumber); | couponOrder.setOrderId(orderNumber); | ||||
| @@ -27,6 +27,11 @@ public class WxParkServiceImpl implements WxParkService { | |||||
| return wxParkMapper.selectByPrimaryKey(id); | return wxParkMapper.selectByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public WxPark getByObj(WxPark record) { | |||||
| return wxParkMapper.selectOne(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxPark record) { | public void saveOrUpdate(WxPark record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.service.impl; | package com.simple.service.impl; | ||||
| import java.text.ParseException; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| @@ -7,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| 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.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| @@ -47,10 +49,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxOrderMapper wxOrderMapper; | WxOrderMapper wxOrderMapper; | ||||
| @Autowired | |||||
| @Autowired | |||||
| WxPayOrderMapper wxPayOrderMapper; | WxPayOrderMapper wxPayOrderMapper; | ||||
| @Autowired | |||||
| @Autowired | |||||
| WxOrderService wxOrderService; | WxOrderService wxOrderService; | ||||
| JSONObject errorMap = JSON.parseObject("{\"NOAUTH\":{\"detail\":\"商户无此接口权限\",\"reason\":\"商户未开通此接口权限\",\"resolution\":\"请商户前往申请此接口权限\"}," + | JSONObject errorMap = JSON.parseObject("{\"NOAUTH\":{\"detail\":\"商户无此接口权限\",\"reason\":\"商户未开通此接口权限\",\"resolution\":\"请商户前往申请此接口权限\"}," + | ||||
| @@ -77,82 +79,99 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| // 1. check 订单 | // 1. check 订单 | ||||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | ||||
| if (order == null) { | if (order == null) { | ||||
| logger.warn("pay order, order not allow, repaymentReq: " + record.toString() +", payWay: " + payWay.toString()); | |||||
| logger.error("pay order, order not allow, repaymentReq: " + record.toString() + ", payWay: " + payWay.toString()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| if (order.getOrderStatus() != EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()) { | if (order.getOrderStatus() != EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()) { | ||||
| logger.warn("pay order, order status not allow, repaymentReq: " + order.toString() + " , payWay: " + payWay.toString()); | |||||
| logger.error("pay order, order status not allow, repaymentReq: " + order.toString() + " , payWay: " + payWay.toString()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_PAY); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_PAY); | ||||
| } | } | ||||
| // 2. check 是否有支付订单 | // 2. check 是否有支付订单 | ||||
| List<WxPayOrder> list = wxPayOrderMapper.findList(record); | |||||
| if (list.size() > 0) { | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_EXIST); | |||||
| } | |||||
| // 3. 创建支付订单 | |||||
| Long id = idworker.nextId(); | |||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| List<WxPayOrder> list = wxPayOrderMapper.findList(record); | |||||
| String payOrderNo = ""; | |||||
| if (list.size() <= 0) { | |||||
| // 3. 创建支付订单 | |||||
| Long id = idworker.nextId(); | |||||
| payOrderNo = String.valueOf(id); | |||||
| record.setId(id); | |||||
| record.setTenantId(user.getTenantId()); | |||||
| record.setCUserId(user.getId()); | |||||
| record.setCreateTime(currentDate); | |||||
| record.setUpdateTime(currentDate); | |||||
| record.setPayTimeStart(currentDate); | |||||
| record.setPayTimeEnd(currentDate); | |||||
| // 支付单号 | |||||
| record.setPayOrderNo(payOrderNo); | |||||
| record.setPayAmount(order.getPayment()); | |||||
| record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||||
| record.setPayOrderStatus(EnumPayStatus.PAY_WAY_WAIT.getCode()); | |||||
| record.setId(id); | |||||
| record.setTenantId(user.getTenantId()); | |||||
| record.setCUserId(user.getId()); | |||||
| record.setCreateTime(currentDate); | |||||
| record.setUpdateTime(currentDate); | |||||
| int currentTime = Utility.convertDate2TimeStamp(currentDate); | |||||
| record.setPayTimeStart(currentTime); | |||||
| record.setPayTimeEnd(currentTime); | |||||
| // 支付单号 | |||||
| record.setPayOrderNo(String.valueOf(id)); | |||||
| record.setPayAmount(order.getPayment()); | |||||
| record.setPayVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||||
| record.setPayOrderStatus(EnumPayStatus.PAY_WAY_WAIT.getCode()); | |||||
| int sqlRow = wxPayOrderMapper.insertSelective(record); | |||||
| if(sqlRow != 1) { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| int sqlRow = wxPayOrderMapper.insertSelective(record); | |||||
| if (sqlRow != 1) { | |||||
| logger.error("pay order insert error: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| } else { | |||||
| record = list.get(0); | |||||
| payOrderNo = String.valueOf(record.getId()); | |||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | ||||
| { | |||||
| // 统一下单 | |||||
| String noncestr = Utility.generate32UUID(); | |||||
| WxPayOrderP wxPayOrderP = new WxPayOrderP(); | |||||
| wxPayOrderP.setOpenid(user.getOpenId()); | |||||
| wxPayOrderP.setAppid(user.getAppId()); | |||||
| wxPayOrderP.setMch_id(payAccount.getMchId()); | |||||
| wxPayOrderP.setNonce_str(noncestr); | |||||
| wxPayOrderP.setBody(order.getDetail()); | |||||
| wxPayOrderP.setOut_trade_no(record.getPayOrderNo()); | |||||
| wxPayOrderP.setTotal_fee(order.getPayment()); | |||||
| wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP | |||||
| wxPayOrderP.setNotify_url(payAccount.getPayNotifyUrl()); | |||||
| wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 | |||||
| wxPayOrderP.setProduct_id(String.valueOf(order.getId())); // 订单ID | |||||
| wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentTime)); | |||||
| wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(currentTime + 15 * 60)); // 15分钟结束 | |||||
| wxPayOrderP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxPayOrderP), payAccount.getApiKey())); | |||||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | |||||
| logger.info("pay order, wechat pushOrder, wxPayOrder:" + wxPayOrderP.toString() + ", response: " + response.toString()); | |||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||||
| String result_no = returnMap.get("result_code"); | |||||
| if ("SUCCESS".equals(result_no)) { | |||||
| String prepay_id = returnMap.get("prepay_id"); | |||||
| String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); | |||||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||||
| sighMap.put("appId", returnMap.get("appid")); | |||||
| sighMap.put("timeStamp", timestamp); | |||||
| sighMap.put("nonceStr", noncestr); | |||||
| sighMap.put("package", "prepay_id="+prepay_id); | |||||
| sighMap.put("signType", "MD5"); | |||||
| String signAgent = WxPayment.createSign(sighMap, payAccount.getApiKey()); | |||||
| returnMap.put("timeStamp", timestamp); | |||||
| returnMap.put("nonceStr", noncestr); | |||||
| returnMap.put("package", "prepay_id="+prepay_id); | |||||
| returnMap.put("paySign", signAgent); | |||||
| return new ResultData(200, "创建支付订单成功", returnMap); | |||||
| } else { | |||||
| JSONObject errObj = errorMap.getJSONObject(result_no); | |||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errObj.toJSONString(), returnMap); | |||||
| } | |||||
| // 统一下单 | |||||
| String noncestr = Utility.generate32UUID(); | |||||
| WxPayOrderP wxPayOrderP = new WxPayOrderP(); | |||||
| wxPayOrderP.setOpenid(user.getOpenId()); | |||||
| wxPayOrderP.setAppid(user.getAppId()); | |||||
| wxPayOrderP.setMch_id(payAccount.getMchId()); | |||||
| wxPayOrderP.setNonce_str(noncestr); | |||||
| wxPayOrderP.setBody(order.getDetail()); | |||||
| wxPayOrderP.setOut_trade_no(record.getPayOrderNo()); | |||||
| wxPayOrderP.setTotal_fee(order.getPayment()); | |||||
| wxPayOrderP.setSpbill_create_ip(record.getIp()); // 终端IP | |||||
| wxPayOrderP.setNotify_url(payAccount.getPayNotifyUrl()); | |||||
| wxPayOrderP.setTrade_type(WxPay.TradeType.JSAPI.name()); // 终端类型 | |||||
| wxPayOrderP.setProduct_id(String.valueOf(order.getId())); // 订单ID | |||||
| wxPayOrderP.setTime_start(Utility.getDataFormatStringYYYYMMDDHHmmss(currentDate)); | |||||
| Date futureDate = new Date(); | |||||
| futureDate.setTime(currentDate.getTime() + 15*60*1000); | |||||
| wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | |||||
| wxPayOrderP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxPayOrderP), payAccount.getApiKey())); | |||||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | |||||
| logger.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); | |||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||||
| returnMap.put("payOrderId", payOrderNo); | |||||
| String result_code = returnMap.get("result_code"); | |||||
| if ("SUCCESS".equals(result_code)) { | |||||
| /* | |||||
| Map<String, String> signMap = WxPayment.buildWeappSecondSignMap(returnMap.get("appid"), | |||||
| String.valueOf(Utility.getCurrentTimeStamp()), | |||||
| returnMap.get("prepay_id"), | |||||
| payAccount.getApiKey()); | |||||
| String signAgent = signMap.remove("sign"); | |||||
| returnMap.putAll(signMap); | |||||
| returnMap.put("paySign", signAgent); | |||||
| */ | |||||
| String prepay_id = returnMap.get("prepay_id"); | |||||
| String timestamp = String.valueOf(Utility.getCurrentTimeStamp()); | |||||
| Map<String, String> sighMap = MapUtil.getOrderMap(); | |||||
| sighMap.put("appId", returnMap.get("appid")); | |||||
| sighMap.put("timeStamp", timestamp); | |||||
| sighMap.put("nonceStr", noncestr); | |||||
| sighMap.put("package", "prepay_id=" + prepay_id); | |||||
| sighMap.put("signType", "MD5"); | |||||
| String signAgent = WxPayment.createSign(sighMap, payAccount.getApiKey()); | |||||
| returnMap.put("timeStamp", timestamp); | |||||
| returnMap.put("nonceStr", noncestr); | |||||
| returnMap.put("package", "prepay_id=" + prepay_id); | |||||
| returnMap.put("paySign", signAgent); | |||||
| logger.info("back to UI: " +returnMap.toString()); | |||||
| return new ResultData(Result.SUCCESS, "创建支付订单成功", returnMap); | |||||
| } else { | |||||
| JSONObject errObj = errorMap.getJSONObject(result_code); | |||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errObj.toJSONString(), returnMap); | |||||
| } | } | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | ||||
| @@ -167,8 +186,9 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| /** | /** | ||||
| * 提供微信支付回调调用 | * 提供微信支付回调调用 | ||||
| * @param paramMap 异步通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * | |||||
| * @param paramMap 异步通知参数 | |||||
| * @param payWay 支付方式 | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| @@ -188,16 +208,14 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| try { | try { | ||||
| if (payWay == EnumPayWay.PAY_WAY_WEAPP) { | if (payWay == EnumPayWay.PAY_WAY_WEAPP) { | ||||
| boolean signVerified = false; | boolean signVerified = false; | ||||
| if (payWay == EnumPayWay.PAY_WAY_WECHAT) { | |||||
| // 微信支付 | |||||
| signVerified = WxPayment.verifyNotify(paramMap, partnerKey); | |||||
| } | |||||
| // 微信支付 | |||||
| signVerified = WxPayment.verifyNotify(paramMap, partnerKey); | |||||
| if (!signVerified) { | if (!signVerified) { | ||||
| logger.warn("notify order, wxpay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||||
| logger.warn("notify order, wxpay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | ||||
| } | } | ||||
| if (!"SUCCESS".equals(paramMap.get("return_code"))) { | if (!"SUCCESS".equals(paramMap.get("return_code"))) { | ||||
| logger.warn("notify order, wxpay status not success, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||||
| logger.warn("notify order, wxpay status not success, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||||
| Map<String, String> resultMap = new LinkedHashMap<>(); | Map<String, String> resultMap = new LinkedHashMap<>(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| resultMap.put("return_msg", "订单状态码非SUCCESS"); | resultMap.put("return_msg", "订单状态码非SUCCESS"); | ||||
| @@ -205,34 +223,45 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| String payOrderNo = paramMap.get("out_trade_no"); | String payOrderNo = paramMap.get("out_trade_no"); | ||||
| String timEndStr = paramMap.get("time_end"); | |||||
| Long payOrderId = Long.valueOf(payOrderNo); | Long payOrderId = Long.valueOf(payOrderNo); | ||||
| WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); | WxPayOrder payOrder = wxPayOrderMapper.selectByPrimaryKey(payOrderId); | ||||
| if (payOrder == null) { | if (payOrder == null) { | ||||
| logger.warn("notify order, wxpay check pay order not exists, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||||
| logger.warn("notify order, wxpay check pay order not exists, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||||
| Map<String, String> resultMap = new LinkedHashMap<>(); | Map<String, String> resultMap = new LinkedHashMap<>(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| resultMap.put("return_msg", "订单不存在"); | resultMap.put("return_msg", "订单不存在"); | ||||
| return XmlUtil.parseDto2Xml(resultMap, ""); | return XmlUtil.parseDto2Xml(resultMap, ""); | ||||
| } | } | ||||
| // 验证支付金额 | // 验证支付金额 | ||||
| if(!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { | |||||
| logger.warn("notify order, wxpay check total_fee is invalid, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||||
| if (!paramMap.get("total_fee").equals(payOrder.getPayAmount().toString())) { | |||||
| logger.warn("notify order, wxpay check total_fee is invalid, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||||
| Map<String, String> resultMap = new LinkedHashMap<>(); | Map<String, String> resultMap = new LinkedHashMap<>(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| resultMap.put("return_msg", "订单总金额不一致"); | resultMap.put("return_msg", "订单总金额不一致"); | ||||
| return XmlUtil.parseDto2Xml(resultMap, ""); | return XmlUtil.parseDto2Xml(resultMap, ""); | ||||
| } | } | ||||
| Date timeEnd = null; | |||||
| try { | |||||
| timeEnd = Utility.getDateFromString(timEndStr); | |||||
| } catch (ParseException e) { | |||||
| logger.error("解析timeEnd失败"); | |||||
| timeEnd = new Date(); | |||||
| } | |||||
| payOrder.setPayTimeEnd(timeEnd); | |||||
| // 处理支付成功 | // 处理支付成功 | ||||
| handleOrderPaySuccess(payOrder, paramMap.get("transaction_id")); | handleOrderPaySuccess(payOrder, paramMap.get("transaction_id")); | ||||
| logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString()); | |||||
| logger.info("notify order, wxpay checksign success, paramMap:{}, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString()); | |||||
| Map<String, String> resultMap = new LinkedHashMap<>(); | Map<String, String> resultMap = new LinkedHashMap<>(); | ||||
| resultMap.put("return_code", "SUCCESS"); | resultMap.put("return_code", "SUCCESS"); | ||||
| resultMap.put("return_msg", "OK"); | resultMap.put("return_msg", "OK"); | ||||
| return XmlUtil.parseDto2Xml(resultMap, ""); | return XmlUtil.parseDto2Xml(resultMap, ""); | ||||
| } | } | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| logger.warn("notify order, alipay checksign error, paramMap: "+paramMap.toString()+ ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||||
| logger.warn("notify order, alipay checksign error, paramMap: " + paramMap.toString() + ", payWay:" + payWay.toString() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_NOTIFY_CHECK_SIGN_ERROR); | ||||
| } | } | ||||
| return ""; | return ""; | ||||
| @@ -246,8 +275,21 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void handleOrderPaySuccess(WxPayOrder record, String transactionId) { | public void handleOrderPaySuccess(WxPayOrder record, String transactionId) { | ||||
| Date currentDate = new Date(); | |||||
| EnumPayStatus payStatus = EnumPayStatus.getEnum(record.getPayOrderStatus()); | EnumPayStatus payStatus = EnumPayStatus.getEnum(record.getPayOrderStatus()); | ||||
| // 判断支付状态 | // 判断支付状态 | ||||
| if (payStatus == EnumPayStatus.PAY_WAY_SUCCESS) { | |||||
| // 已经是成功状态,只更新transactionId | |||||
| try { | |||||
| record.setUpdateTime(currentDate); | |||||
| record.setTransactionId(transactionId); | |||||
| wxPayOrderMapper.updateByPrimaryKeySelective(record); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| return; | |||||
| } | |||||
| if (payStatus != EnumPayStatus.PAY_WAY_WAIT) { | if (payStatus != EnumPayStatus.PAY_WAY_WAIT) { | ||||
| logger.error("pay success handle, payOrder " + record.getPayOrderNo() + | logger.error("pay success handle, payOrder " + record.getPayOrderNo() + | ||||
| "is paid success , orderId : " + record.getOrderId()); | "is paid success , orderId : " + record.getOrderId()); | ||||
| @@ -255,20 +297,20 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | ||||
| if (order == null) { | if (order == null) { | ||||
| logger.error("pay success handle, order " + record.getOrderId() +" not found , payOrderGid : " + record.getPayOrderNo()); | |||||
| logger.error("pay success handle, order " + record.getOrderId() + " not found , payOrderGid : " + record.getPayOrderNo()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| Date currentDate = new Date(); | |||||
| // 修改支付订单状态 | // 修改支付订单状态 | ||||
| try { | try { | ||||
| WxPayOrder updatePayOrder = new WxPayOrder(); | |||||
| updatePayOrder.setId(record.getId()); | |||||
| updatePayOrder.setOrderId(record.getOrderId()); | |||||
| updatePayOrder.setUpdateTime(currentDate); | |||||
| updatePayOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | |||||
| updatePayOrder.setTransactionId(transactionId); | |||||
| wxPayOrderMapper.updateByPrimaryKeySelective(updatePayOrder); | |||||
| WxPayOrder updateOrder = new WxPayOrder(); | |||||
| updateOrder.setId(record.getId()); | |||||
| updateOrder.setOrderId(record.getOrderId()); | |||||
| updateOrder.setUpdateTime(currentDate); | |||||
| updateOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | |||||
| updateOrder.setTransactionId(transactionId); | |||||
| wxPayOrderMapper.updateByPrimaryKeySelective(updateOrder); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| @@ -297,6 +339,68 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| */ | */ | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| public void handlePayOrderStatusUpdate(WxPayOrder record) { | |||||
| // 判断支付状态 | |||||
| if (record.getPayOrderStatus() == EnumPayStatus.PAY_WAY_WAIT.getCode()) { | |||||
| logger.error("pay handle, payOrder " + record.getPayOrderNo() + | |||||
| "is complete, orderId : " + record.getOrderId()); | |||||
| return; | |||||
| } | |||||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(record.getOrderId()); | |||||
| if (order == null) { | |||||
| logger.error("pay handle, order " + record.getOrderId() + " not found , payOrderGid : " + record.getPayOrderNo()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | |||||
| } | |||||
| Date currentDate = new Date(); | |||||
| // 修改支付订单状态 | |||||
| try { | |||||
| WxPayOrder updateOrder = new WxPayOrder(); | |||||
| updateOrder.setId(record.getId()); | |||||
| updateOrder.setOrderId(record.getOrderId()); | |||||
| updateOrder.setUpdateTime(currentDate); | |||||
| updateOrder.setPayOrderStatus(record.getPayOrderStatus()); | |||||
| updateOrder.setPayTimeEnd(currentDate); | |||||
| updateOrder.setFailReason(record.getFailReason()); | |||||
| wxPayOrderMapper.updateByPrimaryKeySelective(updateOrder); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| // 修改订单状态 | |||||
| if (record.getPayOrderStatus() == EnumPayStatus.PAY_WAY_SUCCESS.getCode()) { | |||||
| try { | |||||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| } else if (record.getPayOrderStatus() == EnumPayStatus.PAY_WAY_CANCEL.getCode()) { | |||||
| try { | |||||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||||
| } | |||||
| } | |||||
| /* | |||||
| Map<String, String> msgMap = new HashMap<>(); | |||||
| try { | |||||
| msgMap.put("name", String.valueOf(order.getCouponId())); | |||||
| msgMap.put("orderNo", String.valueOf(order.getId())); | |||||
| msgMap.put("createTime", Utility.getDataFormatString3(order.getCreateDate())); | |||||
| msgMap.put("standingTime", order.getCreateDate() + "-" + currentDate ); | |||||
| // 短信 通知 商户 | |||||
| //smsSenderHandler.sendSms("SMS_18195394", order.getMobile(), msgMap); | |||||
| } catch (Exception e) { | |||||
| logger.error("pay success handle, sms send exception, payOrderi: " + updatePayOrder+ ", msgMap: " + msgMap.toString() + ", e: " + e.getMessage()); | |||||
| } | |||||
| */ | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxPayOrder> listAsPage(WxPayOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxPayOrder> listAsPage(WxPayOrder record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -312,8 +416,8 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| public void saveOrUpdate(WxPayOrder record) { | public void saveOrUpdate(WxPayOrder record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxPayOrderMapper.insertSelective(record); | wxPayOrderMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| wxPayOrderMapper.updateByPrimaryKeySelective(record); | wxPayOrderMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -324,12 +428,6 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxPayOrderMapper.deleteByPrimaryKey(id); | wxPayOrderMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,214 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.*; | |||||
| import com.simple.enums.EnumPayDomain; | |||||
| import com.simple.enums.EnumProfitSharingReceiverType; | |||||
| import com.simple.enums.EnumProfitSharingStatus; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.mapper.*; | |||||
| import com.simple.pay.WxPayment; | |||||
| import com.simple.pay.WxProfitSharing; | |||||
| import com.simple.pay.WxProfitSharingP; | |||||
| import com.simple.service.WxProfitSharingOrderService; | |||||
| import com.simple.utils.BeanUtils; | |||||
| import com.simple.utils.Utility; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderService { | |||||
| @Autowired | |||||
| WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | |||||
| @Autowired | |||||
| WxAppinfoMapper wxAppinfoMapper; | |||||
| @Autowired | |||||
| WxPayAccountMapper wxPayAccountMapper; | |||||
| @Autowired | |||||
| WxOrderMapper wxOrderMapper; | |||||
| @Autowired | |||||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||||
| @Autowired | |||||
| WxProfitSharingResultMapper wxProfitSharingResultMapper; | |||||
| final JSONObject errorMap = JSON.parseObject( | |||||
| "{\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + | |||||
| "\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + | |||||
| "\"RECEIVER_INVALID\":{\"detail\":\"分账接收方非法 \",\"reason\":\"未配置分账接收方\",\"resolution\":\"分账接收方在分账之前需要进行添加\"}," + | |||||
| "\"INVALID_TRANSACTIONID\":{\"detail\":\"无效的微信支付订单号\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"检查原交易单号是否存在\"}," + | |||||
| "\"PARAM_ERROR\":{\"detail\":\"参数错误\t\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"请求参数错误,请重新检查再调用分账接口\"}," + | |||||
| "\"INVALID_REQUEST\":{\"detail\":\"请求不合法\",\"reason\":\"参数中APPID或MCHID不存在等 \",\"resolution\":\"请重新检查再调用分账接口\"}," + | |||||
| "\"OPENID_MISMATCH\":{\"detail\":\"Openid错误\",\"reason\":\"Openid与Appid不匹配\",\"resolution\":\"请检查openid是否正确\"}," + | |||||
| "\"FREQUENCY_LIMITED\":{\"detail\":\"频率限制\",\"reason\":\"请求过多被频率限制\",\"resolution\":\"该被请求未受理,请降低频率后原单重试,请勿更换商户分账单号\"}," + | |||||
| "\"ORDER_NOT_READY\":{\"detail\":\"订单处理中\",\"reason\":\"订单处理中暂时无法分账\",\"resolution\":\"订单处理中暂时无法分账,请稍后再试\"}," + | |||||
| "\"NOAUTH \":{\"detail\":\"无分账权限\",\"reason\":\"未开通分账权限\",\"resolution\":\"请先开通分账权限\"}," + | |||||
| "\"NOT_SHARE_ORDER\":{\"detail\":\"非分账订单\t\",\"reason\":\"不是分账订单,无法分账\",\"resolution\":\"下单时请用合适的参数\"}}"); | |||||
| @Override | |||||
| public PageInfo<WxProfitSharingOrder> listAsPage(WxProfitSharingOrder record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingOrderMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxProfitSharingOrder getById(Long id) { | |||||
| return wxProfitSharingOrderMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxProfitSharingOrder record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxProfitSharingOrderMapper.insertSelective(record); | |||||
| } else { | |||||
| wxProfitSharingOrderMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxProfitSharingOrderMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Autowired | |||||
| WxPayOrderMapper wxPayOrderMapper; | |||||
| @Override | |||||
| public void test() { | |||||
| createSharingOrder(wxAppinfoMapper.selectByPrimaryKey(new Long(1L)),wxPayOrderMapper.selectByPrimaryKey(new Long(190403470006681600L))); | |||||
| } | |||||
| @Override | |||||
| public ResultData createSharingOrder(WxAppinfo subAppInfo, WxPayOrder wxPayOrder) { | |||||
| final IdWorker idworker = IdWorker.get(); | |||||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | |||||
| try { | |||||
| WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); | |||||
| //是否已创建分账订单 | |||||
| record.setOrderId(wxPayOrder.getId().toString()); | |||||
| record = wxProfitSharingOrderMapper.selectOne(record); | |||||
| if (record == null) { | |||||
| //创建分账订单 | |||||
| Date currentDate = new Date(); | |||||
| record = new WxProfitSharingOrder(); | |||||
| record.setId(idworker.nextId()); | |||||
| record.setTenantId(wxPayOrder.getTenantId()); | |||||
| record.setTransactionId(wxPayOrder.getTransactionId()); | |||||
| record.setOrderId(wxPayOrder.getId().toString()); | |||||
| record.setPayAmount(wxPayOrder.getPayAmount()); | |||||
| record.setMerchantId(wxOrder.getMerchantId().toString()); | |||||
| record.setCreateTime(currentDate); | |||||
| record.setUpdateTime(currentDate); | |||||
| record.setPayTimeStart(currentDate); | |||||
| record.setPayTimeEnd(currentDate); | |||||
| wxProfitSharingOrderMapper.insertSelective(record); | |||||
| } | |||||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); | |||||
| //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); | |||||
| //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); | |||||
| //分账提交 | |||||
| WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); | |||||
| //wxProfitSharingP.setAppid(mainAppInfo.getAppId()); | |||||
| //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); | |||||
| wxProfitSharingP.setAppid(subAppInfo.getAppId()); | |||||
| wxProfitSharingP.setMch_id(payAccount.getMchId()); | |||||
| wxProfitSharingP.setSub_appid(subAppInfo.getAppId()); | |||||
| wxProfitSharingP.setSub_mch_id(payAccount.getMchId()); | |||||
| wxProfitSharingP.setNonce_str(Utility.generate32UUID()); | |||||
| wxProfitSharingP.setTransaction_id(wxPayOrder.getTransactionId()); | |||||
| wxProfitSharingP.setOut_trade_no(record.getId().toString()); | |||||
| //添加分账接受方 | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | |||||
| wxProfitSharingReceiver.setMerchantId(wxOrder.getMerchantId().toString()); | |||||
| wxProfitSharingReceiver.setSharingType(1); | |||||
| List<WxProfitSharingReceiver> wxProfitSharingReceiverList = wxProfitSharingReceiverMapper.findList(wxProfitSharingReceiver); | |||||
| if (wxProfitSharingReceiverList.size()<=0 || wxProfitSharingReceiverList.size() > 50) { | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getMessage()); | |||||
| } | |||||
| JSONArray receivers = new JSONArray(); | |||||
| List <WxProfitSharingResult> resultList = new ArrayList<WxProfitSharingResult>(); | |||||
| for (int i=0;i<wxProfitSharingReceiverList.size();i++){ | |||||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverList.get(i); | |||||
| Date currentDate = new Date(); | |||||
| JSONObject jo = new JSONObject(); | |||||
| jo.put("type",EnumProfitSharingReceiverType.getEnum(receiver.getReceiverType()).getMessage()); | |||||
| jo.put("acount",receiver.getReceiverAccount()); | |||||
| jo.put("amount",record.getPayAmount()); //temp: sharing all money with only owner | |||||
| jo.put("description",receiver.getReceiverComments()); | |||||
| receivers.add(jo); | |||||
| WxProfitSharingResult result = new WxProfitSharingResult(); | |||||
| result.setId(idworker.nextId()); | |||||
| result.setSharingOrderId(record.getSharingOrderId()); | |||||
| result.setSharingReceiverId(receiver.getId().toString()); | |||||
| result.setCreateTime(currentDate); | |||||
| result.setUpdateTime(currentDate); | |||||
| resultList.add(result); | |||||
| } | |||||
| wxProfitSharingP.setReceivers(receivers.toJSONString()); | |||||
| wxProfitSharingP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingP), payAccount.getApiKey())); | |||||
| String response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingP)); | |||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||||
| String return_code = returnMap.get("return_code"); | |||||
| if (!"SUCCESS".equals(return_code)) { | |||||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_REQ_FAILED.getCode()); | |||||
| record.setUpdateTime(new Date()); | |||||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); | |||||
| } | |||||
| if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ | |||||
| return new ResultData(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); | |||||
| } | |||||
| String result_code = returnMap.get("result_code"); | |||||
| if (!"SUCCESS".equals(result_code)) { | |||||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | |||||
| record.setUpdateTime(new Date()); | |||||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||||
| return new ResultData(ErrorCode.PROFIT_SHARING_APPLY_FAILED.getCode(), returnMap.get("result_msg")); | |||||
| } | |||||
| record.setSharingOrderId(returnMap.get("order_id")); | |||||
| record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||||
| record.setUpdateTime(new Date()); | |||||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | |||||
| wxProfitSharingResultMapper.insertList(resultList); | |||||
| return new ResultData(returnMap); | |||||
| } catch (RuntimeException e) { | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,54 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxProfitSharingReceiver; | |||||
| import com.simple.mapper.WxProfitSharingReceiverMapper; | |||||
| import com.simple.service.WxProfitSharingReceiverService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiverService { | |||||
| @Autowired | |||||
| WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; | |||||
| @Override | |||||
| public PageInfo<WxProfitSharingReceiver> listAsPage(WxProfitSharingReceiver record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxProfitSharingReceiver getById(Long id) { | |||||
| return wxProfitSharingReceiverMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxProfitSharingReceiver record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxProfitSharingReceiverMapper.insertSelective(record); | |||||
| } else { | |||||
| wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxProfitSharingReceiverMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,54 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxProfitSharingResult; | |||||
| import com.simple.mapper.WxProfitSharingResultMapper; | |||||
| import com.simple.service.WxProfitSharingResultService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxProfitSharingResultServiceImpl implements WxProfitSharingResultService { | |||||
| @Autowired | |||||
| WxProfitSharingResultMapper wxProfitSharingResultMapper; | |||||
| @Override | |||||
| public PageInfo<WxProfitSharingResult> listAsPage(WxProfitSharingResult record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingResultMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxProfitSharingResult getById(Long id) { | |||||
| return wxProfitSharingResultMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxProfitSharingResult record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxProfitSharingResultMapper.insertSelective(record); | |||||
| } else { | |||||
| wxProfitSharingResultMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxProfitSharingResultMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| 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.EnumOrderStatus; | import com.simple.enums.EnumOrderStatus; | ||||
| @@ -18,10 +19,12 @@ import com.simple.mapper.*; | |||||
| import com.simple.pay.WxPay; | import com.simple.pay.WxPay; | ||||
| import com.simple.pay.WxPayment; | import com.simple.pay.WxPayment; | ||||
| import com.simple.pay.WxRefundOrderP; | import com.simple.pay.WxRefundOrderP; | ||||
| import com.simple.service.WxOrderService; | |||||
| import com.simple.service.WxRefundOrderService; | import com.simple.service.WxRefundOrderService; | ||||
| import com.simple.utils.BeanUtils; | import com.simple.utils.BeanUtils; | ||||
| import com.simple.utils.Utility; | import com.simple.utils.Utility; | ||||
| import com.simple.utils.XmlUtil; | import com.simple.utils.XmlUtil; | ||||
| import org.apache.commons.lang.StringUtils; | |||||
| 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.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| @@ -48,6 +51,9 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountMapper wxPayAccountMapper; | WxPayAccountMapper wxPayAccountMapper; | ||||
| @Autowired | |||||
| WxOrderService wxOrderService; | |||||
| JSONObject errorRefundReqMap = JSON.parseObject("{\n" + | JSONObject errorRefundReqMap = JSON.parseObject("{\n" + | ||||
| " \"SYSTEMERROR\": {\n" + | " \"SYSTEMERROR\": {\n" + | ||||
| " \"detail\": \"接口返回错误\",\n" + | " \"detail\": \"接口返回错误\",\n" + | ||||
| @@ -206,33 +212,51 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| @Override | @Override | ||||
| public ResultData createRefundOrder(WxAppinfo appInfo, WxRefundOrder record, EnumPayWay payWay) { | public ResultData createRefundOrder(WxAppinfo appInfo, WxRefundOrder record, EnumPayWay payWay) { | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||||
| if (StringUtils.isBlank(payAccount.getApiKey())) { | |||||
| logger.error("支付密钥为空"); | |||||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND.getCode(), "支付密钥为空,请联系商城管理员"); | |||||
| } | |||||
| if (StringUtils.isBlank(payAccount.getCertPath())) { | |||||
| logger.error("证书路径为空"); | |||||
| throw new MallinkException(ErrorCode.CERT_PATH_NOT_FOUND.getCode(), "证书路径为空,请联系商城管理员"); | |||||
| } | |||||
| // check 是否有退款订单 | // check 是否有退款订单 | ||||
| List<WxRefundOrder> list = wxRefundOrderMapper.findList(record); | List<WxRefundOrder> list = wxRefundOrderMapper.findList(record); | ||||
| if (list.size() > 0) { | if (list.size() > 0) { | ||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST); | |||||
| logger.error("退款订单已存在, 无法再提交退款申请"); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_EXIST.getCode(), "退款订单已存在, 无法再提交退款申请"); | |||||
| } | } | ||||
| // check 支付 订单 | // check 支付 订单 | ||||
| WxPayOrder payOrder = null; | WxPayOrder payOrder = null; | ||||
| Long payOrderId = 0L; | |||||
| try { | |||||
| payOrderId = Long.valueOf(record.getPayOrderNo()); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("参数转换异常: payOrderId-" + record.getPayOrderNo()); | |||||
| throw new MallinkException(ErrorCode.PARAMETER_CAST_ERROR.getCode(), "参数转换异常: payOrderId-" + record.getPayOrderNo()); | |||||
| } | |||||
| try { | try { | ||||
| WxPayOrder payOrderQ = new WxPayOrder(); | WxPayOrder payOrderQ = new WxPayOrder(); | ||||
| payOrderQ.setOrderId(record.getOrderId()); | payOrderQ.setOrderId(record.getOrderId()); | ||||
| payOrderQ.setId(Long.valueOf(record.getPayOrderNo())); | |||||
| payOrderQ.setId(payOrderId); | |||||
| payOrderQ.setPayOrderNo(record.getPayOrderNo()); | payOrderQ.setPayOrderNo(record.getPayOrderNo()); | ||||
| payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | payOrderQ.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | ||||
| payOrder = wxPayOrderMapper.selectOne(payOrderQ); | payOrder = wxPayOrderMapper.selectOne(payOrderQ); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("数据库获取异常: " + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| if (payOrder == null) { | if (payOrder == null) { | ||||
| logger.error("支付订单不存在: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_NOT_EXIST); | throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_NOT_EXIST); | ||||
| } | } | ||||
| if (payOrder.getPayAmount() <= 0) { | if (payOrder.getPayAmount() <= 0) { | ||||
| throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_NOT_EXIST); | |||||
| logger.error("支付订单金额小于等于0: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.REFUND_PAY_ORDER_IS_ZERO); | |||||
| } | } | ||||
| // TODO check 可退券???? | |||||
| // 创建退款订单 | // 创建退款订单 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| Long id = idWorker.nextId(); | Long id = idWorker.nextId(); | ||||
| @@ -247,55 +271,75 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| record.setCUserId(payOrder.getCUserId()); | record.setCUserId(payOrder.getCUserId()); | ||||
| record.setTotalFee(payOrder.getPayAmount()); | record.setTotalFee(payOrder.getPayAmount()); | ||||
| record.setRefundFee(payOrder.getPayAmount()); | record.setRefundFee(payOrder.getPayAmount()); | ||||
| record.setRefundTimeStart((int)(currentDate.getTime()/1000)); | |||||
| record.setRefundTimeStart(currentDate); | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_WAIT.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_WAIT.getCode()); | ||||
| int sqlRow = wxRefundOrderMapper.insertSelective(record); | int sqlRow = wxRefundOrderMapper.insertSelective(record); | ||||
| if(sqlRow != 1) { | if(sqlRow != 1) { | ||||
| logger.error("退款订单数据库插入出错: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("退款订单数据库插入出错: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | |||||
| // 退款申请 | // 退款申请 | ||||
| try { | |||||
| String noncestr = Utility.generate32UUID(); | |||||
| WxRefundOrderP wxRefundOrderP = new WxRefundOrderP(); | |||||
| wxRefundOrderP.setAppid(appInfo.getAppId()); | |||||
| wxRefundOrderP.setMch_id(payAccount.getMchId()); | |||||
| wxRefundOrderP.setNonce_str(noncestr); | |||||
| String noncestr = Utility.generate32UUID(); | |||||
| WxRefundOrderP wxRefundOrderP = new WxRefundOrderP(); | |||||
| wxRefundOrderP.setAppid(appInfo.getAppId()); | |||||
| wxRefundOrderP.setMch_id(payAccount.getMchId()); | |||||
| wxRefundOrderP.setNonce_str(noncestr); | |||||
| if (record.getTransactionId() == null) | |||||
| wxRefundOrderP.setTransaction_id(record.getTransactionId()); | wxRefundOrderP.setTransaction_id(record.getTransactionId()); | ||||
| wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); | |||||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||||
| wxRefundOrderP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxRefundOrderP), payAccount.getApiKey())); | |||||
| String response = WxPay.orderRefund(BeanUtils.toStringMap(wxRefundOrderP), payAccount.getCertPath(), payAccount.getApiKey()); | |||||
| logger.info("微信退款订单:" + wxRefundOrderP.toString() + ", response: " + response.toString()); | |||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||||
| String result_no = returnMap.get("result_code"); | |||||
| if ("SUCCESS".equals(result_no)) { | |||||
| String refund_id = returnMap.get("refund_id"); | |||||
| record.setRefundId(refund_id); | |||||
| wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); | |||||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | |||||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | |||||
| Map signMap = new HashMap(); | |||||
| try { | |||||
| signMap = BeanUtils.toStringMap(wxRefundOrderP); | |||||
| } catch (Exception e) { | |||||
| logger.error("退款签名异常"); | |||||
| throw new MallinkException(ErrorCode.PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); | |||||
| } | |||||
| String signAgent = WxPayment.createSign(signMap, payAccount.getApiKey()); | |||||
| signMap.put("sign", signAgent); | |||||
| String response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getApiKey()); | |||||
| logger.info("微信退款订单:" + wxRefundOrderP.toString() + ", response: " + response.toString()); | |||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | |||||
| String result_no = returnMap.get("result_code"); | |||||
| String refund_id = returnMap.get("refund_id"); | |||||
| // 设置 微信退款订单号 | |||||
| record.setRefundId(refund_id); | |||||
| if ("SUCCESS".equals(result_no)) { | |||||
| logger.error("微信退款订单申请成功: " + returnMap.toString()); | |||||
| try { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_SUCCESS.getCode()); | ||||
| wxRefundOrderMapper.updateByPrimaryKey(record); | wxRefundOrderMapper.updateByPrimaryKey(record); | ||||
| return new ResultData(200, "退款订单申请成功", returnMap); | |||||
| } else { | |||||
| String refund_id = returnMap.get("refund_id"); | |||||
| record.setRefundId(refund_id); | |||||
| return new ResultData(Result.SUCCESS, "退款订单申请成功", returnMap); | |||||
| } catch (Exception e) { | |||||
| logger.error("微信退款订单更新入库出错: " + e.getMessage() + ", record: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||||
| } | |||||
| } else { | |||||
| logger.error("微信退款订单申请失败: " + returnMap.toString()); | |||||
| try { | |||||
| record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | record.setRefundOrderStatus(EnumRefundStatus.REFUND_REQ_FAIL.getCode()); | ||||
| wxRefundOrderMapper.updateByPrimaryKey(record); | wxRefundOrderMapper.updateByPrimaryKey(record); | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errObj.toJSONString(), returnMap); | return new ResultData(ErrorCode.PAY_ORDER_ERROR.getCode(), errObj.toJSONString(), returnMap); | ||||
| } catch(Exception e) { | |||||
| logger.error("微信退款订单更新入库出错: " + e.getMessage() + ", record: " + record.toString()); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||||
| } | } | ||||
| } catch(Exception e) { | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR); | |||||
| } | } | ||||
| } | } | ||||
| // TODO | |||||
| // 微信退款查询 | |||||
| /** | |||||
| * 微信退款查询 | |||||
| * @param appInfo | |||||
| * @param record | |||||
| */ | |||||
| @Override | @Override | ||||
| public ResultData queryRefundOrder(WxAppinfo appInfo, WxRefundOrder record) { | public ResultData queryRefundOrder(WxAppinfo appInfo, WxRefundOrder record) { | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); | ||||
| @@ -307,7 +351,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| String result_no = returnMap.get("result_code"); | String result_no = returnMap.get("result_code"); | ||||
| if ("SUCCESS".equals(result_no)) { | if ("SUCCESS".equals(result_no)) { | ||||
| String refund_id = returnMap.get("refund_id"); | String refund_id = returnMap.get("refund_id"); | ||||
| return new ResultData(200, "退款", returnMap); | |||||
| return new ResultData(Result.SUCCESS, "退款", returnMap); | |||||
| } else { | } else { | ||||
| wxRefundOrderMapper.updateByPrimaryKey(record); | wxRefundOrderMapper.updateByPrimaryKey(record); | ||||
| JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | JSONObject errObj = errorRefundReqMap.getJSONObject(result_no); | ||||
| @@ -433,23 +477,24 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| "is paid success , orderId : " + refundOrder.getOrderId()); | "is paid success , orderId : " + refundOrder.getOrderId()); | ||||
| return; | return; | ||||
| } | } | ||||
| /* | |||||
| WxOrder order = wxRefundOrderMapper.selectByPrimaryKey(record.getOrderId()); | |||||
| WxOrder order = wxOrderMapper.selectByPrimaryKey(refundOrder.getOrderId()); | |||||
| if (order == null) { | if (order == null) { | ||||
| logger.error("pay success handle, order " + record.getOrderId() +" not found , payOrderGid : " + record.getPayOrderNo()); | |||||
| logger.error("pay success handle, order " + refundOrder.getOrderId() +" not found , refundId : " + refundOrder.getId()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| // 修改支付订单状态 | |||||
| // 修改退款订单状态 | |||||
| try { | try { | ||||
| WxPayOrder updatePayOrder = new WxPayOrder(); | |||||
| updatePayOrder.setId(record.getId()); | |||||
| updatePayOrder.setOrderId(record.getOrderId()); | |||||
| updatePayOrder.setUpdateTime(currentDate); | |||||
| updatePayOrder.setPayOrderStatus(EnumPayStatus.PAY_WAY_SUCCESS.getCode()); | |||||
| updatePayOrder.setTransactionId(transactionId); | |||||
| wxPayOrderMapper.updateByPrimaryKeySelective(updatePayOrder); | |||||
| WxRefundOrder updateOrder = new WxRefundOrder(); | |||||
| updateOrder.setId(refundOrder.getId()); | |||||
| updateOrder.setOrderId(refundOrder.getOrderId()); | |||||
| updateOrder.setUpdateTime(currentDate); | |||||
| updateOrder.setRefundOrderStatus(EnumRefundStatus.REFUND_SUCCESS.getCode()); | |||||
| updateOrder.setTransactionId(transactionId); | |||||
| updateOrder.setRefundId(refundId); | |||||
| wxRefundOrderMapper.updateByPrimaryKeySelective(updateOrder); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| @@ -457,12 +502,11 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| // 修改订单状态 | // 修改订单状态 | ||||
| try { | try { | ||||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS); | |||||
| wxOrderService.updateOrderStatus(order.getId(), EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| */ | |||||
| /* | /* | ||||
| Map<String, String> msgMap = new HashMap<>(); | Map<String, String> msgMap = new HashMap<>(); | ||||
| try { | try { | ||||
| @@ -526,6 +526,16 @@ public final class Utility { | |||||
| return sf.format(((long) currentSec) * 1000); | return sf.format(((long) currentSec) * 1000); | ||||
| } | } | ||||
| public static String getDataFormatStringYYYYMMDDHHmmss(Date currentDate) { | |||||
| SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss"); | |||||
| return sf.format(currentDate); | |||||
| } | |||||
| public static Date getDateFromString(String timeEnd) throws ParseException { | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | |||||
| return sdf.parse(timeEnd); | |||||
| } | |||||
| public static String getOrderNo() { | public static String getOrderNo() { | ||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
| String dateStr = sdf.format(new Date()); | String dateStr = sdf.format(new Date()); | ||||
| @@ -1,7 +1,7 @@ | |||||
| <?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.WxCUserCarsMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserCars"> | |||||
| <mapper namespace="com.simple.mapper.WxCUserCarMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserCar"> | |||||
| <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="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| @@ -67,14 +67,9 @@ | |||||
| <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.WxCUserCars" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_c_user_cars | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCUserCar" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_c_user_car | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -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> | ||||
| @@ -327,6 +327,145 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <sql id="findCanSendConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != coverImg "> | |||||
| and `cover_img` like concat('%', #{coverImg},'%') | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != subTitle "> | |||||
| and `sub_title` like concat('%', #{subTitle},'%') | |||||
| </if> | |||||
| <if test=" null != salePrice "> | |||||
| and `sale_price` = #{salePrice} | |||||
| </if> | |||||
| <if test=" null != usePrice "> | |||||
| and `use_price` = #{usePrice} | |||||
| </if> | |||||
| <if test=" null != useLimitQuantity "> | |||||
| and `use_limit_quantity` = #{useLimitQuantity} | |||||
| </if> | |||||
| <if test=" null != targetAd "> | |||||
| and `target_ad` = #{targetAd} | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| and `send_end_date` >= NOW() | |||||
| and `send_start_date` <= NOW() | |||||
| <if test=" null != validType "> | |||||
| and `valid_type` = #{validType} | |||||
| </if> | |||||
| <if test=" null != validStartDate "> | |||||
| and `valid_start_date` = #{validStartDate} | |||||
| </if> | |||||
| <if test=" null != validEndDate "> | |||||
| and `valid_end_date` = #{validEndDate} | |||||
| </if> | |||||
| <if test=" null != validDays "> | |||||
| and `valid_days` = #{validDays} | |||||
| </if> | |||||
| <if test=" null != detail "> | |||||
| and `detail` like concat('%', #{detail},'%') | |||||
| </if> | |||||
| <if test=" null != price "> | |||||
| and `price` = #{price} | |||||
| </if> | |||||
| <if test=" null != remainInventory "> | |||||
| and `remain_inventory` = #{remainInventory} | |||||
| </if> | |||||
| <if test=" null != inventory "> | |||||
| and `inventory` = #{inventory} | |||||
| </if> | |||||
| <if test=" null != remark "> | |||||
| and `remark` like concat('%', #{remark},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` in (0,1,2) | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != business "> | |||||
| and `business` like concat('%', #{business},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon | select <include refid="allColumns" /> from wx_coupon | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| @@ -337,6 +476,13 @@ | |||||
| <include refid="findEnableConditions" /> | <include refid="findEnableConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCanSendList" parameterType="com.simple.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon | |||||
| <include refid="findCanSendConditions" /> | |||||
| </select> | |||||
| @@ -90,9 +90,4 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -9,78 +9,100 @@ | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | <result column="type" jdbcType="INTEGER" property="type" /> | ||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | <result column="title" jdbcType="VARCHAR" property="title" /> | ||||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | <result column="send_type" jdbcType="INTEGER" property="sendType" /> | ||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="send_start_time" jdbcType="TIMESTAMP" property="sendStartTime" /> | |||||
| <result column="send_end_time" jdbcType="TIMESTAMP" property="sendEndTime" /> | |||||
| <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" /> | ||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`merchant_id`,`coupon_id`,`type`,`title`,`send_type`,`create_date`,`update_date` | |||||
| `id`,`tenant_id`,`merchant_id`,`coupon_id`,`type`,`title`,`send_type`,`status`,`send_start_time`,`send_end_time`,`create_date`,`update_date` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and `coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and `coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != title "> | |||||
| and `title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != sendType "> | |||||
| and `send_type` = #{sendType} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != sendStartTime "> | |||||
| and `send_start_time` = #{sendStartTime} | |||||
| </if> | |||||
| <if test=" null != sendEndTime "> | |||||
| and `send_end_time` = #{sendEndTime} | |||||
| </if> | |||||
| <if test=" null != status and status==0"> | |||||
| and `send_end_time` >= NOW() | |||||
| and `send_start_time` <= NOW() | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </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=")"> | ||||
| #{idItem} | |||||
| #{idItem} | |||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| </if> | |||||
| <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.WxCouponSend" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.simple.domain.po.WxCouponSend" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_coupon_send | select <include refid="allColumns" /> from wx_coupon_send | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -6,6 +6,7 @@ | |||||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber" /> | <result column="order_number" jdbcType="BIGINT" property="orderNumber" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | ||||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType" /> | <result column="payment_type" jdbcType="INTEGER" property="paymentType" /> | ||||
| <result column="payment" jdbcType="INTEGER" property="payment" /> | <result column="payment" jdbcType="INTEGER" property="payment" /> | ||||
| @@ -17,7 +18,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`merchant_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -43,6 +44,11 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != bUserId "> | <if test=" null != bUserId "> | ||||
| and `b_user_id` = #{bUserId} | and `b_user_id` = #{bUserId} | ||||
| @@ -98,13 +104,15 @@ | |||||
| <select id="queryListMap" parameterType="com.simple.domain.vo.OrderVo" resultType="hashmap"> | <select id="queryListMap" parameterType="com.simple.domain.vo.OrderVo" resultType="hashmap"> | ||||
| select o.id, o.coupon_id, c.title, v.verification_date, | |||||
| o.c_user_id, u.phone, u.nick_name, c.price, c.sale_price, | |||||
| o.status, o.coupon_status | |||||
| select o.id orderId, c.title, v.verification_date, | |||||
| o.c_user_id, uc.phone, uc.nick_name, c.price, c.sale_price, | |||||
| o.`order_status`, co.`coupon_status` | |||||
| from wx_order o | from wx_order o | ||||
| left join wx_coupon c on c.id = o.coupon_id | |||||
| left join wx_coupon_verify v on v.coupon_id= o.coupon_id | |||||
| left join wx_c_user u on u.id = o.c_user_id | |||||
| left join wx_coupon_order co on co.order_id = o.id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_coupon_verify v on v.coupon_id= co.coupon_id | |||||
| left join wx_c_user uc on uc.id = o.c_user_id | |||||
| left join wx_merchant_b_user ub on ub.id = o.b_user_id | |||||
| <where> | <where> | ||||
| <if test="tenantId != null and tenantId !=''"> | <if test="tenantId != null and tenantId !=''"> | ||||
| and c.`tenant_id` = #{tenantId} | and c.`tenant_id` = #{tenantId} | ||||
| @@ -116,21 +124,24 @@ | |||||
| and o.`id` = #{orderId} | and o.`id` = #{orderId} | ||||
| </if> | </if> | ||||
| <if test="couponId != null and couponId!=''"> | <if test="couponId != null and couponId!=''"> | ||||
| and o.`coupon_id` = #{couponId} | |||||
| and co.`coupon_id` = #{couponId} | |||||
| </if> | </if> | ||||
| <if test="cUserId != null and cUserId !=''"> | <if test="cUserId != null and cUserId !=''"> | ||||
| and o.`c_user_id` = #{cUserId} | and o.`c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| <if test="status != null and status != ''" > | |||||
| and o.`status` = #{status} | |||||
| <if test="bUserId != null and bUserId !=''"> | |||||
| and o.`b_user_id` = #{bUserId} | |||||
| </if> | </if> | ||||
| <if test="couponStatus != null and couponStatus.trim() != ''"> | |||||
| and o.`coupon_status` = #{couponStatus} | |||||
| <if test="orderStatus != null and orderStatus != ''" > | |||||
| and o.`order_status` = #{status} | |||||
| </if> | |||||
| <if test="couponStatus != null and couponStatus != ''"> | |||||
| and co.`coupon_status` = #{couponStatus} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| <choose> | <choose> | ||||
| <otherwise> | <otherwise> | ||||
| order by id desc | |||||
| order by o.`id` desc | |||||
| </otherwise> | </otherwise> | ||||
| </choose> | </choose> | ||||
| </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} | ||||
| @@ -3,15 +3,15 @@ | |||||
| <mapper namespace="com.simple.mapper.WxPayOrderMapper"> | <mapper namespace="com.simple.mapper.WxPayOrderMapper"> | ||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxPayOrder"> | <resultMap id="BaseResultMap" type="com.simple.domain.po.WxPayOrder"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | ||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | ||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | <result column="order_id" jdbcType="BIGINT" property="orderId" /> | ||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| <result column="ip" jdbcType="VARCHAR" property="ip" /> | <result column="ip" jdbcType="VARCHAR" property="ip" /> | ||||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | ||||
| <result column="pay_time_start" jdbcType="INTEGER" property="payTimeStart" /> | |||||
| <result column="pay_time_end" jdbcType="INTEGER" property="payTimeEnd" /> | |||||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" /> | |||||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | ||||
| <result column="pay_vendor" jdbcType="INTEGER" property="payVendor" /> | <result column="pay_vendor" jdbcType="INTEGER" property="payVendor" /> | ||||
| <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo" /> | <result column="pay_order_no" jdbcType="VARCHAR" property="payOrderNo" /> | ||||
| @@ -32,7 +32,7 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and `tenant_id` = #{tenantId} | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | </if> | ||||
| @@ -0,0 +1,110 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.simple.mapper.WxProfitSharingOrderMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxProfitSharingOrder"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" /> | |||||
| <result column="order_id" jdbcType="VARCHAR" property="orderId" /> | |||||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | |||||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" /> | |||||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | |||||
| <result column="sharing_order_id" jdbcType="VARCHAR" property="sharingOrderId" /> | |||||
| <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" /> | |||||
| <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`merchant_id`,`order_id`,`pay_amount`,`pay_time_end`,`pay_time_start`,`transaction_id`,`sharing_order_id`,`error_msg`,`sharing_status`,`update_time`,`create_time` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and `order_id` = #{orderId} | |||||
| </if> | |||||
| <if test=" null != payAmount "> | |||||
| and `pay_amount` = #{payAmount} | |||||
| </if> | |||||
| <if test=" null != payTimeEnd "> | |||||
| and `pay_time_end` = #{payTimeEnd} | |||||
| </if> | |||||
| <if test=" null != payTimeStart "> | |||||
| and `pay_time_start` = #{payTimeStart} | |||||
| </if> | |||||
| <if test=" null != transactionId "> | |||||
| and `transaction_id` like concat('%', #{transactionId},'%') | |||||
| </if> | |||||
| <if test=" null != sharingOrderId "> | |||||
| and `sharing_order_id` like concat('%', #{sharingOrderId},'%') | |||||
| </if> | |||||
| <if test=" null != errorMsg "> | |||||
| and `error_msg` like concat('%', #{errorMsg},'%') | |||||
| </if> | |||||
| <if test=" null != sharingStatus "> | |||||
| and `sharing_status` like concat('%', #{sharingStatus},'%') | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxProfitSharingOrder" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_profit_sharing_order | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,98 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.simple.mapper.WxProfitSharingReceiverMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxProfitSharingReceiver"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" /> | |||||
| <result column="receiver_type" jdbcType="INTEGER" property="receiverType" /> | |||||
| <result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount" /> | |||||
| <result column="receiver_comments" jdbcType="VARCHAR" property="receiverComments" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| <result column="sharing_type" jdbcType="INTEGER" property="sharingType" /> | |||||
| <result column="bank_no" jdbcType="VARCHAR" property="bankNo" /> | |||||
| <result column="true_name" jdbcType="VARCHAR" property="trueName" /> | |||||
| <result column="bank_code" jdbcType="VARCHAR" property="bankCode" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`merchant_id`,`receiver_type`,`receiver_account`,`receiver_comments`,`create_time`,`update_time`,`sharing_type`,`bank_no`,`true_name`,`bank_code` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != receiverType "> | |||||
| and `receiver_type` = #{receiverType} | |||||
| </if> | |||||
| <if test=" null != receiverAccount "> | |||||
| and `receiver_account` like concat('%', #{receiverAccount},'%') | |||||
| </if> | |||||
| <if test=" null != receiverComments "> | |||||
| and `receiver_comments` like concat('%', #{receiverComments},'%') | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | |||||
| <if test=" null != sharingType "> | |||||
| and `sharing_type` = #{sharingType} | |||||
| </if> | |||||
| <if test=" null != bankNo "> | |||||
| and `bank_no` like concat('%', #{bankNo},'%') | |||||
| </if> | |||||
| <if test=" null != trueName "> | |||||
| and `true_name` like concat('%', #{trueName},'%') | |||||
| </if> | |||||
| <if test=" null != bankCode "> | |||||
| and `bank_code` like concat('%', #{bankCode},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.simple.domain.po.WxProfitSharingReceiver" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_profit_sharing_receiver | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | |||||