| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.supersavedriving.driver.modular.system.model.DivisionRecord; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | 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.warpper.OrderInfoWarpper; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | 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.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private RongYunUtil rongYunUtil; |
| | | |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), |
| | | @ApiImplicitParam(value = "原因", name = "cause", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "phone", name = "phone", required = false, dataType = "string"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper transferOrder(Long orderId, String cause){ |
| | | public ResponseWarpper transferOrder(Long orderId, String cause,String phone){ |
| | | if(ToolUtil.isEmpty(orderId)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("orderId")); |
| | | } |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause); |
| | | ResultUtil resultUtil = orderService.transferOrder(uid, orderId, cause,phone); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | 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() { |
| | | DivisionRecord divisionRecord = divisionRecordService.selectById(divisionRecordId); |
| | | Receive receive = new Receive();//确认收货 |
| | | receive.setOriginalMerOrderId(merOrderId); |
| | | receive.setRcvAmount(String.valueOf(Double.valueOf(divisionRecord.getAmount() * 100).intValue())); |
| | | 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(String.valueOf(Double.valueOf(divisionRecord.getAmount() * 100).intValue())); |
| | | 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(); |
| | |
| | | logger.warn("确认收货处理中"); |
| | | } |
| | | } |
| | | }, 15000); |
| | | }, 60000); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |