| | |
| | | @ResponseBody |
| | | public Object rechargeBalance(Integer id, String money) { |
| | | TDriver tDriver = tDriverService.selectById(id); |
| | | tDriver.setBackgroundBalance(new BigDecimal(money).add(tDriver.getBackgroundBalance())); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | // 添加充值记录 |
| | | TRechargeRecord tRechargeRecord = new TRechargeRecord(); |
| | |
| | | Integer id1 = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | tRechargeRecord.setAgentId(id1); |
| | | tRechargeRecordService.insert(tRechargeRecord); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setUserId(id); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setChangeType(10); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetail.setExplain("平台充值"); |
| | | accountChangeDetail.setOldData(tDriver.getBalance().add(tDriver.getBackgroundBalance()).add(tDriver.getCouponBalance()).add(tDriver.getCommission()).doubleValue()); |
| | | tDriver.setBackgroundBalance(new BigDecimal(money).add(tDriver.getBackgroundBalance())); |
| | | tDriverService.updateById(tDriver); |
| | | accountChangeDetail.setNewData(tDriver.getBalance().add(tDriver.getBackgroundBalance()).add(tDriver.getCouponBalance()).add(tDriver.getCommission()).doubleValue()); |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | map.put("onLineDriver",list1); |
| | | }else { |
| | | List<TAgent> tAgentList = tAgentService.selectList(new EntityWrapper<TAgent>() |
| | | .eq("provinceCode", "440000")); |
| | | .eq("provinceCode", "530000")); |
| | | List<Integer> ids = tAgentList.stream().map(TAgent::getId).collect(Collectors.toList()); |
| | | // 查询统计在线司机,待接单,服务中,已完成,已取消 |
| | | List<TDriver> onLineDriver = tDriverService.selectList(new EntityWrapper<TDriver>() |
| | | .in("agentId", ids)); |
| | | |
| | | Map<String, String> mapAddress = geocode("广东省广州市"); |
| | | Map<String, String> mapAddress = geocode("云南省昆明市"); |
| | | map.put("addressLon",mapAddress.get("addressLon")); |
| | | map.put("addressLat",mapAddress.get("addressLat")); |
| | | |
| | |
| | | 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.shiro.ShiroKit; |
| | | 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.dao.TCancelOrderMapper; |
| | | 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 org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | |
| | | private ITAppUserService tAppUserService; |
| | | @Autowired |
| | | private ITCancelOrderService tCancelOrderService; |
| | | @Resource |
| | | private TCancelOrderMapper tCancelOrderMapper; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index() { |
| | | public String index(Model model) { |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | List<TOrderResp> tOrderResps = tCancelOrderMapper.orderExceptionList(null, null, null, null, null, null, null, null, roleType, objectId); |
| | | model.addAttribute("error", tOrderResps.size()); |
| | | return PREFIX + "tOrder.html"; |
| | | } |
| | | |
| | |
| | | Integer state, |
| | | String driverName) { |
| | | // return tOrderService.getOrderList(createTime, code, source, userName, userPhone, state, driverName,2); |
| | | return tCancelOrderService.getCancelOrderList(createTime, code, source, userName, userPhone, state, driverName); |
| | | return tCancelOrderService.orderExceptionList(createTime, code, source, userName, userPhone, state, driverName); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | public class TDriverResp extends TDriver { |
| | | //驾龄 |
| | | private Integer driverAge; |
| | | |
| | | //所属代理商 |
| | | @ApiModelProperty(value = "所属代理商") |
| | |
| | | public void setRefusalCount(Integer refusalCount) { |
| | | this.refusalCount = refusalCount; |
| | | } |
| | | |
| | | public Integer getDriverAge() { |
| | | return driverAge; |
| | | } |
| | | |
| | | public void setDriverAge(Integer driverAge) { |
| | | this.driverAge = driverAge; |
| | | } |
| | | } |
| | |
| | | @Mapper |
| | | public interface TCancelOrderMapper extends BaseMapper<TCancelOrder> { |
| | | |
| | | |
| | | |
| | | List<TOrderResp> orderExceptionList(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("code") String code, |
| | | @Param("source") Integer source, @Param("userName")String userName, @Param("userPhone")String userPhone, |
| | | @Param("state")Integer state, @Param("driverName")String driverName,@Param("roleType")Integer roleType, |
| | | @Param("objectId")Integer objectId); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询取消订单列表 |
| | | * @param startTime |
| | |
| | | a.nickname AS userName,a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone |
| | | </sql> |
| | | |
| | | |
| | | <select id="orderExceptionList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp"> |
| | | select |
| | | o.id, |
| | | o.createTime, |
| | | o.code, |
| | | o.source, |
| | | o.startTime, |
| | | o.userName, |
| | | o.userPhone, |
| | | o.startAddress, |
| | | o.endAddress, |
| | | d.name as driverName, |
| | | d.phone as driverPhone, |
| | | o.estimatedPrice, |
| | | a.cancelCount, |
| | | o.state, |
| | | a.status AS userStatus |
| | | from t_order o |
| | | left join t_app_user a on o.userId = a.id |
| | | left join t_driver d on o.driverId = d.id |
| | | <where> |
| | | a.cancelCount >= 3 |
| | | <if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
| | | AND o.createTime between #{startTime} and #{endTime} |
| | | </if> |
| | | <if test="code != null and code != ''"> |
| | | AND o.code LIKE concat('%',#{code},'%') |
| | | </if> |
| | | <if test="source != null"> |
| | | AND o.source = #{source} |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | AND a.nickname LIKE concat('%',#{userName},'%') |
| | | </if> |
| | | <if test="userPhone != null and userPhone != ''"> |
| | | AND a.phone LIKE concat('%',#{userPhone},'%') |
| | | </if> |
| | | <if test="state != null"> |
| | | AND o.state = #{state} |
| | | </if> |
| | | <if test="driverName != null and driverName != ''"> |
| | | AND d.name LIKE concat('%',#{driverName},'%') |
| | | </if> |
| | | <if test="roleType != null and roleType == 2"> |
| | | AND o.branchOfficeId = #{objectId} |
| | | </if> |
| | | <if test="roleType != null and roleType == 3"> |
| | | AND o.agentId = #{objectId} |
| | | </if> |
| | | </where> |
| | | ORDER BY o.createTime |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getCancelOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp"> |
| | | select <include refid="Base_Column_Order"></include> |
| | | from t_cancel_order co |
| | |
| | | @TableField("merchantIDCode") |
| | | private String merchantIDCode; |
| | | /** |
| | | * 优惠券余额(订单优惠券支付的金额) |
| | | */ |
| | | @TableField("couponBalance") |
| | | private BigDecimal couponBalance; |
| | | /** |
| | | * 是否打开下单二维码 |
| | | */ |
| | | @TableField("openOrderQRCode") |
| | |
| | | this.openOrderQRCode = openOrderQRCode; |
| | | } |
| | | |
| | | public BigDecimal getCouponBalance() { |
| | | return couponBalance; |
| | | } |
| | | |
| | | public void setCouponBalance(BigDecimal couponBalance) { |
| | | this.couponBalance = couponBalance; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | public interface ITCancelOrderService extends IService<TCancelOrder> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询取消订单列表 |
| | | * @param createTime |
| | | * @param code |
| | | * @param source |
| | | * @param userName |
| | | * @param userPhone |
| | | * @param state |
| | | * @param driverName |
| | | * @return |
| | | */ |
| | | List<TOrderResp> orderExceptionList(String createTime, String code, Integer source, String userName, String userPhone, Integer state, String driverName); |
| | | |
| | | |
| | | /** |
| | | * 查询取消订单列表 |
| | | * @param createTime |
| | |
| | | @Autowired |
| | | private ITOrderService tOrderService; |
| | | |
| | | |
| | | @Override |
| | | public List<TOrderResp> orderExceptionList(String createTime, String code, Integer source, String userName, String userPhone, Integer state, String driverName) { |
| | | String startTime = null; |
| | | String endTime = null; |
| | | // 开始,结束时间 |
| | | if(StringUtils.hasLength(createTime)){ |
| | | String[] split = createTime.split(" - "); |
| | | startTime = split[0]; |
| | | endTime = split[1]; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | return tCancelOrderMapper.orderExceptionList(startTime,endTime,code,source,userName,userPhone,state,driverName,roleType,objectId); |
| | | } |
| | | |
| | | @Override |
| | | public List<TOrderResp> getCancelOrderList(String createTime, String code, Integer source, String userName, String userPhone, Integer state, String driverName) { |
| | | String startTime = null; |
| | |
| | | for (TDriver tDriver : tDrivers) { |
| | | TDriverResp tDriverResp = new TDriverResp(); |
| | | BeanUtils.copyProperties(tDriver,tDriverResp); |
| | | tDriverResp.setDriverAge(0); |
| | | if(null != tDriver.getFirstCertificateTime()){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | tDriverResp.setDriverAge(Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tDriver.getFirstCertificateTime()))); |
| | | } |
| | | |
| | | if(Objects.nonNull(tDriver.getBackgroundBalance()) && Objects.nonNull(tDriver.getBalance())){ |
| | | // 设置余额 |
| | |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | try { |
| | | 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){ |
| | | redisUtil.unlock(); |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | return; |
| | | } |
| | | TSystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | redisUtil.unlock(); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | |
| | | } |
| | | |
| | | if(null != driver){ |
| | | TDriver tDriver = driverService.selectById(driver); |
| | | tDriver.setServerStatus(2); |
| | | driverService.updateById(tDriver); |
| | | |
| | | pushUtil.pushGrabOrder(driver, 2, order.getId(), num4); |
| | | //创建定时任务处理订单到大厅 |
| | | new Timer().schedule(new TimerTask() { |
| | |
| | | public void run() { |
| | | TOrder order1 = TOrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | tDriver.setServerStatus(1); |
| | | driverService.updateById(tDriver); |
| | | |
| | | order1.setHallOrder(1); |
| | | TOrderServiceImpl.this.updateById(order1); |
| | | |
| | |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | } |
| | | redisUtil.unlock(); |
| | | }catch (Exception e){ |
| | | redisUtil.unlock(); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public void ExtraPushOrder(TOrder order){ |
| | |
| | | @Scheduled(cron = "0 0 0 * * *") |
| | | public void taskDay(){ |
| | | try { |
| | | locationService.updateFence();//更新线上电子围栏 |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | queryOrderCount() |
| | | break; |
| | | case "map": |
| | | map("",113.264434,23.129162); |
| | | map("",102.709,25.0635); |
| | | break; |
| | | case "order": |
| | | mapOrder(""); |
| | |
| | | }) |
| | | |
| | | |
| | | /** |
| | | * 定时器 |
| | | */ |
| | | setInterval(function () { |
| | | getData(); |
| | | }, 30000); |
| | | |
| | | |
| | | |
| | | function getData(){ |
| | |
| | | var map = new AMap.Map('containerOrder', { |
| | | viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', |
| | | zoom:10, //初始化地图层级 |
| | | center: [113.264434,23.129162] //初始化地图中心点 |
| | | center: [102.709,25.0635] //初始化地图中心点 |
| | | }); |
| | | // map.clearMap(); // 清除地图覆盖物 |
| | | // 经纬度坐标数组 |
| | |
| | | var map = new AMap.Map('container', { |
| | | viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', |
| | | zoom:10, //初始化地图层级 |
| | | center: [104.043246,30.641849] //初始化地图中心点 |
| | | center: [102.709,25.0635] //初始化地图中心点 |
| | | }); |
| | | // map.clearMap(); // 清除地图覆盖物 |
| | | // 经纬度坐标数组 |
| | |
| | | @if(shiro.hasPermission("/tOrder/tOrder-exception")){ |
| | | <#button name="异常" icon="" clickFun="TOrder.tOrderException()"/> |
| | | @} |
| | | <div style="border-radius: 20px;background-color: red;color: #ffffff;width: 20px;height: 20px;text-align: center;line-height: 20px;font-size: 8px;position: absolute;left: 200px;top: -10px;">${error}</div> |
| | | @if(shiro.hasPermission("/tOrder/export")){ |
| | | <#button name="导出" icon="" clickFun="TOrder.export()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tOrder/cancelOrderUpdate")){ |
| | | <#button name="关闭订单" icon="" clickFun="TOrder.cancelOrderUpdate()"/> |
| | | @} |
| | | </div> |
| | | <#table id="TOrderTable"/> |
| | | </div> |
| | |
| | | } |
| | | }}, |
| | | {title: '驾驶证号码', field: 'driverLicenseNumber', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '驾龄', field: 'driverAge', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '身份证号码', field: 'idcard', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '身份证', field: 'source', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 后台取消订单 |
| | | */ |
| | | 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(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |