| | |
| | | import com.agentdriving.driver.modular.system.warpper.*; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.driver.modular.system.model.Driver; |
| | | import com.agentdriving.driver.modular.system.model.DriverBank; |
| | | import com.agentdriving.driver.modular.system.model.Edition; |
| | | import com.agentdriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.agentdriving.driver.modular.system.service.*; |
| | | import com.agentdriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.agentdriving.driver.modular.system.util.huawei.SMSUtil; |
| | | import com.agentdriving.driver.modular.system.warpper.*; |
| | | import com.agentdriving.driver.modular.system.util.RedisUtil; |
| | | import com.agentdriving.driver.modular.system.util.ResultUtil; |
| | | import com.agentdriving.driver.modular.system.util.UUIDUtil; |
| | |
| | | } |
| | | } |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | SMSUtil.send(phone, "4d18e74a95ca400d802755fe0f903589", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | |
| | | * @return |
| | | */ |
| | | List<DriverYouTuiWarpper> queryAllYouTui(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | */ |
| | | void editState(); |
| | | } |
| | |
| | | UNIX_TIMESTAMP(createTime) * 1000 as createTime, |
| | | (newData - oldData) as money, |
| | | newData as balance |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} |
| | | from t_account_change_detail where changeType = 5 and userType = 2 and userId = #{driverId} |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | |
| | | from ( |
| | | select |
| | | (newData - oldData) as money |
| | | from t_account_change_detail where userType = 2 and userId = #{driverId} |
| | | from t_account_change_detail where changeType = 5 and userType = 2 and userId = #{driverId} |
| | | <if test="null != time and '' != time"> |
| | | and DATE_FORMAT(createTime, '%Y年%m月') = #{time} |
| | | </if> |
| | |
| | | content |
| | | from t_you_tui where status = 1 order by createTime desc limit #{pageNum}, #{pageSize} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <update id="editState"> |
| | | update t_you_tui_driver set state = 3 where failureTime <= now() and state != 3 |
| | | </update> |
| | | </mapper> |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil redeemBenefits(Integer driverId, Integer id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * @throws Exception |
| | | */ |
| | | void editState() throws Exception; |
| | | } |
| | |
| | | if(null != driver && driver.getApprovalStatus() == 2){ |
| | | return ResultUtil.error("该手机账号已审核通过,请直接登录。"); |
| | | } |
| | | String idcardFront = driverRegisterWarpper.getIdcardFront(); |
| | | MultipartFile file = MultipartFileUtil.fileToMultipartFile(new File(idcardFront)); |
| | | JSONObject certificate = OCRUtil.certificate(2, file); |
| | | if(null == certificate){ |
| | | return ResultUtil.error("身份证识别失败"); |
| | | } |
| | | String idcode = certificate.getString("公民身份号码"); |
| | | driver.setIdcard(idcode); |
| | | |
| | | |
| | | String driverLicense = driverRegisterWarpper.getDriverLicense(); |
| | | file = MultipartFileUtil.fileToMultipartFile(new File(driverLicense)); |
| | | certificate = OCRUtil.certificate(5, file); |
| | | if(null == certificate){ |
| | | return ResultUtil.error("驾驶证识别失败"); |
| | | } |
| | | System.err.println("驾驶证:" + certificate.toString()); |
| | | String driverLicenseNumber = certificate.getString("驾驶证号码"); |
| | | driver.setDriverLicenseNumber(driverLicenseNumber); |
| | | driver.setFirstCertificateTime(null); |
| | | // String idcardFront = driverRegisterWarpper.getIdcardFront(); |
| | | // MultipartFile file = MultipartFileUtil.fileToMultipartFile(new File(idcardFront)); |
| | | // JSONObject certificate = OCRUtil.certificate(2, file); |
| | | // if(null == certificate){ |
| | | // return ResultUtil.error("身份证识别失败"); |
| | | // } |
| | | // String idcode = certificate.getString("公民身份号码"); |
| | | // driver.setIdcard(idcode); |
| | | // |
| | | // |
| | | // String driverLicense = driverRegisterWarpper.getDriverLicense(); |
| | | // file = MultipartFileUtil.fileToMultipartFile(new File(driverLicense)); |
| | | // certificate = OCRUtil.certificate(5, file); |
| | | // if(null == certificate){ |
| | | // return ResultUtil.error("驾驶证识别失败"); |
| | | // } |
| | | // System.err.println("驾驶证:" + certificate.toString()); |
| | | // String driverLicenseNumber = certificate.getString("驾驶证号码"); |
| | | // driver.setDriverLicenseNumber(driverLicenseNumber); |
| | | // driver.setFirstCertificateTime(null); |
| | | |
| | | |
| | | //账号审核拒绝后的处理 |
| | |
| | | public ResultUtil<List<String>> queryDriverPosition(Integer uid) throws Exception { |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); |
| | | if(null == driverWork){ |
| | | return ResultUtil.error("请先上班"); |
| | | return ResultUtil.error("请先上班", new ArrayList<>()); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | List<String> list = new ArrayList<>(); |
| | |
| | | List<HallOrderList> hallOrderLists = this.baseMapper.queryOrderHall(pageNum, pageSize); |
| | | hallOrderLists.forEach(hallOrderList -> { |
| | | if(ToolUtil.isEmpty(hallOrderList.getAvatar())){ |
| | | hallOrderList.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/66cc269703a84e4da87fb21e2c21ab1f.png"); |
| | | hallOrderList.setAvatar("https://fanghuadaijia.obs.cn-southwest-2.myhuaweicloud.com:443/img%2Fc68f32a7e78e4ef1b0c018fd2c15d7a7.png"); |
| | | } |
| | | hallOrderList.setCurrentDistance(0D); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | |
| | | orderTransferService.insert(orderTransfer); |
| | | } |
| | | |
| | | pushUtil.pushTransferSuccessful(order.getUserId(), 1, order.getId()); |
| | | pushUtil.pushTransferSuccessful(oldDriverId, 2, order.getId()); |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushTransferSuccessful(order.getUserId(), 1, order.getId()); |
| | | } |
| | | } |
| | | |
| | | //推动订单数据 |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(null != order.getUserId()){ |
| | | pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getStatus()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | this.insert(youTuiDriver); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |
| | | public void editState() throws Exception { |
| | | this.baseMapper.editState(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import java.io.*; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | public class MultipartFileUtil { |
| | | |
| | | private MultipartFileUtil() { } |
| | | |
| | | // public static MultipartFile fileToMultipartFile(String path) { |
| | | // URL url = new URL(path); |
| | | // URLConnection urlConnection = url.openConnection(); |
| | | // InputStream inputStream = urlConnection.getInputStream(); |
| | | // |
| | | // FileItem fileItem = createFileItem(inputStream, file); |
| | | // MultipartFile multipartFile = new CommonsMultipartFile(fileItem); |
| | | // return multipartFile; |
| | | // } |
| | | |
| | | |
| | | public static MultipartFile fileToMultipartFile(File file) { |
| | |
| | | } |
| | | return item; |
| | | } |
| | | |
| | | |
| | | |
| | | private static FileItem createFileItem(InputStream inputStream, String fileName) { |
| | | FileItemFactory factory = new DiskFileItemFactory(16, null); |
| | | FileItem item = factory.createItem("textField", "text/plain", true, fileName); |
| | | int bytesRead = 0; |
| | | byte[] buffer = new byte[8192]; |
| | | try { |
| | | OutputStream os = item.getOutputStream(); |
| | | while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return item; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | // String url = "https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/admin%2F%2Fstorage%2Femulated%2F0%2FAndroid%2Fdata%2Fcom.cheaper.driver%2Fcache%2Fimage%2F1681352347391.jpg"; |
| | | // MultipartFile multipartFile = MultipartFileUtil.fileToMultipartFile(url); |
| | | // System.err.println(multipartFile.getName()); |
| | | } |
| | | } |
| | |
| | | import com.agentdriving.driver.modular.system.service.IAccountChangeDetailService; |
| | | import com.agentdriving.driver.modular.system.service.IDriverService; |
| | | import com.agentdriving.driver.modular.system.service.IOrderService; |
| | | import com.agentdriving.driver.modular.system.service.IYouTuiDriverService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | public void taskMinute(){ |
| | | try { |
| | | orderService.completeCollection(); |
| | | youTuiDriverService.editState(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | */ |
| | | public static void send(String phones, String templateId, String templateParas) throws Exception { |
| | | //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "9I0xrhdGXthf1fv9nn8G3glZ6Zng"; //APP_Key |
| | | String appSecret = "U7WxwX2LVk2YD6KAHxjc9tdnXoM9"; //APP_Secret |
| | | String sender = "8823031523874"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | String url = "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "lU6EsIbXNpe39uoZfL71I4n5QK3q"; //APP_Key |
| | | String appSecret = "1zyUgI0js7LV5S2euJdf0KuJxM6w"; //APP_Secret |
| | | String sender = "8823052930697"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | // String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID |
| | | |
| | | //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | |
| | | private String endAddress; |
| | | @ApiModelProperty("订单状态") |
| | | private Integer state; |
| | | @ApiModelProperty("订单来源(1=乘客,2=司机)") |
| | | @ApiModelProperty("订单来源(1=乘客,2=司机,3=管理后台)") |
| | | private Integer source; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | import com.stylefeng.guns.modular.system.controller.util.HttpUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.TokenUtils; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper; |
| | | import com.stylefeng.guns.modular.system.enums.UserTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TDriverWork; |
| | | import com.stylefeng.guns.modular.system.model.TRechargeRecord; |
| | | import com.stylefeng.guns.modular.system.model.TRegion; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private ITRechargeRecordService tRechargeRecordService; |
| | | |
| | | @Autowired |
| | | private ITSystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private AccountChangeDetailMapper accountChangeDetailMapper; |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | |
| | | tDriver.setApprovalUserId(shiroUser.getId()); |
| | | tDriver.setApprovalTime(new Date()); |
| | | tDriverService.updateById(tDriver); |
| | | |
| | | //增加积分奖励 |
| | | if(approvalStatus == 2){ |
| | | TSystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<TSystemConfig>().eq("type", 4)); |
| | | Integer num7 = JSON.parseObject(systemConfig.getContent()).getInteger("num7"); |
| | | TDriver tDriver1 = tDriverService.selectById(tDriver.getInviterId()); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | | accountChangeDetail.setUserType(2); |
| | | accountChangeDetail.setUserId(tDriver1.getId()); |
| | | accountChangeDetail.setType(2); |
| | | accountChangeDetail.setChangeType(10); |
| | | accountChangeDetail.setOldData(tDriver1.getIntegral().doubleValue()); |
| | | tDriver1.setIntegral(tDriver1.getIntegral() + num7); |
| | | accountChangeDetail.setNewData(tDriver1.getIntegral().doubleValue()); |
| | | accountChangeDetail.setExplain("推荐奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | tDriverService.updateById(tDriver1); |
| | | } |
| | | |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.AccountChangeDetail; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:33 |
| | | */ |
| | | public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.AccountChangeDetailMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.AccountChangeDetail"> |
| | | <id column="id" property="id"/> |
| | | <result column="code" property="code"/> |
| | | <result column="userType" property="userType"/> |
| | | <result column="userId" property="userId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="changeType" property="changeType"/> |
| | | <result column="oldData" property="oldData"/> |
| | | <result column="newData" property="newData"/> |
| | | <result column="orderId" property="orderId"/> |
| | | <result column="explain" property="explain"/> |
| | | <result column="createTime" property="createTime"/> |
| | | </resultMap> |
| | | </mapper> |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 账户变动记录 |
| | | * @author zhibing.pu |
| | | * @date 2023/3/4 11:30 |
| | | */ |
| | | @Data |
| | | @TableName("t_account_change_detail") |
| | | public class AccountChangeDetail { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @TableField("code") |
| | | private String code; |
| | | /** |
| | | * 用户类型(1=用户,2=司机) |
| | | */ |
| | | @TableField("userType") |
| | | private Integer userType; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("userId") |
| | | private Integer userId; |
| | | /** |
| | | * 类型(1=余额,2=积分) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付,9=线下收款支付,10=推荐奖励) |
| | | */ |
| | | @TableField("changeType") |
| | | private Integer changeType; |
| | | /** |
| | | * 历史数据 |
| | | */ |
| | | @TableField("oldData") |
| | | private Double oldData; |
| | | /** |
| | | * 新数据 |
| | | */ |
| | | @TableField("newData") |
| | | private Double newData; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Long orderId; |
| | | /** |
| | | * 变动说明 |
| | | */ |
| | | @TableField("explain") |
| | | private String explain; |
| | | /** |
| | | * 变动时间 |
| | | */ |
| | | @TableField("createTime") |
| | | private Date createTime; |
| | | } |
| | |
| | | */ |
| | | public static void send(String phones, String templateId, String templateParas) throws Exception { |
| | | //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "9I0xrhdGXthf1fv9nn8G3glZ6Zng"; //APP_Key |
| | | String appSecret = "U7WxwX2LVk2YD6KAHxjc9tdnXoM9"; //APP_Secret |
| | | String sender = "8823031523874"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | String url = "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "lU6EsIbXNpe39uoZfL71I4n5QK3q"; //APP_Key |
| | | String appSecret = "1zyUgI0js7LV5S2euJdf0KuJxM6w"; //APP_Secret |
| | | String sender = "8823052930697"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | // String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID |
| | | |
| | | //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | |
| | | </div> |
| | | </div> |
| | | <hr/> |
| | | |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >身份证正面照:</label><br/> |
| | | <img src="${idcardFront}" style="height: 100px;width: 100px"/> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">身份证背面照:</label><br/> |
| | | <img src="${idcardBack}" style="height: 100px;width: 100px"/> |
| | | </div> |
| | | </div> |
| | | <div class="initialLevel col-sm-12 control-label form-group" > |
| | | <div class="initialLevel col-sm-3 control-label form-group" > |
| | | <label class="control-label" >驾驶证照片:</label><br/> |
| | | <img src="${driverLicense}" style="height: 100px;width: 100px"/> |
| | | </div> |
| | | <div class="initialLevel col-sm-2 control-label form-group" > |
| | | <label class="control-label">身份证照片:</label><br/> |
| | | <img src="${idcardFront}" style="height: 100px;width: 100px"/> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | TSystemConfig.serviceMgmtSubmit = function () { |
| | | |
| | | var num1 = $("#num1").val(); |
| | | var reg=/^1[3-9]\d{9}$/;//由 1-9开头 的正则表达式 |
| | | var reg=/(^1[3-9]\d{9}$)|(^400\d)/;//由 1-9开头 的正则表达式 |
| | | //先判断是否为整数 在判断 是否在 1-总页 整数范围之内 |
| | | if(!reg.test(num1)){ |
| | | Feng.error("请输入合法手机号!"); |
| | | Feng.error("请输入合法电话号码!"); |
| | | return; |
| | | } |
| | | |
| | |
| | | message: '联系电话不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^1[3-9]\d{9}$/, |
| | | message: '请输入合法手机号' |
| | | regexp: /(^1[3-9]\d{9})$|(^400\d)$/, |
| | | message: '请输入合法电话号' |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | try { |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | SMSUtil.send(phone, "4d18e74a95ca400d802755fe0f903589", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | try { |
| | | Html html = htmlService.selectOne(new EntityWrapper<Html>().eq("type",10)); |
| | | StartPriceWarpper startPriceWarpper = new StartPriceWarpper(); |
| | | //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1},"description":"这是一段说明文本"} |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("HHmm"); |
| | | Integer integer = Integer.valueOf(sdf.format(new Date())); |
| | | for (int i = 0; i < chargeStandard.size(); i++) { |
| | | boolean b = true; |
| | | Date date = new Date(); |
| | | for (int i = 1; i < chargeStandard.size(); i++) {//各种时间段 |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | num1 = num1.replaceAll(":", ""); |
| | | num2 = num2.replaceAll(":", ""); |
| | | JSONArray num3 = jsonObject1.getJSONArray("num3");//起步里程 |
| | | |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | if(integer >= Integer.valueOf(num1) && integer < Integer.valueOf(num2)){ |
| | | startPriceWarpper.setStartPrice(num4); |
| | | startPriceWarpper.setStartDistance(num3); |
| | | startPriceWarpper.setExcessMileageUnitPrice(num6); |
| | | startPriceWarpper.setOvermileage(num5); |
| | | String[] split = num1.split(":"); |
| | | Calendar s = Calendar.getInstance(); |
| | | s.setTime(date); |
| | | s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | s.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | s.set(Calendar.SECOND, 0); |
| | | |
| | | split = num2.split(":"); |
| | | Calendar e = Calendar.getInstance(); |
| | | e.setTime(date); |
| | | e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(split[0])); |
| | | e.set(Calendar.MINUTE, Integer.valueOf(split[1])); |
| | | e.set(Calendar.SECOND, 0); |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | b = false; |
| | | for (int j = 0; j < num3.size(); j++) { |
| | | JSONObject jsonObject2 = num3.getJSONObject(j); |
| | | Double num1_1 = jsonObject2.getDouble("num1"); |
| | | Double num2_1 = jsonObject2.getDouble("num2"); |
| | | Double num3_1 = jsonObject2.getDouble("num3"); |
| | | startPriceWarpper.setStartPrice(num3_1); |
| | | startPriceWarpper.setStartDistance(num1_1); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(b){//默认配置 |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(0); |
| | | JSONArray num3 = jsonObject1.getJSONArray("num3");//起步里程 |
| | | for (int j = 0; j < num3.size(); j++) { |
| | | JSONObject jsonObject2 = num3.getJSONObject(j); |
| | | Double num1_1 = jsonObject2.getDouble("num1"); |
| | | Double num2_1 = jsonObject2.getDouble("num2"); |
| | | Double num3_1 = jsonObject2.getDouble("num3"); |
| | | startPriceWarpper.setStartPrice(num3_1); |
| | | startPriceWarpper.setStartDistance(num1_1); |
| | | } |
| | | } |
| | | startPriceWarpper.setDescription(null == html ? "" : html.getHtml()); |
| | | return ResponseWarpper.success(startPriceWarpper); |
| | | }catch (Exception e){ |
| | |
| | | if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | appUser.setNickname("亲爱的用户"); |
| | | appUser.setAvatar("https://csxdj.obs.cn-south-1.myhuaweicloud.com:443/66cc269703a84e4da87fb21e2c21ab1f.png"); |
| | | appUser.setAvatar("https://fanghuadaijia.obs.cn-southwest-2.myhuaweicloud.com:443/img%2Fc68f32a7e78e4ef1b0c018fd2c15d7a7.png"); |
| | | appUser.setPhone(purePhoneNumber); |
| | | appUser.setOpenid(openid); |
| | | appUser.setUnionid(code2Session.getUnionid()); |
| | |
| | | |
| | | if(date.getTime() >= s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){ |
| | | b = false; |
| | | Double dd = 0d; |
| | | for (int j = 0; j < num3.size(); j++) { |
| | | JSONObject jsonObject2 = num3.getJSONObject(j); |
| | | Double num1_1 = jsonObject2.getDouble("num1"); |
| | |
| | | if(num1_1.compareTo(distance) <= 0 && num2_1.compareTo(distance) > 0){ |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num3_1);//起步价 |
| | | break; |
| | | } |
| | | if(j == num3.size() - 1 && order.getStartPrice() == 0){ |
| | | order.setStartDistance(num2_1);//起步里程 |
| | | order.setStartPrice(num3_1);//起步价 |
| | | dd = distance - num2_1; |
| | | } |
| | | } |
| | | if(dd != 0){ |
| | | //计算长途费 |
| | | if(distance.compareTo(num4) > 0){ |
| | | order.setLongDistance(num4 + "-" + num5);//长途里程 |
| | |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | Double num7 = jsonObject1.getDouble("num7");//超出长途里程每num10公里 |
| | | Double num8 = jsonObject1.getDouble("num8");//超过num8每num10公里收取num11 |
| | | |
| | | Double dd = 0d; |
| | | for (int j = 0; j < num3.size(); j++) { |
| | | JSONObject jsonObject2 = num3.getJSONObject(j); |
| | | Double num1_1 = jsonObject2.getDouble("num1"); |
| | |
| | | if(num1_1.compareTo(distance) <= 0 && num2_1.compareTo(distance) > 0){ |
| | | order.setStartDistance(distance);//起步里程 |
| | | order.setStartPrice(num3_1);//起步价 |
| | | break; |
| | | } |
| | | if(j == num3.size() - 1 && order.getStartPrice() == 0){ |
| | | order.setStartDistance(num2_1);//起步里程 |
| | | order.setStartPrice(num3_1);//起步价 |
| | | dd = distance - num2_1; |
| | | } |
| | | } |
| | | if(dd != 0){ |
| | | //计算长途费 |
| | | if(distance.compareTo(num4) > 0){ |
| | | order.setLongDistance(num4 + "-" + num5);//长途里程 |
| | |
| | | BigDecimal multiply1 = divide1.multiply(new BigDecimal(num8)); |
| | | order.setOverLongDistance(subtract1.doubleValue());//超出长途里程 |
| | | order.setOverLongDistancePrice(multiply1.doubleValue());//超出长途里程费 |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | return ResultUtil.error("司机还未上班"); |
| | | } |
| | | Driver driver = driverService.selectById(travelOrder.getDriverId()); |
| | | if(driver.getServerStatus() == 2){ |
| | | return ResultUtil.error("司机正在服务中"); |
| | | } |
| | | if(driver.getServerStatus() == 1){ |
| | | order.setAgentId(driver.getAgentId()); |
| | | order.setBranchOfficeId(driver.getBranchOfficeId()); |
| | | order.setOrderTakingTime(new Date()); |
| | | |
| | | driver.setServerStatus(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | appUser.setCancelCount(0); |
| | | appUser.setIsException(1); |
| | |
| | | } |
| | | |
| | | if(appUser.getHavDiscount() == 1){//9折 |
| | | payMoney = payMoney * 0.9; |
| | | order.setDiscount(9D); |
| | | order.setDiscountAmount(payMoney * 0.1); |
| | | payMoney = payMoney * 0.9; |
| | | } |
| | | |
| | | order.setPayType(2); |
| | |
| | | order.setPayType(1); |
| | | order.setPayMoney(payMoney); |
| | | |
| | | payMoney = payMoney > appUser.getAccountBalance() ? payMoney - appUser.getAccountBalance() : 0D; |
| | | payMoney = payMoney.compareTo(appUser.getAccountBalance()) > 0 ? payMoney - appUser.getAccountBalance() : 0D; |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); |
| | |
| | | accountChangeDetail.setChangeType(2); |
| | | accountChangeDetail.setOrderId(order.getId()); |
| | | accountChangeDetail.setExplain("代驾服务费"); |
| | | appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); |
| | | appUser.setAccountBalance(appUser.getAccountBalance().compareTo(payMoney) > 0 ? appUser.getAccountBalance() - payMoney : 0); |
| | | accountChangeDetail.setNewData(appUser.getAccountBalance()); |
| | | appUserService.updateById(appUser); |
| | | accountChangeDetailService.insert(accountChangeDetail); |
| | |
| | | */ |
| | | public static void send(String phones, String templateId, String templateParas) throws Exception { |
| | | //必填,请参考"开发准备"获取如下数据,替换为实际值 |
| | | String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "9I0xrhdGXthf1fv9nn8G3glZ6Zng"; //APP_Key |
| | | String appSecret = "U7WxwX2LVk2YD6KAHxjc9tdnXoM9"; //APP_Secret |
| | | String sender = "8823031523874"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | String url = "https://smsapi.cn-north-4.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI |
| | | String appKey = "lU6EsIbXNpe39uoZfL71I4n5QK3q"; //APP_Key |
| | | String appSecret = "1zyUgI0js7LV5S2euJdf0KuJxM6w"; //APP_Secret |
| | | String sender = "8823052930697"; //国内短信签名通道号或国际/港澳台短信通道号 |
| | | // String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID |
| | | |
| | | //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 |
| | | //国际/港澳台短信不用关注该参数 |
| | | String signature = "超省新代驾"; //签名名称 |
| | | String signature = "芳华代驾"; //签名名称 |
| | | |
| | | //必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 |
| | | // String receiver = "+86151****6789,+86152****7890"; //短信接收人号码 |