| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/queryCaptcha1") |
| | | @ApiOperation(value = "获取短信验证码", tags = {"用户端-分享"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil queryCaptcha1(String phone, Integer type){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | try { |
| | | /* HttpSession session = request.getSession(); |
| | | String code = (String)session.getAttribute(Constants.KAPTCHA_SESSION_KEY);*/ |
| | | // String code = redisUtil.getValue(phone+"_Code"); |
| | | // System.out.println("缓存中验证码为:"+code); |
| | | // if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | // return ResultUtil.error("图形验证码错误"); |
| | | // } |
| | | return userInfoService.queryCaptcha(phone, type); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | | * @param phone |
| | |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phone, String code, Integer uid, Integer type, Integer userType){ |
| | | try { |
| | | UserInfo userInfo = userInfoService.queryByPhone(phone); |
| | | if(null != userInfo){ |
| | | return ResultUtil.error("手机号已注册"); |
| | | } |
| | | return userInfoService.captchaLogin(phone, code, uid, type, userType); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | // @Autowired |
| | | // private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | |
| | | //调用移动的小号接口 |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderCrossCity.getStartLon().toString(), orderCrossCity.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode.get("districtCode")); |
| | | Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderCrossCity.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderCrossCity.setTelX(map.get("telX")); |
| | | orderCrossCity.setBindId(map.get("bindId")); |
| | | } |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderCrossCity.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderCrossCity.setTelX(map.get("telX")); |
| | | // orderCrossCity.setBindId(map.get("bindId")); |
| | | // } |
| | | this.insert(orderCrossCity); |
| | | |
| | | if(driver.getState() == 2){ |
| | |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | } |
| | | // if(orderCrossCity.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | // } |
| | | |
| | | orderCrossCity.setState(10); |
| | | orderCrossCity.setTelX(""); |
| | |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 3, query.getOrderId()); |
| | | orderCrossCity.setState(10); |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | } |
| | | // if(orderCrossCity.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX()); |
| | | // } |
| | | orderCrossCity.setBindId(""); |
| | | orderCrossCity.setTelX(""); |
| | | this.updateById(orderCrossCity); |
| | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | // @Autowired |
| | | // private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | |
| | | @Autowired |
| | | private IAssignOrderService assignOrderService; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | // @Autowired |
| | | // private ALiSendSms aLiSendSms; |
| | | |
| | | |
| | | @Value("${filePath}") |
| | |
| | | //调用移动的小号接口 |
| | | /* Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode1.get("districtCode"));*/ |
| | | Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), null); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderPrivateCar.setTelX(map.get("telX")); |
| | | orderPrivateCar.setBindId(map.get("bindId")); |
| | | } |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), null); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderPrivateCar.setTelX(map.get("telX")); |
| | | // orderPrivateCar.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | |
| | | } |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != orderPrivateCar.getDriverId() && orderPrivateCar.getArriveTime()!=null && |
| | | (orderPrivateCar.getArriveTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != orderPrivateCar.getDriverId() && orderPrivateCar.getSnatchOrderTime()!=null && |
| | | (orderPrivateCar.getSnatchOrderTime().getTime() + query.getMinuteNum() * 60 * 1000) < new Date().getTime()){//收费的情况 |
| | | if(null != query){ |
| | | amount += query.getMoney(); |
| | | } |
| | |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderPrivateCar.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | } |
| | | // if(orderPrivateCar.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | // } |
| | | |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCar.setTelX(""); |
| | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | map.put("balance", userInfo.getBalance()); |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | int i = userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 1, orderPrivateCar.getOrderMoney()); |
| | | i = i + userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 0, orderPrivateCar.getOrderMoney()); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | orderPrivateCar.setDiscount(special); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | orderPrivateCar.setDiscountMoney(orderMoney - v); |
| | | orderPrivateCar.setActivityId(query2.getId()); |
| | | orderMoney = v; |
| | | } |
| | | } |
| | | |
| | | } |
| | | int i = userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 1, orderMoney); |
| | | i = i + userCouponRecordService.queryAvailable(uid, orderPrivateCar.getCompanyId(), 1, 0, orderMoney); |
| | | map.put("coupon", i); |
| | | return map; |
| | | } |
| | |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 1, orderPrivateCar.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 0, orderPrivateCar.getOrderMoney(), pageNum, size); |
| | | Double orderMoney = orderPrivateCar.getOrderMoney(); |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | orderPrivateCar.setDiscount(special); |
| | | double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | if(orderMoney.compareTo(v) > 0){ |
| | | orderPrivateCar.setDiscountMoney(orderMoney - v); |
| | | orderPrivateCar.setActivityId(query2.getId()); |
| | | orderMoney = v; |
| | | } |
| | | } |
| | | |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 1, orderMoney, pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, orderPrivateCar.getCompanyId(), 1, 0, orderMoney, pageNum, size); |
| | | list.addAll(list1); |
| | | return list; |
| | | } |
| | |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId()); |
| | | orderPrivateCar.setState(10); |
| | | //解除小号绑定 |
| | | if(orderPrivateCar.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | } |
| | | // if(orderPrivateCar.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX()); |
| | | // } |
| | | orderPrivateCar.setBindId(""); |
| | | orderPrivateCar.setTelX(""); |
| | | this.updateById(orderPrivateCar); |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.DriverActivityHistory; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface DriverActivityHistoryMapper extends BaseMapper<DriverActivityHistory> { |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> query(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, |
| | | @Param("size") Integer size); |
| | | |
| | | |
| | | |
| | | |
| | | List<DriverActivityHistory> queryList(@Param("driverId") Integer driverId, @Param("type") Integer type, |
| | | @Param("carryOut") Integer carryOut, @Param("start") Date start, |
| | | @Param("end") Date end); |
| | | } |
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.DriverActivityHistoryMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.DriverActivityHistory"> |
| | | <id column="id" property="id"/> |
| | | <result column="day" property="day"/> |
| | | <result column="driverId" property="driverId"/> |
| | | <result column="type" property="type"/> |
| | | <result column="activityId" property="activityId"/> |
| | | <result column="carryOut" property="carryOut"/> |
| | | <result column="money" property="money"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <select id="query" resultType="map"> |
| | | select * from |
| | | ( |
| | | select |
| | | DATE_FORMAT(`day`, '%Y.%m.%d') as time, |
| | | if((select count(id) from t_driver_activity_history where driverId = #{driverId}) > (select count(id) from t_driver_activity_history where driverId = #{driverId} and carryOut = 2), 1, 2) as carryOut |
| | | from t_driver_activity_history where driverId = #{driverId} group by `day` |
| | | ) as a order by a.time desc limit #{pageNum}, #{size} |
| | | </select> |
| | | |
| | | <select id="queryList" resultType="DriverActivityHistory"> |
| | | select |
| | | id as id, |
| | | `day` as `day`, |
| | | driverId as driverId, |
| | | `type` as `type`, |
| | | activityId as activityId, |
| | | carryOut as carryOut, |
| | | money as money, |
| | | insertTime as insertTime |
| | | from t_driver_activity_history where `day` between #{start} and #{end} |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
| | | <if test="null != carryOut"> |
| | | and carryOut = #{carryOut} |
| | | </if> |
| | | <if test="null != driverId"> |
| | | and driverId = #{driverId} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | select |
| | | id as id, |
| | | content as content |
| | | from t_system_price where companyId = #{companyId} |
| | | from t_system_price where companyId = #{companyId} and state = 1 |
| | | <if test="null != type"> |
| | | and `type` = #{type} |
| | | </if> |
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 java.util.Date; |
| | | |
| | | /** |
| | | * 司机每天活动数量 |
| | | */ |
| | | @TableName("t_driver_activity_history") |
| | | public class DriverActivityHistory { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 活动日期 |
| | | */ |
| | | @TableField("day") |
| | | private Date day; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 活动类型(1=邀请司机注册,2=邀请用户注册,3=累计在线,4=订单量) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 活动id |
| | | */ |
| | | @TableField("activityId") |
| | | private Integer activityId; |
| | | /** |
| | | * 是否完成(1=否,2=完成) |
| | | */ |
| | | @TableField("carryOut") |
| | | private Integer carryOut; |
| | | /** |
| | | * 奖励金额 |
| | | */ |
| | | @TableField("money") |
| | | private Double money; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(Date day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getActivityId() { |
| | | return activityId; |
| | | } |
| | | |
| | | public void setActivityId(Integer activityId) { |
| | | this.activityId = activityId; |
| | | } |
| | | |
| | | public Integer getCarryOut() { |
| | | return carryOut; |
| | | } |
| | | |
| | | public void setCarryOut(Integer carryOut) { |
| | | this.carryOut = carryOut; |
| | | } |
| | | |
| | | public Double getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(Double money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "DriverActivityHistory{" + |
| | | "id=" + id + |
| | | ", day=" + day + |
| | | ", driverId=" + driverId + |
| | | ", type=" + type + |
| | | ", activityId=" + activityId + |
| | | ", carryOut=" + carryOut + |
| | | ", money=" + money + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ChinaMobileUtil; |
| | | //import com.stylefeng.guns.modular.system.util.ChinaMobileUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | // @Autowired |
| | | // private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | |
| | | } |
| | | amount = num1 + (d1 * num4) + (t1 * num5) + (wait * num7) + yt1 + yt2 + yt3; |
| | | ServerCarModelWarpper serverCarModelWarpper = ServerCarModelWarpper.getServerCarModelWarpper(map); |
| | | serverCarModelWarpper.setAmount(new BigDecimal(amount).multiply(new BigDecimal(0.85)).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue()); |
| | | serverCarModelWarpper.setAmount(new BigDecimal(amount).setScale(BigDecimal.ROUND_HALF_EVEN, 2).doubleValue()); |
| | | serverCarModelWarpper.setMileage(d); |
| | | serverCarModelWarpper.setDuration(t); |
| | | data.add(serverCarModelWarpper); |
| | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.DriverActivityRegisteredMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DriverMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserActivityInviteMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserInfoMapper; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Resource |
| | | private DriverActivityHistoryMapper driverActivityHistoryMapper; |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(0D) > 0){ |
| | | bigDecimal = bigDecimal.add(new BigDecimal(String.valueOf(map.get("money")))); |
| | | incomeService.saveData(2, driver.getId(), 1, Integer.valueOf(String.valueOf(map.get("id"))), null, Double.valueOf(String.valueOf(map.get("money")))); |
| | | |
| | | DriverActivityHistory driverActivityHistory = new DriverActivityHistory(); |
| | | driverActivityHistory.setActivityId(Integer.valueOf(String.valueOf(map.get("id")))); |
| | | driverActivityHistory.setCarryOut(2); |
| | | driverActivityHistory.setDay(new Date()); |
| | | driverActivityHistory.setDriverId(driver.getId()); |
| | | driverActivityHistory.setInsertTime(new Date()); |
| | | driverActivityHistory.setMoney(Double.valueOf(String.valueOf(map.get("money")))); |
| | | driverActivityHistory.setType(1); |
| | | driverActivityHistoryMapper.insert(driverActivityHistory); |
| | | } |
| | | } |
| | | driver.setActivityMoney(bigDecimal.add(new BigDecimal(driver.getActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | @Override |
| | | public synchronized ResultUtil<LoginWarpper> captchaLogin(String phone, String code, Integer uid, Integer type, Integer userType) throws Exception { |
| | | ResultUtil<LoginWarpper> resultUtil = this.captchaLogin(phone, code, null, null,uid,type,userType); |
| | | |
| | | if(resultUtil.getCode() == 200 && null != uid){ |
| | | if(type == 2){//司机分享 |
| | | Driver driver = driverMapper.selectById(uid); |
| | | List<Map<String, Object>> query = driverActivityRegisteredMapper.query(userType, driver.getCompanyId()); |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | for(Map<String, Object> map : query){ |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(0D) > 0){ |
| | | bigDecimal = bigDecimal.add(new BigDecimal(String.valueOf(map.get("money")))); |
| | | incomeService.saveData(2, driver.getId(), 1, Integer.valueOf(String.valueOf(map.get("id"))), null, Double.valueOf(String.valueOf(map.get("money")))); |
| | | } |
| | | } |
| | | driver.setActivityMoney(bigDecimal.add(new BigDecimal(driver.getActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setLaveActivityMoney(bigDecimal.add(new BigDecimal(driver.getLaveActivityMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(bigDecimal.add(new BigDecimal(driver.getBalance())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverMapper.updateById(driver); |
| | | } |
| | | if(type == 1){//用户分享 |
| | | UserInfo userInfo1 = userInfoMapper.selectById(uid); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo1.getCompanyId()); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | | for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ |
| | | //判断当前优惠券金额是否大于可发放剩余总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | | break; |
| | | } |
| | | UserCouponRecord userCouponRecord = new UserCouponRecord(); |
| | | userCouponRecord.setActivityType(3); |
| | | userCouponRecord.setCouponActivityId(Integer.valueOf(String.valueOf(map.get("id")))); |
| | | userCouponRecord.setCouponId(Integer.valueOf(String.valueOf(map.get("couponId")))); |
| | | userCouponRecord.setState(1); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(map.get("effective")))); |
| | | userCouponRecord.setExpirationTime(calendar.getTime()); |
| | | userCouponRecord.setCouponType(Integer.valueOf(String.valueOf(map.get("couponType")))); |
| | | userCouponRecord.setCouponUseType(Integer.valueOf(String.valueOf(map.get("couponUseType")))); |
| | | userCouponRecord.setInsertTime(date); |
| | | userCouponRecord.setFullMoney(Double.valueOf(String.valueOf(map.get("fullMoney")))); |
| | | userCouponRecord.setMoney(Double.valueOf(String.valueOf(map.get("money")))); |
| | | userCouponRecord.setCompanyId(userInfo1.getCompanyId()); |
| | | userCouponRecord.setUserId(uid); |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | //修改剩余可发放总金额 |
| | | lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); |
| | | } |
| | | UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityInviteMapper.updateById(uai); |
| | | } |
| | | } |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IVerifiedService; |
| | | import com.stylefeng.guns.modular.system.util.ALiApiUtil; |
| | | import com.stylefeng.guns.modular.system.util.JuHeUtil; |
| | | //import com.stylefeng.guns.modular.system.util.JuHeUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Service |
| | | public class VerifiedServiceImpl extends ServiceImpl<VerifiedMapper, Verified> implements IVerifiedService { |
| | | |
| | | @Autowired |
| | | private JuHeUtil juHeUtil; |
| | | // @Autowired |
| | | // private JuHeUtil juHeUtil; |
| | | |
| | | @Autowired |
| | | private ALiApiUtil aLiApiUtil; |
| | |
| | | String url = "http://apis.juhe.cn/telecom2Cucc/query"; |
| | | Map<String, String> header = new HashMap<>(); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("key", "c0d55e1fb67efd7ae3175ee9bd8c6bc2"); |
| | | param.put("key", "1"); |
| | | param.put("mobile", name); |
| | | param.put("idcard", code); |
| | | String get = httpClientUtil.pushHttpRequset("GET", url, param, header, "form"); |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import com.aliyuncs.CommonRequest; |
| | | import com.aliyuncs.CommonResponse; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.IAcsClient; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.google.gson.Gson; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 阿里云短信工具类 |
| | | */ |
| | | @Component |
| | | public class ALiSendSms { |
| | | |
| | | // 设置鉴权参数,初始化客户端 |
| | | private DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou",// 地域ID |
| | | "LTAI4G1BpRaihVRZp1RS8Stn",// 您的AccessKey ID |
| | | "PDR7uUEGNf0wIPPVCPCVdySgTwCr90");// 您的AccessKey Secret |
| | | private IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | private static void log_print(String functionName, Object result) { |
| | | Gson gson = new Gson(); |
| | | System.out.println("-------------------------------" + functionName + "-------------------------------"); |
| | | System.out.println(gson.toJson(result)); |
| | | } |
| | | |
| | | /** |
| | | * 添加短信模板 |
| | | */ |
| | | public String addSmsTemplate() throws ClientException { |
| | | CommonRequest addSmsTemplateRequest = new CommonRequest(); |
| | | addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | addSmsTemplateRequest.setSysAction("AddSmsTemplate"); |
| | | addSmsTemplateRequest.setSysVersion("2017-05-25"); |
| | | // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); |
| | | // 模板名称,长度为1~30个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); |
| | | // 模板内容,长度为1~500个字符 |
| | | addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); |
| | | // 短信模板申请说明 |
| | | addSmsTemplateRequest.putQueryParameter("Remark", "测试"); |
| | | CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); |
| | | String data = addSmsTemplateResponse.getData(); |
| | | // 消除返回文本中的反转义字符 |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("addSmsTemplate", sData); |
| | | Gson gson = new Gson(); |
| | | // 将字符串转换为Map类型,取TemplateCode字段值 |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | Object templateCode = map.get("TemplateCode"); |
| | | return templateCode.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 发送短信 |
| | | */ |
| | | public String sendSms(String phone, String templateCode, String json) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("SendSms"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumbers", phone); |
| | | // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | request.putQueryParameter("SignName", "道奇乐科技"); |
| | | // 短信模板ID |
| | | request.putQueryParameter("TemplateCode", templateCode); |
| | | // 短信模板变量对应的实际值,JSON格式。 |
| | | request.putQueryParameter("TemplateParam", json); |
| | | CommonResponse commonResponse = client.getCommonResponse(request); |
| | | String data = commonResponse.getData(); |
| | | String sData = data.replaceAll("'\'", ""); |
| | | log_print("sendSms", sData); |
| | | return sData; |
| | | } |
| | | |
| | | /** |
| | | * 查询发送详情 |
| | | */ |
| | | private void querySendDetails(String bizId) throws ClientException { |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | request.setSysVersion("2017-05-25"); |
| | | request.setSysAction("QuerySendDetails"); |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); |
| | | // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 |
| | | request.putQueryParameter("SendDate", "20191010"); |
| | | // 分页记录数量 |
| | | request.putQueryParameter("PageSize", "10"); |
| | | // 分页当前页码 |
| | | request.putQueryParameter("CurrentPage", "1"); |
| | | // 发送回执ID,即发送流水号。 |
| | | request.putQueryParameter("BizId", bizId); |
| | | CommonResponse response = client.getCommonResponse(request); |
| | | log_print("querySendDetails", response.getData()); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | ALiSendSms sendSmsDemo = new ALiSendSms(); |
| | | try { |
| | | // 创建短信模板 |
| | | String templateCode = sendSmsDemo.addSmsTemplate(); |
| | | // 使用刚创建的短信模板发送短信 |
| | | String sData = sendSmsDemo.sendSms("156xxxxxxxx", templateCode, "{\"code\":\"8888\"}"); |
| | | Gson gson = new Gson(); |
| | | Map map = gson.fromJson(sData, Map.class); |
| | | String bizId = map.get("BizId").toString(); |
| | | // 根据短信发送流水号查询短信发送情况 |
| | | sendSmsDemo.querySendDetails(bizId); |
| | | } catch (ClientException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | //package com.stylefeng.guns.modular.system.util; |
| | | // |
| | | // |
| | | //import com.aliyuncs.CommonRequest; |
| | | //import com.aliyuncs.CommonResponse; |
| | | //import com.aliyuncs.DefaultAcsClient; |
| | | //import com.aliyuncs.IAcsClient; |
| | | //import com.aliyuncs.exceptions.ClientException; |
| | | //import com.aliyuncs.profile.DefaultProfile; |
| | | //import com.google.gson.Gson; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * 阿里云短信工具类 |
| | | // */ |
| | | //@Component |
| | | //public class ALiSendSms { |
| | | // |
| | | // // 设置鉴权参数,初始化客户端 |
| | | // private DefaultProfile profile = DefaultProfile.getProfile( |
| | | // "cn-hangzhou",// 地域ID |
| | | // "111",// 您的AccessKey ID |
| | | // "111");// 您的AccessKey Secret |
| | | // private IAcsClient client = new DefaultAcsClient(profile); |
| | | // |
| | | // private static void log_print(String functionName, Object result) { |
| | | // Gson gson = new Gson(); |
| | | // System.out.println("-------------------------------" + functionName + "-------------------------------"); |
| | | // System.out.println(gson.toJson(result)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 添加短信模板 |
| | | // */ |
| | | // public String addSmsTemplate() throws ClientException { |
| | | // CommonRequest addSmsTemplateRequest = new CommonRequest(); |
| | | // addSmsTemplateRequest.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | // addSmsTemplateRequest.setSysAction("AddSmsTemplate"); |
| | | // addSmsTemplateRequest.setSysVersion("2017-05-25"); |
| | | // // 短信类型。0:验证码;1:短信通知;2:推广短信;3:国际/港澳台消息 |
| | | // addSmsTemplateRequest.putQueryParameter("TemplateType", "0"); |
| | | // // 模板名称,长度为1~30个字符 |
| | | // addSmsTemplateRequest.putQueryParameter("TemplateName", "测试短信模板"); |
| | | // // 模板内容,长度为1~500个字符 |
| | | // addSmsTemplateRequest.putQueryParameter("TemplateContent", "您正在申请手机注册,验证码为:${code},5分钟内有效!"); |
| | | // // 短信模板申请说明 |
| | | // addSmsTemplateRequest.putQueryParameter("Remark", "测试"); |
| | | // CommonResponse addSmsTemplateResponse = client.getCommonResponse(addSmsTemplateRequest); |
| | | // String data = addSmsTemplateResponse.getData(); |
| | | // // 消除返回文本中的反转义字符 |
| | | // String sData = data.replaceAll("'\'", ""); |
| | | // log_print("addSmsTemplate", sData); |
| | | // Gson gson = new Gson(); |
| | | // // 将字符串转换为Map类型,取TemplateCode字段值 |
| | | // Map map = gson.fromJson(sData, Map.class); |
| | | // Object templateCode = map.get("TemplateCode"); |
| | | // return templateCode.toString(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 发送短信 |
| | | // */ |
| | | // public String sendSms(String phone, String templateCode, String json) throws ClientException { |
| | | // CommonRequest request = new CommonRequest(); |
| | | // request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | // request.setSysVersion("2017-05-25"); |
| | | // request.setSysAction("SendSms"); |
| | | // // 接收短信的手机号码 |
| | | // request.putQueryParameter("PhoneNumbers", phone); |
| | | // // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | // request.putQueryParameter("SignName", "XXX"); |
| | | // // 短信模板ID |
| | | // request.putQueryParameter("TemplateCode", templateCode); |
| | | // // 短信模板变量对应的实际值,JSON格式。 |
| | | // request.putQueryParameter("TemplateParam", json); |
| | | // CommonResponse commonResponse = client.getCommonResponse(request); |
| | | // String data = commonResponse.getData(); |
| | | // String sData = data.replaceAll("'\'", ""); |
| | | // log_print("sendSms", sData); |
| | | // return sData; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 查询发送详情 |
| | | // */ |
| | | // private void querySendDetails(String bizId) throws ClientException { |
| | | // CommonRequest request = new CommonRequest(); |
| | | // request.setSysDomain("dysmsapi.aliyuncs.com"); |
| | | // request.setSysVersion("2017-05-25"); |
| | | // request.setSysAction("QuerySendDetails"); |
| | | // // 接收短信的手机号码 |
| | | // request.putQueryParameter("PhoneNumber", "156xxxxxxxx"); |
| | | // // 短信发送日期,支持查询最近30天的记录。格式为yyyyMMdd,例如20191010。 |
| | | // request.putQueryParameter("SendDate", "20191010"); |
| | | // // 分页记录数量 |
| | | // request.putQueryParameter("PageSize", "10"); |
| | | // // 分页当前页码 |
| | | // request.putQueryParameter("CurrentPage", "1"); |
| | | // // 发送回执ID,即发送流水号。 |
| | | // request.putQueryParameter("BizId", bizId); |
| | | // CommonResponse response = client.getCommonResponse(request); |
| | | // log_print("querySendDetails", response.getData()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // ALiSendSms sendSmsDemo = new ALiSendSms(); |
| | | // try { |
| | | // // 创建短信模板 |
| | | // String templateCode = sendSmsDemo.addSmsTemplate(); |
| | | // // 使用刚创建的短信模板发送短信 |
| | | // String sData = sendSmsDemo.sendSms("156xxxxxxxx", templateCode, "{\"code\":\"8888\"}"); |
| | | // Gson gson = new Gson(); |
| | | // Map map = gson.fromJson(sData, Map.class); |
| | | // String bizId = map.get("BizId").toString(); |
| | | // // 根据短信发送流水号查询短信发送情况 |
| | | // sendSmsDemo.querySendDetails(bizId); |
| | | // } catch (ClientException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | //} |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aliyuncs.CommonRequest; |
| | | import com.aliyuncs.CommonResponse; |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.IAcsClient; |
| | | import com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.exceptions.ServerException; |
| | | import com.aliyuncs.http.MethodType; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.google.gson.Gson; |
| | | import com.stylefeng.guns.core.qr.ImgQrTool; |
| | | import com.stylefeng.guns.core.qr.QrImage; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.MD5Util; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 中国移动工具类 |
| | | */ |
| | | @Component |
| | | public class ChinaMobileUtil { |
| | | |
| | | private static String APIKey = "LTAI4G1BpRaihVRZp1RS8Stn"; |
| | | |
| | | private static String SecretKey = "PDR7uUEGNf0wIPPVCPCVdySgTwCr90"; |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | |
| | | /** |
| | | * 绑定小号 |
| | | * @param phoneA |
| | | * @param phoneB |
| | | * @param areaCode |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Map<String, String> midAxbBindSend(String phoneA, String phoneB, Integer areaCode) throws Exception{ |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", ""); |
| | | map1.put("telX", ""); |
| | | map1.put("bindId", ""); |
| | | return map1; |
| | | //暂时屏蔽-后期放开 |
| | | /*DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou", // 地域ID |
| | | APIKey, // 您的AccessKey ID |
| | | SecretKey ); // 您的AccessKey Secret |
| | | IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setMethod(MethodType.POST); |
| | | request.setDomain("dyplsapi.aliyuncs.com"); |
| | | request.setVersion("2017-05-25"); |
| | | request.setAction("BindAxb"); |
| | | // 绑定关系的过期时间。必须晚于当前时间1分钟以上。 |
| | | request.putQueryParameter("Expiration", DateUtil.format(new Date(new Date().getTime()+7 * 24 * 60 * 60*1000L),"yyyy-MM-dd HH:mm:ss")); |
| | | // 号码池Key |
| | | request.putQueryParameter("PoolKey", "FC100000119206151"); |
| | | // AXB中的B号码 |
| | | request.putQueryParameter("PhoneNoB", phoneB); |
| | | // AXB中的A号码 |
| | | request.putQueryParameter("PhoneNoA", phoneA); |
| | | // 指定城市进行X号码的选号。 |
| | | request.putQueryParameter("ExpectCity", "北京"); |
| | | // 是否需要针对该绑定关系产生的所有通话录制通话录音。 |
| | | request.putQueryParameter("IsRecordingEnabled", "false"); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | try { |
| | | CommonResponse response = client.getCommonResponse(request); |
| | | // 处理请求结果 |
| | | System.out.println(response.getData()); |
| | | JSONObject jsonObject = JSONObject.parseObject(response.getData()); |
| | | if(jsonObject.getString("Code").equals("OK")){ |
| | | map1.put("code", "200"); |
| | | map1.put("msg", jsonObject.getString("Message")); |
| | | map1.put("telX", jsonObject.getJSONObject("SecretBindDTO").getString("SecretNo")); |
| | | map1.put("bindId", jsonObject.getJSONObject("SecretBindDTO").getString("SubsId")); |
| | | }else{ |
| | | map1.put("code", jsonObject.getString("Code")); |
| | | map1.put("msg", jsonObject.getString("Message")); |
| | | } |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", e.getErrMsg()); |
| | | } catch (ClientException e) { |
| | | System.out.println("ErrCode:" + e.getErrCode()); |
| | | System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | System.out.println("RequestId:" + e.getRequestId()); |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", e.getErrMsg()); |
| | | } |
| | | return map1;*/ |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 解绑小号关系 |
| | | * @param bindId 绑定关系id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Map<String, String> midAxbUnBindSend(String bindId,String secretNo) throws Exception{ |
| | | //组装请求对象-具体描述见开发文档-订单小号-AXB接口规范部分内容 |
| | | /*Map<String, Object> request = new HashMap<>(); |
| | | //绑定关系ID |
| | | request.put("APPID", APIKey); |
| | | request.put("bindId", bindId); |
| | | |
| | | Map<String, String> header = new HashMap<String, String>(3); |
| | | header.put("Authorization", "Basic " + new String(Base64.encodeBase64((APIKey + ":" + SecretKey).getBytes()))); |
| | | header.put("Content-Type", "application/json;charset=utf-8"); |
| | | String post = httpClientUtil.pushHttpRequset("POST", "https://ct.open.10086.cn/ordernumber/v1/unbinding", request, header, "json"); |
| | | JSONObject jsonObject = JSONObject.parseObject(post); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | if(jsonObject.getString("code").equals("0000")){ |
| | | map1.put("code", "200"); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | }else{ |
| | | map1.put("code", jsonObject.getString("code")); |
| | | map1.put("msg", jsonObject.getString("message")); |
| | | } |
| | | return map1;*/ |
| | | DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou", // 地域ID |
| | | APIKey, // 您的AccessKey ID |
| | | SecretKey ); // 您的AccessKey Secret |
| | | IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | CommonRequest request = new CommonRequest(); |
| | | request.setMethod(MethodType.POST); |
| | | request.setDomain("dyplsapi.aliyuncs.com"); |
| | | request.setVersion("2017-05-25"); |
| | | request.setAction("UnbindSubscription"); |
| | | // 绑定关系的过期时间。必须晚于当前时间1分钟以上。 |
| | | // 号码池Key |
| | | request.putQueryParameter("PoolKey", "FC100000119206151"); |
| | | // 隐私号码。调用BindAXG等号码绑定接口时指定或自动分配的X号码。 |
| | | request.putQueryParameter("SecretNo", secretNo); |
| | | // 绑定关系ID。 |
| | | // |
| | | //可以在控制台的号码管理 > 号码详情中查看绑定关系ID,或者在调用BindAxb等号码绑定API时查看返回参数中的SubsId。 |
| | | request.putQueryParameter("SubsId", bindId); |
| | | Map<String, String> map1 = new HashMap<>(); |
| | | try { |
| | | CommonResponse response = client.getCommonResponse(request); |
| | | // 处理请求结果 |
| | | System.out.println(response.getData()); |
| | | JSONObject jsonObject = JSONObject.parseObject(response.getData()); |
| | | if(jsonObject.getString("Code").equals("OK")){ |
| | | map1.put("code", "200"); |
| | | map1.put("msg", jsonObject.getString("Message")); |
| | | }else{ |
| | | map1.put("code", jsonObject.getString("Code")); |
| | | map1.put("msg", jsonObject.getString("Message")); |
| | | } |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", e.getErrMsg()); |
| | | } catch (ClientException e) { |
| | | System.out.println("ErrCode:" + e.getErrCode()); |
| | | System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | System.out.println("RequestId:" + e.getRequestId()); |
| | | map1.put("code", "-1"); |
| | | map1.put("msg", e.getErrMsg()); |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | try{ |
| | | //System.out.println(midAxbBindSend("18380476116","13688394165",null)); |
| | | System.out.println(midAxbUnBindSend("1000028383491415","17150195840")); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public Map<String, String> HeaderUtils(String APIKey, String SecretKey) throws Exception{ |
| | | Map<String, String> header = new HashMap<>(); |
| | | long time = System.currentTimeMillis(); |
| | | String signStr = MD5Util.encrypt(APIKey + SecretKey + time); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("apiKey", APIKey); |
| | | jsonObject.put("time", time); |
| | | jsonObject.put("sign", signStr); |
| | | Base64 base64 = new Base64(); |
| | | String s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | header.put("header", s); |
| | | |
| | | jsonObject = new JSONObject(); |
| | | jsonObject.put("platformId", ""); |
| | | jsonObject.put("secret", ""); |
| | | s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | header.put("accessCode", s); |
| | | return header; |
| | | } |
| | | } |
| | | //package com.stylefeng.guns.modular.system.util; |
| | | // |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import com.aliyuncs.CommonRequest; |
| | | //import com.aliyuncs.CommonResponse; |
| | | //import com.aliyuncs.DefaultAcsClient; |
| | | //import com.aliyuncs.IAcsClient; |
| | | //import com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest; |
| | | //import com.aliyuncs.exceptions.ClientException; |
| | | //import com.aliyuncs.exceptions.ServerException; |
| | | //import com.aliyuncs.http.MethodType; |
| | | //import com.aliyuncs.profile.DefaultProfile; |
| | | //import com.google.gson.Gson; |
| | | //import com.stylefeng.guns.core.qr.ImgQrTool; |
| | | //import com.stylefeng.guns.core.qr.QrImage; |
| | | //import com.stylefeng.guns.core.util.DateUtil; |
| | | //import com.stylefeng.guns.core.util.MD5Util; |
| | | //import org.apache.commons.codec.binary.Base64; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.io.IOException; |
| | | //import java.util.Date; |
| | | //import java.util.HashMap; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * 中国移动工具类 |
| | | // */ |
| | | //@Component |
| | | //public class ChinaMobileUtil { |
| | | // |
| | | // private static String APIKey = "1111"; |
| | | // |
| | | // private static String SecretKey = "111"; |
| | | // |
| | | // @Autowired |
| | | // private HttpClientUtil httpClientUtil; |
| | | // |
| | | // |
| | | // /** |
| | | // * 绑定小号 |
| | | // * @param phoneA |
| | | // * @param phoneB |
| | | // * @param areaCode |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public static Map<String, String> midAxbBindSend(String phoneA, String phoneB, Integer areaCode) throws Exception{ |
| | | // Map<String, String> map1 = new HashMap<>(); |
| | | // map1.put("code", "-1"); |
| | | // map1.put("msg", ""); |
| | | // map1.put("telX", ""); |
| | | // map1.put("bindId", ""); |
| | | // return map1; |
| | | // //暂时屏蔽-后期放开 |
| | | // /*DefaultProfile profile = DefaultProfile.getProfile( |
| | | // "cn-hangzhou", // 地域ID |
| | | // APIKey, // 您的AccessKey ID |
| | | // SecretKey ); // 您的AccessKey Secret |
| | | // IAcsClient client = new DefaultAcsClient(profile); |
| | | // |
| | | // CommonRequest request = new CommonRequest(); |
| | | // request.setMethod(MethodType.POST); |
| | | // request.setDomain("dyplsapi.aliyuncs.com"); |
| | | // request.setVersion("2017-05-25"); |
| | | // request.setAction("BindAxb"); |
| | | // // 绑定关系的过期时间。必须晚于当前时间1分钟以上。 |
| | | // request.putQueryParameter("Expiration", DateUtil.format(new Date(new Date().getTime()+7 * 24 * 60 * 60*1000L),"yyyy-MM-dd HH:mm:ss")); |
| | | // // 号码池Key |
| | | // request.putQueryParameter("PoolKey", "FC100000119206151"); |
| | | // // AXB中的B号码 |
| | | // request.putQueryParameter("PhoneNoB", phoneB); |
| | | // // AXB中的A号码 |
| | | // request.putQueryParameter("PhoneNoA", phoneA); |
| | | // // 指定城市进行X号码的选号。 |
| | | // request.putQueryParameter("ExpectCity", "北京"); |
| | | // // 是否需要针对该绑定关系产生的所有通话录制通话录音。 |
| | | // request.putQueryParameter("IsRecordingEnabled", "false"); |
| | | // Map<String, String> map1 = new HashMap<>(); |
| | | // try { |
| | | // CommonResponse response = client.getCommonResponse(request); |
| | | // // 处理请求结果 |
| | | // System.out.println(response.getData()); |
| | | // JSONObject jsonObject = JSONObject.parseObject(response.getData()); |
| | | // if(jsonObject.getString("Code").equals("OK")){ |
| | | // map1.put("code", "200"); |
| | | // map1.put("msg", jsonObject.getString("Message")); |
| | | // map1.put("telX", jsonObject.getJSONObject("SecretBindDTO").getString("SecretNo")); |
| | | // map1.put("bindId", jsonObject.getJSONObject("SecretBindDTO").getString("SubsId")); |
| | | // }else{ |
| | | // map1.put("code", jsonObject.getString("Code")); |
| | | // map1.put("msg", jsonObject.getString("Message")); |
| | | // } |
| | | // } catch (ServerException e) { |
| | | // e.printStackTrace(); |
| | | // map1.put("code", "-1"); |
| | | // map1.put("msg", e.getErrMsg()); |
| | | // } catch (ClientException e) { |
| | | // System.out.println("ErrCode:" + e.getErrCode()); |
| | | // System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | // System.out.println("RequestId:" + e.getRequestId()); |
| | | // map1.put("code", "-1"); |
| | | // map1.put("msg", e.getErrMsg()); |
| | | // } |
| | | // return map1;*/ |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 解绑小号关系 |
| | | // * @param bindId 绑定关系id |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public static Map<String, String> midAxbUnBindSend(String bindId,String secretNo) throws Exception{ |
| | | // //组装请求对象-具体描述见开发文档-订单小号-AXB接口规范部分内容 |
| | | // /*Map<String, Object> request = new HashMap<>(); |
| | | // //绑定关系ID |
| | | // request.put("APPID", APIKey); |
| | | // request.put("bindId", bindId); |
| | | // |
| | | // Map<String, String> header = new HashMap<String, String>(3); |
| | | // header.put("Authorization", "Basic " + new String(Base64.encodeBase64((APIKey + ":" + SecretKey).getBytes()))); |
| | | // header.put("Content-Type", "application/json;charset=utf-8"); |
| | | // String post = httpClientUtil.pushHttpRequset("POST", "https://ct.open.10086.cn/ordernumber/v1/unbinding", request, header, "json"); |
| | | // JSONObject jsonObject = JSONObject.parseObject(post); |
| | | // Map<String, String> map1 = new HashMap<>(); |
| | | // if(jsonObject.getString("code").equals("0000")){ |
| | | // map1.put("code", "200"); |
| | | // map1.put("msg", jsonObject.getString("message")); |
| | | // }else{ |
| | | // map1.put("code", jsonObject.getString("code")); |
| | | // map1.put("msg", jsonObject.getString("message")); |
| | | // } |
| | | // return map1;*/ |
| | | // DefaultProfile profile = DefaultProfile.getProfile( |
| | | // "cn-hangzhou", // 地域ID |
| | | // APIKey, // 您的AccessKey ID |
| | | // SecretKey ); // 您的AccessKey Secret |
| | | // IAcsClient client = new DefaultAcsClient(profile); |
| | | // |
| | | // CommonRequest request = new CommonRequest(); |
| | | // request.setMethod(MethodType.POST); |
| | | // request.setDomain("dyplsapi.aliyuncs.com"); |
| | | // request.setVersion("2017-05-25"); |
| | | // request.setAction("UnbindSubscription"); |
| | | // // 绑定关系的过期时间。必须晚于当前时间1分钟以上。 |
| | | // // 号码池Key |
| | | // request.putQueryParameter("PoolKey", "FC100000119206151"); |
| | | // // 隐私号码。调用BindAXG等号码绑定接口时指定或自动分配的X号码。 |
| | | // request.putQueryParameter("SecretNo", secretNo); |
| | | // // 绑定关系ID。 |
| | | // // |
| | | // //可以在控制台的号码管理 > 号码详情中查看绑定关系ID,或者在调用BindAxb等号码绑定API时查看返回参数中的SubsId。 |
| | | // request.putQueryParameter("SubsId", bindId); |
| | | // Map<String, String> map1 = new HashMap<>(); |
| | | // try { |
| | | // CommonResponse response = client.getCommonResponse(request); |
| | | // // 处理请求结果 |
| | | // System.out.println(response.getData()); |
| | | // JSONObject jsonObject = JSONObject.parseObject(response.getData()); |
| | | // if(jsonObject.getString("Code").equals("OK")){ |
| | | // map1.put("code", "200"); |
| | | // map1.put("msg", jsonObject.getString("Message")); |
| | | // }else{ |
| | | // map1.put("code", jsonObject.getString("Code")); |
| | | // map1.put("msg", jsonObject.getString("Message")); |
| | | // } |
| | | // } catch (ServerException e) { |
| | | // e.printStackTrace(); |
| | | // map1.put("code", "-1"); |
| | | // map1.put("msg", e.getErrMsg()); |
| | | // } catch (ClientException e) { |
| | | // System.out.println("ErrCode:" + e.getErrCode()); |
| | | // System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | // System.out.println("RequestId:" + e.getRequestId()); |
| | | // map1.put("code", "-1"); |
| | | // map1.put("msg", e.getErrMsg()); |
| | | // } |
| | | // return map1; |
| | | // } |
| | | // |
| | | // public static void main(String[] args) throws IOException { |
| | | // try{ |
| | | // //System.out.println(midAxbBindSend("18380476116","13688394165",null)); |
| | | // System.out.println(midAxbUnBindSend("1000028383491415","17150195840")); |
| | | // }catch (Exception e){ |
| | | // |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // public Map<String, String> HeaderUtils(String APIKey, String SecretKey) throws Exception{ |
| | | // Map<String, String> header = new HashMap<>(); |
| | | // long time = System.currentTimeMillis(); |
| | | // String signStr = MD5Util.encrypt(APIKey + SecretKey + time); |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.put("apiKey", APIKey); |
| | | // jsonObject.put("time", time); |
| | | // jsonObject.put("sign", signStr); |
| | | // Base64 base64 = new Base64(); |
| | | // String s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | // header.put("header", s); |
| | | // |
| | | // jsonObject = new JSONObject(); |
| | | // jsonObject.put("platformId", ""); |
| | | // jsonObject.put("secret", ""); |
| | | // s = base64.encodeToString(jsonObject.toJSONString().getBytes("UTF-8")); |
| | | // header.put("accessCode", s); |
| | | // return header; |
| | | // } |
| | | //} |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 聚合数据工具类 |
| | | */ |
| | | @Component |
| | | public class JuHeUtil { |
| | | |
| | | @Value("${juhe.appKey}") |
| | | private String key; |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | /** |
| | | * 身份证号码实名认证 |
| | | * @param name |
| | | * @param idcard |
| | | * @return |
| | | */ |
| | | public boolean idcard(String name, String idcard){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("key", key); |
| | | map.put("idcard", idcard); |
| | | map.put("realname", name); |
| | | String content = httpClientUtil.pushHttpRequset("GET", "http://op.juhe.cn/idcard/query", map, new HashMap<>(), "form"); |
| | | System.err.println(content); |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | if(jsonObject.getIntValue("error_code") == 0){ |
| | | int res = jsonObject.getJSONObject("result").getIntValue("res"); |
| | | return res == 1 ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | //package com.stylefeng.guns.modular.system.util; |
| | | // |
| | | //import com.alibaba.fastjson.JSON; |
| | | //import com.alibaba.fastjson.JSONObject; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.util.HashMap; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * 聚合数据工具类 |
| | | // */ |
| | | //@Component |
| | | //public class JuHeUtil { |
| | | // |
| | | // @Value("${juhe.appKey}") |
| | | // private String key; |
| | | // |
| | | // @Autowired |
| | | // private HttpClientUtil httpClientUtil; |
| | | // |
| | | // /** |
| | | // * 身份证号码实名认证 |
| | | // * @param name |
| | | // * @param idcard |
| | | // * @return |
| | | // */ |
| | | // public boolean idcard(String name, String idcard){ |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("key", key); |
| | | // map.put("idcard", idcard); |
| | | // map.put("realname", name); |
| | | // String content = httpClientUtil.pushHttpRequset("GET", "http://op.juhe.cn/idcard/query", map, new HashMap<>(), "form"); |
| | | // System.err.println(content); |
| | | // JSONObject jsonObject = JSON.parseObject(content); |
| | | // if(jsonObject.getIntValue("error_code") == 0){ |
| | | // int res = jsonObject.getJSONObject("result").getIntValue("res"); |
| | | // return res == 1 ? true : false; |
| | | // } |
| | | // return false; |
| | | // } |
| | | //} |
| | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | // @Autowired |
| | | // private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private IDriverServiceService driverServiceService; |
| | |
| | | //调用移动的小号接口 |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | Region region = regionMapper.query(geocode1.get("districtCode")); |
| | | Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderTaxi.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderTaxi.setTelX(map.get("telX")); |
| | | orderTaxi.setBindId(map.get("bindId")); |
| | | } |
| | | // Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderTaxi.getPassengersPhone(), driver.getPhone(), Integer.valueOf(region.getCitycode().substring(1))); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderTaxi.setTelX(map.get("telX")); |
| | | // orderTaxi.setBindId(map.get("bindId")); |
| | | // } |
| | | |
| | | driver.setState(3); |
| | | driverService.updateById(driver); |
| | |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //解除小号绑定 |
| | | if(orderTaxi.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | } |
| | | // if(orderTaxi.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | // } |
| | | |
| | | orderTaxi.setState(10); |
| | | orderTaxi.setTelX(""); |
| | |
| | | transactionDetailsService.saveData(orderTaxi.getUserId(), "取消订单", query.getAmount(), 2, 1, 1, 2, query.getOrderId()); |
| | | orderTaxi.setState(10); |
| | | //解除小号绑定 |
| | | if(orderTaxi.getBindId() != null){ |
| | | chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | } |
| | | // if(orderTaxi.getBindId() != null){ |
| | | // chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX()); |
| | | // } |
| | | orderTaxi.setBindId(""); |
| | | orderTaxi.setTelX(""); |
| | | this.updateById(orderTaxi); |