|
@@ -21,6 +21,7 @@ import com.sqx.modules.address.entity.Address;
|
|
|
import com.sqx.modules.app.dao.UserDao;
|
|
import com.sqx.modules.app.dao.UserDao;
|
|
|
import com.sqx.modules.app.entity.UserEntity;
|
|
import com.sqx.modules.app.entity.UserEntity;
|
|
|
import com.sqx.modules.app.entity.UserMoneyDetails;
|
|
import com.sqx.modules.app.entity.UserMoneyDetails;
|
|
|
|
|
+import com.sqx.modules.app.entity.queryRiderVo;
|
|
|
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
|
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
|
|
import com.sqx.modules.app.service.UserService;
|
|
import com.sqx.modules.app.service.UserService;
|
|
|
import com.sqx.modules.common.entity.CommonInfo;
|
|
import com.sqx.modules.common.entity.CommonInfo;
|
|
@@ -28,6 +29,7 @@ import com.sqx.modules.common.service.CommonInfoService;
|
|
|
import com.sqx.modules.datacentre.query.DataCenterQuery;
|
|
import com.sqx.modules.datacentre.query.DataCenterQuery;
|
|
|
import com.sqx.modules.errand.dao.ErrandEvaluateDao;
|
|
import com.sqx.modules.errand.dao.ErrandEvaluateDao;
|
|
|
import com.sqx.modules.errand.dao.TbIndentDao;
|
|
import com.sqx.modules.errand.dao.TbIndentDao;
|
|
|
|
|
+import com.sqx.modules.errand.dao.TransferRecordDao;
|
|
|
import com.sqx.modules.errand.dto.OrderRiderDeliveryDTO;
|
|
import com.sqx.modules.errand.dto.OrderRiderDeliveryDTO;
|
|
|
import com.sqx.modules.errand.dto.RiderDeliveryDTO;
|
|
import com.sqx.modules.errand.dto.RiderDeliveryDTO;
|
|
|
import com.sqx.modules.errand.dto.RiderTransferByOrderIdDTO;
|
|
import com.sqx.modules.errand.dto.RiderTransferByOrderIdDTO;
|
|
@@ -37,8 +39,10 @@ import com.sqx.modules.errand.entity.*;
|
|
|
import com.sqx.modules.errand.service.TbIndentService;
|
|
import com.sqx.modules.errand.service.TbIndentService;
|
|
|
import com.sqx.modules.errand.service.TbIndentSmsSendLogService;
|
|
import com.sqx.modules.errand.service.TbIndentSmsSendLogService;
|
|
|
import com.sqx.modules.errand.service.TbIndentSmsTemplateService;
|
|
import com.sqx.modules.errand.service.TbIndentSmsTemplateService;
|
|
|
|
|
+import com.sqx.modules.errand.service.TransferRecordService;
|
|
|
import com.sqx.modules.errand.util.LonLatUtil;
|
|
import com.sqx.modules.errand.util.LonLatUtil;
|
|
|
import com.sqx.modules.errand.vo.ShopWaitAcceptOrderVO;
|
|
import com.sqx.modules.errand.vo.ShopWaitAcceptOrderVO;
|
|
|
|
|
+import com.sqx.modules.errand.vo.queryOrderInfoVo;
|
|
|
import com.sqx.modules.goods.dao.GoodsShopDao;
|
|
import com.sqx.modules.goods.dao.GoodsShopDao;
|
|
|
import com.sqx.modules.goods.dao.GoodsShopRelevancyDao;
|
|
import com.sqx.modules.goods.dao.GoodsShopRelevancyDao;
|
|
|
import com.sqx.modules.goods.entity.GoodsShop;
|
|
import com.sqx.modules.goods.entity.GoodsShop;
|
|
@@ -53,6 +57,7 @@ import com.sqx.modules.pay.controller.app.AliPayController;
|
|
|
import com.sqx.modules.pay.dao.PayDetailsDao;
|
|
import com.sqx.modules.pay.dao.PayDetailsDao;
|
|
|
import com.sqx.modules.pay.entity.PayDetails;
|
|
import com.sqx.modules.pay.entity.PayDetails;
|
|
|
import com.sqx.modules.pay.service.WxService;
|
|
import com.sqx.modules.pay.service.WxService;
|
|
|
|
|
+import com.sqx.modules.printInfo.entity.PrintInfo;
|
|
|
import com.sqx.modules.shop.service.ShopMessageService;
|
|
import com.sqx.modules.shop.service.ShopMessageService;
|
|
|
import com.sqx.modules.utils.HttpClientUtil;
|
|
import com.sqx.modules.utils.HttpClientUtil;
|
|
|
import com.sqx.modules.utils.SenInfoCheckUtil;
|
|
import com.sqx.modules.utils.SenInfoCheckUtil;
|
|
@@ -117,6 +122,8 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
private GoodsShopRelevancyDao goodsShopRelevancyDao;
|
|
private GoodsShopRelevancyDao goodsShopRelevancyDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ShopMessageService shopMessageService;
|
|
private ShopMessageService shopMessageService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TransferRecordDao transferRecordDao;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private TbIndentSmsTemplateService smsTemplateService;
|
|
private TbIndentSmsTemplateService smsTemplateService;
|
|
@@ -926,9 +933,16 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Result findRiderIndent(Long userId, Integer page, Integer limit, String indentState) {
|
|
|
|
|
|
|
+ public Result findRiderIndent(Long userId, Integer page, Integer limit, String indentState, String keyword) {
|
|
|
Page<TbIndent> pages = new Page<>(page, limit);
|
|
Page<TbIndent> pages = new Page<>(page, limit);
|
|
|
- PageUtils pageUtils = new PageUtils(tbIndentDao.findRiderIndent(pages, userId, indentState));
|
|
|
|
|
|
|
+ PageUtils pageUtils = new PageUtils(tbIndentDao.findRiderIndent(pages, userId, indentState, keyword));
|
|
|
|
|
+ return Result.success().put("data", pageUtils);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Result findRiderIndentByIds(Long userId, Integer page, Integer limit, List<String> indentIds) {
|
|
|
|
|
+ Page<queryOrderInfoVo> pages = new Page<>(page, limit);
|
|
|
|
|
+ PageUtils pageUtils = new PageUtils(tbIndentDao.findRiderIndentByIds(pages, userId, indentIds));
|
|
|
return Result.success().put("data", pageUtils);
|
|
return Result.success().put("data", pageUtils);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -955,6 +969,17 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
indent.setIsRider(1);
|
|
indent.setIsRider(1);
|
|
|
updateById(indent);
|
|
updateById(indent);
|
|
|
|
|
|
|
|
|
|
+ String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
|
|
|
|
+ TransferRecordEntity tr = new TransferRecordEntity();
|
|
|
|
|
+ tr.setUserId(userEntity.getUserId());
|
|
|
|
|
+ tr.setUserName(userEntity.getUserName());
|
|
|
|
|
+ tr.setUserPhone(userEntity.getPhone());
|
|
|
|
|
+ tr.setOrderId(indent.getOrderId());
|
|
|
|
|
+ tr.setReceveTime(format);
|
|
|
|
|
+ tr.setStationName(userEntity.getStationName());
|
|
|
|
|
+ tr.setDeleteFlag(0);
|
|
|
|
|
+ transferRecordDao.insert(tr);
|
|
|
|
|
+
|
|
|
// 消息通知
|
|
// 消息通知
|
|
|
noticeAfterTransfer(indent);
|
|
noticeAfterTransfer(indent);
|
|
|
}
|
|
}
|
|
@@ -1519,6 +1544,14 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public List<TbIndent> findIndentsByIds(List<Long> ids) {
|
|
|
|
|
+ QueryWrapper<TbIndent> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapper.in("indent_id",ids);
|
|
|
|
|
+ List<TbIndent> result = baseMapper.selectList(queryWrapper);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
public Result findIncome(Long userId, String date, String dateType, Integer page, Integer limit) {
|
|
public Result findIncome(Long userId, String date, String dateType, Integer page, Integer limit) {
|
|
|
HashMap hashMap = new HashMap();
|
|
HashMap hashMap = new HashMap();
|
|
|
//收益统计
|
|
//收益统计
|
|
@@ -1693,6 +1726,49 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
*
|
|
*
|
|
|
* @param indent
|
|
* @param indent
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void noticeAfterTransfer(TbIndent indent,queryRiderVo user) {
|
|
|
|
|
+ CommonInfo one = commonInfoService.findOne(335);
|
|
|
|
|
+ List<String> msgList = new ArrayList<>();
|
|
|
|
|
+ msgList.add(0, indent.getIndentNumber());
|
|
|
|
|
+ String indentState = indent.getIndentState();
|
|
|
|
|
+ if ("3".equals(indentState)) {
|
|
|
|
|
+ msgList.add(1, "已接单");
|
|
|
|
|
+ } else if ("4".equals(indentState)) {
|
|
|
|
|
+ msgList.add(1, "已取货");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ msgList.add(1, "进行中");
|
|
|
|
|
+ }
|
|
|
|
|
+ msgList.add(2, "骑手已更换,新骑手将尽快为您送达");
|
|
|
|
|
+ msgList.add(3, DateUtils.format(new Date()));
|
|
|
|
|
+ if (StrUtil.isNotEmpty(user.getOpenId())) {
|
|
|
|
|
+ MyGlobalThreadPool.execute(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ SenInfoCheckUtil.sendMsg(user.getOpenId(), one.getValue(), msgList, 5);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("订单:{},转单成功通知发送失败,失败原因:{}", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (StrUtil.isNotEmpty(user.getOpenId())) {
|
|
|
|
|
+ MyGlobalThreadPool.execute(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ userService.pushToSingle("更换骑手", "骑手已更换,新骑手将尽快为您送达", user.getClientid());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("订单:{},骑手已更换通知发送失败,失败原因:{}", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 转单后通知
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param indent
|
|
|
|
|
+ */
|
|
|
private void noticeAfterTransfer(TbIndent indent) {
|
|
private void noticeAfterTransfer(TbIndent indent) {
|
|
|
CommonInfo one = commonInfoService.findOne(335);
|
|
CommonInfo one = commonInfoService.findOne(335);
|
|
|
UserEntity user = userService.getById(indent.getUserId());
|
|
UserEntity user = userService.getById(indent.getUserId());
|
|
@@ -1773,7 +1849,7 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
} else {
|
|
} else {
|
|
|
List<UserEntity> userEntities = userService.queryByRealName(realName);
|
|
List<UserEntity> userEntities = userService.queryByRealName(realName);
|
|
|
if (userEntities.size() > 1) {
|
|
if (userEntities.size() > 1) {
|
|
|
- throw new SqxException("根据姓名查到了多个骑手,其输入手机号码精确查询");
|
|
|
|
|
|
|
+ throw new SqxException("根据姓名查到了多个骑手,请输入手机号码精确查询");
|
|
|
}
|
|
}
|
|
|
if (userEntities.size() == 1) {
|
|
if (userEntities.size() == 1) {
|
|
|
userEntity = userEntities.get(0);
|
|
userEntity = userEntities.get(0);
|
|
@@ -1802,6 +1878,34 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
|
|
|
return userEntity;
|
|
return userEntity;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取新骑手
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param riderUserId 被转单骑手id
|
|
|
|
|
+ * @return 新骑手
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public queryRiderVo getNewRicherCheck(Long riderUserId) {
|
|
|
|
|
+ queryRiderVo userEntity = userService.queryRider(riderUserId);
|
|
|
|
|
+
|
|
|
|
|
+ if (userEntity == null) {
|
|
|
|
|
+ throw new SqxException("用户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 校验当前骑手实名认证、保证金等信息
|
|
|
|
|
+ CommonInfo one1 = commonInfoService.findOne(273);
|
|
|
|
|
+ Double cashDeposit = Double.parseDouble(one1.getValue());
|
|
|
|
|
+ if (!"1".equals(userEntity.getCheckCertification())) {
|
|
|
|
|
+ throw new SqxException("骑手未进行实名认证!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (userEntity.getCashDeposit().doubleValue() < cashDeposit) {
|
|
|
|
|
+ throw new SqxException("骑手保证金不足!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return userEntity;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public PageUtils selectIndentPage(Integer page, Integer limit, String acquireCode, Long userId) {
|
|
public PageUtils selectIndentPage(Integer page, Integer limit, String acquireCode, Long userId) {
|
|
|
List<Integer> states = new ArrayList<>();
|
|
List<Integer> states = new ArrayList<>();
|