| | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | |
| | | |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | logger.info("GunsApplication is success!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryCoupon1(Integer uid, String cityCode, Integer state, Integer couponUseType, Double money, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | if(null != pageNum && null != size){ |
| | | pageNum = (pageNum - 1) * size; |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordMapper.queryCoupon1(uid, cityCode, state, couponUseType, money, pageNum, size); |
| | | for (Map<String, Object> map : list) { |
| | | Object citys = map.get("citys"); |
| | |
| | | inviteMapper.insert(invite); |
| | | if (userType==1){ |
| | | // 只有用户邀请用户会获得优惠券 |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | } |
| | | if(type == 1){//用户分享 |
| | | UserInfo userInfo = userInfoMapper.selectById(uid); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | inviteMapper.insert(invite); |
| | | if (userType==1){ |
| | | // 只有用户邀请用户会获得优惠券 |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | * @throws Exception |
| | | */ |
| | | public synchronized void addCoupon(Integer userId, Double money, Integer companyId, Integer paymentRecordId) throws Exception{ |
| | | List<Map<String, Object>> query = userActivityBalanceService.query(money, companyId); |
| | | List<Map<String, Object>> query = userActivityBalanceService.query(money, 1); |
| | | List<UserCouponRecord> list = new ArrayList<>(); |
| | | for(Map<String, Object> map : query){ |
| | | //添加通用优惠券 |
| | |
| | | */ |
| | | private synchronized void addCoupon(UserInfo userInfo) throws Exception{ |
| | | //添加优惠券 |
| | | List<Map<String, Object>> list = userActivityRegisteredService.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> list = userActivityRegisteredService.query(1); |
| | | int num = 0; |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |
| | |
| | | */ |
| | | private synchronized void addInviteCoupon(UserInfo userInfo) throws Exception{ |
| | | //添加优惠券 |
| | | List<Map<String, Object>> list = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> list = userActivityInviteMapper.query(1); |
| | | int num = 0; |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |
| | |
| | | private String endLat; |
| | | @ApiModelProperty("结束经度") |
| | | private String endLon; |
| | | @ApiModelProperty("计费方式(1=线上计费,2=线下计费)") |
| | | private Integer payManner; |
| | | |
| | | public String getEndLat() { |
| | | return endLat; |
| | |
| | | public void setReassignNotice(Integer reassignNotice) { |
| | | this.reassignNotice = reassignNotice; |
| | | } |
| | | |
| | | public Integer getPayManner() { |
| | | return payManner; |
| | | } |
| | | |
| | | public void setPayManner(Integer payManner) { |
| | | this.payManner = payManner; |
| | | } |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | |
| | | return ResultUtil.error("计算行驶距离失败"); |
| | | } |
| | | double d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double amount = setMoney2(query.getId(), d, t); |
| | | if(warpper.getPayManner() == 2){//其他支付,不需要操作,直接完成订单 |
| | | amount = amount + (new BigDecimal(Math.random()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | map.put("balance", userInfo.getBalance()); |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | int i = userCouponRecordService.queryAvailable(uid, null, 1, 2, orderTaxi.getOrderMoney()); |
| | | i = i + userCouponRecordService.queryAvailable(uid, null, 1, 0, orderTaxi.getOrderMoney()); |
| | | map.put("coupon", i); |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Integer companyId = driver.getCompanyId(); |
| | | List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId)); |
| | | List<Map<String, Integer>> cityCode = new ArrayList<>(); |
| | | for (CompanyCity companyCity : companyCityList) { |
| | | Map<String, Integer> city = new HashMap<>(); |
| | | if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getAreaCode())); |
| | | }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getCityCode())); |
| | | }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getProvinceCode())); |
| | | } |
| | | cityCode.add(city); |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), null, null); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), null, null); |
| | | list.addAll(list1); |
| | | map.put("coupon", list.size()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getProvinceCode())); |
| | | } |
| | | cityCode.add(city); |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderTaxi.getId()); |
| | | orderServerWarpper.setOrderType(2); |
| | | orderServerWarpper.setPayManner(orderTaxi.getPayManner()); |
| | | orderServerWarpper.setState(orderTaxi.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[0] : "0.0"); |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | # url: jdbc:mysql://127.0.0.1:3306/xianning?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true |
| | | # username: root |
| | | # password: 123456 |
| | | url: jdbc:mysql://127.0.0.1:3306/xianning_1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true |
| | | url: jdbc:mysql://127.0.0.1:10633/xianning?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true |
| | | username: root |
| | | password: 123456 |
| | | password: XianNing@2024! |
| | | db-name: guns #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |