Merge branch '1.1' of http://120.76.84.145:10101/gitblit/r/java/SuperSaveDriving
136个文件已修改
2个文件已删除
74个文件已添加
| | |
| | | |
| | | String SECRET = "defaultSecret"; |
| | | |
| | | Long EXPIRATION = 604800L; |
| | | Long EXPIRATION = 94608000L; |
| | | |
| | | String AUTH_PATH = "/gunsApi/auth"; |
| | | |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverBank; |
| | | import com.supersavedriving.driver.modular.system.model.Edition; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.Register; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.SMSUtil; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverInfo") |
| | | // @ServiceLog(name = "获取司机个人信息", url = "/api/driver/queryDriverInfo") |
| | | @ApiOperation(value = "获取司机个人信息", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取司机个人信息【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryCommissionList") |
| | | // @ServiceLog(name = "获取佣金记录", url = "/api/driver/queryCommissionList") |
| | | @ApiOperation(value = "获取佣金记录", tags = {"司机端-个人中心"}, notes = "") |
| | | // @ServiceLog(name = "获取收入记录", url = "/api/driver/queryCommissionList") |
| | | @ApiOperation(value = "获取收入记录", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/withdrawCash") |
| | | // @ServiceLog(name = "司机提现操作", url = "/api/driver/withdrawCash") |
| | | @ApiOperation(value = "司机提现操作", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "司机提现操作【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=余额提现,2=佣金提现)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提现金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper withdrawCash(Integer type, Double money){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | public ResponseWarpper withdrawCash(Integer type, Integer bankId, Double money){ |
| | | if(null == bankId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("bankId")); |
| | | } |
| | | if(null == money){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("money")); |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = cashWithdrawalService.withdrawCash(uid, type, money); |
| | | ResultUtil resultUtil = cashWithdrawalService.withdrawCash(uid, type, bankId, money); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ApiOperation(value = "获取司机钱包明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "类型(1=收入,3=充值,4=支出,7=优惠券,8=保险)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "类型(3=充值,8=保险,9=订单信息费)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/balanceRecharge1") |
| | | // @ServiceLog(name = "账户余额充值(跳小程序支付)", url = "/api/driver/balanceRecharge") |
| | | @ApiOperation(value = "账户余额充值(跳小程序支付)", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "小程序code", name = "jscode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper balanceRecharge1(String jscode, Integer driverId, Double amount){ |
| | | if(null == jscode){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("jscode")); |
| | | } |
| | | if(null == driverId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("driverId")); |
| | | } |
| | | if(null == amount){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("amount")); |
| | | } |
| | | try { |
| | | ResultUtil resultUtil = driverService.balanceRecharge1(driverId, jscode, amount); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 账户余额充值支付回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/balanceRechargeCallback") |
| | | public void balanceRechargeCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void balanceRechargeCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | String result = map.get("result"); |
| | | String orderId = out_trade_no.substring(17); |
| | | driverService.balanceRechargeCallback(out_trade_no, transaction_id); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | if(!"0000".equals(interfaceResponse.getCode())){ |
| | | System.err.println("充值回调异常:" + interfaceResponse.getMsg()); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String out_trade_no = jsonObject.getString("parameter1"); |
| | | driverService.balanceRechargeCallback(out_trade_no, merOrderId); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; |
| | | phone = phone.indexOf("+") < 0 ? "+" + phone : phone; |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | resultUtil = ResultUtil.error("验证码无效"); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/microenterprise") |
| | | // @ServiceLog(name = "绑定商户", url = "/api/driver/microenterprise") |
| | | @ApiOperation(value = "绑定商户", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "绑定商户【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.microenterprise(uid, name, IDCode, phone); |
| | | ResultUtil resultUtil = driverService.microenterprise(uid, name, IDCode, phone, "/base/driver/microenterpriseCallback"); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册商户回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/microenterpriseCallback") |
| | | public void microenterpriseCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())) { |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | Driver driver = driverService.selectById(parameter1); |
| | | if ("2".equals(status)) { |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if ("0".equals(status)) { |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if ("1".equals(status)) { |
| | | String userId = jsonObject.getString("userId"); |
| | | driver.setMerchantNumber(userId); |
| | | driverService.updateById(driver); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryBank") |
| | | // @ServiceLog(name = "获取绑定的银行卡", url = "/api/driver/queryBank") |
| | | @ApiOperation(value = "获取绑定的银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取绑定的银行卡【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | DriverBank driverId = driverBankService.selectOne(new EntityWrapper<DriverBank>().eq("driverId", uid)); |
| | | return ResponseWarpper.success(driverId); |
| | | return ResponseWarpper.success(null == driverId ? new DriverBank() : driverId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/addDriverBank") |
| | | // @ServiceLog(name = "绑定银行卡", url = "/api/driver/addDriverBank") |
| | | @ApiOperation(value = "绑定银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "绑定银行卡【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/delDriverBank") |
| | | // @ServiceLog(name = "解绑银行卡", url = "/api/driver/delDriverBank") |
| | | @ApiOperation(value = "解绑银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "解绑银行卡【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "银行卡id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现分账的回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/withdrawCashFZCallback") |
| | | public void withdrawCashFZCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | cashWithdrawalService.withdrawCashFZCallback(interfaceResponse); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 提现确认收货后的结算回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/withdrawCashCallback") |
| | | public void withdrawCashCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | cashWithdrawalService.withdrawCashCallback(interfaceResponse); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.driver.modular.system.model.DivisionRecord; |
| | | import com.supersavedriving.driver.modular.system.model.Order; |
| | | import com.supersavedriving.driver.modular.system.model.RechargeRecord; |
| | | import com.supersavedriving.driver.modular.system.service.IDivisionRecordService; |
| | | import com.supersavedriving.driver.modular.system.service.IRechargeRecordService; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.Receive; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.ReceiveUser; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.model.CloudRecordingCallback; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 订单控制器 |
| | |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(OrderController.class); |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private RongYunUtil rongYunUtil; |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转账回调 |
| | | * @param execute |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/zhaunzhangCallback") |
| | | public void zhaunzhangCallback(@RequestBody InterfaceResponse execute, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(2 == status){ |
| | | System.err.println("转账失败"); |
| | | return; |
| | | } |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | RechargeRecord rechargeRecord = rechargeRecordService.selectById(parameter1); |
| | | |
| | | |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | System.err.println("转账失败:" + execute.getMsg()); |
| | | return; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryDriverOrderList") |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 异步分账回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/ledgerCallback") |
| | | public void ledgerCallback(@RequestBody InterfaceResponse execute, HttpServletResponse response){ |
| | | try{ |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(execute.content(), execute.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | logger.warn("异步分账回调异常"); |
| | | return; |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String divisionRecordId = jsonObject.getString("parameter1"); |
| | | DivisionRecord divisionRecord = divisionRecordService.selectById(divisionRecordId); |
| | | if(divisionRecord.getState() == 2){ |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | return; |
| | | } |
| | | divisionRecord.setMerOrderId(merOrderId); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | |
| | | //确认收货 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Receive receive = new Receive();//确认收货 |
| | | receive.setOriginalMerOrderId(merOrderId); |
| | | receive.setRcvAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(divisionRecord.getMerchantNumber()); |
| | | receiveUser.setRcvSplitAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(receive, Receive.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getCode())){ |
| | | logger.warn("确认收货" + execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | logger.warn("确认收货失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | logger.warn("确认收货处理中"); |
| | | } |
| | | } |
| | | }, 60000); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } else {//验签失败业务处理逻辑 |
| | | logger.warn("支付回调验签失败"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | String appid = req.getParameter("appid"); |
| | | String sign = req.getParameter("sign"); |
| | | ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); |
| | | if (resultUtil.getCode() != 200) { |
| | | if (resultUtil.getCode() != 10000) { |
| | | res.setStatus(HttpStatus.OK.value()); |
| | | res.setHeader("Content-type", "text/html;charset=UTF-8"); |
| | | res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.driver.modular.system.model.DivisionRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:41 |
| | | */ |
| | | public interface DivisionRecordMapper extends BaseMapper<DivisionRecord> { |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<DriverYouTuiWarpper> queryAllYouTui(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | */ |
| | | void editState(); |
| | | } |
| | |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime, |
| | | (newData - oldData) as money, |
| | | newData as balance |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} |
| | | from t_account_change_detail where changeType not in (3, 4, 8, 9) and userType = 2 and `type` = 1 and userId = #{driverId} |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | |
| | | from ( |
| | | select |
| | | (newData - oldData) as money |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} |
| | | from t_account_change_detail where changeType not in (3, 4, 8, 9) and userType = 2 and `type` = 1 and userId = #{driverId} |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime, |
| | | (newData - oldData) as amount, |
| | | newData as balance |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} and changeType in (1, 3, 4, 7, 8) |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} and changeType in (3, 8, 9) |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | |
| | | <result column="userDriverId" property="userDriverId"/> |
| | | <result column="code" property="code"/> |
| | | <result column="businessType" property="businessType"/> |
| | | <result column="bankId" property="bankId"/> |
| | | <result column="amount" property="amount"/> |
| | | <result column="state" property="state"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
New file |
| | |
| | | <?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.supersavedriving.driver.modular.system.dao.DivisionRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.DivisionRecord"> |
| | | <id column="id" property="id"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="merOrderId" property="merOrderId"/> |
| | | <result column="sourceType" property="sourceType"/> |
| | | <result column="amount" property="amount"/> |
| | | <result column="merchantNumber" property="merchantNumber"/> |
| | | <result column="state" property="state"/> |
| | | <result column="payTime" property="payTime"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | a.estimatedMileage, |
| | | a.estimatedTime, |
| | | a.startPrice, |
| | | a.waitTime, |
| | | a.waitTime + a.outWaitTime as waitTime, |
| | | a.actualMileage, |
| | | a.state, |
| | | (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(a.startTime)) / 60 as travelTime |
| | |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="surplusDividedAmount" property="surplusDividedAmount"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | content |
| | | from t_you_tui where status = 1 order by createTime desc limit #{pageNum}, #{pageSize} |
| | | </select> |
| | | |
| | | |
| | | <update id="editState"> |
| | | update t_you_tui_driver set state = 3 where failureTime <= now() and state != 3 |
| | | </update> |
| | | </mapper> |
| | |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 负责人姓名 |
| | | */ |
| | | @TableField("principal") |
| | | @TableField(value = "principal") |
| | | private String principal; |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @TableField("principalPhone") |
| | | @TableField(value = "principalPhone") |
| | | private String principalPhone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | @TableField(value = "email") |
| | | private String email; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | @TableField(value = "provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField(value = "provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | @TableField(value = "cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 代理区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | @TableField(value = "cityName") |
| | | private String cityName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | @TableField(value = "status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | @TableField(value = "createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 开户银行 |
| | | */ |
| | | @TableField("bankDeposit") |
| | | private String bankDeposit; |
| | | /** |
| | | * 银行账号 |
| | | */ |
| | | @TableField("bankAccount") |
| | | private String bankAccount; |
| | | /** |
| | | * 客服电话 |
| | | */ |
| | | @TableField("serviceCalls") |
| | | @TableField(value = "serviceCalls") |
| | | private String serviceCalls; |
| | | /** |
| | | * 商户类型(1=个体工商户,2=企业) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 公司名称 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 经营范围 |
| | | */ |
| | | @TableField("businessScope") |
| | | private String businessScope; |
| | | /** |
| | | * 统一社会信用码 |
| | | */ |
| | | @TableField("socialCreditCode") |
| | | private String socialCreditCode; |
| | | /** |
| | | * 统一社会信用证有效期 |
| | | */ |
| | | @TableField("socialCreditCodeExpires") |
| | | private Date socialCreditCodeExpires; |
| | | /** |
| | | * 企业注册省编号 |
| | | */ |
| | | @TableField("provCodeEnterprise") |
| | | private String provCodeEnterprise; |
| | | /** |
| | | * 企业注册市编号 |
| | | */ |
| | | @TableField("cityCodeEnterprise") |
| | | private String cityCodeEnterprise; |
| | | /** |
| | | * 企业注册区编号 |
| | | */ |
| | | @TableField("areaCodeEnterprise") |
| | | private String areaCodeEnterprise; |
| | | /** |
| | | * 企业注册详细地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 法人姓名 |
| | | */ |
| | | @TableField("legalPerson") |
| | | private String legalPerson; |
| | | /** |
| | | * 法人身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 法人身份证有效期 |
| | | */ |
| | | @TableField("certIdExpires") |
| | | private Date certIdExpires; |
| | | /** |
| | | * 法人手机号 |
| | | */ |
| | | @TableField("legalPhone") |
| | | private String legalPhone; |
| | | /** |
| | | * 附件编号 |
| | | */ |
| | | @TableField("fileNo") |
| | | private String fileNo; |
| | | /** |
| | | * 结算账户名 |
| | | */ |
| | | @TableField("cardName") |
| | | private String cardName; |
| | | /** |
| | | * 结算账户号 |
| | | */ |
| | | @TableField("cardNo") |
| | | private String cardNo; |
| | | /** |
| | | * 银行账户类型(1=对公,2=对私) |
| | | */ |
| | | @TableField("bankAcctType") |
| | | private Integer bankAcctType; |
| | | /** |
| | | * 银行预留手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 开户行编号 |
| | | */ |
| | | @TableField("bankCode") |
| | | private String bankCode; |
| | | /** |
| | | * 开户行地区省编号 |
| | | */ |
| | | @TableField("provCodeBank") |
| | | private String provCodeBank; |
| | | /** |
| | | * 开户行地区市编号 |
| | | */ |
| | | @TableField("cityCodeBank") |
| | | private String cityCodeBank; |
| | | /** |
| | | * 开户行地区区编号 |
| | | */ |
| | | @TableField("areaCodeBank") |
| | | private String areaCodeBank; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("merchantStatus") |
| | | private Integer merchantStatus; |
| | | /** |
| | | * 结算账户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("bankStatus") |
| | | private Integer bankStatus; |
| | | } |
| | |
| | | @TableField("businessType") |
| | | private Integer businessType; |
| | | /** |
| | | * 银行卡id |
| | | */ |
| | | @TableField("bankId") |
| | | private Integer bankId; |
| | | /** |
| | | * 提现金额 |
| | | */ |
| | | @TableField("amount") |
| | |
| | | * 优惠券数量 |
| | | */ |
| | | @TableField("coupon_count") |
| | | private Integer couponCount; |
| | | private Long couponCount; |
| | | /** |
| | | * 剩余数量 |
| | | */ |
| | | @TableField("remaining_quantity") |
| | | private Integer remainingQuantity; |
| | | private Long remainingQuantity; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 15:54 |
| | | */ |
| | | @Data |
| | | @TableName("t_division_record") |
| | | public class DivisionRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 用户类型(1=司机,2=代理商,3=平台) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 分账业务订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 充值记录id |
| | | */ |
| | | @TableField("rechargeRecordId") |
| | | private Integer rechargeRecordId; |
| | | /** |
| | | * 第三方分账业务订单id |
| | | */ |
| | | @TableField("merOrderId") |
| | | private String merOrderId; |
| | | /** |
| | | * 业务来源(1=订单业务,2=平台充值) |
| | | */ |
| | | @TableField("sourceType") |
| | | private Integer sourceType; |
| | | /** |
| | | * 分账金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 收款商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 分账状态(1=分账中,2=分账成功) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 分账时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 司机推荐二维码 |
| | | */ |
| | | @TableField("referralCode") |
| | | private String referralCode; |
| | | } |
| | |
| | | @TableField("overLongDistancePrice") |
| | | private Double overLongDistancePrice; |
| | | /** |
| | | * 等待时长(分钟) |
| | | * 等待时长(s) |
| | | */ |
| | | @TableField("waitTime") |
| | | private Integer waitTime; |
| | |
| | | @TableField("waitTimePrice") |
| | | private Double waitTimePrice; |
| | | /** |
| | | * 超出等待时长(分钟) |
| | | * 超出等待时长(s) |
| | | */ |
| | | @TableField("outWaitTime") |
| | | private Integer outWaitTime; |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统充值记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/21 23:08 |
| | | */ |
| | |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=用户,2=司机,3=代理商) |
| | | * 数据类型(1=用户,2=司机,3=代理商,4=平台) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 剩余待分账金额 |
| | | */ |
| | | @TableField("surplusDividedAmount") |
| | | private Double surplusDividedAmount; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.CashWithdrawal; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 司机提现申请 |
| | | * @param type |
| | | * @param bankId |
| | | * @param money |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil withdrawCash(Integer driverId, Integer type, Double money) throws Exception; |
| | | ResultUtil withdrawCash(Integer driverId, Integer type, Integer bankId, Double money) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 提现异步回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | void withdrawCashFZCallback(InterfaceResponse interfaceResponse); |
| | | |
| | | |
| | | /** |
| | | * 提现确认收货后的结算回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | void withdrawCashCallback(InterfaceResponse interfaceResponse); |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.driver.modular.system.model.DivisionRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:42 |
| | | */ |
| | | public interface IDivisionRecordService extends IService<DivisionRecord> { |
| | | } |
| | |
| | | ResultUtil balanceRecharge(Integer uid, Double amount) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 司机账户余额充值 |
| | | * @param driverId |
| | | * @param amount |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil balanceRecharge1(Integer driverId, String jscode, Double amount) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 支付回调通知处理 |
| | | * @param out_trade_no |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil microenterprise(Integer uid, String name, String number, String phone) throws Exception; |
| | | ResultUtil microenterprise(Integer uid, String name, String number, String phone, String notifyUrl) throws Exception; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil driverOffWork(Integer driverId, Long onlineTime) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 定时任务检查司机余额是否充足 |
| | | */ |
| | | void taskDriverOffWork(); |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<OrderPositionWarpper> queryPosition(Integer orderId, Integer orderType) throws Exception; |
| | | |
| | | |
| | | |
| | | void initMap(Long orderId) throws Exception; |
| | | } |
| | |
| | | */ |
| | | ResultUtil driverAddOrder(Integer uid, AddOrderWarpper addOrderWarpper) throws Exception; |
| | | |
| | | |
| | | Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city) throws Exception; |
| | | /** |
| | | * 获取大厅订单列表 |
| | | * @param uid |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil receiveOrder(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 推送服务中的数据 |
| | | * @param orderId |
| | | */ |
| | | void pushOrderInfo(Long orderId); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 主动完成线下收款 |
| | | */ |
| | | void completeCollection(); |
| | | |
| | | |
| | | ResultUtil fengzhang(Integer userType, Integer id, String merchantNumber, Long orderId, Integer rechargeRecordId, String merOrderId, Double amount, Integer sourceType); |
| | | |
| | | |
| | | |
| | | void saveRevenue(Order order) throws Exception; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil redeemBenefits(Integer driverId, Integer id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * @throws Exception |
| | | */ |
| | | void editState() throws Exception; |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.RechargeRecord; |
| | | import com.supersavedriving.driver.modular.system.model.SystemConfig; |
| | | import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.ISystemConfigService; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.BalanceDetailWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.CommissionDetailListWarpper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | |
| | |
| | | Double num1 = jsonObject.getDouble("num1"); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1)); |
| | | for (Driver driver : drivers) { |
| | | Double couponBalance = driver.getCouponBalance(); |
| | | Double backgroundBalance = driver.getBackgroundBalance(); |
| | | Double balance = driver.getBalance(); |
| | | Double commission = driver.getCommission(); |
| | | double all = couponBalance + backgroundBalance + balance + commission; |
| | | if(num1 > all){ |
| | | double all = backgroundBalance + balance; |
| | | if(num1.compareTo(all) > 0){ |
| | | continue; |
| | | } |
| | | |
| | | double d = num1.doubleValue(); |
| | | if(backgroundBalance > 0 && backgroundBalance < d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getBackgroundBalance()); |
| | | accountChangeDetail.setNewData(0D); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d -= backgroundBalance; |
| | | driver.setBackgroundBalance(0D); |
| | | } |
| | | if(backgroundBalance > 0 && backgroundBalance >= d){ |
| | | }else if(backgroundBalance >= d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setBackgroundBalance(driver.getBackgroundBalance() - d); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d = 0; |
| | | } |
| | | |
| | | if(d > 0){ |
| | | if(couponBalance > 0 && couponBalance < d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getCouponBalance()); |
| | | accountChangeDetail.setNewData(0D); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d -= couponBalance; |
| | | driver.setCouponBalance(0D); |
| | | } |
| | | if(couponBalance > 0 && couponBalance >= d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setCouponBalance(driver.getCouponBalance() - d); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d = 0; |
| | | } |
| | | } |
| | | if(d > 0){ |
| | | if(commission > 0 && commission < d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getCommission()); |
| | | accountChangeDetail.setNewData(0D); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d -= commission; |
| | | driver.setCommission(0D); |
| | | } |
| | | if(commission > 0 && commission >= d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setCommission(driver.getCommission() - d); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d = 0; |
| | | } |
| | | } |
| | | if(d > 0){ |
| | | if(balance > 0 && balance < d){ |
| | | continue; |
| | | } |
| | | if(balance > 0 && balance >= d){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(8); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setBalance(driver.getBalance() - d); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(driver.getBalance()).subtract(new BigDecimal(d)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("收取保险费"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | this.insert(accountChangeDetail); |
| | | d = 0; |
| | | |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(d) >= 0){ |
| | | ResultUtil fengzhang = orderService.fengzhang(3, null, "553021440975", null, rechargeRecord.getId(), rechargeRecord.getOrderNumber(), d, 1); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(d)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = orderService.fengzhang(3, null, "553021440975", null, rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 1); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | d = new BigDecimal(d).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.dao.CashWithdrawalMapper; |
| | | import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; |
| | | import com.supersavedriving.driver.modular.system.model.CashWithdrawal; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | import com.supersavedriving.driver.modular.system.service.ICashWithdrawalService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | /** |
| | | * 司机提现操作 |
| | | * @param driverId |
| | | * @param type |
| | | * @param bankId |
| | | * @param money |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawCash(Integer driverId, Integer type, Double money) throws Exception { |
| | | public ResultUtil withdrawCash(Integer driverId, Integer type, Integer bankId, Double money) throws Exception { |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(type == 1 && (null == driver.getBalance() || driver.getBalance() < money)){ |
| | | return ResultUtil.error("账户余额不足"); |
| | | if(type == 1 && (null == driver.getBalance() || driver.getBalance().compareTo(money) < 0)){ |
| | | return ResultUtil.error("余额不足"); |
| | | } |
| | | if(type == 2 && (null == driver.getCommission() || driver.getCommission() < money)){ |
| | | return ResultUtil.error("佣金余额不足"); |
| | | if(type == 2 && (null == driver.getCommission() || driver.getCommission().compareTo(money) < 0)){ |
| | | return ResultUtil.error("收入余额不足"); |
| | | } |
| | | if(ToolUtil.isEmpty(driver.getMerchantNumber())){ |
| | | return ResultUtil.error("请先注册商户号"); |
| | | } |
| | | |
| | | CashWithdrawal cashWithdrawal = new CashWithdrawal(); |
| | | cashWithdrawal.setType(2); |
| | | cashWithdrawal.setUserDriverId(driverId); |
| | | cashWithdrawal.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | cashWithdrawal.setBusinessType(type == 1 ? 12 : 11); |
| | | cashWithdrawal.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | cashWithdrawal.setBusinessType(type == 2 ? 11 : 12); |
| | | cashWithdrawal.setBankId(bankId); |
| | | cashWithdrawal.setAmount(money); |
| | | cashWithdrawal.setState(1); |
| | | cashWithdrawal.setCreateTime(new Date()); |
| | |
| | | |
| | | //增加记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(type == 1 ? 4 : 6); |
| | | if(type == 1){ |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setBalance(driver.getBalance() - money); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("账户余额提现"); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(driver.getBalance()).subtract(new BigDecimal(money)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | }else{ |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).subtract(new BigDecimal(money)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | } |
| | | if(type == 2){ |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setCommission(driver.getCommission() - money); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("佣金余额提现"); |
| | | } |
| | | accountChangeDetail.setExplain(type == 1 ? "账户余额提现" : "佣金余额提现"); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String outDetailNo = sdf.format(new Date()) + cashWithdrawal.getId(); |
| | | String s = payMoneyUtil.weixinTransferMoney(outDetailNo, money, driver.getOpenid(), driver.getName(), "【超省新代驾】提现付款!"); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | return ResultUtil.error("提现异常,请联系管理员"); |
| | | if(type == 1){//余额提现,调用分账接口 -->确认收货--->提现 |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2) |
| | | .eq("userId", driver.getId()).eq("payType", 1).eq("payStatus", 2).gt("surplusDividedAmount", 0)); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(money) >= 0){//够分账 |
| | | ResultUtil fenzhang = fenzhang(driver, rechargeRecord, cashWithdrawal, 3, money); |
| | | if(fenzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - money); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | break; |
| | | }else{ |
| | | return fenzhang; |
| | | } |
| | | }else{ |
| | | ResultUtil fenzhang = fenzhang(driver, rechargeRecord, cashWithdrawal, 3, surplusDividedAmount); |
| | | if(fenzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | money -= surplusDividedAmount; |
| | | }else{ |
| | | return fenzhang; |
| | | } |
| | | } |
| | | } |
| | | }else{//佣金提现,直接提现到银行卡 |
| | | Double finalMoney = money; |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Withdraw withdraw = new Withdraw(); |
| | | withdraw.setUserId(driver.getMerchantNumber()); |
| | | withdraw.setAmount(new BigDecimal(finalMoney).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | withdraw.setOrderName("账户余额提现"); |
| | | withdraw.setRemark("账户余额提现"); |
| | | withdraw.setNotifyUrl(callbackPath + "/base/driver/withdrawCashCallback"); |
| | | withdraw.setParameter1(cashWithdrawal.getId().toString()); |
| | | TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(1 == status){ |
| | | cashWithdrawal.setOrderNumber(merOrderId1); |
| | | cashWithdrawal.setState(2); |
| | | cashWithdrawal.setOrderNumber(s); |
| | | this.updateById(cashWithdrawal); |
| | | CashWithdrawalServiceImpl.this.updateById(cashWithdrawal); |
| | | } |
| | | if(2 == status){ |
| | | System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | System.err.println("结算接口异常【提现】:" + execute.getMsg()); |
| | | } |
| | | } |
| | | }, 60000); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 司机提现,现将支付的订单进行分账 |
| | | * @param driver |
| | | * @param amount |
| | | * @param cashWithdrawal |
| | | * @return |
| | | */ |
| | | public ResultUtil fenzhang(Driver driver, Double amount, CashWithdrawal cashWithdrawal, Integer payType){ |
| | | List<RechargeRecord> rechargeRecords = new ArrayList<>(); |
| | | if(payType == 1){//司机充值 |
| | | rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2) |
| | | .eq("userId", driver.getId()).eq("payType", 1).eq("payStatus", 2).gt("surplusDividedAmount", 0)); |
| | | } |
| | | if(payType == 2){//平台充值(补贴金额) |
| | | rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>() |
| | | .eq("payType", 2).eq("payStatus", 2).gt("surplusDividedAmount", 0)); |
| | | } |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(amount) >= 0){//够分账 |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(1); |
| | | divisionRecord.setUserId(driver.getId()); |
| | | divisionRecord.setOrderId(rechargeRecord.getId().longValue()); |
| | | divisionRecord.setSourceType(payType == 1 ? 3 : 2); |
| | | divisionRecord.setAmount(amount); |
| | | divisionRecord.setMerchantNumber(driver.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - amount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(rechargeRecord.getOrderNumber()); |
| | | complete.setNotifyUrl(callbackPath + "/base/driver/withdrawCashFZCallback"); |
| | | complete.setParameter1(divisionRecord.getId().toString()); |
| | | complete.setParameter2(rechargeRecord.getId() + "_" + cashWithdrawal.getId()); |
| | | //分账方列表 |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE);//分账操作 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | System.err.println("司机提现分账失败:" + execute.getMsg()); |
| | | break; |
| | | } |
| | | if(1 == status){ |
| | | divisionRecord.setMerOrderId(merOrderId); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | //间隔10秒开始调用确认收货后开始提现 |
| | | |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(driver, rechargeRecord, divisionRecord, cashWithdrawal); |
| | | } |
| | | }, 60000); |
| | | } |
| | | }else{ |
| | | System.err.println("司机提现分账处理异常 :" + execute.getMsg()); |
| | | return ResultUtil.error("司机提现分账处理异常 :" + execute.getMsg()); |
| | | } |
| | | }else{//不够分账 |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(1); |
| | | divisionRecord.setUserId(driver.getId()); |
| | | divisionRecord.setOrderId(rechargeRecord.getId().longValue()); |
| | | divisionRecord.setSourceType(payType == 1 ? 3 : 2); |
| | | divisionRecord.setAmount(surplusDividedAmount); |
| | | divisionRecord.setMerchantNumber(driver.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(rechargeRecord.getOrderNumber()); |
| | | complete.setNotifyUrl(callbackPath + "/base/driver/withdrawCashFZCallback"); |
| | | complete.setParameter1(divisionRecord.getId().toString()); |
| | | //分账方列表 |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(new BigDecimal(surplusDividedAmount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE);//分账操作 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | System.err.println("司机提现分账失败:" + execute.getMsg()); |
| | | break; |
| | | } |
| | | if(1 == status){ |
| | | divisionRecord.setMerOrderId(merOrderId); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | |
| | | //间隔10秒开始调用确认收货后开始提现 |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(driver, rechargeRecord, divisionRecord, cashWithdrawal); |
| | | } |
| | | }, 60000); |
| | | } |
| | | }else{ |
| | | System.err.println("司机提现分账处理异常 :" + execute.getMsg()); |
| | | return ResultUtil.error("司机提现分账处理异常 :" + execute.getMsg()); |
| | | } |
| | | amount -= surplusDividedAmount; |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | public ResultUtil fenzhang(Driver driver, RechargeRecord rechargeRecord, CashWithdrawal cashWithdrawal, Integer sourceType, Double amount){ |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(1); |
| | | divisionRecord.setUserId(driver.getId()); |
| | | divisionRecord.setOrderId(rechargeRecord.getId().longValue()); |
| | | divisionRecord.setSourceType(sourceType); |
| | | divisionRecord.setAmount(amount); |
| | | divisionRecord.setMerchantNumber(driver.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(rechargeRecord.getOrderNumber()); |
| | | complete.setNotifyUrl(callbackPath + "/base/driver/withdrawCashFZCallback"); |
| | | complete.setParameter1(divisionRecord.getId().toString()); |
| | | //分账方列表 |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE);//分账操作 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | System.err.println("司机提现分账失败:" + execute.getMsg()); |
| | | return ResultUtil.error("司机提现分账失败 :" + execute.getMsg()); |
| | | } |
| | | if(1 == status){ |
| | | divisionRecord.setMerOrderId(merOrderId); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | |
| | | //间隔10秒开始调用确认收货后开始提现 |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(driver, rechargeRecord, divisionRecord, cashWithdrawal); |
| | | } |
| | | }, 60000); |
| | | } |
| | | }else{ |
| | | System.err.println("司机提现分账处理异常 :" + execute.getMsg()); |
| | | return ResultUtil.error("司机提现分账处理异常 :" + execute.getMsg()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分账后的确认收货和提现操作 |
| | | * @param driver |
| | | * @param rechargeRecord |
| | | * @param divisionRecord |
| | | * @param cashWithdrawal |
| | | */ |
| | | public void confirmReceipt(Driver driver, RechargeRecord rechargeRecord, DivisionRecord divisionRecord, CashWithdrawal cashWithdrawal){ |
| | | Receive receive = new Receive(); |
| | | receive.setOriginalMerOrderId(rechargeRecord.getOrderNumber()); |
| | | receive.setAsynMerOrderId(divisionRecord.getMerOrderId()); |
| | | receive.setRcvAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(driver.getMerchantNumber()); |
| | | receiveUser.setRcvSplitAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(receive, Receive.SERVICE_CODE);//确认收货 |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute1.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if(ToolUtil.isNotEmpty(merOrderId)){ |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Withdraw withdraw = new Withdraw(); |
| | | withdraw.setUserId(driver.getMerchantNumber()); |
| | | withdraw.setAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | withdraw.setOrderName("账户余额提现"); |
| | | withdraw.setRemark("账户余额提现"); |
| | | withdraw.setNotifyUrl(callbackPath + "/base/driver/withdrawCashCallback"); |
| | | withdraw.setParameter1(cashWithdrawal.getId().toString()); |
| | | TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(1 == status){ |
| | | cashWithdrawal.setOrderNumber(merOrderId1); |
| | | cashWithdrawal.setState(2); |
| | | CashWithdrawalServiceImpl.this.updateById(cashWithdrawal); |
| | | } |
| | | if(2 == status){ |
| | | System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | System.err.println("结算接口异常【提现】:" + execute.getMsg()); |
| | | } |
| | | } |
| | | }, 60000); |
| | | } |
| | | }else{ |
| | | System.err.println("分账确认收货异常【提现】:" + execute1.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 提现分账的异步回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @Override |
| | | public void withdrawCashFZCallback(InterfaceResponse interfaceResponse) { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | System.err.println("司机提现分账失败:" + interfaceResponse.getMsg()); |
| | | return; |
| | | } |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | String parameter2 = jsonObject.getString("parameter2"); |
| | | DivisionRecord divisionRecord = divisionRecordService.selectById(parameter1); |
| | | if(divisionRecord.getState() == 2){ |
| | | return; |
| | | } |
| | | divisionRecord.setMerOrderId(merOrderId); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | Driver driver = driverService.selectById(divisionRecord.getUserId()); |
| | | String[] s = parameter2.split("_"); |
| | | RechargeRecord rechargeRecord = rechargeRecordService.selectById(s[0]); |
| | | CashWithdrawal cashWithdrawal = this.selectById(s[1]); |
| | | |
| | | //间隔10秒开始调用确认收货后开始提现 |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(driver, rechargeRecord, divisionRecord, cashWithdrawal); |
| | | } |
| | | }, 60000); |
| | | } |
| | | }else{ |
| | | System.err.println("司机提现分账异常:" + interfaceResponse.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现确认收货后的结算回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @Override |
| | | public void withdrawCashCallback(InterfaceResponse interfaceResponse) { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject1.getString("parameter1"); |
| | | CashWithdrawal cashWithdrawal = this.selectById(parameter1); |
| | | cashWithdrawal.setOrderNumber(merOrderId1); |
| | | cashWithdrawal.setState(2); |
| | | this.updateById(cashWithdrawal); |
| | | } |
| | | if(2 == status){ |
| | | System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | System.err.println("结算接口异常【提现】:" + interfaceResponse.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.DivisionRecordMapper; |
| | | import com.supersavedriving.driver.modular.system.model.DivisionRecord; |
| | | import com.supersavedriving.driver.modular.system.service.IDivisionRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 16:42 |
| | | */ |
| | | @Service |
| | | public class DivisionRecordServiceImpl extends ServiceImpl<DivisionRecordMapper, DivisionRecord> implements IDivisionRecordService { |
| | | } |
| | |
| | | bindAccount.setPhone(phone); |
| | | TrhRequest<BindAccount> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | |
| | | TrhRequest<UnbindAccount> request = new TrhRequest<>(); |
| | | InterfaceResponse execute = request.execute(unbindAccount, UnbindAccount.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.Register; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; |
| | | import com.supersavedriving.driver.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.driver.modular.system.util.weChat.model.Code2Session; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 司机 |
| | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String appletsAppid; |
| | | |
| | | @Value("${alipay.appid}") |
| | | private String appid; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //新账号 |
| | | if(null == driver){ |
| | | driver = new Driver(); |
| | | driver.setCode(UUIDUtil.getNumberRandom(16)); |
| | | driver.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | try { |
| | | driver = setDriverParamete(driver, driverRegisterWarpper); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | driver.setCreateTime(new Date()); |
| | | this.insert(driver); |
| | | String s = wechatMiniProgramORCode(driver.getId()); |
| | | driver.setReferralCode(s); |
| | | this.updateById(driver); |
| | | |
| | | |
| | | //司机邀请注册奖励 |
| | | if(null != driver.getInviterId()){ |
| | | Driver driver1 = this.selectById(driver.getInviterId()); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | if(num7 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请司机注册奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | this.updateById(driver1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | //生成小程序二维码 |
| | | public String wechatMiniProgramORCode(Integer driverId) throws Exception{ |
| | | InputStream release = weChatUtil.getwxacodeunlimit("pages/index/index", "driverId=" + driverId, "release"); |
| | | String s = OBSUtil.putObjectToBucket(release, "driver_" + driverId + "_" + UUIDUtil.getNumberRandom(5) + ".jpg"); |
| | | return s; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public Driver setDriverParamete(Driver driver, DriverRegisterWarpper driverRegisterWarpper) throws Exception{ |
| | | driver.setAvatar(driverRegisterWarpper.getAvatar()); |
| | | driver.setName(driverRegisterWarpper.getName()); |
| | | driver.setPhone(driverRegisterWarpper.getPhone()); |
| | | driver.setEmergencyContact(driverRegisterWarpper.getEmergencyContact()); |
| | | driver.setEmergencyPhone(driverRegisterWarpper.getEmergencyPhone()); |
| | | driver.setIdcardBack(driverRegisterWarpper.getIdcardBack()); |
| | | driver.setIdcardFront(driverRegisterWarpper.getIdcardFront()); |
| | | driver.setDriverLicense(driverRegisterWarpper.getDriverLicense()); |
| | | if(ToolUtil.isNotEmpty(driverRegisterWarpper.getFirstCertificateTime())){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | driver.setFirstCertificateTime(sdf.parse(driverRegisterWarpper.getFirstCertificateTime())); |
| | | } |
| | | //注册地 |
| | | String code = driverRegisterWarpper.getCode(); |
| | | BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("districtCode", code).eq("status", 1)); |
| | |
| | | driver.setCityCode(branchOffice.getCityCode()); |
| | | driver.setAreaCode(branchOffice.getDistrictCode()); |
| | | driver.setAreaName(branchOffice.getDistrictName()); |
| | | if(null != driverRegisterWarpper.getInviterId()){ |
| | | driver.setInviterType(driverRegisterWarpper.getInviterType()); |
| | | driver.setInviterId(driverRegisterWarpper.getInviterId()); |
| | | } |
| | | driver.setApprovalStatus(1); |
| | | driver.setApprovalNotes(""); |
| | | driver.setApprovalTime(null); |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil<TokenWarpper> driverLogin(String receiver, String phone, String code) throws Exception { |
| | | if(ToolUtil.isEmpty(receiver)){ |
| | | receiver = "+86"; |
| | | } |
| | | String value = redisUtil.getValue(receiver + phone); |
| | | if(!"12345".equals(code) && ToolUtil.isEmpty(value)){ |
| | | return ResultUtil.error("短信验证码无效"); |
| | |
| | | } |
| | | } |
| | | |
| | | if(ToolUtil.isEmpty(driver.getReferralCode())){ |
| | | String s = wechatMiniProgramORCode(driver.getId()); |
| | | driver.setReferralCode(s); |
| | | this.updateById(driver); |
| | | } |
| | | return ResultUtil.success(tokenWarpper); |
| | | } |
| | | |
| | |
| | | if(token.length() > 16){ |
| | | key = token.substring(token.length() - 16); |
| | | } |
| | | redisUtil.setStrValue(key, driver.getId().toString(), 7 * 24 * 60 * 60);//7天 |
| | | redisUtil.setStrValue("DRIVER_" + phone, key, 7 * 24 * 60 * 60);//7天 |
| | | redisUtil.setStrValue(key, driver.getId().toString(), 94608000);//7天 |
| | | redisUtil.setStrValue("DRIVER_" + phone, key, 94608000);//7天 |
| | | |
| | | //下线 |
| | | for (int i = 0; i < 5; i++) { |
| | |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(lon), Double.valueOf(lat)); |
| | | //构造半径 |
| | | Distance distanceR = new Distance(5D, Metrics.KILOMETERS); |
| | | Distance distanceR = new Distance(10D, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | locations.forEach(s -> { |
| | | String value1 = redisUtil.getValue("DRIVER" + s.getDriverId()); |
| | | if(s.getDriverId().compareTo(uid) != 0 && ToolUtil.isNotEmpty(value1)){ |
| | | list.add(s.getLocation().getX() + "," + s.getLocation().getY()); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = this.selectBatchIds(collect); |
| | | for (Driver driver : drivers) { |
| | | String value1 = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | continue; |
| | | } |
| | | }); |
| | | if(driver.getId().compareTo(uid) == 0){ |
| | | continue; |
| | | } |
| | | list.add(value1 + "," + driver.getServerStatus()); |
| | | } |
| | | } |
| | | return ResultUtil.success(list); |
| | | } |
| | |
| | | @Override |
| | | public PromotionWarpper queryPromotionQRCode(Integer uid) throws Exception { |
| | | PromotionWarpper promotionWarpper = new PromotionWarpper(); |
| | | promotionWarpper.setUrl("http://121.37.15.157/share/driverShare/index.html?inviterId=" + uid); |
| | | Driver driver1 = this.selectById(uid); |
| | | if(ToolUtil.isEmpty(driver1.getReferralCode())){ |
| | | String s = wechatMiniProgramORCode(driver1.getId()); |
| | | driver1.setReferralCode(s); |
| | | this.updateById(driver1); |
| | | } |
| | | // promotionWarpper.setUrl("https://chaoshengdaijia.com/share/driverShare/index.html?inviterId=" + uid); |
| | | promotionWarpper.setUrl(driver1.getReferralCode()); |
| | | int user = appUserService.selectCount(new EntityWrapper<AppUser>().eq("inviterType", 2).eq("inviterId", uid).eq("status", 1)); |
| | | int driver = this.selectCount(new EntityWrapper<Driver>().eq("inviterType", 2).eq("inviterId", uid).eq("approvalStatus", 2).eq("status", 1)); |
| | | promotionWarpper.setTotal(user + driver); |
| | | promotionWarpper.setUser(user); |
| | | promotionWarpper.setDriver(driver); |
| | | Driver driver1 = this.selectById(uid); |
| | | promotionWarpper.setAvatar(driver1.getAvatar()); |
| | | promotionWarpper.setName(driver1.getName()); |
| | | return promotionWarpper; |
| | |
| | | if(h > 0 && h > time){ |
| | | Driver driver = this.selectById(driverId); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driverId); |
| | | accountChangeDetail.setType(2); |
| | |
| | | DriverInfoWarpper driverInfo = new DriverInfoWarpper(); |
| | | BeanUtils.copyProperties(driver, driverInfo); |
| | | driverInfo.setWithdrawBalance(driver.getBalance()); |
| | | driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverInfo.setBalance(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue());//司机充值+平台充值 |
| | | driverInfo.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(driver.getCouponBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue());//司机订单收入+司机佣金收入+司机优惠券收入+司机折扣收入 |
| | | YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid) |
| | | .eq("state", 2).last(" and failureTime > now() order by failureTime limit 0, 1")); |
| | | if(null != youTuiDriver){ |
| | |
| | | List<AccountChangeDetail> list = new ArrayList<>(); |
| | | for (Driver driver : drivers) { |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | |
| | | Driver driver = this.selectById(uid); |
| | | //调起微信 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | RechargeRecord rechargeRecord = new RechargeRecord(); |
| | | rechargeRecord.setType(2); |
| | | rechargeRecord.setUserId(uid); |
| | |
| | | rechargeRecord.setAgentId(driver.getAgentId()); |
| | | rechargeRecordService.insert(rechargeRecord); |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | paymentOrder.setOrderName("账户充值"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(appletsAppid); |
| | | paymentOrder.setOpenid(driver.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | paymentOrderGood.setGoodsName("充值"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(callbackPath + "/base/driver/balanceRechargeCallback");//前端回调地址 |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/driver/balanceRechargeCallback"); |
| | | paymentOrder.setParameter1(out_trade_no); |
| | | |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/driver/balanceRechargeCallback", "APP"); |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | if(rechargeRecord1.getPayStatus() != 1){ |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * SUCCESS--支付成功 |
| | | * REFUND--转入退款 |
| | | * NOTPAY--未支付 |
| | | * CLOSED--已关闭 |
| | | * REVOKED--已撤销(刷卡支付) |
| | | * USERPAYING--用户支付中 |
| | | * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | * ACCEPT--已接收,等待扣款 |
| | | */ |
| | | ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(out_trade_no, ""); |
| | | if(resultUtil.getCode() == 200){ |
| | | Map<String, String> map = resultUtil.getData(); |
| | | String trade_type = map.get("trade_type"); |
| | | String trade_state = map.get("trade_state"); |
| | | String transaction_id = map.get("transaction_id"); |
| | | if("REFUND".equals(trade_state) || "NOTPAY".equals(trade_state) || "CLOSED".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){ |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | return; |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | queryOrder.setQueryType("1"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("SUCCESS".equals(trade_state)){ |
| | | Driver driver1 = DriverServiceImpl.this.selectById(uid); |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | Driver driver1 = DriverServiceImpl.this.selectById(rechargeRecord1.getUserId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(uid); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setChangeType(3); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("余额充值"); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setBalance(driver1.getBalance() + amount); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("账户充值"); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getBalance()).add(new BigDecimal(driver1.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver1.setBalance(new BigDecimal(driver1.getBalance()).add(new BigDecimal(rechargeRecord1.getAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getBalance()).add(new BigDecimal(driver1.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | DriverServiceImpl.this.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(transaction_id); |
| | | rechargeRecord1.setOrderNumber(merOrderId); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | return; |
| | | break; |
| | | } |
| | | if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if(10 == num){ |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | } |
| | | }).start(); |
| | | return weixinpay; |
| | | } |
| | | return ResultUtil.success(payCode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 司机端跳小程序支付 |
| | | * @param driverId |
| | | * @param jscode |
| | | * @param amount |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil balanceRecharge1(Integer driverId, String jscode, Double amount) throws Exception { |
| | | Code2Session code2Session = weChatUtil.code2Session(jscode); |
| | | if(null != code2Session.getErrcode() && code2Session.getErrcode() != 0){ |
| | | return ResultUtil.error(code2Session.getErrmsg()); |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | | Driver driver = this.selectById(driverId); |
| | | driver.setOpenid(openid); |
| | | this.updateById(driver); |
| | | return balanceRecharge(driverId, amount); |
| | | } |
| | | |
| | | /** |
| | | * 充值回调通知逻辑处理 |
| | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(rechargeRecord1.getUserId()); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setChangeType(3); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("余额充值"); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setBalance(driver1.getBalance() + rechargeRecord1.getAmount()); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("账户充值"); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getBalance()).add(new BigDecimal(driver1.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver1.setBalance(new BigDecimal(driver1.getBalance()).add(new BigDecimal(rechargeRecord1.getAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getBalance()).add(new BigDecimal(driver1.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | this.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(transaction_id); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil microenterprise(Integer uid, String name, String number, String phone) throws Exception { |
| | | public ResultUtil microenterprise(Integer uid, String name, String number, String phone, String notifyUrl) throws Exception { |
| | | Driver driver = this.selectById(uid); |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("driver_" + uid); |
| | | registerVO.setMerUserId(driver.getCode());//"driver_" + uid |
| | | registerVO.setPhone(phone); |
| | | registerVO.setUserType("0"); |
| | | registerVO.setUserName(name); |
| | | registerVO.setCertId(number); |
| | | registerVO.setNotifyUrl(""); |
| | | registerVO.setNotifyUrl(callbackPath + notifyUrl); |
| | | registerVO.setParameter1(uid.toString()); |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | driver.setMerchantIDCode(number); |
| | | driver.setMerchantName(name); |
| | | driver.setMerchantPhone(phone); |
| | | this.updateById(driver); |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String userId = jsonObject.getString("userId"); |
| | |
| | | @Override |
| | | public ResultUtil driverWork(Integer driverId) throws Exception { |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(ToolUtil.isEmpty(driver.getMerchantNumber())){ |
| | | return ResultUtil.error("请先注册商户号"); |
| | | } |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | Double num1 = JSON.parseObject(systemConfig.getContent()).getDouble("num1"); |
| | | if(driver.getBalance() == null || driver.getBalance().compareTo(num1) < 0){ |
| | | return ResultUtil.error("账户余额不足,请先充值"); |
| | | } |
| | | systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num5 = jsonObject.getInteger("num5"); |
| | | OrderTransfer orderTransfer = orderTransferService.selectOne(new EntityWrapper<OrderTransfer>().eq("oldDriverId", driverId) |
| | | .eq("status", 1).isNotNull("successTime").orderBy("createTime desc limit 0, 1")); |
| | | if(null != orderTransfer){ |
| | | int i = Double.valueOf((System.currentTimeMillis() - orderTransfer.getSuccessTime().getTime()) / 60000).intValue(); |
| | | if(num5 > i){ |
| | | return ResultUtil.error("暂时还无法上班,请" + (num5 - i) + "分钟后重试"); |
| | | } |
| | | } |
| | | // systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | // JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | // Integer num5 = jsonObject.getInteger("num5"); |
| | | // OrderTransfer orderTransfer = orderTransferService.selectOne(new EntityWrapper<OrderTransfer>().eq("oldDriverId", driverId) |
| | | // .eq("status", 1).isNotNull("successTime").orderBy("createTime desc limit 0, 1")); |
| | | // if(null != orderTransfer){ |
| | | // int i = Double.valueOf((System.currentTimeMillis() - orderTransfer.getSuccessTime().getTime()) / 60000).intValue(); |
| | | // if(num5 > i){ |
| | | // return ResultUtil.error("暂时还无法上班,请" + (num5 - i) + "分钟后重试"); |
| | | // } |
| | | // } |
| | | |
| | | DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverId).eq("status", 1)); |
| | | if(null != driverWork){ |
| | |
| | | driverService.updateById(driver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void taskDriverOffWork() { |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | Double num1 = JSON.parseObject(systemConfig.getContent()).getDouble("num1"); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1).lt("balance", num1)); |
| | | for (Driver driver : drivers) { |
| | | DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver.getId()).eq("status", 1)); |
| | | if(null != driverWork){ |
| | | driverWork.setStatus(2); |
| | | driverWork.setOffWorkTime(new Date()); |
| | | this.updateById(driverWork); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public void saveOrderPosition(DriverPositionWarpper driverPositionWarpper) throws Exception { |
| | | Integer orderId = driverPositionWarpper.getOrderId(); |
| | | Integer driverId = driverPositionWarpper.getDriverId(); |
| | | Order order = orderService.selectById(orderId); |
| | | if(null == order.getDriverId() || order.getDriverId().compareTo(driverId) != 0){ |
| | | return; |
| | | } |
| | | if(order.getState() != 105 && order.getState() != 401){ |
| | | return; |
| | | } |
| | | Integer orderType = driverPositionWarpper.getOrderType(); |
| | | File file = new File(filePath + orderId + ".json"); |
| | | if(!file.exists()){ |
| | |
| | | OrderPositionWarpper orderPositionWarpper = orderPositionWarppers.get(orderPositionWarppers.size() - 1); |
| | | saveOrderMileage(driverPositionWarpper, orderPositionWarpper); |
| | | } |
| | | //大于50米才存储有效定位数据 |
| | | //大于100米才存储有效定位数据 |
| | | if(orderPositionWarppers.size() > 0){ |
| | | OrderPositionWarpper orderPositionWarpper1 = orderPositionWarppers.get(orderPositionWarppers.size() - 1); |
| | | String fromLonLat = driverPositionWarpper.getLon() + "," + driverPositionWarpper.getLat(); |
| | | String toLonLat = orderPositionWarpper1.getLon() + "," + orderPositionWarpper1.getLat(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(fromLonLat, toLonLat); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(wgs84 >= 50){ |
| | | |
| | | // long timeMillis = System.currentTimeMillis(); |
| | | // long time = orderPositionWarpper1.getInsertTime().getTime(); |
| | | // long t = timeMillis - time; |
| | | // if(wgs84 >= 200 && t <= 8){//排除位置漂移 |
| | | // return; |
| | | // } |
| | | |
| | | if(wgs84 >= 50){//5秒165米 |
| | | OrderPositionWarpper orderPositionWarpper = new OrderPositionWarpper(); |
| | | BeanUtils.copyProperties(driverPositionWarpper, orderPositionWarpper); |
| | | orderPositionWarpper.setInsertTime(new Date()); |
| | |
| | | Order order = orderService.selectById(driverPositionWarpper.getOrderId()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | Integer num = map.get(order.getId().toString()); |
| | | if(50 < wgs84){ |
| | | |
| | | // long timeMillis = System.currentTimeMillis(); |
| | | // long time = orderPositionWarpper.getInsertTime().getTime(); |
| | | // long t = timeMillis - time; |
| | | // if(wgs84 >= 200 && t <= 8){//排除位置漂移 |
| | | // return; |
| | | // } |
| | | |
| | | if(50 < wgs84){//5秒165米 |
| | | order.setActualMileage(order.getActualMileage() + wgs84.intValue()); |
| | | orderService.updateById(order); |
| | | map.put(order.getId().toString(), 0); |
| | |
| | | } |
| | | } |
| | | } |
| | | if(50 >= wgs84 && 12 <= (null == num ? 0 : num)){//1分钟(5秒上传一次数据) |
| | | |
| | | if(50 >= wgs84 && 6 <= (null == num ? 0 : num)){//30秒(5秒上传一次数据) |
| | | Integer integer = map.get(order.getId().toString()); |
| | | map.put(order.getId().toString(), null == integer ? 0 : integer++); |
| | | map.put(order.getId().toString(), null == integer ? 0 : integer + 1); |
| | | //进入等待状态 |
| | | if(order.getState() == 401){ |
| | | return; |
| | | } |
| | | ProcessOperationsWarpper processOperationsWarpper = new ProcessOperationsWarpper(); |
| | | processOperationsWarpper.setOrderId(order.getId()); |
| | | processOperationsWarpper.setState(401); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if(50 >= wgs84 && 12 > (null == num ? 0 : num)){ |
| | | if(50 >= wgs84 && 6 > (null == num ? 0 : num)){ |
| | | Integer integer = map.get(order.getId().toString()); |
| | | map.put(order.getId().toString(), null == integer ? 0 : integer++); |
| | | map.put(order.getId().toString(), null == integer ? 0 : integer + 1); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void initMap(Long orderId) throws Exception { |
| | | map.put(orderId.toString(), 0); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | |
| | | import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.HallOrderList; |
| | | import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Circle; |
| | | import org.springframework.data.geo.Distance; |
| | | import org.springframework.data.geo.Metrics; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | */ |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | |
| | | @Autowired |
| | | private IUserToCouponService userToCouponService; |
| | | |
| | | private Map<String, Timer> timerMap = new HashMap<>(); |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | @Autowired |
| | | private IAgentService agentService; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | |
| | | |
| | |
| | | driver.setServerStatus(2); |
| | | order.setOrderTakingTime(new Date()); |
| | | } |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(5)); |
| | | order.setSource(2); |
| | | |
| | | AppUser appUser = appUserService.selectOne(new EntityWrapper<AppUser>().eq("phone", addOrderWarpper.getPhone()).eq("status", 1)); |
| | | if(null != appUser){ |
| | | order.setUserId(appUser.getId()); |
| | | } |
| | | |
| | | |
| | | String startAddress = addOrderWarpper.getStartAddress(); |
| | | startAddress = startAddress.replaceAll("& #40;", "("); |
| | | startAddress = startAddress.replaceAll("& #41;", ")"); |
| | | addOrderWarpper.setStartAddress(startAddress); |
| | | if(ToolUtil.isNotEmpty(addOrderWarpper.getEndAddress())){ |
| | | String endAddress = addOrderWarpper.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | addOrderWarpper.setEndAddress(endAddress); |
| | | } |
| | | |
| | | order.setUserName(addOrderWarpper.getUserName()); |
| | | order.setUserPhone(addOrderWarpper.getPhone()); |
| | | order.setAgentId(driver.getAgentId()); |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order.setCreateTime(new Date()); |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | | order.setState(null == order.getDriverId() ? 101 : 102); |
| | | order.setStatus(1); |
| | | order.setCreateTime(new Date()); |
| | | this.insert(order); |
| | | driverService.updateById(driver); |
| | | //推送状态 |
| | | if(null != order.getDriverId()){ |
| | | //推动订单数据 |
| | | redisUtil.addSetValue("orderService", order.getId().toString()); |
| | | pushUtil.pushOrderStatus(uid, 2, order.getId(), order.getStatus()); |
| | | }else{ |
| | | //开始推单 |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushOrder(finalOrder); |
| | | pushOrder(finalOrder.getId()); |
| | | } |
| | | }).start(); |
| | | } |
| | |
| | | * @param city 查询天气的城市 |
| | | * @return |
| | | */ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city) throws Exception{ |
| | | order = getOrderInitialPrice(order); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | if(null == systemConfig){ |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | Date date = order.getCreateTime(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | |
| | | Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | String[] split1 = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split1[0]); |
| | | |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | s.set(Calendar.SECOND, 59); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(num3.compareTo(distance) >= 0){//起步里程内 |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | Double distance1 = distance;//原始里程 |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 |
| | | order.setOverDriveDistance(new BigDecimal(distance1 - num3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//超出起步里程 |
| | | |
| | | distance = new BigDecimal(distance).setScale(0, RoundingMode.UP).doubleValue();//向上取整 |
| | | BigDecimal divide = new BigDecimal(distance - num3).divide(new BigDecimal(num5), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 |
| | | |
| | | //计算长途费 |
| | | //计算长途费(超出长途起始公里,费用开始按照长途规则计算。) |
| | | if(distance.compareTo(num7) > 0){ |
| | | order.setStartDistance(0D);//起步里程 |
| | | order.setStartPrice(0D);//起步价 |
| | | order.setOverDriveDistance(0D);//超出起步里程 |
| | | order.setOverDrivePrice(0D);//超出起步里程费 |
| | | |
| | | order.setLongDistance(num7 + "-" + num8);//长途里程 |
| | | order.setLongDistancePrice(num9);//长途费 |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | order.setOverLongDistance(new BigDecimal(distance1 - num8).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//超出长途里程 |
| | | |
| | | BigDecimal divide1 = new BigDecimal(distance - num8).divide(new BigDecimal(num10), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | | order.setWaitTime(num1);//等待时长 |
| | | if(waitTime.compareTo(num1 * 60) >= 0){ |
| | | order.setWaitTime(num1 * 60);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | Integer w = waitTime - (num1 * 60); |
| | | BigDecimal multiply = new BigDecimal(w).divide(new BigDecimal(60), 0, RoundingMode.UP).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | | }else{ |
| | | order.setWaitTime(waitTime);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | } |
| | | |
| | | //恶劣天气 |
| | |
| | | order.setLongDistancePrice(0D);//长途里程费 |
| | | order.setOverLongDistance(0D);//超出长途里程 |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | order.setWaitTime(0);//等待时长 |
| | | // order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | |
| | | |
| | | /** |
| | | * 订单推送逻辑 |
| | | * @param order |
| | | */ |
| | | public void pushOrder(Order order){ |
| | | public void pushOrder(Long orderId){ |
| | | try { |
| | | Order order = this.selectById(orderId); |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | | * 没有1 - 》 |
| | |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | boolean lock = redisUtil.lock(orderId.toString(), 5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId.toString(),5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | redisUtil.unlock(orderId.toString()); |
| | | return; |
| | | } |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | redisUtil.unlock(orderId.toString()); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | |
| | | YouTuiDriver youTuiDriver1 = null; |
| | | if(driverIds.size() > 0){ |
| | | List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds) |
| | | .eq("state", 2).last(" and (surplusQuantity > 0 or now() < endTime) and now() < failureTime")); |
| | | .eq("state", 2).last(" and surplusQuantity > 0 and now() < endTime and now() < failureTime")); |
| | | Double d = null; |
| | | for (YouTuiDriver youTuiDriver : youTuiDrivers) { |
| | | String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", youTuiDriver.getDriverId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1 || count > 0){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(null != youTuiDriver1 && youTuiDriver1.getType() == 1){ |
| | | youTuiDriver1.setSurplusQuantity(youTuiDriver1.getSurplusQuantity() - 1); |
| | | youTuiDriverService.updateById(youTuiDriver1); |
| | |
| | | |
| | | driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() > 0){ |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("serverStatus", 1).eq("status", 1).in("id", driverIds)); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | continue; |
| | | } |
| | | |
| | | Integer integral = null; |
| | | Double score = null; |
| | | Integer integral = null;//积分 |
| | | Double score = null;//评分 |
| | | Double d = null; |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", driver1.getId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(count > 0){ |
| | | continue; |
| | | } |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) < 0){//积分相同对比评分 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | d = wgs84; |
| | | continue; |
| | | } |
| | | if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离 |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | if(d == null || d.compareTo(wgs84) > 0){ |
| | | if(d.compareTo(wgs84) > 0){ |
| | | d = wgs84; |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | | driver = driver1.getId(); |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | if(null != driver){ |
| | | //防止多笔订单推给一个司机 |
| | | Driver driver1 = driverService.selectById(driver); |
| | | driver1.setServerStatus(2); |
| | | driverService.updateById(driver1); |
| | | pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); |
| | | //创建定时任务处理订单到大厅 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | if(order1.getState() != 101 && order1.getState() != 201 && order1.getState() != 301 && order1.getDriverId().compareTo(driver1.getId()) != 0){ |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | if(order1.getState() == 201 || order1.getState() == 301 || (order1.getState() == 101 && null == order1.getDriverId())){ |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | } |
| | | if(order1.getState() == 201 || (order1.getState() == 101 && null == order1.getDriverId())){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | ExtraPushOrder(order); |
| | | } |
| | | |
| | | |
| | | } |
| | | }, num4 * 1000); |
| | | }else{ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | } |
| | | redisUtil.unlock(orderId.toString()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | redisUtil.unlock(orderId.toString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public void ExtraPushOrder(Order order){ |
| | | String startLat = order.getStartLat(); |
| | | String startLng = order.getStartLng(); |
| | | |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); |
| | | Double num = 5D;//范围公里 |
| | | //构造半径 |
| | | Distance distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() == 0){ |
| | | return; |
| | | } |
| | | List<DriverWork> tDriverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", driverIds).eq("status", 1)); |
| | | driverIds = tDriverWorks.stream().map(DriverWork::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | return; |
| | | } |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if (ToolUtil.isEmpty(value)) { |
| | | continue; |
| | | } |
| | | pushUtil.pushGrabOrderExtras(driver1.getId(), 2); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | List<HallOrderList> hallOrderLists = this.baseMapper.queryOrderHall(pageNum, pageSize); |
| | | List<HallOrderList> lists = new ArrayList<>(); |
| | | hallOrderLists.forEach(hallOrderList -> { |
| | | if(ToolUtil.isEmpty(hallOrderList.getAvatar())){ |
| | | hallOrderList.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/66cc269703a84e4da87fb21e2c21ab1f.png"); |
| | |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(hallOrderList.getStartLng() + "," + hallOrderList.getStartLat(), value); |
| | | Double wgs84 = distance.get("WGS84"); |
| | | hallOrderList.setCurrentDistance(wgs84); |
| | | |
| | | if(wgs84 > 5000){ |
| | | return; |
| | | } |
| | | }else{ |
| | | hallOrderList.setCurrentDistance(0D); |
| | | return; |
| | | } |
| | | lists.add(hallOrderList); |
| | | }); |
| | | return hallOrderLists; |
| | | return lists; |
| | | } |
| | | |
| | | |
| | |
| | | orderRefusalService.insert(orderRefusal); |
| | | |
| | | Driver driver = driverService.selectById(uid); |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | |
| | | //扣除积分 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig) { |
| | |
| | | Integer num10 = JSON.parseObject(systemConfig.getContent()).getInteger("num10"); |
| | | if (num10 > 0) { |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(uid); |
| | | accountChangeDetail.setType(2); |
| | |
| | | if(count > 0){ |
| | | return ResultUtil.error("还有未完成的订单"); |
| | | } |
| | | boolean lock = redisUtil.lock(); |
| | | boolean lock = redisUtil.lock(orderId.toString(), 5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId.toString(),5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | redisUtil.unlock(orderId.toString()); |
| | | return ResultUtil.error("请重试"); |
| | | } |
| | | Order order = this.selectById(orderId); |
| | | Integer state = order.getState(); |
| | | Integer oldDriverId = order.getDriverId(); |
| | | if(state == 301){ |
| | | redisUtil.unlock(); |
| | | redisUtil.unlock(orderId.toString()); |
| | | return ResultUtil.error("订单已被取消"); |
| | | } |
| | | if(state != 101 && state != 201){ |
| | | redisUtil.unlock(); |
| | | redisUtil.unlock(orderId.toString()); |
| | | return ResultUtil.error("手速慢了哦"); |
| | | } |
| | | order.setDriverId(uid); |
| | |
| | | order.setState(102); |
| | | order.setOrderTakingTime(new Date()); |
| | | this.updateById(order); |
| | | redisUtil.unlock(); |
| | | redisUtil.unlock(orderId.toString()); |
| | | |
| | | if(null != order.getUserId()){ |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | |
| | | driverService.updateById(driver); |
| | | if(state == 201){//转单的订单 |
| | | //停止定时任务 |
| | | Timer timer = timerMap.get(order.getId().toString()); |
| | | if(null != timer){ |
| | | timer.cancel(); |
| | | timerMap.remove(order.getId().toString()); |
| | | } |
| | | //原司机下班 |
| | | redisUtil.delSetValue("orderService", order.getId().toString()); |
| | | //原司机下班 TODO 2023-06-21 客户说取消此功能 |
| | | Driver oldDriver = driverService.selectById(oldDriverId); |
| | | oldDriver.setServerStatus(1); |
| | | driverService.updateById(oldDriver); |
| | | |
| | | DriverWork driverWork1 = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", oldDriverId).eq("status", 1)); |
| | | driverWork1.setStatus(2); |
| | | driverWork1.setOffWorkTime(new Date()); |
| | | driverWorkService.updateById(driverWork1); |
| | | // DriverWork driverWork1 = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", oldDriverId).eq("status", 1)); |
| | | // driverWork1.setStatus(2); |
| | | // driverWork1.setOffWorkTime(new Date()); |
| | | // driverWorkService.updateById(driverWork1); |
| | | |
| | | //添加关系数据 |
| | | OrderTransfer orderTransfer = orderTransferService.selectOne(new EntityWrapper<OrderTransfer>().eq("orderId", order.getId()).eq("status", 1).isNull("successTime")); |
| | |
| | | orderTransfer.setSuccessTime(new Date()); |
| | | orderTransferService.insert(orderTransfer); |
| | | } |
| | | |
| | | pushUtil.pushTransferSuccessful(order.getUserId(), 1, order.getId()); |
| | | pushUtil.pushTransferSuccessful(oldDriverId, 2, order.getId()); |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushTransferSuccessful(order.getUserId(), 1, order.getId()); |
| | | } |
| | | } |
| | | |
| | | //推动订单数据 |
| | | pushOrderInfo(order.getId(), uid);//开始推送订单数据 |
| | | redisUtil.addSetValue("orderService", order.getId().toString()); |
| | | //发送系统消息 |
| | | systemMessageService.addSystemMessage(uid, 2, "接单成功", "您已成功接到用户订单,请尽快联系客户!"); |
| | | pushUtil.pushOrderStatus(order.getDriverId(), 2, order.getId(), order.getState()); |
| | |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | } |
| | | }catch (Exception e){ |
| | | redisUtil.unlock(); |
| | | redisUtil.unlock(orderId.toString()); |
| | | e.printStackTrace(); |
| | | throw e; |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(orderId); |
| | | Integer wait = Integer.valueOf(orderInfoWarpper.getWaitTime()); |
| | | if(null != order.getStartWaitTime()){ |
| | | wait += Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 1000).intValue(); |
| | | } |
| | | Integer s = wait % 60; |
| | | int m = Double.valueOf(wait / 60).intValue(); |
| | | orderInfoWarpper.setWaitTime((m < 10 ? ("0" + m) : m) + ":" + (s < 10 ? ("0" + s) : s)); |
| | | Double actualMileage = orderInfoWarpper.getActualMileage(); |
| | | orderInfoWarpper.setActualMileage(new BigDecimal(actualMileage / 1000).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | if(orderInfoWarpper.getTravelTime() == null){ |
| | | orderInfoWarpper.setTravelTime(0); |
| | | } |
| | |
| | | Map<String, String> distance1 = MapUtil.getDistance(orderInfoWarpper.getStartLng() + "," + orderInfoWarpper.getStartLat(), value, 0); |
| | | orderInfoWarpper.setPickUpTime(Integer.valueOf(distance1.get("duration")) / 60); |
| | | } |
| | | orderInfoWarpper.setDriverId(order.getDriverId()); |
| | | return orderInfoWarpper; |
| | | } |
| | | |
| | |
| | | order.setStartTime(new Date()); |
| | | } |
| | | //计算等待用户时长 |
| | | Integer w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 60000).intValue(); |
| | | Integer w = new BigDecimal(Double.valueOf(System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 1000).intValue(); |
| | | order.setWaitTime(order.getWaitTime() + w); |
| | | order.setStartWaitTime(null); |
| | | orderPositionService.initMap(order.getId()); |
| | | break; |
| | | case 106: |
| | | order.setGetoffTime(new Date()); |
| | | if(ToolUtil.isEmpty(order.getEndAddress())){ |
| | | |
| | | String endAddress = processOperationsWarpper.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | processOperationsWarpper.setEndAddress(endAddress); |
| | | |
| | | order.setEndAddress(processOperationsWarpper.getEndAddress()); |
| | | order.setEndLng(processOperationsWarpper.getEndLng()); |
| | | order.setEndLat(processOperationsWarpper.getEndLat()); |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(2, Double.valueOf(order.getActualMileage() / 1000), order.getWaitTime(), order, city); |
| | | try { |
| | | order = getOrderPrice(2, Double.valueOf(order.getActualMileage()) / 1000, order.getWaitTime(), order, city); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.error("计算费用异常"); |
| | | } |
| | | Coupon coupon = userToCouponService.queryCoupon(order.getUserId(), order.getOrderMoney()); |
| | | if(null != coupon){ |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | order.setPayMoney(order.getOrderMoney() - coupon.getCouponPreferentialAmount()); |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(coupon.getId()); |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | }else{ |
| | | order.setPayMoney(order.getOrderMoney()); |
| | | } |
| | | |
| | | //修改司机状态和积分 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | saveIntegral(order); |
| | | redisUtil.delSetValue("orderService", order.getId().toString()); |
| | | break; |
| | | case 401: |
| | | order.setStartWaitTime(new Date()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加订单积分奖励 |
| | | * @param order |
| | |
| | | Integer num5 = JSON.parseObject(systemConfig.getContent()).getInteger("num5"); |
| | | if(num5 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); |
| | | driver.setIntegral(driver.getIntegral() + num5); |
| | | accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); |
| | |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | //恶劣天气完成订单奖励 |
| | | String city = ""; |
| | | District geocode = MapUtil.geocode(order.getEndLng(), order.getEndLat()); |
| | | if(null != geocode){ |
| | | WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | boolean badWeather = WeatherUtil.isBadWeather(city); |
| | | if(badWeather){ |
| | | Integer num8 = JSON.parseObject(systemConfig.getContent()).getInteger("num8"); |
| | | if(num8 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setType(2); |
| | |
| | | accountChangeDetail.setExplain("恶劣天气完成订单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | } |
| | | driverService.updateById(driver); |
| | | |
| | | if(null == order.getUserId()){ |
| | | return; |
| | | } |
| | | //推荐用户首单完成奖励 |
| | | Integer num4 = JSON.parseObject(systemConfig.getContent()).getInteger("num4"); |
| | | if(num4 > 0){ |
| | | List<Integer> state = Arrays.asList(105); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", order.getUserId()).eq("status", 1).in("state", state)); |
| | | if(count > 1){ |
| | | return; |
| | | } |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | if(null != appUser && null != appUser.getInviterType()){ |
| | | if(appUser.getInviterType() == 1){ |
| | | return; |
| | | } |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐用户完成首单奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * 定时任务推送订单数据 |
| | | * @param orderId |
| | | * @param uid |
| | | */ |
| | | public void pushOrderInfo(Long orderId, Integer uid){ |
| | | Timer timer = new Timer(); |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | Order order = OrderServiceImpl.this.selectById(orderId); |
| | | public void pushOrderInfo(Long orderId){ |
| | | Order order = this.selectById(orderId); |
| | | Integer driverId = order.getDriverId(); |
| | | String value = redisUtil.getValue("DRIVER" + driverId); |
| | | if(order.getState() == 106 || order.getState() == 301){ |
| | | Timer timer = timerMap.get(order.getId().toString()); |
| | | if(null != timer){ |
| | | timer.cancel(); |
| | | timerMap.remove(order.getId().toString()); |
| | | } |
| | | redisUtil.delSetValue("orderService", orderId.toString()); |
| | | return; |
| | | } |
| | | |
| | | PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); |
| | |
| | | pushOrderInfoWarpper.setDriverLat(split[1]); |
| | | pushOrderInfoWarpper.setDriverLng(split[0]); |
| | | } |
| | | int w = 0; |
| | | Integer w = 0; |
| | | if(null != order.getStartWaitTime()){ |
| | | w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 60000).intValue(); |
| | | w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 1000).intValue(); |
| | | } |
| | | pushOrderInfoWarpper.setWaitTime(order.getWaitTime() + w); |
| | | Integer wait = order.getWaitTime() + w; |
| | | Integer s = wait % 60; |
| | | Integer m = wait / 60; |
| | | pushOrderInfoWarpper.setWaitTime((m < 10 ? ("0" + m) : m) + ":" + (s < 10 ? ("0" + s) : s)); |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushOrderInfoWarpper.setActualMileage(Double.valueOf(order.getActualMileage() / 1000)); |
| | | pushOrderInfoWarpper.setTravelTime(0); |
| | | if(null != order.getStartTime()){ |
| | | int travelTime = Double.valueOf((System.currentTimeMillis() - order.getStartTime().getTime()) / 60000).intValue(); |
| | | pushOrderInfoWarpper.setTravelTime(travelTime); |
| | | } |
| | | pushOrderInfoWarpper.setActualMileage(new BigDecimal(order.getActualMileage()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | pushOrderInfoWarpper.setTravelTime("0"); |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushOrderInfo(order.getUserId(), 1, pushOrderInfoWarpper); |
| | | } |
| | |
| | | return; |
| | | } |
| | | } |
| | | pushUtil.pushOrderInfo(uid, 2, pushOrderInfoWarpper); |
| | | } |
| | | },0, 10000); |
| | | timerMap.put(orderId.toString(), timer); |
| | | pushUtil.pushOrderInfo(driverId, 2, pushOrderInfoWarpper); |
| | | } |
| | | |
| | | |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushOrder(finalOrder); |
| | | pushOrder(finalOrder.getId()); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |
| | |
| | | @Override |
| | | public ResultUtil setOrderEndAddress(Integer uid, OrderEndAddressWarpper orderEndAddressWarpper) throws Exception { |
| | | Order order = this.selectById(orderEndAddressWarpper.getOrderId()); |
| | | |
| | | String endAddress = orderEndAddressWarpper.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | orderEndAddressWarpper.setEndAddress(endAddress); |
| | | |
| | | order.setEndLat(orderEndAddressWarpper.getEndLat()); |
| | | order.setEndLng(orderEndAddressWarpper.getEndLng()); |
| | | order.setEndAddress(orderEndAddressWarpper.getEndAddress()); |
| | |
| | | @Override |
| | | public ResultUtil driverCancelOrder(Integer uid, Long orderId, String cause) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | if(null == order){ |
| | | return ResultUtil.error("订单数据异常"); |
| | | } |
| | | if(uid.compareTo(order.getDriverId()) != 0){ |
| | | return ResultUtil.error("无法取消订单"); |
| | | } |
| | |
| | | |
| | | order.setState(301); |
| | | this.updateById(order); |
| | | redisUtil.delSetValue("orderService", orderId.toString()); |
| | | |
| | | CancelOrder cancelOrder = new CancelOrder(); |
| | | cancelOrder.setOrderId(orderId); |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getStatus()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | Driver driver = driverService.selectById(uid); |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | orderPriceWarpper.setWaitTime(orderPriceWarpper.getWaitTime() + orderPriceWarpper.getOutWaitTime()); |
| | | orderPriceWarpper.setWaitTimePrice(orderPriceWarpper.getWaitTimePrice() + orderPriceWarpper.getOutWaitTimePrice()); |
| | | orderPriceWarpper.setLongDistance(0D); |
| | | if(ToolUtil.isNotEmpty(order.getLongDistance())){ |
| | | orderPriceWarpper.setStartTime(order.getArrivalTimeAtTheAppointmentPoint().getTime()); |
| | | orderPriceWarpper.setEndTime(order.getGetoffTime().getTime()); |
| | | orderPriceWarpper.setActualMileage(Double.valueOf(order.getActualMileage()) / 1000); |
| | | if(null != order.getStartPrice() && 0 != order.getStartPrice()){ |
| | | orderPriceWarpper.setStartPrice(order.getStartPrice()); |
| | | orderPriceWarpper.setStartDistance(order.getStartDistance()); |
| | | orderPriceWarpper.setOverDriveDistance(order.getOverDriveDistance()); |
| | | orderPriceWarpper.setMileageFee(order.getOverDrivePrice()); |
| | | }else{ |
| | | if(order.getLongDistance().indexOf("-") >= 0){ |
| | | String[] split = order.getLongDistance().split("-"); |
| | | Double longDistanc = Double.valueOf(split[1]) - Double.valueOf(split[0]) + orderPriceWarpper.getOverLongDistance(); |
| | | orderPriceWarpper.setLongDistance(longDistanc); |
| | | orderPriceWarpper.setStartPrice(order.getLongDistancePrice()); |
| | | orderPriceWarpper.setStartDistance(Double.valueOf(split[1])); |
| | | orderPriceWarpper.setOverDriveDistance(order.getOverLongDistance()); |
| | | orderPriceWarpper.setMileageFee(order.getOverLongDistancePrice()); |
| | | } |
| | | orderPriceWarpper.setLongDistancePrice(orderPriceWarpper.getLongDistancePrice() + orderPriceWarpper.getOverLongDistancePrice()); |
| | | orderPriceWarpper.setBadWeatherDistance(orderPriceWarpper.getBadWeatherDistance() + orderPriceWarpper.getOverBadWeatherDistance()); |
| | | orderPriceWarpper.setBadWeatherPrice(orderPriceWarpper.getBadWeatherPrice() + orderPriceWarpper.getOverBadWeatherPrice()); |
| | | |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(0); |
| | | if(null != order.getGetoffTime()){ |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | } |
| | | Integer waitTime = order.getWaitTime() + order.getOutWaitTime(); |
| | | Integer s = waitTime % 60; |
| | | Integer m = waitTime / 60; |
| | | orderPriceWarpper.setWaitTime((m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s)); |
| | | orderPriceWarpper.setWaitTimePrice(order.getWaitTimePrice() + order.getOutWaitTimePrice()); |
| | | orderPriceWarpper.setDiscountAmount(order.getDiscountAmount()); |
| | | orderPriceWarpper.setDiscountedPrice(order.getDiscountedPrice()); |
| | | orderPriceWarpper.setBadWeatherPrice(order.getBadWeatherPrice()); |
| | | orderPriceWarpper.setPayMoney(order.getPayMoney()); |
| | | if(order.getState() < 106){ |
| | | orderPriceWarpper.setPayMoney(order.getOrderMoney()); |
| | | } |
| | | orderPriceWarpper.setWxCollectionCode(driver.getWxCollectionCode()); |
| | | orderPriceWarpper.setZfbCollectionCode(driver.getZfbCollectionCode()); |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer payType, Integer state) throws Exception { |
| | | List<Integer> s = Arrays.asList(107, 108); |
| | | if(!s.contains(state)){ |
| | | return ResultUtil.error("操作失败"); |
| | | try { |
| | | boolean lock = redisUtil.lock(orderId + "",5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId + "",5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.error("请稍后重试"); |
| | | } |
| | | |
| | | Order order = this.selectById(orderId); |
| | | if(state == 107 && order.getState() != 106){ |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.error("操作失败,请刷新数据"); |
| | | } |
| | | if(state == 108 && order.getState() != 107){ |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.error("操作失败,请刷新数据"); |
| | | } |
| | | |
| | | order.setState(state); |
| | | |
| | | if(payType == 2 && state == 107){ |
| | | order.setPayType(3); |
| | | Coupon coupon = userToCouponService.queryCoupon(order.getUserId(), order.getOrderMoney()); |
| | | if(null != coupon){ |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountAmount(coupon.getCouponPreferentialAmount()); |
| | | order.setPayMoney(order.getOrderMoney() - coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | |
| | | if(payType == 2 && state == 108){ |
| | | order.setPayTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | order.setPayMoney(order.getPayMoney() - coupon.getCouponPreferentialAmount()); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(coupon.getCouponPreferentialAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(discountedPrice) >= 0){ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | discountedPrice = new BigDecimal(discountedPrice).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.updateById(order); |
| | | |
| | | if(state == 108){//计算抽成 |
| | | if((payType == 1 && state == 107) || (payType == 2 && state == 108)){ |
| | | //修改司机状态和积分 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(payType == 2 && state == 108){//计算抽成 |
| | | saveRevenue(order); |
| | | } |
| | | |
| | |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | } |
| | | |
| | | if(payType == 2 && state == 107){ |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | OrderServiceImpl.this.setOrderStatus(uid, orderId, payType, 108); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }, 60000); |
| | | } |
| | | redisUtil.unlock(orderId + ""); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | redisUtil.unlock(orderId + ""); |
| | | e.printStackTrace(); |
| | | return ResultUtil.error("系统异常"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 转账 |
| | | * @param id |
| | | * @param merOrderId |
| | | * @param toUserId |
| | | * @param amount |
| | | * @param notifyUrl |
| | | * @return |
| | | */ |
| | | public ResultUtil<Double> zhaunzhang(Integer id, String merOrderId, String toUserId, Double amount, String notifyUrl){ |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId(merOrderId); |
| | | transfer.setToUserId(toUserId); |
| | | transfer.setAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | transfer.setOrderName("补贴"); |
| | | transfer.setNotifyUrl(notifyUrl); |
| | | transfer.setParameter1(id.toString()); |
| | | TrhRequest<Transfer> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(transfer, Transfer.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status");//0:待处理;1:成功;2:失败 |
| | | if("2" == status){ |
| | | System.err.println("转账失败"); |
| | | return ResultUtil.error("转账失败"); |
| | | } |
| | | Double remainAmount = Double.valueOf(jsonObject.getInteger("remainAmount")) / 100; |
| | | return ResultUtil.success(remainAmount); |
| | | }else{ |
| | | System.err.println("转账失败:" + execute.getMsg()); |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 计算抽成和分佣 |
| | | * 计算线下收款的抽成和分佣 |
| | | * @param order |
| | | */ |
| | | public void saveRevenue(Order order) throws Exception{ |
| | |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | Double payMoney = order.getPayMoney(); |
| | | |
| | | if(null != order.getUserId()){ |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", order.getUserId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | //首单积分奖励 |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig1.getContent()); |
| | | Integer num4 = jsonObject2.getInteger("num4"); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户首单积分奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | } |
| | | |
| | | |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | Double n = 0D; |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num2 = jsonObject.getDouble("num2"); |
| | | Double num3 = jsonObject.getDouble("num3"); |
| | | n = num3; |
| | | if(order.getPayMoney() >= num2){ |
| | | payMoney = payMoney - num3;//司机收入 |
| | | if(order.getOrderMoney() >= num2){//订单金额大于num2才有抽佣金 |
| | | driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail1 = new AccountChangeDetail(); |
| | | accountChangeDetail1.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail1.setUserType(2); |
| | | accountChangeDetail1.setUserId(driver.getId()); |
| | | accountChangeDetail1.setType(1); |
| | | accountChangeDetail1.setChangeType(9); |
| | | accountChangeDetail1.setOrderId(order.getId()); |
| | | accountChangeDetail1.setOldData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setExplain("订单信息费"); |
| | | accountChangeDetail1.setCreateTime(new Date()); |
| | | driver.setBalance(new BigDecimal(driver.getBalance()).subtract(new BigDecimal(num3)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setNewData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail1); |
| | | |
| | | |
| | | //有分佣的情况,分佣的金额从司机充值金额中扣除转给分佣对象 |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); |
| | | if(null != systemConfig1){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | //司机推荐用户收入 |
| | | if(null != appUser && null != appUser.getInviterType() && appUser.getInviterType() == 2){ |
| | | Double num1 = jsonObject1.getDouble("num1"); |
| | | num1 = (num3 >= num1 ? num1 : num3); |
| | | |
| | | if(num1 > 0){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | //首单积分奖励 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driverService.updateById(driver1); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(2); |
| | |
| | | revenue.setAmount(num1); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | Double num1_1 = num1; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num1_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num1_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num1_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | num3 = (num3 >= num1 ? num3 - num1 : 0); |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num1_1 = new BigDecimal(num1_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num1 ? v : 0); |
| | | } |
| | | |
| | | //开始处理层级抽佣 |
| | | if(null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | if(num3 > 0 && null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 |
| | | if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ |
| | | Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num5); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num5)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num5 ? num3 - num5 : 0); |
| | | |
| | | Double num5_1 = num5; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num5_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num5_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num5_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num5_1 = new BigDecimal(num5_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num5)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num5 ? v : 0); |
| | | } |
| | | num6 = (num3 >= num6 ? num6 : num3); |
| | | if(num6 > 0){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num6); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driver2.setCommission(new BigDecimal(driver2.getCommission()).add(new BigDecimal(num6)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num6 ? num3 - num6 : 0); |
| | | |
| | | Double num6_1 = num6; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num6_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num6_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num6_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num6_1 = new BigDecimal(num6_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num6)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num6 ? v : 0); |
| | | } |
| | | num7 = (num3 >= num7 ? num7 : num3); |
| | | if(num7 > 0){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver3.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver3.getCouponBalance()).add(new BigDecimal(driver3.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver3.setCommission(driver3.getCommission() + num7); |
| | | accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | driver3.setCommission(new BigDecimal(driver3.getCommission()).add(new BigDecimal(num7)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver3.getCouponBalance()).add(new BigDecimal(driver3.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver3); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num7 ? num3 - num7 : 0); |
| | | |
| | | Double num7_1 = num7; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num7_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver3.getId(), driver3.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num7_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num7_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver3.getId(), driver3.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num7_1 = new BigDecimal(num7_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num7)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num7 ? v : 0); |
| | | } |
| | | }else{ |
| | | Double num3_ = jsonObject1.getDouble("num3"); |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num3_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num3_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num3_ ? num3 - num3_ : 0); |
| | | |
| | | Double num3_1 = num3_; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num3_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num3_ ? v : 0); |
| | | } |
| | | num4 = (num3 >= num4 ? num4 : num3); |
| | | if(num4 > 0){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num4); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driver2.setCommission(new BigDecimal(driver2.getCommission()).add(new BigDecimal(num4)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num4 ? num3 - num4 : 0); |
| | | |
| | | Double num4_1 = num4; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num4_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num4_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num4_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num4_1 = new BigDecimal(num4_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num4)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num4 ? v : 0); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num2_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num2_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num2_ ? num3 - num2_ : 0); |
| | | |
| | | Double num2_1 = num2_; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num2_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num2_1, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num2_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num2_1 = new BigDecimal(num2_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num2_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num2_ ? v : 0); |
| | | } |
| | | } |
| | | } |
| | |
| | | revenue.setAmount(num3); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | Agent agent = agentService.selectById(driver.getAgentId()); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(2, agent.getId(), agent.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(2, agent.getId(), agent.getMerchantNumber(), order.getId(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(fengzhang.getCode() == 10000){ |
| | | rechargeRecord.setSurplusDividedAmount(0d); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3 = new BigDecimal(num3).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //司机余额扣减抽佣金额 |
| | | if(n > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(9); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("线下收款服务费支出"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver.setBalance(driver.getBalance() - n); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分账操作 |
| | | * @param amount |
| | | */ |
| | | @Override |
| | | public ResultUtil fengzhang(Integer userType, Integer id, String merchantNumber, Long orderId, Integer rechargeRecordId, String merOrderId, Double amount, Integer sourceType){ |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(userType); |
| | | divisionRecord.setUserId(id); |
| | | divisionRecord.setOrderId(orderId); |
| | | divisionRecord.setRechargeRecordId(rechargeRecordId); |
| | | divisionRecord.setSourceType(sourceType); |
| | | divisionRecord.setAmount(amount); |
| | | divisionRecord.setMerchantNumber(merchantNumber); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(merOrderId); |
| | | complete.setNotifyUrl(callbackPath + "/base/order/ledgerCallback"); |
| | | complete.setParameter1(divisionRecord.getId().toString()); |
| | | //分账方列表 |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(merchantNumber); |
| | | pamentOrderUser.setSplitAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE);//分账操作 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId1 = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | logger.warn("订单支付成功后的分账处理异常失败"); |
| | | return ResultUtil.error("订单支付成功后的分账处理异常失败"); |
| | | } |
| | | if(1 == status){ |
| | | divisionRecord.setMerOrderId(merOrderId1); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | //间隔1分钟开始调用确认收货后开始提现 |
| | | |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(merchantNumber, merOrderId, divisionRecord); |
| | | } |
| | | }, 60000); |
| | | return ResultUtil.success(); |
| | | } |
| | | }else{ |
| | | logger.warn("订单支付成功后的分账处理异常 :" + execute.getMsg()); |
| | | return ResultUtil.error("订单支付成功后的分账处理异常 :" + execute.getMsg()); |
| | | } |
| | | logger.warn("未知异常"); |
| | | return ResultUtil.error("未知异常"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分账后的确认收货 |
| | | * @param divisionRecord |
| | | */ |
| | | public void confirmReceipt(String merchantNumber, String orderNumber, DivisionRecord divisionRecord){ |
| | | Receive receive = new Receive(); |
| | | receive.setOriginalMerOrderId(orderNumber); |
| | | receive.setAsynMerOrderId(divisionRecord.getMerOrderId()); |
| | | receive.setRcvAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(merchantNumber); |
| | | receiveUser.setRcvSplitAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(receive, Receive.SERVICE_CODE);//确认收货 |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute1.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | logger.warn("分账确认收货成功"); |
| | | }else{ |
| | | logger.warn("分账确认收货异常" + execute1.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取司机的订单列表 |
| | |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | MyAchievementWarpper myAchievementWarpper = new MyAchievementWarpper(); |
| | | myAchievementWarpper.setType("订单"); |
| | |
| | | } |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | myAchievementWarpper = new MyAchievementWarpper(); |
| | |
| | | if(performanceRankingWarpper.getDriverId().compareTo(driverId) == 0){ |
| | | break; |
| | | } |
| | | if(i == performanceRankingWarppers.size() - 1){ |
| | | position = 0; |
| | | d = 0D; |
| | | } |
| | | } |
| | | myAchievementWarpper = new MyAchievementWarpper(); |
| | | myAchievementWarpper.setType("佣金"); |
| | |
| | | */ |
| | | @Override |
| | | public void completeCollection() { |
| | | this.baseMapper.completeCollection(); |
| | | List<Order> orders = this.selectList(new EntityWrapper<Order>().eq("state", 107).eq("status", 1) |
| | | .eq("payType", 3).last(" and UNIX_TIMESTAMP(getoffTime) + 600 <= UNIX_TIMESTAMP(now())")); |
| | | for (Order order : orders) { |
| | | Long orderId = order.getId(); |
| | | try { |
| | | boolean lock = redisUtil.lock(orderId + "",5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(orderId + "",5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | redisUtil.unlock(orderId + ""); |
| | | continue; |
| | | } |
| | | completeCollection_(order); |
| | | }catch (Exception e){ |
| | | redisUtil.unlock(orderId + ""); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void completeCollection_(Order order) throws Exception{ |
| | | order.setState(108); |
| | | order.setPayTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(coupon.getCouponPreferentialAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(discountedPrice) >= 0){ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | discountedPrice = new BigDecimal(discountedPrice).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.updateById(order); |
| | | saveRevenue(order); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception { |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | Wrapper<Revenue> wrapper = new EntityWrapper<Revenue>().eq("type", 2).eq("userType", 2) |
| | | Wrapper<Revenue> wrapper = new EntityWrapper<Revenue>().eq("userType", 2) |
| | | .eq("userId", driverId); |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | wrapper.eq("DATE_FORMAT(createTime, '%Y年%m月')", time); |
| | |
| | | CommissionListWarpper commissionListWarpper = new CommissionListWarpper(); |
| | | commissionListWarpper.setCreateTime(revenue.getCreateTime().getTime()); |
| | | commissionListWarpper.setAmount(revenue.getAmount()); |
| | | Order order = orderService.selectById(revenue.getOrderId()); |
| | | if(null != order.getUserId()){ |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && appUser.getInviterId().compareTo(driverId) == 0){ |
| | | commissionListWarpper.setUserType(1); |
| | | } |
| | | } |
| | | if(null == commissionListWarpper.getUserType()){ |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != driver.getInviterType() && driver.getInviterType() == 2 && driver.getInviterId().compareTo(driverId) == 0){ |
| | | commissionListWarpper.setUserType(2); |
| | | } |
| | | } |
| | | commissionListWarpper.setUserType(revenue.getType()); |
| | | list.add(commissionListWarpper); |
| | | } |
| | | return list; |
| | |
| | | } |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driverId); |
| | | accountChangeDetail.setType(2); |
| | |
| | | this.insert(youTuiDriver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public void editState() throws Exception { |
| | | this.baseMapper.editState(); |
| | | } |
| | | } |
| | |
| | | |
| | | static { |
| | | YamlPropertiesFactoryBean yamlProFb = new YamlPropertiesFactoryBean(); |
| | | yamlProFb.setResources(new ClassPathResource("application.yaml")); |
| | | yamlProFb.setResources(new ClassPathResource("application.yml")); |
| | | Properties properties = yamlProFb.getObject(); |
| | | System.out.println("mallbook 参数配置初始化"); |
| | | System.out.println("--------------------------------"); |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class Complete { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "complete"; |
| | | //原支付请求订单号 |
| | | private String originalMerOrderId; |
| | | //分账方列表 |
| | | private List<PamentOrderUser> splitList; |
| | | //后台回调地址 |
| | | private String notifyUrl; |
| | | //自定义参数1 |
| | | private String parameter1; |
| | | //自定义参数2 |
| | | private String parameter2; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public List<PamentOrderUser> getSplitList() { |
| | | return splitList; |
| | | } |
| | | |
| | | public void setSplitList(List<PamentOrderUser> splitList) { |
| | | this.splitList = splitList; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class PamentOrderUser { |
| | | |
| | | /** |
| | | * 分账方会员ID(必填) |
| | | */ |
| | | private String splitUserId; |
| | | |
| | | /** |
| | | * 分账金额(必填) |
| | | */ |
| | | private String splitAmount; |
| | | |
| | | /** |
| | | * 分账类型(必填) |
| | | * 0:收单金额(收款人) |
| | | * 1:分账金额 |
| | | * 2:佣金 |
| | | */ |
| | | private String splitType; |
| | | |
| | | public String getSplitUserId() { |
| | | return splitUserId; |
| | | } |
| | | |
| | | public void setSplitUserId(String splitUserId) { |
| | | this.splitUserId = splitUserId; |
| | | } |
| | | |
| | | public String getSplitAmount() { |
| | | return splitAmount; |
| | | } |
| | | |
| | | public void setSplitAmount(String splitAmount) { |
| | | this.splitAmount = splitAmount; |
| | | } |
| | | |
| | | public String getSplitType() { |
| | | return splitType; |
| | | } |
| | | |
| | | public void setSplitType(String splitType) { |
| | | this.splitType = splitType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class PaymentOrder { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "paymentOrder"; |
| | | /** |
| | | * 业务订单号(必填) |
| | | */ |
| | | private String bizOrderId; |
| | | |
| | | /** |
| | | * 交易金额(必填) |
| | | */ |
| | | private String amount; |
| | | |
| | | /** |
| | | * 付款人 |
| | | */ |
| | | private String payerUserName; |
| | | |
| | | /** |
| | | * 收款人会员ID(必填) |
| | | */ |
| | | private String payeeUserId; |
| | | |
| | | /** |
| | | * 订单名称(必填) |
| | | */ |
| | | private String orderName; |
| | | |
| | | /** |
| | | * 支付类型(必填) |
| | | */ |
| | | private String payType; |
| | | |
| | | /** |
| | | * 交易类型(必填) |
| | | */ |
| | | private String transferType; |
| | | |
| | | /** |
| | | * 订单过期时间 |
| | | */ |
| | | private String expire; |
| | | |
| | | /** |
| | | * 微信或支付宝的appid |
| | | */ |
| | | private String appid; |
| | | |
| | | /** |
| | | * 微信或支付宝用户id |
| | | */ |
| | | private String openid; |
| | | |
| | | /** |
| | | * 终端IP(必填) |
| | | */ |
| | | private String terminalIp; |
| | | |
| | | /** |
| | | * 分账方列表(必填) |
| | | */ |
| | | private List<PamentOrderUser> splitList; |
| | | |
| | | /** |
| | | * 商品列表(必填) |
| | | */ |
| | | private List<PaymentOrderGood> goodsDetail; |
| | | |
| | | /** |
| | | * 前台回调地址(必填) |
| | | */ |
| | | private String frontUrl; |
| | | |
| | | /** |
| | | * 后台回调地址(必填) |
| | | */ |
| | | private String notifyUrl; |
| | | |
| | | /** |
| | | * 自定义参数1 |
| | | */ |
| | | private String parameter1; |
| | | |
| | | /** |
| | | * 自定义参数2 |
| | | */ |
| | | private String parameter2; |
| | | /* |
| | | * 是否异步分账 |
| | | */ |
| | | private String asynSplitFlag; |
| | | |
| | | /** |
| | | * 付款方子商户编号 |
| | | */ |
| | | private String payerUserId; |
| | | |
| | | /** |
| | | * 银行编码 |
| | | */ |
| | | private String bankCode; |
| | | |
| | | /** |
| | | * 银行卡类型 |
| | | */ |
| | | private String cardType; |
| | | |
| | | /** |
| | | * 快捷卡唯一标识 |
| | | */ |
| | | private String tokenNo; |
| | | |
| | | |
| | | public String getPayerUserId() { |
| | | return payerUserId; |
| | | } |
| | | |
| | | public void setPayerUserId(String payerUserId) { |
| | | this.payerUserId = payerUserId; |
| | | } |
| | | |
| | | public String getBankCode() { |
| | | return bankCode; |
| | | } |
| | | |
| | | public void setBankCode(String bankCode) { |
| | | this.bankCode = bankCode; |
| | | } |
| | | |
| | | public String getCardType() { |
| | | return cardType; |
| | | } |
| | | |
| | | public void setCardType(String cardType) { |
| | | this.cardType = cardType; |
| | | } |
| | | |
| | | public String getTokenNo() { |
| | | return tokenNo; |
| | | } |
| | | |
| | | public void setTokenNo(String tokenNo) { |
| | | this.tokenNo = tokenNo; |
| | | } |
| | | |
| | | public String getAsynSplitFlag() { |
| | | return asynSplitFlag; |
| | | } |
| | | |
| | | public void setAsynSplitFlag(String asynSplitFlag) { |
| | | this.asynSplitFlag = asynSplitFlag; |
| | | } |
| | | |
| | | public String getBizOrderId() { |
| | | return bizOrderId; |
| | | } |
| | | |
| | | public void setBizOrderId(String bizOrderId) { |
| | | this.bizOrderId = bizOrderId; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getPayerUserName() { |
| | | return payerUserName; |
| | | } |
| | | |
| | | public void setPayerUserName(String payerUserName) { |
| | | this.payerUserName = payerUserName; |
| | | } |
| | | |
| | | public String getPayeeUserId() { |
| | | return payeeUserId; |
| | | } |
| | | |
| | | public void setPayeeUserId(String payeeUserId) { |
| | | this.payeeUserId = payeeUserId; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(String payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public String getTransferType() { |
| | | return transferType; |
| | | } |
| | | |
| | | public void setTransferType(String transferType) { |
| | | this.transferType = transferType; |
| | | } |
| | | |
| | | public String getExpire() { |
| | | return expire; |
| | | } |
| | | |
| | | public void setExpire(String expire) { |
| | | this.expire = expire; |
| | | } |
| | | |
| | | public String getAppid() { |
| | | return appid; |
| | | } |
| | | |
| | | public void setAppid(String appid) { |
| | | this.appid = appid; |
| | | } |
| | | |
| | | public String getOpenid() { |
| | | return openid; |
| | | } |
| | | |
| | | public void setOpenid(String openid) { |
| | | this.openid = openid; |
| | | } |
| | | |
| | | public String getTerminalIp() { |
| | | return terminalIp; |
| | | } |
| | | |
| | | public void setTerminalIp(String terminalIp) { |
| | | this.terminalIp = terminalIp; |
| | | } |
| | | |
| | | public List<PamentOrderUser> getSplitList() { |
| | | return splitList; |
| | | } |
| | | |
| | | public void setSplitList(List<PamentOrderUser> splitList) { |
| | | this.splitList = splitList; |
| | | } |
| | | |
| | | public List<PaymentOrderGood> getGoodsDetail() { |
| | | return goodsDetail; |
| | | } |
| | | |
| | | public void setGoodsDetail(List<PaymentOrderGood> goodsDetail) { |
| | | this.goodsDetail = goodsDetail; |
| | | } |
| | | |
| | | public String getFrontUrl() { |
| | | return frontUrl; |
| | | } |
| | | |
| | | public void setFrontUrl(String frontUrl) { |
| | | this.frontUrl = frontUrl; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class PaymentOrderGood { |
| | | |
| | | /** 商品编号 */ |
| | | private String goodsId; |
| | | |
| | | /** 商品名称,必填 */ |
| | | private String goodsName; |
| | | |
| | | /** 商品数量 */ |
| | | private String quantity; |
| | | |
| | | /** 商品价格 */ |
| | | private String price; |
| | | |
| | | public String getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(String goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public String getGoodsName() { |
| | | return goodsName; |
| | | } |
| | | |
| | | public void setGoodsName(String goodsName) { |
| | | this.goodsName = goodsName; |
| | | } |
| | | |
| | | public String getQuantity() { |
| | | return quantity; |
| | | } |
| | | |
| | | public void setQuantity(String quantity) { |
| | | this.quantity = quantity; |
| | | } |
| | | |
| | | public String getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(String price) { |
| | | this.price = price; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class QueryOrder { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryOrder"; |
| | | /** |
| | | * 原请求订单号 |
| | | */ |
| | | private String originalMerOrderId; |
| | | |
| | | /** |
| | | * 查询类型 |
| | | */ |
| | | private String queryType; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public String getQueryType() { |
| | | return queryType; |
| | | } |
| | | |
| | | public void setQueryType(String queryType) { |
| | | this.queryType = queryType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | | * @Date 2021/9/18 9:41 |
| | | */ |
| | | public class QueryUser { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryUser"; |
| | | /** |
| | | * 业务系统会员id |
| | | */ |
| | | |
| | | private String merUserId; |
| | | |
| | | public String getMerUserId() { |
| | | return merUserId; |
| | | } |
| | | |
| | | public void setMerUserId(String merUserId) { |
| | | this.merUserId = merUserId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 确认收货信息参数 |
| | | */ |
| | | public class Receive { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "receive"; |
| | | /** |
| | | * 原支付请求订单号(必填) |
| | | */ |
| | | private String originalMerOrderId; |
| | | /** |
| | | * 异步分账订单号(多次异步确认订单进行确认收货时必传) |
| | | */ |
| | | private String asynMerOrderId; |
| | | |
| | | /** |
| | | * 确认收货总额(必填) |
| | | * 必须大于0 |
| | | * 确认收货总额=总确认分账金额 |
| | | */ |
| | | private String rcvAmount; |
| | | |
| | | /** |
| | | * 分账方列表(必填) |
| | | */ |
| | | private List<ReceiveUser> splitList; |
| | | |
| | | /** |
| | | * 商品列表 |
| | | */ |
| | | private List<ReceiveGood> goodsDetail; |
| | | /** |
| | | * 自定义参数1 |
| | | */ |
| | | private String parameter1; |
| | | |
| | | /** |
| | | * 自定义参数2 |
| | | */ |
| | | private String parameter2; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public String getAsynMerOrderId() { |
| | | return asynMerOrderId; |
| | | } |
| | | |
| | | public void setAsynMerOrderId(String asynMerOrderId) { |
| | | this.asynMerOrderId = asynMerOrderId; |
| | | } |
| | | |
| | | public String getRcvAmount() { |
| | | return rcvAmount; |
| | | } |
| | | |
| | | public void setRcvAmount(String rcvAmount) { |
| | | this.rcvAmount = rcvAmount; |
| | | } |
| | | |
| | | public List<ReceiveUser> getSplitList() { |
| | | return splitList; |
| | | } |
| | | |
| | | public void setSplitList(List<ReceiveUser> splitList) { |
| | | this.splitList = splitList; |
| | | } |
| | | |
| | | public List<ReceiveGood> getGoodsDetail() { |
| | | return goodsDetail; |
| | | } |
| | | |
| | | public void setGoodsDetail(List<ReceiveGood> goodsDetail) { |
| | | this.goodsDetail = goodsDetail; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class ReceiveGood { |
| | | |
| | | /** 商品编号 */ |
| | | private String goodsId; |
| | | |
| | | /** 商品名称,必填 */ |
| | | private String goodsName; |
| | | |
| | | /** 商品数量 */ |
| | | private String quantity; |
| | | |
| | | /** 商品价格 */ |
| | | private String price; |
| | | |
| | | public String getGoodsId() { |
| | | return goodsId; |
| | | } |
| | | |
| | | public void setGoodsId(String goodsId) { |
| | | this.goodsId = goodsId; |
| | | } |
| | | |
| | | public String getGoodsName() { |
| | | return goodsName; |
| | | } |
| | | |
| | | public void setGoodsName(String goodsName) { |
| | | this.goodsName = goodsName; |
| | | } |
| | | |
| | | public String getQuantity() { |
| | | return quantity; |
| | | } |
| | | |
| | | public void setQuantity(String quantity) { |
| | | this.quantity = quantity; |
| | | } |
| | | |
| | | public String getPrice() { |
| | | return price; |
| | | } |
| | | |
| | | public void setPrice(String price) { |
| | | this.price = price; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | public class ReceiveUser { |
| | | |
| | | /** 分账方会员ID,必填 */ |
| | | private String splitUserId; |
| | | |
| | | /** 确认分账金额,必填 */ |
| | | private String rcvSplitAmount; |
| | | |
| | | public String getSplitUserId() { |
| | | return splitUserId; |
| | | } |
| | | |
| | | public void setSplitUserId(String splitUserId) { |
| | | this.splitUserId = splitUserId; |
| | | } |
| | | |
| | | public String getRcvSplitAmount() { |
| | | return rcvSplitAmount; |
| | | } |
| | | |
| | | public void setRcvSplitAmount(String rcvSplitAmount) { |
| | | this.rcvSplitAmount = rcvSplitAmount; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class Transfer { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "transfer"; |
| | | //充值订单号 |
| | | private String depositMerOrderId; |
| | | //收款方子商户号 |
| | | private String toUserId; |
| | | //转账金额 |
| | | private String amount; |
| | | //订单信息 |
| | | private String orderName; |
| | | //后台回调地址 |
| | | private String notifyUrl; |
| | | //自定义参数1 |
| | | private String parameter1; |
| | | //自定义参数2 |
| | | private String parameter2; |
| | | |
| | | public String getDepositMerOrderId() { |
| | | return depositMerOrderId; |
| | | } |
| | | |
| | | public void setDepositMerOrderId(String depositMerOrderId) { |
| | | this.depositMerOrderId = depositMerOrderId; |
| | | } |
| | | |
| | | public String getToUserId() { |
| | | return toUserId; |
| | | } |
| | | |
| | | public void setToUserId(String toUserId) { |
| | | this.toUserId = toUserId; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.MallBook.model; |
| | | |
| | | public class Withdraw { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "withdraw"; |
| | | /** |
| | | * 子商户编号(必填) |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 结算金额(必填) |
| | | */ |
| | | private String amount; |
| | | |
| | | /** |
| | | * 订单名称 |
| | | */ |
| | | private String orderName; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 后台回调地址(必填) |
| | | */ |
| | | private String notifyUrl; |
| | | |
| | | /** |
| | | * 自定义参数1 |
| | | */ |
| | | private String parameter1; |
| | | |
| | | /** |
| | | * 自定义参数2 |
| | | */ |
| | | private String parameter2; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
| | |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceRequest; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | |
| | | */ |
| | | public class TrhRequest<T> { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(TrhRequest.class); |
| | | |
| | | public InterfaceResponse execute(T t, String serverCode) { |
| | | InterfaceRequest<T> request = new InterfaceRequest(t, serverCode); |
| | | System.out.println("mallbook请求参数:" + JSONUtil.toJsonStr(request)); |
| | | logger.warn("mallbook请求参数:" + JSONUtil.toJsonStr(request)); |
| | | String result = HttpUtil.post(ChannelConfig.payUrl, BeanUtil.beanToMap(request)); |
| | | System.out.println("mallbook响应参数:" + result); |
| | | logger.warn("mallbook响应参数:" + result); |
| | | InterfaceResponse response = JSONUtil.toBean(result, InterfaceResponse.class); |
| | | boolean verify = RSASignature.validate(response.content(), response.getSign()); |
| | | if (!verify) { |
| | | throw new ValidateException("签名验证失败"); |
| | | logger.warn("签名验证失败"); |
| | | } else { |
| | | System.out.printf("签名验证通过"); |
| | | logger.warn("签名验证通过"); |
| | | } |
| | | return response; |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.security.*; |
| | |
| | | initiateBatchTransferRequest.setOutBatchNo(outDetailNo); |
| | | initiateBatchTransferRequest.setBatchName("付款"); |
| | | initiateBatchTransferRequest.setBatchRemark(remark); |
| | | initiateBatchTransferRequest.setTotalAmount(amount.longValue() * 100); |
| | | initiateBatchTransferRequest.setTotalAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue()); |
| | | initiateBatchTransferRequest.setTotalNum(1); |
| | | { |
| | | List<TransferDetailInput> transferDetailListList = new ArrayList<>(); |
| | | { |
| | | TransferDetailInput transferDetailInput = new TransferDetailInput(); |
| | | transferDetailInput.setOutDetailNo(outDetailNo); |
| | | transferDetailInput.setTransferAmount(amount.longValue() * 100); |
| | | transferDetailInput.setTransferAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue()); |
| | | transferDetailInput.setTransferRemark(remark); |
| | | transferDetailInput.setOpenid(openid); |
| | | if(amount > 0.3){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 系统推单推送 附加(防止 用户推单后,范围内的司机20s 内接不到单的补充方法) |
| | | * @param id 接受对象id |
| | | * @param type 接受对象类型(1=用户,2=司机) |
| | | */ |
| | | public void pushGrabOrderExtras(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "PUSH_ORDER"); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 推送订单数据 |
| | | * @param id |
| | |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | System.err.println("定时任务启动"); |
| | | Jedis resource = jedisPool.getResource(); |
| | | resource.setex(finalKey, time, value); |
| | | resource.close(); |
| | |
| | | return lock("redis", uuid, time); |
| | | } |
| | | |
| | | /** |
| | | * 获取redis锁 |
| | | * @param key |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public boolean lock(String key, int time){ |
| | | String uuid = UUID.randomUUID().toString(); |
| | | return lock(key, uuid, time); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * redis释放锁 |
| | |
| | | package com.supersavedriving.driver.modular.system.util; |
| | | |
| | | |
| | | import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | |
| | | |
| | | /** |
| | | * 5秒推送 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 5) |
| | | public void task5Seconds(){ |
| | | try { |
| | | Set<String> orderServices = redisUtil.getSetAllValue("orderService"); |
| | | for (String s : orderServices) { |
| | | orderService.pushOrderInfo(Long.valueOf(s));//开始推送订单数据 |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskMinute(){ |
| | | try { |
| | | orderService.completeCollection(); |
| | | driverWorkService.taskDriverOffWork(); |
| | | youTuiDriverService.editState(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @Scheduled(cron = "0 0 0 * * *") |
| | | public void taskDay(){ |
| | | try { |
| | | orderService.completeCollection(); |
| | | accountChangeDetailService.deductionInsurance(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.security.*; |
| | | |
| | | /** |
| | | * AES加密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | public class AES { |
| | | |
| | | public static boolean initialized = false; |
| | | |
| | | /** |
| | | * AES解密 |
| | | * |
| | | * @param content |
| | | * 密文 |
| | | * @return |
| | | * @throws InvalidAlgorithmParameterException |
| | | * @throws NoSuchProviderException |
| | | */ |
| | | public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException { |
| | | initialize(); |
| | | try { |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); |
| | | Key sKeySpec = new SecretKeySpec(keyByte, "AES"); |
| | | cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化 |
| | | byte[] result = cipher.doFinal(content); |
| | | return result; |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchProviderException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void initialize() { |
| | | if (initialized) |
| | | return; |
| | | Security.addProvider(new BouncyCastleProvider()); |
| | | initialized = true; |
| | | } |
| | | |
| | | // 生成iv |
| | | public static AlgorithmParameters generateIV(byte[] iv) throws Exception { |
| | | AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); |
| | | params.init(new IvParameterSpec(iv)); |
| | | return params; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | @SuppressWarnings("serial") |
| | | public class AesException extends Exception { |
| | | |
| | | public final static int OK = 0; |
| | | public final static int ValidateSignatureError = -40001; |
| | | public final static int ParseXmlError = -40002; |
| | | public final static int ComputeSignatureError = -40003; |
| | | public final static int IllegalAesKey = -40004; |
| | | public final static int ValidateAppidError = -40005; |
| | | public final static int EncryptAESError = -40006; |
| | | public final static int DecryptAESError = -40007; |
| | | public final static int IllegalBuffer = -40008; |
| | | //public final static int EncodeBase64Error = -40009; |
| | | //public final static int DecodeBase64Error = -40010; |
| | | //public final static int GenReturnXmlError = -40011; |
| | | |
| | | private int code; |
| | | |
| | | private static String getMessage(int code) { |
| | | switch (code) { |
| | | case ValidateSignatureError: |
| | | return "签名验证错误"; |
| | | case ParseXmlError: |
| | | return "xml解析失败"; |
| | | case ComputeSignatureError: |
| | | return "sha加密生成签名失败"; |
| | | case IllegalAesKey: |
| | | return "SymmetricKey非法"; |
| | | case ValidateAppidError: |
| | | return "appid校验失败"; |
| | | case EncryptAESError: |
| | | return "aes加密失败"; |
| | | case DecryptAESError: |
| | | return "aes解密失败"; |
| | | case IllegalBuffer: |
| | | return "解密后得到的buffer非法"; |
| | | // case EncodeBase64Error: |
| | | // return "base64加密错误"; |
| | | // case DecodeBase64Error: |
| | | // return "base64解密错误"; |
| | | // case GenReturnXmlError: |
| | | // return "xml生成失败"; |
| | | default: |
| | | return null; // cannot be |
| | | } |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | AesException(int code) { |
| | | super(getMessage(code)); |
| | | this.code = code; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | class ByteGroup { |
| | | ArrayList<Byte> byteContainer = new ArrayList<Byte>(); |
| | | |
| | | public byte[] toBytes() { |
| | | byte[] bytes = new byte[byteContainer.size()]; |
| | | for (int i = 0; i < byteContainer.size(); i++) { |
| | | bytes[i] = byteContainer.get(i); |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | public ByteGroup addBytes(byte[] bytes) { |
| | | for (byte b : bytes) { |
| | | byteContainer.add(b); |
| | | } |
| | | return this; |
| | | } |
| | | |
| | | public int size() { |
| | | return byteContainer.size(); |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * 对公众平台发送给公众账号的消息加解密示例代码. |
| | | * |
| | | * @copyright Copyright (c) 1998-2014 Tencent Inc. |
| | | */ |
| | | |
| | | // ------------------------------------------------------------------------ |
| | | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 提供基于PKCS7算法的加解密接口. |
| | | */ |
| | | class PKCS7Encoder { |
| | | static Charset CHARSET = Charset.forName("utf-8"); |
| | | static int BLOCK_SIZE = 32; |
| | | |
| | | /** |
| | | * 获得对明文进行补位填充的字节. |
| | | * |
| | | * @param count 需要进行填充补位操作的明文字节个数 |
| | | * @return 补齐用的字节数组 |
| | | */ |
| | | static byte[] encode(int count) { |
| | | // 计算需要填充的位数 |
| | | int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); |
| | | if (amountToPad == 0) { |
| | | amountToPad = BLOCK_SIZE; |
| | | } |
| | | // 获得补位所用的字符 |
| | | char padChr = chr(amountToPad); |
| | | String tmp = new String(); |
| | | for (int index = 0; index < amountToPad; index++) { |
| | | tmp += padChr; |
| | | } |
| | | return tmp.getBytes(CHARSET); |
| | | } |
| | | |
| | | /** |
| | | * 删除解密后明文的补位字符 |
| | | * |
| | | * @param decrypted 解密后的明文 |
| | | * @return 删除补位字符后的明文 |
| | | */ |
| | | static byte[] decode(byte[] decrypted) { |
| | | int pad = (int) decrypted[decrypted.length - 1]; |
| | | if (pad < 1 || pad > 32) { |
| | | pad = 0; |
| | | } |
| | | return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); |
| | | } |
| | | |
| | | /** |
| | | * 将数字转化成ASCII码对应的字符,用于对明文进行补码 |
| | | * |
| | | * @param a 需要转化的数字 |
| | | * @return 转化得到的字符 |
| | | */ |
| | | static char chr(int a) { |
| | | byte target = (byte) (a & 0xFF); |
| | | return (char) target; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /** |
| | | * 对公众平台发送给公众账号的消息加解密示例代码. |
| | | * |
| | | * @copyright Copyright (c) 1998-2014 Tencent Inc. |
| | | */ |
| | | |
| | | // ------------------------------------------------------------------------ |
| | | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * SHA1 class |
| | | * |
| | | * 计算公众平台的消息签名接口. |
| | | */ |
| | | public class SHA1 { |
| | | |
| | | /** |
| | | * 用SHA1算法生成安全签名 |
| | | * @param token 票据 |
| | | * @param timestamp 时间戳 |
| | | * @param nonce 随机字符串 |
| | | * @param encrypt 密文 |
| | | * @return 安全签名 |
| | | * @throws AesException |
| | | */ |
| | | public static String getSHA1(String token, String timestamp, String nonce, String encrypt) throws AesException |
| | | { |
| | | try { |
| | | String[] array = new String[] { token, timestamp, nonce, encrypt }; |
| | | StringBuffer sb = new StringBuffer(); |
| | | // 字符串排序 |
| | | Arrays.sort(array); |
| | | for (int i = 0; i < 4; i++) { |
| | | sb.append(array[i]); |
| | | } |
| | | String str = sb.toString(); |
| | | // SHA1签名生成 |
| | | MessageDigest md = MessageDigest.getInstance("SHA-1"); |
| | | md.update(str.getBytes()); |
| | | byte[] digest = md.digest(); |
| | | |
| | | StringBuffer hexstr = new StringBuffer(); |
| | | String shaHex = ""; |
| | | for (int i = 0; i < digest.length; i++) { |
| | | shaHex = Integer.toHexString(digest[i] & 0xFF); |
| | | if (shaHex.length() < 2) { |
| | | hexstr.append(0); |
| | | } |
| | | hexstr.append(shaHex); |
| | | } |
| | | return hexstr.toString(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new AesException(AesException.ComputeSignatureError); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * 对公众平台发送给公众账号的消息加解密示例代码. |
| | | * |
| | | * @copyright Copyright (c) 1998-2014 Tencent Inc. |
| | | */ |
| | | |
| | | // ------------------------------------------------------------------------ |
| | | |
| | | /** |
| | | * 针对org.apache.commons.codec.binary.Base64, |
| | | * 需要导入架包commons-codec-1.9(或commons-codec-1.8等其他版本) |
| | | * 官方下载地址:http://commons.apache.org/proper/commons-codec/download_codec.cgi |
| | | */ |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.nio.charset.Charset; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | |
| | | /** |
| | | * 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串). |
| | | * <ol> |
| | | * <li>第三方回复加密消息给公众平台</li> |
| | | * <li>第三方收到公众平台发送的消息,验证消息的安全性,并对消息进行解密。</li> |
| | | * </ol> |
| | | * 说明:异常java.security.InvalidKeyException:illegal Key Size的解决方案 |
| | | * <ol> |
| | | * <li>在官方网站下载JCE无限制权限策略文件(JDK7的下载地址: |
| | | * http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</li> |
| | | * <li>下载后解压,可以看到local_policy.jar和US_export_policy.jar以及readme.txt</li> |
| | | * <li>如果安装了JRE,将两个jar文件放到%JRE_HOME%\lib\security目录下覆盖原来的文件</li> |
| | | * <li>如果安装了JDK,将两个jar文件放到%JDK_HOME%\jre\lib\security目录下覆盖原来文件</li> |
| | | * </ol> |
| | | */ |
| | | public class WXBizMsgCrypt { |
| | | static Charset CHARSET = Charset.forName("utf-8"); |
| | | Base64 base64 = new Base64(); |
| | | byte[] aesKey; |
| | | String token; |
| | | String appId; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * @param token 公众平台上,开发者设置的token |
| | | * @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey |
| | | * @param appId 公众平台appid |
| | | * |
| | | * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 |
| | | */ |
| | | public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException { |
| | | if (encodingAesKey.length() != 43) { |
| | | throw new AesException(AesException.IllegalAesKey); |
| | | } |
| | | |
| | | this.token = token; |
| | | this.appId = appId; |
| | | aesKey = Base64.decodeBase64(encodingAesKey + "="); |
| | | } |
| | | |
| | | // 生成4个字节的网络字节序 |
| | | byte[] getNetworkBytesOrder(int sourceNumber) { |
| | | byte[] orderBytes = new byte[4]; |
| | | orderBytes[3] = (byte) (sourceNumber & 0xFF); |
| | | orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF); |
| | | orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF); |
| | | orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF); |
| | | return orderBytes; |
| | | } |
| | | |
| | | // 还原4个字节的网络字节序 |
| | | int recoverNetworkBytesOrder(byte[] orderBytes) { |
| | | int sourceNumber = 0; |
| | | for (int i = 0; i < 4; i++) { |
| | | sourceNumber <<= 8; |
| | | sourceNumber |= orderBytes[i] & 0xff; |
| | | } |
| | | return sourceNumber; |
| | | } |
| | | |
| | | // 随机生成16位字符串 |
| | | String getRandomStr() { |
| | | String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < 16; i++) { |
| | | int number = random.nextInt(base.length()); |
| | | sb.append(base.charAt(number)); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 对明文进行加密. |
| | | * |
| | | * @param text 需要加密的明文 |
| | | * @return 加密后base64编码的字符串 |
| | | * @throws AesException aes加密失败 |
| | | */ |
| | | String encrypt(String randomStr, String text) throws AesException { |
| | | ByteGroup byteCollector = new ByteGroup(); |
| | | byte[] randomStrBytes = randomStr.getBytes(CHARSET); |
| | | byte[] textBytes = text.getBytes(CHARSET); |
| | | byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); |
| | | byte[] appidBytes = appId.getBytes(CHARSET); |
| | | |
| | | // randomStr + networkBytesOrder + text + appid |
| | | byteCollector.addBytes(randomStrBytes); |
| | | byteCollector.addBytes(networkBytesOrder); |
| | | byteCollector.addBytes(textBytes); |
| | | byteCollector.addBytes(appidBytes); |
| | | |
| | | // ... + pad: 使用自定义的填充方式对明文进行补位填充 |
| | | byte[] padBytes = PKCS7Encoder.encode(byteCollector.size()); |
| | | byteCollector.addBytes(padBytes); |
| | | |
| | | // 获得最终的字节流, 未加密 |
| | | byte[] unencrypted = byteCollector.toBytes(); |
| | | |
| | | try { |
| | | // 设置加密模式为AES的CBC模式 |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); |
| | | SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES"); |
| | | IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16); |
| | | cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv); |
| | | |
| | | // 加密 |
| | | byte[] encrypted = cipher.doFinal(unencrypted); |
| | | |
| | | // 使用BASE64对加密后的字符串进行编码 |
| | | String base64Encrypted = base64.encodeToString(encrypted); |
| | | |
| | | return base64Encrypted; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new AesException(AesException.EncryptAESError); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 对密文进行解密. |
| | | * |
| | | * @param text 需要解密的密文 |
| | | * @return 解密得到的明文 |
| | | * @throws AesException aes解密失败 |
| | | */ |
| | | String decrypt(String text) throws AesException { |
| | | byte[] original; |
| | | try { |
| | | // 设置解密模式为AES的CBC模式 |
| | | Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); |
| | | SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES"); |
| | | IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16)); |
| | | cipher.init(Cipher.DECRYPT_MODE, key_spec, iv); |
| | | |
| | | // 使用BASE64对密文进行解码 |
| | | byte[] encrypted = Base64.decodeBase64(text); |
| | | |
| | | // 解密 |
| | | original = cipher.doFinal(encrypted); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new AesException(AesException.DecryptAESError); |
| | | } |
| | | |
| | | String xmlContent, from_appid; |
| | | try { |
| | | // 去除补位字符 |
| | | byte[] bytes = PKCS7Encoder.decode(original); |
| | | |
| | | // 分离16位随机字符串,网络字节序和AppId |
| | | byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20); |
| | | |
| | | int xmlLength = recoverNetworkBytesOrder(networkOrder); |
| | | |
| | | xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET); |
| | | from_appid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length), |
| | | CHARSET); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new AesException(AesException.IllegalBuffer); |
| | | } |
| | | |
| | | // appid不相同的情况 |
| | | if (!from_appid.equals(appId)) { |
| | | throw new AesException(AesException.ValidateAppidError); |
| | | } |
| | | return xmlContent; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 将公众平台回复用户的消息加密打包. |
| | | * <ol> |
| | | * <li>对要发送的消息进行AES-CBC加密</li> |
| | | * <li>生成安全签名</li> |
| | | * <li>将消息密文和安全签名打包成xml格式</li> |
| | | * </ol> |
| | | * |
| | | * @param replyMsg 公众平台待回复用户的消息,xml格式的字符串 |
| | | * @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp |
| | | * @param nonce 随机串,可以自己生成,也可以用URL参数的nonce |
| | | * |
| | | * @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串 |
| | | * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 |
| | | */ |
| | | public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException { |
| | | // 加密 |
| | | String encrypt = encrypt(getRandomStr(), replyMsg); |
| | | |
| | | // 生成安全签名 |
| | | if (timeStamp == "") { |
| | | timeStamp = Long.toString(System.currentTimeMillis()); |
| | | } |
| | | |
| | | String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt); |
| | | |
| | | // System.out.println("发送给平台的签名是: " + signature[1].toString()); |
| | | // 生成发送的xml |
| | | String result = XMLParse.generate(encrypt, signature, timeStamp, nonce); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 检验消息的真实性,并且获取解密后的明文. |
| | | * <ol> |
| | | * <li>利用收到的密文生成安全签名,进行签名验证</li> |
| | | * <li>若验证通过,则提取xml中的加密消息</li> |
| | | * <li>对消息进行解密</li> |
| | | * </ol> |
| | | * |
| | | * @param msgSignature 签名串,对应URL参数的msg_signature |
| | | * @param timeStamp 时间戳,对应URL参数的timestamp |
| | | * @param nonce 随机串,对应URL参数的nonce |
| | | * @param postData 密文,对应POST请求的数据 |
| | | * |
| | | * @return 解密后的原文 |
| | | * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 |
| | | */ |
| | | public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData) |
| | | throws AesException { |
| | | |
| | | // 密钥,公众账号的app secret |
| | | // 提取密文 |
| | | Object[] encrypt = XMLParse.extract(postData); |
| | | |
| | | // 验证安全签名 |
| | | String signature = SHA1.getSHA1(token, timeStamp, nonce, encrypt[1].toString()); |
| | | |
| | | // 和URL中的签名比较是否相等 |
| | | // System.out.println("第三方收到URL中的签名:" + msg_sign); |
| | | // System.out.println("第三方校验签名:" + signature); |
| | | if (!signature.equals(msgSignature)) { |
| | | throw new AesException(AesException.ValidateSignatureError); |
| | | } |
| | | |
| | | // 解密 |
| | | String result = decrypt(encrypt[1].toString()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 验证URL |
| | | * @param msgSignature 签名串,对应URL参数的msg_signature |
| | | * @param timeStamp 时间戳,对应URL参数的timestamp |
| | | * @param nonce 随机串,对应URL参数的nonce |
| | | * @param echoStr 随机串,对应URL参数的echostr |
| | | * |
| | | * @return 解密之后的echostr |
| | | * @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息 |
| | | */ |
| | | public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) |
| | | throws AesException { |
| | | String signature = SHA1.getSHA1(token, timeStamp, nonce, ""); |
| | | |
| | | if (!signature.equals(msgSignature)) { |
| | | throw new AesException(AesException.ValidateSignatureError); |
| | | } |
| | | |
| | | String result = decrypt(echoStr); |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | public class WXCore { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(WXCore.class); |
| | | |
| | | private static final String WATERMARK = "watermark"; |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private static String appid ; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 解密数据 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String encryptedData, String sessionKey, String iv){ |
| | | String result = ""; |
| | | try { |
| | | AES aes = new AES(); |
| | | byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData), Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv)); |
| | | if(null != resultByte && resultByte.length > 0){ |
| | | result = new String(WxPKCS7Encoder.decode(resultByte), "UTF-8"); |
| | | // JSONObject jsonObject = JSON.parseObject(result); |
| | | // String decryptAppid = jsonObject.getJSONObject(WATERMARK).getString("appid"); |
| | | // if(!appid.equals(decryptAppid)){ |
| | | // result = ""; |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | result = ""; |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | String appId = "wx4f4bc4dec97d474b"; |
| | | String encryptedData = "ajhisfk0EhWCBcoxt/5QJA3bKPTygQXANbCSev92MyqIqGxRhzZFS1SlQrIWAo3tx8YfsB+VlScZNOlRyfnXKqPUl9h+PDeKsTkTst9V4pq4mUbI+r3AautXBffVk/rpyjMfanVsWeOlxkupdv2U9U4BrueR/Rak+TCmHTWUUf8eDLoi6nioL/Pft/rYaO3JD54hgpcY0Ef/k7Boyap4E0/uKVowY1ANO7KVydSXE6S7OKzXuzmDTbV38v+7ryMHtglUzoKzF1gL8y9OZRwkaesfHN1kfItjpsAibjSgkIiiW6ZEHLT2n1UDkJtfUqg63je2cJAH7gzeUm9TCDDftdhLU+NuPk3j/LXyFQ05pJ8B19+kIXF3dcmHOH7lFvi7yGmVuAD/9AnetGWgId3TZDS/OjbiVUM30RogeziAw98VpAyAAq1r2ULFwi8e928m"; |
| | | String sessionKey = "CdxFGwXIluQFZ+qD+NSFKQ=="; |
| | | String iv = "3FD8r1Spwlf7LG8YEq41+Q=="; |
| | | logger.debug(decrypt(encryptedData, sessionKey, iv)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpClientUtil; |
| | | import com.supersavedriving.driver.modular.system.util.httpClinet.HttpResult; |
| | | import com.supersavedriving.driver.modular.system.util.weChat.model.Code2Session; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.*; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * 微信工具类 |
| | | */ |
| | | @Component |
| | | public class WeChatUtil { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(WeChatUtil.class); |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String wxAppletsAppid; |
| | | |
| | | @Value("${wx.appletsAppSecret}") |
| | | private String wxAppletsAppSecret; |
| | | |
| | | @Value("${wx.officialAccountAppid}") |
| | | private String officialAccountAppid; |
| | | |
| | | @Value("{wx.officialAccountAppSecret}") |
| | | private String officialAccountAppSecret; |
| | | |
| | | @Value("${wx.appid}") |
| | | private String webAppId; |
| | | |
| | | @Value("${wx.appSecret}") |
| | | private String webAppSecret; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | |
| | | { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | // Thread.sleep(30000); |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // String wxAppletsAccessToken = getWxAppletsAccessToken(); |
| | | // if(ToolUtil.isEmpty(wxAppletsAccessToken)){ |
| | | // System.err.println("获取微信小程序access_token失败"); |
| | | // return; |
| | | // } |
| | | // redisUtil.setStrValue("wxAppletsAccessToken", wxAppletsAccessToken, 7000); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }, 0, 7000000); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 小程序使用jscode获取openid |
| | | * @param jscode |
| | | * @return |
| | | */ |
| | | public Code2Session code2Session(String jscode) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret |
| | | + "&js_code=" + jscode + "&grant_type=authorization_code"; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(null == httpResult || httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | Code2Session code2Session = JSON.parseObject(httpResult.getData(), Code2Session.class); |
| | | return code2Session; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取微信小程序token |
| | | * @return |
| | | */ |
| | | public String getWxAppletsAccessToken() throws Exception{ |
| | | String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + wxAppletsAppid + "&secret=" + wxAppletsAppSecret; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return ""; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 获取jsapiTicket(小程序) |
| | | * 来源 www.vxzsk.com |
| | | * @return |
| | | */ |
| | | public String getWxAppletsJSApiTicket() throws Exception{ |
| | | String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); |
| | | String urlStr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + wxAppletsAccessToken + "&type=jsapi"; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", urlStr, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | logger.debug(httpResult.getData()); |
| | | String ticket = JSONObject.parseObject(httpResult.getData()).getString("ticket"); |
| | | return ticket; |
| | | } |
| | | |
| | | /** |
| | | * 通过config接口注入权限验证配置(小程序) |
| | | * 附录1-JS-SDK使用权限签名算法, |
| | | * @return |
| | | */ |
| | | public Map<String,Object> getWxAppletsSignatureConfig(String url) throws Exception{ |
| | | //获取token |
| | | try { |
| | | url = URLDecoder.decode(url, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String ticket = getWxAppletsJSApiTicket(); |
| | | String noncestr = UUIDUtil.getRandomCode(); |
| | | Long timestamp = System.currentTimeMillis(); |
| | | String content = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
| | | String signature = DigestUtils.sha1Hex(content); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("appId", wxAppletsAppid); |
| | | map.put("timestamp", timestamp); |
| | | map.put("nonceStr", noncestr); |
| | | map.put("signature", signature); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 网站应用登录 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public Map<String, String> webAccessToken(String code) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + webAppId + "&secret=" + webAppSecret + "&code=" + code + "&grant_type=authorization_code"; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | int errcode = jsonObject.getIntValue("errcode"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | if(errcode == 0){//成功 |
| | | map.put("access_token", jsonObject.getString("access_token")); |
| | | map.put("openid", jsonObject.getString("openid")); |
| | | map.put("refresh_token", jsonObject.getString("refresh_token")); |
| | | map.put("unionid", jsonObject.getString("unionid")); |
| | | return map; |
| | | } |
| | | if(errcode == -1){//系统繁忙,此时请开发者稍候再试 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 40029){//code 无效 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 45011){//频率限制,每个用户每分钟100次 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取微信个人信息 |
| | | * @param access_token |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | public Map<String, Object> getUserInfo(String access_token, String openid) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | int errcode = jsonObject.getIntValue("errcode"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(errcode == 0){//成功 |
| | | map.put("nickname", jsonObject.getString("nickname")); |
| | | map.put("openid", jsonObject.getString("openid")); |
| | | map.put("sex", jsonObject.getString("sex")); |
| | | map.put("headimgurl", jsonObject.getString("headimgurl")); |
| | | return map; |
| | | } |
| | | if(errcode == -1){//系统繁忙,此时请开发者稍候再试 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 40029){//code 无效 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | if(errcode == 45011){//频率限制,每个用户每分钟100次 |
| | | map.put("msg", jsonObject.getString("errmsg")); |
| | | return map; |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 公众号获取openid |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public Map<String,Object> getOpenId(String code) throws Exception{ |
| | | if (code == null || code.length() == 0) { |
| | | return null; |
| | | } |
| | | String grantType = "authorization_code"; |
| | | String params = "appid=" + officialAccountAppid + "&secret=" + officialAccountAppSecret + "&code=" + code + "&grant_type=" + grantType; |
| | | logger.debug("sssss"+params); |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", "https://api.weixin.qq.com/sns/oauth2/access_token?" + params, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | JSONObject json = JSON.parseObject(httpResult.getData()); |
| | | logger.debug(json.toJSONString()); |
| | | String openId = json.get("openid").toString(); |
| | | String accessToken = json.get("access_token").toString(); |
| | | Integer expiresIn = json.getInteger("expires_in"); |
| | | String refresh_token = json.getString("refresh_token"); |
| | | String unionid = json.getString("unionid"); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("openId",openId); |
| | | map.put("accessToken",accessToken); |
| | | map.put("expiresIn", expiresIn); |
| | | map.put("refreshToken", refresh_token); |
| | | map.put("unionid", unionid); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 获取acess_token (公众号) |
| | | * 来源www.vxzsk.com |
| | | * @return |
| | | */ |
| | | public String getAccessToken() throws Exception{ |
| | | String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + officialAccountAppid |
| | | + "&secret=" + officialAccountAppSecret; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | String accessToken = JSONObject.parseObject(httpResult.getData()).getString("access_token"); |
| | | return accessToken; |
| | | } |
| | | |
| | | /*** |
| | | * 获取jsapiTicket(公众号) |
| | | * 来源 www.vxzsk.com |
| | | * @return |
| | | */ |
| | | public String getJSApiTicket() throws Exception{ |
| | | //获取token |
| | | String acess_token = redisUtil.getValue("acess_token"); |
| | | String urlStr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + acess_token + "&type=jsapi"; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", urlStr, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | logger.debug(httpResult.getData()); |
| | | String ticket = JSONObject.parseObject(httpResult.getData()).getString("ticket"); |
| | | return ticket; |
| | | } |
| | | |
| | | /** |
| | | * 通过config接口注入权限验证配置(公众号) |
| | | * 附录1-JS-SDK使用权限签名算法, |
| | | * @return |
| | | */ |
| | | public Map<String,Object> getSignatureConfig(String url) throws Exception{ |
| | | //获取token |
| | | try { |
| | | url = URLDecoder.decode(url, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String ticket = getJSApiTicket(); |
| | | String noncestr = UUIDUtil.getRandomCode(); |
| | | Long timestamp = System.currentTimeMillis(); |
| | | String content = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url; |
| | | String signature = DigestUtils.sha1Hex(content); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("appId", officialAccountAppid); |
| | | map.put("timestamp", timestamp); |
| | | map.put("nonceStr", noncestr); |
| | | map.put("signature", signature); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 公众号获取用户个人信息 |
| | | * @param access_token |
| | | * @param openid |
| | | * @return |
| | | */ |
| | | public Map<String, Object> queryUserInfo(String access_token, String openid) throws Exception{ |
| | | String url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid + "&lang=zh_CN"; |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("GET", url, null, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return null; |
| | | } |
| | | logger.debug(httpResult.getData()); |
| | | JSONObject j = JSON.parseObject(httpResult.getData()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("nickname", j.getString("nickname")); |
| | | map.put("sex", j.getInteger("sex")); |
| | | map.put("headimgurl", j.getString("headimgurl")); |
| | | map.put("unionid", j.getString("unionid")); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取小程序二维码 |
| | | * @param page 跳转页 例如 pages/index/index |
| | | * @param scene 参数 a=1&b=2 |
| | | */ |
| | | public InputStream getwxacodeunlimit(String page, String scene, String envVersion) throws Exception{ |
| | | try { |
| | | String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); |
| | | String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + wxAppletsAccessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("scene", scene); |
| | | param.put("page", page); |
| | | param.put("env_version", envVersion); |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); |
| | | httpHeaders.setContentType(type); |
| | | HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); |
| | | ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class, new Object[0]); |
| | | String body1 = exchange.getBody(); |
| | | // System.err.println(body1); |
| | | ResponseEntity<byte[]> entity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | byte[] body = entity.getBody(); |
| | | // System.err.println(Base64.encodeBase64String(body)); |
| | | return new ByteArrayInputStream(body); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取小程序urlscheme码 |
| | | * @return |
| | | */ |
| | | public String getUrlscheme(String path) throws Exception{ |
| | | String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); |
| | | String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token=" + wxAppletsAccessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("is_expire", true); |
| | | param.put("expire_type", 1); |
| | | param.put("expire_interval", 180); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("path", path); |
| | | map1.put("query", ""); |
| | | map1.put("env_version", "release"); |
| | | param.put("jump_wxa", map1); |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); |
| | | httpHeaders.setContentType(type); |
| | | HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); |
| | | ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); |
| | | String body1 = exchange.getBody(); |
| | | return body1; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 微信小程序加解密 |
| | | * @author pzb |
| | | * @Date 2021/12/3 15:43 |
| | | */ |
| | | public class WxPKCS7Encoder { |
| | | private static final Charset CHARSET = Charset.forName("utf-8"); |
| | | private static final int BLOCK_SIZE = 32; |
| | | |
| | | /** |
| | | * 获得对明文进行补位填充的字节. |
| | | * |
| | | * @param count |
| | | * 需要进行填充补位操作的明文字节个数 |
| | | * @return 补齐用的字节数组 |
| | | */ |
| | | public static byte[] encode(int count) { |
| | | // 计算需要填充的位数 |
| | | int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE); |
| | | if (amountToPad == 0) { |
| | | amountToPad = BLOCK_SIZE; |
| | | } |
| | | // 获得补位所用的字符 |
| | | char padChr = chr(amountToPad); |
| | | String tmp = new String(); |
| | | for (int index = 0; index < amountToPad; index++) { |
| | | tmp += padChr; |
| | | } |
| | | return tmp.getBytes(CHARSET); |
| | | } |
| | | |
| | | /** |
| | | * 删除解密后明文的补位字符 |
| | | * |
| | | * @param decrypted |
| | | * 解密后的明文 |
| | | * @return 删除补位字符后的明文 |
| | | */ |
| | | public static byte[] decode(byte[] decrypted) { |
| | | int pad = decrypted[decrypted.length - 1]; |
| | | if (pad < 1 || pad > 32) { |
| | | pad = 0; |
| | | } |
| | | return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad); |
| | | } |
| | | |
| | | /** |
| | | * 将数字转化成ASCII码对应的字符,用于对明文进行补码 |
| | | * |
| | | * @param a |
| | | * 需要转化的数字 |
| | | * @return 转化得到的字符 |
| | | */ |
| | | public static char chr(int a) { |
| | | byte target = (byte) (a & 0xFF); |
| | | return (char) target; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * 对公众平台发送给公众账号的消息加解密示例代码. |
| | | * |
| | | * @copyright Copyright (c) 1998-2014 Tencent Inc. |
| | | */ |
| | | |
| | | // ------------------------------------------------------------------------ |
| | | |
| | | package com.supersavedriving.driver.modular.system.util.weChat; |
| | | |
| | | import org.w3c.dom.Document; |
| | | import org.w3c.dom.Element; |
| | | import org.w3c.dom.NodeList; |
| | | import org.xml.sax.InputSource; |
| | | |
| | | import javax.xml.parsers.DocumentBuilder; |
| | | import javax.xml.parsers.DocumentBuilderFactory; |
| | | import java.io.StringReader; |
| | | |
| | | /** |
| | | * XMLParse class |
| | | * |
| | | * 提供提取消息格式中的密文及生成回复消息格式的接口. |
| | | */ |
| | | class XMLParse { |
| | | |
| | | /** |
| | | * 提取出xml数据包中的加密消息 |
| | | * @param xmltext 待提取的xml字符串 |
| | | * @return 提取出的加密消息字符串 |
| | | * @throws AesException |
| | | */ |
| | | public static Object[] extract(String xmltext) throws AesException { |
| | | Object[] result = new Object[3]; |
| | | try { |
| | | DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| | | DocumentBuilder db = dbf.newDocumentBuilder(); |
| | | StringReader sr = new StringReader(xmltext); |
| | | InputSource is = new InputSource(sr); |
| | | Document document = db.parse(is); |
| | | |
| | | Element root = document.getDocumentElement(); |
| | | NodeList nodelist1 = root.getElementsByTagName("Encrypt"); |
| | | NodeList nodelist2 = root.getElementsByTagName("ToUserName"); |
| | | result[0] = 0; |
| | | result[1] = nodelist1.item(0).getTextContent(); |
| | | result[2] = nodelist2.item(0).getTextContent(); |
| | | return result; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new AesException(AesException.ParseXmlError); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成xml消息 |
| | | * @param encrypt 加密后的消息密文 |
| | | * @param signature 安全签名 |
| | | * @param timestamp 时间戳 |
| | | * @param nonce 随机字符串 |
| | | * @return 生成的xml字符串 |
| | | */ |
| | | public static String generate(String encrypt, String signature, String timestamp, String nonce) { |
| | | |
| | | String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n" |
| | | + "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n" |
| | | + "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>"; |
| | | return String.format(format, encrypt, signature, timestamp, nonce); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 订阅消息类目 |
| | | */ |
| | | @Data |
| | | public class Category { |
| | | /** |
| | | * 类目id |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 类目名称 |
| | | */ |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * TODO |
| | | * |
| | | * @author 39373 |
| | | * @date 2023/2/26 19:42 |
| | | */ |
| | | @Data |
| | | public class Code2Session { |
| | | /** |
| | | * 状态码(-1=系统繁忙,0=成功,40029=code无效,45011=频率限制,每个用户每分钟100次,40226=高风险等级用户,小程序登录拦截 ) |
| | | */ |
| | | private Integer errcode; |
| | | /** |
| | | * 状态说明 |
| | | */ |
| | | private String errmsg; |
| | | /** |
| | | * openid |
| | | */ |
| | | private String openid; |
| | | /** |
| | | * sessionKey |
| | | */ |
| | | private String session_key; |
| | | /** |
| | | * unionid |
| | | */ |
| | | private String unionid; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class KeywordEnum { |
| | | /** |
| | | * 枚举参数的 key |
| | | */ |
| | | private String keywordCode; |
| | | /** |
| | | * 枚举参数值范围列表 |
| | | */ |
| | | private List<String> enumValueList; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 消息模板 |
| | | */ |
| | | @Data |
| | | public class MessageTemplate { |
| | | /** |
| | | * 添加至帐号下的模板 id,发送小程序订阅消息时所需 |
| | | */ |
| | | private String priTmplId; |
| | | /** |
| | | * 模版标题 |
| | | */ |
| | | private String title; |
| | | /** |
| | | * 模版内容 |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 模板内容示例 |
| | | */ |
| | | private String example; |
| | | /** |
| | | * 模版类型,2 为一次性订阅,3 为长期订阅 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 枚举参数值范围 |
| | | */ |
| | | private List<KeywordEnum> keywordEnumValueList; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 公共消息模板关键字 |
| | | */ |
| | | @Data |
| | | public class PubTemplateKeywords { |
| | | /** |
| | | * 关键词 id,选用模板时需要 |
| | | */ |
| | | private Integer kid; |
| | | /** |
| | | * 关键词内容 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 关键词内容对应的示例 |
| | | */ |
| | | private String example; |
| | | /** |
| | | * 参数类型 |
| | | */ |
| | | private String rule; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.driver.modular.system.util.weChat.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 功能模板 |
| | | */ |
| | | @Data |
| | | public class PubTemplatetitles { |
| | | /** |
| | | * 模版标题 id |
| | | */ |
| | | private Integer tid; |
| | | /** |
| | | * 模版标题 |
| | | */ |
| | | private String title; |
| | | /** |
| | | * 模版类型,2 为一次性订阅,3 为长期订阅 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 模版所属类目 id |
| | | */ |
| | | private Integer categoryId; |
| | | } |
| | |
| | | private String code; |
| | | @ApiModelProperty("时间") |
| | | private Long createTime; |
| | | @ApiModelProperty("类型(1=订单收入,3=充值,4=提现,7=优惠券收入,8=保险支付)") |
| | | @ApiModelProperty("类型(3=充值,8=保险支付,9=订单信息费)") |
| | | private Integer type; |
| | | @ApiModelProperty("金额") |
| | | private Double amount; |
| | |
| | | public class CommissionListWarpper { |
| | | @ApiModelProperty("日期") |
| | | private Long createTime; |
| | | @ApiModelProperty("推广类型(1=用户,2=司机)") |
| | | @ApiModelProperty("推广类型(1=线上收入,2=佣金,3=优惠券)") |
| | | private Integer userType; |
| | | @ApiModelProperty("获取佣金") |
| | | private Double amount; |
| | |
| | | private String merchantName; |
| | | @ApiModelProperty("商户电话") |
| | | private String merchantPhone; |
| | | @ApiModelProperty("商户身份证号码") |
| | | @ApiModelProperty("商户身份证号码【1.1】") |
| | | private String merchantIDCode; |
| | | } |
| | |
| | | public class DriverRegisterWarpper { |
| | | @ApiModelProperty(value = "注册区域code", required = true, dataType = "string") |
| | | private String code; |
| | | @ApiModelProperty(value = "头像", required = true, dataType = "string") |
| | | @ApiModelProperty(value = "头像", required = false, dataType = "string") |
| | | private String avatar; |
| | | @ApiModelProperty(value = "姓名", required = false, dataType = "string") |
| | | private String name; |
| | | @ApiModelProperty(value = "手机号码", required = true, dataType = "string") |
| | | private String phone; |
| | | @ApiModelProperty(value = "紧急联系人", required = true, dataType = "string") |
| | |
| | | private String idcardFront; |
| | | @ApiModelProperty(value = "身份证背面照", required = true, dataType = "string") |
| | | private String idcardBack; |
| | | @ApiModelProperty(value = "驾驶证领证时间(2023-01-01)", required = true, dataType = "string") |
| | | private String firstCertificateTime; |
| | | @ApiModelProperty(value = "驾驶证照片", required = true, dataType = "string") |
| | | private String driverLicense; |
| | | @ApiModelProperty(value = "邀约人类型(1=用户,2=司机)", required = false, dataType = "int") |
| | |
| | | private String userName; |
| | | @ApiModelProperty("用户电话") |
| | | private String userPhone; |
| | | @ApiModelProperty("司机id") |
| | | private Integer driverId; |
| | | @ApiModelProperty("用户余额") |
| | | private Double balance; |
| | | @ApiModelProperty("下单次数") |
| | |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("等待时长") |
| | | private Integer waitTime; |
| | | private String waitTime; |
| | | @ApiModelProperty("行驶里程") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("行驶时间") |
| | |
| | | @Data |
| | | @ApiModel |
| | | public class OrderPriceWarpper { |
| | | @ApiModelProperty("订单金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("订单开始时间") |
| | | private Long startTime; |
| | | @ApiModelProperty("订单结束时间") |
| | | private Long endTime; |
| | | @ApiModelProperty("总行驶里程") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("总行驶时间") |
| | | private Integer travelTime; |
| | | @ApiModelProperty("起步里程") |
| | | private Double startDistance; |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("超过起步里程") |
| | | @ApiModelProperty("起步里程") |
| | | private Double startDistance; |
| | | @ApiModelProperty("超出起步里程") |
| | | private Double overDriveDistance; |
| | | @ApiModelProperty("超过起步里程费") |
| | | private Double overDrivePrice; |
| | | @ApiModelProperty("长途里程") |
| | | private Double longDistance; |
| | | @ApiModelProperty("长途费") |
| | | private Double longDistancePrice; |
| | | @ApiModelProperty("超过长途里程") |
| | | private Double overLongDistance; |
| | | @ApiModelProperty("超过长途里程费") |
| | | private Double overLongDistancePrice; |
| | | @ApiModelProperty("里程费") |
| | | private Double mileageFee; |
| | | @ApiModelProperty("等待时长") |
| | | private Integer waitTime; |
| | | private String waitTime; |
| | | @ApiModelProperty("等待费") |
| | | private Double waitTimePrice; |
| | | @ApiModelProperty("超出等待时长") |
| | | private Integer outWaitTime; |
| | | @ApiModelProperty("超出等待费") |
| | | private Double outWaitTimePrice; |
| | | @ApiModelProperty("恶劣天气里程") |
| | | private Double badWeatherDistance; |
| | | @ApiModelProperty("恶劣天气费") |
| | | private Double badWeatherPrice; |
| | | @ApiModelProperty("恶劣天气超出里程") |
| | | private Double overBadWeatherDistance; |
| | | @ApiModelProperty("恶劣天气超出里程费") |
| | | private Double overBadWeatherPrice; |
| | | @ApiModelProperty("折扣金额") |
| | | private Double discountAmount; |
| | | @ApiModelProperty("优惠金额") |
| | | @ApiModelProperty("优惠券金额") |
| | | private Double discountedPrice; |
| | | @ApiModelProperty("恶劣天气费") |
| | | private Double badWeatherPrice; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | @ApiModelProperty("微信收款码") |
| | | private String wxCollectionCode; |
| | | @ApiModelProperty("支付宝收款码") |
| | |
| | | @ApiModelProperty("司机经度") |
| | | private String driverLng; |
| | | @ApiModelProperty("等待时长(分钟)") |
| | | private Integer waitTime; |
| | | private String waitTime; |
| | | @ApiModelProperty("行驶里程(公里)") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("行驶时间(分钟)") |
| | | private Integer travelTime; |
| | | private String travelTime; |
| | | @ApiModelProperty("101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中") |
| | | private Integer state; |
| | | } |
| | |
| | | grantType: authorization_code #填authorization_code |
| | | appid: wx8a9af3889395d0e1 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 95a34f114973298cce4297a20bb59bc3 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: 1 #小程序APPid |
| | | appletsAppSecret: 1 # |
| | | appletsAppid: wx8ae6c610563f2fe6 #小程序APPid |
| | | appletsAppSecret: 8b2c93b0be4f017350050f1e660680fe # |
| | | officialAccountAppid: 11111 |
| | | officialAccountAppSecret: 1111 |
| | | webAppId: 111 |
| | | webAppSecret: 11 |
| | | mchId: 1636941942 #微信支付分配的商户号 |
| | | key: Eri2GR2SB3b6iIhaoD7k3KQ8X0wf1Ybh #key为商户平台设置的密钥key: |
| | | apiv3: AKJ51Z4nhSqYBxmOXgUyCKA1vLP0J5Aj #key为商户平台设置的密钥key: |
| | |
| | | --- |
| | | |
| | | alipay: |
| | | appid: 2021001161600393 #应用程序唯一标识 |
| | | appPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEbTcG2wz+kaYDo2YxflpHE59MvKc3rbl6RlBgO6i5GzgphzeRTv5kRWUpSVkKCsbxFvAYLcgFPmm5nY2fz5hCTKiRcYfpUjH/OougUbzYU3ilUc9JqMbmvy7KN+Kv7+kQYCGLvMqlyYPiJ7LrmJLpE/FUcNLDwo6xUmwJSxaF7M4TbD3ZQZdddki1iJp9GihlqehZCMWOBeotEXvPKDEzSEkYlnvHPQaaspVgeesGmlHDuOiZUokENutxpjo7klWe97NA49hXEtI+xlczNGJKdBr0keBX/kSMsnx8kMxYDjh4QTySBaR6zlO4RYPFekWv9QZ2CrfiKCS7AHUpZYZ5AgMBAAECggEAXjCoUPIBHhhOcowIJe/vGlr0lUohzdJ8+GGGzcvhSDf6DF+mwG3lN0C8oU8QS7o6okRkZW46tLAd1u4fS6oGbDHGPBz6RJQ4B4eGxHMe1OcaCsxTmdq4DmuxRhfV3rnPldwqQA/6O01HxtXhxvzwkWOj5SGSZ7a8c5diTIHh9ULd6neUI/rIFC97mH1TeW0uDIxAtyvswz0pIfDhAR+lsOyTg/8qzsIXjpBFG4gAVxhUeUqQA5HzbsFglC08V7ViDk1OEoWi3yIj1CmNdtntJI4cxqLgTK7MNB9udhbN2I9YasuIpZvlAcvPi5R9cYT8vvFBCFGM+i22wtcsQmxdAQKBgQDaD9y6WNmsp+IaAUG3FqbJC8SqwreGIiEflWwVjrd+LuN6yhyr45CobOmhbTz0de8gRJEZKgJZEJcywL1ScrPIC4n1JaG688lk5aR+0Lik5fy1+L6G/CydJoJqlh6KKdwPJmDGpVu/geLJcLkWcYOwL56IL7GK2JI1p607R0x6iQKBgQCbd0n4xG9GkpvW4LDAJiMEhwPu9QcCKIT0mXVXCgMFdWel9bY3+8RSZoziWutaofm9tRHFAqwjbRyOZ+EdckkNsWVkkTnkKGtAhYKgM0GaOwdMFxmvME5WYJ74a5t1jiezDmR3obUBtS2nyQ8CFPUnlimoTR9F6APrth3h8uvwcQKBgFWaCn1AqdrEYNbyjViRVNHxg7fBDohiV3xtjOt9hfzL7VLjipPTlpL3hlNvbZFNxpx1LjyhqCBMif5LeUanbnnmRbbtmeqpDvNDzupVh1Z8TlMlHa4hymW6m1G6MqzsN83es/jnKvgnxd5sGMx9rUN5vhMaHekykVrswu1VVOl5AoGAMDljh7gfMEv/7TqLeT8bM6dR8AivoNrCy0Di5hnj8AiIGzHJ0TnWnxzSbNB5GwcNeew109/NV7vb1MyiRskRoh657eUiiQSEqGIBsAHWQqo2zEKKJA6e7ipQhYyTj3aGGAPJ5FYT2LDDtb0nW6T2ms34pA0wOzYKKU63nEQHLfECgYEAgbbpZJRtPxWB1M/Dg7loguT5O/VUsKefS0JrSD+tJIqYkumH5mejvYW5YEeDdelkvBhAEFUW9JOkzL+1w1g3wz2QQ2aPV/r55cJE3EfOzbwgw6GsO+8UuyiavbFhS3pFZNI0pR5M3u1+SIcLqQCnYLbO11vnEXglB6wjw9/oxPE= #开发者应用私钥 |
| | | alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhG03BtsM/pGmA6NmMX5aRxOfTLynN625ekZQYDuouRs4KYc3kU7+ZEVlKUlZCgrG8RbwGC3IBT5puZ2Nn8+YQkyokXGH6VIx/zqLoFG82FN4pVHPSajG5r8uyjfir+/pEGAhi7zKpcmD4iey65iS6RPxVHDSw8KOsVJsCUsWhezOE2w92UGXXXZItYiafRooZanoWQjFjgXqLRF7zygxM0hJGJZ7xz0GmrKVYHnrBppRw7jomVKJBDbrcaY6O5JVnvezQOPYVxLSPsZXMzRiSnQa9JHgV/5EjLJ8fJDMWA44eEE8kgWkes5TuEWDxXpFr/UGdgq34igkuwB1KWWGeQIDAQAB #应用公钥 |
| | | alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmDrvcNvhexu3KkxVS9bemdSn6pyQUFmpyOGMDOirGR+RbmldpH2N9bPegzZynb5+bmRHii4ib31XeoXc7M7r6UsPhmPeLoSBNwpC+Uig0VxPa0hmvHjAl6StArhB3eMib6Zo40nM6eCYZLLZ1kKpI5Ad/APov9uLrbSnoeZsgeRibQix07arvTEsZq6pJavNlA+UBjp65o6Bv0+kfQ65pMTpbu+jRtTzkTj1hoW9PjwlWrY21F1FvN67zDWkTB2LjGFsqan0Qoe4/X8nK3VsDvkjIm/ZQsnQr8ZzfcuTzQPrcZpo3h9DPZoHeiToEfXtyk7E0bQHEmYVpmrvk/IJwIDAQAB #支付宝公钥 |
| | | appid: 111 #应用程序唯一标识 |
| | | appPrivateKey: 111 #开发者应用私钥 |
| | | alipayPublicKey: 111 #应用公钥 |
| | | alipay_public_key: 111 #支付宝公钥 |
| | | |
| | | --- |
| | | |
| | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | #callbackPath: https://okyueche.com:443/user |
| | | callbackPath: https://chaoshengdaijia.com:443/driver |
| | | #测试环境 |
| | | callbackPath: http://121.37.15.157:80/driver |
| | | #callbackPath: http://121.37.15.157:80/driver |
| | | |
| | | |
| | | --- |
| | |
| | | |
| | | # mallbook 调起接口参数配置 |
| | | mallbook: |
| | | # pay_url:mallbook接口地址 测试环境: http://ld.mallbook.cn:12000/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: http://ld.mallbook.cn:12000/api |
| | | # pay_url:mallbook接口地址 测试环境: https://uat.mallbook.cn/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: https://cloudpay.mallbook.cn/api |
| | | # merchant_no 业务系统商户平台编号,需替换为mallbook工作人员提供的商户编号 |
| | | merchant_no: 需要替换内容 |
| | | merchant_no: MBH23056 |
| | | # version 接口版本号 |
| | | version: 1.0.0 |
| | | # channel_type 渠道类型 HF:汇付 |
| | | channel_type: HF |
| | | # merchant_private_key 商户平台私钥,需要替换成商户平台自己生成的私钥 |
| | | merchant_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoGARvX6k6rVwuUW6HjAPkzXVntCtDI8q/niGZbeILc5T/noer+UNDECSy9f8T6ENw7tEKWaHOFcicrqgRv+wXeo2hPiJI2iYsUNs6I8ckd8i4uy/PBEDMW78GlnQLAatk0NC44HKjn8cuIHaETKNG2Vk3rwGBzNgDZ/God1L6JAgMBAAECgYBhCsOwzehBk5pJ2+9pLO+8Rm72EQGvtflb0BBI1zst1x2gBr4DOPedMJe6yymQVrmP/rJItvONdV/DRqHtKMZ2Wa4ul/U1mDnAtS/FkpRYBA5FaXV2hNEW11xBLhL5iGk35P23Bzaa0MJw9Vsd0vjeykridIw/PweDyTdeRBwC2QJBANS+iOaKRuf6BRwCKDmBSHOiZmc/kKnpx2f5BD3h+LWEX3JsNxObMbW1SxQIf2/qwqzIoEm/WbWaOyuwtRZkXQ8CQQCmFjTm5l+Ws2LoQgM+5+eLmPyMyRFOu4G8yqsUkhKuANHK/qrsS1GTbv6SN341NijjNYl05e0h6Jq1T9UZmtrnAkEAwTfzmn7H+3RmI5QJ+IBkzzEWFHv05X0/8DyID7QmcKWzEncaZqIzObdYYu983qa2/LqSaahyz68uQnYRYi7xHQJATr3SgPIRuaH8r360iTtrRHzYp2qgYQJ25On1KECEyKgszp/kqzieSVbjLLFQjavKwMXeEGT+AwiDaJibwJLxWwJAXZApORsqGqdxc9FTxt5iiqG2ZP5DTXxc6E+ihmlmoVl9KncgTf9ez0Q0Qz/4KUTPTHNVgzt1nyBxiLtnyzFavA== |
| | | merchant_private_key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALHmyTrxPYcAwABnX+3VW9vxUftm57zBpnbfOT4vizMnKdpfCkIgtdbfdnSCtt637yWM2fxnZfItnhTeQA2lL8f4SXgZt/bVXfmAWi4IxQ+HJy0Qs8nNy2nnjICPBPcpWzHwUxQ/THHqU0a7b9B91J5DFcbQb25BHeRpHwkBw6A/AgMBAAECgYAmcWq2s/7Jt53F+JDAQkTRaHqAyyH0phwkv+QMzhVUfngK2lLLK2pf/nYIg16lDjY9dQx+AJIFHVp1w/kveayzOz3BIqPoznyIVYPolRGZCWPo+2vdp0CIdBh7zahST5g5Gem4cU47wO5hPYs1kXKPG4mUPtaIAMHFxhyLvIagAQJBAOS63AIZrRrldeNCVVNXbpAT52JuWLCgravM9coOh6scmG6UQwxxcott8hneHr9fazk2LHbHMxlG8F+dQPA0+D8CQQDHHJN7Dnske8oJ+1sq4uhQP3HMsmNIgth+ZcaZpiPcxnNKYVGhzAwTVV2ruFJle5ajebo6zfWuqJhtZGRNh1gBAkA/lRoXk1+lfGfa9tOVSVa4wm+t0xLgdqoQefdRZdyc2mQdSSWiTd8Tl0qXmkFd3X6G9uJBWnp/6lJjoektXOwtAkBsZTQsw99qJzIAaSRinpDWTxPG2j6OlR0DAqkxsG7JnAfbsEteh9TzGYAbIgdJVBTX/kbSCJn9ca85rnOkeVABAkAUbDfU3Z702z20NtwAxc1IkrtQ1lKuqSpj9/LuR1/6KRkYQsUWnUiOO9hu5YDWIcflFrnCenF8j8OnvGghltxT |
| | | # mall_book_public_key mallbook测试环境公钥 不需要替换 |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0L2DaHOO8ekhktB6RoHxIcki/0v7OUeOn9tX9VBE+jv6PRjqlZRWL3Qezxz5ADtHEyLv+RFFaceXSep6rWyoQ6DRlvLv5CySUAxAM42LLVe4DI3l/0ccEAIuU5NCpwAAj1zkm2X01DwUCZwymLjlqbDlBvQhpq+1fddtTtA/QLQIDAQAB |
| | | # mall_book_public_key mallbook生产环境公钥 不需要替换 |
| | | # mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | |
| | |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | <maxHistory>200</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | |
| | | //package com.supersavedriving.driver; |
| | | // |
| | | //import com.supersavedriving.driver.modular.system.model.WeatherCity; |
| | | //import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | //import com.supersavedriving.driver.modular.system.service.IOrderService; |
| | | //import com.supersavedriving.driver.modular.system.service.IWeatherCityService; |
| | | // import com.alibaba.fastjson.JSON; |
| | | // import com.alibaba.fastjson.JSONObject; |
| | | // import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | // import com.supersavedriving.driver.core.util.ToolUtil; |
| | | // import com.supersavedriving.driver.modular.system.model.*; |
| | | // import com.supersavedriving.driver.modular.system.service.*; |
| | | // import com.supersavedriving.driver.modular.system.service.impl.CashWithdrawalServiceImpl; |
| | | // import com.supersavedriving.driver.modular.system.service.impl.OrderServiceImpl; |
| | | // import com.supersavedriving.driver.modular.system.util.MallBook.model.*; |
| | | // import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | // import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | //import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | // import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | //import com.supersavedriving.driver.modular.system.util.juhe.WeatherCityInfo; |
| | | //import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil; |
| | | // import com.supersavedriving.driver.modular.system.warpper.OrderPriceWarpper; |
| | | //import com.supersavedriving.driver.modular.system.warpper.PerformanceSummaryWarpper; |
| | | //import org.junit.Test; |
| | | //import org.junit.runner.RunWith; |
| | |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | // import java.text.SimpleDateFormat; |
| | | // import java.util.*; |
| | | // |
| | | // |
| | | //@RunWith(SpringRunner.class) |
| | |
| | | // @Autowired |
| | | // private IOrderService orderService; |
| | | // |
| | | // @Autowired |
| | | // private IDriverService driverService; |
| | | // |
| | | // @Autowired |
| | | // private IDriverBankService driverBankService; |
| | | // |
| | | // @Autowired |
| | | // private IAppUserService appUserService; |
| | | // |
| | | // @Autowired |
| | | // private ISystemConfigService systemConfigService; |
| | | // |
| | | // @Autowired |
| | | // private IAccountChangeDetailService accountChangeDetailService; |
| | | // |
| | | // @Autowired |
| | | // private IRevenueService revenueService; |
| | | // |
| | | // @Autowired |
| | | // private IRechargeRecordService rechargeRecordService; |
| | | // |
| | | // @Autowired |
| | | // private IAgentService agentService; |
| | | // |
| | | // @Autowired |
| | | // private IDivisionRecordService divisionRecordService; |
| | | // |
| | | // @Autowired |
| | | // private ICashWithdrawalService cashWithdrawalService; |
| | | // |
| | | // @Autowired |
| | | // private RedisUtil redisUtil; |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // @Test |
| | | // public void test() throws Exception { |
| | | // PerformanceSummaryWarpper performanceSummaryWarpper = orderService.queryPerformanceSummary(1, 1, "2023年", 3); |
| | | //// Withdraw withdraw = new Withdraw(); |
| | | //// withdraw.setUserId("79796121680"); |
| | | //// withdraw.setAmount(String.valueOf(Double.valueOf(54.48 * 100).intValue())); |
| | | //// withdraw.setOrderName("账户余额提现"); |
| | | //// withdraw.setRemark("账户余额提现"); |
| | | //// withdraw.setNotifyUrl("https://chaoshengdaijia.com:443/driver/base/driver/withdrawCashCallback"); |
| | | //// withdraw.setParameter1("1"); |
| | | //// TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | //// InterfaceResponse execute = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | | //// if("0000".equals(execute.getCode())){ |
| | | //// JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | //// String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | //// Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | //// if(1 == status){ |
| | | //// } |
| | | //// if(2 == status){ |
| | | //// System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | //// } |
| | | //// }else{ |
| | | //// System.err.println("结算接口异常【提现】:" + execute.getMsg()); |
| | | //// } |
| | | // |
| | | // |
| | | // |
| | | //// QueryUser queryUser = new QueryUser(); |
| | | //// /** |
| | | //// * 业务系统会员ID(必填) 字段长度最长:32位 |
| | | //// */ |
| | | //// queryUser.setMerUserId("driver_13"); |
| | | //// TrhRequest<QueryUser> request = new TrhRequest(); |
| | | //// InterfaceResponse execute = request.execute(queryUser, QueryUser.SERVICE_CODE); |
| | | //// if("0000".equals(execute.getCode())){ |
| | | //// JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | //// String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | //// Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | //// if(1 == status){ |
| | | //// } |
| | | //// if(2 == status){ |
| | | //// System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | //// } |
| | | //// }else{ |
| | | //// System.err.println("结算接口异常【提现】:" + execute.getMsg()); |
| | | //// } |
| | | // |
| | | // |
| | | // for (int i = 0; i < 2; i++) { |
| | | // String value = redisUtil.getValue("repeat_" + 10); |
| | | // if(ToolUtil.isEmpty(value)){ |
| | | // redisUtil.setStrValue("repeat_" + 10, System.currentTimeMillis() + "", 600);//10分钟 |
| | | // }else{ |
| | | // Long s = System.currentTimeMillis() - Long.valueOf(value); |
| | | // if(s.compareTo(60000L) < 0){//1分钟 |
| | | // System.err.println("数据处理中"); |
| | | // } |
| | | //} |
| | | // } |
| | | // } |
| | | // |
| | | //} |
| | |
| | | </content> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-core:5.3.8" level="project" /> |
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-crypto:5.3.8" level="project" /> |
| | | <orderEntry type="module" module-name="guns-core (1)" /> |
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatisplus-spring-boot-starter:1.0.5" level="project" /> |
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.0.4.RELEASE" level="project" /> |
| | |
| | | <orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.23.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.23.Final" level="project" /> |
| | | <orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.23.Final" level="project" /> |
| | | <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.20" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.github.wechatpay-apiv3:wechatpay-java-shangmi:0.2.1" level="project" /> |
| | | <orderEntry type="library" name="Maven: com.github.wechatpay-apiv3:wechatpay-java-core:0.2.1" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.tencent.kona:kona-crypto:1.0.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: org.bouncycastle:bcprov-jdk18on:1.72" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.tencent.kona:kona-pkix:1.0.3" level="project" /> |
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: com.tencent.kona:kona-provider:1.0.3" level="project" /> |
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.7.7" level="project" /> |
| | | </component> |
| | | </module> |
| | |
| | | </parent> |
| | | <packaging>war</packaging> |
| | | |
| | | <properties> |
| | | <hutool.version>5.3.8</hutool.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- hutool工具类--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-core</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-crypto</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <!--<dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <!--引入本地工行支付jar end--> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.20</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.wechatpay-apiv3</groupId> |
| | | <artifactId>wechatpay-java-shangmi</artifactId> |
| | | <version>0.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.7.7</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | */ |
| | | Map<String, String> hashMap = new LinkedHashMap<>(); |
| | | hashMap.put("/static/**", "anon"); |
| | | hashMap.put("/base/**", "anon"); |
| | | hashMap.put("/gunsApi/**", "anon"); |
| | | hashMap.put("/login", "anon"); |
| | | hashMap.put("/global/sessionError", "anon"); |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.TAgent; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.ITAgentService; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.BindAccount; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.TrhRequest; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | |
| | | * @Date 2018/7/20 23:39 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/gunsApi") |
| | | @RequestMapping("") |
| | | public class ApiController extends BaseController { |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | private ITAgentService tAgentService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/microenterpriseCallback") |
| | | public void microenterpriseCallback(@RequestBody InterfaceResponse response){ |
| | | if("0000".equals(response.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(response.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | TAgent tAgent = tAgentService.selectById(parameter1); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | //开始绑定结算账户 |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | bindAccount.setBankCode(tAgent.getBankCode()); |
| | | /** |
| | | * api登录接口,通过账号密码获取token |
| | | * 省份编码 |
| | | */ |
| | | @RequestMapping("/auth") |
| | | public Object auth(@RequestParam("username") String username, |
| | | @RequestParam("password") String password) { |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password.toCharArray()); |
| | | |
| | | //获取数据库中的账号密码,准备比对 |
| | | User user = userMapper.getByAccount(username); |
| | | |
| | | String credentials = user.getPassword(); |
| | | String salt = user.getSalt(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | |
| | | if (passwordTrueFlag) { |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("token", JwtTokenUtil.generateToken(String.valueOf(user.getId()))); |
| | | return result; |
| | | bindAccount.setProvCode("0035"); |
| | | /** |
| | | * 地区编码 |
| | | */ |
| | | bindAccount.setAreaCode("3501"); |
| | | TrhRequest<BindAccount> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | } else { |
| | | return new ErrorTip(500, "账号密码错误!"); |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试接口是否走鉴权 |
| | | */ |
| | | @RequestMapping(value = "/test", method = RequestMethod.POST) |
| | | public Object test() { |
| | | return SUCCESS_TIP; |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + response.getMsg()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.util.ZipUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.server.HttpServerResponse; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.common.constant.state.ManagerStatus; |
| | | import com.stylefeng.guns.core.exception.GunsException; |
| | | import com.stylefeng.guns.core.exception.ServiceExceptionEnum; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAgentResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.enums.PayStatusEnum; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.*; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.hdf.extractor.TC; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.net.InetAddress; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | * @Date 2023-02-20 09:18:08 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tAgent") |
| | | @RequestMapping("") |
| | | public class TAgentController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tAgent/"; |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ISettlementRecordService settlementRecordService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private ITSystemConfigService systemConfigService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | @RequestMapping("/tAgent") |
| | | public String index(Model model) { |
| | | model.addAttribute("userType", Objects.requireNonNull(ShiroKit.getUser()).getRoleType()); |
| | | return PREFIX + "tAgent.html"; |
| | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tAgent_add") |
| | | @RequestMapping("/tAgent/tAgent_add") |
| | | public String tAgentAdd() { |
| | | return PREFIX + "tAgent_add.html"; |
| | | } |
| | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tAgent_update/{tAgentId}") |
| | | @RequestMapping("/tAgent/tAgent_update/{tAgentId}") |
| | | public String tAgentUpdate(@PathVariable Integer tAgentId, Model model) { |
| | | TAgent tAgent = tAgentService.selectById(tAgentId); |
| | | model.addAttribute("item",tAgent); |
| | |
| | | /** |
| | | * 跳转详情页面 |
| | | */ |
| | | @RequestMapping("/agentDetail") |
| | | @RequestMapping("/tAgent/agentDetail") |
| | | public String agentDetail(Integer agentId, Model model) { |
| | | tAgentService.detail(agentId,model); |
| | | return PREFIX + "tAgentDetail.html"; |
| | |
| | | /** |
| | | * 跳转区域页面 |
| | | */ |
| | | @RequestMapping("/areaDetail") |
| | | @RequestMapping("/tAgent/areaDetail") |
| | | public String areaDetail(String area,String areaId,Model model) { |
| | | // String[] split1 = areaId.split("/"); |
| | | // List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | // model.addAttribute("provinceList",tRegions); |
| | | //// List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | //// // 查询市 |
| | | //// List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0])); |
| | | //// model.addAttribute("cityList",tRegions1); |
| | | //// |
| | | //// // 查询区 |
| | | //// List<Integer> cityIds = tRegions1.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | //// List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", cityIds)); |
| | | //// model.addAttribute("districtList",tRegions2); |
| | | // |
| | | // if(StringUtils.hasLength(area) && StringUtils.hasLength(areaId)){ |
| | | // String[] split = area.split("/"); |
| | | // model.addAttribute("provinceName",split[0]); |
| | | // model.addAttribute("cityName",split[1]); |
| | | // if(split.length>2){ |
| | | // model.addAttribute("districtName",split[2]); |
| | | // }else { |
| | | // model.addAttribute("districtName",""); |
| | | // } |
| | | // |
| | | // model.addAttribute("provinceId",split1[0]); |
| | | // model.addAttribute("cityId",split1[1]); |
| | | // if(split1.length>2) { |
| | | // model.addAttribute("districtId", split1[2]); |
| | | // }else { |
| | | // model.addAttribute("districtId", ""); |
| | | // } |
| | | // |
| | | // List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0])); |
| | | // model.addAttribute("cityList",tRegions1); |
| | | // |
| | | // // 查询区 |
| | | // List<TRegion> tRegions2 = tRegionService.selectList(new EntityWrapper<TRegion>().in("parent_id", split1[1])); |
| | | // model.addAttribute("districtList",tRegions2); |
| | | // }else { |
| | | // model.addAttribute("cityList",new ArrayList<>()); |
| | | // model.addAttribute("districtList",new ArrayList<>()); |
| | | // |
| | | // model.addAttribute("provinceName",""); |
| | | // model.addAttribute("cityName",""); |
| | | // model.addAttribute("districtName",""); |
| | | // |
| | | // model.addAttribute("provinceId",""); |
| | | // model.addAttribute("cityId",""); |
| | | // model.addAttribute("districtId", ""); |
| | | // } |
| | | String[] split1 = areaId.split("/"); |
| | | List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | model.addAttribute("province",tRegions); |
| | | List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | model.addAttribute("provinceList",tRegions); |
| | | // List<Integer> provinceIds = tRegions.stream().map(TRegion::getId).collect(Collectors.toList()); |
| | | // 查询市 |
| | | List<TRegion> tRegions1 = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", split1[0])); |
| | | model.addAttribute("cityList",tRegions1); |
| | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @RequestMapping(value = "/tAgent/list") |
| | | @ResponseBody |
| | | public Object list(String principal,String principalPhone,String createTime,Integer status) { |
| | | EntityWrapper<TAgent> wrapper = tAgentService.getAgentWrapper(principal,principalPhone,createTime,status); |
| | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list-back") |
| | | @RequestMapping(value = "/tAgent/list-back") |
| | | @ResponseBody |
| | | public Object listBack(String condition) { |
| | | return tAgentService.selectList(null); |
| | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @RequestMapping(value = "/tAgent/add") |
| | | @ResponseBody |
| | | @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW) |
| | | public Object add(TAgent tAgent) { |
| | | |
| | | String[] split1 = tAgent.getArea().split("/"); |
| | | |
| | | int count = tAgentService.selectCount(new EntityWrapper<TAgent>().eq("provinceName", split1[0]).eq("cityName",split1[1])); |
| | | // int count = tAgentService.selectCount(new EntityWrapper<TAgent>() |
| | | // .eq("provinceName", split1[0]) |
| | | // .eq("cityName",split1[1]) |
| | | // .eq("districtName",sp)); |
| | | int count = tAgentService.selectCount(new EntityWrapper<TAgent>() |
| | | .eq("merchantName", tAgent.getMerchantName())); |
| | | if(count>0){ |
| | | return new SuccessTip(500,"该代理商已存在!"); |
| | | } |
| | |
| | | user.setSex(1); |
| | | userService.insert(user); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | registeredMerchant(tAgent); |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | |
| | | public void registeredMerchant(TAgent tAgent){ |
| | | if(tAgent.getUserType() == 0){ |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("agent_" + tAgent.getId()); |
| | | registerVO.setPhone(tAgent.getPrincipalPhone()); |
| | | registerVO.setUserType("0"); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/tAgent/microenterpriseCallback"); |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | }else{ |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | } |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + execute.getMsg()); |
| | | } |
| | | }else{ |
| | | Register registerVO = new Register(); |
| | | registerVO.setMerUserId("agent_" + tAgent.getId()); |
| | | registerVO.setPhone(tAgent.getPrincipalPhone()); |
| | | registerVO.setUserType(tAgent.getUserType().toString()); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | registerVO.setCertIdExpires(sdf.format(tAgent.getCertIdExpires())); |
| | | registerVO.setBusinessScope(tAgent.getBusinessScope()); |
| | | registerVO.setSocialCreditCode(tAgent.getSocialCreditCode()); |
| | | registerVO.setSocialCreditCodeExpires(sdf.format(tAgent.getSocialCreditCodeExpires())); |
| | | registerVO.setLegalPhone(tAgent.getLegalPhone()); |
| | | registerVO.setLegalPerson(tAgent.getLegalPerson()); |
| | | registerVO.setAddress(tAgent.getAddress()); |
| | | registerVO.setProvCode(tAgent.getProvCodeEnterprise()); |
| | | registerVO.setAreaCode(tAgent.getAreaCodeEnterprise()); |
| | | registerVO.setFileNo(tAgent.getFileNo()); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/tAgent/microenterpriseCallback"); |
| | | registerVO.setParameter1(tAgent.getId().toString()); |
| | | |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse response = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(response.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(response.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if("1".equals(status)){ |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | //开始绑定结算账户 |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | bindAccount.setBankCode(tAgent.getBankCode()); |
| | | bindAccount.setProvCode(tAgent.getProvCodeBank()); |
| | | bindAccount.setAreaCode(tAgent.getAreaCodeBank()); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败" ); |
| | | } |
| | | if("1".equals(status1)){ |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | }else{ |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | System.err.println("注册代理商子商户异常:" + response.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 注册商户回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/tAgent/microenterpriseCallback") |
| | | public void microenterpriseCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())) { |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | TAgent tAgent = tAgentService.selectById(parameter1); |
| | | if ("2".equals(status)) { |
| | | tAgent.setMerchantStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if ("0".equals(status)) { |
| | | tAgent.setMerchantStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if ("1".equals(status)) { |
| | | String userId = jsonObject.getString("userId"); |
| | | tAgent.setMerchantNumber(userId); |
| | | tAgent.setMerchantStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | |
| | | //开始绑定结算账户 |
| | | BindAccount bindAccount = new BindAccount(); |
| | | bindAccount.setUserId(tAgent.getMerchantNumber()); |
| | | bindAccount.setCertId(tAgent.getMerchantIDCode()); |
| | | bindAccount.setCardName(tAgent.getCardName()); |
| | | bindAccount.setCardNo(tAgent.getCardNo()); |
| | | bindAccount.setBankAcctType(tAgent.getBankAcctType().toString()); |
| | | bindAccount.setPhone(tAgent.getPhone()); |
| | | bindAccount.setBankCode(tAgent.getBankCode()); |
| | | bindAccount.setProvCode(tAgent.getProvCodeBank()); |
| | | bindAccount.setAreaCode(tAgent.getAreaCodeBank()); |
| | | TrhRequest<BindAccount> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(bindAccount, BindAccount.SERVICE_CODE); |
| | | if ("0000".equals(execute.getCode())) { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if ("2".equals(status1)) { |
| | | tAgent.setBankStatus(2); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户失败"); |
| | | } |
| | | if ("1".equals(status1)) { |
| | | tAgent.setBankStatus(1); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户成功"); |
| | | } |
| | | if ("0".equals(status1)) { |
| | | tAgent.setBankStatus(0); |
| | | tAgentService.updateById(tAgent); |
| | | System.err.println("绑定结算账户处理中"); |
| | | } |
| | | } else { |
| | | System.err.println("绑定结算账户失败:" + execute.getMsg()); |
| | | } |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @RequestMapping(value = "/tAgent/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tAgentId) { |
| | | tAgentService.deleteById(tAgentId); |
| | |
| | | /** |
| | | * 修改用户状态 |
| | | */ |
| | | @RequestMapping(value = "/update-status") |
| | | @RequestMapping(value = "/tAgent/update-status") |
| | | @ResponseBody |
| | | public Object updateStatus(Integer id,Integer status) { |
| | | TAgent tAgent = tAgentService.selectById(id); |
| | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @RequestMapping(value = "/tAgent/update") |
| | | @ResponseBody |
| | | public Object update(TAgent tAgent) { |
| | | tAgent.setPrincipal(tAgent.getPrincipal().replace(" ","")); |
| | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tAgentId}") |
| | | @RequestMapping(value = "/tAgent/detail/{tAgentId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tAgentId") Integer tAgentId) { |
| | | return tAgentService.selectById(tAgentId); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "省市区查询",notes="省市区查询") |
| | | @RequestMapping(value = "/area") |
| | | @RequestMapping(value = "/tAgent/area") |
| | | @ResponseBody |
| | | public Object area() { |
| | | return tRegionService.getAreaList(); |
| | | } |
| | | |
| | | @ApiOperation(value = "省查询",notes="省查询") |
| | | @RequestMapping(value = "/areaProvince") |
| | | @RequestMapping(value = "/tAgent/areaProvince") |
| | | @ResponseBody |
| | | public Object areaProvince(Model model) { |
| | | return tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | } |
| | | |
| | | @ApiOperation(value = "市区查询",notes="市区查询") |
| | | @RequestMapping(value = "/areaCity") |
| | | @RequestMapping(value = "/tAgent/areaCity") |
| | | @ResponseBody |
| | | public Object areaCity(Integer parentId) { |
| | | return tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id",parentId)); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "导出代理商列表",notes="导出代理商列表") |
| | | @RequestMapping(value = "/export") |
| | | @RequestMapping(value = "/tAgent/export") |
| | | @ResponseBody |
| | | public void export(String principal,String principalPhone,Integer status,String createTime, HttpServletResponse response) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/tAgent/uploadFile") |
| | | public String uploadFile(MultipartFile file){ |
| | | File srcFile = null; |
| | | String originalFilename = file.getOriginalFilename(); |
| | | String substring = originalFilename.substring(originalFilename.lastIndexOf(".")); |
| | | String fileName = ""; |
| | | try { |
| | | fileName = UUIDUtil.getRandomCode(28) + ".png"; |
| | | srcFile = multipartFileToFile(file, fileName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ImageUpload imageUpload = new ImageUpload(); |
| | | imageUpload.setMerUserId("33567678901213221"); |
| | | File zip = ZipUtil.zip(srcFile); |
| | | imageUpload.setName(zip.getName()); |
| | | imageUpload.setFile(Base64.encode(zip)); |
| | | TrhRequest<ImageUpload> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(imageUpload, ImageUpload.SERVICE_CODE); |
| | | if(execute.getCode().equals("0000")){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | return jsonObject.getString("fileNo"); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | public File multipartFileToFile(MultipartFile file, String fileName) throws Exception { |
| | | File toFile = null; |
| | | if (file.equals("") || file.getSize() <= 0) { |
| | | file = null; |
| | | } else { |
| | | InputStream ins = null; |
| | | ins = file.getInputStream(); |
| | | toFile = new File("D:\\logs\\" + fileName); |
| | | inputStreamToFile(ins, toFile); |
| | | ins.close(); |
| | | } |
| | | return toFile; |
| | | |
| | | } |
| | | |
| | | |
| | | private static void inputStreamToFile(InputStream ins, File file) { |
| | | try { |
| | | OutputStream os = new FileOutputStream(file); |
| | | int bytesRead = 0; |
| | | byte[] buffer = new byte[8192]; |
| | | while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | os.close(); |
| | | ins.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到企业信息页 |
| | | * @return |
| | | */ |
| | | @GetMapping("/tAgent/showEnterprisePage") |
| | | public String showEnterprisePage(Model model){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | | Integer roleType = user.getRoleType(); |
| | | User user1 = userService.selectById(user.getId()); |
| | | TAgent tAgent = new TAgent(); |
| | | if(roleType == 1){//平台 |
| | | tAgent.setPrincipal(user1.getName()); |
| | | tAgent.setPrincipalPhone(user1.getPhone()); |
| | | tAgent.setEmail(user1.getEmail()); |
| | | tAgent.setMerchantNumber("553021440975"); |
| | | } |
| | | if(roleType == 3){//代理商 |
| | | tAgent = tAgentService.selectById(objectId); |
| | | } |
| | | model.addAttribute("roleType", roleType); |
| | | model.addAttribute("item", tAgent); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | model.addAttribute("socialCreditCodeExpires", roleType == 1 ? "" :Objects.isNull(tAgent.getSocialCreditCodeExpires())?"": sdf.format(tAgent.getSocialCreditCodeExpires())); |
| | | model.addAttribute("certIdExpires", roleType == 1 ? "" : null == tAgent.getCertIdExpires() ? "" : sdf.format(tAgent.getCertIdExpires())); |
| | | Wrapper<SettlementRecord> settlementRecordWrapper = new EntityWrapper<SettlementRecord>().eq("type", roleType == 1 ? 1 : 2); |
| | | if(roleType == 2){ |
| | | settlementRecordWrapper.eq("objectId", objectId); |
| | | } |
| | | List<SettlementRecord> settlementRecords = settlementRecordService.selectList(settlementRecordWrapper.isNotNull("arrivalTime").orderBy("insertTime desc")); |
| | | model.addAttribute("settlementRecords", settlementRecords); |
| | | |
| | | QueryBalance queryBalance = new QueryBalance(); |
| | | queryBalance.setUserId(tAgent.getMerchantNumber()); |
| | | TrhRequest<QueryBalance> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(queryBalance, QueryBalance.SERVICE_CODE); |
| | | model.addAttribute("balance", 0); |
| | | model.addAttribute("marketingAmount", 0); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | model.addAttribute("balance", jsonObject.getDoubleValue("settledAmount") / 100); |
| | | if(roleType == 1){ |
| | | Double amount = rechargeRecordService.querSumSurplusDividedAmount(4); |
| | | model.addAttribute("marketingAmount", amount); |
| | | } |
| | | } |
| | | return PREFIX + "enterprisePage.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现申请 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/tAgent/withdrawCash") |
| | | public ResultUtil withdrawCash(){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | | Integer roleType = user.getRoleType(); |
| | | User user1 = userService.selectById(user.getId()); |
| | | TAgent tAgent = new TAgent(); |
| | | if(roleType == 1){//平台 |
| | | tAgent.setLegalPerson(user1.getName()); |
| | | tAgent.setLegalPhone(user1.getPhone()); |
| | | tAgent.setEmail(user1.getEmail()); |
| | | tAgent.setMerchantNumber("553021440975"); |
| | | } |
| | | if(roleType == 3){//代理商 |
| | | tAgent = tAgentService.selectById(objectId); |
| | | } |
| | | QueryBalance queryBalance = new QueryBalance(); |
| | | queryBalance.setUserId(tAgent.getMerchantNumber()); |
| | | TrhRequest<QueryBalance> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(queryBalance, QueryBalance.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer settledAmount = jsonObject.getInteger("settledAmount"); |
| | | if(0 == settledAmount){ |
| | | return ResultUtil.error("余额不足"); |
| | | } |
| | | SettlementRecord settlementRecord = new SettlementRecord(); |
| | | settlementRecord.setType(roleType == 1 ? 1 : 2); |
| | | if(roleType == 3){ |
| | | settlementRecord.setObjectId(tAgent.getId()); |
| | | } |
| | | settlementRecord.setAmount(Double.valueOf(settledAmount) / 100); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | |
| | | |
| | | Withdraw withdraw = new Withdraw(); |
| | | withdraw.setUserId(tAgent.getMerchantNumber()); |
| | | withdraw.setAmount(String.valueOf(settledAmount)); |
| | | withdraw.setOrderName("账户余额提现"); |
| | | withdraw.setRemark("账户余额提现"); |
| | | withdraw.setNotifyUrl(callbackPath + "/base/tAgent/withdrawCashCallback"); |
| | | withdraw.setParameter1(settlementRecord.getId().toString()); |
| | | TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(0 == status){ |
| | | return ResultUtil.error("申请处理中"); |
| | | } |
| | | if(1 == status){ |
| | | settlementRecord.setOrderNumber(merOrderId1); |
| | | settlementRecord.setArrivalTime(new Date()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | return ResultUtil.success(); |
| | | } |
| | | if(2 == status){ |
| | | return ResultUtil.error("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | return ResultUtil.error("结算接口异常【提现】:" + execute.getMsg()); |
| | | } |
| | | |
| | | }else{ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | return ResultUtil.error("未知异常"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 提现回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/tAgent/withdrawCashCallback") |
| | | public void withdrawCashCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response) { |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId1 = jsonObject1.getString("merOrderId"); |
| | | Integer status = jsonObject1.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject1.getString("parameter1"); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(parameter1); |
| | | settlementRecord.setOrderNumber(merOrderId1); |
| | | settlementRecord.setArrivalTime(new Date()); |
| | | settlementRecordService.updateById(settlementRecord); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | if(2 == status){ |
| | | System.err.println("结算接口异常【提现】:" + jsonObject1.getString("statusMsg")); |
| | | } |
| | | }else{ |
| | | System.err.println("结算接口异常【提现】:" + interfaceResponse.getMsg()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 充值补贴金额 |
| | | * @param amount |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/tAgent/accountRecharge") |
| | | public ResultUtil accountRecharge(Double amount){ |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); |
| | | RechargeRecord rechargeRecord = new RechargeRecord(); |
| | | rechargeRecord.setCode(out_trade_no); |
| | | rechargeRecord.setType(4); |
| | | rechargeRecord.setAmount(amount); |
| | | rechargeRecord.setPayType(2); |
| | | rechargeRecord.setPayStatus(1); |
| | | rechargeRecord.setCreateTime(new Date()); |
| | | rechargeRecordService.insert(rechargeRecord); |
| | | |
| | | Deposit deposit = new Deposit(); |
| | | deposit.setAmount(String.valueOf(Double.valueOf(amount * 100).intValue())); |
| | | deposit.setOrderName("补贴充值"); |
| | | deposit.setPayType("ALI_CB"); |
| | | deposit.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | deposit.setFrontUrl(callbackPath + "/base/tAgent/accountRechargeCallback"); |
| | | deposit.setNotifyUrl(callbackPath + "/base/tAgent/accountRechargeCallback"); |
| | | deposit.setParameter1(rechargeRecord.getId().toString()); |
| | | TrhRequest<Deposit> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(deposit, Deposit.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | return ResultUtil.error("支付异常"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | RechargeRecord rechargeRecord1 = rechargeRecordService.selectById(rechargeRecord.getId()); |
| | | if(rechargeRecord1.getPayStatus() != 1){ |
| | | return; |
| | | } |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | /** |
| | | * 1:支付查询 2:退款查询 3:确认收货查询 4:结算查询 5:充值查询 6:转账查询 7:异步分账查询(必填) 字段长度最长:1位 |
| | | */ |
| | | queryOrder.setQueryType("5"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(merOrderId); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | break; |
| | | } |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return ResultUtil.success(payCode); |
| | | }else{ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 补贴金额充值回调 |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/tAgent/accountRechargeCallback") |
| | | public void accountRechargeCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | System.err.println("支付异常"); |
| | | return; |
| | | } |
| | | if(1 == status){ |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | RechargeRecord rechargeRecord = rechargeRecordService.selectById(parameter1); |
| | | rechargeRecord.setPayStatus(2); |
| | | rechargeRecord.setPayTime(new Date()); |
| | | rechargeRecord.setOrderNumber(jsonObject.getString("merOrderId")); |
| | | rechargeRecord.setSurplusDividedAmount(rechargeRecord.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }else{ |
| | | System.err.println(interfaceResponse.getMsg()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | user.setAccount(tBranchOffice.getAccount()); |
| | | user.setPassword(ShiroKit.md5(user.getPassword(), user.getSalt())); |
| | | user.setPassword(ShiroKit.md5(tBranchOffice.getPassword(), user.getSalt())); |
| | | userService.updateById(user); |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | import com.stylefeng.guns.modular.system.controller.util.HttpUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.TokenUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TDriverWork; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.ui.Model; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.Period; |
| | |
| | | @Autowired |
| | | private ITRechargeRecordService tRechargeRecordService; |
| | | |
| | | @Autowired |
| | | private ITSystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private AccountChangeDetailMapper accountChangeDetailMapper; |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | /** |
| | |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tDriver_update") |
| | | public String tDriverUpdate( Integer tDriverId, Model model) { |
| | | public String tDriverUpdate( Integer tDriverId, Model model) throws ParseException { |
| | | TDriver tDriver = tDriverService.selectById(tDriverId); |
| | | TDriverResp tDriverResp = new TDriverResp(); |
| | | BeanUtils.copyProperties(tDriver,tDriverResp); |
| | | |
| | | if(Objects.nonNull(tDriverResp.getFirstCertificateTime())){ |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format1 = format.format(tDriverResp.getFirstCertificateTime()); |
| | | tDriverResp.setFirstCertificateTimeStr(format1); |
| | | } |
| | | // tDriverResp.setFirstCertificateTime(format.parse(format1)); |
| | | |
| | | // 查询邀请人 |
| | | TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId()); |
| | |
| | | tDriver.setApprovalUserId(shiroUser.getId()); |
| | | tDriver.setApprovalTime(new Date()); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | //增加积分奖励 |
| | | if(approvalStatus == 2 && null != tDriver.getInviterId()){ |
| | | TSystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 4)); |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId()); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(tDriver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(10); |
| | | accountChangeDetail.setOldData(tDriver1.getIntegral().doubleValue()); |
| | | tDriver1.setIntegral(tDriver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(tDriver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | tDriverService.updateById(tDriver1); |
| | | } |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | }else { |
| | | // 业绩排名 performanceTable |
| | | // 查询广东全区域数据 查询广东所有的代理商 |
| | | List<TAgent> tAgentList = tAgentService.selectList(new EntityWrapper<TAgent>() |
| | | .eq("provinceCode", "440000")); |
| | | List<TAgent> tAgentList = tAgentService.selectList(null); |
| | | List<Integer> ids = tAgentList.stream().map(TAgent::getId).collect(Collectors.toList()); |
| | | if (1 == type){ |
| | | // 单量 |
| | |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserDetailOrderResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverCommissionResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TOrderResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.model.TOrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.ITCancelOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | private ITAppUserService tAppUserService; |
| | | @Autowired |
| | | private ITCancelOrderService tCancelOrderService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getOrderTrack") |
| | | @ResponseBody |
| | | public ResultUtil getOrderTrack(Integer orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + ".json"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | */ |
| | | @RequestMapping(value = "/cancelOrderUpdate") |
| | | @ResponseBody |
| | | public Object cancelOrderUpdate(@RequestParam Integer tOrderId) { |
| | | TOrder tOrder = tOrderService.selectById(tOrderId); |
| | | tOrder.setState(OrderStateEnum.CANCELED.getCode()); |
| | | tOrderService.updateById(tOrder); |
| | | if(null != tOrder.getDriverId()){ |
| | | redisUtil.delSetValue("orderService", tOrder.getId().toString()); |
| | | TDriver tDriver = driverService.selectById(tOrder.getDriverId()); |
| | | tDriver.setServerStatus(1); |
| | | driverService.updateById(tDriver); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | |
| | | model.addAttribute("num2",jsonObject.getInteger("num2")); |
| | | model.addAttribute("num3",jsonObject.getInteger("num3")); |
| | | model.addAttribute("num4",jsonObject.getInteger("num4")); |
| | | model.addAttribute("num5",jsonObject.getInteger("num5")); |
| | | // model.addAttribute("num5",jsonObject.getInteger("num5")); |
| | | return PREFIX + "tSystemConfigDispatchRules.html"; |
| | | } |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "加盟区域ID") |
| | | private String areaId; |
| | | private String firstCertificateTimeStr; |
| | | |
| | | public String getFirstCertificateTimeStr() { |
| | | return firstCertificateTimeStr; |
| | | } |
| | | |
| | | public void setFirstCertificateTimeStr(String firstCertificateTimeStr) { |
| | | this.firstCertificateTimeStr = firstCertificateTimeStr; |
| | | } |
| | | |
| | | @Override |
| | | public String getAreaId() { |
| | |
| | | /** |
| | | * 跳转到修改字典 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping("/dict_edit/{dictId}") |
| | | public String deptUpdate(@PathVariable Integer dictId, Model model) { |
| | | Dict dict = dictService.selectById(dictId); |
| | |
| | | */ |
| | | @BussinessLog(value = "添加字典记录", key = "dictName,dictValues", dict = DictMap.class) |
| | | @RequestMapping(value = "/add") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object add(String dictCode,String dictTips,String dictName, String dictValues) { |
| | | if (ToolUtil.isOneEmpty(dictCode,dictName, dictValues)) { |
| | |
| | | * 获取所有字典列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(String condition) { |
| | | List<Map<String, Object>> list = this.dictService.list(condition); |
| | |
| | | * 字典详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{dictId}") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("dictId") Integer dictId) { |
| | | return dictService.selectById(dictId); |
| | |
| | | */ |
| | | @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class) |
| | | @RequestMapping(value = "/update") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object update(Integer dictId,String dictCode,String dictName, String dictTips,String dictValues) { |
| | | if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) { |
| | |
| | | * 查询操作日志列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) { |
| | | Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage(); |
| | |
| | | * 查询操作日志详情 |
| | | */ |
| | | @RequestMapping("/detail/{id}") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object detail(@PathVariable Integer id) { |
| | | OperationLog operationLog = operationLogService.selectById(id); |
| | |
| | | */ |
| | | @BussinessLog(value = "清空业务日志") |
| | | @RequestMapping("/delLog") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object delLog() { |
| | | SqlRunner.db().delete("delete from sys_operation_log"); |
| | |
| | | if(f==5){ |
| | | model.addAttribute("number", "5"); |
| | | } |
| | | model.addAttribute("message","账号或密码错误!"); |
| | | model.addAttribute("tips","账号或密码错误!"); |
| | | return "/login.html"; |
| | | } |
| | | } |
| | |
| | | * 查询登录日志列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName) { |
| | | Page<LoginLog> page = new PageFactory<LoginLog>().defaultPage(); |
| | |
| | | */ |
| | | @BussinessLog("清空登录日志") |
| | | @RequestMapping("/delLoginLog") |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Object delLog() { |
| | | SqlRunner.db().delete("delete from sys_login_log"); |
| | |
| | | /** |
| | | * 跳转到菜单详情列表页面 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/menu_edit/{menuId}") |
| | | public String menuEdit(@PathVariable Long menuId, Model model) { |
| | | if (ToolUtil.isEmpty(menuId)) { |
| | |
| | | /** |
| | | * 修该菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/edit") |
| | | @BussinessLog(value = "修改菜单", key = "name", dict = MenuDict.class) |
| | | @ResponseBody |
| | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(@RequestParam(required = false) String menuName, @RequestParam(required = false) String level) { |
| | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/add") |
| | | @BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class) |
| | | @ResponseBody |
| | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @Permission(Const.ADMIN_NAME) |
| | | @RequestMapping(value = "/remove") |
| | | @BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class) |
| | | @ResponseBody |
| | |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @BussinessLog(value = "添加角色", key = "name", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip add(@Valid Role role, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | |
| | | */ |
| | | @RequestMapping(value = "/edit") |
| | | @BussinessLog(value = "修改角色", key = "name", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip edit(@Valid Role role, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | |
| | | */ |
| | | @RequestMapping(value = "/remove") |
| | | @BussinessLog(value = "删除角色", key = "roleId", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip remove(@RequestParam Integer roleId) { |
| | | if (ToolUtil.isEmpty(roleId)) { |
| | |
| | | */ |
| | | @RequestMapping("/setAuthority") |
| | | @BussinessLog(value = "配置权限", key = "roleId,ids", dict = RoleDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip setAuthority(@RequestParam("roleId") Integer roleId, @RequestParam("ids") String ids) { |
| | | if (ToolUtil.isOneEmpty(roleId)) { |
| | |
| | | */ |
| | | @RequestMapping("/add") |
| | | @BussinessLog(value = "添加管理员", key = "account", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip add(@Valid UserDto user, BindingResult result) { |
| | | if (result.hasErrors()) { |
| | |
| | | user.setCreatetime(new Date()); |
| | | |
| | | User objectUser = UserFactory.createUser(user); |
| | | //查找平台所属公司 |
| | | TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).orderBy("id", true).last(" limit 1")); |
| | | if (SinataUtil.isNotEmpty(company)){ |
| | | objectUser.setObjectId(company.getId()); |
| | | } |
| | | ShiroUser user1 = ShiroKit.getUser(); |
| | | objectUser.setRoleType(user1.getRoleType()); |
| | | objectUser.setObjectId(user1.getObjectId()); |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | this.userService.insert(objectUser); |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/reset") |
| | | @BussinessLog(value = "重置管理员密码", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip reset(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITCompanyService itCompanyService; |
| | | |
| | | /** |
| | | * 冻结用户 |
| | | */ |
| | | @RequestMapping("/freeze") |
| | | @BussinessLog(value = "冻结用户", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip freeze(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | |
| | | } |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.FREEZED.getCode()); |
| | | |
| | | User user = userService.selectById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 |
| | | TCompany company = itCompanyService.selectById(user.getObjectId()); |
| | | company.setState(1); |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | // itDriverService.updateCompanyDriverState(3,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | TCompany franchisee = itCompanyService.selectById(user.getObjectId()); |
| | | franchisee.setState(1); |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | // itDriverService.updateFranchiseeDriverState(3,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/unfreeze") |
| | | @BussinessLog(value = "解除冻结用户", key = "userId", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip unfreeze(@RequestParam Integer userId) { |
| | | if (ToolUtil.isEmpty(userId)) { |
| | |
| | | this.userService.setStatus(userId, ManagerStatus.OK.getCode()); |
| | | |
| | | User user = userService.selectById(userId); |
| | | if (user.getRoleType() == 2){ |
| | | //查询分公司 |
| | | TCompany company = itCompanyService.selectById(user.getObjectId()); |
| | | company.setState(0); |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | // itDriverService.updateCompanyDriverState(2,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | | TCompany franchisee = itCompanyService.selectById(user.getObjectId()); |
| | | franchisee.setState(0); |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | // itDriverService.updateFranchiseeDriverState(2,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/setRole") |
| | | @BussinessLog(value = "分配角色", key = "userId,roleIds", dict = UserDict.class) |
| | | @Permission(Const.ADMIN_NAME) |
| | | @ResponseBody |
| | | public Tip setRole(@RequestParam("userId") Integer userId, @RequestParam("roleIds") String roleIds) { |
| | | if (ToolUtil.isOneEmpty(userId, roleIds)) { |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.AccountChangeDetail; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:33 |
| | | */ |
| | | public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:25 |
| | | */ |
| | | public interface RechargeRecordMapper extends BaseMapper<RechargeRecord> { |
| | | |
| | | |
| | | |
| | | |
| | | Double querSumSurplusDividedAmount(@Param("type") Integer type); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:46 |
| | | */ |
| | | public interface SettlementRecordMapper extends BaseMapper<SettlementRecord> { |
| | | } |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.AccountChangeDetail"> |
| | | <id column="id" property="id"/> |
| | | <result column="code" property="code"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="changeType" property="changeType"/> |
| | | <result column="oldData" property="oldData"/> |
| | | <result column="newData" property="newData"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="explain" property="explain"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.RechargeRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.RechargeRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="userId" property="userId" /> |
| | | <result column="code" property="code" /> |
| | | <result column="amount" property="amount"/> |
| | | <result column="payType" property="payType" /> |
| | | <result column="payTime" property="payTime" /> |
| | | <result column="payStatus" property="payStatus" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="surplusDividedAmount" property="surplusDividedAmount"/> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="querSumSurplusDividedAmount" resultType="double"> |
| | | select ifnull(sum(surplusDividedAmount), 0) from t_recharge_record where payStatus = 2 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?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.stylefeng.guns.modular.system.dao.SettlementRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.SettlementRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="type" property="type" /> |
| | | <result column="objectId" property="objectId" /> |
| | | <result column="amount" property="amount" /> |
| | | <result column="arrivalTime" property="arrivalTime" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | AND o.agentId = #{objectId} |
| | | </if> |
| | | </where> |
| | | ORDER BY co.createTime |
| | | ORDER BY co.createTime desc |
| | | </select> |
| | | <select id="userCancelOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp"> |
| | | select co.createTime,o.code,o.startAddress,o.endAddress |
| | |
| | | o.id, o.code, o.userId, o.driverId, o.`source`, o.agentId, o.branchOfficeId, o.startTime, o.startAddress, o.startLat, o.startLng, o.endAddress, o.endLat, o.endLng, |
| | | o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime, |
| | | o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice, |
| | | o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,a.nickname AS userName, |
| | | a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone |
| | | o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice, |
| | | o.userPhone,o.userName,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone |
| | | </sql> |
| | | |
| | | <sql id="Base_Column_Server_Order"> |
| | |
| | | o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime, |
| | | o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice, |
| | | o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice, |
| | | d.name AS driverName,d.phone AS driverPhone |
| | | o.userPhone,o.userName,d.name AS driverName,d.phone AS driverPhone |
| | | </sql> |
| | | |
| | | <select id="getOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp"> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 账户变动记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:30 |
| | | */ |
| | | @Data |
| | | @TableName("t_account_change_detail") |
| | | public class AccountChangeDetail { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 类型(1=余额,2=积分) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付,9=线下收款支付,10=推荐奖励) |
| | | */ |
| | | @TableField("changeType") |
| | | private Integer changeType; |
| | | /** |
| | | * 历史数据 |
| | | */ |
| | | @TableField("oldData") |
| | | private Double oldData; |
| | | /** |
| | | * 新数据 |
| | | */ |
| | | @TableField("newData") |
| | | private Double newData; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 变动说明 |
| | | */ |
| | | @TableField("explain") |
| | | private String explain; |
| | | /** |
| | | * 变动时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统充值记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/21 23:08 |
| | | */ |
| | | @Data |
| | | @TableName("t_recharge_record") |
| | | public class RechargeRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=用户,2=司机,3=代理商,4=平台) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 流水号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 充值金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 支付方式(1=微信,2=系统充值) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | | /** |
| | | * 完成支付时间 |
| | | */ |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 支付状态(1=待支付,2=已完成) |
| | | */ |
| | | @TableField("payStatus") |
| | | private Integer payStatus; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 剩余待分账金额 |
| | | */ |
| | | @TableField("surplusDividedAmount") |
| | | private Double surplusDividedAmount; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 结算记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:43 |
| | | */ |
| | | @Data |
| | | @TableName("t_settlement_record") |
| | | public class SettlementRecord { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 1=平台,2=代理商,3=司机 |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 结算对象id |
| | | */ |
| | | @TableField("objectId") |
| | | private Integer objectId; |
| | | /** |
| | | * 提现金额 |
| | | */ |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 第三方流水号 |
| | | */ |
| | | @TableField("orderNumber") |
| | | private String orderNumber; |
| | | /** |
| | | * 到账时间 |
| | | */ |
| | | @TableField("arrivalTime") |
| | | private Date arrivalTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
| | |
| | | */ |
| | | private String cityName; |
| | | /** |
| | | * 代理区域区编号 |
| | | */ |
| | | private String districtCode; |
| | | /** |
| | | * 代理区域区名称 |
| | | */ |
| | | private String districtName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer status; |
| | |
| | | * 添加时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 开户银行 |
| | | */ |
| | | @TableField(value = "bankDeposit") |
| | | @ApiModelProperty(value = "开户银行") |
| | | private String bankDeposit; |
| | | |
| | | /** |
| | | * 银行账户 |
| | | */ |
| | | @TableField(value = "bankAccount") |
| | | @ApiModelProperty(value = "银行账户") |
| | | private String bankAccount; |
| | | |
| | | @TableField(value = "serviceCalls") |
| | | @ApiModelProperty(value = "客服电话") |
| | | private String serviceCalls; |
| | | |
| | | /** |
| | | * 商户类型(1=个体工商户,2=企业) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 公司名称 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 经营范围 |
| | | */ |
| | | @TableField("businessScope") |
| | | private String businessScope; |
| | | /** |
| | | * 统一社会信用码 |
| | | */ |
| | | @TableField("socialCreditCode") |
| | | private String socialCreditCode; |
| | | /** |
| | | * 统一社会信用证有效期 |
| | | */ |
| | | @TableField("socialCreditCodeExpires") |
| | | private Date socialCreditCodeExpires; |
| | | /** |
| | | * 企业注册省编号 |
| | | */ |
| | | @TableField("provCodeEnterprise") |
| | | private String provCodeEnterprise; |
| | | /** |
| | | * 企业注册市编号 |
| | | */ |
| | | @TableField("cityCodeEnterprise") |
| | | private String cityCodeEnterprise; |
| | | /** |
| | | * 企业注册区编号 |
| | | */ |
| | | @TableField("areaCodeEnterprise") |
| | | private String areaCodeEnterprise; |
| | | /** |
| | | * 企业注册详细地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 法人姓名 |
| | | */ |
| | | @TableField("legalPerson") |
| | | private String legalPerson; |
| | | /** |
| | | * 法人身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 法人身份证有效期 |
| | | */ |
| | | @TableField("certIdExpires") |
| | | private Date certIdExpires; |
| | | /** |
| | | * 法人手机号 |
| | | */ |
| | | @TableField("legalPhone") |
| | | private String legalPhone; |
| | | /** |
| | | * 附件编号 |
| | | */ |
| | | @TableField("fileNo") |
| | | private String fileNo; |
| | | /** |
| | | * 结算账户名 |
| | | */ |
| | | @TableField("cardName") |
| | | private String cardName; |
| | | /** |
| | | * 结算账户号 |
| | | */ |
| | | @TableField("cardNo") |
| | | private String cardNo; |
| | | /** |
| | | * 银行账户类型(1=对公,2=对私) |
| | | */ |
| | | @TableField("bankAcctType") |
| | | private Integer bankAcctType; |
| | | /** |
| | | * 银行预留手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 开户行编号 |
| | | */ |
| | | @TableField("bankCode") |
| | | private String bankCode; |
| | | /** |
| | | * 开户行地区省编号 |
| | | */ |
| | | @TableField("provCodeBank") |
| | | private String provCodeBank; |
| | | /** |
| | | * 开户行地区市编号 |
| | | */ |
| | | @TableField("cityCodeBank") |
| | | private String cityCodeBank; |
| | | /** |
| | | * 开户行地区区编号 |
| | | */ |
| | | @TableField("areaCodeBank") |
| | | private String areaCodeBank; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("merchantStatus") |
| | | private Integer merchantStatus; |
| | | /** |
| | | * 结算账户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("bankStatus") |
| | | private Integer bankStatus; |
| | | |
| | | |
| | | |
| | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "密码") |
| | | private String password; |
| | | |
| | | public String getDistrictCode() { |
| | | return districtCode; |
| | | } |
| | | |
| | | public void setDistrictCode(String districtCode) { |
| | | this.districtCode = districtCode; |
| | | } |
| | | |
| | | public String getDistrictName() { |
| | | return districtName; |
| | | } |
| | | |
| | | public void setDistrictName(String districtName) { |
| | | this.districtName = districtName; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | |
| | | |
| | | public void setAreaId(String areaId) { |
| | | this.areaId = areaId; |
| | | } |
| | | |
| | | public String getBankDeposit() { |
| | | return bankDeposit; |
| | | } |
| | | |
| | | public void setBankDeposit(String bankDeposit) { |
| | | this.bankDeposit = bankDeposit; |
| | | } |
| | | |
| | | public String getBankAccount() { |
| | | return bankAccount; |
| | | } |
| | | |
| | | public void setBankAccount(String bankAccount) { |
| | | this.bankAccount = bankAccount; |
| | | } |
| | | |
| | | public String getArea() { |
| | |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(Integer userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public String getMerchantName() { |
| | | return merchantName; |
| | | } |
| | | |
| | | public void setMerchantName(String merchantName) { |
| | | this.merchantName = merchantName; |
| | | } |
| | | |
| | | public String getBusinessScope() { |
| | | return businessScope; |
| | | } |
| | | |
| | | public void setBusinessScope(String businessScope) { |
| | | this.businessScope = businessScope; |
| | | } |
| | | |
| | | public String getSocialCreditCode() { |
| | | return socialCreditCode; |
| | | } |
| | | |
| | | public void setSocialCreditCode(String socialCreditCode) { |
| | | this.socialCreditCode = socialCreditCode; |
| | | } |
| | | |
| | | public Date getSocialCreditCodeExpires() { |
| | | return socialCreditCodeExpires; |
| | | } |
| | | |
| | | public void setSocialCreditCodeExpires(Date socialCreditCodeExpires) { |
| | | this.socialCreditCodeExpires = socialCreditCodeExpires; |
| | | } |
| | | |
| | | public String getProvCodeEnterprise() { |
| | | return provCodeEnterprise; |
| | | } |
| | | |
| | | public void setProvCodeEnterprise(String provCodeEnterprise) { |
| | | this.provCodeEnterprise = provCodeEnterprise; |
| | | } |
| | | |
| | | public String getCityCodeEnterprise() { |
| | | return cityCodeEnterprise; |
| | | } |
| | | |
| | | public void setCityCodeEnterprise(String cityCodeEnterprise) { |
| | | this.cityCodeEnterprise = cityCodeEnterprise; |
| | | } |
| | | |
| | | public String getAreaCodeEnterprise() { |
| | | return areaCodeEnterprise; |
| | | } |
| | | |
| | | public void setAreaCodeEnterprise(String areaCodeEnterprise) { |
| | | this.areaCodeEnterprise = areaCodeEnterprise; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public String getLegalPerson() { |
| | | return legalPerson; |
| | | } |
| | | |
| | | public void setLegalPerson(String legalPerson) { |
| | | this.legalPerson = legalPerson; |
| | | } |
| | | |
| | | public String getMerchantIDCode() { |
| | | return merchantIDCode; |
| | | } |
| | | |
| | | public void setMerchantIDCode(String merchantIDCode) { |
| | | this.merchantIDCode = merchantIDCode; |
| | | } |
| | | |
| | | public Date getCertIdExpires() { |
| | | return certIdExpires; |
| | | } |
| | | |
| | | public void setCertIdExpires(Date certIdExpires) { |
| | | this.certIdExpires = certIdExpires; |
| | | } |
| | | |
| | | public String getLegalPhone() { |
| | | return legalPhone; |
| | | } |
| | | |
| | | public void setLegalPhone(String legalPhone) { |
| | | this.legalPhone = legalPhone; |
| | | } |
| | | |
| | | public String getFileNo() { |
| | | return fileNo; |
| | | } |
| | | |
| | | public void setFileNo(String fileNo) { |
| | | this.fileNo = fileNo; |
| | | } |
| | | |
| | | public String getCardName() { |
| | | return cardName; |
| | | } |
| | | |
| | | public void setCardName(String cardName) { |
| | | this.cardName = cardName; |
| | | } |
| | | |
| | | public String getCardNo() { |
| | | return cardNo; |
| | | } |
| | | |
| | | public void setCardNo(String cardNo) { |
| | | this.cardNo = cardNo; |
| | | } |
| | | |
| | | public Integer getBankAcctType() { |
| | | return bankAcctType; |
| | | } |
| | | |
| | | public void setBankAcctType(Integer bankAcctType) { |
| | | this.bankAcctType = bankAcctType; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getBankCode() { |
| | | return bankCode; |
| | | } |
| | | |
| | | public void setBankCode(String bankCode) { |
| | | this.bankCode = bankCode; |
| | | } |
| | | |
| | | public String getProvCodeBank() { |
| | | return provCodeBank; |
| | | } |
| | | |
| | | public void setProvCodeBank(String provCodeBank) { |
| | | this.provCodeBank = provCodeBank; |
| | | } |
| | | |
| | | public String getCityCodeBank() { |
| | | return cityCodeBank; |
| | | } |
| | | |
| | | public void setCityCodeBank(String cityCodeBank) { |
| | | this.cityCodeBank = cityCodeBank; |
| | | } |
| | | |
| | | public String getAreaCodeBank() { |
| | | return areaCodeBank; |
| | | } |
| | | |
| | | public void setAreaCodeBank(String areaCodeBank) { |
| | | this.areaCodeBank = areaCodeBank; |
| | | } |
| | | |
| | | public String getMerchantNumber() { |
| | | return merchantNumber; |
| | | } |
| | | |
| | | public void setMerchantNumber(String merchantNumber) { |
| | | this.merchantNumber = merchantNumber; |
| | | } |
| | | |
| | | public Integer getMerchantStatus() { |
| | | return merchantStatus; |
| | | } |
| | | |
| | | public void setMerchantStatus(Integer merchantStatus) { |
| | | this.merchantStatus = merchantStatus; |
| | | } |
| | | |
| | | public Integer getBankStatus() { |
| | | return bankStatus; |
| | | } |
| | | |
| | | public void setBankStatus(Integer bankStatus) { |
| | | this.bankStatus = bankStatus; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @TableField(value = "cancelCount") |
| | | private Integer cancelCount; |
| | | |
| | | @ApiModelProperty(value = "是否拥有9折优惠 1是 0否") |
| | | @ApiModelProperty(value = "是否拥有95折优惠 1是 0否") |
| | | @TableField(value = "havDiscount") |
| | | private Integer havDiscount; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "优惠券数量") |
| | | @TableField("coupon_count") |
| | | private Integer couponCount; |
| | | private Long couponCount; |
| | | |
| | | @ApiModelProperty(value = "剩余数量") |
| | | @TableField("remaining_quantity") |
| | | private Integer remainingQuantity; |
| | | private Long remainingQuantity; |
| | | |
| | | @ApiModelProperty(value = "删除 true未删除 false已删除") |
| | | @TableField("status") |
| | |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getRemainingQuantity() { |
| | | public Long getRemainingQuantity() { |
| | | return remainingQuantity; |
| | | } |
| | | |
| | | public void setRemainingQuantity(Integer remainingQuantity) { |
| | | public void setRemainingQuantity(Long remainingQuantity) { |
| | | this.remainingQuantity = remainingQuantity; |
| | | } |
| | | |
| | | public Integer getCouponCount() { |
| | | public Long getCouponCount() { |
| | | return couponCount; |
| | | } |
| | | |
| | | public void setCouponCount(Integer couponCount) { |
| | | public void setCouponCount(Long couponCount) { |
| | | this.couponCount = couponCount; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "后台充值余额") |
| | | private BigDecimal backgroundBalance; |
| | | @ApiModelProperty(value = "优惠券余额") |
| | | private BigDecimal couponBalance; |
| | | @ApiModelProperty(value = "启用冻结理由") |
| | | private String remark; |
| | | |
| | |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "驾驶证初次领证时间") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date firstCertificateTime; |
| | | @ApiModelProperty(value = "佣金") |
| | | private BigDecimal commission; |
| | |
| | | @ApiModelProperty(value = "邀请人电话") |
| | | private String inviterPhone; |
| | | |
| | | public BigDecimal getCouponBalance() { |
| | | return couponBalance; |
| | | } |
| | | |
| | | public void setCouponBalance(BigDecimal couponBalance) { |
| | | this.couponBalance = couponBalance; |
| | | } |
| | | |
| | | public String getInviterName() { |
| | | return inviterName; |
| | |
| | | @ApiModelProperty(value = "是否已开票 1是 0否") |
| | | private Integer isInvoice; |
| | | |
| | | @ApiModelProperty(value = "用户手机号") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "用户姓名") |
| | | private String userName; |
| | | |
| | | public String getUserPhone() { |
| | | return userPhone; |
| | | } |
| | | |
| | | public void setUserPhone(String userPhone) { |
| | | this.userPhone = userPhone; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public Integer getIsInvoice() { |
| | | return isInvoice; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:26 |
| | | */ |
| | | public interface IRechargeRecordService extends IService<RechargeRecord> { |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param type |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | Double querSumSurplusDividedAmount(Integer type); |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:48 |
| | | */ |
| | | public interface ISettlementRecordService extends IService<SettlementRecord> { |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.RechargeRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.RechargeRecord; |
| | | import com.stylefeng.guns.modular.system.service.IRechargeRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 14:26 |
| | | */ |
| | | @Service |
| | | public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordMapper, RechargeRecord> implements IRechargeRecordService { |
| | | |
| | | @Override |
| | | public Double querSumSurplusDividedAmount(Integer type) { |
| | | return this.baseMapper.querSumSurplusDividedAmount(type); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.SettlementRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.SettlementRecord; |
| | | import com.stylefeng.guns.modular.system.service.ISettlementRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/2 12:48 |
| | | */ |
| | | @Service |
| | | public class SettlementRecordServiceImpl extends ServiceImpl<SettlementRecordMapper, SettlementRecord> implements ISettlementRecordService { |
| | | } |
| | |
| | | // 过滤已使用优惠券 |
| | | List<TOrder> usedCoupon = orderList.stream().filter(order -> (order.getState().equals(OrderStateEnum.FINISH.getCode()) || order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode())) |
| | | && Objects.nonNull(order.getCouponId()) && order.getAgentId().equals(tAgent.getId())).collect(Collectors.toList()); |
| | | model.addAttribute("usedCoupon",usedCoupon.size()); |
| | | // model.addAttribute("usedCoupon",usedCoupon.size()); |
| | | // 已使用优惠券金额求和,已使用优惠券id |
| | | // List<Integer> usedCouponId = usedCoupon.stream().map(TOrder::getCouponId).collect(Collectors.toList()); |
| | | // if(CollectionUtils.isEmpty(usedCouponId)){ |
| | |
| | | BigDecimal couponPriceSum = BigDecimal.ZERO; |
| | | for (TUserToCoupon userToCoupon : tUserToCoupons) { |
| | | TCoupon tCoupons1 = tCouponMapper.selectById(userToCoupon.getCouponId()); |
| | | if(Objects.nonNull(tCoupons1)){ |
| | | couponPriceSum = couponPriceSum.add(tCoupons1.getCouponPreferentialAmount().multiply(new BigDecimal(userToCoupon.getCouponTotal()))); |
| | | } |
| | | } |
| | | model.addAttribute("couponPriceSum", couponPriceSum); |
| | | // 过滤代理商发放的优惠券 |
| | | int sum = tUserToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | model.addAttribute("issuedCoupon",sum); |
| | | // 总量减去有效数量和过期数量为使用数量 |
| | | int validCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum();//有效数量 |
| | | int expireCount = tUserToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum();//过期数量 |
| | | model.addAttribute("usedCoupon",sum-validCount-expireCount); |
| | | // 司机信息 |
| | | // 司机数 |
| | | List<TDriver> drivers = tDriverMapper.selectList(new EntityWrapper<TDriver>().eq("agentId", tAgent.getId())); |
| | |
| | | List<TOrder> tOrders = tOrderMapper.selectList(new EntityWrapper<TOrder>()); |
| | | // 查询优惠券 |
| | | List<TCoupon> tCoupons = tCouponMapper.selectList(new EntityWrapper<TCoupon>()); |
| | | // 用户 |
| | | // 用户优惠券 |
| | | List<TUserToCoupon> tUserToCoupons = tUserToCouponMapper.selectList(new EntityWrapper<TUserToCoupon>()); |
| | | // 查询司机信息 |
| | | List<TDriver> tDrivers = tDriverMapper.selectList(new EntityWrapper<TDriver>()); |
| | |
| | | // 过滤已使用优惠券 |
| | | List<TOrder> usedCoupon = tOrders.stream().filter(order -> (order.getState().equals(OrderStateEnum.FINISH.getCode()) || order.getState().equals(OrderStateEnum.WAIT_EVALUATED.getCode())) |
| | | && Objects.nonNull(order.getCouponId()) && tAgent.getId().equals(order.getAgentId())).collect(Collectors.toList()); |
| | | // 通过订单总量获取已完成订单的使用优惠券数量及优惠券金额 |
| | | tAgentResp.setUsedCoupon(usedCoupon.size()); |
| | | // 金额 |
| | | Optional<BigDecimal> reduce = usedCoupon.stream().map(TOrder::getDiscountedPrice).reduce(BigDecimal::add); |
| | | reduce.ifPresent(tAgentResp::setCouponPriceSum); |
| | | |
| | | |
| | | // 已使用优惠券金额求和,已使用优惠券id |
| | | // List<Integer> usedCouponId = usedCoupon.stream().map(TOrder::getCouponId).collect(Collectors.toList()); |
| | | // if(CollectionUtils.isEmpty(usedCouponId)){ |
| | |
| | | // } |
| | | } |
| | | |
| | | if(!CollectionUtils.isEmpty(tUserToCoupons)){ |
| | | // 过滤代理商发放的优惠券 |
| | | List<TUserToCoupon> userToCoupons = tUserToCoupons.stream().filter(coupon -> tAgent.getId().equals(coupon.getObjectId()) && coupon.getRoleType() == 3).collect(Collectors.toList()); |
| | | int sum = userToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | tAgentResp.setIssuedCoupon(sum); |
| | | BigDecimal couponPriceSum = BigDecimal.ZERO; |
| | | for (TUserToCoupon userToCoupon : userToCoupons) { |
| | | TCoupon tCoupons1 = tCouponMapper.selectById(userToCoupon.getCouponId()); |
| | | couponPriceSum = couponPriceSum.add(tCoupons1.getCouponPreferentialAmount().multiply(new BigDecimal(userToCoupon.getCouponTotal()))); |
| | | } |
| | | tAgentResp.setCouponPriceSum(couponPriceSum); |
| | | } |
| | | // if(!CollectionUtils.isEmpty(tUserToCoupons)){ |
| | | // // 过滤代理商发放的优惠券 |
| | | // List<TUserToCoupon> userToCoupons = tUserToCoupons.stream().filter(coupon -> tAgent.getId().equals(coupon.getObjectId()) && coupon.getRoleType() == 3).collect(Collectors.toList()); |
| | | // int sum = userToCoupons.stream().mapToInt(TUserToCoupon::getCouponTotal).sum(); |
| | | // tAgentResp.setIssuedCoupon(sum); |
| | | // // 总量减去有效数量和过期数量为使用数量 |
| | | // int validCount = userToCoupons.stream().mapToInt(TUserToCoupon::getValidCount).sum();//有效数量 |
| | | // int expireCount = userToCoupons.stream().mapToInt(TUserToCoupon::getExpireCount).sum();//过期数量 |
| | | // tAgentResp.setUsedCoupon(sum-validCount-expireCount); |
| | | // BigDecimal couponPriceSum = BigDecimal.ZERO; |
| | | // for (TUserToCoupon userToCoupon : userToCoupons) { |
| | | // TCoupon tCoupons1 = tCouponMapper.selectById(userToCoupon.getCouponId()); |
| | | // if(Objects.nonNull(tCoupons1)){ |
| | | // couponPriceSum = couponPriceSum.add(tCoupons1.getCouponPreferentialAmount().multiply(new BigDecimal(userToCoupon.getCouponTotal()))); |
| | | // } |
| | | // } |
| | | // tAgentResp.setCouponPriceSum(couponPriceSum); |
| | | // } |
| | | |
| | | if(!CollectionUtils.isEmpty(tDrivers)){ |
| | | // 司机数 |
| | |
| | | // 已发放优惠券 |
| | | tBranchOfficeResp.setTotalCount(totalCount); |
| | | |
| | | BigDecimal orderPriceCount = new BigDecimal("0"); |
| | | BigDecimal orderPriceCount = BigDecimal.ZERO; |
| | | // 累计优惠券金额 |
| | | for (TUserToCoupon tUserToCoupon : tUserToCoupons) { |
| | | TCoupon tCoupon = tCouponMapper.selectById(tUserToCoupon.getCouponId()); |
| | | if(Objects.nonNull(tCoupon)){ |
| | | BigDecimal price = tCoupon.getCouponPreferentialAmount().multiply(new BigDecimal(tUserToCoupon.getCouponTotal())); |
| | | orderPriceCount = orderPriceCount.add(price); |
| | | } |
| | | } |
| | | tBranchOfficeResp.setOrderPriceCount(orderPriceCount); |
| | | |
| | |
| | | } |
| | | tBranchOffice.setDistrictName(area.getName()); |
| | | tBranchOffice.setDistrictCode(area.getCode()); |
| | | }else { |
| | | } |
| | | /*else { |
| | | tBranchOffice.setDistrictName(city.getName()); |
| | | tBranchOffice.setDistrictCode(city.getCode()); |
| | | } |
| | | }*/ |
| | | |
| | | // 通过省市查询代理商 |
| | | List<TAgent> tAgent = tAgentMapper.selectList(new EntityWrapper<TAgent>().eq("provinceCode", province.getCode()) |
| | |
| | | TDriverResp tDriverResp = new TDriverResp(); |
| | | BeanUtils.copyProperties(tDriver,tDriverResp); |
| | | |
| | | if(Objects.nonNull(tDriver.getBackgroundBalance()) && Objects.nonNull(tDriver.getBalance())){ |
| | | if(Objects.nonNull(tDriver.getBackgroundBalance()) && Objects.nonNull(tDriver.getBalance()) && Objects.nonNull(tDriver.getCouponBalance())){ |
| | | // 设置余额 |
| | | tDriverResp.setBalance(tDriver.getBackgroundBalance().add(tDriver.getBalance())); |
| | | tDriverResp.setBalance(tDriver.getBackgroundBalance().add(tDriver.getBalance()).add(tDriver.getCouponBalance())); |
| | | } |
| | | |
| | | // 所属代理商 |
| | |
| | | |
| | | String monthDate = new SimpleDateFormat("yyyyMM").format(new Date()); |
| | | |
| | | if(Objects.nonNull(tDriver.getBackgroundBalance()) && Objects.nonNull(tDriver.getBalance())){ |
| | | if(Objects.nonNull(tDriver.getBackgroundBalance()) && Objects.nonNull(tDriver.getBalance()) && Objects.nonNull(tDriver.getCouponBalance())){ |
| | | // 设置余额 |
| | | tDriver.setBalance(tDriver.getBackgroundBalance().add(tDriver.getBalance())); |
| | | tDriver.setBalance(tDriver.getBackgroundBalance().add(tDriver.getBalance()).add(tDriver.getCouponBalance())); |
| | | model.addAttribute("balance",tDriver.getBalance()); |
| | | }else { |
| | | model.addAttribute("balance",BigDecimal.ZERO); |
| | |
| | | tBranchOffice = tBranchOfficeMapper.selectList(new EntityWrapper<TBranchOffice>().eq("provinceCode", province.getCode()) |
| | | .eq("cityCode", city.getCode()) |
| | | .eq("status", StatusEnum.NORMAL.getCode()) |
| | | .eq("districtCode", city.getCode()) |
| | | .last("LIMIT 1")); |
| | | // tBranchOffice = tBranchOfficeMapper.selectList(new EntityWrapper<TBranchOffice>().eq("provinceCode", province.getCode()) |
| | | // .eq("cityCode", city.getCode()) |
| | | // .eq("status", StatusEnum.NORMAL.getCode()) |
| | | // .eq("districtCode", city.getCode()) |
| | | // .last("LIMIT 1")); |
| | | } |
| | | if(!CollectionUtils.isEmpty(tBranchOffice)){ |
| | | tDriver.setBranchOfficeId(tBranchOffice.get(0).getId()); |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | |
| | | @Service |
| | | public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> implements ITOrderService { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private TOrderMapper tOrderMapper; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private TAppUserMapper tAppUserMapper; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private TDriverMapper tDriverMapper; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private TBranchOfficeMapper tBranchOfficeMapper; |
| | | |
| | | @Override |
| | |
| | | public void orderDetail(Integer orderId, Model model) { |
| | | // 订单信息 |
| | | TOrder tOrder = tOrderMapper.selectById(orderId); |
| | | model.addAttribute("id", orderId); |
| | | model.addAttribute("createTime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(tOrder.getCreateTime()));//下单时间 |
| | | model.addAttribute("code",tOrder.getCode());//订单编号 |
| | | model.addAttribute("source",tOrder.getSource());//订单来源 |
| | |
| | | } |
| | | model.addAttribute("startPrice",tOrder.getStartPrice());//起步价 |
| | | model.addAttribute("overDrivePrice",tOrder.getOverDrivePrice());//里程费 |
| | | model.addAttribute("waitTimePrice",tOrder.getWaitTimePrice());//等待费 |
| | | model.addAttribute("waitTimePrice",tOrder.getWaitTimePrice().add(tOrder.getOutWaitTimePrice()));//等待费 |
| | | model.addAttribute("badWeatherPrice",tOrder.getBadWeatherPrice());//恶劣天气费用 |
| | | model.addAttribute("orderMoney",tOrder.getOrderMoney());//实际费用 |
| | | model.addAttribute("payMoney",tOrder.getPayMoney());//实际支付费用 |
| | |
| | | model.addAttribute("discountAmount",tOrder.getDiscountAmount());//折扣金额 |
| | | model.addAttribute("userId",tOrder.getUserId());//用户id |
| | | model.addAttribute("routeRecord",tOrder.getRouteRecord());//行程录音 |
| | | model.addAttribute("userPhone",tOrder.getUserPhone());//用户手机号 |
| | | model.addAttribute("userName",tOrder.getUserName());//用户名称 |
| | | |
| | | // 查询用户 |
| | | TAppUser tAppUser = tAppUserMapper.selectById(tOrder.getUserId()); |
| | | model.addAttribute("userName",tAppUser.getNickname()); |
| | | model.addAttribute("userPhone",tAppUser.getPhone()); |
| | | if(Objects.nonNull(tAppUser)){ |
| | | model.addAttribute("havDiscount",tAppUser.getHavDiscount()); |
| | | if(1 == tAppUser.getHavDiscount()){ |
| | | // 计算9折优惠金额 |
| | | BigDecimal multiply = tOrder.getOrderMoney().multiply(new BigDecimal("0.1")).setScale(2); |
| | | BigDecimal subtract = tOrder.getOrderMoney().subtract(tOrder.getDiscountedPrice()); |
| | | // 计算95折优惠金额 |
| | | BigDecimal multiply = subtract.multiply(new BigDecimal("0.05"), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | model.addAttribute("multiply",multiply); |
| | | }else { |
| | | model.addAttribute("multiply",0); |
| | | } |
| | | }else { |
| | | model.addAttribute("havDiscount",0); |
| | | model.addAttribute("multiply",0); |
| | | } |
| | | |
| | | // 查询司机 |
| | |
| | | list = tRevenueMapper.getDataStatisticsIncomeOrCommissionByIds(ids,2,monthDate); |
| | | } |
| | | model.addAttribute("performanceResp",list); |
| | | map.put("performanceResp",list); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.config; |
| | | |
| | | import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | | * @Date 2022/2/10 10:03 |
| | | */ |
| | | public class ChannelConfig { |
| | | /** |
| | | * mallbook 测试环境地址 |
| | | */ |
| | | public static String payUrl; |
| | | |
| | | /** |
| | | * 业务系统商户平台编号 |
| | | */ |
| | | public static String merchantNo; |
| | | /** |
| | | * 接口版本号,不同版本号触发不同接口业务 |
| | | */ |
| | | public static String version; |
| | | /* |
| | | * 渠道类型 HF:汇付 |
| | | */ |
| | | public static String channelType; |
| | | |
| | | /** |
| | | * 商户平台私钥路径 |
| | | */ |
| | | public static String merchantPrivateKey; |
| | | /** |
| | | * mallbook公钥路径 |
| | | */ |
| | | public static String mallBookPublicKey; |
| | | |
| | | static { |
| | | YamlPropertiesFactoryBean yamlProFb = new YamlPropertiesFactoryBean(); |
| | | yamlProFb.setResources(new ClassPathResource("application.yml")); |
| | | Properties properties = yamlProFb.getObject(); |
| | | System.out.println("mallbook 参数配置初始化"); |
| | | System.out.println("--------------------------------"); |
| | | System.out.println("环境地址:" + properties.get("mallbook.pay_url")); |
| | | System.out.println("商户平台编号:" + properties.get("mallbook.merchant_no")); |
| | | System.out.println("接口版本号:" + properties.get("mallbook.version")); |
| | | System.out.println("渠道类型:" + properties.get("mallbook.channel_type")); |
| | | System.out.println("商户平台私钥:" + properties.get("mallbook.merchant_private_key")); |
| | | System.out.println("mallbook 公钥:" + properties.get("mallbook.mall_book_public_key")); |
| | | System.out.println("--------------------------------"); |
| | | payUrl = properties.get("mallbook.pay_url").toString(); |
| | | merchantNo = properties.get("mallbook.merchant_no").toString(); |
| | | version = properties.get("mallbook.version").toString(); |
| | | channelType = properties.get("mallbook.channel_type").toString(); |
| | | merchantPrivateKey = properties.get("mallbook.merchant_private_key").toString(); |
| | | mallBookPublicKey = properties.get("mallbook.mall_book_public_key").toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class BindAccount<T> { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "bindAccount"; |
| | | //子商户编号 |
| | | private String userId; |
| | | //身份证号 |
| | | private String certId; |
| | | //结算账户名 |
| | | private String cardName; |
| | | //结算账户号 |
| | | private String cardNo; |
| | | //银行账户类型 |
| | | private String bankAcctType; |
| | | //手机号 |
| | | private String phone; |
| | | //开户银行名称 |
| | | private String bankName; |
| | | //银行编码 |
| | | private String bankCode; |
| | | //省份编码 |
| | | private String provCode; |
| | | //地区编码 |
| | | private String areaCode; |
| | | |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getCertId() { |
| | | return certId; |
| | | } |
| | | |
| | | public void setCertId(String certId) { |
| | | this.certId = certId; |
| | | } |
| | | |
| | | public String getCardName() { |
| | | return cardName; |
| | | } |
| | | |
| | | public void setCardName(String cardName) { |
| | | this.cardName = cardName; |
| | | } |
| | | |
| | | public String getCardNo() { |
| | | return cardNo; |
| | | } |
| | | |
| | | public void setCardNo(String cardNo) { |
| | | this.cardNo = cardNo; |
| | | } |
| | | |
| | | public String getBankAcctType() { |
| | | return bankAcctType; |
| | | } |
| | | |
| | | public void setBankAcctType(String bankAcctType) { |
| | | this.bankAcctType = bankAcctType; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getBankName() { |
| | | return bankName; |
| | | } |
| | | |
| | | public void setBankName(String bankName) { |
| | | this.bankName = bankName; |
| | | } |
| | | |
| | | public String getBankCode() { |
| | | return bankCode; |
| | | } |
| | | |
| | | public void setBankCode(String bankCode) { |
| | | this.bankCode = bankCode; |
| | | } |
| | | |
| | | public String getProvCode() { |
| | | return provCode; |
| | | } |
| | | |
| | | public void setProvCode(String provCode) { |
| | | this.provCode = provCode; |
| | | } |
| | | |
| | | public String getAreaCode() { |
| | | return areaCode; |
| | | } |
| | | |
| | | public void setAreaCode(String areaCode) { |
| | | this.areaCode = areaCode; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class Deposit { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "deposit"; |
| | | //充值金额 |
| | | private String amount; |
| | | //订单信息 |
| | | private String orderName; |
| | | //支付类型 |
| | | private String payType; |
| | | //微信或支付宝的appid |
| | | private String appid; |
| | | //微信或支付宝用户id |
| | | private String openid; |
| | | //终端IP |
| | | private String terminalIp; |
| | | //前台回调地址 |
| | | private String frontUrl; |
| | | //后台回调地址 |
| | | private String notifyUrl; |
| | | //自定义参数1 |
| | | private String parameter1; |
| | | //自定义参数2 |
| | | private String parameter2; |
| | | |
| | | private String bankCode; |
| | | |
| | | private String cardType; |
| | | |
| | | public String getBankCode() { |
| | | return bankCode; |
| | | } |
| | | |
| | | public void setBankCode(String bankCode) { |
| | | this.bankCode = bankCode; |
| | | } |
| | | |
| | | public String getCardType() { |
| | | return cardType; |
| | | } |
| | | |
| | | public void setCardType(String cardType) { |
| | | this.cardType = cardType; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getPayType() { |
| | | return payType; |
| | | } |
| | | |
| | | public void setPayType(String payType) { |
| | | this.payType = payType; |
| | | } |
| | | |
| | | public String getAppid() { |
| | | return appid; |
| | | } |
| | | |
| | | public void setAppid(String appid) { |
| | | this.appid = appid; |
| | | } |
| | | |
| | | public String getOpenid() { |
| | | return openid; |
| | | } |
| | | |
| | | public void setOpenid(String openid) { |
| | | this.openid = openid; |
| | | } |
| | | |
| | | public String getTerminalIp() { |
| | | return terminalIp; |
| | | } |
| | | |
| | | public void setTerminalIp(String terminalIp) { |
| | | this.terminalIp = terminalIp; |
| | | } |
| | | |
| | | public String getFrontUrl() { |
| | | return frontUrl; |
| | | } |
| | | |
| | | public void setFrontUrl(String frontUrl) { |
| | | this.frontUrl = frontUrl; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | /** |
| | | * @author huangh |
| | | * @version 1.0 |
| | | * @description |
| | | * @date 2021/9/18 16:10 |
| | | */ |
| | | |
| | | public class ImageUpload { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "fileUpload"; |
| | | //业务系统会员编号 |
| | | private String merUserId; |
| | | //文件名称 |
| | | private String file; |
| | | //文件 |
| | | private String name; |
| | | |
| | | public String getMerUserId() { |
| | | return merUserId; |
| | | } |
| | | |
| | | public void setMerUserId(String merUserId) { |
| | | this.merUserId = merUserId; |
| | | } |
| | | |
| | | public String getFile() { |
| | | return file; |
| | | } |
| | | |
| | | public void setFile(String file) { |
| | | this.file = file; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * |
| | | */ |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.RSASignature; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 接口请求包 |
| | | * |
| | | */ |
| | | public class InterfaceRequest<T> implements Serializable { |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = -8130938432046696213L; |
| | | |
| | | |
| | | /** |
| | | * 商户平台编号 |
| | | */ |
| | | private String merchantNo = ChannelConfig.merchantNo; |
| | | |
| | | /** |
| | | * 接口版本号,不同版本号触发不同接口业务 |
| | | */ |
| | | private String version = ChannelConfig.version; |
| | | /* |
| | | * 渠道类型 HF:汇付 |
| | | */ |
| | | private String channelType = ChannelConfig.channelType; |
| | | |
| | | |
| | | /** |
| | | * 业务系统订单ID |
| | | */ |
| | | private String merOrderId; |
| | | |
| | | /** |
| | | * 签名 |
| | | */ |
| | | private String sign; |
| | | |
| | | /** |
| | | * 业务类型编号 |
| | | */ |
| | | private String serverCode; |
| | | |
| | | /** |
| | | * 业务参数,json格式 |
| | | */ |
| | | private String params; |
| | | |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String date; |
| | | |
| | | |
| | | public String getChannelType() { |
| | | return channelType; |
| | | } |
| | | |
| | | public void setChannelType(String channelType) { |
| | | this.channelType = channelType; |
| | | } |
| | | |
| | | public String getMerOrderId() { |
| | | return merOrderId; |
| | | } |
| | | |
| | | public void setMerOrderId(String merOrderId) { |
| | | this.merOrderId = merOrderId; |
| | | } |
| | | |
| | | public String getMerchantNo() { |
| | | return merchantNo; |
| | | } |
| | | |
| | | public void setMerchantNo(String merchantNo) { |
| | | this.merchantNo = merchantNo; |
| | | } |
| | | |
| | | public String getSign() { |
| | | return sign; |
| | | } |
| | | |
| | | public void setSign(String sign) { |
| | | this.sign = sign; |
| | | } |
| | | |
| | | public String getServerCode() { |
| | | return serverCode; |
| | | } |
| | | |
| | | public void setServerCode(String serverCode) { |
| | | this.serverCode = serverCode; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | public String getDate() { |
| | | return date; |
| | | } |
| | | |
| | | public void setDate(String date) { |
| | | this.date = date; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 签名顺序必须一致!!! |
| | | * 签名顺序必须一致!!! |
| | | * 签名顺序必须一致!!! |
| | | * 订单号 + 商户号 + 渠道类型 + 时间戳 + 业务参数json |
| | | * @return 待签名字符串 |
| | | */ |
| | | public String content() { |
| | | return StrUtil.builder() |
| | | .append(StringUtil.convertNull(merOrderId)) |
| | | .append(StringUtil.convertNull(merchantNo)) |
| | | .append(StringUtil.convertNull(channelType)) |
| | | .append(StringUtil.convertNull(date)) |
| | | .append(StringUtil.convertNull(params)) |
| | | .toString(); |
| | | } |
| | | |
| | | public InterfaceRequest() { |
| | | } |
| | | |
| | | public InterfaceRequest(T obj, String serverCode) { |
| | | this.merOrderId = IdUtil.fastSimpleUUID(); |
| | | this.serverCode = serverCode; |
| | | this.date = System.currentTimeMillis() + ""; |
| | | this.params = JSONUtil.toJsonStr(obj); |
| | | // todo 使用商户平台私钥生成sign,需要修改证书对应路径 |
| | | this.sign = RSASignature.sign(content()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "InterfaceRequest{" + |
| | | "merOrderId='" + merOrderId + '\'' + |
| | | ", merchantNo='" + merchantNo + '\'' + |
| | | ", sign='" + sign + '\'' + |
| | | ", serverCode='" + serverCode + '\'' + |
| | | ", params='" + params + '\'' + |
| | | ", date='" + date + '\'' + |
| | | ", version='" + version + '\'' + |
| | | ", channelType='" + channelType + '\'' + |
| | | '}'; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * |
| | | */ |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.util.StringUtil; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | |
| | | public class InterfaceResponse implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * 结果字符串,json格式 |
| | | */ |
| | | private String result; |
| | | |
| | | /** |
| | | * 签名,由code+msg+date+result根据私钥生成, 如果有参数为null,签名串中应当做空字符串("")来处理 |
| | | */ |
| | | private String sign; |
| | | |
| | | /** |
| | | * 结果代码 |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 结果信息 |
| | | */ |
| | | private String msg; |
| | | |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private String date; |
| | | |
| | | /** |
| | | * 接口版本号 |
| | | */ |
| | | private String version; |
| | | |
| | | public String getResult() { |
| | | return result; |
| | | } |
| | | |
| | | public void setResult(String result) { |
| | | this.result = result; |
| | | } |
| | | |
| | | public String getSign() { |
| | | return sign; |
| | | } |
| | | |
| | | public void setSign(String sign) { |
| | | this.sign = sign; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getDate() { |
| | | return date; |
| | | } |
| | | |
| | | public void setDate(String date) { |
| | | this.date = date; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "InterfaceResponse{" + |
| | | "result='" + result + '\'' + |
| | | ", sign='" + sign + '\'' + |
| | | ", code='" + code + '\'' + |
| | | ", msg='" + msg + '\'' + |
| | | ", date='" + date + '\'' + |
| | | ", version='" + version + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | /** |
| | | * 签名顺序必须一致!!! |
| | | * 签名顺序必须一致!!! |
| | | * 签名顺序必须一致!!! |
| | | * 结果代码 + 结果信息 + 渠道类型 + 时间戳 + 结果字符串json |
| | | * @return 待签名字符串 |
| | | */ |
| | | public String content() { |
| | | return StrUtil.builder() |
| | | .append(StringUtil.convertNull(code)) |
| | | .append(StringUtil.convertNull(msg)) |
| | | .append(StringUtil.convertNull(date)) |
| | | .append(StringUtil.convertNull(result)) |
| | | .toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | |
| | | public class QueryBalance { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryBalance"; |
| | | private String userId;//子商户编号 |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class QueryOrder { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryOrder"; |
| | | /** |
| | | * 原请求订单号 |
| | | */ |
| | | private String originalMerOrderId; |
| | | |
| | | /** |
| | | * 查询类型 |
| | | */ |
| | | private String queryType; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public String getQueryType() { |
| | | return queryType; |
| | | } |
| | | |
| | | public void setQueryType(String queryType) { |
| | | this.queryType = queryType; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | /** |
| | | * @author huangh |
| | | * @version 1.0 |
| | | * @description |
| | | * @date 2021/12/10 16:45 |
| | | */ |
| | | |
| | | public class Register { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "register"; |
| | | //业务系统会员id |
| | | private String merUserId; |
| | | //手机号 |
| | | private String phone; |
| | | //子商户类型 |
| | | private String userType; |
| | | //子商户名称 |
| | | private String userName; |
| | | //身份证号码 |
| | | private String certId; |
| | | //法人身份证有效期 |
| | | private String certIdExpires; |
| | | //经营范围 |
| | | private String businessScope; |
| | | //统一社会信用码 |
| | | private String socialCreditCode; |
| | | //统一社会信用证有效期 |
| | | private String socialCreditCodeExpires; |
| | | //法人手机号 |
| | | private String legalPhone; |
| | | //法人姓名 |
| | | private String legalPerson; |
| | | //企业地址 |
| | | private String address; |
| | | //省份编码 |
| | | private String provCode; |
| | | //地区编码 |
| | | private String areaCode; |
| | | //附件编号 |
| | | private String fileNo; |
| | | //后台回调地址 |
| | | private String notifyUrl; |
| | | //自定义参数1 |
| | | private String parameter1; |
| | | //自定义参数2 |
| | | private String parameter2; |
| | | |
| | | public String getMerUserId() { |
| | | return merUserId; |
| | | } |
| | | |
| | | public void setMerUserId(String merUserId) { |
| | | this.merUserId = merUserId; |
| | | } |
| | | |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(String userType) { |
| | | this.userType = userType; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getCertId() { |
| | | return certId; |
| | | } |
| | | |
| | | public void setCertId(String certId) { |
| | | this.certId = certId; |
| | | } |
| | | |
| | | public String getCertIdExpires() { |
| | | return certIdExpires; |
| | | } |
| | | |
| | | public void setCertIdExpires(String certIdExpires) { |
| | | this.certIdExpires = certIdExpires; |
| | | } |
| | | |
| | | public String getBusinessScope() { |
| | | return businessScope; |
| | | } |
| | | |
| | | public void setBusinessScope(String businessScope) { |
| | | this.businessScope = businessScope; |
| | | } |
| | | |
| | | public String getSocialCreditCode() { |
| | | return socialCreditCode; |
| | | } |
| | | |
| | | public void setSocialCreditCode(String socialCreditCode) { |
| | | this.socialCreditCode = socialCreditCode; |
| | | } |
| | | |
| | | public String getSocialCreditCodeExpires() { |
| | | return socialCreditCodeExpires; |
| | | } |
| | | |
| | | public void setSocialCreditCodeExpires(String socialCreditCodeExpires) { |
| | | this.socialCreditCodeExpires = socialCreditCodeExpires; |
| | | } |
| | | |
| | | public String getLegalPhone() { |
| | | return legalPhone; |
| | | } |
| | | |
| | | public void setLegalPhone(String legalPhone) { |
| | | this.legalPhone = legalPhone; |
| | | } |
| | | |
| | | public String getLegalPerson() { |
| | | return legalPerson; |
| | | } |
| | | |
| | | public void setLegalPerson(String legalPerson) { |
| | | this.legalPerson = legalPerson; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public String getProvCode() { |
| | | return provCode; |
| | | } |
| | | |
| | | public void setProvCode(String provCode) { |
| | | this.provCode = provCode; |
| | | } |
| | | |
| | | public String getAreaCode() { |
| | | return areaCode; |
| | | } |
| | | |
| | | public void setAreaCode(String areaCode) { |
| | | this.areaCode = areaCode; |
| | | } |
| | | |
| | | public String getFileNo() { |
| | | return fileNo; |
| | | } |
| | | |
| | | public void setFileNo(String fileNo) { |
| | | this.fileNo = fileNo; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class UnbindAccount { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "unbindAccount"; |
| | | |
| | | /** |
| | | * 子商户编号 |
| | | */ |
| | | private String userId; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.model; |
| | | |
| | | public class Withdraw { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "withdraw"; |
| | | /** |
| | | * 子商户编号(必填) |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 结算金额(必填) |
| | | */ |
| | | private String amount; |
| | | |
| | | /** |
| | | * 订单名称 |
| | | */ |
| | | private String orderName; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 后台回调地址(必填) |
| | | */ |
| | | private String notifyUrl; |
| | | |
| | | /** |
| | | * 自定义参数1 |
| | | */ |
| | | private String parameter1; |
| | | |
| | | /** |
| | | * 自定义参数2 |
| | | */ |
| | | private String parameter2; |
| | | |
| | | public String getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getAmount() { |
| | | return amount; |
| | | } |
| | | |
| | | public void setAmount(String amount) { |
| | | this.amount = amount; |
| | | } |
| | | |
| | | public String getOrderName() { |
| | | return orderName; |
| | | } |
| | | |
| | | public void setOrderName(String orderName) { |
| | | this.orderName = orderName; |
| | | } |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public String getNotifyUrl() { |
| | | return notifyUrl; |
| | | } |
| | | |
| | | public void setNotifyUrl(String notifyUrl) { |
| | | this.notifyUrl = notifyUrl; |
| | | } |
| | | |
| | | public String getParameter1() { |
| | | return parameter1; |
| | | } |
| | | |
| | | public void setParameter1(String parameter1) { |
| | | this.parameter1 = parameter1; |
| | | } |
| | | |
| | | public String getParameter2() { |
| | | return parameter2; |
| | | } |
| | | |
| | | public void setParameter2(String parameter2) { |
| | | this.parameter2 = parameter2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | | * @Date 2021/12/21 14:23 |
| | | */ |
| | | public class Base64 { |
| | | static private final int BASELENGTH = 128; |
| | | static private final int LOOKUPLENGTH = 64; |
| | | static private final int TWENTYFOURBITGROUP = 24; |
| | | static private final int EIGHTBIT = 8; |
| | | static private final int SIXTEENBIT = 16; |
| | | static private final int FOURBYTE = 4; |
| | | static private final int SIGN = -128; |
| | | static private final char PAD = '='; |
| | | static private final boolean fDebug = false; |
| | | static final private byte[] base64Alphabet = new byte[BASELENGTH]; |
| | | static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; |
| | | |
| | | static { |
| | | for (int i = 0; i < BASELENGTH; ++i) { |
| | | base64Alphabet[i] = -1; |
| | | } |
| | | for (int i = 'Z'; i >= 'A'; i--) { |
| | | base64Alphabet[i] = (byte) (i - 'A'); |
| | | } |
| | | for (int i = 'z'; i >= 'a'; i--) { |
| | | base64Alphabet[i] = (byte) (i - 'a' + 26); |
| | | } |
| | | |
| | | for (int i = '9'; i >= '0'; i--) { |
| | | base64Alphabet[i] = (byte) (i - '0' + 52); |
| | | } |
| | | |
| | | base64Alphabet['+'] = 62; |
| | | base64Alphabet['/'] = 63; |
| | | |
| | | for (int i = 0; i <= 25; i++) { |
| | | lookUpBase64Alphabet[i] = (char) ('A' + i); |
| | | } |
| | | |
| | | for (int i = 26, j = 0; i <= 51; i++, j++) { |
| | | lookUpBase64Alphabet[i] = (char) ('a' + j); |
| | | } |
| | | |
| | | for (int i = 52, j = 0; i <= 61; i++, j++) { |
| | | lookUpBase64Alphabet[i] = (char) ('0' + j); |
| | | } |
| | | lookUpBase64Alphabet[62] = (char) '+'; |
| | | lookUpBase64Alphabet[63] = (char) '/'; |
| | | |
| | | } |
| | | |
| | | private static boolean isWhiteSpace(char octect) { |
| | | return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); |
| | | } |
| | | |
| | | private static boolean isPad(char octect) { |
| | | return (octect == PAD); |
| | | } |
| | | |
| | | private static boolean isData(char octect) { |
| | | return (octect < BASELENGTH && base64Alphabet[octect] != -1); |
| | | } |
| | | |
| | | /** |
| | | * Encodes hex octects into Base64 |
| | | * |
| | | * @param binaryData |
| | | * Array containing binaryData |
| | | * @return Encoded Base64 array |
| | | */ |
| | | public static String encode(byte[] binaryData) { |
| | | |
| | | if (binaryData == null) { |
| | | return null; |
| | | } |
| | | |
| | | int lengthDataBits = binaryData.length * EIGHTBIT; |
| | | if (lengthDataBits == 0) { |
| | | return ""; |
| | | } |
| | | |
| | | int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; |
| | | int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; |
| | | int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 |
| | | : numberTriplets; |
| | | char encodedData[] = null; |
| | | |
| | | encodedData = new char[numberQuartet * 4]; |
| | | |
| | | byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; |
| | | |
| | | int encodedIndex = 0; |
| | | int dataIndex = 0; |
| | | if (fDebug) { |
| | | System.out.println("number of triplets = " + numberTriplets); |
| | | } |
| | | |
| | | for (int i = 0; i < numberTriplets; i++) { |
| | | b1 = binaryData[dataIndex++]; |
| | | b2 = binaryData[dataIndex++]; |
| | | b3 = binaryData[dataIndex++]; |
| | | |
| | | if (fDebug) { |
| | | System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3); |
| | | } |
| | | |
| | | l = (byte) (b2 & 0x0f); |
| | | k = (byte) (b1 & 0x03); |
| | | |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) |
| | | : (byte) ((b1) >> 2 ^ 0xc0); |
| | | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) |
| | | : (byte) ((b2) >> 4 ^ 0xf0); |
| | | byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) |
| | | : (byte) ((b3) >> 6 ^ 0xfc); |
| | | |
| | | if (fDebug) { |
| | | System.out.println("val2 = " + val2); |
| | | System.out.println("k4 = " + (k << 4)); |
| | | System.out.println("vak = " + (val2 | (k << 4))); |
| | | } |
| | | |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; |
| | | } |
| | | |
| | | // form integral number of 6-bit groups |
| | | if (fewerThan24bits == EIGHTBIT) { |
| | | b1 = binaryData[dataIndex]; |
| | | k = (byte) (b1 & 0x03); |
| | | if (fDebug) { |
| | | System.out.println("b1=" + b1); |
| | | System.out.println("b1<<2 = " + (b1 >> 2)); |
| | | } |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) |
| | | : (byte) ((b1) >> 2 ^ 0xc0); |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; |
| | | encodedData[encodedIndex++] = PAD; |
| | | encodedData[encodedIndex++] = PAD; |
| | | } else if (fewerThan24bits == SIXTEENBIT) { |
| | | b1 = binaryData[dataIndex]; |
| | | b2 = binaryData[dataIndex + 1]; |
| | | l = (byte) (b2 & 0x0f); |
| | | k = (byte) (b1 & 0x03); |
| | | |
| | | byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) |
| | | : (byte) ((b1) >> 2 ^ 0xc0); |
| | | byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) |
| | | : (byte) ((b2) >> 4 ^ 0xf0); |
| | | |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; |
| | | encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; |
| | | encodedData[encodedIndex++] = PAD; |
| | | } |
| | | |
| | | return new String(encodedData); |
| | | } |
| | | |
| | | /** |
| | | * Decodes Base64 data into octects |
| | | * |
| | | * @param encoded |
| | | * string containing Base64 data |
| | | * @return Array containind decoded data. |
| | | */ |
| | | public static byte[] decode(String encoded) { |
| | | |
| | | if (encoded == null) { |
| | | return null; |
| | | } |
| | | |
| | | char[] base64Data = encoded.toCharArray(); |
| | | // remove white spaces |
| | | int len = removeWhiteSpace(base64Data); |
| | | |
| | | if (len % FOURBYTE != 0) { |
| | | return null;// should be divisible by four |
| | | } |
| | | |
| | | int numberQuadruple = (len / FOURBYTE); |
| | | |
| | | if (numberQuadruple == 0) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | byte decodedData[] = null; |
| | | byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; |
| | | char d1 = 0, d2 = 0, d3 = 0, d4 = 0; |
| | | |
| | | int i = 0; |
| | | int encodedIndex = 0; |
| | | int dataIndex = 0; |
| | | decodedData = new byte[(numberQuadruple) * 3]; |
| | | |
| | | for (; i < numberQuadruple - 1; i++) { |
| | | |
| | | if (!isData((d1 = base64Data[dataIndex++])) |
| | | || !isData((d2 = base64Data[dataIndex++])) |
| | | || !isData((d3 = base64Data[dataIndex++])) |
| | | || !isData((d4 = base64Data[dataIndex++]))) { |
| | | return null; |
| | | }// if found "no data" just return null |
| | | |
| | | b1 = base64Alphabet[d1]; |
| | | b2 = base64Alphabet[d2]; |
| | | b3 = base64Alphabet[d3]; |
| | | b4 = base64Alphabet[d4]; |
| | | |
| | | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); |
| | | } |
| | | |
| | | if (!isData((d1 = base64Data[dataIndex++])) |
| | | || !isData((d2 = base64Data[dataIndex++]))) { |
| | | return null;// if found "no data" just return null |
| | | } |
| | | |
| | | b1 = base64Alphabet[d1]; |
| | | b2 = base64Alphabet[d2]; |
| | | |
| | | d3 = base64Data[dataIndex++]; |
| | | d4 = base64Data[dataIndex++]; |
| | | if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters |
| | | if (isPad(d3) && isPad(d4)) { |
| | | if ((b2 & 0xf) != 0)// last 4 bits should be zero |
| | | { |
| | | return null; |
| | | } |
| | | byte[] tmp = new byte[i * 3 + 1]; |
| | | System.arraycopy(decodedData, 0, tmp, 0, i * 3); |
| | | tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); |
| | | return tmp; |
| | | } else if (!isPad(d3) && isPad(d4)) { |
| | | b3 = base64Alphabet[d3]; |
| | | if ((b3 & 0x3) != 0)// last 2 bits should be zero |
| | | { |
| | | return null; |
| | | } |
| | | byte[] tmp = new byte[i * 3 + 2]; |
| | | System.arraycopy(decodedData, 0, tmp, 0, i * 3); |
| | | tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | return tmp; |
| | | } else { |
| | | return null; |
| | | } |
| | | } else { // No PAD e.g 3cQl |
| | | b3 = base64Alphabet[d3]; |
| | | b4 = base64Alphabet[d4]; |
| | | decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); |
| | | decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); |
| | | decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); |
| | | |
| | | } |
| | | |
| | | return decodedData; |
| | | } |
| | | |
| | | /** |
| | | * remove WhiteSpace from MIME containing encoded Base64 data. |
| | | * |
| | | * @param data |
| | | * the byte array of base64 data (with WS) |
| | | * @return the new length |
| | | */ |
| | | private static int removeWhiteSpace(char[] data) { |
| | | if (data == null) { |
| | | return 0; |
| | | } |
| | | |
| | | // count characters that's not whitespace |
| | | int newSize = 0; |
| | | int len = data.length; |
| | | for (int i = 0; i < len; i++) { |
| | | if (!isWhiteSpace(data[i])) { |
| | | data[newSize++] = data[i]; |
| | | } |
| | | } |
| | | return newSize; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | import cn.hutool.cache.CacheUtil; |
| | | import cn.hutool.cache.impl.TimedCache; |
| | | |
| | | /** |
| | | * @author linqy |
| | | * 缓存工具类,生产建议使用其他缓存中间件 |
| | | */ |
| | | public class CacheUtils { |
| | | private static final TimedCache<String, String> TIMED_CACHE = CacheUtil.newTimedCache(5000); |
| | | |
| | | static { |
| | | /** 每1s检查一次过期 */ |
| | | TIMED_CACHE.schedulePrune(1000); |
| | | } |
| | | |
| | | /** |
| | | * 存入键值对,提供消逝时间 |
| | | * |
| | | * @param key |
| | | * @param value |
| | | * @param timeout |
| | | */ |
| | | public static void put(String key, String value, Long timeout) { |
| | | /** 设置消逝时间 */ |
| | | TIMED_CACHE.put(key, value, timeout); |
| | | } |
| | | |
| | | /** |
| | | * 每次重新get一次缓存,均会重新刷新消逝时间 |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public static String get(String key) { |
| | | return TIMED_CACHE.get(key); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | import java.io.BufferedWriter; |
| | | import java.io.FileWriter; |
| | | import java.security.KeyPair; |
| | | import java.security.KeyPairGenerator; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | import java.security.interfaces.RSAPrivateKey; |
| | | import java.security.interfaces.RSAPublicKey; |
| | | |
| | | /** |
| | | * 公私钥代码生成 |
| | | * @Author xiaogc |
| | | * @Date 2021/12/21 14:22 |
| | | */ |
| | | public class RSAEncryptGeneration { |
| | | |
| | | public static void main(String[] args) { |
| | | // 生成一对公私钥到指定路径下 .pfx私钥 .cer公钥 |
| | | RSAEncryptGeneration.genKeyPair("D:\\tools"); |
| | | } |
| | | /** |
| | | * 随机生成密钥对 |
| | | */ |
| | | public static void genKeyPair(String filePath) { |
| | | // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象 |
| | | KeyPairGenerator keyPairGen = null; |
| | | try { |
| | | keyPairGen = KeyPairGenerator.getInstance("RSA"); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 初始化密钥对生成器,密钥大小为96-1024位 |
| | | keyPairGen.initialize(1024, new SecureRandom()); |
| | | // 生成一个密钥对,保存在keyPair中 |
| | | KeyPair keyPair = keyPairGen.generateKeyPair(); |
| | | // 得到私钥 |
| | | RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); |
| | | // 得到公钥 |
| | | RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); |
| | | try { |
| | | // 得到公钥字符串 |
| | | String publicKeyString = Base64.encode(publicKey.getEncoded()); |
| | | System.out.println("公钥字符串:"+publicKeyString); |
| | | // 得到私钥字符串 |
| | | String privateKeyString = Base64.encode(privateKey.getEncoded()); |
| | | System.out.println("私钥字符串:"+privateKeyString); |
| | | // 将密钥对写入到文件 .pfx私钥 .cer公钥 |
| | | FileWriter pubfw = new FileWriter(filePath + "/merchant_no.cer"); |
| | | FileWriter prifw = new FileWriter(filePath + "/merchant_no.pfx"); |
| | | BufferedWriter pubbw = new BufferedWriter(pubfw); |
| | | BufferedWriter pribw = new BufferedWriter(prifw); |
| | | pubbw.write(publicKeyString); |
| | | pribw.write(privateKeyString); |
| | | pubbw.flush(); |
| | | pubbw.close(); |
| | | pubfw.close(); |
| | | pribw.flush(); |
| | | pribw.close(); |
| | | prifw.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | |
| | | import com.stylefeng.guns.modular.system.util.MallBook.config.ChannelConfig; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.security.KeyFactory; |
| | | import java.security.PrivateKey; |
| | | import java.security.PublicKey; |
| | | import java.security.spec.PKCS8EncodedKeySpec; |
| | | import java.security.spec.X509EncodedKeySpec; |
| | | |
| | | /** |
| | | * @author RSA签名验签类 |
| | | */ |
| | | public class RSASignature { |
| | | |
| | | public static Logger logger = LoggerFactory.getLogger(RSASignature.class); |
| | | |
| | | /** |
| | | * 签名算法 |
| | | */ |
| | | public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; |
| | | |
| | | |
| | | /** |
| | | * 商户平台私钥签名 |
| | | * |
| | | * @param content |
| | | * @return |
| | | */ |
| | | public static String sign(String content) { |
| | | try { |
| | | String privateKey = ChannelConfig.merchantPrivateKey; |
| | | PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey)); |
| | | KeyFactory keyf = KeyFactory.getInstance("RSA"); |
| | | PrivateKey priKey = keyf.generatePrivate(priPKCS8); |
| | | java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); |
| | | signature.initSign(priKey); |
| | | signature.update(content.getBytes()); |
| | | byte[] signed = signature.sign(); |
| | | return Base64.encode(signed); |
| | | } catch (Exception e) { |
| | | logger.error("签名失败{}", e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 读取证书 |
| | | * |
| | | * @param filePath 证书文件路径 |
| | | */ |
| | | public static String loadKey(String filePath) throws Exception { |
| | | try (BufferedReader br = new BufferedReader(new FileReader(filePath))) { |
| | | String readLine; |
| | | StringBuilder sb = new StringBuilder(); |
| | | while ((readLine = br.readLine()) != null) { |
| | | sb.append(readLine); |
| | | } |
| | | return sb.toString(); |
| | | } catch (IOException e) { |
| | | throw new Exception("私钥数据读取错误"); |
| | | } catch (NullPointerException e) { |
| | | throw new Exception("私钥输入流为空"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * mallbook公钥验签 |
| | | * |
| | | * @param content 待签名数据 |
| | | * @param sign 签名值 |
| | | * @return false 验签失败 true 成功 |
| | | */ |
| | | public static boolean validate(String content, String sign) { |
| | | boolean verify = false; |
| | | try { |
| | | String publicKey = ChannelConfig.mallBookPublicKey; |
| | | verify = RSASignature.doCheck(content, sign, publicKey, "utf-8"); |
| | | } catch (Exception e) { |
| | | logger.error("验签失败:{}", e); |
| | | } |
| | | return verify; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * RSA验签 |
| | | * |
| | | * @param content 待签名数据 |
| | | * @param sign 签名值 |
| | | * @param publicKey 分配给开发商公钥 |
| | | * @param encode 字符集编码 |
| | | * @return 布尔值 |
| | | */ |
| | | public static boolean doCheck(String content, String sign, String publicKey, String encode) { |
| | | try { |
| | | KeyFactory keyFactory = KeyFactory.getInstance("RSA"); |
| | | byte[] encodedKey = Base64.decode(publicKey); |
| | | PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); |
| | | java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS); |
| | | signature.initVerify(pubKey); |
| | | signature.update(content.getBytes(encode)); |
| | | return signature.verify(Base64.decode(sign)); |
| | | } catch (Exception e) { |
| | | logger.error("验签失败{}", e); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | |
| | | |
| | | public class StringUtil extends StrUtil { |
| | | |
| | | /** |
| | | * null转为空字符串 |
| | | * |
| | | * @param str |
| | | * @return |
| | | */ |
| | | public static String convertNull(String str) { |
| | | if (str == null) { |
| | | return ""; |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.MallBook.util; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.exceptions.ValidateException; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.InterfaceRequest; |
| | | import com.stylefeng.guns.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | | * @Date 2022/1/24 13:45 |
| | | */ |
| | | public class TrhRequest<T> { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServerLog"); |
| | | |
| | | public InterfaceResponse execute(T t, String serverCode) { |
| | | InterfaceRequest<T> request = new InterfaceRequest(t, serverCode); |
| | | logger.warn("mallbook请求参数:" + JSONUtil.toJsonStr(request)); |
| | | String result = HttpUtil.post(ChannelConfig.payUrl, BeanUtil.beanToMap(request)); |
| | | logger.warn("mallbook响应参数:" + result); |
| | | InterfaceResponse response = JSONUtil.toBean(result, InterfaceResponse.class); |
| | | boolean verify = RSASignature.validate(response.content(), response.getSign()); |
| | | if (!verify) { |
| | | throw new ValidateException("签名验证失败"); |
| | | } else { |
| | | logger.warn("签名验证通过"); |
| | | } |
| | | return response; |
| | | } |
| | | } |
| | |
| | | userToCoupon.setExpireCount(validCount); |
| | | userToCoupon.setValidCount(0); |
| | | } |
| | | if(collect2.size() > 0){ |
| | | userToCouponService.updateBatchById(collect2); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @Scheduled(cron = "0 0 0 * * *") |
| | | public void taskDay(){ |
| | | try { |
| | | locationService.updateFence();//更新线上电子围栏 |
| | | // locationService.updateFence();//更新线上电子围栏 |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | tAppUser.setIsException(2); |
| | | } |
| | | } |
| | | if(appUserList.size() > 0){ |
| | | appUserService.updateBatchById(appUserList); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | if(driverList.size() > 0){ |
| | | driverService.updateBatchById(driverList); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | driver.setIsException(1); |
| | | } |
| | | } |
| | | if(driverList.size() > 0){ |
| | | driverService.updateBatchById(driverList); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | spring: |
| | | profiles: |
| | | # active: dev |
| | | active: produce |
| | | mvc: |
| | | static-path-pattern: /static/** |
| | |
| | | map: |
| | | key: e0370a9a4d10739045fb0b8f4742a67e #高德key |
| | | |
| | | #eureka: |
| | | # client: |
| | | # service-url: #注册中心地址 |
| | | # defaultZone: http://sinata:sinata@139.9.249.67:8000/eureka #启用身份验证的方式连接 |
| | | # register-with-eureka: true #在注册中心进行注册 |
| | | # fetch-registry: true #从Eureka中获取注册信息。 |
| | | |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | profiles: local |
| | | datasource: |
| | | url: jdbc:mysql://192.168.110.80:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://127.0.0.1:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 |
| | | username: root |
| | | # password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj |
| | | password: 123456 |
| | | password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj |
| | | # password: 123456 |
| | | db-name: super_save_driving #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | |
| | | - dataSourceGuns |
| | | - dataSourceBiz |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | profiles: produce |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/super_save_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj |
| | | db-name: super_save_driving #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | --- |
| | | |
| | | filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 |
| | | #filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | --- |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://chaoshengdaijia.com:8443 |
| | | #测试环境 |
| | | #callbackPath: http://121.37.15.157:8010 |
| | | |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
| | | |
| | | --- |
| | | |
| | | # mallbook 调起接口参数配置 |
| | | mallbook: |
| | | # pay_url:mallbook接口地址 测试环境: https://uat.mallbook.cn/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: https://cloudpay.mallbook.cn/api |
| | | # merchant_no 业务系统商户平台编号,需替换为mallbook工作人员提供的商户编号 |
| | | merchant_no: MBH23056 |
| | | # version 接口版本号 |
| | | version: 1.0.0 |
| | | # channel_type 渠道类型 HF:汇付 |
| | | channel_type: HF |
| | | # merchant_private_key 商户平台私钥,需要替换成商户平台自己生成的私钥 |
| | | merchant_private_key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALHmyTrxPYcAwABnX+3VW9vxUftm57zBpnbfOT4vizMnKdpfCkIgtdbfdnSCtt637yWM2fxnZfItnhTeQA2lL8f4SXgZt/bVXfmAWi4IxQ+HJy0Qs8nNy2nnjICPBPcpWzHwUxQ/THHqU0a7b9B91J5DFcbQb25BHeRpHwkBw6A/AgMBAAECgYAmcWq2s/7Jt53F+JDAQkTRaHqAyyH0phwkv+QMzhVUfngK2lLLK2pf/nYIg16lDjY9dQx+AJIFHVp1w/kveayzOz3BIqPoznyIVYPolRGZCWPo+2vdp0CIdBh7zahST5g5Gem4cU47wO5hPYs1kXKPG4mUPtaIAMHFxhyLvIagAQJBAOS63AIZrRrldeNCVVNXbpAT52JuWLCgravM9coOh6scmG6UQwxxcott8hneHr9fazk2LHbHMxlG8F+dQPA0+D8CQQDHHJN7Dnske8oJ+1sq4uhQP3HMsmNIgth+ZcaZpiPcxnNKYVGhzAwTVV2ruFJle5ajebo6zfWuqJhtZGRNh1gBAkA/lRoXk1+lfGfa9tOVSVa4wm+t0xLgdqoQefdRZdyc2mQdSSWiTd8Tl0qXmkFd3X6G9uJBWnp/6lJjoektXOwtAkBsZTQsw99qJzIAaSRinpDWTxPG2j6OlR0DAqkxsG7JnAfbsEteh9TzGYAbIgdJVBTX/kbSCJn9ca85rnOkeVABAkAUbDfU3Z702z20NtwAxc1IkrtQ1lKuqSpj9/LuR1/6KRkYQsUWnUiOO9hu5YDWIcflFrnCenF8j8OnvGghltxT |
| | | # mall_book_public_key mallbook测试环境公钥 不需要替换 |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <configuration> |
| | | <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> |
| | | <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> |
| | | <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
| | | <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <contextName>logback</contextName> |
| | | |
| | | <!--定义日志存放的位置--> |
| | | <springProperty scope="context" name="gunsLogPath" source="log.path" defaultValue="guns-logs"/> |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <property name="log.path" value="/usr/local/server/app/logs/management"/> |
| | | <!--<property name="log.path" value="d:/logs/driver"/>--> |
| | | |
| | | <!-- ****************************************************************************************** --> |
| | | <!-- ****************************** 本地开发只在控制台打印日志 ******************************** --> |
| | | <!-- ****************************************************************************************** --> |
| | | <springProfile name="local"> |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
| | | <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
| | | <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
| | | <!-- 彩色日志格式 --> |
| | | <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--encoder 默认配置为PatternLayoutEncoder--> |
| | | <!--1. 输出到控制台--> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!-- 日志记录器,日期滚动记录 --> |
| | | <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文件的路径及文件名 --> |
| | | <file>${gunsLogPath}/log_error.log</file> |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 |
| | | 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> |
| | | <fileNamePattern>${gunsLogPath}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, |
| | | 命名日志文件,例如log-error-2013-12-21.0.log --> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>2MB</maxFileSize> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 追加方式记录日志 --> |
| | | <append>true</append> |
| | | <!-- 日志文件的格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志文件记录级别配置。 |
| | | 日志级别:ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF |
| | | onMatch="ACCEPT" 表示匹配该级别及以上 |
| | | onMatch="DENY" 表示不匹配该级别及以上 |
| | | onMatch="NEUTRAL" 表示该级别及以上的,由下一个filter处理,如果当前是最后一个,则表示匹配该级别及以上 |
| | | onMismatch="ACCEPT" 表示匹配该级别以下 |
| | | onMismatch="NEUTRAL" 表示该级别及以下的,由下一个filter处理,如果当前是最后一个,则不匹配该级别以下的 |
| | | onMismatch="DENY" 表示不匹配该级别以下的 |
| | | --> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | |
| | | </filter> |
| | | </appender> |
| | | |
| | | <root level="INFO"> |
| | | <appender-ref ref="STDOUT"/> |
| | | <appender-ref ref="FILE"/> |
| | | </root> |
| | | </springProfile> |
| | | |
| | | <!-- ****************************************************************************************** --> |
| | | <!-- ********************** 放到服务器上不管在什么环境都只在文件记录日志 ********************** --> |
| | | <!-- ****************************************************************************************** --> |
| | | <springProfile name="!local"> |
| | | |
| | | <!-- 日志记录器,日期滚动记录 --> |
| | | <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文件的路径及文件名 --> |
| | | <file>${gunsLogPath}/log_error.log</file> |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/all.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 |
| | | 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> |
| | | <fileNamePattern>${gunsLogPath}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, |
| | | 命名日志文件,例如log-error-2013-12-21.0.log --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>2MB</maxFileSize> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 追加方式记录日志 --> |
| | | <append>true</append> |
| | | <!-- 日志文件的格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | </encoder> |
| | | <!-- 此日志文件只记录error级别的 --> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>error</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | <level>DEBUG</level> |
| | | <onMatch>DENY</onMatch> |
| | | <onMismatch>ACCEPT</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 日志记录器,日期滚动记录 --> |
| | | <appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文件的路径及文件名 --> |
| | | <file>${gunsLogPath}/log_total.log</file> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 |
| | | 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> |
| | | <fileNamePattern>${gunsLogPath}/total/log-total-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, |
| | | 命名日志文件,例如log-error-2013-12-21.0.log --> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>2MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | </rollingPolicy> |
| | | <!-- 追加方式记录日志 --> |
| | | <append>true</append> |
| | | <!-- 日志文件的格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <pattern>===%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern> |
| | | <charset>utf-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | <!-- |
| | | <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
| | | 以及指定<appender>。<logger>仅有一个name属性, |
| | | 一个可选的level和一个可选的addtivity属性。 |
| | | name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
| | | 如果未设置此属性,那么当前logger将会继承上级的级别。 |
| | | addtivity:是否向上级logger传递打印信息。默认是true。 |
| | | <logger name="org.springframework.web" level="info"/> |
| | | <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> |
| | | --> |
| | | |
| | | <root level="INFO"> |
| | | <appender-ref ref="FILE_ERROR"/> |
| | | <appender-ref ref="FILE_ALL"/> |
| | | <!-- |
| | | root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 不能设置为INHERITED或者同义词NULL。默认是DEBUG |
| | | 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
| | | --> |
| | | |
| | | <!-- 4 最终的策略: |
| | | 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> |
| | | <springProfile name="dev"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.driver.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="fat"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.driver.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="produce"> |
| | | <root level="info"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="ServiceLog" level="debug"/> |
| | | <logger name="com.supersavedriving.driver.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | </configuration> |
| | | |
| | | |
| | |
| | | #redisÅäÖÿªÊ¼ |
| | | # RedisÊý¾Ý¿âË÷Òý£¨Ä¬ÈÏΪ0£© |
| | | spring.redis.database=0 |
| | | # Redis·þÎñÆ÷µØÖ· |
| | | |
| | | ## Redis·þÎñÆ÷µØÖ· |
| | | spring.redis.host=127.0.0.1 |
| | | ## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú |
| | | spring.redis.port=16379 |
| | | ## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© |
| | | spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ |
| | | |
| | | ## Redis·þÎñÆ÷µØÖ· |
| | | # Redis·þÎñÆ÷µØÖ· |
| | | #spring.redis.host=127.0.0.1 |
| | | ## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú |
| | | #spring.redis.port=6379 |
| | |
| | | // orderByMonth(new Date().getMonth() + 1) |
| | | // orderByYear(new Date().getFullYear()) |
| | | // queryOrderCount() |
| | | setInterval(function () { |
| | | console.log(1111111111) |
| | | getData() |
| | | }, 30000); |
| | | }) |
| | | |
| | | function selectYear(e){ |
| | |
| | | selectMonth(value)// change 每点一次都会监听一遍 |
| | | } |
| | | }); |
| | | laydate.render({ |
| | | elem: '#createTime', |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | |
| | | // 进度条加载 |
| | | function loading(){ |
| | | var options = $.extend({ |
| | | percentage : $('#agentTotal').text(), |
| | | percentage : $('#agentTotal').text()<100?$('#agentTotal').text():($('#agentTotal').text()>1000?$('#agentTotal').text()/100:$('#agentTotal').text()/10), |
| | | ShowProgressCount: false, |
| | | duration: 10, |
| | | |
| | |
| | | }); |
| | | $('#pro1').LineProgressbar(options); |
| | | var options = $.extend({ |
| | | percentage : $('#agentMonthTotal').text(), |
| | | percentage : $('#agentMonthTotal').text()<100?$('#agentMonthTotal').text():($('#agentMonthTotal').text()>1000?$('#agentMonthTotal').text()/100:$('#agentMonthTotal').text()/10), |
| | | ShowProgressCount: false, |
| | | duration: 10, |
| | | |
| | |
| | | }); |
| | | $('#pro2').LineProgressbar(options); |
| | | var options = $.extend({ |
| | | percentage : $('#driverTotal').text(), |
| | | percentage : $('#driverTotal').text()<100?$('#driverTotal').text():($('#driverTotal').text()>1000?$('#driverTotal').text()/100:$('#driverTotal').text()/10), |
| | | ShowProgressCount: false, |
| | | duration: 10, |
| | | |
| | |
| | | }); |
| | | $('#pro3').LineProgressbar(options); |
| | | var options = $.extend({ |
| | | percentage : $('#driverMonthTotal').text(), |
| | | percentage : $('#driverMonthTotal').text()<100?$('#driverMonthTotal').text():($('#driverMonthTotal').text()>1000?$('#driverMonthTotal').text()/100:$('#driverMonthTotal').text()/10), |
| | | ShowProgressCount: false, |
| | | duration: 10, |
| | | |
| | |
| | | document.getElementById("serverCount").innerText=data.serverCount |
| | | document.getElementById("finishCount").innerText=data.finishCount |
| | | document.getElementById("cancelCount").innerText=data.cancelCount |
| | | $('#allList').val(data.allList); |
| | | console.log(data.allList) |
| | | map(data.allList,data.addressLon,data.addressLat) |
| | | $('#onLineDriver').val(data.onLineDriver); |
| | | console.log(data.onLineDriver) |
| | | map(data.onLineDriver,data.addressLon,data.addressLat) |
| | | getOrderData() |
| | | |
| | | }, function (data) { |
| | |
| | | document.getElementById("serverCount").innerText=data.serverCount |
| | | document.getElementById("finishCount").innerText=data.finishCount |
| | | document.getElementById("cancelCount").innerText=data.cancelCount |
| | | $('#allList').val(data.allList); |
| | | map(data.allList,data.addressLon,data.addressLat) |
| | | $('#onLineDriver').val(data.onLineDriver); |
| | | map(data.onLineDriver,data.addressLon,data.addressLat) |
| | | getOrderData() |
| | | }, function (data) { |
| | | }); |
| | |
| | | window._AMapSecurityConfig = { |
| | | securityJsCode:'b62d9146929db08c4c2f4537d045320d', |
| | | }; |
| | | laydate.render({ |
| | | elem: '#createTime', |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | |
| | | AMapLoader.reset() // 需要把这个reset一下 |
| | | AMapLoader.load({ |
| | |
| | | }); |
| | | // map.clearMap(); // 清除地图覆盖物 |
| | | // 经纬度坐标数组 |
| | | const onLineDriver = $('#onLineDriver').val(); |
| | | |
| | | var onLineDriver; |
| | | if(e==""){ |
| | | onLineDriver = $('#onLineDriver').val(); |
| | | console.log("onLineDriver========================") |
| | | console.log(onLineDriver) |
| | | var list1 = JSON.stringify(onLineDriver) |
| | | console.log("list1========================") |
| | | console.log(list1) |
| | | const jsonArr = JSON.parse(list1) |
| | | console.log("jsonArr========================") |
| | | console.log(jsonArr) |
| | | const jsonArr1 = JSON.parse(jsonArr); |
| | | console.log("jsonArr1========================") |
| | | console.log(jsonArr1) |
| | | M = jsonArr1; |
| | | }else{ |
| | | M=e; |
| | | } |
| | | console.log("M =========================") |
| | | console.log(M) |
| | | M.forEach(function(marker) { |
| | | console.log("========================") |
| | | console.log(marker) |
| | | new AMap.Marker({ |
| | | map: map, |
| | | icon: marker[2]==1?'https://csxdj.obs.cn-south-1.myhuaweicloud.com/c1d2f38187de40daa353fcc70993288e.png':'https://csxdj.obs.cn-south-1.myhuaweicloud.com/c1d2f38187de40daa353fcc70993288e.png', |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style type="text/css"> |
| | | table{ |
| | | width: 100%; |
| | | } |
| | | td, th{ |
| | | border: 1px solid #eee; |
| | | text-align: center; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | } |
| | | td select, td div, td div input, td input{ |
| | | height: 100%; |
| | | width: 95%; |
| | | border: none; |
| | | text-indent: 10px; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="tAgentInfoForm"> |
| | | <input type="hidden" id="provCodeEnterprise1" value="${item.provCodeEnterprise}"> |
| | | <input type="hidden" id="areaCodeEnterprise1" value="${item.areaCodeEnterprise}"> |
| | | <input type="hidden" id="provCodeBank1" value="${item.provCodeBank}"> |
| | | <input type="hidden" id="areaCodeBank1" value="${item.areaCodeBank}"> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 企业信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*负责人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principal" name="principal" value="${item.principal}" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*联系电话:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principalPhone" name="principalPhone" value="${item.principalPhone}" maxlength="11" type="number" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" ${roleType == 1 ? 'hidden' : ''}> |
| | | <input id="areaId" type="hidden"> |
| | | <label class="col-sm-3 control-label">*代理区域:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="area" onclick="TAgent.area()" name="area" value="${item.provinceName}/${item.cityName}" placeholder="请选择" readonly> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*邮箱:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="email" name="email" type="email" value="${item.email}" maxlength="40" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row" ${roleType == 1 ? 'hidden' : ''}> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 商户信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*商户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="userType"> |
| | | <option value="0" ${item.userType == 0 ? 'selected' : '' }>小微商户</option> |
| | | <option value="1" ${item.userType == 1 ? 'selected' : '' }>个体工商户</option> |
| | | <option value="2" ${item.userType == 2 ? 'selected' : '' }>企业</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantName" name="merchantName" value="${item.merchantName}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*经营范围:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="businessScope" name="businessScope" value="${item.businessScope}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCode" name="socialCreditCode" value="${item.socialCreditCode}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCodeExpires" name="socialCreditCodeExpires" value="${socialCreditCodeExpires}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeEnterprise" name="provCodeEnterprise" onchange="initArea(this, 'areaCodeEnterprise')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeEnterprise" name="areaCodeEnterprise"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*企业详细地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="address" name="address" value="${item.address}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardName" name="cardName" value="${item.cardName}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardNo" name="cardNo" value="${item.cardNo}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行账户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankAcctType"> |
| | | <option value="1" ${item.bankAcctType == 1 ? 'selected' : ''}>对公</option> |
| | | <option value="2" ${item.bankAcctType == 2 ? 'selected' : ''}>对私</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPerson" name="legalPerson" value="${item.legalPerson}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantIDCode" name="merchantIDCode" value="${item.merchantIDCode}" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="certIdExpires" name="certIdExpires" value="${certIdExpires}"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPhone" name="legalPhone" value="${item.legalPhone}" type="text" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">营业执照扫描件:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="fileNo" name="fileNo" value="${item.fileNo}" value="" readonly style="height: 100%;width: 100%;border: none;"/> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <button class="form-control" id="fileNoBtnId">上传</button> |
| | | </div> |
| | | <input type="file" id="file" style="display: none;"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*银行名称:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankCode" name="bankCode"> |
| | | <option value="01020000" ${item.bankAcctType == '01020000' ? 'selected' : ''}>工商银行</option> |
| | | <option value="01030000" ${item.bankAcctType == '01030000' ? 'selected' : ''}>农业银行</option> |
| | | <option value="01040000" ${item.bankAcctType == '01040000' ? 'selected' : ''}>中国银行</option> |
| | | <option value="01050000" ${item.bankAcctType == '01050000' ? 'selected' : ''}>建设银行</option> |
| | | <option value="03010000" ${item.bankAcctType == '03010000' ? 'selected' : ''}>交通银行</option> |
| | | <option value="03134402" ${item.bankAcctType == '03134402' ? 'selected' : ''}>平安银行</option> |
| | | <option value="03020000" ${item.bankAcctType == '03020000' ? 'selected' : ''}>中信银行</option> |
| | | <option value="03030000" ${item.bankAcctType == '03030000' ? 'selected' : ''}>光大银行</option> |
| | | <option value="03040000" ${item.bankAcctType == '03040000' ? 'selected' : ''}>华夏银行</option> |
| | | <option value="03050000" ${item.bankAcctType == '03050000' ? 'selected' : ''}>民生银行</option> |
| | | <option value="03060000" ${item.bankAcctType == '03060000' ? 'selected' : ''}>广发银行</option> |
| | | <option value="03080000" ${item.bankAcctType == '03080000' ? 'selected' : ''}>招商银行</option> |
| | | <option value="03090000" ${item.bankAcctType == '03090000' ? 'selected' : ''}>兴业银行</option> |
| | | <option value="03100000" ${item.bankAcctType == '03100000' ? 'selected' : ''}>浦发银行</option> |
| | | <option value="03130011" ${item.bankAcctType == '03130011' ? 'selected' : ''}>北京银行</option> |
| | | <option value="03130012" ${item.bankAcctType == '03130012' ? 'selected' : ''}>天津银行</option> |
| | | <option value="03130031" ${item.bankAcctType == '03130031' ? 'selected' : ''}>上海银行</option> |
| | | <option value="03130032" ${item.bankAcctType == '03130032' ? 'selected' : ''}>江苏银行</option> |
| | | <option value="03130050" ${item.bankAcctType == '03130050' ? 'selected' : ''}>重庆银行</option> |
| | | <option value="03132102" ${item.bankAcctType == '03132102' ? 'selected' : ''}>大连银行</option> |
| | | <option value="03132301" ${item.bankAcctType == '03132301' ? 'selected' : ''}>哈尔滨银行</option> |
| | | <option value="03133201" ${item.bankAcctType == '03133201' ? 'selected' : ''}>南京银行</option> |
| | | <option value="03133301" ${item.bankAcctType == '03133301' ? 'selected' : ''}>杭州银行</option> |
| | | <option value="03133302" ${item.bankAcctType == '03133302' ? 'selected' : ''}>宁波银行</option> |
| | | <option value="03133308" ${item.bankAcctType == '03133308' ? 'selected' : ''}>温州银行</option> |
| | | <option value="03150000" ${item.bankAcctType == '03150000' ? 'selected' : ''}>恒丰银行</option> |
| | | <option value="03160000" ${item.bankAcctType == '03160000' ? 'selected' : ''}>浙商银行</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*开户行地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeBank" name="provCodeBank" onchange="initArea(this, 'areaCodeBank')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeBank" name="areaCodeBank"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行预留手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="phone" name="phone" value="${item.phone}" type="number" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*注册状态:</label> |
| | | <div class="col-sm-4"> |
| | | 商户开户状态: |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | 结算账户绑定状态: |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 账户信息 |
| | | </div> |
| | | <div class="form-group" ${roleType != 1 ? 'hidden' : ''}> |
| | | <label class="col-sm-3 control-label">充值余额:</label> |
| | | <div class="col-sm-3"> |
| | | <span>${marketingAmount}</span> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="amount" type="number" min="0" placeholder="请输入充值金额"> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <button onclick="accountRecharge()">充值</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">可提现余额:</label> |
| | | <div class="col-sm-3"> |
| | | <span id="balance">${balance}</span> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <button onclick="withdrawCash()">提现</button> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">提现记录:</label> |
| | | <div class="col-sm-9"> |
| | | <table> |
| | | <thead> |
| | | <tr><th>提现时间</th><th>提现金额</th><th>到账时间</th></tr> |
| | | </thead> |
| | | <tbody> |
| | | @for(obj in settlementRecords){ |
| | | <tr><td>${obj.insertTime}</td><td>${obj.amount}</td><td>${obj.arrivalTime}</td></tr> |
| | | @} |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent.js"></script> |
| | | <script src="${ctxPath}/static/js/qrcode.js"></script> |
| | | <script src="${ctxPath}/static/js/jquery.qrcode.js"></script> |
| | | <script type="text/javascript"> |
| | | var citys = [{"value":"0011","title":"北京市","cities":[{"value":"1100","title":"北京市"}]},{"value":"0012","title":"天津市","cities":[{"value":"1200","title":"天津市"}]},{"value":"0013","title":"河北省","cities":[{"value":"1301","title":"石家庄"},{"value":"1302","title":"保定"},{"value":"1303","title":"沧州"},{"value":"1304","title":"承德"},{"value":"1305","title":"邯郸"},{"value":"1306","title":"衡水"},{"value":"1307","title":"廊坊"},{"value":"1308","title":"秦皇岛"},{"value":"1309","title":"唐山"},{"value":"1310","title":"邢台"},{"value":"1311","title":"张家口"}]},{"value":"0014","title":"山西省","cities":[{"value":"1401","title":"太原"},{"value":"1402","title":"长治"},{"value":"1403","title":"大同"},{"value":"1404","title":"晋城"},{"value":"1405","title":"离石"},{"value":"1406","title":"临汾"},{"value":"1407","title":"朔州"},{"value":"1408","title":"忻州"},{"value":"1409","title":"阳泉"},{"value":"1410","title":"榆次"},{"value":"1411","title":"运城"},{"value":"1412","title":"晋中"},{"value":"1413","title":"吕梁"}]},{"value":"0015","title":"内蒙古自治区","cities":[{"value":"1501","title":"呼和浩特"},{"value":"1502","title":"包头"},{"value":"1503","title":"阿拉善"},{"value":"1504","title":"巴彦淖尔"},{"value":"1505","title":"赤峰"},{"value":"1506","title":"呼伦贝尔"},{"value":"1507","title":"乌海"},{"value":"1508","title":"乌兰察布"},{"value":"1509","title":"锡林郭勒"},{"value":"1510","title":"兴安"},{"value":"1511","title":"鄂尔多斯"},{"value":"1512","title":"通辽"},{"value":"1513","title":"满洲里"}]},{"value":"0021","title":"辽宁省","cities":[{"value":"2101","title":"沈阳"},{"value":"2102","title":"大连"},{"value":"2103","title":"鞍山"},{"value":"2104","title":"本溪"},{"value":"2105","title":"朝阳"},{"value":"2106","title":"丹东"},{"value":"2107","title":"抚顺"},{"value":"2108","title":"阜新"},{"value":"2109","title":"葫芦岛"},{"value":"2110","title":"锦州"},{"value":"2111","title":"辽阳"},{"value":"2112","title":"盘锦"},{"value":"2113","title":"铁岭"},{"value":"2114","title":"营口"}]},{"value":"0022","title":"吉林省","cities":[{"value":"2201","title":"长春"},{"value":"2202","title":"白城"},{"value":"2203","title":"白山"},{"value":"2204","title":"吉林"},{"value":"2205","title":"辽源"},{"value":"2206","title":"四平"},{"value":"2207","title":"松原"},{"value":"2208","title":"通化"},{"value":"2209","title":"延边"}]},{"value":"0023","title":"黑龙江省","cities":[{"value":"2301","title":"哈尔滨"},{"value":"2302","title":"大庆"},{"value":"2303","title":"大兴安岭"},{"value":"2304","title":"鹤岗"},{"value":"2305","title":"黑河"},{"value":"2306","title":"鸡西"},{"value":"2307","title":"佳木斯"},{"value":"2308","title":"牡丹江"},{"value":"2309","title":"七台河"},{"value":"2310","title":"齐齐哈尔"},{"value":"2311","title":"双鸭山"},{"value":"2312","title":"绥化"},{"value":"2313","title":"伊春"}]},{"value":"0031","title":"上海市","cities":[{"value":"3100","title":"上海市"}]},{"value":"0032","title":"江苏省","cities":[{"value":"3201","title":"南京"},{"value":"3202","title":"常州"},{"value":"3203","title":"淮安"},{"value":"3204","title":"连云港"},{"value":"3205","title":"南通"},{"value":"3206","title":"苏州"},{"value":"3207","title":"宿迁"},{"value":"3208","title":"泰州"},{"value":"3209","title":"无锡"},{"value":"3210","title":"徐州"},{"value":"3211","title":"盐城"},{"value":"3212","title":"扬州"},{"value":"3213","title":"镇江"},{"value":"3214","title":"胥浦"},{"value":"3215","title":"昆山"}]},{"value":"0033","title":"浙江省","cities":[{"value":"3301","title":"杭州"},{"value":"3302","title":"宁波"},{"value":"3303","title":"湖州"},{"value":"3304","title":"嘉兴"},{"value":"3305","title":"金华"},{"value":"3306","title":"绍兴"},{"value":"3307","title":"台州"},{"value":"3308","title":"温州"},{"value":"3309","title":"舟山"},{"value":"3310","title":"衢州"},{"value":"3311","title":"丽水"}]},{"value":"0034","title":"安徽省","cities":[{"value":"3401","title":"合肥"},{"value":"3402","title":"安庆"},{"value":"3403","title":"蚌埠"},{"value":"3404","title":"巢湖"},{"value":"3405","title":"池州"},{"value":"3406","title":"滁州"},{"value":"3407","title":"阜阳"},{"value":"3408","title":"淮北"},{"value":"3409","title":"淮南"},{"value":"3410","title":"黄山"},{"value":"3411","title":"六安"},{"value":"3412","title":"马鞍山"},{"value":"3414","title":"铜陵"},{"value":"3415","title":"芜湖"},{"value":"3416","title":"宣城"},{"value":"3417","title":"亳州"},{"value":"3418","title":"宿州"}]},{"value":"0035","title":"福建省","cities":[{"value":"3501","title":"福州"},{"value":"3502","title":"厦门"},{"value":"3503","title":"龙岩"},{"value":"3504","title":"南平"},{"value":"3505","title":"宁德"},{"value":"3506","title":"莆田"},{"value":"3507","title":"泉州"},{"value":"3508","title":"三明"},{"value":"3509","title":"漳州"}]},{"value":"0036","title":"江西省","cities":[{"value":"3601","title":"南昌"},{"value":"3602","title":"抚州"},{"value":"3603","title":"赣州"},{"value":"3604","title":"吉安"},{"value":"3605","title":"景德镇"},{"value":"3606","title":"九江"},{"value":"3607","title":"萍乡"},{"value":"3608","title":"上饶"},{"value":"3609","title":"新余"},{"value":"3610","title":"宜春"},{"value":"3611","title":"鹰潭"}]},{"value":"0037","title":"山东省","cities":[{"value":"3701","title":"济南"},{"value":"3702","title":"青岛"},{"value":"3703","title":"滨州"},{"value":"3704","title":"德州"},{"value":"3705","title":"东营"},{"value":"3706","title":"菏泽"},{"value":"3707","title":"济宁"},{"value":"3708","title":"莱芜"},{"value":"3709","title":"聊城"},{"value":"3710","title":"临沂"},{"value":"3711","title":"日照"},{"value":"3712","title":"泰安"},{"value":"3713","title":"威海"},{"value":"3714","title":"潍坊"},{"value":"3715","title":"烟台"},{"value":"3716","title":"枣庄"},{"value":"3717","title":"淄博"}]},{"value":"0041","title":"河南省","cities":[{"value":"4101","title":"郑州"},{"value":"4102","title":"安阳"},{"value":"4103","title":"焦作"},{"value":"4104","title":"鹤壁"},{"value":"4105","title":"开封"},{"value":"4106","title":"洛阳"},{"value":"4107","title":"南阳"},{"value":"4108","title":"平顶山"},{"value":"4109","title":"三门峡"},{"value":"4110","title":"商丘"},{"value":"4111","title":"新乡"},{"value":"4112","title":"信阳"},{"value":"4113","title":"许昌"},{"value":"4114","title":"周口"},{"value":"4115","title":"驻马店"},{"value":"4116","title":"漯河"},{"value":"4117","title":"濮阳"},{"value":"4118","title":"济源"}]},{"value":"0042","title":"湖北省","cities":[{"value":"4201","title":"武汉"},{"value":"4202","title":"鄂州"},{"value":"4203","title":"恩施"},{"value":"4204","title":"黄冈"},{"value":"4205","title":"黄石"},{"value":"4206","title":"荆门"},{"value":"4207","title":"荆州"},{"value":"4208","title":"十堰"},{"value":"4209","title":"随州"},{"value":"4210","title":"咸宁"},{"value":"4211","title":"襄樊"},{"value":"4212","title":"孝感"},{"value":"4213","title":"神农架"},{"value":"4214","title":"天门"},{"value":"4215","title":"宜昌"},{"value":"4216","title":"三峡"},{"value":"4217","title":"潜江"},{"value":"4218","title":"仙桃"}]},{"value":"0043","title":"湖南省","cities":[{"value":"4301","title":"长沙"},{"value":"4302","title":"常德"},{"value":"4303","title":"郴州"},{"value":"4304","title":"衡阳"},{"value":"4305","title":"怀化"},{"value":"4306","title":"娄底"},{"value":"4307","title":"邵阳"},{"value":"4308","title":"湘潭"},{"value":"4309","title":"湘西"},{"value":"4310","title":"益阳"},{"value":"4311","title":"永州"},{"value":"4312","title":"岳阳"},{"value":"4313","title":"张家界"},{"value":"4314","title":"株洲"},{"value":"4331","title":"吉首"}]},{"value":"0044","title":"广东省","cities":[{"value":"4401","title":"广州"},{"value":"4402","title":"深圳"},{"value":"4403","title":"潮州"},{"value":"4404","title":"东莞"},{"value":"4405","title":"佛山"},{"value":"4406","title":"惠州"},{"value":"4407","title":"江门"},{"value":"4408","title":"揭阳"},{"value":"4409","title":"茂名"},{"value":"4410","title":"梅州"},{"value":"4411","title":"清远"},{"value":"4412","title":"汕头"},{"value":"4413","title":"汕尾"},{"value":"4414","title":"韶关"},{"value":"4415","title":"阳江"},{"value":"4416","title":"云浮"},{"value":"4417","title":"湛江"},{"value":"4418","title":"肇庆"},{"value":"4419","title":"中山"},{"value":"4420","title":"河源"},{"value":"4421","title":"珠海"}]},{"value":"0045","title":"广西壮族自治区","cities":[{"value":"4501","title":"南宁"},{"value":"4502","title":"百色"},{"value":"4503","title":"北海"},{"value":"4504","title":"桂林"},{"value":"4505","title":"河池"},{"value":"4506","title":"柳州"},{"value":"4507","title":"梧州"},{"value":"4508","title":"玉林"},{"value":"4509","title":"崇左"},{"value":"4510","title":"防城港"},{"value":"4511","title":"贵港"},{"value":"4512","title":"贺州"},{"value":"4513","title":"来宾"},{"value":"4514","title":"钦州"}]},{"value":"0046","title":"海南省","cities":[{"value":"4601","title":"海口"},{"value":"4602","title":"三亚"},{"value":"4603","title":"白沙"},{"value":"4604","title":"保亭"},{"value":"4605","title":"昌江"},{"value":"4606","title":"澄迈"},{"value":"4607","title":"儋州"},{"value":"4608","title":"定安"},{"value":"4609","title":"东方"},{"value":"4610","title":"乐东"},{"value":"4611","title":"临高"},{"value":"4612","title":"陵水"},{"value":"4613","title":"琼海"},{"value":"4614","title":"琼中"},{"value":"4615","title":"屯昌"},{"value":"4616","title":"万宁"},{"value":"4617","title":"文昌"},{"value":"4618","title":"五指山"},{"value":"4619","title":"洋浦"}]},{"value":"0050","title":"重庆市","cities":[{"value":"5000","title":"重庆市"}]},{"value":"0051","title":"四川省","cities":[{"value":"5101","title":"成都"},{"value":"5102","title":"巴中"},{"value":"5103","title":"达州"},{"value":"5104","title":"德阳"},{"value":"5105","title":"广安"},{"value":"5106","title":"广元"},{"value":"5107","title":"乐山"},{"value":"5108","title":"凉山"},{"value":"5109","title":"眉山"},{"value":"5110","title":"绵阳"},{"value":"5111","title":"南充"},{"value":"5112","title":"内江"},{"value":"5113","title":"攀枝花"},{"value":"5114","title":"遂宁"},{"value":"5115","title":"雅安"},{"value":"5116","title":"宜宾"},{"value":"5117","title":"自贡"},{"value":"5118","title":"泸州"},{"value":"5119","title":"阿坝"},{"value":"5120","title":"甘孜"},{"value":"5121","title":"资阳"}]},{"value":"0052","title":"贵州省","cities":[{"value":"5201","title":"贵阳"},{"value":"5202","title":"安顺"},{"value":"5203","title":"毕节"},{"value":"5204","title":"六盘水"},{"value":"5205","title":"铜仁"},{"value":"5206","title":"遵义"},{"value":"5207","title":"黔东南"},{"value":"5208","title":"黔南"},{"value":"5209","title":"黔西南"}]},{"value":"0053","title":"云南省","cities":[{"value":"5301","title":"昆明"},{"value":"5302","title":"西双版纳"},{"value":"5303","title":"保山"},{"value":"5304","title":"楚雄"},{"value":"5305","title":"大理"},{"value":"5306","title":"德宏"},{"value":"5307","title":"红河"},{"value":"5308","title":"丽江"},{"value":"5309","title":"临沧"},{"value":"5310","title":"怒江"},{"value":"5311","title":"曲靖"},{"value":"5312","title":"思茅"},{"value":"5313","title":"文山"},{"value":"5314","title":"玉溪"},{"value":"5315","title":"昭通"},{"value":"5316","title":"中甸"},{"value":"5317","title":"迪庆州"}]},{"value":"0054","title":"西藏自治区","cities":[{"value":"5401","title":"拉萨"},{"value":"5402","title":"阿里"},{"value":"5403","title":"昌都"},{"value":"5404","title":"林芝"},{"value":"5405","title":"那曲"},{"value":"5406","title":"日喀则"},{"value":"5407","title":"山南"},{"value":"5424","title":"樟木口岸"}]},{"value":"0061","title":"陕西省","cities":[{"value":"6101","title":"西安"},{"value":"6102","title":"安康"},{"value":"6103","title":"宝鸡"},{"value":"6104","title":"汉中"},{"value":"6105","title":"商洛"},{"value":"6106","title":"铜川"},{"value":"6107","title":"渭南"},{"value":"6108","title":"咸阳"},{"value":"6109","title":"延安"},{"value":"6110","title":"榆林"}]},{"value":"0062","title":"甘肃省","cities":[{"value":"6201","title":"兰州"},{"value":"6202","title":"白银"},{"value":"6203","title":"定西"},{"value":"6204","title":"东风"},{"value":"6205","title":"合作"},{"value":"6206","title":"嘉峪关"},{"value":"6207","title":"金昌"},{"value":"6208","title":"酒泉"},{"value":"6209","title":"矿区"},{"value":"6210","title":"临夏"},{"value":"6211","title":"陇南"},{"value":"6212","title":"平凉"},{"value":"6213","title":"庆阳"},{"value":"6214","title":"天水"},{"value":"6215","title":"武威"},{"value":"6216","title":"张掖"},{"value":"6217","title":"甘南州"}]},{"value":"0063","title":"青海省","cities":[{"value":"6301","title":"西宁"},{"value":"6302","title":"海东"},{"value":"6322","title":"海北"},{"value":"6323","title":"黄南"},{"value":"6325","title":"海南"},{"value":"6326","title":"果洛"},{"value":"6327","title":"玉树"},{"value":"6328","title":"海西"}]},{"value":"0064","title":"宁夏回族自治区","cities":[{"value":"6401","title":"银川"},{"value":"6402","title":"中卫"},{"value":"6403","title":"固原"},{"value":"6404","title":"石嘴山"},{"value":"6405","title":"吴忠"}]},{"value":"0065","title":"新疆维吾尔自治区","cities":[{"value":"6501","title":"乌鲁木齐"},{"value":"6502","title":"阿克苏"},{"value":"6503","title":"阿勒泰"},{"value":"6504","title":"巴州"},{"value":"6505","title":"博州"},{"value":"6506","title":"昌吉"},{"value":"6507","title":"哈密"},{"value":"6508","title":"和田"},{"value":"6509","title":"喀什"},{"value":"6510","title":"克拉玛依"},{"value":"6511","title":"马兰"},{"value":"6512","title":"石河子"},{"value":"6513","title":"塔城"},{"value":"6514","title":"吐鲁番"},{"value":"6515","title":"伊犁"},{"value":"6516","title":"克州"},{"value":"6517","title":"阿拉尔"},{"value":"6518","title":"五家渠"}]},{"value":"2003","title":"台湾省","cities":[{"value":"9903","title":"台湾省"}]},{"value":"2001","title":"香港特别行政区","cities":[{"value":"9901","title":"香港特别行政区"}]},{"value":"2002","title":"澳门特别行政区","cities":[{"value":"9902","title":"澳门特别行政区"}]}]; |
| | | laydate.render({ |
| | | elem: '#socialCreditCodeExpires', |
| | | type: "date" |
| | | }); |
| | | laydate.render({ |
| | | elem: '#certIdExpires', |
| | | type: "date" |
| | | }); |
| | | $('#userType').change(function () { |
| | | let userType = $(this).val(); |
| | | if(userType == 0){ |
| | | $('.qy').hide(); |
| | | $('#bankAcctType').html('<option value="2">对私</option>') |
| | | $('#merchantIDCode').parent('div').siblings('label').text('*身份证号') |
| | | $('#merchantName').parent('div').siblings('label').text('*姓名') |
| | | }else{ |
| | | $('.qy').show(); |
| | | $('#bankAcctType').html('<option value="1">对公</option>') |
| | | $('#merchantIDCode').parent('div').siblings('label').text('*法人身份证号') |
| | | $('#merchantName').parent('div').siblings('label').text('*公司名称') |
| | | } |
| | | }) |
| | | |
| | | |
| | | function initCity(id) { |
| | | let city = ""; |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | city += '<option value="' + p.value + '">' + p.title+ '</option>' |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | function initArea(e, id) { |
| | | let city = ""; |
| | | let cityCode = $(e).val(); |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | if(p.value == cityCode){ |
| | | let a = p.cities; |
| | | for(let j in a){ |
| | | city += '<option value="' + a[j].value + '">' + a[j].title+ '</option>' |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | |
| | | $('#fileNoBtnId').click(function () { |
| | | $('#file').click(); |
| | | }) |
| | | |
| | | $('#file').change(function () { |
| | | var formData = new FormData(); |
| | | formData.append('file', $('#file')[0].files[0]) |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/uploadFile", |
| | | type : "POST", |
| | | data : formData, |
| | | contentType : false, |
| | | processData : false, |
| | | success : function(data) { |
| | | if("" == data){ |
| | | Feng.error("上传失败"); |
| | | }else{ |
| | | $('#fileNo').val(data); |
| | | $('#file').val(''); |
| | | Feng.success("上传成功!"); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("上传失败"); |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | function withdrawCash(){ |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/withdrawCash", |
| | | type : "POST", |
| | | success : function(data) { |
| | | if(data.code == 200){ |
| | | Feng.success("提现成功!"); |
| | | document.location.reload(); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("提现失败"); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | function accountRecharge(){ |
| | | let amount = $('#amount').val(); |
| | | if(null == amount || '' == amount || 0 >= amount){ |
| | | Feng.error("请填入有效的充值金额"); |
| | | return |
| | | } |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/accountRecharge", |
| | | type : "POST", |
| | | data: { |
| | | amount: amount |
| | | }, |
| | | success : function(data) { |
| | | if(data.code == 200){ |
| | | const str = '<div class="row">\n' + |
| | | ' <div class="form-group" style="height: 50px;">\n' + |
| | | ' <div class="col-sm-8">\n' + |
| | | ' <div id="canvas"></div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: '支付宝收款二维码' |
| | | ,area: ['343px', '386px'] |
| | | ,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset |
| | | ,id: 'layerDemo' //防止重复弹出 |
| | | ,content: '<div style="padding: 20px">' + str + '</div>' |
| | | ,btnAlign: 'c' //按钮居中 |
| | | ,shade: 0.5 //不显示遮罩 |
| | | }); |
| | | $("#canvas").qrcode({ |
| | | render: "canvas", //设置渲染方式:table和canvas,使用canvas方式性能相对来说比较好. |
| | | width: 300, //默认宽度 |
| | | height: 300, //默认高度 |
| | | typeNumber: -1, //计算模式一般默认为-1 |
| | | correctLevel: 2, //二维码纠错级别 |
| | | background: "#ffffff", //背景颜色 |
| | | foreground: "#000000", //二维码颜色 |
| | | text: data.data, //二维码内容:可以直接填一个网址 |
| | | }); |
| | | }else{ |
| | | Feng.error(data.msg); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("提现失败"); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | $(function () { |
| | | initCity('provCodeBank'); |
| | | initCity('provCodeEnterprise'); |
| | | |
| | | $('#provCodeBank').val($('#provCodeBank1').val()); |
| | | initArea($('#provCodeBank'), 'areaCodeBank'); |
| | | $('#areaCodeBank').val($('#areaCodeBank1').val()); |
| | | |
| | | $('#provCodeEnterprise').val($('#provCodeEnterprise1').val()); |
| | | initArea($('#provCodeEnterprise'), 'areaCodeEnterprise'); |
| | | $('#areaCodeEnterprise').val($('#areaCodeEnterprise1').val()); |
| | | |
| | | $('#userType').change(); |
| | | }) |
| | | </script> |
| | | @} |
| | |
| | | <label class="col-sm-1" style="width: 20px;">省:</label> |
| | | <select class="input-group col-sm-2 " onclick="TAgent.areaProvince()" id="province" style="width: 200px;height: 33px" name="province"> |
| | | <option value="">请选择</option> |
| | | @for(i in province){ |
| | | <option id="${i.id}" value="${i.name}"${i.name == provinceName ? 'selected=selected' : ''}>${i.name}</option> |
| | | @for(i in provinceList){ |
| | | <option id="${i.id}" value="${i.id}"${i.name == provinceName ? 'selected=selected' : ''}>${i.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | |
| | | <select class="input-group col-sm-2" id="city" style="width: 200px;height: 33px" name="city"> |
| | | <option value="">请选择</option> |
| | | @for(city in cityList){ |
| | | <option id="${city.id}" value="${city.name}"${city.name == cityName ? 'selected=selected' : ''}>${city.name}</option> |
| | | <option id="${city.id}" value="${city.id}"${city.name == cityName ? 'selected=selected' : ''}>${city.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal"> |
| | | |
| | | <div class="row" id="tAgentInfoForm"> |
| | | <div class="col-sm-12" style="text-align: center"> |
| | | <input hidden id="areaId" value="areaId"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: center"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >负责人姓名:</label> |
| | | <input id="principal" name="principal" type="text" maxlength="20" placeholder="请输入" style="height: 30px" required> |
| | | <div class="form-horizontal" id="tAgentInfoForm"> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 代理商信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*负责人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principal" name="principal" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >联系电话:</label> |
| | | <input id="principalPhone" name="principalPhone" maxlength="11" type="number" placeholder="请输入" style="height: 30px" required> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*联系电话:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="principalPhone" name="principalPhone" maxlength="11" type="number" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <label class="control-label" >邮箱:</label> |
| | | <input id="email" name="email" type="email" maxlength="40" placeholder="请输入" style="height: 30px"> |
| | | <div class="form-group"> |
| | | <input id="areaId" type="hidden"> |
| | | <label class="col-sm-3 control-label">*代理区域:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="area" onclick="TAgent.area()" name="area" placeholder="请选择" readonly> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >代理区域:</label> |
| | | <input id="area" onclick="TAgent.area()" name="area" placeholder="请选择" style="height: 30px" readonly required> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*邮箱:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="email" name="email" type="email" maxlength="40" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <label class="control-label" >开户银行:</label> |
| | | <input id="bankDeposit" name="bankDeposit" type="text" maxlength="20" placeholder="请输入" style="height: 30px"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*登录账号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="account" name="account" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <label class="control-label" >银行账户:</label> |
| | | <input id="bankAccount" name="bankAccount" type="number" maxlength="20" placeholder="请输入" style="height: 30px"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*登录密码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="password" name="password" type="password" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="initialLevel col-sm-12 control-label form-group">--> |
| | | <!-- <div class="initialLevel col-sm-6 control-label form-group" >--> |
| | | <!-- <label class="control-label" >客服电话:</label>--> |
| | | <!-- <input id="serviceCalls" name="serviceCalls" type="number" maxlength="20" placeholder="请输入" style="height: 30px">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >登录账号:</label> |
| | | <input id="account" name="account" type="text" maxlength="20" placeholder="请输入" style="height: 30px"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*确认密码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="rePassword" name="rePassword" type="password" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >登录密码:</label> |
| | | <input id="password" name="password" type="password" maxlength="20" placeholder="请输入密码" style="height: 30px"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-6 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >确认密码:</label> |
| | | <input id="rePassword" name="rePassword" type="password" maxlength="20" placeholder="请输入确认密码" style="height: 30px"> |
| | | <div class="row"> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | 商户信息 |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*商户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="userType"> |
| | | <option value="0">小微商户</option> |
| | | <option value="1">个体工商户</option> |
| | | <option value="2">企业</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantName" name="merchantName" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*经营范围:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="businessScope" name="businessScope" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用码:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCode" name="socialCreditCode" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*统一社会信用证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="socialCreditCodeExpires" name="socialCreditCodeExpires" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeEnterprise" name="provCodeEnterprise" onchange="initArea(this, 'areaCodeEnterprise')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeEnterprise" name="areaCodeEnterprise"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*企业详细地址:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="address" name="address" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardName" name="cardName" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*结算账户号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="cardNo" name="cardNo" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行账户类型:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankAcctType"> |
| | | <option value="2">对私</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-6"> |
| | | <div class="form-group"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人姓名:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPerson" name="legalPerson" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*身份证号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="merchantIDCode" name="merchantIDCode" type="text" maxlength="20" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人身份证有效期:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="certIdExpires" name="certIdExpires"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*法人手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="legalPhone" name="legalPhone" type="text" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">营业执照扫描件:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="fileNo" name="fileNo" value="" readonly style="height: 100%;width: 100%;border: none;"/> |
| | | </div> |
| | | <div class="col-sm-2"> |
| | | <button class="form-control" id="fileNoBtnId">上传</button> |
| | | </div> |
| | | <input type="file" id="file" style="display: none;"> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*银行名称:</label> |
| | | <div class="col-sm-9"> |
| | | <select class="form-control" id="bankCode" name="bankCode"> |
| | | <option value="01020000">工商银行</option> |
| | | <option value="01030000">农业银行</option> |
| | | <option value="01040000">中国银行</option> |
| | | <option value="01050000">建设银行</option> |
| | | <option value="03010000">交通银行</option> |
| | | <option value="03134402">平安银行</option> |
| | | <option value="03020000">中信银行</option> |
| | | <option value="03030000">光大银行</option> |
| | | <option value="03040000">华夏银行</option> |
| | | <option value="03050000">民生银行</option> |
| | | <option value="03060000">广发银行</option> |
| | | <option value="03080000">招商银行</option> |
| | | <option value="03090000">兴业银行</option> |
| | | <option value="03100000">浦发银行</option> |
| | | <option value="03130011">北京银行</option> |
| | | <option value="03130012">天津银行</option> |
| | | <option value="03130031">上海银行</option> |
| | | <option value="03130032">江苏银行</option> |
| | | <option value="03130050">重庆银行</option> |
| | | <option value="03132102">大连银行</option> |
| | | <option value="03132301">哈尔滨银行</option> |
| | | <option value="03133201">南京银行</option> |
| | | <option value="03133301">杭州银行</option> |
| | | <option value="03133302">宁波银行</option> |
| | | <option value="03133308">温州银行</option> |
| | | <option value="03150000">恒丰银行</option> |
| | | <option value="03160000">浙商银行</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group qy"> |
| | | <label class="col-sm-3 control-label">*开户行地区:</label> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="provCodeBank" name="provCodeBank" onchange="initArea(this, 'areaCodeBank')"></select> |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | <select class="form-control" id="areaCodeBank" name="areaCodeBank"></select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*银行预留手机号:</label> |
| | | <div class="col-sm-9"> |
| | | <input class="form-control" id="phone" name="phone" type="number" maxlength="11" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*注册状态:</label> |
| | | <div class="col-sm-4"> |
| | | 商户开户状态: |
| | | </div> |
| | | <div class="col-sm-4"> |
| | | 结算账户绑定状态: |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TAgentInfoDlg.close()"/> |
| | |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tAgent/tAgent.js"></script> |
| | | <script type="text/javascript"> |
| | | var citys = [{"value":"0011","title":"北京市","cities":[{"value":"1100","title":"北京市"}]},{"value":"0012","title":"天津市","cities":[{"value":"1200","title":"天津市"}]},{"value":"0013","title":"河北省","cities":[{"value":"1301","title":"石家庄"},{"value":"1302","title":"保定"},{"value":"1303","title":"沧州"},{"value":"1304","title":"承德"},{"value":"1305","title":"邯郸"},{"value":"1306","title":"衡水"},{"value":"1307","title":"廊坊"},{"value":"1308","title":"秦皇岛"},{"value":"1309","title":"唐山"},{"value":"1310","title":"邢台"},{"value":"1311","title":"张家口"}]},{"value":"0014","title":"山西省","cities":[{"value":"1401","title":"太原"},{"value":"1402","title":"长治"},{"value":"1403","title":"大同"},{"value":"1404","title":"晋城"},{"value":"1405","title":"离石"},{"value":"1406","title":"临汾"},{"value":"1407","title":"朔州"},{"value":"1408","title":"忻州"},{"value":"1409","title":"阳泉"},{"value":"1410","title":"榆次"},{"value":"1411","title":"运城"},{"value":"1412","title":"晋中"},{"value":"1413","title":"吕梁"}]},{"value":"0015","title":"内蒙古自治区","cities":[{"value":"1501","title":"呼和浩特"},{"value":"1502","title":"包头"},{"value":"1503","title":"阿拉善"},{"value":"1504","title":"巴彦淖尔"},{"value":"1505","title":"赤峰"},{"value":"1506","title":"呼伦贝尔"},{"value":"1507","title":"乌海"},{"value":"1508","title":"乌兰察布"},{"value":"1509","title":"锡林郭勒"},{"value":"1510","title":"兴安"},{"value":"1511","title":"鄂尔多斯"},{"value":"1512","title":"通辽"},{"value":"1513","title":"满洲里"}]},{"value":"0021","title":"辽宁省","cities":[{"value":"2101","title":"沈阳"},{"value":"2102","title":"大连"},{"value":"2103","title":"鞍山"},{"value":"2104","title":"本溪"},{"value":"2105","title":"朝阳"},{"value":"2106","title":"丹东"},{"value":"2107","title":"抚顺"},{"value":"2108","title":"阜新"},{"value":"2109","title":"葫芦岛"},{"value":"2110","title":"锦州"},{"value":"2111","title":"辽阳"},{"value":"2112","title":"盘锦"},{"value":"2113","title":"铁岭"},{"value":"2114","title":"营口"}]},{"value":"0022","title":"吉林省","cities":[{"value":"2201","title":"长春"},{"value":"2202","title":"白城"},{"value":"2203","title":"白山"},{"value":"2204","title":"吉林"},{"value":"2205","title":"辽源"},{"value":"2206","title":"四平"},{"value":"2207","title":"松原"},{"value":"2208","title":"通化"},{"value":"2209","title":"延边"}]},{"value":"0023","title":"黑龙江省","cities":[{"value":"2301","title":"哈尔滨"},{"value":"2302","title":"大庆"},{"value":"2303","title":"大兴安岭"},{"value":"2304","title":"鹤岗"},{"value":"2305","title":"黑河"},{"value":"2306","title":"鸡西"},{"value":"2307","title":"佳木斯"},{"value":"2308","title":"牡丹江"},{"value":"2309","title":"七台河"},{"value":"2310","title":"齐齐哈尔"},{"value":"2311","title":"双鸭山"},{"value":"2312","title":"绥化"},{"value":"2313","title":"伊春"}]},{"value":"0031","title":"上海市","cities":[{"value":"3100","title":"上海市"}]},{"value":"0032","title":"江苏省","cities":[{"value":"3201","title":"南京"},{"value":"3202","title":"常州"},{"value":"3203","title":"淮安"},{"value":"3204","title":"连云港"},{"value":"3205","title":"南通"},{"value":"3206","title":"苏州"},{"value":"3207","title":"宿迁"},{"value":"3208","title":"泰州"},{"value":"3209","title":"无锡"},{"value":"3210","title":"徐州"},{"value":"3211","title":"盐城"},{"value":"3212","title":"扬州"},{"value":"3213","title":"镇江"},{"value":"3214","title":"胥浦"},{"value":"3215","title":"昆山"}]},{"value":"0033","title":"浙江省","cities":[{"value":"3301","title":"杭州"},{"value":"3302","title":"宁波"},{"value":"3303","title":"湖州"},{"value":"3304","title":"嘉兴"},{"value":"3305","title":"金华"},{"value":"3306","title":"绍兴"},{"value":"3307","title":"台州"},{"value":"3308","title":"温州"},{"value":"3309","title":"舟山"},{"value":"3310","title":"衢州"},{"value":"3311","title":"丽水"}]},{"value":"0034","title":"安徽省","cities":[{"value":"3401","title":"合肥"},{"value":"3402","title":"安庆"},{"value":"3403","title":"蚌埠"},{"value":"3404","title":"巢湖"},{"value":"3405","title":"池州"},{"value":"3406","title":"滁州"},{"value":"3407","title":"阜阳"},{"value":"3408","title":"淮北"},{"value":"3409","title":"淮南"},{"value":"3410","title":"黄山"},{"value":"3411","title":"六安"},{"value":"3412","title":"马鞍山"},{"value":"3414","title":"铜陵"},{"value":"3415","title":"芜湖"},{"value":"3416","title":"宣城"},{"value":"3417","title":"亳州"},{"value":"3418","title":"宿州"}]},{"value":"0035","title":"福建省","cities":[{"value":"3501","title":"福州"},{"value":"3502","title":"厦门"},{"value":"3503","title":"龙岩"},{"value":"3504","title":"南平"},{"value":"3505","title":"宁德"},{"value":"3506","title":"莆田"},{"value":"3507","title":"泉州"},{"value":"3508","title":"三明"},{"value":"3509","title":"漳州"}]},{"value":"0036","title":"江西省","cities":[{"value":"3601","title":"南昌"},{"value":"3602","title":"抚州"},{"value":"3603","title":"赣州"},{"value":"3604","title":"吉安"},{"value":"3605","title":"景德镇"},{"value":"3606","title":"九江"},{"value":"3607","title":"萍乡"},{"value":"3608","title":"上饶"},{"value":"3609","title":"新余"},{"value":"3610","title":"宜春"},{"value":"3611","title":"鹰潭"}]},{"value":"0037","title":"山东省","cities":[{"value":"3701","title":"济南"},{"value":"3702","title":"青岛"},{"value":"3703","title":"滨州"},{"value":"3704","title":"德州"},{"value":"3705","title":"东营"},{"value":"3706","title":"菏泽"},{"value":"3707","title":"济宁"},{"value":"3708","title":"莱芜"},{"value":"3709","title":"聊城"},{"value":"3710","title":"临沂"},{"value":"3711","title":"日照"},{"value":"3712","title":"泰安"},{"value":"3713","title":"威海"},{"value":"3714","title":"潍坊"},{"value":"3715","title":"烟台"},{"value":"3716","title":"枣庄"},{"value":"3717","title":"淄博"}]},{"value":"0041","title":"河南省","cities":[{"value":"4101","title":"郑州"},{"value":"4102","title":"安阳"},{"value":"4103","title":"焦作"},{"value":"4104","title":"鹤壁"},{"value":"4105","title":"开封"},{"value":"4106","title":"洛阳"},{"value":"4107","title":"南阳"},{"value":"4108","title":"平顶山"},{"value":"4109","title":"三门峡"},{"value":"4110","title":"商丘"},{"value":"4111","title":"新乡"},{"value":"4112","title":"信阳"},{"value":"4113","title":"许昌"},{"value":"4114","title":"周口"},{"value":"4115","title":"驻马店"},{"value":"4116","title":"漯河"},{"value":"4117","title":"濮阳"},{"value":"4118","title":"济源"}]},{"value":"0042","title":"湖北省","cities":[{"value":"4201","title":"武汉"},{"value":"4202","title":"鄂州"},{"value":"4203","title":"恩施"},{"value":"4204","title":"黄冈"},{"value":"4205","title":"黄石"},{"value":"4206","title":"荆门"},{"value":"4207","title":"荆州"},{"value":"4208","title":"十堰"},{"value":"4209","title":"随州"},{"value":"4210","title":"咸宁"},{"value":"4211","title":"襄樊"},{"value":"4212","title":"孝感"},{"value":"4213","title":"神农架"},{"value":"4214","title":"天门"},{"value":"4215","title":"宜昌"},{"value":"4216","title":"三峡"},{"value":"4217","title":"潜江"},{"value":"4218","title":"仙桃"}]},{"value":"0043","title":"湖南省","cities":[{"value":"4301","title":"长沙"},{"value":"4302","title":"常德"},{"value":"4303","title":"郴州"},{"value":"4304","title":"衡阳"},{"value":"4305","title":"怀化"},{"value":"4306","title":"娄底"},{"value":"4307","title":"邵阳"},{"value":"4308","title":"湘潭"},{"value":"4309","title":"湘西"},{"value":"4310","title":"益阳"},{"value":"4311","title":"永州"},{"value":"4312","title":"岳阳"},{"value":"4313","title":"张家界"},{"value":"4314","title":"株洲"},{"value":"4331","title":"吉首"}]},{"value":"0044","title":"广东省","cities":[{"value":"4401","title":"广州"},{"value":"4402","title":"深圳"},{"value":"4403","title":"潮州"},{"value":"4404","title":"东莞"},{"value":"4405","title":"佛山"},{"value":"4406","title":"惠州"},{"value":"4407","title":"江门"},{"value":"4408","title":"揭阳"},{"value":"4409","title":"茂名"},{"value":"4410","title":"梅州"},{"value":"4411","title":"清远"},{"value":"4412","title":"汕头"},{"value":"4413","title":"汕尾"},{"value":"4414","title":"韶关"},{"value":"4415","title":"阳江"},{"value":"4416","title":"云浮"},{"value":"4417","title":"湛江"},{"value":"4418","title":"肇庆"},{"value":"4419","title":"中山"},{"value":"4420","title":"河源"},{"value":"4421","title":"珠海"}]},{"value":"0045","title":"广西壮族自治区","cities":[{"value":"4501","title":"南宁"},{"value":"4502","title":"百色"},{"value":"4503","title":"北海"},{"value":"4504","title":"桂林"},{"value":"4505","title":"河池"},{"value":"4506","title":"柳州"},{"value":"4507","title":"梧州"},{"value":"4508","title":"玉林"},{"value":"4509","title":"崇左"},{"value":"4510","title":"防城港"},{"value":"4511","title":"贵港"},{"value":"4512","title":"贺州"},{"value":"4513","title":"来宾"},{"value":"4514","title":"钦州"}]},{"value":"0046","title":"海南省","cities":[{"value":"4601","title":"海口"},{"value":"4602","title":"三亚"},{"value":"4603","title":"白沙"},{"value":"4604","title":"保亭"},{"value":"4605","title":"昌江"},{"value":"4606","title":"澄迈"},{"value":"4607","title":"儋州"},{"value":"4608","title":"定安"},{"value":"4609","title":"东方"},{"value":"4610","title":"乐东"},{"value":"4611","title":"临高"},{"value":"4612","title":"陵水"},{"value":"4613","title":"琼海"},{"value":"4614","title":"琼中"},{"value":"4615","title":"屯昌"},{"value":"4616","title":"万宁"},{"value":"4617","title":"文昌"},{"value":"4618","title":"五指山"},{"value":"4619","title":"洋浦"}]},{"value":"0050","title":"重庆市","cities":[{"value":"5000","title":"重庆市"}]},{"value":"0051","title":"四川省","cities":[{"value":"5101","title":"成都"},{"value":"5102","title":"巴中"},{"value":"5103","title":"达州"},{"value":"5104","title":"德阳"},{"value":"5105","title":"广安"},{"value":"5106","title":"广元"},{"value":"5107","title":"乐山"},{"value":"5108","title":"凉山"},{"value":"5109","title":"眉山"},{"value":"5110","title":"绵阳"},{"value":"5111","title":"南充"},{"value":"5112","title":"内江"},{"value":"5113","title":"攀枝花"},{"value":"5114","title":"遂宁"},{"value":"5115","title":"雅安"},{"value":"5116","title":"宜宾"},{"value":"5117","title":"自贡"},{"value":"5118","title":"泸州"},{"value":"5119","title":"阿坝"},{"value":"5120","title":"甘孜"},{"value":"5121","title":"资阳"}]},{"value":"0052","title":"贵州省","cities":[{"value":"5201","title":"贵阳"},{"value":"5202","title":"安顺"},{"value":"5203","title":"毕节"},{"value":"5204","title":"六盘水"},{"value":"5205","title":"铜仁"},{"value":"5206","title":"遵义"},{"value":"5207","title":"黔东南"},{"value":"5208","title":"黔南"},{"value":"5209","title":"黔西南"}]},{"value":"0053","title":"云南省","cities":[{"value":"5301","title":"昆明"},{"value":"5302","title":"西双版纳"},{"value":"5303","title":"保山"},{"value":"5304","title":"楚雄"},{"value":"5305","title":"大理"},{"value":"5306","title":"德宏"},{"value":"5307","title":"红河"},{"value":"5308","title":"丽江"},{"value":"5309","title":"临沧"},{"value":"5310","title":"怒江"},{"value":"5311","title":"曲靖"},{"value":"5312","title":"思茅"},{"value":"5313","title":"文山"},{"value":"5314","title":"玉溪"},{"value":"5315","title":"昭通"},{"value":"5316","title":"中甸"},{"value":"5317","title":"迪庆州"}]},{"value":"0054","title":"西藏自治区","cities":[{"value":"5401","title":"拉萨"},{"value":"5402","title":"阿里"},{"value":"5403","title":"昌都"},{"value":"5404","title":"林芝"},{"value":"5405","title":"那曲"},{"value":"5406","title":"日喀则"},{"value":"5407","title":"山南"},{"value":"5424","title":"樟木口岸"}]},{"value":"0061","title":"陕西省","cities":[{"value":"6101","title":"西安"},{"value":"6102","title":"安康"},{"value":"6103","title":"宝鸡"},{"value":"6104","title":"汉中"},{"value":"6105","title":"商洛"},{"value":"6106","title":"铜川"},{"value":"6107","title":"渭南"},{"value":"6108","title":"咸阳"},{"value":"6109","title":"延安"},{"value":"6110","title":"榆林"}]},{"value":"0062","title":"甘肃省","cities":[{"value":"6201","title":"兰州"},{"value":"6202","title":"白银"},{"value":"6203","title":"定西"},{"value":"6204","title":"东风"},{"value":"6205","title":"合作"},{"value":"6206","title":"嘉峪关"},{"value":"6207","title":"金昌"},{"value":"6208","title":"酒泉"},{"value":"6209","title":"矿区"},{"value":"6210","title":"临夏"},{"value":"6211","title":"陇南"},{"value":"6212","title":"平凉"},{"value":"6213","title":"庆阳"},{"value":"6214","title":"天水"},{"value":"6215","title":"武威"},{"value":"6216","title":"张掖"},{"value":"6217","title":"甘南州"}]},{"value":"0063","title":"青海省","cities":[{"value":"6301","title":"西宁"},{"value":"6302","title":"海东"},{"value":"6322","title":"海北"},{"value":"6323","title":"黄南"},{"value":"6325","title":"海南"},{"value":"6326","title":"果洛"},{"value":"6327","title":"玉树"},{"value":"6328","title":"海西"}]},{"value":"0064","title":"宁夏回族自治区","cities":[{"value":"6401","title":"银川"},{"value":"6402","title":"中卫"},{"value":"6403","title":"固原"},{"value":"6404","title":"石嘴山"},{"value":"6405","title":"吴忠"}]},{"value":"0065","title":"新疆维吾尔自治区","cities":[{"value":"6501","title":"乌鲁木齐"},{"value":"6502","title":"阿克苏"},{"value":"6503","title":"阿勒泰"},{"value":"6504","title":"巴州"},{"value":"6505","title":"博州"},{"value":"6506","title":"昌吉"},{"value":"6507","title":"哈密"},{"value":"6508","title":"和田"},{"value":"6509","title":"喀什"},{"value":"6510","title":"克拉玛依"},{"value":"6511","title":"马兰"},{"value":"6512","title":"石河子"},{"value":"6513","title":"塔城"},{"value":"6514","title":"吐鲁番"},{"value":"6515","title":"伊犁"},{"value":"6516","title":"克州"},{"value":"6517","title":"阿拉尔"},{"value":"6518","title":"五家渠"}]},{"value":"2003","title":"台湾省","cities":[{"value":"9903","title":"台湾省"}]},{"value":"2001","title":"香港特别行政区","cities":[{"value":"9901","title":"香港特别行政区"}]},{"value":"2002","title":"澳门特别行政区","cities":[{"value":"9902","title":"澳门特别行政区"}]}]; |
| | | laydate.render({ |
| | | elem: '#socialCreditCodeExpires', |
| | | type: "date" |
| | | }); |
| | | laydate.render({ |
| | | elem: '#certIdExpires', |
| | | type: "date" |
| | | }); |
| | | $('.qy').hide(); |
| | | $('#userType').change(function () { |
| | | let userType = $(this).val(); |
| | | if(userType == 0){ |
| | | $('.qy').hide(); |
| | | $('#bankAcctType').html('<option value="2">对私</option>') |
| | | $('#merchantIDCode').parent('div').siblings('label').text('*身份证号') |
| | | $('#merchantName').parent('div').siblings('label').text('*姓名') |
| | | }else{ |
| | | $('.qy').show(); |
| | | $('#bankAcctType').html('<option value="1">对公</option>') |
| | | $('#merchantIDCode').parent('div').siblings('label').text('*法人身份证号') |
| | | $('#merchantName').parent('div').siblings('label').text('*公司名称') |
| | | } |
| | | }) |
| | | |
| | | function initCity(id) { |
| | | let city = ""; |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | city += '<option value="' + p.value + '">' + p.title+ '</option>' |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | function initArea(e, id) { |
| | | let city = ""; |
| | | let cityCode = $(e).val(); |
| | | for(let i in citys){ |
| | | let p = citys[i]; |
| | | if(p.value == cityCode){ |
| | | let a = p.cities; |
| | | for(let j in a){ |
| | | city += '<option value="' + a[j].value + '">' + a[j].title+ '</option>' |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | $('#' + id).html(city); |
| | | } |
| | | |
| | | |
| | | $('#fileNoBtnId').click(function () { |
| | | $('#file').click(); |
| | | }) |
| | | |
| | | $('#file').change(function () { |
| | | var formData = new FormData(); |
| | | formData.append('file', $('#file')[0].files[0]) |
| | | $.ajax({ |
| | | url : Feng.ctxPath + "/tAgent/uploadFile", |
| | | type : "POST", |
| | | data : formData, |
| | | contentType : false, |
| | | processData : false, |
| | | success : function(data) { |
| | | if("" == data){ |
| | | Feng.error("上传失败"); |
| | | }else{ |
| | | $('#fileNo').val(data); |
| | | $('#file').val(''); |
| | | Feng.success("上传成功!"); |
| | | } |
| | | }, |
| | | error : function() { |
| | | Feng.error("上传失败"); |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | |
| | | $(function () { |
| | | initCity('provCodeBank'); |
| | | initCity('provCodeEnterprise'); |
| | | }) |
| | | </script> |
| | | @} |
| | |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >登录账号:</label> |
| | | <input id="account" name="account" type="text" maxlength="20" placeholder="请输入" style="height: 30px"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >登录密码:</label> |
| | | <input id="password" name="password" type="password" maxlength="20" placeholder="请输入密码" style="height: 30px"> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group"> |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >确认密码:</label> |
| | | <input id="rePassword" name="rePassword" type="password" maxlength="20" placeholder="请输入确认密码" style="height: 30px"> |
| | | </div> |
| | |
| | | <div class="initialLevel col-sm-12 control-label form-group" id="coupon1" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label">优惠券限制数量:</label> |
| | | <input id="couponCount" name="couponCount1" type="number" min="0" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponCount" name="couponCount1" type="number" min="0" maxlength="12" placeholder="最多12位数字" style="height: 30px" required> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">优惠券限制数量:</label> |
| | | <input id="couponCount" name="couponCount2" type="number" min="1" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponCount" name="couponCount2" type="number" min="1" placeholder="请输入优惠券限制数量" style="height: 30px" required> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">条件金额:订单满</label> |
| | | <input id="couponConditionalAmount" name="couponConditionalAmount" type="number" min="14" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponConditionalAmount" name="couponConditionalAmount" type="number" min="14" maxlength="12" placeholder="最多12位数字" style="height: 30px" required> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > |
| | | <label>可使用</label> |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">优惠金额:</label> |
| | | <input id="couponPreferentialAmount" name="couponPreferentialAmount" type="number" min="1" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponPreferentialAmount" name="couponPreferentialAmount" type="number" min="1" maxlength="12" placeholder="最多12位数字" style="height: 30px" required> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">有效期:</label> |
| | | <input id="couponValidity" name="couponValidity" type="number" min="1" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponValidity" name="couponValidity" type="number" min="1" maxlength="12" placeholder="最多12位数字" style="height: 30px" required> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > |
| | | <label>天</label> |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">优惠券总量:</label> |
| | | <input id="remainingQuantity" name="remainingQuantity" min="1" type="number" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="remainingQuantity" name="remainingQuantity" min="1" type="number" maxlength="12" placeholder="最多12位数字" style="height: 30px" required> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label">赠送数量:</label> |
| | | <input id="couponSendQuantity" name="couponSendQuantity" min="1" type="number" maxlength="4" placeholder="最多4位数字" style="height: 30px" required> |
| | | <input id="couponSendQuantity" name="couponSendQuantity" min="1" type="number" placeholder="请输入赠送数量" style="height: 30px" required> |
| | | </div> |
| | | <div class="initialLevel col-sm-3 control-label form-group" style="text-align: left" > |
| | | <label>张</label> |
| | |
| | | <script src="${ctxPath}/static/modular/system/tCoupon/tCoupon_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tCoupon/tCoupon.js"></script> |
| | | <script type="text/javascript"> |
| | | $(function () { |
| | | $("#coupon1").show() |
| | | $("#coupon2").hide() |
| | | }); |
| | | //监听下拉菜单的变动操作 |
| | | $("#couponType").change(function(){ |
| | | if(this.value == 1){ |
| | |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >驾驶证初次领证时间:</label> |
| | | <input id="firstCertificateTime" name="firstCertificateTime" type="text" placeholder="请选择时间" style="height: 30px"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span style="color:red">*</span> |
| | | <label class="control-label" >驾驶证:</label> |
| | | <#uploadImg id="driverLicense"/> |
| | |
| | | <script src="${ctxPath}/static/modular/system/tDriver/tDriver_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tDriver/tDriver.js"></script> |
| | | <script type="text/javascript"> |
| | | |
| | | laydate.render({ |
| | | elem: '#firstCertificateTime', |
| | | type: 'date', |
| | | range: false, |
| | | max: Date.now() |
| | | }); |
| | | |
| | | $(function () { |
| | | var idCardPositive = new $WebUpload("idcardFront"); |
| | | idCardPositive.setUploadBarId("progressBar"); |
| | |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >驾驶证初次领证时间:</label> |
| | | <input id="firstCertificateTime" name="firstCertificateTime" value="${item.firstCertificateTimeStr}" type="text" style="height: 30px" disabled> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <!-- <div class="initialLevel col-sm-3 control-label form-group" >--> |
| | | <!-- <span style="color:red">*</span>--> |
| | | <!-- <label class="control-label" >驾驶证:</label>--> |
| | |
| | | <script src="${ctxPath}/static/modular/system/tDriver/tDriver_info.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tDriver/tDriver.js"></script> |
| | | <script type="text/javascript"> |
| | | |
| | | laydate.render({ |
| | | elem: '#firstCertificateTime', |
| | | type: 'date', |
| | | range: false, |
| | | max: Date.now() |
| | | }); |
| | | |
| | | $(function () { |
| | | if('' == $("#inviterName").val()){ |
| | | $("#inviterName").val('') |
| | |
| | | @if(shiro.hasPermission("/tOrder/export")){ |
| | | <#button name="导出" icon="" clickFun="TOrder.export()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tOrder/cancelOrderUpdate")){ |
| | | <#button name="关闭订单" icon="" clickFun="TOrder.cancelOrderUpdate()"/> |
| | | @} |
| | | </div> |
| | | <div class="hidden-xs" id="TOrderTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/tOrder/add")){ |
| | |
| | | <input hidden id="startLat" value="${startLat}"> |
| | | <input hidden id="endLng" value="${endLng}"> |
| | | <input hidden id="endLat" value="${endLat}"> |
| | | <input hidden id="id" value="${id}"> |
| | | |
| | | <hr/> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | |
| | | @if(havDiscount == 1){ |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label" >9折优惠:</label> |
| | | <label class="control-label" >95折优惠:</label> |
| | | <label>${multiply}</label> |
| | | <label>元</label> |
| | | </div> |
| | | </div> |
| | | @} |
| | | |
| | | @if(startLng != null){ |
| | | <hr/> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div style="background-color: gray;height: 35px;line-height: 35px"> |
| | | <label style="color: #0C0C0C">行程轨迹</label> |
| | | <div class="row" style="margin-top: 30px;"> |
| | | <div class="col-sm-4"> |
| | | <h2 class="h3Class" style="font-weight: 700;">线路轨迹</h2> |
| | | </div> |
| | | </div> |
| | | <hr/> |
| | | <div class="row"> |
| | | <div class="col-sm-10"> |
| | | <div class="form-horizontal" id="container" style="margin-left: 50px;width: 100%; height: 500px;"></div> |
| | | <div class="input-card" style="margin-left: 50px;"> |
| | | <h4>轨迹回放控制</h4> |
| | | <div class="input-item"> |
| | | <input type="button" class="btn" value="开始动画" id="start" onclick="startAnimation()"/> |
| | | <input type="button" class="btn" value="暂停动画" id="pause" onclick="pauseAnimation()"/> |
| | | <input type="button" class="btn" value="继续动画" id="resume" onclick="resumeAnimation()"/> |
| | | <input type="button" class="btn" value="停止动画" id="stop" onclick="stopAnimation()"/> |
| | | </div> |
| | | <div class="input-item"> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div id="container" ></div> |
| | | <div id="panel" ></div> |
| | | </div> |
| | | @} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <hr/> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | |
| | | </div> |
| | | <hr/> |
| | | |
| | | @if(routeRecord != null){ |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <audio id="audio" autoplay controls muted> |
| | | <!-- <source src="http://www.w3capi.com/upload/audio/audio_example.mp3" type="audio/mpeg">--> |
| | | <source src="${routeRecord}" type="audio/mpeg"> |
| | | </audio> |
| | | </div> |
| | | @} |
| | | |
| | | |
| | | <div class="hidden-xs" id="TDriverTableToolbar" role="group" style="text-align: center"> |
| | | <#button name="取消" icon="fa-plus" clickFun="TOrderInfoDlg.close()" /> |
| | |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tOrder/tOrder.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tOrder/tOrder_info.js"></script> |
| | | |
| | | <!--<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=1d43098bcd98ab124623e7e4bcc9595e&plugin=AMap.Driving"></script>--> |
| | | <!--<script type="text/javascript" src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>--> |
| | | <!--<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>--> |
| | | <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script> |
| | | <script src="https://webapi.amap.com/maps?v=1.4.15&key=1d43098bcd98ab124623e7e4bcc9595e"></script> |
| | | <script src="https://cache.amap.com/lbs/static/addToolbar.js"></script> |
| | | <script src="https://webapi.amap.com/loader.js"></script> |
| | | |
| | | <style type="text/css"> |
| | |
| | | type: 'date', |
| | | range: true |
| | | }); |
| | | if(null != $('#startLng').val() && '' != $('#startLng').val()){ |
| | | AMapLoader.reset() // 需要把这个reset一下 |
| | | AMapLoader.load({ |
| | | "key": "1d43098bcd98ab124623e7e4bcc9595e", // 申请好的Web端开发者Key,首次调用 load 时必填 |
| | | "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 |
| | | "plugins": ['AMap.Driving'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等 |
| | | "AMapUI": { // 是否加载 AMapUI,缺省不加载 |
| | | "version": '1.1', // AMapUI 版本 |
| | | "plugins":['overlay/SimpleMarker'], // 需要加载的 AMapUI ui插件 |
| | | }, |
| | | "Loca":{ // 是否加载 Loca, 缺省不加载 |
| | | "version": '2.0' // Loca 版本 |
| | | }, |
| | | }).then((AMap)=>{ |
| | | //初始化地图对象,加载地图 |
| | | var map = new AMap.Map('container', { |
| | | viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', |
| | | zoom:13, //初始化地图层级 |
| | | center: [$('#startLng').val(), $('#startLat').val()] //初始化地图中心点 |
| | | var map = new AMap.Map("container", { |
| | | resizeEnable: true, |
| | | zoom: 14 |
| | | }); |
| | | //构造路线导航类 |
| | | var driving = new AMap.Driving({ |
| | | map: map, |
| | | |
| | | $(function() { |
| | | getTrajectory(); |
| | | }); |
| | | // 根据起终点经纬度规划驾车导航路线 |
| | | driving.search(new AMap.LngLat($('#startLng').val(), $('#startLat').val()), new AMap.LngLat($('#endLng').val(), $('#endLat').val()), function(status, result) { |
| | | // result 即是对应的驾车导航信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult |
| | | if (status === 'complete') { |
| | | Feng.success('绘制订单路线完成') |
| | | function getTrajectory() { |
| | | $.ajax({ |
| | | url: Feng.ctxPath + '/tOrder/getOrderTrack', |
| | | type: 'POST', |
| | | data:{ |
| | | orderDetailId: $("#id").val() |
| | | }, |
| | | success: function (res) { |
| | | if(res.status == 200){ |
| | | var data = res.data; |
| | | if(data.length > 0){ |
| | | orderTrack(data); |
| | | }/*else{ |
| | | Feng.error("当前订单没有轨迹"); |
| | | }*/ |
| | | } else { |
| | | Feng.error('获取驾车数据失败:' + result) |
| | | Feng.error(res.msg); |
| | | } |
| | | } |
| | | }); |
| | | }).catch((e)=>{ |
| | | console.error(e); //加载错误提示 |
| | | } |
| | | |
| | | var marker, lineArr = []; |
| | | |
| | | function orderTrack(data) { |
| | | for(var i in data){ |
| | | var waypoints = []; |
| | | var lon = parseFloat(data[i].lon); |
| | | var lat = parseFloat(data[i].lat); |
| | | waypoints.push(lon); |
| | | waypoints.push(lat); |
| | | lineArr.push(waypoints); |
| | | } |
| | | |
| | | marker = new AMap.Marker({ |
| | | map: map, |
| | | position: lineArr[0], |
| | | icon: "https://webapi.amap.com/images/car.png", |
| | | offset: new AMap.Pixel(-26, -13), |
| | | autoRotation: true, |
| | | angle:-90, |
| | | }); |
| | | }else { |
| | | Feng.info('该订单未完成,无地图路线显示!') |
| | | |
| | | // 绘制轨迹 |
| | | var polyline = new AMap.Polyline({ |
| | | map: map, |
| | | path: lineArr, |
| | | showDir:true, |
| | | strokeColor: "#28F", //线颜色 |
| | | // strokeOpacity: 1, //线透明度 |
| | | strokeWeight: 6, //线宽 |
| | | // strokeStyle: "solid" //线样式 |
| | | }); |
| | | |
| | | var passedPolyline = new AMap.Polyline({ |
| | | map: map, |
| | | // path: lineArr, |
| | | strokeColor: "#AF5", //线颜色 |
| | | // strokeOpacity: 1, //线透明度 |
| | | strokeWeight: 6, //线宽 |
| | | // strokeStyle: "solid" //线样式 |
| | | }); |
| | | |
| | | |
| | | marker.on('moving', function (e) { |
| | | passedPolyline.setPath(e.passedPath); |
| | | }); |
| | | |
| | | map.setFitView(); |
| | | } |
| | | |
| | | |
| | | function startAnimation () { |
| | | marker.moveAlong(lineArr, 200); |
| | | } |
| | | |
| | | function pauseAnimation () { |
| | | marker.pauseMove(); |
| | | } |
| | | |
| | | function resumeAnimation () { |
| | | marker.resumeMove(); |
| | | } |
| | | |
| | | function stopAnimation () { |
| | | marker.stopMove(); |
| | | } |
| | | |
| | | |
| | |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <span class="control-label" >余额充值满</span> |
| | | <input class="control-label" id="num2" name="num2" value="${num2}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元,获得9折优惠权限</span> |
| | | <span class="control-label" >元,获得95折优惠权限</span> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <!--<div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <span class="control-label" >司机邀请1名用户,下单后完成订单后获得</span> |
| | | <input class="control-label" id="num1" name="num1" value="${num1}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单</span> |
| | | </div> |
| | | </div>--> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <span class="control-label" >司机A邀请1名司机B,完成有效单后获得</span> |
| | | <input class="control-label" id="num1" name="num1" value="${num1}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <input class="control-label" id="num2" name="num2" value="${num2}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单</span> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <span class="control-label" >司机B邀请1名司机C,完成有效单后B获得</span> |
| | | <input class="control-label" id="num2" name="num2" value="${num2}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单 司机A获得</span> |
| | | <input class="control-label" id="num3" name="num3" value="${num3}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单 司机A获得</span> |
| | | <input class="control-label" id="num4" name="num4" value="${num4}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单</span> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <span class="control-label" >司机C邀请1名司机D,完成有效单后C获得</span> |
| | | <input class="control-label" id="num4" name="num4" value="${num4}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单 司机B获得</span> |
| | | <input class="control-label" id="num5" name="num5" value="${num5}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单 司机A获得</span> |
| | | <span class="control-label" >元/单 司机B获得</span> |
| | | <input class="control-label" id="num6" name="num6" value="${num6}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单 司机A获得</span> |
| | | <input class="control-label" id="num7" name="num7" value="${num7}" type="text" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/单</span> |
| | | </div> |
| | | </div> |
| | |
| | | var value = $(this).val() |
| | | regexp(value) |
| | | }) |
| | | $("input[name=num7]").mouseleave('input',function(){ |
| | | var value = $(this).val() |
| | | regexp(value) |
| | | }) |
| | | function regexp(value){ |
| | | var reg=/^(\d+.?)?\d{0,2}$/;//由 1-9开头 的正则表达式 整数 |
| | | var reg=/^(\d+.?)?\d{0,2}$/;//由 1-9开头 的正则表达式 整数 两位小数 |
| | | var reg1 = /^(([1-9]{1}\d*)|(0{1}))(\.\d{2})$/; // 两位小数 |
| | | //先判断是否为整数 在判断 是否在 1-总页 整数范围之内 |
| | | if(reg.test(value)){ |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <!--<div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >改派设置:</label> |
| | | </div> |
| | | </div> |
| | | </div>--> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <!--<div class="initialLevel col-sm-12 control-label form-group" style="text-align: left" > |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <span class="control-label" >改派后暂停接单</span> |
| | | <input class="control-label" id="num5" name="num5" value="${num5}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <input class="control-label" id="num5" name="num5" value="" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >分钟</span> |
| | | </div> |
| | | </div> |
| | | </div>--> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10" style="text-align: center"> |
| | |
| | | var value = $(this).val() |
| | | regexp(value) |
| | | }) |
| | | $("input[name=num5]").bind('input',function(){ |
| | | /*$("input[name=num5]").bind('input',function(){ |
| | | var value = $(this).val() |
| | | regexp(value) |
| | | }) |
| | | })*/ |
| | | function regexp(value){ |
| | | var reg=/^[1-9]\d*$/;//由 1-9开头 的正则表达式 |
| | | //先判断是否为整数 在判断 是否在 1-总页 整数范围之内 |
| | |
| | | <div name="rulesForm"> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <span class="control-label" >时间段</span> |
| | | <input class="control-label" id="num1" name="num1" value="${ChargeStandard.num1}" type="text" placeholder="00:00" style="height: 30px;width: 80px"> |
| | | <input class="control-label time-item" id="num1" name="num1" value="${ChargeStandard.num1}" type="text" placeholder="00:00" style="height: 30px;width: 80px" readonly> |
| | | <span class="control-label" >——</span> |
| | | <input class="control-label" id="num2" name="num2" value="${ChargeStandard.num2}" type="text" placeholder="00:00" style="height: 30px;width: 80px"> |
| | | <input class="control-label time-item" id="num2" name="num2" value="${ChargeStandard.num2}" type="text" placeholder="00:00" style="height: 30px;width: 80px" readonly> |
| | | <span class="control-label" >代驾里程</span> |
| | | <input class="control-label" id="num3" name="num3" value="${ChargeStandard.num3}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >公里,起步价</span> |
| | |
| | | <input class="control-label" id="num12" name="num12" value="${ExtraCost.num1}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >分钟,收取</span> |
| | | <input class="control-label" id="num13" name="num13" value="${ExtraCost.num2}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元,超出</span> |
| | | <input class="control-label" id="num14" name="num14" value="${ExtraCost.num3}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >分钟,收取</span> |
| | | <span class="control-label" >元,超出收取</span> |
| | | <input class="control-label" id="num15" name="num15" value="${ExtraCost.num4}" type="number" min="0" style="height: 30px;width: 80px"> |
| | | <span class="control-label" >元/分钟</span> |
| | | </div> |
| | |
| | | <script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig.js"></script> |
| | | <script src="${ctxPath}/static/modular/system/tSystemConfig/tSystemConfig_info.js"></script> |
| | | <script type="text/javascript"> |
| | | // laydate.render({ |
| | | // elem: 'input[name=num1]', |
| | | // type: 'time', |
| | | // format: 'HH:mm', |
| | | // range: false, |
| | | // lang:'zn' |
| | | // }); |
| | | // laydate.render({ |
| | | // elem: 'input[name=num2]', |
| | | // type: 'time', |
| | | // format: 'HH:mm', |
| | | // range: false, |
| | | // lang:'zn' |
| | | // }); |
| | | lay('.time-item').each(function(){ |
| | | laydate.render({ |
| | | elem: this, |
| | | type: 'time', |
| | | format: 'HH:mm', |
| | | range: false, |
| | | lang:'zn', |
| | | trigger: 'click' |
| | | }); |
| | | }); |
| | | |
| | | var elem1 = document.querySelector(".js-switch1"); |
| | | var init1 = new Switchery(elem1); |
New file |
| | |
| | | (function( $ ){ |
| | | $.fn.qrcode = function(options) { |
| | | // if options is string, |
| | | if( typeof options === 'string' ){ |
| | | options = { text: options }; |
| | | } |
| | | |
| | | // set default values |
| | | // typeNumber < 1 for automatic calculation |
| | | options = $.extend( {}, { |
| | | render : "canvas", |
| | | width : 256, |
| | | height : 256, |
| | | typeNumber : -1, |
| | | correctLevel : QRErrorCorrectLevel.H, |
| | | background : "#ffffff", |
| | | foreground : "#000000" |
| | | }, options); |
| | | |
| | | var createCanvas = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create canvas element |
| | | var canvas = document.createElement('canvas'); |
| | | canvas.width = options.width; |
| | | canvas.height = options.height; |
| | | var ctx = canvas.getContext('2d'); |
| | | |
| | | // compute tileW/tileH based on options.width/options.height |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the canvas |
| | | for( var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | for( var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | ctx.fillStyle = qrcode.isDark(row, col) ? options.foreground : options.background; |
| | | var w = (Math.ceil((col+1)*tileW) - Math.floor(col*tileW)); |
| | | var h = (Math.ceil((row+1)*tileH) - Math.floor(row*tileH)); |
| | | ctx.fillRect(Math.round(col*tileW),Math.round(row*tileH), w, h); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return canvas; |
| | | } |
| | | |
| | | // from Jon-Carlos Rivera (https://github.com/imbcmdth) |
| | | var createTable = function(){ |
| | | // create the qrcode itself |
| | | var qrcode = new QRCode(options.typeNumber, options.correctLevel); |
| | | qrcode.addData(options.text); |
| | | qrcode.make(); |
| | | |
| | | // create table element |
| | | var $table = $('<table></table>') |
| | | .css("width", options.width+"px") |
| | | .css("height", options.height+"px") |
| | | .css("border", "0px") |
| | | .css("border-collapse", "collapse") |
| | | .css('background-color', options.background); |
| | | |
| | | // compute tileS percentage |
| | | var tileW = options.width / qrcode.getModuleCount(); |
| | | var tileH = options.height / qrcode.getModuleCount(); |
| | | |
| | | // draw in the table |
| | | for(var row = 0; row < qrcode.getModuleCount(); row++ ){ |
| | | var $row = $('<tr></tr>').css('height', tileH+"px").appendTo($table); |
| | | |
| | | for(var col = 0; col < qrcode.getModuleCount(); col++ ){ |
| | | $('<td></td>') |
| | | .css('width', tileW+"px") |
| | | .css('background-color', qrcode.isDark(row, col) ? options.foreground : options.background) |
| | | .appendTo($row); |
| | | } |
| | | } |
| | | // return just built canvas |
| | | return $table; |
| | | } |
| | | |
| | | |
| | | return this.each(function(){ |
| | | var element = options.render == "canvas" ? createCanvas() : createTable(); |
| | | $(element).appendTo(this); |
| | | }); |
| | | }; |
| | | })( jQuery ); |
New file |
| | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode for JavaScript |
| | | // |
| | | // Copyright (c) 2009 Kazuhiko Arase |
| | | // |
| | | // URL: http://www.d-project.com/ |
| | | // |
| | | // Licensed under the MIT license: |
| | | // http://www.opensource.org/licenses/mit-license.php |
| | | // |
| | | // The word "QR Code" is registered trademark of |
| | | // DENSO WAVE INCORPORATED |
| | | // http://www.denso-wave.com/qrcode/faqpatent-e.html |
| | | // |
| | | //--------------------------------------------------------------------- |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QR8bitByte |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QR8bitByte(data) { |
| | | this.mode = QRMode.MODE_8BIT_BYTE; |
| | | this.data = data; |
| | | } |
| | | |
| | | QR8bitByte.prototype = { |
| | | |
| | | getLength : function(buffer) { |
| | | return this.data.length; |
| | | }, |
| | | |
| | | write : function(buffer) { |
| | | for (var i = 0; i < this.data.length; i++) { |
| | | // not JIS ... |
| | | buffer.put(this.data.charCodeAt(i), 8); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRCode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRCode(typeNumber, errorCorrectLevel) { |
| | | this.typeNumber = typeNumber; |
| | | this.errorCorrectLevel = errorCorrectLevel; |
| | | this.modules = null; |
| | | this.moduleCount = 0; |
| | | this.dataCache = null; |
| | | this.dataList = new Array(); |
| | | } |
| | | |
| | | QRCode.prototype = { |
| | | |
| | | addData : function(data) { |
| | | var newData = new QR8bitByte(data); |
| | | this.dataList.push(newData); |
| | | this.dataCache = null; |
| | | }, |
| | | |
| | | isDark : function(row, col) { |
| | | if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { |
| | | throw new Error(row + "," + col); |
| | | } |
| | | return this.modules[row][col]; |
| | | }, |
| | | |
| | | getModuleCount : function() { |
| | | return this.moduleCount; |
| | | }, |
| | | |
| | | make : function() { |
| | | // Calculate automatically typeNumber if provided is < 1 |
| | | if (this.typeNumber < 1 ){ |
| | | var typeNumber = 1; |
| | | for (typeNumber = 1; typeNumber < 40; typeNumber++) { |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | for (var i = 0; i < this.dataList.length; i++) { |
| | | var data = this.dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | if (buffer.getLengthInBits() <= totalDataCount * 8) |
| | | break; |
| | | } |
| | | this.typeNumber = typeNumber; |
| | | } |
| | | this.makeImpl(false, this.getBestMaskPattern() ); |
| | | }, |
| | | |
| | | makeImpl : function(test, maskPattern) { |
| | | |
| | | this.moduleCount = this.typeNumber * 4 + 17; |
| | | this.modules = new Array(this.moduleCount); |
| | | |
| | | for (var row = 0; row < this.moduleCount; row++) { |
| | | |
| | | this.modules[row] = new Array(this.moduleCount); |
| | | |
| | | for (var col = 0; col < this.moduleCount; col++) { |
| | | this.modules[row][col] = null;//(col + row) % 3; |
| | | } |
| | | } |
| | | |
| | | this.setupPositionProbePattern(0, 0); |
| | | this.setupPositionProbePattern(this.moduleCount - 7, 0); |
| | | this.setupPositionProbePattern(0, this.moduleCount - 7); |
| | | this.setupPositionAdjustPattern(); |
| | | this.setupTimingPattern(); |
| | | this.setupTypeInfo(test, maskPattern); |
| | | |
| | | if (this.typeNumber >= 7) { |
| | | this.setupTypeNumber(test); |
| | | } |
| | | |
| | | if (this.dataCache == null) { |
| | | this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); |
| | | } |
| | | |
| | | this.mapData(this.dataCache, maskPattern); |
| | | }, |
| | | |
| | | setupPositionProbePattern : function(row, col) { |
| | | |
| | | for (var r = -1; r <= 7; r++) { |
| | | |
| | | if (row + r <= -1 || this.moduleCount <= row + r) continue; |
| | | |
| | | for (var c = -1; c <= 7; c++) { |
| | | |
| | | if (col + c <= -1 || this.moduleCount <= col + c) continue; |
| | | |
| | | if ( (0 <= r && r <= 6 && (c == 0 || c == 6) ) |
| | | || (0 <= c && c <= 6 && (r == 0 || r == 6) ) |
| | | || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getBestMaskPattern : function() { |
| | | |
| | | var minLostPoint = 0; |
| | | var pattern = 0; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | |
| | | this.makeImpl(true, i); |
| | | |
| | | var lostPoint = QRUtil.getLostPoint(this); |
| | | |
| | | if (i == 0 || minLostPoint > lostPoint) { |
| | | minLostPoint = lostPoint; |
| | | pattern = i; |
| | | } |
| | | } |
| | | |
| | | return pattern; |
| | | }, |
| | | |
| | | createMovieClip : function(target_mc, instance_name, depth) { |
| | | |
| | | var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); |
| | | var cs = 1; |
| | | |
| | | this.make(); |
| | | |
| | | for (var row = 0; row < this.modules.length; row++) { |
| | | |
| | | var y = row * cs; |
| | | |
| | | for (var col = 0; col < this.modules[row].length; col++) { |
| | | |
| | | var x = col * cs; |
| | | var dark = this.modules[row][col]; |
| | | |
| | | if (dark) { |
| | | qr_mc.beginFill(0, 100); |
| | | qr_mc.moveTo(x, y); |
| | | qr_mc.lineTo(x + cs, y); |
| | | qr_mc.lineTo(x + cs, y + cs); |
| | | qr_mc.lineTo(x, y + cs); |
| | | qr_mc.endFill(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return qr_mc; |
| | | }, |
| | | |
| | | setupTimingPattern : function() { |
| | | |
| | | for (var r = 8; r < this.moduleCount - 8; r++) { |
| | | if (this.modules[r][6] != null) { |
| | | continue; |
| | | } |
| | | this.modules[r][6] = (r % 2 == 0); |
| | | } |
| | | |
| | | for (var c = 8; c < this.moduleCount - 8; c++) { |
| | | if (this.modules[6][c] != null) { |
| | | continue; |
| | | } |
| | | this.modules[6][c] = (c % 2 == 0); |
| | | } |
| | | }, |
| | | |
| | | setupPositionAdjustPattern : function() { |
| | | |
| | | var pos = QRUtil.getPatternPosition(this.typeNumber); |
| | | |
| | | for (var i = 0; i < pos.length; i++) { |
| | | |
| | | for (var j = 0; j < pos.length; j++) { |
| | | |
| | | var row = pos[i]; |
| | | var col = pos[j]; |
| | | |
| | | if (this.modules[row][col] != null) { |
| | | continue; |
| | | } |
| | | |
| | | for (var r = -2; r <= 2; r++) { |
| | | |
| | | for (var c = -2; c <= 2; c++) { |
| | | |
| | | if (r == -2 || r == 2 || c == -2 || c == 2 |
| | | || (r == 0 && c == 0) ) { |
| | | this.modules[row + r][col + c] = true; |
| | | } else { |
| | | this.modules[row + r][col + c] = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | setupTypeNumber : function(test) { |
| | | |
| | | var bits = QRUtil.getBCHTypeNumber(this.typeNumber); |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; |
| | | } |
| | | |
| | | for (var i = 0; i < 18; i++) { |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; |
| | | } |
| | | }, |
| | | |
| | | setupTypeInfo : function(test, maskPattern) { |
| | | |
| | | var data = (this.errorCorrectLevel << 3) | maskPattern; |
| | | var bits = QRUtil.getBCHTypeInfo(data); |
| | | |
| | | // vertical |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 6) { |
| | | this.modules[i][8] = mod; |
| | | } else if (i < 8) { |
| | | this.modules[i + 1][8] = mod; |
| | | } else { |
| | | this.modules[this.moduleCount - 15 + i][8] = mod; |
| | | } |
| | | } |
| | | |
| | | // horizontal |
| | | for (var i = 0; i < 15; i++) { |
| | | |
| | | var mod = (!test && ( (bits >> i) & 1) == 1); |
| | | |
| | | if (i < 8) { |
| | | this.modules[8][this.moduleCount - i - 1] = mod; |
| | | } else if (i < 9) { |
| | | this.modules[8][15 - i - 1 + 1] = mod; |
| | | } else { |
| | | this.modules[8][15 - i - 1] = mod; |
| | | } |
| | | } |
| | | |
| | | // fixed module |
| | | this.modules[this.moduleCount - 8][8] = (!test); |
| | | |
| | | }, |
| | | |
| | | mapData : function(data, maskPattern) { |
| | | |
| | | var inc = -1; |
| | | var row = this.moduleCount - 1; |
| | | var bitIndex = 7; |
| | | var byteIndex = 0; |
| | | |
| | | for (var col = this.moduleCount - 1; col > 0; col -= 2) { |
| | | |
| | | if (col == 6) col--; |
| | | |
| | | while (true) { |
| | | |
| | | for (var c = 0; c < 2; c++) { |
| | | |
| | | if (this.modules[row][col - c] == null) { |
| | | |
| | | var dark = false; |
| | | |
| | | if (byteIndex < data.length) { |
| | | dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1); |
| | | } |
| | | |
| | | var mask = QRUtil.getMask(maskPattern, row, col - c); |
| | | |
| | | if (mask) { |
| | | dark = !dark; |
| | | } |
| | | |
| | | this.modules[row][col - c] = dark; |
| | | bitIndex--; |
| | | |
| | | if (bitIndex == -1) { |
| | | byteIndex++; |
| | | bitIndex = 7; |
| | | } |
| | | } |
| | | } |
| | | |
| | | row += inc; |
| | | |
| | | if (row < 0 || this.moduleCount <= row) { |
| | | row -= inc; |
| | | inc = -inc; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | }; |
| | | |
| | | QRCode.PAD0 = 0xEC; |
| | | QRCode.PAD1 = 0x11; |
| | | |
| | | QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { |
| | | |
| | | var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); |
| | | |
| | | var buffer = new QRBitBuffer(); |
| | | |
| | | for (var i = 0; i < dataList.length; i++) { |
| | | var data = dataList[i]; |
| | | buffer.put(data.mode, 4); |
| | | buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); |
| | | data.write(buffer); |
| | | } |
| | | |
| | | // calc num max data. |
| | | var totalDataCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalDataCount += rsBlocks[i].dataCount; |
| | | } |
| | | |
| | | if (buffer.getLengthInBits() > totalDataCount * 8) { |
| | | throw new Error("code length overflow. (" |
| | | + buffer.getLengthInBits() |
| | | + ">" |
| | | + totalDataCount * 8 |
| | | + ")"); |
| | | } |
| | | |
| | | // end code |
| | | if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { |
| | | buffer.put(0, 4); |
| | | } |
| | | |
| | | // padding |
| | | while (buffer.getLengthInBits() % 8 != 0) { |
| | | buffer.putBit(false); |
| | | } |
| | | |
| | | // padding |
| | | while (true) { |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD0, 8); |
| | | |
| | | if (buffer.getLengthInBits() >= totalDataCount * 8) { |
| | | break; |
| | | } |
| | | buffer.put(QRCode.PAD1, 8); |
| | | } |
| | | |
| | | return QRCode.createBytes(buffer, rsBlocks); |
| | | } |
| | | |
| | | QRCode.createBytes = function(buffer, rsBlocks) { |
| | | |
| | | var offset = 0; |
| | | |
| | | var maxDcCount = 0; |
| | | var maxEcCount = 0; |
| | | |
| | | var dcdata = new Array(rsBlocks.length); |
| | | var ecdata = new Array(rsBlocks.length); |
| | | |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | |
| | | var dcCount = rsBlocks[r].dataCount; |
| | | var ecCount = rsBlocks[r].totalCount - dcCount; |
| | | |
| | | maxDcCount = Math.max(maxDcCount, dcCount); |
| | | maxEcCount = Math.max(maxEcCount, ecCount); |
| | | |
| | | dcdata[r] = new Array(dcCount); |
| | | |
| | | for (var i = 0; i < dcdata[r].length; i++) { |
| | | dcdata[r][i] = 0xff & buffer.buffer[i + offset]; |
| | | } |
| | | offset += dcCount; |
| | | |
| | | var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); |
| | | var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); |
| | | |
| | | var modPoly = rawPoly.mod(rsPoly); |
| | | ecdata[r] = new Array(rsPoly.getLength() - 1); |
| | | for (var i = 0; i < ecdata[r].length; i++) { |
| | | var modIndex = i + modPoly.getLength() - ecdata[r].length; |
| | | ecdata[r][i] = (modIndex >= 0)? modPoly.get(modIndex) : 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | var totalCodeCount = 0; |
| | | for (var i = 0; i < rsBlocks.length; i++) { |
| | | totalCodeCount += rsBlocks[i].totalCount; |
| | | } |
| | | |
| | | var data = new Array(totalCodeCount); |
| | | var index = 0; |
| | | |
| | | for (var i = 0; i < maxDcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < dcdata[r].length) { |
| | | data[index++] = dcdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var i = 0; i < maxEcCount; i++) { |
| | | for (var r = 0; r < rsBlocks.length; r++) { |
| | | if (i < ecdata[r].length) { |
| | | data[index++] = ecdata[r][i]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMode |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMode = { |
| | | MODE_NUMBER : 1 << 0, |
| | | MODE_ALPHA_NUM : 1 << 1, |
| | | MODE_8BIT_BYTE : 1 << 2, |
| | | MODE_KANJI : 1 << 3 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRErrorCorrectLevel |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRErrorCorrectLevel = { |
| | | L : 1, |
| | | M : 0, |
| | | Q : 3, |
| | | H : 2 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMaskPattern |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMaskPattern = { |
| | | PATTERN000 : 0, |
| | | PATTERN001 : 1, |
| | | PATTERN010 : 2, |
| | | PATTERN011 : 3, |
| | | PATTERN100 : 4, |
| | | PATTERN101 : 5, |
| | | PATTERN110 : 6, |
| | | PATTERN111 : 7 |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRUtil |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRUtil = { |
| | | |
| | | PATTERN_POSITION_TABLE : [ |
| | | [], |
| | | [6, 18], |
| | | [6, 22], |
| | | [6, 26], |
| | | [6, 30], |
| | | [6, 34], |
| | | [6, 22, 38], |
| | | [6, 24, 42], |
| | | [6, 26, 46], |
| | | [6, 28, 50], |
| | | [6, 30, 54], |
| | | [6, 32, 58], |
| | | [6, 34, 62], |
| | | [6, 26, 46, 66], |
| | | [6, 26, 48, 70], |
| | | [6, 26, 50, 74], |
| | | [6, 30, 54, 78], |
| | | [6, 30, 56, 82], |
| | | [6, 30, 58, 86], |
| | | [6, 34, 62, 90], |
| | | [6, 28, 50, 72, 94], |
| | | [6, 26, 50, 74, 98], |
| | | [6, 30, 54, 78, 102], |
| | | [6, 28, 54, 80, 106], |
| | | [6, 32, 58, 84, 110], |
| | | [6, 30, 58, 86, 114], |
| | | [6, 34, 62, 90, 118], |
| | | [6, 26, 50, 74, 98, 122], |
| | | [6, 30, 54, 78, 102, 126], |
| | | [6, 26, 52, 78, 104, 130], |
| | | [6, 30, 56, 82, 108, 134], |
| | | [6, 34, 60, 86, 112, 138], |
| | | [6, 30, 58, 86, 114, 142], |
| | | [6, 34, 62, 90, 118, 146], |
| | | [6, 30, 54, 78, 102, 126, 150], |
| | | [6, 24, 50, 76, 102, 128, 154], |
| | | [6, 28, 54, 80, 106, 132, 158], |
| | | [6, 32, 58, 84, 110, 136, 162], |
| | | [6, 26, 54, 82, 110, 138, 166], |
| | | [6, 30, 58, 86, 114, 142, 170] |
| | | ], |
| | | |
| | | G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), |
| | | G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), |
| | | G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), |
| | | |
| | | getBCHTypeInfo : function(data) { |
| | | var d = data << 10; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { |
| | | d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); |
| | | } |
| | | return ( (data << 10) | d) ^ QRUtil.G15_MASK; |
| | | }, |
| | | |
| | | getBCHTypeNumber : function(data) { |
| | | var d = data << 12; |
| | | while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { |
| | | d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); |
| | | } |
| | | return (data << 12) | d; |
| | | }, |
| | | |
| | | getBCHDigit : function(data) { |
| | | |
| | | var digit = 0; |
| | | |
| | | while (data != 0) { |
| | | digit++; |
| | | data >>>= 1; |
| | | } |
| | | |
| | | return digit; |
| | | }, |
| | | |
| | | getPatternPosition : function(typeNumber) { |
| | | return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; |
| | | }, |
| | | |
| | | getMask : function(maskPattern, i, j) { |
| | | |
| | | switch (maskPattern) { |
| | | |
| | | case QRMaskPattern.PATTERN000 : return (i + j) % 2 == 0; |
| | | case QRMaskPattern.PATTERN001 : return i % 2 == 0; |
| | | case QRMaskPattern.PATTERN010 : return j % 3 == 0; |
| | | case QRMaskPattern.PATTERN011 : return (i + j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; |
| | | case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 == 0; |
| | | case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; |
| | | case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; |
| | | |
| | | default : |
| | | throw new Error("bad maskPattern:" + maskPattern); |
| | | } |
| | | }, |
| | | |
| | | getErrorCorrectPolynomial : function(errorCorrectLength) { |
| | | |
| | | var a = new QRPolynomial([1], 0); |
| | | |
| | | for (var i = 0; i < errorCorrectLength; i++) { |
| | | a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) ); |
| | | } |
| | | |
| | | return a; |
| | | }, |
| | | |
| | | getLengthInBits : function(mode, type) { |
| | | |
| | | if (1 <= type && type < 10) { |
| | | |
| | | // 1 - 9 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 10; |
| | | case QRMode.MODE_ALPHA_NUM : return 9; |
| | | case QRMode.MODE_8BIT_BYTE : return 8; |
| | | case QRMode.MODE_KANJI : return 8; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 27) { |
| | | |
| | | // 10 - 26 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 12; |
| | | case QRMode.MODE_ALPHA_NUM : return 11; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 10; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else if (type < 41) { |
| | | |
| | | // 27 - 40 |
| | | |
| | | switch(mode) { |
| | | case QRMode.MODE_NUMBER : return 14; |
| | | case QRMode.MODE_ALPHA_NUM : return 13; |
| | | case QRMode.MODE_8BIT_BYTE : return 16; |
| | | case QRMode.MODE_KANJI : return 12; |
| | | default : |
| | | throw new Error("mode:" + mode); |
| | | } |
| | | |
| | | } else { |
| | | throw new Error("type:" + type); |
| | | } |
| | | }, |
| | | |
| | | getLostPoint : function(qrCode) { |
| | | |
| | | var moduleCount = qrCode.getModuleCount(); |
| | | |
| | | var lostPoint = 0; |
| | | |
| | | // LEVEL1 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | |
| | | var sameCount = 0; |
| | | var dark = qrCode.isDark(row, col); |
| | | |
| | | for (var r = -1; r <= 1; r++) { |
| | | |
| | | if (row + r < 0 || moduleCount <= row + r) { |
| | | continue; |
| | | } |
| | | |
| | | for (var c = -1; c <= 1; c++) { |
| | | |
| | | if (col + c < 0 || moduleCount <= col + c) { |
| | | continue; |
| | | } |
| | | |
| | | if (r == 0 && c == 0) { |
| | | continue; |
| | | } |
| | | |
| | | if (dark == qrCode.isDark(row + r, col + c) ) { |
| | | sameCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (sameCount > 5) { |
| | | lostPoint += (3 + sameCount - 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL2 |
| | | |
| | | for (var row = 0; row < moduleCount - 1; row++) { |
| | | for (var col = 0; col < moduleCount - 1; col++) { |
| | | var count = 0; |
| | | if (qrCode.isDark(row, col ) ) count++; |
| | | if (qrCode.isDark(row + 1, col ) ) count++; |
| | | if (qrCode.isDark(row, col + 1) ) count++; |
| | | if (qrCode.isDark(row + 1, col + 1) ) count++; |
| | | if (count == 0 || count == 4) { |
| | | lostPoint += 3; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL3 |
| | | |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | for (var col = 0; col < moduleCount - 6; col++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row, col + 1) |
| | | && qrCode.isDark(row, col + 2) |
| | | && qrCode.isDark(row, col + 3) |
| | | && qrCode.isDark(row, col + 4) |
| | | && !qrCode.isDark(row, col + 5) |
| | | && qrCode.isDark(row, col + 6) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount - 6; row++) { |
| | | if (qrCode.isDark(row, col) |
| | | && !qrCode.isDark(row + 1, col) |
| | | && qrCode.isDark(row + 2, col) |
| | | && qrCode.isDark(row + 3, col) |
| | | && qrCode.isDark(row + 4, col) |
| | | && !qrCode.isDark(row + 5, col) |
| | | && qrCode.isDark(row + 6, col) ) { |
| | | lostPoint += 40; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // LEVEL4 |
| | | |
| | | var darkCount = 0; |
| | | |
| | | for (var col = 0; col < moduleCount; col++) { |
| | | for (var row = 0; row < moduleCount; row++) { |
| | | if (qrCode.isDark(row, col) ) { |
| | | darkCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; |
| | | lostPoint += ratio * 10; |
| | | |
| | | return lostPoint; |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRMath |
| | | //--------------------------------------------------------------------- |
| | | |
| | | var QRMath = { |
| | | |
| | | glog : function(n) { |
| | | |
| | | if (n < 1) { |
| | | throw new Error("glog(" + n + ")"); |
| | | } |
| | | |
| | | return QRMath.LOG_TABLE[n]; |
| | | }, |
| | | |
| | | gexp : function(n) { |
| | | |
| | | while (n < 0) { |
| | | n += 255; |
| | | } |
| | | |
| | | while (n >= 256) { |
| | | n -= 255; |
| | | } |
| | | |
| | | return QRMath.EXP_TABLE[n]; |
| | | }, |
| | | |
| | | EXP_TABLE : new Array(256), |
| | | |
| | | LOG_TABLE : new Array(256) |
| | | |
| | | }; |
| | | |
| | | for (var i = 0; i < 8; i++) { |
| | | QRMath.EXP_TABLE[i] = 1 << i; |
| | | } |
| | | for (var i = 8; i < 256; i++) { |
| | | QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] |
| | | ^ QRMath.EXP_TABLE[i - 5] |
| | | ^ QRMath.EXP_TABLE[i - 6] |
| | | ^ QRMath.EXP_TABLE[i - 8]; |
| | | } |
| | | for (var i = 0; i < 255; i++) { |
| | | QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i; |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRPolynomial |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRPolynomial(num, shift) { |
| | | |
| | | if (num.length == undefined) { |
| | | throw new Error(num.length + "/" + shift); |
| | | } |
| | | |
| | | var offset = 0; |
| | | |
| | | while (offset < num.length && num[offset] == 0) { |
| | | offset++; |
| | | } |
| | | |
| | | this.num = new Array(num.length - offset + shift); |
| | | for (var i = 0; i < num.length - offset; i++) { |
| | | this.num[i] = num[i + offset]; |
| | | } |
| | | } |
| | | |
| | | QRPolynomial.prototype = { |
| | | |
| | | get : function(index) { |
| | | return this.num[index]; |
| | | }, |
| | | |
| | | getLength : function() { |
| | | return this.num.length; |
| | | }, |
| | | |
| | | multiply : function(e) { |
| | | |
| | | var num = new Array(this.getLength() + e.getLength() - 1); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | for (var j = 0; j < e.getLength(); j++) { |
| | | num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) ); |
| | | } |
| | | } |
| | | |
| | | return new QRPolynomial(num, 0); |
| | | }, |
| | | |
| | | mod : function(e) { |
| | | |
| | | if (this.getLength() - e.getLength() < 0) { |
| | | return this; |
| | | } |
| | | |
| | | var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) ); |
| | | |
| | | var num = new Array(this.getLength() ); |
| | | |
| | | for (var i = 0; i < this.getLength(); i++) { |
| | | num[i] = this.get(i); |
| | | } |
| | | |
| | | for (var i = 0; i < e.getLength(); i++) { |
| | | num[i] ^= QRMath.gexp(QRMath.glog(e.get(i) ) + ratio); |
| | | } |
| | | |
| | | // recursive call |
| | | return new QRPolynomial(num, 0).mod(e); |
| | | } |
| | | }; |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRRSBlock |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRRSBlock(totalCount, dataCount) { |
| | | this.totalCount = totalCount; |
| | | this.dataCount = dataCount; |
| | | } |
| | | |
| | | QRRSBlock.RS_BLOCK_TABLE = [ |
| | | |
| | | // L |
| | | // M |
| | | // Q |
| | | // H |
| | | |
| | | // 1 |
| | | [1, 26, 19], |
| | | [1, 26, 16], |
| | | [1, 26, 13], |
| | | [1, 26, 9], |
| | | |
| | | // 2 |
| | | [1, 44, 34], |
| | | [1, 44, 28], |
| | | [1, 44, 22], |
| | | [1, 44, 16], |
| | | |
| | | // 3 |
| | | [1, 70, 55], |
| | | [1, 70, 44], |
| | | [2, 35, 17], |
| | | [2, 35, 13], |
| | | |
| | | // 4 |
| | | [1, 100, 80], |
| | | [2, 50, 32], |
| | | [2, 50, 24], |
| | | [4, 25, 9], |
| | | |
| | | // 5 |
| | | [1, 134, 108], |
| | | [2, 67, 43], |
| | | [2, 33, 15, 2, 34, 16], |
| | | [2, 33, 11, 2, 34, 12], |
| | | |
| | | // 6 |
| | | [2, 86, 68], |
| | | [4, 43, 27], |
| | | [4, 43, 19], |
| | | [4, 43, 15], |
| | | |
| | | // 7 |
| | | [2, 98, 78], |
| | | [4, 49, 31], |
| | | [2, 32, 14, 4, 33, 15], |
| | | [4, 39, 13, 1, 40, 14], |
| | | |
| | | // 8 |
| | | [2, 121, 97], |
| | | [2, 60, 38, 2, 61, 39], |
| | | [4, 40, 18, 2, 41, 19], |
| | | [4, 40, 14, 2, 41, 15], |
| | | |
| | | // 9 |
| | | [2, 146, 116], |
| | | [3, 58, 36, 2, 59, 37], |
| | | [4, 36, 16, 4, 37, 17], |
| | | [4, 36, 12, 4, 37, 13], |
| | | |
| | | // 10 |
| | | [2, 86, 68, 2, 87, 69], |
| | | [4, 69, 43, 1, 70, 44], |
| | | [6, 43, 19, 2, 44, 20], |
| | | [6, 43, 15, 2, 44, 16], |
| | | |
| | | // 11 |
| | | [4, 101, 81], |
| | | [1, 80, 50, 4, 81, 51], |
| | | [4, 50, 22, 4, 51, 23], |
| | | [3, 36, 12, 8, 37, 13], |
| | | |
| | | // 12 |
| | | [2, 116, 92, 2, 117, 93], |
| | | [6, 58, 36, 2, 59, 37], |
| | | [4, 46, 20, 6, 47, 21], |
| | | [7, 42, 14, 4, 43, 15], |
| | | |
| | | // 13 |
| | | [4, 133, 107], |
| | | [8, 59, 37, 1, 60, 38], |
| | | [8, 44, 20, 4, 45, 21], |
| | | [12, 33, 11, 4, 34, 12], |
| | | |
| | | // 14 |
| | | [3, 145, 115, 1, 146, 116], |
| | | [4, 64, 40, 5, 65, 41], |
| | | [11, 36, 16, 5, 37, 17], |
| | | [11, 36, 12, 5, 37, 13], |
| | | |
| | | // 15 |
| | | [5, 109, 87, 1, 110, 88], |
| | | [5, 65, 41, 5, 66, 42], |
| | | [5, 54, 24, 7, 55, 25], |
| | | [11, 36, 12], |
| | | |
| | | // 16 |
| | | [5, 122, 98, 1, 123, 99], |
| | | [7, 73, 45, 3, 74, 46], |
| | | [15, 43, 19, 2, 44, 20], |
| | | [3, 45, 15, 13, 46, 16], |
| | | |
| | | // 17 |
| | | [1, 135, 107, 5, 136, 108], |
| | | [10, 74, 46, 1, 75, 47], |
| | | [1, 50, 22, 15, 51, 23], |
| | | [2, 42, 14, 17, 43, 15], |
| | | |
| | | // 18 |
| | | [5, 150, 120, 1, 151, 121], |
| | | [9, 69, 43, 4, 70, 44], |
| | | [17, 50, 22, 1, 51, 23], |
| | | [2, 42, 14, 19, 43, 15], |
| | | |
| | | // 19 |
| | | [3, 141, 113, 4, 142, 114], |
| | | [3, 70, 44, 11, 71, 45], |
| | | [17, 47, 21, 4, 48, 22], |
| | | [9, 39, 13, 16, 40, 14], |
| | | |
| | | // 20 |
| | | [3, 135, 107, 5, 136, 108], |
| | | [3, 67, 41, 13, 68, 42], |
| | | [15, 54, 24, 5, 55, 25], |
| | | [15, 43, 15, 10, 44, 16], |
| | | |
| | | // 21 |
| | | [4, 144, 116, 4, 145, 117], |
| | | [17, 68, 42], |
| | | [17, 50, 22, 6, 51, 23], |
| | | [19, 46, 16, 6, 47, 17], |
| | | |
| | | // 22 |
| | | [2, 139, 111, 7, 140, 112], |
| | | [17, 74, 46], |
| | | [7, 54, 24, 16, 55, 25], |
| | | [34, 37, 13], |
| | | |
| | | // 23 |
| | | [4, 151, 121, 5, 152, 122], |
| | | [4, 75, 47, 14, 76, 48], |
| | | [11, 54, 24, 14, 55, 25], |
| | | [16, 45, 15, 14, 46, 16], |
| | | |
| | | // 24 |
| | | [6, 147, 117, 4, 148, 118], |
| | | [6, 73, 45, 14, 74, 46], |
| | | [11, 54, 24, 16, 55, 25], |
| | | [30, 46, 16, 2, 47, 17], |
| | | |
| | | // 25 |
| | | [8, 132, 106, 4, 133, 107], |
| | | [8, 75, 47, 13, 76, 48], |
| | | [7, 54, 24, 22, 55, 25], |
| | | [22, 45, 15, 13, 46, 16], |
| | | |
| | | // 26 |
| | | [10, 142, 114, 2, 143, 115], |
| | | [19, 74, 46, 4, 75, 47], |
| | | [28, 50, 22, 6, 51, 23], |
| | | [33, 46, 16, 4, 47, 17], |
| | | |
| | | // 27 |
| | | [8, 152, 122, 4, 153, 123], |
| | | [22, 73, 45, 3, 74, 46], |
| | | [8, 53, 23, 26, 54, 24], |
| | | [12, 45, 15, 28, 46, 16], |
| | | |
| | | // 28 |
| | | [3, 147, 117, 10, 148, 118], |
| | | [3, 73, 45, 23, 74, 46], |
| | | [4, 54, 24, 31, 55, 25], |
| | | [11, 45, 15, 31, 46, 16], |
| | | |
| | | // 29 |
| | | [7, 146, 116, 7, 147, 117], |
| | | [21, 73, 45, 7, 74, 46], |
| | | [1, 53, 23, 37, 54, 24], |
| | | [19, 45, 15, 26, 46, 16], |
| | | |
| | | // 30 |
| | | [5, 145, 115, 10, 146, 116], |
| | | [19, 75, 47, 10, 76, 48], |
| | | [15, 54, 24, 25, 55, 25], |
| | | [23, 45, 15, 25, 46, 16], |
| | | |
| | | // 31 |
| | | [13, 145, 115, 3, 146, 116], |
| | | [2, 74, 46, 29, 75, 47], |
| | | [42, 54, 24, 1, 55, 25], |
| | | [23, 45, 15, 28, 46, 16], |
| | | |
| | | // 32 |
| | | [17, 145, 115], |
| | | [10, 74, 46, 23, 75, 47], |
| | | [10, 54, 24, 35, 55, 25], |
| | | [19, 45, 15, 35, 46, 16], |
| | | |
| | | // 33 |
| | | [17, 145, 115, 1, 146, 116], |
| | | [14, 74, 46, 21, 75, 47], |
| | | [29, 54, 24, 19, 55, 25], |
| | | [11, 45, 15, 46, 46, 16], |
| | | |
| | | // 34 |
| | | [13, 145, 115, 6, 146, 116], |
| | | [14, 74, 46, 23, 75, 47], |
| | | [44, 54, 24, 7, 55, 25], |
| | | [59, 46, 16, 1, 47, 17], |
| | | |
| | | // 35 |
| | | [12, 151, 121, 7, 152, 122], |
| | | [12, 75, 47, 26, 76, 48], |
| | | [39, 54, 24, 14, 55, 25], |
| | | [22, 45, 15, 41, 46, 16], |
| | | |
| | | // 36 |
| | | [6, 151, 121, 14, 152, 122], |
| | | [6, 75, 47, 34, 76, 48], |
| | | [46, 54, 24, 10, 55, 25], |
| | | [2, 45, 15, 64, 46, 16], |
| | | |
| | | // 37 |
| | | [17, 152, 122, 4, 153, 123], |
| | | [29, 74, 46, 14, 75, 47], |
| | | [49, 54, 24, 10, 55, 25], |
| | | [24, 45, 15, 46, 46, 16], |
| | | |
| | | // 38 |
| | | [4, 152, 122, 18, 153, 123], |
| | | [13, 74, 46, 32, 75, 47], |
| | | [48, 54, 24, 14, 55, 25], |
| | | [42, 45, 15, 32, 46, 16], |
| | | |
| | | // 39 |
| | | [20, 147, 117, 4, 148, 118], |
| | | [40, 75, 47, 7, 76, 48], |
| | | [43, 54, 24, 22, 55, 25], |
| | | [10, 45, 15, 67, 46, 16], |
| | | |
| | | // 40 |
| | | [19, 148, 118, 6, 149, 119], |
| | | [18, 75, 47, 31, 76, 48], |
| | | [34, 54, 24, 34, 55, 25], |
| | | [20, 45, 15, 61, 46, 16] |
| | | ]; |
| | | |
| | | QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); |
| | | |
| | | if (rsBlock == undefined) { |
| | | throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); |
| | | } |
| | | |
| | | var length = rsBlock.length / 3; |
| | | |
| | | var list = new Array(); |
| | | |
| | | for (var i = 0; i < length; i++) { |
| | | |
| | | var count = rsBlock[i * 3 + 0]; |
| | | var totalCount = rsBlock[i * 3 + 1]; |
| | | var dataCount = rsBlock[i * 3 + 2]; |
| | | |
| | | for (var j = 0; j < count; j++) { |
| | | list.push(new QRRSBlock(totalCount, dataCount) ); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) { |
| | | |
| | | switch(errorCorrectLevel) { |
| | | case QRErrorCorrectLevel.L : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; |
| | | case QRErrorCorrectLevel.M : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; |
| | | case QRErrorCorrectLevel.Q : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; |
| | | case QRErrorCorrectLevel.H : |
| | | return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; |
| | | default : |
| | | return undefined; |
| | | } |
| | | } |
| | | |
| | | //--------------------------------------------------------------------- |
| | | // QRBitBuffer |
| | | //--------------------------------------------------------------------- |
| | | |
| | | function QRBitBuffer() { |
| | | this.buffer = new Array(); |
| | | this.length = 0; |
| | | } |
| | | |
| | | QRBitBuffer.prototype = { |
| | | |
| | | get : function(index) { |
| | | var bufIndex = Math.floor(index / 8); |
| | | return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; |
| | | }, |
| | | |
| | | put : function(num, length) { |
| | | for (var i = 0; i < length; i++) { |
| | | this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); |
| | | } |
| | | }, |
| | | |
| | | getLengthInBits : function() { |
| | | return this.length; |
| | | }, |
| | | |
| | | putBit : function(bit) { |
| | | |
| | | var bufIndex = Math.floor(this.length / 8); |
| | | if (this.buffer.length <= bufIndex) { |
| | | this.buffer.push(0); |
| | | } |
| | | |
| | | if (bit) { |
| | | this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) ); |
| | | } |
| | | |
| | | this.length++; |
| | | } |
| | | }; |
| | |
| | | {title: '客服电话', field: 'serviceCalls', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '订单数量', field: 'orderSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效订单', field: 'validOrder', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '已发放优惠券', field: 'issuedCoupon', visible: true, align: 'center', valign: 'middle'}, |
| | | // {title: '已发放优惠券', field: 'issuedCoupon', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '已使用优惠券', field: 'usedCoupon', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '累计优惠券金额', field: 'couponPriceSum', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '司机充值', field: 'driverRecharge', visible: true, align: 'center', valign: 'middle'}, |
| | |
| | | if(this.value==""){ |
| | | $("#city").empty();//二级联动设为空设为空 |
| | | $("#city").append('<option value="">请选择</option>'); |
| | | // //region |
| | | // $("#district").empty();//三级联动设为空设为空 |
| | | // $("#district").append('<option value="">请选择</option>'); |
| | | } |
| | | if(this.value!=""){//第一级下拉菜单选择了值 |
| | | $("#city").empty();//先行置空,防止上次选择留下的元素影响效果 |
| | | $("#city").append('<option value="">请选择</option>')//设置初始选项 |
| | | //region |
| | | // $("#district").empty();//三级联动设为空设为空 |
| | | // $("#district").append('<option value="">请选择</option>'); |
| | | var province = document.getElementById('province'); |
| | | var index= province.selectedIndex ; |
| | | var id = province.options[index].id; |
| | |
| | | ajax.start(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /*var province = document.getElementById('province'); |
| | | var index= province.selectedIndex ; |
| | | var id = province.options[index].id; |
| | | /** |
| | | * 查询区 |
| | | */ |
| | | TAgent.areaDistrict = function () { |
| | | //监听第二个下拉菜单的变动操作 |
| | | $("#city").change(function(){ |
| | | if(this.value==""){//第二级菜单为空,则将第三级菜单也置为空 |
| | | $("#district").empty(); |
| | | $("#district").append('<option value="">请选择</option>'); |
| | | } |
| | | if(this.value!=""){//第二级菜单不为空,则将第三级菜单动态生成 |
| | | $("#district").empty(); |
| | | $("#district").append('<option value="">请选择</option>'); |
| | | |
| | | var city = document.getElementById('city'); |
| | | var cityIndex= city.selectedIndex ; |
| | | var id = city.options[cityIndex].id; |
| | | if(id == ""){ |
| | | id = city.options[cityIndex].value; |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgent/areaCity?parentId="+id, function (data) { |
| | | var opts=document.getElementById('city').options; |
| | | opts.length=0;// 这一句是清空原有列表项 |
| | | for(var i=0,n=data.length;i<n;i++){ |
| | | var data1=data[i]; |
| | | var opt=new Option(data1.name,data1.id,true,true); |
| | | opts.add(opt); |
| | | for(var i=0,n=data.length;i<n;i++){//对区数据进行遍历,动态生成 |
| | | $("#district").append('<option value="'+data[i].id+'">'+data[i].name+'</option>'); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("查询失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.start();*/ |
| | | ajax.start(); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 选择省市 |
| | | */ |
| | | TAgent.submitArea = function () { |
| | | var province = document.getElementById('province'); |
| | | var provinceIndex= province.selectedIndex ; |
| | | var provinceName = province.options[provinceIndex].value; |
| | | var provinceId = province.options[provinceIndex].id; |
| | | var provinceId = province.options[provinceIndex].value; |
| | | var provinceName = province.options[provinceIndex].innerText; |
| | | |
| | | if(provinceName == null || provinceName == ''){ |
| | | Feng.error("请选择省份!") |
| | |
| | | return; |
| | | } |
| | | |
| | | console.log(provinceName+'/'+cityName) |
| | | console.log(provinceId+'/'+cityId) |
| | | |
| | | parent.$("#area").val(provinceName+'/'+cityName) |
| | | parent.$("#areaId").val(provinceId+'/'+cityId) |
| | | TAgentInfoDlg.close(); |
| | | // var province = document.getElementById('province'); |
| | | // var provinceIndex= province.selectedIndex ; |
| | | // var provinceId = province.options[provinceIndex].value; |
| | | // var provinceName = province.options[provinceIndex].innerText; |
| | | // console.log(provinceId) |
| | | // console.log(provinceName) |
| | | // |
| | | // if(provinceName == null || provinceName == ''){ |
| | | // Feng.error("请选择省份!") |
| | | // return; |
| | | // } |
| | | // |
| | | // var city = document.getElementById('city'); |
| | | // var cityIndex= city.selectedIndex ; |
| | | // var cityId = city.options[cityIndex].value; |
| | | // var cityName = city.options[cityIndex].innerText; |
| | | // console.log(cityId) |
| | | // console.log(cityName) |
| | | // if(cityName == null || cityName == '' || cityName =='请选择'){ |
| | | // Feng.error("请选择市区!") |
| | | // return; |
| | | // } |
| | | // |
| | | // var district = document.getElementById('district'); |
| | | // var districtIndex= district.selectedIndex ; |
| | | // var districtId = district.options[districtIndex].value; |
| | | // var districtName = district.options[districtIndex].innerText; |
| | | // console.log(districtId) |
| | | // console.log(districtName) |
| | | // |
| | | // if(districtName == '' || districtName == null || districtName == '请选择'){ |
| | | // parent.$("#area").val(provinceName+'/'+cityName) |
| | | // parent.$("#areaId").val(provinceId+'/'+cityId) |
| | | // }else { |
| | | // parent.$("#area").val(provinceName+'/'+cityName+'/'+districtName) |
| | | // parent.$("#areaId").val(provinceId+'/'+cityId+'/'+districtId) |
| | | // } |
| | | // TAgentInfoDlg.close(); |
| | | } |
| | | |
| | | |
| | |
| | | message: '两次密码不一致' |
| | | }, |
| | | } |
| | | }, |
| | | merchantName: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '公司名称不能为空' |
| | | } |
| | | } |
| | | }, |
| | | businessScope: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '经营范围不能为空' |
| | | } |
| | | } |
| | | }, |
| | | socialCreditCode: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '统一社会信用码不能为空' |
| | | } |
| | | } |
| | | }, |
| | | socialCreditCodeExpires: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '统一社会信用证有效期不能为空' |
| | | } |
| | | } |
| | | }, |
| | | provCodeEnterprise: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '地区不能为空' |
| | | } |
| | | } |
| | | }, |
| | | cityCodeEnterprise: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '地区不能为空' |
| | | } |
| | | } |
| | | }, |
| | | areaCodeEnterprise: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '地区不能为空' |
| | | } |
| | | } |
| | | }, |
| | | address: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '企业详细地址不能为空' |
| | | } |
| | | } |
| | | }, |
| | | legalPerson: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '法人姓名不能为空' |
| | | } |
| | | } |
| | | }, |
| | | merchantIDCode: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '法人身份证号不能为空' |
| | | } |
| | | } |
| | | }, |
| | | certIdExpires: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '法人身份证有效期不能为空' |
| | | } |
| | | } |
| | | }, |
| | | legalPhone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '法人手机号不能为空' |
| | | } |
| | | } |
| | | }, |
| | | fileNo: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '营业执照扫描件不能为空' |
| | | } |
| | | } |
| | | }, |
| | | cardName: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '结算账户名不能为空' |
| | | } |
| | | } |
| | | }, |
| | | cardNo: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '结算账户号不能为空' |
| | | } |
| | | } |
| | | }, |
| | | phone: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '银行预留手机号不能为空' |
| | | } |
| | | } |
| | | }, |
| | | bankCode: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '银行名称不能为空' |
| | | } |
| | | } |
| | | }, |
| | | provCodeBank: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '开户行地区不能为空' |
| | | } |
| | | } |
| | | }, |
| | | cityCodeBank: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '开户行地区不能为空' |
| | | } |
| | | } |
| | | }, |
| | | areaCodeBank: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '开户行地区不能为空' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | .set('areaId') |
| | | .set('account') |
| | | .set('password') |
| | | .set('createTime'); |
| | | .set('createTime') |
| | | .set('userType') |
| | | .set('merchantName') |
| | | .set('businessScope') |
| | | .set('socialCreditCode') |
| | | .set('socialCreditCodeExpires') |
| | | .set('provCodeEnterprise') |
| | | .set('cityCodeEnterprise') |
| | | .set('areaCodeEnterprise') |
| | | .set('address') |
| | | .set('cardName') |
| | | .set('cardNo') |
| | | .set('bankAcctType') |
| | | .set('phone') |
| | | .set('legalPerson') |
| | | .set('merchantIDCode') |
| | | .set('certIdExpires') |
| | | .set('legalPhone') |
| | | .set('bankCode') |
| | | .set('provCodeBank') |
| | | .set('cityCodeBank') |
| | | .set('areaCodeBank'); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | if(this.tAgentInfoData.userType == 0){ |
| | | delete this.tAgentInfoData.socialCreditCodeExpires; |
| | | delete this.tAgentInfoData.certIdExpires; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){ |
| | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | |
| | | if(!this.validate()){ |
| | | return ; |
| | | var branchOfficeName = $('#branchOfficeName').val(); |
| | | var principal = $('#principal').val(); |
| | | var principalPhone = $('#principalPhone').val(); |
| | | var area = $('#area').val(); |
| | | if(null == branchOfficeName || '' == branchOfficeName){ |
| | | Feng.error("分公司名称不能为空"); |
| | | return |
| | | } |
| | | if(null == principal || '' == principal){ |
| | | Feng.error("负责人姓名不能为空"); |
| | | return |
| | | } |
| | | if(null == principalPhone || '' == principalPhone){ |
| | | Feng.error("联系电话不能为空"); |
| | | return |
| | | } |
| | | if(null == area || '' == area){ |
| | | Feng.error("代理区域不能为空"); |
| | | return |
| | | } |
| | | |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tBranchOffice/update", function(data){ |
| | |
| | | } |
| | | if(this.value == 2){ |
| | | $("#changeCouponSendQuantity").show() |
| | | // $("#couponSendQuantity").bind('input',function(){ |
| | | // var value = $(this).val() |
| | | // |
| | | // if(value>$("#couponCount").val()){ |
| | | // Feng.error("赠送数量必须小于限制数量") |
| | | // return; |
| | | // } |
| | | // }) |
| | | } |
| | | |
| | | }) |
| | |
| | | return; |
| | | } |
| | | |
| | | // if(couponType == 2 && $("input[name=couponCount2]").val() < 1){ |
| | | // Feng.info("新人优惠券限制数量必须大于0!") |
| | | // return; |
| | | // } |
| | | if(couponType == 2 && $("input[name=couponCount2]").val() < $("#couponSendQuantity").val()){ |
| | | Feng.info("赠送数量必须小于等于限制数量!") |
| | | return; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tCoupon/add", function(data){ |
| | |
| | | .set('approvalTime') |
| | | .set('serverStatus') |
| | | .set('integral') |
| | | .set('firstCertificateTime') |
| | | .set('status') |
| | | .set('area') |
| | | .set('areaId') |
| | |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | console.log(this.tDriverInfoData) |
| | | ajax.set(this.tDriverInfoData); |
| | | ajax.start(); |
| | | } |
| | |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | /** |
| | | * 后台取消订单 |
| | | */ |
| | | TOrder.cancelOrderUpdate = function () { |
| | | if (this.check()) { |
| | | |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | |
| | | var id = selected[0].id |
| | | var state = selected[0].state |
| | | |
| | | console.log(id) |
| | | console.log(state) |
| | | |
| | | if (state != 101 && state != 102 && state != 103 && state != 104 && state != 105 && state != 106 && state != 107) { |
| | | Feng.error("该订单当前状态不可取消!") |
| | | return; |
| | | } |
| | | var ajax = new $ax(Feng.ctxPath + "/tOrder/cancelOrderUpdate", function (data) { |
| | | Feng.success("取消订单成功!"); |
| | | TOrder.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("取消订单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("tOrderId", id); |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 订单信息导出 |
| | |
| | | reqData['num2'] = Number($("#num2").val()); |
| | | reqData['num3'] = Number($("#num3").val()); |
| | | reqData['num4'] = Number($("#num4").val()); |
| | | reqData['num5'] = Number($("#num5").val()); |
| | | // reqData['num5'] = Number($("#num5").val()); |
| | | ajax.set("content",JSON.stringify(reqData)); |
| | | ajax.set("type",1); |
| | | ajax.start(); |
| | |
| | | reqData['num4'] = $("#num4").val(); |
| | | reqData['num5'] = $("#num5").val(); |
| | | reqData['num6'] = $("#num6").val(); |
| | | reqData['num7'] = $("#num7").val(); |
| | | console.log(JSON.stringify(reqData)) |
| | | ajax.set("content",JSON.stringify(reqData)); |
| | | ajax.set("type",2); |
| | |
| | | var a ="<div>\n" + |
| | | " <div class=\"initialLevel col-sm-12 control-label form-group\" >\n" + |
| | | " <span class=\"control-label\" >时间段</span>\n" + |
| | | " <input class=\"control-label\" id=\"num1-"+i+"\" name=\"num1\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\">\n" + |
| | | " <input class=\"control-label time-item\" id=\"num1-"+i+"\" name=\"num1\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\" readonly>\n" + |
| | | " <span class=\"control-label\" >——</span>\n" + |
| | | " <input class=\"control-label\" id=\"num2-"+i+"\" name=\"num2\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\">\n" + |
| | | " <input class=\"control-label time-item\" id=\"num2-"+i+"\" name=\"num2\" type=\"text\" placeholder=\"00:00\" style=\"height: 30px;width: 80px\" readonly>\n" + |
| | | " <span class=\"control-label\" >代驾里程</span>\n" + |
| | | " <input class=\"control-label\" id=\"num3-"+i+"\" name=\"num3\" type=\"number\" style=\"height: 30px;width: 80px\">\n" + |
| | | " <span class=\"control-label\" >公里,起步价</span>\n" + |
| | |
| | | " </div>" |
| | | |
| | | $("#rules").append($(a)) |
| | | // laydate.render({ |
| | | // elem: '#num1-'+i, |
| | | // type: 'time', |
| | | // format: 'HH:mm', |
| | | // range: false, |
| | | // lang:'zn' |
| | | // }); |
| | | // laydate.render({ |
| | | // elem: '#num2-'+i, |
| | | // type: 'time', |
| | | // format: 'HH:mm', |
| | | // range: false, |
| | | // lang:'zn' |
| | | // }); |
| | | lay('.time-item').each(function(){ |
| | | laydate.render({ |
| | | elem: this, |
| | | type: 'time', |
| | | format: 'HH:mm', |
| | | range: false, |
| | | lang:'zn', |
| | | trigger: 'click' |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | TSystemConfig.delBox = function (o) { |
| | |
| | | field: 'rePassword', |
| | | message: '两次密码不一致' |
| | | }, |
| | | regexp: { |
| | | regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, |
| | | message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' |
| | | }, |
| | | // regexp: { |
| | | // regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, |
| | | // message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' |
| | | // }, |
| | | } |
| | | }, |
| | | rePassword: { |
| | |
| | | field: 'password', |
| | | message: '两次密码不一致' |
| | | }, |
| | | regexp: { |
| | | regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, |
| | | message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' |
| | | }, |
| | | // regexp: { |
| | | // regexp: /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/, |
| | | // message: '密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符' |
| | | // }, |
| | | } |
| | | } |
| | | } |
| | |
| | | Feng.error("新密码不能和原始密码相同"); |
| | | return |
| | | } |
| | | let patt = /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/; |
| | | if(!patt.test(newPwd)){ |
| | | Feng.error("密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符"); |
| | | return |
| | | } |
| | | // let patt = /(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,30}/; |
| | | // if(!patt.test(newPwd)){ |
| | | // Feng.error("密码中必须包含大小字母、数字、特称字符,至少8个字符,最多30个字符"); |
| | | // return |
| | | // } |
| | | var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) { |
| | | Feng.success("修改成功!"); |
| | | }, function (data) { |
| | |
| | | |
| | | String SECRET = "defaultSecret"; |
| | | |
| | | Long EXPIRATION = 604800L; |
| | | Long EXPIRATION = 94608000L;//365*3天 |
| | | |
| | | String AUTH_PATH = "/gunsApi/auth"; |
| | | |
| | |
| | | import com.supersavedriving.user.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.user.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.user.modular.system.util.huawei.SMSUtil; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/getUrlLink") |
| | | // @ServiceLog(name = "获取跳转微信url_link", url = "/base/appUser/appUserLogin") |
| | | @ApiOperation(value = "获取跳转微信url_link", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "跳转小程序路径", name = "path", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "跳转的附带参数", name = "query", required = false, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper<String> getUrlLink(String path, String query){ |
| | | try { |
| | | String urlLink = weChatUtil.getUrlLink(path, query, "release"); |
| | | return ResponseWarpper.success(urlLink); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!"); |
| | | return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9.5折优惠!"); |
| | | } |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/rechargeBalanceCallback") |
| | | // @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") |
| | | public void rechargeBalanceCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void rechargeBalanceCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | if(!"0000".equals(interfaceResponse.getCode())){ |
| | | System.err.println("充值回调异常:" + interfaceResponse.getMsg()); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | appUserService.rechargeBalanceCallback(orderId, merOrderId); |
| | |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | |
| | | // Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // String result = map.get("result"); |
| | | // String orderId = out_trade_no.substring(17); |
| | | // appUserService.rechargeBalanceCallback(out_trade_no, transaction_id); |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.print(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/driverRegister") |
| | | // @ServiceLog(name = "注册司机", url = "/api/user/driverRegister") |
| | | @ApiOperation(value = "注册司机", tags = {"用户端-登录注册"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper driverRegister(DriverRegisterWarpper driverRegisterWarpper){ |
| | | try { |
| | | Integer uid = appUserService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | ResultUtil resultUtil = driverService.driverRegister(uid, driverRegisterWarpper); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HHmm"); |
| | | Integer integer = Integer.valueOf(sdf.format(new Date())); |
| | | Date date = new Date(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | num1 = num1.replaceAll(":", ""); |
| | | num2 = num2.replaceAll(":", ""); |
| | | |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | if(integer >= Integer.valueOf(num1) && integer < Integer.valueOf(num2)){ |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | String[] split1 = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split1[0]); |
| | | |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | startPriceWarpper.setStartPrice(num4); |
| | | startPriceWarpper.setStartDistance(num3); |
| | | startPriceWarpper.setExcessMileageUnitPrice(num6); |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.AppUser; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | import com.supersavedriving.user.modular.system.model.Order; |
| | | import com.supersavedriving.user.modular.system.model.Revenue; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.Receive; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class OrderController { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(OrderController.class); |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<OrderPriceWarpper> queryOrderPrice(Long orderId){ |
| | | public ResponseWarpper<OrderPriceInfoWarpper> queryOrderPrice(Long orderId){ |
| | | if(null == orderId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | OrderPriceWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId); |
| | | OrderPriceInfoWarpper orderPriceWarpper = orderService.queryOrderPrice(uid, orderId); |
| | | return ResponseWarpper.success(orderPriceWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | /** |
| | | * 订单微信支付回调处理 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/orderPayCallback") |
| | | public void orderPayCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | public void orderPayCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | String parameter2 = jsonObject.getString("parameter2"); |
| | | if(2 == status){ |
| | | Order order = orderService.selectById(orderId); |
| | | AccountChangeDetail accountChangeDetail = accountChangeDetailService.selectById(parameter2); |
| | | Double m = new BigDecimal(accountChangeDetail.getOldData()).subtract(new BigDecimal(accountChangeDetail.getNewData())).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | AppUser appUser1 = appUserService.selectById(order.getUserId()); |
| | | appUser1.setAccountBalance(new BigDecimal(appUser1.getAccountBalance()).add(new BigDecimal(m)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | appUserService.updateById(appUser1); |
| | | accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | System.err.println("支付失败"); |
| | | } |
| | | if(1 == status){ |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | ResultUtil resultUtil = orderService.orderPayCallback(orderId, merOrderId); |
| | | if(resultUtil.getCode() == 10000){ |
| | | response.setStatus(200); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | } |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | |
| | | |
| | | // Map<String, String> map = payMoneyUtil.weixinpayCallback(request); |
| | | // if(null != map){ |
| | | // String out_trade_no = map.get("out_trade_no"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // String result = map.get("result"); |
| | | // String orderId = out_trade_no.substring(17); |
| | | // ResultUtil resultUtil = orderService.orderPayCallback(orderId, transaction_id); |
| | | // if(resultUtil.getCode() == 10000){ |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.print(result); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | // } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 异步分账回调 |
| | | * 转账回调 |
| | | * @param execute |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/ledgerCallback") |
| | | public void ledgerCallback(HttpServletRequest request, HttpServletResponse response){ |
| | | @PostMapping("/base/order/zhaunzhangCallback") |
| | | public void zhaunzhangCallback(@RequestBody InterfaceResponse execute, HttpServletResponse response){ |
| | | try{ |
| | | String code = request.getParameter("code"); |
| | | String version = request.getParameter("version"); |
| | | String msg = request.getParameter("msg"); |
| | | String date = request.getParameter("date"); |
| | | String result = request.getParameter("result"); |
| | | String sign = request.getParameter("sign"); |
| | | InterfaceResponse interfaceResponse = new InterfaceResponse(); |
| | | interfaceResponse.setCode(code); |
| | | interfaceResponse.setVersion(version); |
| | | interfaceResponse.setMsg(msg); |
| | | interfaceResponse.setDate(date); |
| | | interfaceResponse.setResult(result); |
| | | interfaceResponse.setSign(sign); |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String orderId = jsonObject.getString("parameter1"); |
| | | //确认收货 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order = orderService.selectById(orderId); |
| | | List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("userType", 2).eq("orderId", order.getId())); |
| | | Receive receive = new Receive();//确认收货 |
| | | receive.setOriginalMerOrderId(merOrderId); |
| | | receive.setRcvAmount(String.valueOf(order.getPayMoney() * 100)); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | for (Revenue revenue : revenues) { |
| | | Driver driver = driverService.selectById(revenue.getUserId()); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(driver.getMerchantNumber()); |
| | | receiveUser.setRcvSplitAmount(revenue.getAmount().toString()); |
| | | splitList.add(receiveUser); |
| | | } |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(receive, Receive.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | System.err.println("确认收货" + execute.getMsg()); |
| | | } |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | System.err.println("确认收货失败"); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(2 == status){ |
| | | logger.warn("转账失败"); |
| | | return; |
| | | } |
| | | if("0".equals(status)){ |
| | | System.err.println("确认收货处理中"); |
| | | } |
| | | } |
| | | }, 30000); |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | RechargeRecord rechargeRecord = rechargeRecordService.selectById(parameter1); |
| | | |
| | | |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }else{ |
| | | logger.warn("转账失败:" + execute.getMsg()); |
| | | return; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 异步分账回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/order/ledgerCallback") |
| | | public void ledgerCallback(@RequestBody InterfaceResponse execute, HttpServletResponse response){ |
| | | try{ |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(execute.content(), execute.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(2 == status){ |
| | | logger.warn("异步分账回调异常"); |
| | | return; |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String divisionRecordId = jsonObject.getString("parameter1"); |
| | | DivisionRecord divisionRecord = divisionRecordService.selectById(divisionRecordId); |
| | | if(divisionRecord.getState() == 2){ |
| | | |
| | | } |
| | | |
| | | //确认收货 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Receive receive = new Receive();//确认收货 |
| | | receive.setOriginalMerOrderId(merOrderId); |
| | | receive.setRcvAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(divisionRecord.getMerchantNumber()); |
| | | receiveUser.setRcvSplitAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request1 = new TrhRequest(); |
| | | InterfaceResponse execute = request1.execute(receive, Receive.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getCode())){ |
| | | logger.warn("确认收货" + execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | logger.warn("确认收货失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | logger.warn("确认收货处理中"); |
| | | } |
| | | } |
| | | }, 60000); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | |
| | | String appid = req.getParameter("appid"); |
| | | String sign = req.getParameter("sign"); |
| | | ResultUtil resultUtil = authService.checkSyncAuth(appid, sign, req); |
| | | if (resultUtil.getCode() != 200) { |
| | | if (resultUtil.getCode() != 10000) { |
| | | res.setStatus(HttpStatus.OK.value()); |
| | | res.setHeader("Content-type", "text/html;charset=UTF-8"); |
| | | res.getWriter().print(JSON.toJSONString(resultUtil));//Res.Failure("req timeout, please try again") |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/8/3 14:20 |
| | | */ |
| | | public interface BranchOfficeMapper extends BaseMapper<BranchOffice> { |
| | | } |
New file |
| | |
| | | <?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.supersavedriving.user.modular.system.dao.BranchOfficeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.BranchOffice"> |
| | | <id column="id" property="id"/> |
| | | <result column="agentId" property="agentId"/> |
| | | <result column="principal" property="principal"/> |
| | | <result column="principalPhone" property="principalPhone"/> |
| | | <result column="email" property="email"/> |
| | | <result column="provinceCode" property="provinceCode"/> |
| | | <result column="provinceName" property="provinceName"/> |
| | | <result column="cityCode" property="cityCode"/> |
| | | <result column="cityName" property="cityName"/> |
| | | <result column="districtCode" property="districtCode"/> |
| | | <result column="districtName" property="districtName"/> |
| | | <result column="status" property="status"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | ifnull(DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y'), 0) as driverAge, |
| | | (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber, |
| | | b.score as driverScore, |
| | | a.payType, |
| | | a.state, |
| | | UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, |
| | | c.score as evaluationScore, |
| | |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <result column="agentId" property="agentId" /> |
| | | <result column="surplusDividedAmount" property="surplusDividedAmount"/> |
| | | </resultMap> |
| | | </mapper> |
| | |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 负责人姓名 |
| | | */ |
| | | @TableField("principal") |
| | | @TableField(value = "principal") |
| | | private String principal; |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @TableField("principalPhone") |
| | | @TableField(value = "principalPhone") |
| | | private String principalPhone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | @TableField(value = "email") |
| | | private String email; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | @TableField(value = "provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField(value = "provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | @TableField(value = "cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 代理区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | @TableField(value = "cityName") |
| | | private String cityName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | @TableField(value = "status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | @TableField(value = "createTime") |
| | | private Date createTime; |
| | | /** |
| | | * 开户银行 |
| | | */ |
| | | @TableField("bankDeposit") |
| | | private String bankDeposit; |
| | | /** |
| | | * 银行账号 |
| | | */ |
| | | @TableField("bankAccount") |
| | | private String bankAccount; |
| | | /** |
| | | * 客服电话 |
| | | */ |
| | | @TableField("serviceCalls") |
| | | @TableField(value = "serviceCalls") |
| | | private String serviceCalls; |
| | | /** |
| | | * 商户类型(1=个体工商户,2=企业) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 公司名称 |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | /** |
| | | * 经营范围 |
| | | */ |
| | | @TableField("businessScope") |
| | | private String businessScope; |
| | | /** |
| | | * 统一社会信用码 |
| | | */ |
| | | @TableField("socialCreditCode") |
| | | private String socialCreditCode; |
| | | /** |
| | | * 统一社会信用证有效期 |
| | | */ |
| | | @TableField("socialCreditCodeExpires") |
| | | private Date socialCreditCodeExpires; |
| | | /** |
| | | * 企业注册省编号 |
| | | */ |
| | | @TableField("provCodeEnterprise") |
| | | private String provCodeEnterprise; |
| | | /** |
| | | * 企业注册市编号 |
| | | */ |
| | | @TableField("cityCodeEnterprise") |
| | | private String cityCodeEnterprise; |
| | | /** |
| | | * 企业注册区编号 |
| | | */ |
| | | @TableField("areaCodeEnterprise") |
| | | private String areaCodeEnterprise; |
| | | /** |
| | | * 企业注册详细地址 |
| | | */ |
| | | @TableField("address") |
| | | private String address; |
| | | /** |
| | | * 法人姓名 |
| | | */ |
| | | @TableField("legalPerson") |
| | | private String legalPerson; |
| | | /** |
| | | * 法人身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 法人身份证有效期 |
| | | */ |
| | | @TableField("certIdExpires") |
| | | private Date certIdExpires; |
| | | /** |
| | | * 法人手机号 |
| | | */ |
| | | @TableField("legalPhone") |
| | | private String legalPhone; |
| | | /** |
| | | * 附件编号 |
| | | */ |
| | | @TableField("fileNo") |
| | | private String fileNo; |
| | | /** |
| | | * 结算账户名 |
| | | */ |
| | | @TableField("cardName") |
| | | private String cardName; |
| | | /** |
| | | * 结算账户号 |
| | | */ |
| | | @TableField("cardNo") |
| | | private String cardNo; |
| | | /** |
| | | * 银行账户类型(1=对公,2=对私) |
| | | */ |
| | | @TableField("bankAcctType") |
| | | private Integer bankAcctType; |
| | | /** |
| | | * 银行预留手机号 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 开户行编号 |
| | | */ |
| | | @TableField("bankCode") |
| | | private String bankCode; |
| | | /** |
| | | * 开户行地区省编号 |
| | | */ |
| | | @TableField("provCodeBank") |
| | | private String provCodeBank; |
| | | /** |
| | | * 开户行地区市编号 |
| | | */ |
| | | @TableField("cityCodeBank") |
| | | private String cityCodeBank; |
| | | /** |
| | | * 开户行地区区编号 |
| | | */ |
| | | @TableField("areaCodeBank") |
| | | private String areaCodeBank; |
| | | /** |
| | | * 商户号 |
| | | */ |
| | | @TableField("merchantNumber") |
| | | private String merchantNumber; |
| | | /** |
| | | * 商户姓名 |
| | | * 商户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("merchantName") |
| | | private String merchantName; |
| | | @TableField("merchantStatus") |
| | | private Integer merchantStatus; |
| | | /** |
| | | * 商户电话 |
| | | * 结算账户状态(0=审核中,1=已成功,2=审核失败) |
| | | */ |
| | | @TableField("merchantPhone") |
| | | private String merchantPhone; |
| | | /** |
| | | * 商户身份证号码 |
| | | */ |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | @TableField("bankStatus") |
| | | private Integer bankStatus; |
| | | } |
| | |
| | | @TableField("cancelCount") |
| | | private Integer cancelCount; |
| | | /** |
| | | * 是否拥有9折优惠 1是 0否 |
| | | * 是否拥有9.5折优惠 1是 0否 |
| | | */ |
| | | @TableField("havDiscount") |
| | | private Integer havDiscount; |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分公司实体 |
| | | * @author pzb |
| | | * @Date 2023/2/3 14:13 |
| | | */ |
| | | @Data |
| | | @TableName("t_branch_office") |
| | | public class BranchOffice { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 负责人姓名 |
| | | */ |
| | | @TableField("principal") |
| | | private String principal; |
| | | /** |
| | | * 负责人电话 |
| | | */ |
| | | @TableField("principalPhone") |
| | | private String principalPhone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | private String email; |
| | | /** |
| | | * 代理区域省编号 |
| | | */ |
| | | @TableField("provinceCode") |
| | | private String provinceCode; |
| | | /** |
| | | * 代理区域省名称 |
| | | */ |
| | | @TableField("provinceName") |
| | | private String provinceName; |
| | | /** |
| | | * 代理区域市编号 |
| | | */ |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | /** |
| | | * 代理区域市名称 |
| | | */ |
| | | @TableField("cityName") |
| | | private String cityName; |
| | | /** |
| | | * 代理区域区编号 |
| | | */ |
| | | @TableField("districtCode") |
| | | private String districtCode; |
| | | /** |
| | | * 代理区域区名称 |
| | | */ |
| | | @TableField("districtName") |
| | | private String districtName; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("status") |
| | | private Integer status; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | * 优惠券数量 |
| | | */ |
| | | @TableField("coupon_count") |
| | | private Integer couponCount; |
| | | private Long couponCount; |
| | | /** |
| | | * 剩余数量 |
| | | */ |
| | | @TableField("remaining_quantity") |
| | | private Integer remainingQuantity; |
| | | private Long remainingQuantity; |
| | | } |
| | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 分账记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/5/6 15:54 |
| | | */ |
| | |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 充值记录id |
| | | */ |
| | | @TableField("rechargeRecordId") |
| | | private Integer rechargeRecordId; |
| | | /** |
| | | * 第三方分账业务订单id |
| | | */ |
| | | @TableField("merOrderId") |
| | |
| | | */ |
| | | @TableField("openOrderQRCode") |
| | | private Integer openOrderQRCode; |
| | | /** |
| | | * 司机推荐二维码 |
| | | */ |
| | | @TableField("referralCode") |
| | | private String referralCode; |
| | | } |
| | |
| | | @TableField("overLongDistancePrice") |
| | | private Double overLongDistancePrice; |
| | | /** |
| | | * 等待时长(分钟) |
| | | * 等待时长(s) |
| | | */ |
| | | @TableField("waitTime") |
| | | private Integer waitTime; |
| | |
| | | @TableField("waitTimePrice") |
| | | private Double waitTimePrice; |
| | | /** |
| | | * 超出等待时长(分钟) |
| | | * 超出等待时长(s) |
| | | */ |
| | | @TableField("outWaitTime") |
| | | private Integer outWaitTime; |
| | |
| | | @TableField("discount") |
| | | private Double discount; |
| | | /** |
| | | * 支付类型(1=微信支付,2=余额支付,3=线下支付) |
| | | * 支付类型(1=微信支付,2=余额支付,3=线下支付,4=微信+余额) |
| | | */ |
| | | @TableField("payType") |
| | | private Integer payType; |
| | |
| | | @TableField("payTime") |
| | | private Date payTime; |
| | | /** |
| | | * 微信支付金额 |
| | | */ |
| | | @TableField("weChatPayment") |
| | | private Double weChatPayment; |
| | | /** |
| | | * 账户余额支付金额 |
| | | */ |
| | | @TableField("balancePayment") |
| | | private Double balancePayment; |
| | | /** |
| | | * 微信支付剩余未分账金额 |
| | | */ |
| | | @TableField("residueWeChatPayment") |
| | | private Double residueWeChatPayment; |
| | | /** |
| | | * 余额支付剩余未分账金额 |
| | | */ |
| | | @TableField("residueBalancePayment") |
| | | private Double residueBalancePayment; |
| | | /** |
| | | * 第三方支付流水号 |
| | | */ |
| | | @TableField("orderNo") |
| | |
| | | @TableField("amount") |
| | | private Double amount; |
| | | /** |
| | | * 未分配金额 |
| | | */ |
| | | @TableField("unallocatedAmount") |
| | | private Double unallocatedAmount; |
| | | /** |
| | | * 支付方式(1=微信,2=系统充值) |
| | | */ |
| | | @TableField("payType") |
| | |
| | | */ |
| | | @TableField("agentId") |
| | | private Integer agentId; |
| | | /** |
| | | * 剩余待分账金额 |
| | | */ |
| | | @TableField("surplusDividedAmount") |
| | | private Double surplusDividedAmount; |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/8/3 14:22 |
| | | */ |
| | | public interface IBranchOfficeService extends IService<BranchOffice> { |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | |
| | | import java.util.List; |
| | |
| | | * @throws Exception |
| | | */ |
| | | List<NearbyDriverWarpper> queryDriverPosition(String lon, String lat, Double scope) throws Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 司机注册 |
| | | * @param driverRegisterWarpper |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil driverRegister(Integer uid, DriverRegisterWarpper driverRegisterWarpper) throws Exception; |
| | | } |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception; |
| | | OrderPriceInfoWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception; |
| | | |
| | | |
| | | /** |
| | |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.PaymentOrder; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.PaymentOrderGood; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.QueryOrder; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.Transfer; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.user.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.user.modular.system.util.RedisUtil; |
| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | |
| | | if(token.length() > 16){ |
| | | key = token.substring(token.length() - 16); |
| | | } |
| | | redisUtil.setStrValue(key, appUser.getId().toString(), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue(key, appUser.getId().toString(), 94608000); |
| | | redisUtil.setStrValue("USER_" + appUser.getPhone(), key, 94608000); |
| | | return token; |
| | | } |
| | | return null; |
| | |
| | | @Override |
| | | public ResultUtil<SignInToRegisterWarpper> signInToRegister(SignInToRegister signInToRegister) throws Exception { |
| | | SignInToRegisterWarpper warpper = new SignInToRegisterWarpper(); |
| | | try { |
| | | if(ToolUtil.isEmpty(signInToRegister.getJscode())){ |
| | | return ResultUtil.paranErr("jscode"); |
| | | } |
| | |
| | | appUser.setStatus(1); |
| | | appUser.setCreateTime(new Date()); |
| | | appUser.setIsException(1); |
| | | if(null != signInToRegister.getInviterId()){ |
| | | appUser.setInviterId(signInToRegister.getInviterId()); |
| | | appUser.setInviterType(signInToRegister.getInviterType()); |
| | | } |
| | | this.insert(appUser); |
| | | //发送优惠券 |
| | | boolean lock = redisUtil.lock(); |
| | | boolean lock = redisUtil.lock(5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(lock){ |
| | | List<CouponWarpper> list = pushCoupon(appUser.getId()); |
| | | redisUtil.unlock(); |
| | |
| | | return ResultUtil.error("获取身份凭证失败"); |
| | | } |
| | | warpper.setToken(token); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | redisUtil.unlock(); |
| | | } |
| | | return ResultUtil.success(warpper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转账 |
| | | * @param id |
| | | * @param merOrderId |
| | | * @param toUserId |
| | | * @param amount |
| | | * @param notifyUrl |
| | | * @return |
| | | */ |
| | | public ResultUtil zhaunzhang(Integer id, String merOrderId, String toUserId, Double amount, String notifyUrl){ |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId(merOrderId); |
| | | transfer.setToUserId(toUserId); |
| | | transfer.setAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | transfer.setOrderName("补贴"); |
| | | transfer.setNotifyUrl(notifyUrl); |
| | | transfer.setParameter1(id.toString()); |
| | | TrhRequest<Transfer> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(transfer, Transfer.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理;1:成功;2:失败 |
| | | if(2 == status){ |
| | | System.err.println("转账失败"); |
| | | return ResultUtil.error("转账失败"); |
| | | } |
| | | return ResultUtil.success(); |
| | | }else{ |
| | | System.err.println("转账失败:" + execute.getMsg()); |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | .eq("coupon_state", 1).eq("status", 1).gt("remaining_quantity", 0)); |
| | | List<CouponWarpper> list = new ArrayList<>(); |
| | | for (Coupon coupon : coupons) { |
| | | Long num = coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? |
| | | coupon.getRemainingQuantity() : coupon.getCouponSendQuantity(); |
| | | for (int i = 0; i < num; i++) { |
| | | UserToCoupon userToCoupon = new UserToCoupon(); |
| | | userToCoupon.setCouponId(coupon.getId()); |
| | | userToCoupon.setCreateTime(new Date()); |
| | | userToCoupon.setUserId(userId); |
| | | userToCoupon.setStatus(1); |
| | | userToCoupon.setCouponTotal(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? |
| | | coupon.getRemainingQuantity() : coupon.getCouponSendQuantity()); |
| | | userToCoupon.setValidCount(userToCoupon.getCouponTotal()); |
| | | userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity() * 24 * 60 * 60 * 1000))); |
| | | userToCoupon.setCouponTotal(1); |
| | | userToCoupon.setValidCount(1); |
| | | userToCoupon.setExpireTime(new Date(System.currentTimeMillis() + (coupon.getCouponValidity().longValue() * 24L * 60L * 60L * 1000L))); |
| | | userToCouponService.insert(userToCoupon); |
| | | |
| | | coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 : |
| | | coupon.getRemainingQuantity() - coupon.getCouponSendQuantity()); |
| | | couponService.updateById(coupon); |
| | | |
| | | CouponWarpper couponWarpper = new CouponWarpper(); |
| | | couponWarpper.setCouponConditionalAmount(coupon.getCouponConditionalAmount()); |
| | |
| | | couponWarpper.setNumber(userToCoupon.getValidCount()); |
| | | couponWarpper.setExpirationDate(userToCoupon.getExpireTime().getTime()); |
| | | list.add(couponWarpper); |
| | | } |
| | | coupon.setRemainingQuantity(coupon.getCouponSendQuantity() > coupon.getRemainingQuantity() ? 0 : |
| | | coupon.getRemainingQuantity() - coupon.getCouponSendQuantity()); |
| | | couponService.updateById(coupon); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | return ResultUtil.error("充值金额必须大于0"); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); |
| | | String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | AppUser appUser = this.selectById(uid); |
| | | RechargeRecord rechargeRecord = new RechargeRecord(); |
| | | rechargeRecord.setType(1); |
| | |
| | | rechargeRecord.setPayStatus(1); |
| | | rechargeRecord.setPayType(1); |
| | | rechargeRecordService.insert(rechargeRecord); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/appUser/rechargeBalanceCallback", "JSAPI", appUser.getOpenid()); |
| | | // return weixinpay; |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(amount * 100)); |
| | | paymentOrder.setOrderName("余额充值"); |
| | | paymentOrder.setAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | paymentOrder.setOrderName("账户充值"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | paymentOrderGood.setGoodsName("余额充值"); |
| | | paymentOrderGood.setGoodsName("账户充值"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setFrontUrl(callbackPath + "/base/appUser/rechargeBalanceCallback"); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/appUser/rechargeBalanceCallback"); |
| | | paymentOrder.setParameter1(out_trade_no); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | RechargeRecord rechargeRecord1 = rechargeRecordService.selectOne(new EntityWrapper<RechargeRecord>().eq("code", out_trade_no)); |
| | | if(rechargeRecord1.getPayStatus() != 1){ |
| | | return; |
| | | } |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | queryOrder.setQueryType("1"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | AppUser appUser1 = AppUserServiceImpl.this.selectById(rechargeRecord1.getUserId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser1.getId()); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setChangeType(3); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("账户充值"); |
| | | accountChangeDetail.setOldData(appUser1.getAccountBalance()); |
| | | appUser1.setAccountBalance(new BigDecimal(appUser1.getAccountBalance()).add(new BigDecimal(rechargeRecord1.getAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(appUser1.getAccountBalance()); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | Double num2 = JSON.parseObject(systemConfig.getContent()).getDouble("num2"); |
| | | if(appUser1.getHavDiscount() == 0 && rechargeRecord1.getAmount().compareTo(num2) >= 0){ |
| | | appUser1.setHavDiscount(1); |
| | | } |
| | | AppUserServiceImpl.this.updateById(appUser1); |
| | | |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(merOrderId); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | break; |
| | | } |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | rechargeRecordService.deleteById(rechargeRecord1.getId()); |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return ResultUtil.success(payCode); |
| | | } |
| | | |
| | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(rechargeRecord1.getUserId()); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setChangeType(3); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("余额充值"); |
| | | accountChangeDetail.setOldData(appUser.getAccountBalance()); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() + rechargeRecord1.getAmount()); |
| | | appUser.setAccountBalance(new BigDecimal(appUser.getAccountBalance()).add(new BigDecimal(rechargeRecord1.getAmount())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | this.updateById(appUser); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); |
| | | Double num2 = JSON.parseObject(systemConfig.getContent()).getDouble("num2"); |
| | | if(appUser.getHavDiscount() == 0 && rechargeRecord1.getAmount().compareTo(num2) >= 0){ |
| | | appUser.setHavDiscount(1); |
| | | } |
| | | this.updateById(appUser); |
| | | |
| | | rechargeRecord1.setPayTime(new Date()); |
| | | rechargeRecord1.setPayStatus(2); |
| | | rechargeRecord1.setOrderNumber(transaction_id); |
| | | rechargeRecord1.setSurplusDividedAmount(rechargeRecord1.getAmount()); |
| | | rechargeRecordService.updateById(rechargeRecord1); |
| | | } |
| | | |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.modular.system.dao.BranchOfficeMapper; |
| | | import com.supersavedriving.user.modular.system.model.BranchOffice; |
| | | import com.supersavedriving.user.modular.system.service.IBranchOfficeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/8/3 14:22 |
| | | */ |
| | | @Service |
| | | public class BranchOfficeServiceImpl extends ServiceImpl<BranchOfficeMapper, BranchOffice> implements IBranchOfficeService { |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.DriverMapper; |
| | | import com.supersavedriving.user.modular.system.model.Driver; |
| | | import com.supersavedriving.user.modular.system.model.DriverWork; |
| | | import com.supersavedriving.user.modular.system.service.IDriverService; |
| | | import com.supersavedriving.user.modular.system.service.IDriverWorkService; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.GeodesyUtil; |
| | | import com.supersavedriving.user.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.user.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.user.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.user.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.user.modular.system.warpper.NearbyDriverWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.geo.Circle; |
| | |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.InputStream; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @Autowired |
| | | private IBranchOfficeService branchOfficeService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取5公里范围内的司机 |
| | |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | // System.err.println("附近空闲司机" + JSON.toJSONString(locations)); |
| | | List<Integer> collect = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return list; |
| | | } |
| | | List<Driver> drivers = this.selectList(new EntityWrapper<Driver>().in("id", collect).eq("approvalStatus", 2).eq("serverStatus", 1).eq("status", 1)); |
| | | collect = drivers.stream().map(Driver::getId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return list; |
| | | } |
| | | List<DriverWork> driverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", collect).eq("status", 1)); |
| | | for (DriverWork driverWork : driverWorks) { |
| | | String value = redisUtil.getValue("DRIVER" + driverWork.getDriverId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | NearbyDriverWarpper nearbyDriverWarpper = new NearbyDriverWarpper(); |
| | | nearbyDriverWarpper.setLonLat(value); |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, lon + "," + lat); |
| | |
| | | nearbyDriverWarpper.setDriverId(driverWork.getDriverId()); |
| | | list.add(nearbyDriverWarpper); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册司机 |
| | | * @param uid |
| | | * @param driverRegisterWarpper |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil driverRegister(Integer uid, DriverRegisterWarpper driverRegisterWarpper) throws Exception { |
| | | Driver driver = this.selectOne(new EntityWrapper<Driver>().eq("phone", driverRegisterWarpper.getPhone()).ne("status", 3)); |
| | | if(null != driver && driver.getStatus() == 2){ |
| | | return ResultUtil.error("该手机账号已被冻结,请联系管理员。"); |
| | | } |
| | | if(null != driver && driver.getApprovalStatus() == 1){ |
| | | return ResultUtil.error("该手机账号正在审核中。"); |
| | | } |
| | | if(null != driver && driver.getApprovalStatus() == 2){ |
| | | return ResultUtil.error("该手机账号已审核通过,请直接登录。"); |
| | | } |
| | | |
| | | //账号审核拒绝后的处理 |
| | | if(null != driver && driver.getApprovalStatus() == 3){ |
| | | try { |
| | | driver = setDriverParamete(driver, driverRegisterWarpper); |
| | | }catch (Exception e){ |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | this.updateAllColumnById(driver); |
| | | } |
| | | |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | //新账号 |
| | | if(null == driver){ |
| | | driver = new Driver(); |
| | | driver.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | try { |
| | | driver = setDriverParamete(driver, driverRegisterWarpper); |
| | | }catch (Exception e){ |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | |
| | | driver.setCreateTime(new Date()); |
| | | driver.setInviterId(appUser.getInviterId()); |
| | | driver.setInviterType(appUser.getInviterType()); |
| | | this.insert(driver); |
| | | String s = wechatMiniProgramORCode(driver.getId()); |
| | | driver.setReferralCode(s); |
| | | this.updateById(driver); |
| | | |
| | | |
| | | //司机邀请注册奖励 |
| | | if(null != driver.getInviterId()){ |
| | | Driver driver1 = this.selectById(driver.getInviterId()); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | if(null != systemConfig){ |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | if(num7 > 0){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | driver1.setIntegral(driver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请司机注册奖励"); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | this.updateById(driver1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 组装个人信息 |
| | | * @param driver |
| | | * @param driverRegisterWarpper |
| | | * @return |
| | | */ |
| | | public Driver setDriverParamete(Driver driver, DriverRegisterWarpper driverRegisterWarpper) throws Exception{ |
| | | driver.setAvatar(driverRegisterWarpper.getAvatar()); |
| | | driver.setName(driverRegisterWarpper.getName()); |
| | | driver.setPhone(driverRegisterWarpper.getPhone()); |
| | | driver.setEmergencyContact(driverRegisterWarpper.getEmergencyContact()); |
| | | driver.setEmergencyPhone(driverRegisterWarpper.getEmergencyPhone()); |
| | | driver.setIdcardBack(driverRegisterWarpper.getIdcardBack()); |
| | | driver.setIdcardFront(driverRegisterWarpper.getIdcardFront()); |
| | | driver.setDriverLicense(driverRegisterWarpper.getDriverLicense()); |
| | | if(ToolUtil.isNotEmpty(driverRegisterWarpper.getFirstCertificateTime())){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | driver.setFirstCertificateTime(sdf.parse(driverRegisterWarpper.getFirstCertificateTime())); |
| | | } |
| | | //注册地 |
| | | String code = driverRegisterWarpper.getCode(); |
| | | BranchOffice branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("districtCode", code).eq("status", 1)); |
| | | if(null == branchOffice){ |
| | | branchOffice = branchOfficeService.selectOne(new EntityWrapper<BranchOffice>().eq("cityCode", code).eq("status", 1)); |
| | | if(null == branchOffice){ |
| | | throw new Exception("该区域无服务商"); |
| | | } |
| | | } |
| | | driver.setBranchOfficeId(branchOffice.getId()); |
| | | driver.setAgentId(branchOffice.getAgentId()); |
| | | driver.setProvinceCode(branchOffice.getProvinceCode()); |
| | | driver.setProvinceName(branchOffice.getProvinceName()); |
| | | driver.setCityName(branchOffice.getCityName()); |
| | | driver.setCityCode(branchOffice.getCityCode()); |
| | | driver.setAreaCode(branchOffice.getDistrictCode()); |
| | | driver.setAreaName(branchOffice.getDistrictName()); |
| | | if(null != driverRegisterWarpper.getInviterId()){ |
| | | driver.setInviterType(driverRegisterWarpper.getInviterType()); |
| | | driver.setInviterId(driverRegisterWarpper.getInviterId()); |
| | | } |
| | | driver.setApprovalStatus(1); |
| | | driver.setApprovalNotes(""); |
| | | driver.setApprovalTime(null); |
| | | driver.setApprovalUserId(null); |
| | | driver.setStatus(1); |
| | | driver.setSource(driverRegisterWarpper.getSource()); |
| | | return driver; |
| | | } |
| | | |
| | | |
| | | |
| | | //生成小程序二维码 |
| | | public String wechatMiniProgramORCode(Integer driverId) throws Exception{ |
| | | InputStream release = weChatUtil.getwxacodeunlimit("pages/index/index", "driverId=" + driverId, "release"); |
| | | String s = OBSUtil.putObjectToBucket(release, "driver_" + driverId); |
| | | return s; |
| | | } |
| | | } |
| | |
| | | import com.supersavedriving.user.modular.system.util.juhe.WeatherUtil; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import io.swagger.models.auth.In; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | */ |
| | | @Service |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | |
| | | @Autowired |
| | | private IDivisionRecordService divisionRecordService; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Value("${wx.appletsAppid}") |
| | | private String appletsAppid; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order = getOrderPrice(1, d, 0, new Order(), city); |
| | | Order order1 = new Order(); |
| | | order1.setCreateTime(new Date()); |
| | | Order order = getOrderPrice(1, d, 0, order1, city); |
| | | Double estimatedPrice = order.getEstimatedPrice(); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); |
| | | if(null != coupon){ |
| | |
| | | int i = 0; |
| | | Double scope = 5D; |
| | | while (true){ |
| | | List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getLng().toString(), estimatedCosts.getLat().toString(), scope); |
| | | List<NearbyDriverWarpper> nearbyDriverWarppers = driverService.queryDriverPosition(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString(), scope); |
| | | if(nearbyDriverWarppers.size() == 0){ |
| | | scope += 5; |
| | | i++; |
| | |
| | | } |
| | | return ResultUtil.success(estimatedCostsWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | Date date = order.getCreateTime(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) {//计算各个时段 |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | |
| | | Double num11 = jsonObject1.getDouble("num11");//超过num8每num10公里收取num11 |
| | | |
| | | String[] split = num1.split(":"); |
| | | Integer hour1 = Integer.valueOf(split[0]); |
| | | String[] split1 = num2.split(":"); |
| | | Integer hour2 = Integer.valueOf(split1[0]); |
| | | |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.HOUR_OF_DAY, hour1); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.HOUR_OF_DAY, hour2); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split1[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(hour1 > hour2){ |
| | | if(s.getTimeInMillis() > date.getTime()){ |
| | | s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1); |
| | | }else{ |
| | | e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1); |
| | | } |
| | | } |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | if(num3.compareTo(distance) >= 0){//起步里程内 |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | }else{ |
| | | BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num3));//超出起步里程 |
| | | BigDecimal divide = subtract.divide(new BigDecimal(num5), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | Double distance1 = distance;//原始里程 |
| | | order.setStartDistance(num3);//起步里程 |
| | | order.setStartPrice(num4);//起步价 |
| | | order.setOverDriveDistance(subtract.doubleValue());//超出起步里程 |
| | | order.setOverDriveDistance(new BigDecimal(distance1 - num3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//超出起步里程 |
| | | |
| | | distance = new BigDecimal(distance).setScale(0, RoundingMode.UP).doubleValue();//向上取整 |
| | | BigDecimal divide = new BigDecimal(distance - num3).divide(new BigDecimal(num5), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply = divide.multiply(new BigDecimal(num6)); |
| | | order.setOverDrivePrice(multiply.doubleValue());//超出起步里程费 |
| | | |
| | | //计算长途费 |
| | | //计算长途费(超出长途起始公里,费用开始按照长途规则计算。) |
| | | if(distance.compareTo(num7) > 0){ |
| | | order.setStartDistance(0D);//起步里程 |
| | | order.setStartPrice(0D);//起步价 |
| | | order.setOverDriveDistance(0D);//超出起步里程 |
| | | order.setOverDrivePrice(0D);//超出起步里程费 |
| | | |
| | | order.setLongDistance(num7 + "-" + num8);//长途里程 |
| | | order.setLongDistancePrice(num9);//长途费 |
| | | } |
| | | //计算长途里程超出的部分 |
| | | if(distance.compareTo(num8) > 0){ |
| | | BigDecimal subtract1 = new BigDecimal(distance).subtract(new BigDecimal(num8)); |
| | | BigDecimal divide1 = subtract1.divide(new BigDecimal(num10), new MathContext(2, RoundingMode.HALF_EVEN)); |
| | | order.setOverLongDistance(new BigDecimal(distance1 - num8).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//超出长途里程 |
| | | |
| | | BigDecimal divide1 = new BigDecimal(distance - num8).divide(new BigDecimal(num10), 2, BigDecimal.ROUND_HALF_EVEN); |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num11)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | |
| | | Double num9 = extraCost.getDouble("num9");//恶劣天气最高收取金额 |
| | | |
| | | //等待费用 |
| | | if(waitTime.compareTo(num1) >= 0){ |
| | | order.setWaitTime(num1);//等待时长 |
| | | if(waitTime.compareTo(num1 * 60) >= 0){ |
| | | order.setWaitTime(num1 * 60);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | Integer w = waitTime - (num1 * 60); |
| | | BigDecimal multiply = new BigDecimal(w).divide(new BigDecimal(60), 0, RoundingMode.UP).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | | } |
| | |
| | | order.setLongDistancePrice(0D);//长途里程费 |
| | | order.setOverLongDistance(0D);//超出长途里程 |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | order.setWaitTime(0);//等待时长 |
| | | // order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order.setCreateTime(new Date()); |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | | if(null != travelOrder.getDriverId()){ |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); |
| | |
| | | |
| | | for (Integer i = 0; i < travelOrder.getDriverNum(); i++) { |
| | | order.setId(null); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3)); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(5)); |
| | | boolean insert = this.insert(order); |
| | | if(insert){ |
| | | //推送状态 |
| | |
| | | * 订单推送逻辑 |
| | | */ |
| | | public void pushOrder(Long orderId){ |
| | | try { |
| | | Order order = this.selectById(orderId); |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | boolean lock = redisUtil.lock(5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | | while (num1 <= 10){ |
| | | Thread.sleep(3000);//等待3秒 |
| | | lock = redisUtil.lock(5); |
| | | if(lock){ |
| | | break; |
| | | }else{ |
| | | num1++; |
| | | } |
| | | } |
| | | } |
| | | if(!lock){ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | redisUtil.unlock(); |
| | | } |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | redisUtil.unlock(); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | |
| | | YouTuiDriver youTuiDriver1 = null; |
| | | if(driverIds.size() > 0){ |
| | | List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds) |
| | | .eq("state", 2).last(" and (surplusQuantity > 0 or now() < endTime) and now() < failureTime")); |
| | | .eq("state", 2).last(" and surplusQuantity > 0 and now() < endTime and now() < failureTime")); |
| | | Double d = null; |
| | | for (YouTuiDriver youTuiDriver : youTuiDrivers) { |
| | | String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); |
| | |
| | | continue; |
| | | } |
| | | Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1){ |
| | | int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", youTuiDriver.getDriverId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(driver1.getServerStatus() == 2 || driver1.getOpenOrderQRCode() == 1 || count > 0){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); |
| | |
| | | if(ToolUtil.isEmpty(value)){ |
| | | continue; |
| | | } |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | continue; |
| | | } |
| | | int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", driver1.getId()).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); |
| | | if(count > 0){ |
| | | continue; |
| | | } |
| | | |
| | | if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 |
| | | integral = driver1.getIntegral(); |
| | | score = driver1.getScore(); |
| | |
| | | } |
| | | |
| | | if(null != driver){ |
| | | //防止多笔订单推给一个司机 |
| | | Driver driver1 = driverService.selectById(driver); |
| | | driver1.setServerStatus(2); |
| | | driverService.updateById(driver1); |
| | | pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); |
| | | //创建定时任务处理订单到大厅 |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | if(order1.getState() != 101 && order1.getState() != 201 && order1.getState() != 301 && order1.getDriverId().compareTo(driver1.getId()) != 0){ |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | if(order1.getState() == 201 || order1.getState() == 301 || (order1.getState() == 101 && null == order1.getDriverId())){ |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | } |
| | | if(order1.getState() == 201 || (order1.getState() == 101 && null == order1.getDriverId())){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | ExtraPushOrder(order); |
| | | } |
| | | } |
| | | }, num4 * 1000); |
| | | }else{ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | } |
| | | redisUtil.unlock(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | redisUtil.unlock(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public void ExtraPushOrder(Order order){ |
| | | String startLat = order.getStartLat(); |
| | | String startLng = order.getStartLng(); |
| | | |
| | | //找到中心点 |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); |
| | | Double num = 5D;//范围公里 |
| | | //构造半径 |
| | | Distance distanceR = new Distance(num, Metrics.KILOMETERS); |
| | | //画圆 |
| | | Circle circle = new Circle(geoJsonPoint, distanceR); |
| | | // 构造query对象 |
| | | Query query = Query.query(Criteria.where("location").withinSphere(circle)); |
| | | List<Location> locations = mongoTemplate.find(query, Location.class); |
| | | List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); |
| | | if(driverIds.size() == 0){ |
| | | return; |
| | | } |
| | | List<DriverWork> tDriverWorks = driverWorkService.selectList(new EntityWrapper<DriverWork>().in("driverId", driverIds).eq("status", 1)); |
| | | driverIds = tDriverWorks.stream().map(DriverWork::getDriverId).collect(Collectors.toList()); |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2) |
| | | .eq("serverStatus", 1).eq("openOrderQRCode", 0).eq("status", 1).in("id", driverIds)); |
| | | if(drivers.size() == 0){ |
| | | return; |
| | | } |
| | | for (Driver driver1 : drivers) { |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if (ToolUtil.isEmpty(value)) { |
| | | continue; |
| | | } |
| | | pushUtil.pushGrabOrderExtras(driver1.getId(), 2); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | cancelOrderService.insert(cancelOrder); |
| | | order.setState(301); |
| | | this.updateById(order); |
| | | redisUtil.delSetValue("orderService", order.getId().toString()); |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setCancelCount(appUser.getCancelCount() + 1); |
| | | if(appUser.getCancelCount() >= 3){ |
| | |
| | | @Override |
| | | public ResultUtil editOrderEndAddress(Integer uid, EditOrderEndAddress editOrderEndAddress) throws Exception { |
| | | Order order = this.selectById(editOrderEndAddress.getOrderId()); |
| | | |
| | | String endAddress = editOrderEndAddress.getEndAddress(); |
| | | endAddress = endAddress.replaceAll("& #40;", "("); |
| | | endAddress = endAddress.replaceAll("& #41;", ")"); |
| | | editOrderEndAddress.setEndAddress(endAddress); |
| | | |
| | | order.setEndAddress(editOrderEndAddress.getEndAddress()); |
| | | order.setEndLat(editOrderEndAddress.getEndLat().toString()); |
| | | order.setEndLng(editOrderEndAddress.getEndLng().toString()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderPriceWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception { |
| | | public OrderPriceInfoWarpper queryOrderPrice(Integer uid, Long orderId) throws Exception { |
| | | Order order = this.selectById(orderId); |
| | | OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); |
| | | BeanUtils.copyProperties(order, orderPriceWarpper); |
| | | orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); |
| | | OrderPriceInfoWarpper orderPriceWarpper = new OrderPriceInfoWarpper(); |
| | | orderPriceWarpper.setStartTime(order.getArrivalTimeAtTheAppointmentPoint().getTime()); |
| | | orderPriceWarpper.setEndTime(order.getGetoffTime().getTime()); |
| | | orderPriceWarpper.setActualMileage(Double.valueOf(order.getActualMileage()) / 1000); |
| | | if(null != order.getStartPrice() && 0 != order.getStartPrice()){ |
| | | orderPriceWarpper.setStartPrice(order.getStartPrice()); |
| | | orderPriceWarpper.setStartDistance(order.getStartDistance()); |
| | | orderPriceWarpper.setOverDriveDistance(order.getOverDriveDistance()); |
| | | orderPriceWarpper.setMileageFee(order.getOverDrivePrice()); |
| | | }else{ |
| | | String[] split = order.getLongDistance().split("-"); |
| | | orderPriceWarpper.setStartPrice(order.getLongDistancePrice()); |
| | | orderPriceWarpper.setStartDistance(Double.valueOf(split[1])); |
| | | orderPriceWarpper.setOverDriveDistance(order.getOverLongDistance()); |
| | | orderPriceWarpper.setMileageFee(order.getOverLongDistancePrice()); |
| | | } |
| | | Integer waitTime = order.getWaitTime() + order.getOutWaitTime(); |
| | | Integer s = waitTime % 60; |
| | | int m = Double.valueOf(waitTime / 60).intValue(); |
| | | orderPriceWarpper.setWaitTime((m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s)); |
| | | orderPriceWarpper.setWaitTimePrice(order.getWaitTimePrice() + order.getOutWaitTimePrice()); |
| | | orderPriceWarpper.setDiscountAmount(order.getDiscountAmount()); |
| | | orderPriceWarpper.setDiscountedPrice(order.getDiscountedPrice()); |
| | | orderPriceWarpper.setBadWeatherPrice(order.getBadWeatherPrice()); |
| | | orderPriceWarpper.setPayMoney(order.getPayMoney()); |
| | | orderPriceWarpper.setOrderMoney(order.getOrderMoney()); |
| | | if(order.getState() < 107){ |
| | | orderPriceWarpper.setPayMoney(order.getOrderMoney()); |
| | | } |
| | | return orderPriceWarpper; |
| | | } |
| | | |
| | |
| | | orderPriceWarpper.setBalance(appUser.getAccountBalance()); |
| | | orderPriceWarpper.setDiscount(0D); |
| | | orderPriceWarpper.setDiscountAmount(0D); |
| | | orderPriceWarpper.setPayType(1);//微信支付 |
| | | orderPriceWarpper.setPayType(order.getPayType());//微信支付 |
| | | if(null == order.getPayType() && -1 == payType){ |
| | | orderPriceWarpper.setPayType(1); |
| | | payType = 0; |
| | | } |
| | | Double orderMoney = order.getOrderMoney(); |
| | | //先算优惠券 |
| | | // Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | // if(null != coupon && null == couponId){ |
| | | // orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | // orderPriceWarpper.setCouponId(coupon.getId()); |
| | | // } |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, orderMoney); |
| | | if(null != coupon && null == couponId){ |
| | | orderPriceWarpper.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | orderPriceWarpper.setCouponId(coupon.getId()); |
| | | } |
| | | if(payType == 1 && null == couponId && appUser.getHavDiscount() == 1 && balance.compareTo(orderMoney) >= 0){//使用余额抵扣 |
| | | orderPriceWarpper.setDiscount(9D); |
| | | orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderMoney = new BigDecimal(orderMoney * 0.9).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | orderPriceWarpper.setDiscount(9.5D); |
| | | orderPriceWarpper.setDiscountAmount(new BigDecimal(orderMoney * 0.05).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | orderMoney = new BigDecimal(orderMoney * 0.95).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | } |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | |
| | | return ResultUtil.error("不允许支付"); |
| | | } |
| | | if(orderPayment.getPayType() == 2){ |
| | | Double payMoney = order.getOrderMoney() * (appUser.getHavDiscount() == 1 ? 0.9 : 1); |
| | | Double payMoney = order.getOrderMoney() * (appUser.getHavDiscount() == 1 ? 0.95 : 1); |
| | | if(appUser.getAccountBalance() < payMoney){ |
| | | return ResultUtil.error("账户余额不足"); |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | userToCouponService.updateById(userToCoupon); |
| | | } |
| | | } |
| | | Double payMoney = order.getPayMoney(); |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | // this.updateById(order); |
| | | |
| | | |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(payMoney * 100)); |
| | | paymentOrder.setAmount(new BigDecimal(payMoney).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | paymentOrder.setOrderName("代驾服务费"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(""); |
| | | paymentOrder.setAppid(appletsAppid); |
| | | paymentOrder.setOpenid(appUser.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | |
| | | paymentOrderGood.setGoodsName("服务费"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setFrontUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setParameter1(order.getId().toString()); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | this.updateById(order); |
| | | |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() != 107){ |
| | | return; |
| | | } |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | queryOrder.setQueryType("1"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | ResultUtil resultUtil = orderPayCallback(order1.getId().toString(), merOrderId); |
| | | |
| | | break; |
| | | } |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | return ResultUtil.success(payCode); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public ResultUtil balancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | } |
| | | } |
| | | |
| | | if(appUser.getHavDiscount() == 1){//9折 |
| | | payMoney = payMoney * 0.9; |
| | | order.setDiscount(9D); |
| | | order.setDiscountAmount(payMoney * 0.1); |
| | | Double payMoney = order.getPayMoney(); |
| | | if(appUser.getHavDiscount() == 1){//9.5折 |
| | | order.setDiscount(9.5D); |
| | | order.setDiscountAmount(payMoney * 0.05); |
| | | payMoney = payMoney * 0.95; |
| | | } |
| | | |
| | | order.setPayType(2); |
| | |
| | | |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | |
| | | accountChangeDetail.setChangeType(2); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() - payMoney); |
| | | appUser.setAccountBalance(new BigDecimal(appUser.getAccountBalance()).subtract(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | //处理佣金和收入记录 |
| | | saveCommission(order); |
| | | saveCommissionYE(order); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinAndBalancePayment(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | Double payMoney = order.getOrderMoney(); |
| | | if(null != couponId){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(couponId); |
| | | if(userToCoupon.getValidCount() > 0){ |
| | | userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); |
| | | userToCouponService.updateById(userToCoupon); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | payMoney = payMoney - coupon.getCouponPreferentialAmount(); |
| | | order.setCouponId(coupon.getId()); |
| | | order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); |
| | | } |
| | | } |
| | | Double payMoney = order.getPayMoney(); |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | |
| | | payMoney = payMoney > appUser.getAccountBalance() ? payMoney - appUser.getAccountBalance() : 0D; |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(1); |
| | | accountChangeDetail.setUserId(appUser.getId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | |
| | | accountChangeDetail.setChangeType(2); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); |
| | | |
| | | Double wx_p = 0D; |
| | | if(payMoney.compareTo(appUser.getAccountBalance()) > 0){//支付金额大于账户余额 |
| | | wx_p = new BigDecimal(payMoney).subtract(new BigDecimal(appUser.getAccountBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | order.setBalancePayment(appUser.getAccountBalance()); |
| | | order.setWeChatPayment(wx_p); |
| | | appUser.setAccountBalance(0D); |
| | | }else{ |
| | | order.setBalancePayment(payMoney); |
| | | order.setWeChatPayment(0D); |
| | | appUser.setAccountBalance(new BigDecimal(appUser.getAccountBalance()).subtract(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | } |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | if(0 < payMoney){//还需要调起微信支付 |
| | | order.setResidueBalancePayment(order.getBalancePayment()); |
| | | order.setResidueWeChatPayment(order.getWeChatPayment()); |
| | | |
| | | if(0 < wx_p){//还需要调起微信支付 |
| | | order.setPayType(4); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | // ResultUtil weixinpay = payMoneyUtil.weixinpay("代驾服务费", "", out_trade_no, payMoney.toString(), "/base/order/orderPayCallback", "JSAPI", appUser.getOpenid()); |
| | | |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setBizOrderId(out_trade_no); |
| | | paymentOrder.setAmount(String.valueOf(payMoney * 100)); |
| | | paymentOrder.setAmount(new BigDecimal(wx_p).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | paymentOrder.setOrderName("代驾服务费"); |
| | | paymentOrder.setPayType("WX_MINI"); |
| | | paymentOrder.setTransferType("0"); |
| | | paymentOrder.setAsynSplitFlag("1"); |
| | | paymentOrder.setAppid(""); |
| | | paymentOrder.setAppid(appletsAppid); |
| | | paymentOrder.setOpenid(appUser.getOpenid()); |
| | | paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | |
| | | paymentOrderGood.setGoodsName("服务费"); |
| | | goodsDetail.add(paymentOrderGood); |
| | | paymentOrder.setGoodsDetail(goodsDetail); |
| | | paymentOrder.setFrontUrl(""); |
| | | paymentOrder.setFrontUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | paymentOrder.setParameter1(order.getId().toString()); |
| | | paymentOrder.setParameter2(accountChangeDetail.getId().toString()); |
| | | |
| | | TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | if(!"0000".equals(execute.getCode())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String payCode = jsonObject.getString("payCode"); |
| | | this.updateById(order); |
| | | return ResultUtil.success(payCode); |
| | | |
| | | // TODO: 2023/5/18 取消支付后需要处理优惠券数据回退 |
| | | // |
| | | // |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // int num = 1; |
| | | // int wait = 0; |
| | | // while (num <= 10){ |
| | | // int min = 5000; |
| | | // wait += (min * num); |
| | | // Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | // if(order1.getState() != 107){ |
| | | // return; |
| | | // } |
| | | // |
| | | // /** |
| | | // * SUCCESS--支付成功 |
| | | // * REFUND--转入退款 |
| | | // * NOTPAY--未支付 |
| | | // * CLOSED--已关闭 |
| | | // * REVOKED--已撤销(刷卡支付) |
| | | // * USERPAYING--用户支付中 |
| | | // * PAYERROR--支付失败(其他原因,如银行返回失败) |
| | | // * ACCEPT--已接收,等待扣款 |
| | | // */ |
| | | // ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(out_trade_no, ""); |
| | | // if(resultUtil.getCode() == 200){ |
| | | // Map<String, String> map = resultUtil.getData(); |
| | | // String trade_type = map.get("trade_type"); |
| | | // String trade_state = map.get("trade_state"); |
| | | // String transaction_id = map.get("transaction_id"); |
| | | // if("REFUND".equals(trade_state) || "NOTPAY".equals(trade_state) || "CLOSED".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){ |
| | | // AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); |
| | | // AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); |
| | | // Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); |
| | | // appUser1.setAccountBalance(appUser1.getAccountBalance() + b); |
| | | // appUserService.updateById(appUser1); |
| | | // |
| | | // accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | // return; |
| | | // } |
| | | // if("SUCCESS".equals(trade_state)){ |
| | | // order1.setPayTime(new Date()); |
| | | // order1.setState(108); |
| | | // order1.setOrderNo(transaction_id); |
| | | // OrderServiceImpl.this.updateById(order1); |
| | | // |
| | | // //处理抽成及收入 |
| | | // saveCommission(order1); |
| | | // return; |
| | | // } |
| | | // if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // }else{ |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // if(10 == num){ |
| | | // AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); |
| | | // AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); |
| | | // Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); |
| | | // appUser1.setAccountBalance(appUser1.getAccountBalance() + b); |
| | | // appUserService.updateById(appUser1); |
| | | // |
| | | // accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }).start(); |
| | | // return weixinpay; |
| | | if(ToolUtil.isNotEmpty(payCode)){ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 10){ |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() != 107){ |
| | | return; |
| | | } |
| | | // order.setPayTime(new Date()); |
| | | // this.updateById(order); |
| | | QueryOrder queryOrder = new QueryOrder(); |
| | | queryOrder.setOriginalMerOrderId(merOrderId); |
| | | queryOrder.setQueryType("1"); |
| | | TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("0".equals(status1)){//待处理 |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | if("1".equals(status1)){//成功 |
| | | String merOrderId = jsonObject1.getString("merOrderId"); |
| | | ResultUtil resultUtil = orderPayCallback(order1.getId().toString(), merOrderId); |
| | | |
| | | break; |
| | | } |
| | | if("2".equals(status1) || 10 == num){//失败 |
| | | Double m = accountChangeDetail.getOldData() - accountChangeDetail.getNewData(); |
| | | AppUser appUser1 = appUserService.selectById(order1.getUserId()); |
| | | appUser1.setAccountBalance(new BigDecimal(appUser1.getAccountBalance()).add(new BigDecimal(m)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | appUserService.updateById(appUser1); |
| | | accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | break; |
| | | } |
| | | }else{ |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | return ResultUtil.success(payCode); |
| | | }else{ |
| | | order.setPayType(2); |
| | | order.setPayTime(new Date()); |
| | | order.setState(108); |
| | | this.updateById(order); |
| | | |
| | | //处理佣金和收入记录 |
| | | saveCommissionYE(order); |
| | | } |
| | | return ResultUtil.success(); |
| | | |
| | | } |
| | |
| | | order.setOrderNo(transaction_id); |
| | | this.updateById(order); |
| | | //添加收入明细 |
| | | saveCommission(order); |
| | | if(order.getPayType() == 4){ |
| | | saveCommissionWXANDYU(order); |
| | | } |
| | | if(order.getPayType() == 1){ |
| | | saveCommissionWX(order); |
| | | } |
| | | |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); |
| | | if(null != order.getDriverId()) { |
| | |
| | | pushOrderInfoWarpper.setState(order.getState()); |
| | | pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); |
| | | } |
| | | |
| | | //支付成功---->异步分账----->10s钟后再进行确认收货 |
| | | //确认收货后才能进行提现(结算接口) |
| | | //异步分账 |
| | | List<Revenue> revenues = revenueService.selectList(new EntityWrapper<Revenue>().eq("orderId", order.getId())); |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(transaction_id); |
| | | complete.setNotifyUrl(callbackPath + "/base/order/ledgerCallback"); |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | for (Revenue revenue : revenues) { |
| | | if(revenue.getUserType() == 2){//司机 |
| | | Driver driver = driverService.selectById(revenue.getUserId()); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(driver.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); |
| | | pamentOrderUser.setSplitType("2"); |
| | | splitList.add(pamentOrderUser); |
| | | |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(1); |
| | | divisionRecord.setUserId(revenue.getUserId()); |
| | | divisionRecord.setOrderId(order.getId()); |
| | | divisionRecord.setMerOrderId(transaction_id); |
| | | divisionRecord.setSourceType(1); |
| | | divisionRecord.setAmount(revenue.getAmount()); |
| | | divisionRecord.setMerchantNumber(driver.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | } |
| | | if(revenue.getUserType() == 3){//代理商 |
| | | Agent agent = agentService.selectById(revenue.getUserId()); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(agent.getMerchantNumber()); |
| | | pamentOrderUser.setSplitAmount(revenue.getAmount().toString()); |
| | | pamentOrderUser.setSplitType("2"); |
| | | splitList.add(pamentOrderUser); |
| | | |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(2); |
| | | divisionRecord.setUserId(revenue.getUserId()); |
| | | divisionRecord.setOrderId(order.getId()); |
| | | divisionRecord.setMerOrderId(transaction_id); |
| | | divisionRecord.setSourceType(1); |
| | | divisionRecord.setAmount(revenue.getAmount()); |
| | | divisionRecord.setMerchantNumber(agent.getMerchantNumber()); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | } |
| | | |
| | | } |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE); |
| | | if(!"0000".equals(execute.getResult())){ |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | if("2".equals(status)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | |
| | | //使用优惠券的情况,通过转账接口将优惠券的收入转到司机电子账簿 |
| | | if(null != order.getCouponId()){ |
| | | List<PlatformRechargeRecord> platformRechargeRecords = platformRechargeRecordService.selectList(new EntityWrapper<PlatformRechargeRecord>().eq("state", 2).last(" and balance > 0 order by payTime")); |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | |
| | | |
| | | for (PlatformRechargeRecord platformRechargeRecord : platformRechargeRecords) { |
| | | if(discountedPrice == 0){ |
| | | break; |
| | | } |
| | | |
| | | if(platformRechargeRecord.getBalance().compareTo(discountedPrice) >= 0){ |
| | | discountedPrice = 0D; |
| | | platformRechargeRecord.setBalance(platformRechargeRecord.getBalance() - discountedPrice); |
| | | platformRechargeRecordService.updateById(platformRechargeRecord); |
| | | }else{ |
| | | |
| | | } |
| | | |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId("6831518911582834611"); |
| | | transfer.setToUserId(driver.getMerchantNumber()); |
| | | transfer.setAmount(discountedPrice.toString()); |
| | | transfer.setOrderName(""); |
| | | transfer.setNotifyUrl(""); |
| | | transfer.setParameter1(order.getId().toString()); |
| | | |
| | | TrhRequest<Transfer> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(transfer, Transfer.SERVICE_CODE); |
| | | if(!"0000".equals(execute1.getResult())){ |
| | | return ResultUtil.error(execute1.getMsg()); |
| | | } |
| | | JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | String status1 = jsonObject1.getString("status"); |
| | | if("2".equals(status1)){ |
| | | return ResultUtil.error("失败"); |
| | | } |
| | | if("0".equals(status1)){ |
| | | return ResultUtil.error("处理中"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | if(null != systemConfig){ |
| | | //{"num1":"10:00","num2":"14:00","num3":10,"num4":10,"num5":10,"num6":10,"num7":10,"num8":10,"num9":5,"num10":5} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num5 = jsonObject.getInteger("num5"); |
| | | Integer num5 = jsonObject.getInteger("num6"); |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | |
| | | |
| | | //增加积分变动记录 |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(order.getDriverId()); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | |
| | | |
| | | |
| | | /** |
| | | * 处理订单收入及分佣抽成 |
| | | * 微信支付分佣 |
| | | * @param order |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public void saveCommission(Order order) throws Exception{ |
| | | //司机收入和代理商抽成(先分佣,后抽成) |
| | | //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 |
| | | public void saveCommissionWX(Order order) throws Exception{ |
| | | saveGiveaway(order);//处理分佣 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | //司机订单收入 |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(order.getPayMoney() + order.getDiscountedPrice() + order.getDiscountAmount()); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(1); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getPayMoney())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | //订单收入 |
| | | fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), null, order.getOrderNo(), order.getPayMoney(), 1); |
| | | |
| | | if(null != order.getCouponId()){ |
| | | accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getDiscountedPrice())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(order.getDiscountedPrice()) >= 0){ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | discountedPrice = new BigDecimal(discountedPrice).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 处理分佣 |
| | | * @param order |
| | | */ |
| | | public void saveGiveaway(Order order) throws Exception{ |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | Double payMoney = order.getPayMoney(); |
| | | |
| | | //首单积分奖励 |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(107, 108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig1.getContent()); |
| | | Integer num4 = jsonObject2.getInteger("num4"); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("邀请用户首单积分奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setIntegral(driver1.getIntegral() + num4); |
| | | accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | | driverService.updateById(driver1); |
| | | } |
| | | |
| | | |
| | | |
| | | //todo 司机订单收入归并到佣金中一起提现 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | Double num2 = jsonObject.getDouble("num2"); |
| | | Double num3 = jsonObject.getDouble("num3"); |
| | | if(order.getPayMoney() >= num2){ |
| | | payMoney = payMoney - num3;//司机收入 |
| | | if(order.getOrderMoney().compareTo(num2) >= 0){//订单金额大于num2开始分佣 |
| | | AccountChangeDetail accountChangeDetail1 = new AccountChangeDetail(); |
| | | accountChangeDetail1.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail1.setUserType(2); |
| | | accountChangeDetail1.setUserId(driver.getId()); |
| | | accountChangeDetail1.setType(1); |
| | | accountChangeDetail1.setChangeType(9); |
| | | accountChangeDetail1.setOrderId(order.getId()); |
| | | accountChangeDetail1.setOldData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setExplain("订单信息费"); |
| | | accountChangeDetail1.setCreateTime(new Date()); |
| | | driver.setBalance(new BigDecimal(driver.getBalance()).subtract(new BigDecimal(num3)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setNewData(new BigDecimal(driver.getBalance()).add(new BigDecimal(driver.getBackgroundBalance())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail1); |
| | | |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); |
| | | if(null != systemConfig1){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); |
| | | //司机推荐首单收入 |
| | | List<Integer> state = Arrays.asList(108, 109); |
| | | int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | //司机推荐用户收入 |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2){ |
| | | Double num1 = jsonObject1.getDouble("num1"); |
| | | num1 = (num3 >= num1 ? num1 : num3); |
| | | |
| | | if(num1 > 0){ |
| | | Driver driver1 = driverService.selectById(appUser.getInviterId()); |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("邀请用户奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | |
| | | revenue.setAmount(num1); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | //司机充值记录分账 |
| | | Double num1_1 = num1; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num1_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num1_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num1_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | num3 = (num3 >= num1 ? num3 - num1 : 0); |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num1_1 = new BigDecimal(num1_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num1 ? v : 0); |
| | | } |
| | | |
| | | //开始处理层级抽佣 |
| | | if(null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | if(num3 > 0 && null != driver & null != driver.getInviterType() && driver.getInviterType() == 2){ |
| | | Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 |
| | | if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ |
| | | Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num5); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num5)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num5 ? num3 - num5 : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num5_1 = num5; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num5_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num5_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num5_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num5_1 = new BigDecimal(num5_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num5)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num5 ? v : 0); |
| | | } |
| | | num6 = (num3 >= num6 ? num6 : num3); |
| | | if(num6 > 0 && null != driver2){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num6); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driver2.setCommission(new BigDecimal(driver2.getCommission()).add(new BigDecimal(num6)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num6 ? num3 - num6 : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num6_1 = num6; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num6_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num6_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num6_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num6_1 = new BigDecimal(num6_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num6)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num6 ? v : 0); |
| | | } |
| | | num7 = (num3 >= num7 ? num7 : num3); |
| | | if(num7 > 0 && null != driver3){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver3.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver3.getCouponBalance()).add(new BigDecimal(driver3.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver3.setCommission(driver3.getCommission() + num7); |
| | | accountChangeDetail.setNewData(driver3.getBalance() + driver3.getBackgroundBalance() + driver3.getCouponBalance() + driver3.getCommission()); |
| | | driver3.setCommission(new BigDecimal(driver3.getCommission()).add(new BigDecimal(num7)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver3.getCouponBalance()).add(new BigDecimal(driver3.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver3); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num7 ? num3 - num7 : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num7_1 = num7; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num7_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver3.getId(), driver3.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num7_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num7_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver3.getId(), driver3.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num7_1 = new BigDecimal(num7_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num7)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num7 ? v : 0); |
| | | } |
| | | }else{ |
| | | Double num3_ = jsonObject1.getDouble("num3"); |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num3_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num3_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num3_ ? num3 - num3_ : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num3_1 = num3_; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num3_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num3_ ? v : 0); |
| | | } |
| | | num4 = (num3 >= num4 ? num4 : num3); |
| | | if(num4 > 0 && null != driver2){ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver2.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver2.setCommission(driver2.getCommission() + num4); |
| | | accountChangeDetail.setNewData(driver2.getBalance() + driver2.getBackgroundBalance() + driver2.getCouponBalance() + driver2.getCommission()); |
| | | driver2.setCommission(new BigDecimal(driver2.getCommission()).add(new BigDecimal(num4)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver2.getCouponBalance()).add(new BigDecimal(driver2.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver2); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num4 ? num3 - num4 : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num4_1 = num4; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num4_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num4_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num4_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver2.getId(), driver2.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num4_1 = new BigDecimal(num4_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num4)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num4 ? v : 0); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver1.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("订单分佣收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num2_); |
| | | accountChangeDetail.setNewData(driver1.getBalance() + driver1.getBackgroundBalance() + driver1.getCouponBalance() + driver1.getCommission()); |
| | | driver1.setCommission(new BigDecimal(driver1.getCommission()).add(new BigDecimal(num2_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver1.getCouponBalance()).add(new BigDecimal(driver1.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver1); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | num3 = (num3 >= num2_ ? num3 - num2_ : 0); |
| | | |
| | | //司机充值记录分账 |
| | | Double num2_1 = num2_; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num2_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num2_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num2_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver1.getId(), driver1.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num2_1 = new BigDecimal(num2_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | double v = new BigDecimal(num3).subtract(new BigDecimal(num2_)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | num3 = (num3 >= num2_ ? v : 0); |
| | | } |
| | | } |
| | | } |
| | |
| | | revenue.setAmount(num3); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | Agent agent = agentService.selectById(driver.getAgentId()); |
| | | //司机充值记录分账 |
| | | Double num3_1 = num3; |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 2).eq("userId", driver.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(2, agent.getId(), agent.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(2, agent.getId(), agent.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 余额支付分账 |
| | | * @param order |
| | | * @throws Exception |
| | | */ |
| | | public void saveCommissionYE(Order order) throws Exception{ |
| | | saveGiveaway(order);//分佣 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | //司机订单收入 |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(payMoney + order.getDiscountedPrice()); |
| | | revenue.setAmount(order.getPayMoney() + order.getDiscountedPrice());//todo 折扣司机承担 |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail1 = new AccountChangeDetail(); |
| | | accountChangeDetail1.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail1.setUserType(2); |
| | | accountChangeDetail1.setUserId(driver.getId()); |
| | | accountChangeDetail1.setType(1); |
| | | accountChangeDetail1.setChangeType(1); |
| | | accountChangeDetail1.setOrderId(order.getId()); |
| | | accountChangeDetail1.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getPayMoney())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setExplain("订单收入"); |
| | | accountChangeDetail1.setCreateTime(new Date()); |
| | | accountChangeDetail1.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail1); |
| | | |
| | | //用户充值记录分账 |
| | | Double num3_1 = order.getPayMoney(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 1).eq("userId", appUser.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3_1, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(2, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if(null != order.getCouponId()){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setExplain("订单收入"); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getDiscountedPrice())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver.setBalance(driver.getBalance() + payMoney); |
| | | if(null != order.getCouponId()){ |
| | | driver.setCouponBalance(driver.getCouponBalance() + order.getDiscountedPrice()); |
| | | } |
| | | accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | List<RechargeRecord> rechargeRecords1 = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords1) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(order.getDiscountedPrice()) >= 0){ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | discountedPrice = new BigDecimal(discountedPrice).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | // TODO: 2023/6/25 折扣优惠由司机承担 |
| | | // if(null != order.getDiscountAmount() && 0 < order.getDiscountAmount()){ |
| | | // AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | // accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | // accountChangeDetail.setUserType(2); |
| | | // accountChangeDetail.setUserId(driver.getId()); |
| | | // accountChangeDetail.setType(1); |
| | | // accountChangeDetail.setChangeType(1); |
| | | // accountChangeDetail.setOrderId(order.getId()); |
| | | // accountChangeDetail.setOldData(driver.getCouponBalance() + driver.getCommission()); |
| | | // driver.setCommission(driver.getCommission() + order.getDiscountAmount()); |
| | | // accountChangeDetail.setExplain("折扣优惠收入"); |
| | | // accountChangeDetail.setCreateTime(new Date()); |
| | | // accountChangeDetail.setNewData(driver.getCouponBalance() + driver.getCommission()); |
| | | // driverService.updateById(driver); |
| | | // accountChangeDetailService.saveData(accountChangeDetail); |
| | | // //补贴中分账 |
| | | // Double discountedPrice = order.getDiscountAmount(); |
| | | // List<RechargeRecord> rechargeRecords1 = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | // for (RechargeRecord rechargeRecord : rechargeRecords1) { |
| | | // Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | // if(surplusDividedAmount.compareTo(order.getDiscountAmount()) >= 0){ |
| | | // ResultUtil zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | // if(10000 == zhaunzhang.getCode()){ |
| | | // rechargeRecord.setSurplusDividedAmount(rechargeRecord.getSurplusDividedAmount() - discountedPrice); |
| | | // rechargeRecordService.updateById(rechargeRecord); |
| | | // } |
| | | // break; |
| | | // }else{ |
| | | // ResultUtil zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | // if(10000 == zhaunzhang.getCode()){ |
| | | // rechargeRecord.setSurplusDividedAmount(0D); |
| | | // rechargeRecordService.updateById(rechargeRecord); |
| | | // discountedPrice -= surplusDividedAmount; |
| | | // }else{ |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信+余额支付分账 |
| | | * @param order |
| | | * @throws Exception |
| | | */ |
| | | public void saveCommissionWXANDYU(Order order) throws Exception{ |
| | | saveGiveaway(order);//分佣 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | AppUser appUser = appUserService.selectById(order.getUserId()); |
| | | //司机订单收入 |
| | | Revenue revenue = new Revenue(); |
| | | revenue.setType(1); |
| | | revenue.setUserType(2); |
| | | revenue.setUserId(driver.getId()); |
| | | revenue.setOrderId(order.getId()); |
| | | revenue.setAmount(order.getPayMoney() + order.getDiscountedPrice() + order.getDiscountAmount()); |
| | | revenue.setCreateTime(new Date()); |
| | | revenueService.insert(revenue); |
| | | |
| | | AccountChangeDetail accountChangeDetail1 = new AccountChangeDetail(); |
| | | accountChangeDetail1.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail1.setUserType(2); |
| | | accountChangeDetail1.setUserId(driver.getId()); |
| | | accountChangeDetail1.setType(1); |
| | | accountChangeDetail1.setChangeType(1); |
| | | accountChangeDetail1.setOrderId(order.getId()); |
| | | accountChangeDetail1.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getPayMoney())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail1.setExplain("订单收入"); |
| | | accountChangeDetail1.setCreateTime(new Date()); |
| | | accountChangeDetail1.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail1); |
| | | |
| | | //订单分账 |
| | | Double num3_1 = order.getPayMoney(); |
| | | Double residueWeChatPayment = order.getResidueWeChatPayment(); |
| | | Double residueBalancePayment = order.getResidueBalancePayment(); |
| | | if(residueWeChatPayment.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), null, order.getOrderNo(), num3_1, 1); |
| | | if(10000 != fengzhang.getCode()){ |
| | | return; |
| | | } |
| | | order.setResidueWeChatPayment(new BigDecimal(order.getResidueWeChatPayment()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | }else{ |
| | | ResultUtil fengzhang = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), null, order.getOrderNo(), residueWeChatPayment, 1); |
| | | if(10000 != fengzhang.getCode()){ |
| | | return; |
| | | } |
| | | order.setResidueWeChatPayment(0D); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(residueWeChatPayment)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | |
| | | //账户余额继续分账 |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 1).eq("userId", appUser.getId()).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(num3_1) >= 0){ |
| | | ResultUtil fengzhang1 = fengzhang(1, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), num3_1, 3); |
| | | if(10000 == fengzhang1.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(new BigDecimal(rechargeRecord.getSurplusDividedAmount()).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | order.setResidueBalancePayment(new BigDecimal(residueBalancePayment).subtract(new BigDecimal(num3_1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil fengzhang1 = fengzhang(2, driver.getId(), driver.getMerchantNumber(), order.getId().longValue(), rechargeRecord.getId(), rechargeRecord.getOrderNumber(), surplusDividedAmount, 3); |
| | | if(10000 == fengzhang1.getCode()){ |
| | | rechargeRecord.setSurplusDividedAmount(0D); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | num3_1 = new BigDecimal(num3_1).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | order.setResidueBalancePayment(new BigDecimal(residueBalancePayment).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.updateById(order); |
| | | |
| | | if(null != order.getCouponId()){ |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(driver.getId()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(7); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setOldData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driver.setCommission(new BigDecimal(driver.getCommission()).add(new BigDecimal(order.getDiscountedPrice())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | accountChangeDetail.setExplain("优惠券收入"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setNewData(new BigDecimal(driver.getCouponBalance()).add(new BigDecimal(driver.getCommission())).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | accountChangeDetailService.saveData(accountChangeDetail); |
| | | //补贴中分账 |
| | | Double discountedPrice = order.getDiscountedPrice(); |
| | | List<RechargeRecord> rechargeRecords = rechargeRecordService.selectList(new EntityWrapper<RechargeRecord>().eq("type", 4).eq("payStatus", 2).gt("surplusDividedAmount", 0).orderBy("createTime")); |
| | | for (RechargeRecord rechargeRecord : rechargeRecords) { |
| | | Double surplusDividedAmount = rechargeRecord.getSurplusDividedAmount(); |
| | | if(surplusDividedAmount.compareTo(order.getDiscountedPrice()) >= 0){ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), discountedPrice, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | } |
| | | break; |
| | | }else{ |
| | | ResultUtil<Double> zhaunzhang = zhaunzhang(rechargeRecord.getId(), rechargeRecord.getOrderNumber(), driver.getMerchantNumber(), surplusDividedAmount, callbackPath + "/base/order/zhaunzhangCallback"); |
| | | if(10000 == zhaunzhang.getCode()){ |
| | | Double remainAmount = zhaunzhang.getData(); |
| | | rechargeRecord.setSurplusDividedAmount(remainAmount); |
| | | rechargeRecordService.updateById(rechargeRecord); |
| | | discountedPrice = new BigDecimal(discountedPrice).subtract(new BigDecimal(surplusDividedAmount)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分账操作 |
| | | * @param amount |
| | | */ |
| | | public ResultUtil fengzhang(Integer userType, Integer id, String merchantNumber, Long orderId, Integer rechargeRecordId, String merOrderId, Double amount, Integer sourceType){ |
| | | DivisionRecord divisionRecord = new DivisionRecord(); |
| | | divisionRecord.setUserType(userType); |
| | | divisionRecord.setUserId(id); |
| | | divisionRecord.setOrderId(orderId); |
| | | divisionRecord.setRechargeRecordId(rechargeRecordId); |
| | | divisionRecord.setSourceType(sourceType); |
| | | divisionRecord.setAmount(amount); |
| | | divisionRecord.setMerchantNumber(merchantNumber); |
| | | divisionRecord.setState(1); |
| | | divisionRecord.setCreateTime(new Date()); |
| | | divisionRecordService.insert(divisionRecord); |
| | | |
| | | Complete complete = new Complete(); |
| | | complete.setOriginalMerOrderId(merOrderId); |
| | | complete.setNotifyUrl(callbackPath + "/base/order/ledgerCallback"); |
| | | complete.setParameter1(divisionRecord.getId().toString()); |
| | | //分账方列表 |
| | | List<PamentOrderUser> splitList = new ArrayList<>(); |
| | | PamentOrderUser pamentOrderUser = new PamentOrderUser(); |
| | | pamentOrderUser.setSplitUserId(merchantNumber); |
| | | pamentOrderUser.setSplitAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | pamentOrderUser.setSplitType("1"); |
| | | splitList.add(pamentOrderUser); |
| | | complete.setSplitList(splitList); |
| | | TrhRequest<Complete> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(complete, Complete.SERVICE_CODE);//分账操作 |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | Integer status = jsonObject.getInteger("status");//0:待处理 1:成功 2:失败 |
| | | String merOrderId1 = jsonObject.getString("merOrderId"); |
| | | if(2 == status){ |
| | | logger.warn("订单支付成功后的分账处理异常失败"); |
| | | return ResultUtil.error("订单支付成功后的分账处理异常失败"); |
| | | } |
| | | if(1 == status){ |
| | | divisionRecord.setMerOrderId(merOrderId1); |
| | | divisionRecord.setPayTime(new Date()); |
| | | divisionRecord.setState(2); |
| | | divisionRecordService.updateById(divisionRecord); |
| | | //间隔1分钟开始调用确认收货后开始提现 |
| | | |
| | | new Timer().schedule(new TimerTask() {//确认收货和提现 |
| | | @Override |
| | | public void run() { |
| | | confirmReceipt(merchantNumber, merOrderId, divisionRecord); |
| | | } |
| | | }, 60000); |
| | | return ResultUtil.success(); |
| | | } |
| | | }else{ |
| | | logger.warn("订单支付成功后的分账处理异常 :" + execute.getMsg()); |
| | | return ResultUtil.error("订单支付成功后的分账处理异常 :" + execute.getMsg()); |
| | | } |
| | | logger.warn("未知异常"); |
| | | return ResultUtil.error("未知异常"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分账后的确认收货 |
| | | * @param divisionRecord |
| | | */ |
| | | public void confirmReceipt(String merchantNumber, String orderNumber, DivisionRecord divisionRecord){ |
| | | Receive receive = new Receive(); |
| | | receive.setOriginalMerOrderId(orderNumber); |
| | | receive.setAsynMerOrderId(divisionRecord.getMerOrderId()); |
| | | receive.setRcvAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | List<ReceiveUser> splitList = new ArrayList<>(); |
| | | ReceiveUser receiveUser = new ReceiveUser(); |
| | | receiveUser.setSplitUserId(merchantNumber); |
| | | receiveUser.setRcvSplitAmount(new BigDecimal(divisionRecord.getAmount()).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | splitList.add(receiveUser); |
| | | receive.setSplitList(splitList); |
| | | TrhRequest<Receive> request = new TrhRequest(); |
| | | InterfaceResponse execute1 = request.execute(receive, Receive.SERVICE_CODE);//确认收货 |
| | | if("0000".equals(execute1.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute1.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | logger.warn("分账确认收货成功"); |
| | | }else{ |
| | | logger.warn("分账确认收货异常" + execute1.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转账 |
| | | * @param id |
| | | * @param merOrderId |
| | | * @param toUserId |
| | | * @param amount |
| | | * @param notifyUrl |
| | | * @return |
| | | */ |
| | | public ResultUtil<Double> zhaunzhang(Integer id, String merOrderId, String toUserId, Double amount, String notifyUrl){ |
| | | Transfer transfer = new Transfer(); |
| | | transfer.setDepositMerOrderId(merOrderId); |
| | | transfer.setToUserId(toUserId); |
| | | transfer.setAmount(new BigDecimal(amount).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | transfer.setOrderName("补贴"); |
| | | transfer.setNotifyUrl(notifyUrl); |
| | | transfer.setParameter1(id.toString()); |
| | | TrhRequest<Transfer> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(transfer, Transfer.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | String status = jsonObject.getString("status");//0:待处理;1:成功;2:失败 |
| | | if("2" == status){ |
| | | System.err.println("转账失败"); |
| | | return ResultUtil.error("转账失败"); |
| | | } |
| | | Double remainAmount = Double.valueOf(jsonObject.getInteger("remainAmount")) / 100; |
| | | return ResultUtil.success(remainAmount); |
| | | }else{ |
| | | System.err.println("转账失败:" + execute.getMsg()); |
| | | return ResultUtil.error(execute.getMsg()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("waitTime", num1 + "分钟/" + num2 + "元"); |
| | | map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟"); |
| | | systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 |
| | | if(1 == num11){ |
| | | map.put("badWeather", "雨天、恶劣天气时代驾里程在" + num5 + "公里内加" + num6 + "元/单,达" + num7 + "公里或以上的订单按总价加" + num8 + "倍计费,封顶加" + num9 + "元"); |
| | | } |
| | | priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map)); |
| | | } |
| | | return priceRulesWarpper; |
| | |
| | | |
| | | static { |
| | | YamlPropertiesFactoryBean yamlProFb = new YamlPropertiesFactoryBean(); |
| | | yamlProFb.setResources(new ClassPathResource("application.yaml")); |
| | | yamlProFb.setResources(new ClassPathResource("application.yml")); |
| | | Properties properties = yamlProFb.getObject(); |
| | | System.out.println("mallbook 参数配置初始化"); |
| | | System.out.println("--------------------------------"); |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.util.MallBook.model; |
| | | |
| | | public class QueryOrder { |
| | | /**业务类型编号,必须和接口文档一致*/ |
| | | public static String SERVICE_CODE = "queryOrder"; |
| | | /** |
| | | * 原请求订单号 |
| | | */ |
| | | private String originalMerOrderId; |
| | | |
| | | /** |
| | | * 查询类型 |
| | | */ |
| | | private String queryType; |
| | | |
| | | public String getOriginalMerOrderId() { |
| | | return originalMerOrderId; |
| | | } |
| | | |
| | | public void setOriginalMerOrderId(String originalMerOrderId) { |
| | | this.originalMerOrderId = originalMerOrderId; |
| | | } |
| | | |
| | | public String getQueryType() { |
| | | return queryType; |
| | | } |
| | | |
| | | public void setQueryType(String queryType) { |
| | | this.queryType = queryType; |
| | | } |
| | | } |
| | |
| | | import com.supersavedriving.user.modular.system.util.MallBook.config.ChannelConfig; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceRequest; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * @Author xiaogc |
| | |
| | | */ |
| | | public class TrhRequest<T> { |
| | | |
| | | Logger logger = LoggerFactory.getLogger("ServiceLog"); |
| | | |
| | | public InterfaceResponse execute(T t, String serverCode) { |
| | | InterfaceRequest<T> request = new InterfaceRequest(t, serverCode); |
| | | System.out.println("mallbook请求参数:" + JSONUtil.toJsonStr(request)); |
| | | logger.warn("mallbook请求参数:" + JSONUtil.toJsonStr(request)); |
| | | String result = HttpUtil.post(ChannelConfig.payUrl, BeanUtil.beanToMap(request)); |
| | | System.out.println("mallbook响应参数:" + result); |
| | | logger.warn("mallbook响应参数:" + result); |
| | | InterfaceResponse response = JSONUtil.toBean(result, InterfaceResponse.class); |
| | | boolean verify = RSASignature.validate(response.content(), response.getSign()); |
| | | if (!verify) { |
| | | throw new ValidateException("签名验证失败"); |
| | | } else { |
| | | System.out.printf("签名验证通过"); |
| | | logger.warn("签名验证通过"); |
| | | } |
| | | return response; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 系统推单推送 附加(防止 用户推单后,范围内的司机20s 内接不到单的补充方法) |
| | | * @param id 接受对象id |
| | | * @param type 接受对象类型(1=用户,2=司机) |
| | | */ |
| | | public void pushGrabOrderExtras(Integer id, Integer type){ |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "PUSH_ORDER"); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | logger.debug(jsonObject1.getString("msg")); |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 转单成功推送 |
| | | * @param id |
| | | * @param type |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }, 0, 7000000); |
| | | }, 0, 6000000); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | String body1 = exchange.getBody(); |
| | | return body1; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取小程序urllink码 |
| | | * env_version 默认值"release"。要打开的小程序版本。正式版为 "release",体验版为"trial",开发版为"develop",仅在微信外打开时生效。 |
| | | * @return |
| | | */ |
| | | public String getUrlLink(String path, String query, String env_version) throws Exception{ |
| | | String wxAppletsAccessToken = redisUtil.getValue("wxAppletsAccessToken"); |
| | | String url = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=" + wxAppletsAccessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", path); |
| | | param.put("query", query); |
| | | param.put("is_expire", true); |
| | | param.put("expire_type", 0); |
| | | param.put("expire_time", System.currentTimeMillis() + 60 * 60 * 1000); |
| | | param.put("env_version", env_version); |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | MediaType type=MediaType.parseMediaType("application/json;charset=UTF-8"); |
| | | httpHeaders.setContentType(type); |
| | | HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>(param, httpHeaders); |
| | | ResponseEntity<String> exchange = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class); |
| | | String body1 = exchange.getBody(); |
| | | JSONObject jsonObject = JSON.parseObject(body1); |
| | | Integer errcode = jsonObject.getInteger("errcode"); |
| | | if(null != errcode && 40001 == errcode){ |
| | | wxAppletsAccessToken = getWxAppletsAccessToken(); |
| | | if(ToolUtil.isEmpty(wxAppletsAccessToken)){ |
| | | System.err.println("获取微信小程序access_token失败"); |
| | | return "获取微信小程序access_token失败"; |
| | | } |
| | | redisUtil.setStrValue("wxAppletsAccessToken", wxAppletsAccessToken, 7000); |
| | | return getUrlLink(path, query, env_version); |
| | | } |
| | | return body1; |
| | | } |
| | | } |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 司机注册 |
| | | * @author pzb |
| | | * @Date 2023/2/6 9:15 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class DriverRegisterWarpper { |
| | | @ApiModelProperty(value = "注册区域code", required = true, dataType = "string") |
| | | private String code; |
| | | @ApiModelProperty(value = "头像", required = false, dataType = "string") |
| | | private String avatar; |
| | | @ApiModelProperty(value = "姓名", required = false, dataType = "string") |
| | | private String name; |
| | | @ApiModelProperty(value = "手机号码", required = true, dataType = "string") |
| | | private String phone; |
| | | @ApiModelProperty(value = "紧急联系人", required = true, dataType = "string") |
| | | private String emergencyContact; |
| | | @ApiModelProperty(value = "紧急联系人电话", required = true, dataType = "string") |
| | | private String emergencyPhone; |
| | | @ApiModelProperty(value = "身份证正面照", required = true, dataType = "string") |
| | | private String idcardFront; |
| | | @ApiModelProperty(value = "身份证背面照", required = true, dataType = "string") |
| | | private String idcardBack; |
| | | @ApiModelProperty(value = "驾驶证领证时间(2023-01-01)", required = true, dataType = "string") |
| | | private String firstCertificateTime; |
| | | @ApiModelProperty(value = "驾驶证照片", required = true, dataType = "string") |
| | | private String driverLicense; |
| | | @ApiModelProperty(value = "邀约人类型(1=用户,2=司机)", required = false, dataType = "int") |
| | | private Integer inviterType; |
| | | @ApiModelProperty(value = "邀约人Id", required = false, dataType = "int") |
| | | private Integer inviterId; |
| | | @ApiModelProperty(value = "注册来源(1=司机端注册,2=其他端注册)", required = true, dataType = "int") |
| | | private Integer source; |
| | | } |
| | |
| | | private String driverLon; |
| | | @ApiModelProperty("司机位置纬度") |
| | | private String driverLat; |
| | | @ApiModelProperty("支付类型(1=微信支付,2=余额支付,3=线下支付,4=微信+余额)") |
| | | private Integer payType; |
| | | @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") |
| | | private Integer state; |
| | | @ApiModelProperty("客服电话") |
New file |
| | |
| | | package com.supersavedriving.user.modular.system.warpper; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/6/20 18:12 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class OrderPriceInfoWarpper { |
| | | @ApiModelProperty("订单开始时间") |
| | | private Long startTime; |
| | | @ApiModelProperty("订单结束时间") |
| | | private Long endTime; |
| | | @ApiModelProperty("总行驶里程") |
| | | private Double actualMileage; |
| | | @ApiModelProperty("起步价") |
| | | private Double startPrice; |
| | | @ApiModelProperty("起步里程") |
| | | private Double startDistance; |
| | | @ApiModelProperty("超出起步里程") |
| | | private Double overDriveDistance; |
| | | @ApiModelProperty("里程费") |
| | | private Double mileageFee; |
| | | @ApiModelProperty("等待时长") |
| | | private String waitTime; |
| | | @ApiModelProperty("等待费") |
| | | private Double waitTimePrice; |
| | | @ApiModelProperty("折扣金额") |
| | | private Double discountAmount; |
| | | @ApiModelProperty("优惠券金额") |
| | | private Double discountedPrice; |
| | | @ApiModelProperty("恶劣天气费") |
| | | private Double badWeatherPrice; |
| | | @ApiModelProperty("订单金额") |
| | | private Double orderMoney; |
| | | @ApiModelProperty("支付金额") |
| | | private Double payMoney; |
| | | } |
| | |
| | | @ApiModelProperty("超过长途里程费") |
| | | private Double overLongDistancePrice; |
| | | @ApiModelProperty("等待时长") |
| | | private Integer waitTime; |
| | | private Double waitTime; |
| | | @ApiModelProperty("等待费") |
| | | private Double waitTimePrice; |
| | | @ApiModelProperty("超出等待时长") |
| | | private Integer outWaitTime; |
| | | private Double outWaitTime; |
| | | @ApiModelProperty("超出等待费") |
| | | private Double outWaitTimePrice; |
| | | @ApiModelProperty("恶劣天气里程") |
| | |
| | | --- |
| | | |
| | | alipay: |
| | | appid: 2021001161600393 #应用程序唯一标识 |
| | | appPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEbTcG2wz+kaYDo2YxflpHE59MvKc3rbl6RlBgO6i5GzgphzeRTv5kRWUpSVkKCsbxFvAYLcgFPmm5nY2fz5hCTKiRcYfpUjH/OougUbzYU3ilUc9JqMbmvy7KN+Kv7+kQYCGLvMqlyYPiJ7LrmJLpE/FUcNLDwo6xUmwJSxaF7M4TbD3ZQZdddki1iJp9GihlqehZCMWOBeotEXvPKDEzSEkYlnvHPQaaspVgeesGmlHDuOiZUokENutxpjo7klWe97NA49hXEtI+xlczNGJKdBr0keBX/kSMsnx8kMxYDjh4QTySBaR6zlO4RYPFekWv9QZ2CrfiKCS7AHUpZYZ5AgMBAAECggEAXjCoUPIBHhhOcowIJe/vGlr0lUohzdJ8+GGGzcvhSDf6DF+mwG3lN0C8oU8QS7o6okRkZW46tLAd1u4fS6oGbDHGPBz6RJQ4B4eGxHMe1OcaCsxTmdq4DmuxRhfV3rnPldwqQA/6O01HxtXhxvzwkWOj5SGSZ7a8c5diTIHh9ULd6neUI/rIFC97mH1TeW0uDIxAtyvswz0pIfDhAR+lsOyTg/8qzsIXjpBFG4gAVxhUeUqQA5HzbsFglC08V7ViDk1OEoWi3yIj1CmNdtntJI4cxqLgTK7MNB9udhbN2I9YasuIpZvlAcvPi5R9cYT8vvFBCFGM+i22wtcsQmxdAQKBgQDaD9y6WNmsp+IaAUG3FqbJC8SqwreGIiEflWwVjrd+LuN6yhyr45CobOmhbTz0de8gRJEZKgJZEJcywL1ScrPIC4n1JaG688lk5aR+0Lik5fy1+L6G/CydJoJqlh6KKdwPJmDGpVu/geLJcLkWcYOwL56IL7GK2JI1p607R0x6iQKBgQCbd0n4xG9GkpvW4LDAJiMEhwPu9QcCKIT0mXVXCgMFdWel9bY3+8RSZoziWutaofm9tRHFAqwjbRyOZ+EdckkNsWVkkTnkKGtAhYKgM0GaOwdMFxmvME5WYJ74a5t1jiezDmR3obUBtS2nyQ8CFPUnlimoTR9F6APrth3h8uvwcQKBgFWaCn1AqdrEYNbyjViRVNHxg7fBDohiV3xtjOt9hfzL7VLjipPTlpL3hlNvbZFNxpx1LjyhqCBMif5LeUanbnnmRbbtmeqpDvNDzupVh1Z8TlMlHa4hymW6m1G6MqzsN83es/jnKvgnxd5sGMx9rUN5vhMaHekykVrswu1VVOl5AoGAMDljh7gfMEv/7TqLeT8bM6dR8AivoNrCy0Di5hnj8AiIGzHJ0TnWnxzSbNB5GwcNeew109/NV7vb1MyiRskRoh657eUiiQSEqGIBsAHWQqo2zEKKJA6e7ipQhYyTj3aGGAPJ5FYT2LDDtb0nW6T2ms34pA0wOzYKKU63nEQHLfECgYEAgbbpZJRtPxWB1M/Dg7loguT5O/VUsKefS0JrSD+tJIqYkumH5mejvYW5YEeDdelkvBhAEFUW9JOkzL+1w1g3wz2QQ2aPV/r55cJE3EfOzbwgw6GsO+8UuyiavbFhS3pFZNI0pR5M3u1+SIcLqQCnYLbO11vnEXglB6wjw9/oxPE= #开发者应用私钥 |
| | | alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhG03BtsM/pGmA6NmMX5aRxOfTLynN625ekZQYDuouRs4KYc3kU7+ZEVlKUlZCgrG8RbwGC3IBT5puZ2Nn8+YQkyokXGH6VIx/zqLoFG82FN4pVHPSajG5r8uyjfir+/pEGAhi7zKpcmD4iey65iS6RPxVHDSw8KOsVJsCUsWhezOE2w92UGXXXZItYiafRooZanoWQjFjgXqLRF7zygxM0hJGJZ7xz0GmrKVYHnrBppRw7jomVKJBDbrcaY6O5JVnvezQOPYVxLSPsZXMzRiSnQa9JHgV/5EjLJ8fJDMWA44eEE8kgWkes5TuEWDxXpFr/UGdgq34igkuwB1KWWGeQIDAQAB #应用公钥 |
| | | alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmDrvcNvhexu3KkxVS9bemdSn6pyQUFmpyOGMDOirGR+RbmldpH2N9bPegzZynb5+bmRHii4ib31XeoXc7M7r6UsPhmPeLoSBNwpC+Uig0VxPa0hmvHjAl6StArhB3eMib6Zo40nM6eCYZLLZ1kKpI5Ad/APov9uLrbSnoeZsgeRibQix07arvTEsZq6pJavNlA+UBjp65o6Bv0+kfQ65pMTpbu+jRtTzkTj1hoW9PjwlWrY21F1FvN67zDWkTB2LjGFsqan0Qoe4/X8nK3VsDvkjIm/ZQsnQr8ZzfcuTzQPrcZpo3h9DPZoHeiToEfXtyk7E0bQHEmYVpmrvk/IJwIDAQAB #支付宝公钥 |
| | | appid: 111 #应用程序唯一标识 |
| | | appPrivateKey: 111 #开发者应用私钥 |
| | | alipayPublicKey: 111 #应用公钥 |
| | | alipay_public_key: 111 #支付宝公钥 |
| | | |
| | | --- |
| | | |
| | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | #callbackPath: http://121.37.15.157:80/user |
| | | callbackPath: https://chaoshengdaijia.com:443/user |
| | | #正式测试环境 |
| | | callbackPath: http://121.37.15.157:80/user |
| | | #callbackPath: http://121.37.15.157:80/user |
| | | |
| | | --- |
| | | |
| | |
| | | |
| | | # mallbook 调起接口参数配置 |
| | | mallbook: |
| | | # pay_url:mallbook接口地址 测试环境: http://ld.mallbook.cn:12000/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: http://ld.mallbook.cn:12000/api |
| | | # pay_url:mallbook接口地址 测试环境: https://uat.mallbook.cn/api 生产环境:https://cloudpay.mallbook.cn/api |
| | | pay_url: https://cloudpay.mallbook.cn/api |
| | | # merchant_no 业务系统商户平台编号,需替换为mallbook工作人员提供的商户编号 |
| | | merchant_no: 需要替换内容 |
| | | merchant_no: MBH23056 |
| | | # version 接口版本号 |
| | | version: 1.0.0 |
| | | # channel_type 渠道类型 HF:汇付 |
| | | channel_type: HF |
| | | # merchant_private_key 商户平台私钥,需要替换成商户平台自己生成的私钥 |
| | | merchant_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIoGARvX6k6rVwuUW6HjAPkzXVntCtDI8q/niGZbeILc5T/noer+UNDECSy9f8T6ENw7tEKWaHOFcicrqgRv+wXeo2hPiJI2iYsUNs6I8ckd8i4uy/PBEDMW78GlnQLAatk0NC44HKjn8cuIHaETKNG2Vk3rwGBzNgDZ/God1L6JAgMBAAECgYBhCsOwzehBk5pJ2+9pLO+8Rm72EQGvtflb0BBI1zst1x2gBr4DOPedMJe6yymQVrmP/rJItvONdV/DRqHtKMZ2Wa4ul/U1mDnAtS/FkpRYBA5FaXV2hNEW11xBLhL5iGk35P23Bzaa0MJw9Vsd0vjeykridIw/PweDyTdeRBwC2QJBANS+iOaKRuf6BRwCKDmBSHOiZmc/kKnpx2f5BD3h+LWEX3JsNxObMbW1SxQIf2/qwqzIoEm/WbWaOyuwtRZkXQ8CQQCmFjTm5l+Ws2LoQgM+5+eLmPyMyRFOu4G8yqsUkhKuANHK/qrsS1GTbv6SN341NijjNYl05e0h6Jq1T9UZmtrnAkEAwTfzmn7H+3RmI5QJ+IBkzzEWFHv05X0/8DyID7QmcKWzEncaZqIzObdYYu983qa2/LqSaahyz68uQnYRYi7xHQJATr3SgPIRuaH8r360iTtrRHzYp2qgYQJ25On1KECEyKgszp/kqzieSVbjLLFQjavKwMXeEGT+AwiDaJibwJLxWwJAXZApORsqGqdxc9FTxt5iiqG2ZP5DTXxc6E+ihmlmoVl9KncgTf9ez0Q0Qz/4KUTPTHNVgzt1nyBxiLtnyzFavA== |
| | | merchant_private_key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALHmyTrxPYcAwABnX+3VW9vxUftm57zBpnbfOT4vizMnKdpfCkIgtdbfdnSCtt637yWM2fxnZfItnhTeQA2lL8f4SXgZt/bVXfmAWi4IxQ+HJy0Qs8nNy2nnjICPBPcpWzHwUxQ/THHqU0a7b9B91J5DFcbQb25BHeRpHwkBw6A/AgMBAAECgYAmcWq2s/7Jt53F+JDAQkTRaHqAyyH0phwkv+QMzhVUfngK2lLLK2pf/nYIg16lDjY9dQx+AJIFHVp1w/kveayzOz3BIqPoznyIVYPolRGZCWPo+2vdp0CIdBh7zahST5g5Gem4cU47wO5hPYs1kXKPG4mUPtaIAMHFxhyLvIagAQJBAOS63AIZrRrldeNCVVNXbpAT52JuWLCgravM9coOh6scmG6UQwxxcott8hneHr9fazk2LHbHMxlG8F+dQPA0+D8CQQDHHJN7Dnske8oJ+1sq4uhQP3HMsmNIgth+ZcaZpiPcxnNKYVGhzAwTVV2ruFJle5ajebo6zfWuqJhtZGRNh1gBAkA/lRoXk1+lfGfa9tOVSVa4wm+t0xLgdqoQefdRZdyc2mQdSSWiTd8Tl0qXmkFd3X6G9uJBWnp/6lJjoektXOwtAkBsZTQsw99qJzIAaSRinpDWTxPG2j6OlR0DAqkxsG7JnAfbsEteh9TzGYAbIgdJVBTX/kbSCJn9ca85rnOkeVABAkAUbDfU3Z702z20NtwAxc1IkrtQ1lKuqSpj9/LuR1/6KRkYQsUWnUiOO9hu5YDWIcflFrnCenF8j8OnvGghltxT |
| | | # mall_book_public_key mallbook测试环境公钥 不需要替换 |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0L2DaHOO8ekhktB6RoHxIcki/0v7OUeOn9tX9VBE+jv6PRjqlZRWL3Qezxz5ADtHEyLv+RFFaceXSep6rWyoQ6DRlvLv5CySUAxAM42LLVe4DI3l/0ccEAIuU5NCpwAAj1zkm2X01DwUCZwymLjlqbDlBvQhpq+1fddtTtA/QLQIDAQAB |
| | | # mall_book_public_key mallbook生产环境公钥 不需要替换 |
| | | # mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | mall_book_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq6OLZKgUHH5wOk9xSBgN7yC17r3PQwMlY9/IorqrOlaIqrU0eAVZ5+dWrJD/3bdu7Ctq8n8trTm/IUYs7wtMg5SKwyX4/N+KQc2N7LL4yCq4vNl41q9sYgrtA0QnZoucIZcq1mwyu7RTDC8Wp7LGddnlkJsmL8masgMxA6cc9NwIDAQAB |
| | | |
| | |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | <maxHistory>200</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
New file |
| | |
| | | //package com.supersavedriving.user; |
| | | // |
| | | //import com.supersavedriving.user.modular.system.service.IOrderService; |
| | | //import com.supersavedriving.user.modular.system.warpper.OrderPriceWarpper; |
| | | //import org.junit.Test; |
| | | //import org.junit.runner.RunWith; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | //import org.springframework.test.context.junit4.SpringRunner; |
| | | // |
| | | ///** |
| | | // * @author zhibing.pu |
| | | // * @date 2023/5/29 10:20 |
| | | // */ |
| | | //@RunWith(SpringRunner.class) |
| | | //@SpringBootTest |
| | | //public class GunsApplicationTest { |
| | | // |
| | | // @Autowired |
| | | // private IOrderService orderService; |
| | | // |
| | | // |
| | | // @Test |
| | | // public void test(){ |
| | | // OrderPriceWarpper orderPriceWarpper = null; |
| | | // try { |
| | | // orderPriceWarpper = orderService.calculationOfExpenses(14, 133L, null, 1, 0D); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // System.err.println(orderPriceWarpper); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | //} |
| | |
| | | * @param msg |
| | | * @author TaoNingBo |
| | | */ |
| | | public void JudgeOperation(ChannelHandlerContext ctx, String msg) { |
| | | public synchronized void JudgeOperation(ChannelHandlerContext ctx, String msg) { |
| | | try { |
| | | // 验证即时通讯命令是否正确有效 |
| | | if (SinataUtil.isEmpty(msg)) { |
| | |
| | | * @param msg |
| | | * @author TaoNingBo |
| | | */ |
| | | public void JudgeOperation(ChannelHandlerContext ctx, Object msg) { |
| | | public synchronized void JudgeOperation(ChannelHandlerContext ctx, Object msg) { |
| | | try { |
| | | // ByteBuf转String |
| | | ByteBuf byteBuf = (ByteBuf) msg; |
| | |
| | | if(b){ |
| | | NettyChannelMap.remove_(data_); |
| | | } |
| | | // new Timer().schedule(new TimerTask() { |
| | | // @Override |
| | | // public void run() { |
| | | // NettyChannelMap.remove_(data_); |
| | | // } |
| | | // }, 5000); |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | NettyChannelMap.remove_(data_); |
| | | } |
| | | }, 5000); |
| | | } |
| | | NettyChannelMap.update_(token.substring(token.length() - 16), ctx); |
| | | NettyChannelMap.update("USER" + userId1, ctx); |
| | |
| | | }else{ |
| | | //确保账号在单个设备上登录 |
| | | if(StringUtil.isNotEmpty(token)){//APP端登录的操作 |
| | | // String token_ = redisUtil.getValue("DRIVER_" + userId1);//缓存中拿最新数据 |
| | | // if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向当前设备发送数据 |
| | | // ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(token_.length() - 16)); |
| | | // if(null != data_){ |
| | | // JSONObject msg_ = new JSONObject(); |
| | | // msg_.put("code", 200); |
| | | // msg_.put("msg", "SUCCESS"); |
| | | // msg_.put("method", "OFFLINE"); |
| | | // msg_.put("data", new Object()); |
| | | // boolean b = this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息 |
| | | // if(b){ |
| | | // NettyChannelMap.remove_(data_); |
| | | // } |
| | | // } |
| | | // } |
| | | String token_ = redisUtil.getValue("DRIVER_" + userId1);//缓存中拿最新数据 |
| | | if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向当前设备发送数据 |
| | | ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(token_.length() - 16)); |
| | | if(null != data_){ |
| | | JSONObject msg_ = new JSONObject(); |
| | | msg_.put("code", 200); |
| | | msg_.put("msg", "SUCCESS"); |
| | | msg_.put("method", "OFFLINE"); |
| | | msg_.put("data", new Object()); |
| | | boolean b = this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息 |
| | | if(b){ |
| | | NettyChannelMap.remove_(data_); |
| | | } |
| | | } |
| | | } |
| | | NettyChannelMap.update("DRIVER" + userId1, ctx); |
| | | NettyChannelMap.update_(token.substring(token.length() - 16), ctx); |
| | | redisUtil.setStrValue("DRIVER_" + userId1, token); |
| | |
| | | spring: |
| | | application: |
| | | name: zuul-gateway #服务名称 |
| | | servlet: |
| | | multipart: |
| | | max-request-size: 500MB |
| | | max-file-size: 500MB |
| | | |
| | | eureka: |
| | | client: |
| | |
| | | #redisÅäÖÿªÊ¼ |
| | | # RedisÊý¾Ý¿âË÷Òý£¨Ä¬ÈÏΪ0£© |
| | | spring.redis.database=0 |
| | | |
| | | # Redis·þÎñÆ÷µØÖ· |
| | | spring.redis.host=127.0.0.1 |
| | | # Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú |
| | |
| | | # Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© |
| | | spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ |
| | | |
| | | ## Redis·þÎñÆ÷µØÖ· |
| | | # Redis·þÎñÆ÷µØÖ· |
| | | #spring.redis.host=127.0.0.1 |
| | | ## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú |
| | | #spring.redis.port=6379 |
| | | ## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© |
| | | #spring.redis.password=123456 |
| | | |
| | | # Á¬½Ó³Ø×î´óÁ¬½ÓÊý£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£© |
| | | spring.redis.jedis.pool.max-active=1024 |
| | | # Á¬½Ó³Ø×î´ó×èÈûµÈ´ýʱ¼ä£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£© |