| | |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.Receive; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.ReceiveUser; |
| | |
| | | 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; |
| | | |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IBranchOfficeService branchOfficeService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/order/queryServerPrice") |
| | | // @ServiceLog(name = "获取正在进行中的订单id", url = "/api/order/queryServerOrder") |
| | | @ApiOperation(value = "根据定位获取恶劣天气+节假日信息", tags = {"用户端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "经度", name = "lon", required = true, dataType = "String"), |
| | | }) |
| | | public ResponseWarpper<Integer> queryServerPrice(String lat,String lon){ |
| | | try { |
| | | Integer i =0; // 0为不能接单 1为恶劣天气 2为节假日 3为恶劣+节假日 |
| | | District geocode = MapUtil.geocode(lon, lat); |
| | | String districtCode = geocode.getDistrictCode(); |
| | | List<BranchOffice> districtCode1 = branchOfficeService.selectList(new EntityWrapper<BranchOffice>().eq("districtCode", districtCode).eq("status",1)); |
| | | if(districtCode1.size()>0){ |
| | | BranchOffice branchOffice = districtCode1.get(0); |
| | | Integer id = branchOffice.getId(); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId", id)); |
| | | SystemConfig systemConfig9 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 9).eq("companyId", id)); |
| | | if(systemConfig!=null && systemConfig9!=null){ |
| | | String content = systemConfig.getContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(content); |
| | | String num1 = jsonObject.get("num1").toString(); |
| | | String content9 = systemConfig9.getContent(); |
| | | JSONObject jsonObject9 = JSONObject.parseObject(content9); |
| | | String num9 = jsonObject9.get("num1").toString(); |
| | | if("1".equals(num1)){ |
| | | i=1; |
| | | } |
| | | if("1".equals(num9)){ |
| | | i=2; |
| | | } |
| | | if("1".equals(num1)&&"1".equals(num9)){ |
| | | i=3; |
| | | } |
| | | } |
| | | } |
| | | return ResponseWarpper.success(i); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | @Autowired |
| | | private IRechargeRecordService rechargeRecordService; |
| | | |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(2 == status){ |
| | | Order order = orderService.selectById(orderId); |
| | | AccountChangeDetail accountChangeDetail = accountChangeDetailService.selectById(parameter2); |
| | | Double m = accountChangeDetail.getOldData() - accountChangeDetail.getNewData(); |
| | | 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(appUser1.getAccountBalance() + m); |
| | | 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("支付失败"); |
| | |
| | | } |
| | | 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() { |
| | | 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"); |