| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | 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.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.system.controller.general.TDriverController; |
| | | import com.stylefeng.guns.modular.system.controller.util.Base64Util; |
| | | import com.stylefeng.guns.modular.system.controller.util.GetOpenBodySig; |
| | | import com.stylefeng.guns.modular.system.controller.util.Util; |
| | | import com.stylefeng.guns.modular.system.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService tServerCarmodelService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITLineService itLineService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITOrderPositionService tOrderPositionService; |
| | | |
| | | |
| | | private ResultUtil resultUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | |
| | | /** |
| | | * 跳转到跨城出行订单首页 |
| | | */ |
| | |
| | | public String index(Model model) { |
| | | //服务快车车型 |
| | | List<TServerCarmodel> carmodelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1)); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | model.addAttribute("carmodelList", carmodelList); |
| | | //线路 |
| | | List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().last(" where not FIND_IN_SET(state,'3')")); |
| | | model.addAttribute("lineList",lineList); |
| | |
| | | model.addAttribute("tOrderCrossCityId",tOrderCrossCityId); |
| | | return PREFIX + "tOrderCrossCity_track.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | | * |
| | | * @param orderDetailId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getOrderTrack", method = RequestMethod.POST) |
| | | public ResultUtil getOrderTrack(String orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | public ResultUtil getOrderTrack(Integer orderDetailId) { |
| | | if (ToolUtil.isNotEmpty(orderDetailId)) { |
| | | try { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + "_3.txt"); |
| | | 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); |
| | | // List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 3).eq("orderId", orderDetailId).orderBy("insertTime")); |
| | | /*if(list.size() == 0){ |
| | | return ResultUtil.error("该订单没有运行轨迹"); |
| | | }*/ |
| | | resultUtil = ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | Query query = new Query() |
| | | .addCriteria(Criteria.where("orderId").is(orderDetailId).and("orderType").is(3)) |
| | | .with(new Sort(Sort.Direction.ASC, "insertTime")); |
| | | List<TOrderPosition> positions = mongoTemplate.find(query, TOrderPosition.class); |
| | | resultUtil = ResultUtil.success(positions); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | resultUtil = ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | } else { |
| | | resultUtil = ResultUtil.paranErr(); |
| | | } |
| | | return resultUtil; |
| | |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer lineId, |
| | | Integer state) { |
| | | Integer state, |
| | | Integer abnormal, |
| | | Integer promotion, |
| | | String promotionUser) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,serverCarModelId,driver,lineId,state)); |
| | | page.setRecords(tOrderCrossCityService.getCrossCityOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/export") |
| | | @ResponseBody |
| | | public void export(String insertTime, |
| | | String orderNum, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String passengers, |
| | | String passengersPhone, |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer lineId, |
| | | Integer state, |
| | | Integer abnormal, |
| | | Integer promotion, |
| | | String promotionUser, HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)) { |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String, Object>> list = tOrderCrossCityService.getCrossCityOrderListExport(null, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), orderNum, orderSource, userName, userPhone, passengers, passengersPhone, serverCarModelId, driver, lineId, state, abnormal, promotion, promotionUser,null); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |
| | | |
| | | //第一行显示【封装】 |
| | | List<String> twoList = new ArrayList<String>(); |
| | | twoList.add("总计:"); |
| | | twoList.add(String.valueOf(list.size())+"条"); |
| | | dataList.add(twoList); |
| | | |
| | | // 列【封装】 |
| | | List<String> shellList = new ArrayList<String>(); |
| | | shellList.add("下单时间"); |
| | | shellList.add("订单编号"); |
| | | shellList.add("订单来源"); |
| | | shellList.add("乘车时间"); |
| | | shellList.add("下单用户昵称"); |
| | | shellList.add("下单用户手机"); |
| | | shellList.add("乘车用户姓名"); |
| | | shellList.add("乘车用户手机"); |
| | | shellList.add("起点"); |
| | | shellList.add("终点"); |
| | | shellList.add("线路名称"); |
| | | shellList.add("选择车型"); |
| | | shellList.add("接单司机"); |
| | | shellList.add("接单车辆"); |
| | | shellList.add("订单金额"); |
| | | shellList.add("状态"); |
| | | shellList.add("是否异常订单"); |
| | | shellList.add("是否推广订单"); |
| | | shellList.add("推广员姓名"); |
| | | shellList.add("推广员电话"); |
| | | dataList.add(shellList); |
| | | |
| | | for (Map<String,Object> object : list){ |
| | | // 详细数据列【封装】 |
| | | shellList = new ArrayList<String>(); |
| | | if(SinataUtil.isNotEmpty(object.get("insertTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("orderNum"))){ |
| | | shellList.add(object.get("orderNum").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | // 1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单 |
| | | if(SinataUtil.isNotEmpty(object.get("orderSource"))){ |
| | | switch (object.get("orderSource").toString()){ |
| | | case "1": |
| | | shellList.add("APP下单"); |
| | | break; |
| | | case "2": |
| | | shellList.add("扫码下单"); |
| | | break; |
| | | case "3": |
| | | shellList.add("小程序下单"); |
| | | break; |
| | | case "4": |
| | | shellList.add("司机下单"); |
| | | break; |
| | | case "5": |
| | | shellList.add("调度下单"); |
| | | break; |
| | | case "6": |
| | | shellList.add("道行龙城下单"); |
| | | break; |
| | | default: |
| | | shellList.add("-"); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("travelTime"))){ |
| | | shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("travelTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss")); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("userName"))){ |
| | | shellList.add(object.get("userName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("userPhone"))){ |
| | | shellList.add(object.get("userPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("passengers"))){ |
| | | shellList.add(object.get("passengers").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("passengersPhone"))){ |
| | | shellList.add(object.get("passengersPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("contactPersonPhone"))){ |
| | | shellList.add(object.get("contactPersonPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("startAddress"))){ |
| | | shellList.add(object.get("startAddress").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("endAddress"))){ |
| | | shellList.add(object.get("endAddress").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("lineName"))){ |
| | | shellList.add(object.get("lineName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("serverCarModelName"))){ |
| | | shellList.add(object.get("serverCarModelName").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("driver"))){ |
| | | shellList.add(object.get("driver").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("car"))){ |
| | | shellList.add(object.get("car").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("orderMoney"))){ |
| | | shellList.add(object.get("orderMoney").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | // 1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付 |
| | | if(SinataUtil.isNotEmpty(object.get("state"))){ |
| | | switch (object.get("state").toString()){ |
| | | case "1": |
| | | shellList.add("待接单"); |
| | | break; |
| | | case "2": |
| | | shellList.add("待出发"); |
| | | break; |
| | | case "3": |
| | | shellList.add("待到达预约地点"); |
| | | break; |
| | | case "4": |
| | | shellList.add("待乘客上车"); |
| | | break; |
| | | case "5": |
| | | shellList.add("服务中"); |
| | | break; |
| | | case "6": |
| | | shellList.add("完成服务"); |
| | | break; |
| | | case "7": |
| | | shellList.add("待支付"); |
| | | break; |
| | | case "8": |
| | | shellList.add("待评价"); |
| | | break; |
| | | case "9": |
| | | shellList.add("已完成"); |
| | | break; |
| | | case "10": |
| | | shellList.add("已取消"); |
| | | break; |
| | | case "11": |
| | | shellList.add("改派中"); |
| | | break; |
| | | case "12": |
| | | shellList.add("取消待支付"); |
| | | break; |
| | | default: |
| | | shellList.add("-"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("abnormal"))){ |
| | | shellList.add(object.get("abnormal").toString().equals("1")?"否":"是"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("promotion"))){ |
| | | shellList.add(object.get("promotion").toString().equals("1")?"否":"是"); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | if(SinataUtil.isNotEmpty(object.get("promotionUser"))){ |
| | | shellList.add(object.get("promotionUser").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | if(SinataUtil.isNotEmpty(object.get("promotionPhone"))){ |
| | | shellList.add(object.get("promotionPhone").toString()); |
| | | }else{ |
| | | shellList.add("-"); |
| | | } |
| | | |
| | | |
| | | dataList.add(shellList); |
| | | } |
| | | try { |
| | | // 调用工具类进行导出 |
| | | ExcelExportUtil.easySheet("订单导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "订单导出记录", dataList,request, response); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | |
| | | @ResponseBody |
| | | public Object cancel(@RequestParam Integer tOrderCrossCityId) throws Exception { |
| | | TOrderCrossCity tOrderCrossCity = tOrderCrossCityService.selectById(tOrderCrossCityId); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | |
| | | TOrderCrossCity orderCrossCity = tOrderCrossCityService.selectById(tOrderCrossCityId); |
| | | if(orderCrossCity.getState() > 5 && orderCrossCity.getState() != 11 && orderCrossCity.getState() != 7){ |
| | | if (orderCrossCity.getState() > 5 && orderCrossCity.getState() != 11 && orderCrossCity.getState() != 7) { |
| | | return ResultUtil.error("订单状态不在可取消范围内"); |
| | | } |
| | | orderCrossCity.setState(10); |
| | | tOrderCrossCityService.updateById(orderCrossCity); |
| | | |
| | | if(orderCrossCity.getDriverId() != null){ |
| | | |
| | | if (orderCrossCity.getDriverId() != null) { |
| | | //修改司机信息 |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(orderCrossCity.getLineShiftDriverId()); |
| | | lineShiftDriver.setLaveSeat(lineShiftDriver.getLaveSeat() + orderCrossCity.getPeopleNumber() > lineShiftDriver.getTotalSeat() ? |
| | |
| | | if(orderCrossCity.getPayType()==5){ |
| | | TDriver driver = tDriverService.selectById(orderCrossCity.getDriverId()); |
| | | if(orderCrossCity.getPayMoney().doubleValue()>0) { |
| | | createAllocationReq(1, driver.getId(), 1, orderCrossCity.getPayMoney().doubleValue()); |
| | | } |
| | | } |
| | | |
| | |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城出行取消退款", orderCrossCity.getPayMoney().doubleValue(), 1, 1, 1, 3, tOrderCrossCityId); |
| | | if(orderCrossCity.getPayMoney().doubleValue()>0){ |
| | | if(orderCrossCity.getOrderSource()==4){ |
| | | tDriverController.createAllocationReq(1,orderCrossCity.getDriverId(),1,orderCrossCity.getPayMoney().doubleValue()); |
| | | }else { |
| | | createAllocationReqUser(1,userInfo.getId(),1,orderCrossCity.getPayMoney().doubleValue()); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | userService.updateById(userInfo); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城出行取消退款", orderCrossCity.getPayMoney().doubleValue(), 1, 1, 1, 3, tOrderCrossCityId); |
| | | if(orderCrossCity.getPayMoney().doubleValue()>0) { |
| | | if (orderCrossCity.getOrderSource() == 4) { |
| | | // 退给司机 |
| | | createAllocationReq(1, orderCrossCity.getDriverId(), 1, orderCrossCity.getPayMoney().doubleValue()); |
| | | } else { |
| | | createAllocationReqUser(1, orderCrossCity.getUserId(), 1, orderCrossCity.getPayMoney().doubleValue()); |
| | | } |
| | | } |
| | | |
| | | System.out.println("退款"); |
| | | String billNo = orderCrossCity.getBillNo(); |
| | | // cancleMoney(orderCrossCity.getPayMoney(),billNo); |
| | |
| | | tOrderCrossCityService.updateById(tOrderCrossCity); |
| | | return SUCCESS_TIP; |
| | | } |
| | | // appId: 8a81c1bf831e72e30187ad640adf49be |
| | | // appKey: 6463dcd46c6d410eb40e68ee40e86e84 |
| | | // md5key: NxDhJztSzCDFzs3Z5Fzck7BAG2sRA4DY5aKScJDZrAzMkCh7 |
| | | // msgSrcId: 34U0 |
| | | // mid: 898150841210108 |
| | | // tid: 84UJWSE8 |
| | | // instMid: QRPAYDEFAULT |
| | | |
| | | |
| | | |
| | | public static ResultUtil cancleMoney(BigDecimal amount,String no) throws Exception { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("requestTimestamp", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss")); // 报文请求时间 |
| | |
| | | @Autowired |
| | | private IUserWithdrawalService userWithdrawalService; |
| | | |
| | | public String createAllocationReq(Integer companyId,Integer userId,int type,double money){ |
| | | List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); |
| | | TDriver tUser = tDriverService.selectById(userId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | return "error"; |
| | | } |
| | | |
| | | AllocationReq allocationReq= new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | if(type==1){ |
| | | |
| | | allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | |
| | | allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | }else { |
| | | allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | } |
| | | money=money*100; |
| | | allocationReq.setAmount((int)money); |
| | | allocationReq.setProductName("分账"); |
| | | allocationReq.setProductCount(1); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setOrderAmount(1l); |
| | | try { |
| | | AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println(allocationResp); |
| | | return "ok"; |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | } |
| | | public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money){ |
| | | List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); |
| | | TUser tUser = userService.selectById(userId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | return "error"; |
| | | } |
| | | AllocationReq allocationReq= new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | if(type==1){ |
| | | |
| | | allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | |
| | | allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | }else { |
| | | allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | } |
| | | money=money*100; |
| | | allocationReq.setAmount((int)money); |
| | | allocationReq.setProductName("分账"); |
| | | allocationReq.setProductCount(1); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setOrderAmount(1l); |
| | | try { |
| | | AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println(allocationResp); |
| | | return "ok"; |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | ResultUtil resultUtil = cancleMoney(new BigDecimal(0.01), "34U02023062418175413584261700"); |
| | | } |
| | | } |