Merge remote-tracking branch 'origin/master'
# Conflicts:
# ManagementQYTTravel/guns-admin/pom.xml
28个文件已删除
41个文件已添加
60个文件已修改
| | |
| | | <groupId>org.ehcache</groupId> |
| | | <artifactId>ehcache</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | <!--需要分布式session的话需要放开注释--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/javabase64-1.3.1.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("嘉易行 Doc") |
| | | .title("黔云通 Doc") |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | |
| | | public class GunsProperties { |
| | | |
| | | public static final String PREFIX = "guns"; |
| | | |
| | | |
| | | private Boolean kaptchaOpen = false; |
| | | |
| | | |
| | | private Boolean swaggerOpen = false; |
| | | |
| | | |
| | | private String fileUploadPath; |
| | | |
| | | |
| | | private Boolean haveCreatePath = false; |
| | | |
| | | |
| | | private Boolean springSessionOpen = false; |
| | | |
| | | |
| | | // 文件服务器访问地址 |
| | | private String pictureServerAddress; |
| | | |
| | | /** |
| | | * session 失效时间(默认为30分钟 单位:秒) |
| | | */ |
| | | private Integer sessionInvalidateTime = 30 * 60; |
| | | |
| | | |
| | | /** |
| | | * session 验证失效时间(默认为15分钟 单位:秒) |
| | | */ |
| | | private Integer sessionValidationInterval = 15 * 60; |
| | | |
| | | |
| | | public String getFileUploadPath() { |
| | | //如果没有写文件上传路径,保存到临时目录 |
| | | if (isEmpty(fileUploadPath)) { |
| | |
| | | public void setSessionInvalidateTime(Integer sessionInvalidateTime) { |
| | | this.sessionInvalidateTime = sessionInvalidateTime; |
| | | } |
| | | |
| | | |
| | | public Integer getSessionValidationInterval() { |
| | | return sessionValidationInterval; |
| | | } |
| | | |
| | | |
| | | public void setSessionValidationInterval(Integer sessionValidationInterval) { |
| | | this.sessionValidationInterval = sessionValidationInterval; |
| | | } |
| | | |
| | | public String getPictureServerAddress() { |
| | | return pictureServerAddress; |
| | | } |
| | | |
| | | public void setPictureServerAddress(String pictureServerAddress) { |
| | | this.pictureServerAddress = pictureServerAddress; |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.ALiSendSms; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ISmsrecordService smsrecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverOrdersService driverOrdersService; |
| | | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * |
| | | * @param phone |
| | | * @return |
| | | */ |
| | |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil queryCaptcha(String phone, Integer type){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | | public ResultUtil queryCaptcha(String phone, Integer type) { |
| | | if (ToolUtil.isNotEmpty(phone)) { |
| | | try { |
| | | return driverService.queryCaptcha(phone, type); |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else{ |
| | | } else { |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证短信验证码 |
| | | * |
| | | * @param phone |
| | | * @param code |
| | | * @return |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 司机注册审核后的短信 |
| | | * |
| | | * @param uid |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/sendsms") |
| | | public ResultUtil sendsms(Integer uid, Integer type){ |
| | | public ResultUtil sendsms(Integer uid, Integer type) { |
| | | try { |
| | | Driver driver = driverService.selectById(uid); |
| | | String templateCode = null; |
| | | switch (type){ |
| | | switch (type) { |
| | | case 1: |
| | | templateCode = "SMS_229648175";//身份验证 |
| | | break; |
| | |
| | | templateCode = "SMS_229613326";//司机注册失败 |
| | | break; |
| | | } |
| | | String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | // String s = aLiSendSms.sendSms(driver.getPhone(), templateCode, "{}"); |
| | | SMSUtil.sendVerifyCode(driver.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getDriverCode") |
| | | @ApiOperation(value = "获取司机端的二维码", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil getDriverCode(HttpServletRequest request){ |
| | | public ResultUtil getDriverCode(HttpServletRequest request) { |
| | | try { |
| | | Integer driverId = driverService.getUserIdFormRedis(request); |
| | | if(null == driverId){ |
| | | if (null == driverId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(driverId); |
| | | if(driver!=null){ |
| | | if (driver != null) { |
| | | String fileName = driver.getQrCode(); |
| | | if(fileName==null || "".equals(fileName) ){ |
| | | if (fileName == null || "".equals(fileName)) { |
| | | String appletPath = "pages/home/scanPage/scanPage"; |
| | | //HttpURLConnection httpURLConnection = weChatUtil.getwxacodeunlimit(appletPath, "d=" + driverId + "&k=" + 0, "release",driverId); |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId , "release"); |
| | | if(inputStream!=null){ |
| | | fileName = OssUploadUtil.ossUploadByStream(driverId,inputStream); |
| | | System.out.println(fileName); |
| | | driver.setQrCode(fileName); |
| | | InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId, "release"); |
| | | if (inputStream != null) { |
| | | // 上传文件目录 |
| | | fileName = UUID.randomUUID().toString() + ".png"; |
| | | String fileSavePath = gunsProperties.getFileUploadPath() + "img\\"; |
| | | FileUtil.writeFromStream(inputStream, fileName); |
| | | String pictureName = gunsProperties.getPictureServerAddress() + "img/" + fileName; |
| | | // fileName = OssUploadUtil.ossUploadByStream(driverId, inputStream); |
| | | System.out.println(pictureName); |
| | | driver.setQrCode(pictureName); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | |
| | | driver.setAuthState(3); |
| | | driverService.updateById(driver); |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("DRIVER_" + driverId); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER_" + driverId); |
| | | if (ToolUtil.isNotEmpty(value)) {//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | String key = redisUtil.getValue("DRIVER_" + driver.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("DRIVER_" + driverId);//清除存储的token |
| | | String key = (String) redisTemplate.opsForValue().get("DRIVER_" + driver.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("DRIVER_" + driverId);//清除存储的token |
| | | } |
| | | return ResultUtil.success(); |
| | | } catch (Exception e) { |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.dao.*; |
| | | import com.stylefeng.guns.modular.crossCity.model.*; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShift; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineSite; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineSiteService; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.SiteWarpper; |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.SystemException; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | List<Map<String, Object>> s = lineSiteMapper.queryDriver(lineId, sdf.parse(day), driverId); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(sdf.parse(day)); |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.controller.AppOrderController; |
| | | import com.stylefeng.guns.modular.account.unionpay.GetOpenBodySig; |
| | | import com.stylefeng.guns.modular.account.unionpay.QrCodeConfiguration; |
| | | import com.stylefeng.guns.modular.account.unionpay.Util; |
| | |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysIntegralMapper; |
| | |
| | | import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IOrderAdditionalFeeService orderAdditionalFeeService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IMerchantActivityService merchantActivityService; |
| | |
| | | } |
| | | merchantActivityService.updateBatchById(merchantActivities); |
| | | } |
| | | String value = redisUtil.getValue("merchantVoucher"); |
| | | String value = (String) redisTemplate.opsForValue().get("merchantVoucher"); |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | | if(null == jsonObject){ |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userInfo.getPhone(), listWarppers); |
| | | redisUtil.setStrValue("merchantVoucher", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("merchantVoucher", jsonObject.toJSONString()); |
| | | |
| | | pushUtil.removeTask(orderId, 3);//删除定时任务,结束推送数据 |
| | | systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderCrossCity.getUserId(), 1); |
| | |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsSpreadService orderLogisticsSpreadService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | |
| | | } |
| | | merchantActivityService.updateBatchById(merchantActivities); |
| | | } |
| | | String value = redisUtil.getValue("merchantVoucher"); |
| | | String value = (String) redisTemplate.opsForValue().get("merchantVoucher"); |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | | if(null == jsonObject){ |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userInfo.getPhone(), listWarppers); |
| | | redisUtil.setStrValue("merchantVoucher", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("merchantVoucher", jsonObject.toJSONString()); |
| | | } |
| | | |
| | | break; |
| | |
| | | orderLogistics.setArriveTime(date); |
| | | orderLogistics.setStartServiceTime(date); |
| | | orderLogistics.setBoardingTime(date); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | String[] split = value.split(","); |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(split[0], split[1]); |
| | |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.gavaghan.geodesy.Ellipsoid; |
| | | import org.gavaghan.geodesy.GeodeticCalculator; |
| | | import org.gavaghan.geodesy.GeodeticCurve; |
| | | import org.gavaghan.geodesy.GlobalCoordinates; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | @Resource |
| | | private CarServiceMapper carServiceMapper; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | /** |
| | | * 获取司机端首页订单列表 |
| | | * @param state 1=服务中,2=待服务(30分钟定义预约) |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | /** |
| | | * 获取订单详情页(服务中的页面) |
| | |
| | | if(order!=null){ |
| | | orders.addAll(order); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | order = this.baseMapper.queryOrderInfo(orderId,5,value.split(",")[0],value.split(",")[1]); |
| | | if(order!=null){ |
| | | orders.addAll(order); |
| | |
| | | if(order!=null){ |
| | | orders.addAll(order); |
| | | } |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),5,value.split(",")[0],value.split(",")[1]); |
| | | if(order!=null){ |
| | | orders.addAll(order); |
| | |
| | | */ |
| | | @TableField("appletsOpenId") |
| | | private String appletsOpenId; |
| | | |
| | | /** |
| | | * 司机二维码 |
| | | */ |
| | | @TableField("qrCode") |
| | | private String qrCode; |
| | | |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | |
| | | public String getQrCode() { |
| | | return qrCode; |
| | | } |
| | | |
| | | |
| | | public void setQrCode(String qrCode) { |
| | | this.qrCode = qrCode; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | public void setAppletsOpenId(String appletsOpenId) { |
| | | this.appletsOpenId = appletsOpenId; |
| | | } |
| | | |
| | | |
| | | public String getWithdrawPassword() { |
| | | return withdrawPassword; |
| | | } |
| | | |
| | | |
| | | public void setWithdrawPassword(String withdrawPassword) { |
| | | this.withdrawPassword = withdrawPassword; |
| | | } |
| | | |
| | | |
| | | public Long getEmpId() { |
| | | return empId; |
| | | } |
| | | |
| | | public void setEmpId(Long empId) { |
| | | this.empId = empId; |
| | | } |
| | | |
| | | public Long getEnterId() { |
| | | return enterId; |
| | | } |
| | | |
| | | public void setEnterId(Long enterId) { |
| | | this.enterId = enterId; |
| | | } |
| | | |
| | | public String getEntercode() { |
| | | return entercode; |
| | | } |
| | | |
| | | public void setEntercode(String entercode) { |
| | | this.entercode = entercode; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Driver{" + |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.EditStaffNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.GetStaffNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.StaffNodeInfo; |
| | | import com.stylefeng.guns.modular.system.warpper.ActivityWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private CompanyMapper companyMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DriverActivityRegisteredMapper driverActivityRegisteredMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DriverActivityOrderMapper driverActivityOrderMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DriverActivityOnlineMapper driverActivityOnlineMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DriverActivityHistoryMapper driverActivityHistoryMapper; |
| | | |
| | | |
| | | @Resource |
| | | private UserCouponRecordMapper userCouponRecordMapper; |
| | | |
| | | |
| | | @Resource |
| | | private DriverOrdersMapper driverOrdersMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | |
| | | @Autowired |
| | | private ICompanyCityService companyCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | @Autowired |
| | | private ISmsrecordService smsrecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private ICarService carService; |
| | | |
| | | |
| | | @Autowired |
| | | private IReassignService reassignService; |
| | | |
| | |
| | | public ResultUtil queryCaptcha(String phone, Integer type) throws Exception { |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < 4; i++){ |
| | | for (int i = 0; i < 4; i++) { |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | String authCode = sb.toString(); |
| | | String sms = "短信验证码【" + authCode + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"; |
| | | |
| | | |
| | | //发送验证码短信 |
| | | redisUtil.setStrValue(phone, authCode, 5 * 60);//设置五分钟过期 |
| | | redisTemplate.opsForValue().set(phone, authCode, 5, TimeUnit.MINUTES);//设置五分钟过期 |
| | | String templateCode = ""; |
| | | switch (type){ |
| | | switch (type) { |
| | | case 1: |
| | | templateCode = "SMS_154775435";//身份验证 |
| | | break; |
| | |
| | | templateCode = "SMS_154775431";//修改密码 |
| | | break; |
| | | } |
| | | String sData = aLiSendSms.sendSms(phone, "SMS_229715276", "{\"code\":\"" + authCode + "\"}"); |
| | | JSONObject jsonObject = JSON.parseObject(sData); |
| | | String message = jsonObject.getString("Message"); |
| | | if(!"OK".equals(message)){ |
| | | return ResultUtil.error(""); |
| | | } |
| | | System.out.println(sms); |
| | | // String sData = aLiSendSms.sendSms(phone, "SMS_229715276", "{\"code\":\"" + authCode + "\"}"); |
| | | // JSONObject jsonObject = JSON.parseObject(sData); |
| | | // String message = jsonObject.getString("Message"); |
| | | // if(!"OK".equals(message)){ |
| | | // return ResultUtil.error(""); |
| | | // } |
| | | // System.out.println(sms); |
| | | SMSUtil.sendVerifyCode(phone); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkCaptcha(String phone, String code) throws Exception { |
| | | Object value = redisUtil.getValue(phone); |
| | | Object value = redisTemplate.opsForValue().get(phone); |
| | | if("1234".equals(code)){ |
| | | return true; |
| | | } |
| | |
| | | @Override |
| | | public ResultUtil<LoginWarpper> driverLogin(String phone, String password) throws Exception { |
| | | Driver driver = driverMapper.queryByPhone(phone); |
| | | if(null == driver){ |
| | | if (null == driver) { |
| | | return ResultUtil.error("账号未注册"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(driver.getIdCard()) && driver.getAuthState() == 1){ |
| | | //查询中台员工数据 |
| | | GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | request.setEmpId(driver.getEmpId()); |
| | | request.setEntercode(driver.getEntercode()); |
| | | request.setMobile(driver.getPhone()); |
| | | StaffNodeInfo staffNode = EmployeeUtil.getStaffNode(request); |
| | | if (null == staffNode || staffNode.getIsValid().equals("0")) { |
| | | return ResultUtil.error("账号未注册"); |
| | | } |
| | | |
| | | if (ToolUtil.isNotEmpty(driver.getIdCard()) && driver.getAuthState() == 1) { |
| | | return ResultUtil.error("账号正在审核中,请耐心等待"); |
| | | } |
| | | if(driver.getAuthState() == 3){ |
| | | if (driver.getAuthState() == 3) { |
| | | return ResultUtil.error("账号已被冻结,请联系管理员"); |
| | | } |
| | | if(!driver.getPassword().equals(ShiroKit.md5(password, salt))){ |
| | | if (!driver.getPassword().equals(ShiroKit.md5(password, salt))) { |
| | | return ResultUtil.error("密码错误"); |
| | | } |
| | | |
| | | String value = redisUtil.getValue("DEVICE_" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | |
| | | String value = (String) redisTemplate.opsForValue().get("DEVICE_" + driver.getId()); |
| | | if (ToolUtil.isNotEmpty(value)) { |
| | | return ResultUtil.error("当前账户正在车载端登录"); |
| | | } |
| | | |
| | | |
| | | //调用单点登录逻辑 |
| | | this.singlePointLogin(driver.getId()); |
| | | |
| | | |
| | | String token = this.getToken(driver, password); |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(driver.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setState(ToolUtil.isEmpty(driver.getIdCard()) ? 1 : 0); |
| | | |
| | | |
| | | //创建高德猎鹰的终端数据 |
| | | String tid = gdFalconUtil.createTerminal(phone); |
| | | loginWarpper.setServerId(gdFalconUtil.getServerId()); |
| | |
| | | }else{ |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | String value = (String) redisTemplate.opsForValue().get(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | }else{ |
| | | return null; |
| | |
| | | @Override |
| | | public ResultUtil updatePhone(String phone, String code, Integer uid) throws Exception { |
| | | Driver driver = driverMapper.queryByPhone(phone); |
| | | if(null != driver){ |
| | | if (null != driver) { |
| | | return ResultUtil.error("电话号码已被注册"); |
| | | } |
| | | boolean b = this.checkCaptcha(phone, code); |
| | | if(!b){ |
| | | if (!b) { |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | Driver driver1 = this.selectById(uid); |
| | | GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | request.setEmpId(driver1.getEmpId()); |
| | | request.setEntercode(driver1.getEntercode()); |
| | | request.setMobile(driver1.getPhone()); |
| | | StaffNodeInfo staffNode = EmployeeUtil.getStaffNode(request); |
| | | if ("0".equals(staffNode.getIsValid())) { |
| | | return ResultUtil.error("无效的司机账号"); |
| | | } |
| | | EditStaffNodeRequest editStaffNodeRequest = new EditStaffNodeRequest(); |
| | | editStaffNodeRequest.setEmpId(staffNode.getEmpId()); |
| | | editStaffNodeRequest.setMobile(staffNode.getMphone()); |
| | | editStaffNodeRequest.setEntercode(staffNode.getEnterNum()); |
| | | editStaffNodeRequest.setEnterId(staffNode.getEnterId()); |
| | | editStaffNodeRequest.setEmpName(staffNode.getEmpName()); |
| | | editStaffNodeRequest.setEmpNickname(staffNode.getEmpNickname()); |
| | | editStaffNodeRequest.setLoginNo(staffNode.getLoginNo()); |
| | | editStaffNodeRequest.setMphone(phone); |
| | | editStaffNodeRequest.setEmail(staffNode.getEmail()); |
| | | editStaffNodeRequest.setDeptId(staffNode.getDeptId()); |
| | | editStaffNodeRequest.setPositionId(1); |
| | | editStaffNodeRequest.setSuperLevel(0); |
| | | editStaffNodeRequest.setHideMobile(0); |
| | | Boolean editStaffNode = EmployeeUtil.editStaffNode(editStaffNodeRequest); |
| | | if (!editStaffNode) { |
| | | return ResultUtil.error("修改手机号码失败"); |
| | | } |
| | | |
| | | driver1.setAccount(phone); |
| | | driver1.setPhone(phone); |
| | | this.updateById(driver1); |
| | | |
| | | |
| | | smsrecordService.saveData(7, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | driverOrdersMapper.insert(query); |
| | | } |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driver.getId(), 2, 1); |
| | | if(null == driverWork){ |
| | | if (null == driverWork) { |
| | | driverWork = new DriverWork(); |
| | | driverWork.setStartTime(new Date()); |
| | | driverWork.setDriverId(driver.getId()); |
| | |
| | | driverWork.setType("2"); |
| | | driverWorkMapper.insert(driverWork); |
| | | } |
| | | if(driver.getState() == 1){ |
| | | if (driver.getState() == 1) { |
| | | driver.setState(2); |
| | | driverMapper.updateById(driver); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //调用单点登录清除缓存数据 |
| | | this.singlePointLogin(driver.getId()); |
| | | |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(driver.getPhone(), jobNum.toCharArray()); |
| | | String credentials = ShiroKit.md5(driver.getJobNumber(), salt); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(driver.getId())); |
| | | redisUtil.setStrValue(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisUtil.setStrValue("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(driver.getId()); |
| | | loginWarpper.setToken(s); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | |
| | | |
| | | //创建高德猎鹰的终端数据 |
| | | String tid = gdFalconUtil.createTerminal(driver.getPhone()); |
| | | loginWarpper.setServerId(gdFalconUtil.getServerId()); |
| | |
| | | driverOrdersMapper.insert(query); |
| | | } |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driver.getId(), 2, 1); |
| | | if(null == driverWork){ |
| | | if (null == driverWork) { |
| | | driverWork = new DriverWork(); |
| | | driverWork.setStartTime(new Date()); |
| | | driverWork.setDriverId(driver.getId()); |
| | |
| | | driverWork.setType("2"); |
| | | driverWorkMapper.insert(driverWork); |
| | | } |
| | | if(driver.getState() == 1){ |
| | | if (driver.getState() == 1) { |
| | | driver.setState(2); |
| | | driverMapper.updateById(driver); |
| | | } |
| | | |
| | | |
| | | this.singlePointLogin(driver.getId());//清除缓存实现单点登录 |
| | | |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(driver.getPhone(), identification.toCharArray()); |
| | | String credentials = ShiroKit.md5(driver.getIdCard(), salt); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(driver.getId())); |
| | | redisUtil.setStrValue(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisUtil.setStrValue("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(driver.getId()); |
| | | loginWarpper.setToken(s); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | |
| | | |
| | | //创建高德猎鹰的终端数据 |
| | | String tid = gdFalconUtil.createTerminal(driver.getPhone()); |
| | | loginWarpper.setServerId(gdFalconUtil.getServerId()); |
| | |
| | | driverOrdersMapper.insert(query); |
| | | } |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driver.getId(), 2, 1); |
| | | if(null == driverWork){ |
| | | if (null == driverWork) { |
| | | driverWork = new DriverWork(); |
| | | driverWork.setStartTime(new Date()); |
| | | driverWork.setDriverId(driver.getId()); |
| | |
| | | driverWork.setType("2"); |
| | | driverWorkMapper.insert(driverWork); |
| | | } |
| | | if(driver.getState() == 1){ |
| | | if (driver.getState() == 1) { |
| | | driver.setState(2); |
| | | driverMapper.updateById(driver); |
| | | } |
| | | |
| | | |
| | | this.singlePointLogin(driver.getId());//清除缓存实现单点登录 |
| | | |
| | | |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(driver.getPhone(), taxiAptitudeCard.toCharArray()); |
| | | String credentials = ShiroKit.md5(driver.getTaxiAptitudeCard(), salt); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(driver.getId())); |
| | | redisUtil.setStrValue(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisUtil.setStrValue("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set(driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("DRIVER_" + driver.getId(), s); |
| | | |
| | | |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(driver.getId()); |
| | | loginWarpper.setToken(s); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | |
| | | |
| | | //创建高德猎鹰的终端数据 |
| | | String tid = gdFalconUtil.createTerminal(driver.getPhone()); |
| | | loginWarpper.setServerId(gdFalconUtil.getServerId()); |
| | |
| | | public void taskOffWork() throws Exception { |
| | | List<Driver> drivers = driverMapper.selectList(new EntityWrapper<Driver>().eq("authState", 2).ne("state", 3)); |
| | | Long now = Long.valueOf(System.currentTimeMillis()); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DEVICE_" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value) && now.compareTo(Long.valueOf(value) + (60 * 60 * 1000)) > 0){ |
| | | for (Driver driver : drivers) { |
| | | String value = (String) redisTemplate.opsForValue().get("DEVICE_" + driver.getId()); |
| | | if (ToolUtil.isNotEmpty(value) && now.compareTo(Long.valueOf(value) + (60 * 60 * 1000)) > 0) { |
| | | driver.setState(1); |
| | | driverMapper.updateById(driver); |
| | | redisUtil.remove("DEVICE_" + driver.getId()); |
| | | redisTemplate.delete("DEVICE_" + driver.getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | public ResultUtil loginOut(Integer id) throws Exception { |
| | | //开始清除redis中无效的数据 |
| | | Driver driver = driverMapper.selectById(id); |
| | | String key = redisUtil.getValue(driver.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("DRIVER_" + id);//清除存储的token |
| | | redisUtil.remove("DEVICE_" + id);//清除车载端登录的标识 |
| | | String key = (String) redisTemplate.opsForValue().get(driver.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("DRIVER_" + id);//清除存储的token |
| | | redisTemplate.delete("DEVICE_" + id);//清除车载端登录的标识 |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取编号 |
| | | * @return |
| | | * 单点登录 |
| | | * |
| | | * @param id |
| | | */ |
| | | public String getCode(){ |
| | | int count = driverMapper.getCount(); |
| | | String code = String.valueOf(1000001 + count); |
| | | return "D" + code.substring(1); |
| | | private void singlePointLogin(Integer id) { |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER_" + id); |
| | | if (ToolUtil.isNotEmpty(value)) {//将另外设备上的强迫下线(如果是车载端不需要下线) |
| | | //开始清除redis中无效的数据 |
| | | Driver driver = driverMapper.selectById(id); |
| | | String key = (String) redisTemplate.opsForValue().get("DRIVER_" + driver.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("DRIVER_" + id);//清除存储的token |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | * |
| | | * @param driver |
| | | * @param password |
| | | * @return |
| | | */ |
| | | private String getToken(Driver driver, String password){ |
| | | private String getToken(Driver driver, String password) { |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(driver.getPhone(), password.toCharArray()); |
| | | String credentials = driver.getPassword(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(driver.getId())); |
| | | redisUtil.setStrValue(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7 * 24 * 60 * 60); |
| | | redisUtil.setStrValue("DRIVER_" + driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisUtil.setStrValue("DRIVER_" + driver.getId(), s); |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(driver.getId()), 7, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("DRIVER_" + driver.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("DRIVER_" + driver.getId(), s); |
| | | return s; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 单点登录 |
| | | * @param id |
| | | * 获取编号 |
| | | * |
| | | * @return |
| | | */ |
| | | private void singlePointLogin(Integer id){ |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("DRIVER_" + id); |
| | | if(ToolUtil.isNotEmpty(value)){//将另外设备上的强迫下线(如果是车载端不需要下线) |
| | | //开始清除redis中无效的数据 |
| | | Driver driver = driverMapper.selectById(id); |
| | | String key = redisUtil.getValue("DRIVER_" + driver.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("DRIVER_" + driver.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("DRIVER_" + id);//清除存储的token |
| | | } |
| | | public String getCode() { |
| | | int count = driverMapper.getCount(); |
| | | String code = String.valueOf(1000001 + count); |
| | | return "D" + code.substring(1); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | |
| | | import com.stylefeng.guns.modular.system.service.IOrderPositionService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.GeodesyUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderStatusWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private PushAuxiliaryMapper pushAuxiliaryMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil positionSocket(OrderPosition orderPosition, Integer uid) throws Exception { |
| | | redisUtil.setStrValue(String.valueOf(uid), orderPosition.getLon() + "," + orderPosition.getLat()); |
| | | redisTemplate.opsForValue().set(String.valueOf(uid), orderPosition.getLon() + "," + orderPosition.getLat()); |
| | | if(ToolUtil.isNotEmpty(orderPosition.getOrderId()) && ToolUtil.isNotEmpty(orderPosition.getOrderType())){ |
| | | orderPositionService.saveData(orderPosition); |
| | | } |
| | |
| | | } |
| | | |
| | | //查看是否有可接单的数据 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(uid)); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(uid)); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | String[] split = value.split(","); |
| | | List<OrderStatusWarpper> list1 = this.searchOrder(split[0], split[1], uid); |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysReformistMapper; |
| | | import com.stylefeng.guns.modular.system.model.AdditionalFee; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.model.Region; |
| | | import com.stylefeng.guns.modular.system.service.IAdditionalFeeService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderService; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | |
| | | |
| | | Integer muoth = Long.valueOf((orderTaxi.getTravelTime().getTime() - System.currentTimeMillis()) / (1000 * 60)).intValue(); |
| | | //发送短信提醒 |
| | | aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderTaxi.getStartAddress() + "\",\"data1\":\"" + orderTaxi.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | // aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderTaxi.getStartAddress() + "\",\"data1\":\"" + orderTaxi.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | } |
| | | //专车 |
| | | List<OrderPrivateCar> list1 = orderPrivateCarService.queryMaturity(); |
| | |
| | | |
| | | Integer muoth = Long.valueOf((orderPrivateCar.getTravelTime().getTime() - System.currentTimeMillis()) / (1000 * 60)).intValue(); |
| | | //发送短信提醒 |
| | | aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderPrivateCar.getStartAddress() + "\",\"data1\":\"" + orderPrivateCar.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | // aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderPrivateCar.getStartAddress() + "\",\"data1\":\"" + orderPrivateCar.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | } |
| | | //跨城 |
| | | List<OrderCrossCity> orderCrossCities = orderCrossCityService.queryMaturity(); |
| | |
| | | |
| | | Integer muoth = Long.valueOf((orderCrossCity.getTravelTime().getTime() - System.currentTimeMillis()) / (1000 * 60)).intValue(); |
| | | //发送短信提醒 |
| | | aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderCrossCity.getStartAddress() + "\",\"data1\":\"" + orderCrossCity.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | // aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderCrossCity.getStartAddress() + "\",\"data1\":\"" + orderCrossCity.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | } |
| | | //小件物流 |
| | | List<OrderLogistics> orderLogistics = orderLogisticsService.queryMaturity(); |
| | |
| | | |
| | | Integer muoth = Long.valueOf((orderLogistics1.getTravelTime().getTime() - System.currentTimeMillis()) / (1000 * 60)).intValue(); |
| | | //发送短信提醒 |
| | | aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderLogistics1.getStartAddress() + "\",\"data1\":\"" + orderLogistics1.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | // aLiSendSms.sendSms(driver.getPhone(), "SMS_229613325", "{\"data\":\"" + orderLogistics1.getStartAddress() + "\",\"data1\":\"" + orderLogistics1.getEndAddress() + "\",\"data2\":\"" + muoth + "\"}"); |
| | | } |
| | | if(drivers.size() > 0){ |
| | | driverService.updateBatchById(drivers);//批量修改状态为服务中 |
| | |
| | | state = orderTaxi.getState(); |
| | | |
| | | //司机手动确认收款,删除限制司机6分钟不能接单的标识 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | break; |
| | | } |
| | |
| | | public boolean authentication(String name, String code){ |
| | | String url = "https://safrvcert.market.alicloudapi.com/safrv_2meta_id_name/"; |
| | | Map<String, String> header = new HashMap<>(); |
| | | header.put("Authorization", "APPCODE b7d32437d08149099457dcb50fb57df2"); |
| | | header.put("Authorization", "APPCODE 111"); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("__userId", "1732960796168165"); |
| | | param.put("verifyKey", "IVO4js5kValcdt"); |
| | | param.put("__userId", "111"); |
| | | param.put("verifyKey", "111"); |
| | | param.put("userName", name); |
| | | param.put("identifyNum", code); |
| | | String get = httpClientUtil.pushHttpRequset("GET", url, param, header, "form"); |
| | | JSONObject jsonObject = JSON.parseObject(get); |
| | | if(jsonObject.getIntValue("code") == 200){ |
| | | if (jsonObject.getIntValue("code") == 200) { |
| | | JSONObject value = jsonObject.getJSONObject("value"); |
| | | if(value.getIntValue("bizCode") == 0){ |
| | | if (value.getIntValue("bizCode") == 0) { |
| | | return true; |
| | | }else{ |
| | | } else { |
| | | return false; |
| | | } |
| | | }else{ |
| | |
| | | // 设置鉴权参数,初始化客户端 |
| | | private DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou",// 地域ID |
| | | "LTAI5tCeHnZXREQBcVf3NHLB",// 您的AccessKey ID |
| | | "OEX6AtRb3qOCyp53xOFdDEYgBjzZzS");// 您的AccessKey Secret |
| | | "111",// 您的AccessKey ID |
| | | "111");// 您的AccessKey Secret |
| | | private IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | private static void log_print(String functionName, Object result) { |
| | |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumbers", phone); |
| | | // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | request.putQueryParameter("SignName", "嘉易行"); |
| | | request.putQueryParameter("SignName", "111"); |
| | | // 短信模板ID |
| | | request.putQueryParameter("TemplateCode", templateCode); |
| | | // 短信模板变量对应的实际值,JSON格式。 |
| | |
| | | @Component |
| | | public class GDFalconUtil implements ApplicationRunner { |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | //import com.stylefeng.guns.modular.system.model.GDFence; |
| | | //import com.stylefeng.guns.modular.system.service.IGDFenceService; |
| | | import com.stylefeng.guns.modular.system.service.IGDInterfaceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | |
| | | @Autowired |
| | | private IGDInterfaceService gdInterfaceService; |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | private JSONArray jsonArray = new JSONArray(); |
| | | |
| | |
| | | @Component |
| | | public class GDMapGeocodingUtil { |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | |
| | | import com.aliyun.oss.OSSClient; |
| | | import com.aliyun.oss.model.ObjectMetadata; |
| | | import com.aliyun.oss.model.PutObjectRequest; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | public class OssUploadUtil { |
| | | //OSS图片访问域名 |
| | | public static String oss_domain = "https://jiayixing-bucket.oss-cn-beijing.aliyuncs.com/"; |
| | | public static String accessKeyId = "LTAI5tE2Z7nA1rbtzZYMSPqR"; |
| | | public static String accessKeySecret = "HOGUqx1t4UWh8KepXJf69dlKj4tTBs"; |
| | | public static String bucketName="jiayixing-bucket"; |
| | | public static String accessKeyId = "111"; |
| | | public static String accessKeySecret = "111"; |
| | | public static String bucketName = "111"; |
| | | public static String endpoint = "oss-cn-beijing.aliyuncs.com"; |
| | | /** |
| | | * base64图片 contentType |
| | | */ |
| | | private static final String CONTENT_TYPE = "image/jpg"; |
| | | |
| | | public static OSSClient ossClient = new OSSClient(endpoint, accessKeyId,accessKeySecret); |
| | | public static OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); |
| | | |
| | | public static String ossUpload(HttpServletRequest request, MultipartFile file) throws IOException{ |
| | | public static String ossUpload(HttpServletRequest request, MultipartFile file) throws IOException { |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | |
| | | import com.stylefeng.guns.modular.system.service.IOrderPositionService; |
| | | import com.stylefeng.guns.modular.system.service.ITransactionDetailsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private ServerCarModelMapper serverCarModelMapper; |
| | |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | Car car = carService.selectById(orderPrivateCar.getCarId()); |
| | | String value = redisUtil.getValue("DRIVER" + orderPrivateCar.getDriverId()); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + orderPrivateCar.getDriverId()); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("Address", 450204);//发起地行政区划代码 |
| | | jsonObject.put("OrderId", orderPrivateCar.getOrderNum());//订单编号 |
| | |
| | | public void operateLogin(Integer driverId){ |
| | | Driver driver = driverService.selectById(driverId); |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | String value = redisUtil.getValue("DRIVER" + driverId); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + driverId); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("LicenseId", driver.getDriveCard());//机动车驾驶证号 |
| | |
| | | public void operateLogout(Integer driverId){ |
| | | Driver driver = driverService.selectById(driverId); |
| | | Car car = carService.selectById(driver.getCarId()); |
| | | String value = redisUtil.getValue("DRIVER" + driverId); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + driverId); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("LicenseId", driver.getDriveCard());//机动车驾驶证号 |
| | |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * socket推单处理类 |
| | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("id", userId); |
| | | data.put("type", 1); |
| | | String value = redisUtil.getValue(orderId + "_" + orderType); |
| | | String value = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType); |
| | | if(ToolUtil.isEmpty(value)){ |
| | | redisUtil.setStrValue(orderId + "_" + orderType, data.toJSONString()); |
| | | redisTemplate.opsForValue().set(orderId + "_" + orderType, data.toJSONString()); |
| | | createTask(orderId, orderType); |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driverId)); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driverId)); |
| | | if(null == value || "".equals(value)){ |
| | | return; |
| | | } |
| | |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | String value1 = redisUtil.getValue(orderId + "_" + orderType); |
| | | String value1 = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | this.removeTask(orderId, orderType); |
| | | return; |
| | |
| | | if (null != timer){ |
| | | timer.cancel(); |
| | | taskMap.remove(orderId + "_" + orderType); |
| | | redisUtil.remove(orderId + "_" + orderType); |
| | | redisTemplate.delete(orderId + "_" + orderType); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", JSON.toJSONString(request)); |
| | | map.put("content", new Gson().toJson(request)); |
| | | log.info("【修改企业基本信息】请求地址:" + url); |
| | | log.info("【修改企业基本信息】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, map); |
| | |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", JSON.toJSONString(request)); |
| | | map.put("content", new Gson().toJson(request)); |
| | | |
| | | log.info("【创建企业】请求地址:" + url); |
| | | log.info("【创建企业】请求参数:" + JSON.toJSONString(map)); |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【根据手机号注册用户】请求地址:" + url); |
| | | log.info("【根据手机号注册用户】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【易信用户修改密码】请求地址:" + url); |
| | | log.info("【易信用户修改密码】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", JSON.toJSONString(request)); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【易信重置密码】请求地址:" + url); |
| | | log.info("【易信重置密码】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Integer empId; |
| | | private Long empId; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Integer empId; |
| | | private Long empId; |
| | | /** |
| | | * 操作人手机号 |
| | | */ |
| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.OrderAdditionalFee; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | |
| | | orderTaxi.setArriveTime(date); |
| | | orderTaxi.setStartServiceTime(date); |
| | | orderTaxi.setBoardingTime(date); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + uid); |
| | | if (ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(split[0], split[1]); |
| | | orderTaxi.setBoardingAddress(geocode1.get("address")); |
| | | orderTaxi.setBoardingLon(Double.valueOf(split[0])); |
| | | orderTaxi.setBoardingLat(Double.valueOf(split[1])); |
| | | } |
| | | |
| | | |
| | | //调用高德创建轨迹 |
| | | String s = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | String track = gdFalconUtil.createTrack(s); |
| | |
| | | } |
| | | }).start(); |
| | | //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | jsonArray = JSON.parseArray(vehicle); |
| | | } |
| | | jsonArray.add(orderTaxi.getDriverId()); |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | |
| | | orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney()); |
| | | orderTaxi1.setState(8); |
| | | OrderTaxiServiceImpl.this.updateById(orderTaxi1); |
| | | |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | }).start(); |
| | | |
| | | //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | jsonArray = JSON.parseArray(vehicle); |
| | | } |
| | | jsonArray.add(orderTaxi.getDriverId()); |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识 |
| | | |
| | | TimerTask timerTask = new TimerTask() { |
| | | @Override |
| | |
| | | orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney()); |
| | | orderTaxi1.setState(8); |
| | | OrderTaxiServiceImpl.this.updateById(orderTaxi1); |
| | | |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | | kaptcha-open: false #是否开启登录时验证码 (true/false) |
| | | # file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | picture-server-address: http://192.168.0.43/resources/ #图片服务器地址 |
| | | spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) |
| | | session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 |
| | | session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 |
| | |
| | | |
| | | --- |
| | | |
| | | mysql_ssl: |
| | | useSSL: true |
| | | requireSSL: true |
| | | verifyServerCertificate: true |
| | | sslMode: verify_ca |
| | | trustCertificateKeyStoreUrl: file:D:/Program Files/mysql-5.7.38-winx64/data/truststore |
| | | trustCertificateKeyStorePassword: sinata |
| | | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/jyxtravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | |
| | | #测试环境 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | timeout: 5000 |
| | | database: 10 |
| | | password: 123456 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: wxfba0dbf7c79c8593 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 99ffb558cc6af57fd60703fb36e28829 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: #小程序APPid |
| | | appletsAppSecret: # |
| | | mchId: 1523106371 #微信支付分配的商户号 |
| | | key: s4TQO0NqPaRc0YfGptejNjlOpFlt4y2K #key为商户平台设置的密钥key: |
| | | appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: wxcc3c9058e2b294db #小程序APPid |
| | | appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # |
| | | mchId: 111 #微信支付分配的商户号 |
| | | key: 111 #key为商户平台设置的密钥key: |
| | | |
| | | --- |
| | | |
| | | alipay: |
| | | appid: 2021003104609427 #应用程序唯一标识 |
| | | appPrivateKey: MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7Kry43+tFiWnNhg9Us48Jzbjf/65hO/d0epihS4LnAO15L+V4UZfpSfIvIC5N6kEnkem+/abBnhAtSQE05s4gR3PtuP0H2SNX79+pgFliA1QvaSoA514f+APKiDUPTkmaTbp3MXCx0RGYEAEd6LOi8AUbFF2QWKDiMY76ac2l2FirVEeU8r9dIvPu1WDtTMoxAGFu6JfNsZ1ik8VyZUvULHyrXbe6Fx4KFX8kFX4PYEZ8RU3q6y9PCwMAjiPoBMs7t9s4GBrlfGoxMoC6+Lthh6rhLEq4OLoVVzrh/H+yWXg0SpFhnxN3RtIWueVWc9qsF7wtFoP4gXDWI/x6OmFRAgMBAAECggEBALhARjCpHm8B60oL4yO67+DyyECa7wuBgQUFeyOttlu6KgzW/csIZ8ecp/GEeJDzPti5Z6ZBBdwswjgSWkG9xMU6EgG/zjffpk93MHMoitVV+ZYCrPreyWYnPXQvyiwbIZHpWtrjrNEfw3YyqybKYazRI/WYgtMKrLZ/mwUhCvVq6CEwVMRDZXc2ietCtrZvbH4XuRtbXxxddzjiChhlRVwbD4Vei5eYS7F97PjHSrtjxjPyatw/mq6Gwh7tkjXuBliB2NwLcHkkm4FT4WxyLSWO8OydYPFYC5E6ENaZmZZMub3bXQ66xciCXwWMHZ7uRe5tmwtxWj8QqjLj8GtciAECgYEA8dVP6ViKSuwQ6WInDvAxoLrrcEX3D5N17L4sb0kfUtsd7S+g4MbHueXAmIqdlFXnCvjmfFUYg4kqfYU/PqaElntupuvTzwe4JUAtnmw7MB72iP6fzL1x3kBFgzn4ZaVzcRafRiiqE27+KPOkD+uNsgCMExIeTC6IgaKUbkjMjOECgYEAxiGdHN9ho44uBORW8+kdX1c92PFfpHsRcLdZkE6C+kjoS2QAMl1mM72yWHRn+rqK/Kk5BCipQ92+K/j78Zs1Zmunz+JJvQgTxQ2HFlW1tnb53K9F4xr6K1ysYdVmfeLH5wtNAJ2aLabD9Nzi/7RW4Oz83rN3bPFW4Dxgi5O0cnECgYEAgzejLJIGN7DvXDMNzmU2CGhj53+PFryEd/iYU6nxfRu3mUMGn/A73vpzDlHoPtx9iM6VAVGLA5QhognyzyO7PYur9pZvTx55JH02Q4emde3XB25hds40QsvM6+9AgKbNhMcplP/riK/o6H+KvbiqIbN6Tb6/Accd+nkk4NJPawECgYEArKbb9y39Mn4SQfcMgo2QJ+WpImPruTP5FaTgaizQW/OuYQvqU/kpt0rFn+kINufZd6Sq56HbJiWTs1PLkFV06iRD3pZNNWlVePB52A+mQjNZNmKR3v5CJAkkujgwkOBO3FnvpuqvULqypazaLoLi9ivtis8O8aM41jwm0VpL8zECgYAXoKO7mfyehcyOqHTgvUo8JOIZm4G1zxZxMImutQc13ZY0mZniGFuZJ5cXFWHpyscrt69zklpp1uhYJLsaoKfPUeZi1ZujlSA7uY4vEYUoEA+AQT541/Bn7JqOoUnLAMzsucEF0vUV/kYmePe68B3JbrxZKisgFkR5OB/8/Nh2og== #开发者应用私钥 |
| | | appid: 111 #应用程序唯一标识 |
| | | appPrivateKey: 111 #开发者应用私钥 |
| | | alipayPublicKey: 1 #应用公钥 |
| | | alipay_public_key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuyq8uN/rRYlpzYYPVLOPCc243/+uYTv3dHqYoUuC5wDteS/leFGX6UnyLyAuTepBJ5Hpvv2mwZ4QLUkBNObOIEdz7bj9B9kjV+/fqYBZYgNUL2kqAOdeH/gDyog1D05Jmk26dzFwsdERmBABHeizovAFGxRdkFig4jGO+mnNpdhYq1RHlPK/XSLz7tVg7UzKMQBhbuiXzbGdYpPFcmVL1Cx8q123uhceChV/JBV+D2BGfEVN6usvTwsDAI4j6ATLO7fbOBga5XxqMTKAuvi7YYeq4SxKuDi6FVc64fx/sll4NEqRYZ8Td0bSFrnlVnParBe8LRaD+IFw1iP8ejphUQIDAQAB #支付宝公钥 |
| | | alipay_public_key: 111 #支付宝公钥 |
| | | |
| | | --- |
| | | |
| | | juhe: #聚合数据 |
| | | appKey: 01ba594fee41fc7214ca77ef51c783c9 # |
| | | appKey: 111 # |
| | | |
| | | |
| | | --- |
| | | |
| | | jiguang: |
| | | appKey-driver: c673a73acba4d06849913fd2 #极光推送应用唯一标识 |
| | | masterSecret-driver: 8553897a9a886fb0cf467e97 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | appKey-dispatch: 7eecaa0ce660780f4b364684 #极光推送应用唯一标识 |
| | | masterSecret-dispatch: fca87938cb39a72360ea3293 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | appKey-driver: 111 #极光推送应用唯一标识 |
| | | masterSecret-driver: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | appKey-dispatch: 111 #极光推送应用唯一标识 |
| | | masterSecret-dispatch: 111 #用于服务器端 API 调用时与 AppKey 配合使用达到鉴权的目的 |
| | | |
| | | |
| | | --- |
| | | |
| | | #filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 |
| | | filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | |
| | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://zhentonggongsi.com:443/driver |
| | | #正式测试环境 |
| | | #callbackPath: http://123.56.89.63:8080/driver |
| | | #本地测试环境 |
| | | #callbackPath: http://vwpmxwbhv59i.guyubao.com/driver |
| | | |
| | | --- |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
| | | |
| | | --- |
| | | #云闪付配置 |
| | | #upyzt: |
| | | # root-mch-id: 1007907055778710140 |
| | | # api-base: |
| | | # encrypt-public-key: 04a79c8a0f236b383ac5815d22eebbc29f947f7e10c5a145dc545107e88bf30a97eee234b734f63578dd3423e4ba05bea2741a3e5b9e7e85f6f8e91eb406fa61dd |
| | | # sign-private-key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCv6jKnPPv+RbL1Ez4TGF2rXD13Lb5hsqEHFG1lGu2j//HVDrSxjAKtWiOCSBcsi3ql1vLHcE9ptkX098sBjJQ71KlqwBB9bJKfUA3aP/R8aoP+2T247vr4vpGoVHrOGIx9fb2nCK6lX7jamuBlWls2SrXiSwgsNBBMfdzaSev5MMLW7Rwts4CCaDvTNE+fTMJeSi1Bj3gDyY/s+ZDz9usZ4thQq4XV/CMuq9KfT36U5kbBMPLZzlT7CnH82uewG3vZ8MYJ83VqveNsWcWUXvDlpeDKbk7IKqzzpcqM608VFf9YVlaH1PnPxGJVMg+fRI0zcxT/ayxQ6/lj8lBjz81PAgMBAAECggEARIL9v0xtCBa1H+Wio2U19esytRvHrd0YAd3ezSWzr8+aq9PSY+OXl1QnyDGzdNHNrpEMdMg05YLrtABdu/i4MqUcZkrvISoL4KgY/QszeNEzHyoUc9X/QKlXqStduK6u6KD0H/2tpxKkt97hzhdmtrpaJAv83tpYDrJmNU3c7Wt8EdVein8LoO+ZM5Y5Fj2z08RoWcuoba6VAtvL+/LXC+yFHhh9XaVOPFt/KKgf17GpbI2b++1oLsBH1Lvy5aVNLobuBhoG//YRWITzpvTESFnlZeZZEE1/my45ae21LEC4p9WZbkfyUhEsWgKdGNyysj2Bi9suirZw2I11emXCIQKBgQD/Z6vPYHJOclNUnpNmj8keJkfe1wOrhPiaNyaMn6D/SE3DuGd1q5ilQA3etkc42UvgVeO9VLwAYE/fauDwl/AcztRv5KugdKcrRYmaT76DqWvy5ScYh6uCxWDYF4TyT4XKDWpH3nBA7/tzEbiJM8PobgGQpQHhIidd4Xua45nE9QKBgQCwUx39zwEGF6wCp7xs4yeWZy/M2XmuyzaDrWQjqj4PdPOhd4M3TOeGa7Dk0u8SlTGtkXbtc1MztIVO/91nc7ge706Zp94lqTW34owqWKRTbW46H7v4Cm48RIRek/q7WliYD3FmhhMnbBYjv1905KTqbb20kAsR6ensMwE4SmD+swKBgQCt5pneXq4V6dQBZuO4TqjC5Y/EFCTEkYpv/qM51qrZhxKj9BhFz6vkwKNxBC2kcJgwTGr/jAViQDHCTtSQHPP5uX5+HXYaj7MPTI6vyiJPJXmB7jNbiWznYptZJ1J3ZlwTQmUeQD+wh3ZvWB6NFPkMdnKMWT3ZW9bwHkp6IQSfTQKBgGU99FSNjWrwIKYNpdVnwI1Nhla68HF64TxOTNdloujBIDqwIrmYAMBgCVv5+afT3ohoo77HnxhrKLgplfkWqruocJstlhJNzDhfblfKOeBlTws0uXs8kfss5Exh72+v+nqlM1nI1iqmlzfDZI370u2AQZLxukl45AXpa2Pk4TidAoGBALAmhrLFpTgQb7zTv471azY2Z9LRCGOcU0c73JbHvx6kkTudOQslf4ojqUJH/mR2/bIjzP0NuUpdL9r/1ZFlbhVRzYYbJdlKhByDUiHN0kBK0T4OfVNaudRAn9AkGUKzgR/ZcpkJ1XDu/Q5xTGsTs4TobNsPrVgNqVvcFxsMVa+f |
| | | # verify-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxRo7VeJ9goO9Udw/NGmg11ebTMZNLtqssbjID+smZjGuHrwBI/E7nYxe9aBSjswtAjdVFpspRXacOayTBTKwUix1pUpAMHZSC0vw0nLGOBesXYorPOlPQrOHHReIKFg+tVDsKNENNsHPxq1zOal8O8dXjN2ZDxMe2XjOkXP40iYa3YitX4pRN3aKRORnm/jyOjqBimdGwDQvXam97L5Ig6/h4AntZQaQMb1dCCNKe8TUJmCQqGFe4uxQlrrYRBqZApyeafNh75bu+kV7H1TRg3ryuHwPk3UHB3pcA09KcpLmlS0Z27Y8yiNtQFdlsMxbyF22Ji66OkNjTWko04JVXwIDAQAB |
| | | |
| | | upyzt: |
| | | root-mch-id: 1008242569972661286 |
| | | api-base: |
| | | encrypt-public-key: 04b82af98a8cae3977176f7d667da9cf7b1dec0eb6f9bb8384e379ee45583205846ae808f1e4f50d4e3bd35d92e51a46455b58c75fe8d1092c0650a7696211f5c6 |
| | | sign-private-key: MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCmpIUQUcQ34ECQblphKdggKYDvOJRLcWOQPoREPIHO2/1yp9So5b3O65LqQVeKxShYtLHLnn9TeDRMP6aKWhVtkm0itRJ7LpZJExhCtcZN721PzC+vQWTlitiQKNFkkBycAxa5K2IRVHoiTIyfeuCSGy+iX9YRGyxr8frMCvKUCENVtqAxmqSheykqNCF3m/Nu3WarV/XxxKLTZgbY7WO5kO/MbvEok2VtklnKV92ntT8rS300ck3GOxHATKyxThZ+N+A13dgwfW8oS/U27uQhXnaSyiL23Aqnkjdue2cCYhwqj+JskOvB4FDI4osL1A3D87Vr453+7dR4srTSlX59AgMBAAECggEBAICWlSM5pSrkvY11ygIN8vsma5qs0ynADm8A/rlU42nHMbSmsx+9YBDqkQx4bV/ksTR6AnQ4EtJLADgSKaW6y6wogFR22xL4qPksZd0cPTBoX7Zivi0DTiMeV+wtwx5RYfI1I/Sw+FSdFj2fSifJ/r5fggtO3nWGvWlyaO/IRtVYp5R7nl2xa6dA0tmlj3M59zBH8JV84WKjmkYKelNeM5cn2dpC1jokhZTGlNSUx5FAvFHWXbFzSkKWTl0quEbAqaAoWaSQn2DlWutxh4pYnlq5tIhR9tbXdbfrv6QTC/dekctwxHCwLQEpG+Bo2ZG8CNmMaL9UthpLJzprsH2ZrGECgYEA28nmpSfWHKuPM8sp0/+wFMgGIAaBzKFFa9skAyQakUDy0V+8yKwDv1WF6/YFqjpObgB0pwRN84mBgYxumuT73VE8ewztRvZ6Zj/upU/t7XVnb3ZZfWxQXlUslktgg0dGNRZRBaNDTHcNaq71PiRGOpDF/mx3bEPVbPz0m/YLVnUCgYEAwhkPy5viQnQPFu0WmSJSnB48sUq8w9hkN/A9mTBDKZg+dWcO57X85bbK/fly/OmXPn9jtayunMul2fOFg69UkLJi0l89kECF7w+nqmeiGYILbqH7rxbnRpMyGoeClVDCgjRsTR/IVM42XuSDGdBduea1M+3InMqDclgLXzRG1ukCgYBtjBeKr+1XQudQYG3LvcBsyznKUpP1g1hPpt0vN5qKVX3xf69fseT4Q89JScmPDBq1V0LNUCbuQNYs1Or4BzPGHsxvZIULfqSJPEpdWRZ06bSRaMK38fmo2vkrPAyxwh+rLCFcFwDfJuOoDeYsf/YFEM2uvy9S5giFlxrwdVU3VQKBgQCQ6Scay3IcTQvrAO1rPO3SMtz7PKI70XXZMZq7oQWzqz+OZXgCVKPQWS2qei94VWmetnsZ6yeeVoindSGMVD1dnmEbURHkfdfAyL5UAfVK+AVS/sqqSP44ebLhjaRXmCjwDvWAiycE8cQ0CoU6o48mOPG2KGQrcyK6HrO2y4/L6QKBgQCetnmw1FkvRRGjSUSW/VkC3gFd8zUzVXkCpB7ikygukgXxzztU9Ef6MYljb+LJbWNVoZRJFL8qRixHvqJ5NPOiJEUetn2v5e+dsFF4ZtjnMAm7F27+RDJWYnldb0i7N9YhAPRV4jhVf9w2uVvD+pNvtrvgWyhVvfwWSX/bKRgYXQ== |
| | | verify-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyr6JlFZM197He+qcWImiHaVfdY9aIQTL7HaqIOvAqgCLa/oUoHlUNLb8ZZbQzFm/uDhgitPSP8tG0NPW0Vge0zlSXdYZFJFpZdBDmtkGR/fN0bJ9UMcijFEkCzyo2j2KTsJ4jMbaWW13zPQfGir6PIVX8YbQSB1prZzGWt+LzW4VTowwFl7iF/g9M/MqM67fnLmg+lIqzwaG1JsjDwDC0nUmywJfFFH/j/yKWsq+YYDh1dZI7cDWxMbrzgDzxOfBMSc4mk/e9pxaTtIjPbRsmOsAUiwdh4av/VIyI3KI9wdKiJQR6Sk3BcNWbk6cGgAbpnc5kZ87qMUjUZ6fY+VUAQIDAQAB |
| | | |
| | | #二维码支付 |
| | | qrcode: |
| | | appId: 8a81c1bf831e72e30187ad640adf49be |
| | | appKey: 6463dcd46c6d410eb40e68ee40e86e84 |
| | | md5key: NxDhJztSzCDFzs3Z5Fzck7BAG2sRA4DY5aKScJDZrAzMkCh7 |
| | | msgSrcId: 34U0 |
| | | mid: 898150841210108 |
| | | tid: 84UJWSE8 |
| | | instMid: QRPAYDEFAULT |
| | | #qrcode: |
| | | # appId: 8a81c1bf831e72e30187ad640adf49be |
| | | # appKey: 6463dcd46c6d410eb40e68ee40e86e84 |
| | | # md5key: NxDhJztSzCDFzs3Z5Fzck7BAG2sRA4DY5aKScJDZrAzMkCh7 |
| | | # msgSrcId: 1017 |
| | | # mid: 898201612345678 |
| | | # tid: 88880001 |
| | | # instMid: QRPAYDEFAULT |
| | | #qrcode: |
| | | # appId: 10037e6f6823b20801682b6a5e5a0006 |
| | | # appKey: 1c4e3b16066244ae9b236a09e5b312e8 |
| | | # md5key: impARTxrQcfwmRijpDNCw6hPxaWCddKEpYxjaKXDhCaTCXJ6 |
| | | # msgSrcId: 1017 |
| | | # mid: 898201612345678 |
| | | # tid: 88880001 |
| | | # instMid: QRPAYDEFAULT |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.DeleteStafNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.EditStaffNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.GetStaffNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | |
| | | |
| | | GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | request.setEmpId(11448036); |
| | | request.setEmpId(11448036L); |
| | | request.setMobile("15828353127"); |
| | | request.setEntercode("981100006005878"); |
| | | EmployeeUtil.getStaffNode(request); |
| | |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <!-- 导入Excel数据依赖 start --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | |
| | | public Object delete(@RequestParam Integer tDriverId) { |
| | | TDriver driver = tDriverService.selectById(tDriverId); |
| | | driver.setFlag("3"); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | User user1 = userService.selectById(user.getId()); |
| | | TCompany tCompany = itCompanyService.selectById(user.getObjectId()); |
| | | //中台先删除司机 |
| | | GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | request.setEmpId(driver.getEmpId()); |
| | | request.setMobile(user1.getPhone()); |
| | | request.setEntercode(tCompany.getEnterCode()); |
| | | StaffNodeInfo staffNode = EmployeeUtil.getStaffNode(request); |
| | | if ("1".equals(staffNode.getIsValid())) { |
| | | DeleteStafNodeRequest deleteStafNodeRequest = new DeleteStafNodeRequest(); |
| | | deleteStafNodeRequest.setEmpId(driver.getEmpId()); |
| | | deleteStafNodeRequest.setEntercode(tCompany.getEnterCode()); |
| | | deleteStafNodeRequest.setMobile(user1.getPhone()); |
| | | EmployeeUtil.ecrmDeleteStafNode(deleteStafNodeRequest); |
| | | } |
| | | tDriverService.updateById(driver); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER_" + driver.getPhone()); |
| | | redisTemplate.delete(value); |
| | |
| | | <groupId>org.ehcache</groupId> |
| | | <artifactId>ehcache</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | <!--需要分布式session的话需要放开注释--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--<groupId>org.springframework.session</groupId>--> |
| | | <!--<artifactId>spring-session-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.boot</groupId>--> |
| | | <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> |
| | | <!--</dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | | <artifactId>kaptcha</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>redis.clients</groupId> |
| | | <artifactId>jedis</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <version>2.4</version> |
| | | <classifier>jdk13</classifier> |
| | | </dependency> |
| | | <!--中台sdk--> |
| | | <dependency> |
| | | <groupId>com.zhongtai</groupId> |
| | | <artifactId>zhongtai-sdk</artifactId> |
| | | <version>1.0.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/openApiClient-1.0.0.jar</systemPath> |
| | | </dependency> |
| | | <!--单点登录sdk--> |
| | | <dependency> |
| | | <groupId>com.cas</groupId> |
| | | <artifactId>cas-client-oncon</artifactId> |
| | | <version>3.0.5</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/cas-client-oncon-3.0.5.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.cas</groupId> |
| | | <artifactId>cas-client-oncon-core</artifactId> |
| | | <version>1.2.2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/cas-client-oncon-core-1.2.2.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>it.sauronsoftware</groupId> |
| | | <artifactId>base64</artifactId> |
| | | <version>1.3.1</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/javabase64-1.3.1.jar</systemPath> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.builder.SpringApplicationBuilder; |
| | | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; |
| | | import org.springframework.cloud.client.loadbalancer.LoadBalanced; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.context.annotation.Bean; |
| | |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @EnableTransactionManagement//启动事务功能 |
| | | public class GunsApplication /*extends SpringBootServletInitializer*/ { |
| | | |
| | | public class GunsApplication { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class); |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | SpringApplication.run(GunsApplication.class, args); |
| | | logger.info("GunsApplication is success!"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 向Spring容器中定义RestTemplate对象 |
| | | * @return |
| | |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("嘉易行 Doc") |
| | | .title("黔云通 Doc") |
| | | .description("所有接口前需要加 /user 前缀,例如:/user/base/agreement/queryByType <br>" + |
| | | "所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | |
| | | */ |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(new RestApiInteceptor()).addPathPatterns("/api/**") |
| | | .excludePathPatterns("/api/placeOrder/notifyUrl").excludePathPatterns("/api/placeOrder/notifyUrlOne").excludePathPatterns("/base/**").excludePathPatterns("/api/electronicLedger/**"); |
| | | // registry.addInterceptor(new RestApiInteceptor()).excludePathPatterns("/api/**") |
| | | // .addPathPatterns("/api/placeOrder/notifyUrl").excludePathPatterns("/api/placeOrder/notifyUrlOne"); |
| | | registry.addInterceptor(new RestApiInteceptor()).addPathPatterns("/api/**"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.account.model.TBank; |
| | | import com.stylefeng.guns.modular.account.model.TBankNext; |
| | | import com.stylefeng.guns.modular.account.model.TUserBankAccount; |
| | |
| | | import com.stylefeng.guns.modular.account.server.ITBankService; |
| | | import com.stylefeng.guns.modular.account.server.UserBankAccountService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.BalanceAcctExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.CusApplicationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.SettleAcctExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.BalanceAcctReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.UserBankAccountReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.model.UserBankAccount; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.BalanceAcctListResp; |
| | | import com.unionpay.upyzt.resp.CusApplicationResp; |
| | | import com.unionpay.upyzt.resp.SettleAcctListResp; |
| | | import com.unionpay.upyzt.resp.SettleAcctResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | } |
| | | userBankAccount.setUserId(uid); |
| | | UserBankAccount userBankAccount1 = new UserBankAccount(); |
| | | BeanUtils.copyProperties(userBankAccount,userBankAccount1); |
| | | BeanUtils.copyProperties(userBankAccount, userBankAccount1); |
| | | userBankAccount1.setCreateTime(new Date()); |
| | | userBankAccount1.setUserType(1); |
| | | userBankAccount1.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | userBankAccount1.setBankAcctType("1"); |
| | | bankAccountService.insert(userBankAccount1); |
| | | UserBankAccountReq userBankAccountReq = new UserBankAccountReq(); |
| | | BeanUtils.copyProperties(userBankAccount1,userBankAccountReq); |
| | | userBankAccountReq.setCusId(userId.get(0).getCusId()); |
| | | // UserBankAccountReq userBankAccountReq = new UserBankAccountReq(); |
| | | // BeanUtils.copyProperties(userBankAccount1,userBankAccountReq); |
| | | // userBankAccountReq.setCusId(userId.get(0).getCusId()); |
| | | // SettleAcctResp settleAcctResp = SettleAcctExample.create(userBankAccountReq); |
| | | // userBankAccount1.setOutRequestNo(settleAcctResp.getOutRequestNo()); |
| | | // userBankAccount1.setVerifyStatus(settleAcctResp.getVerifyStatus()); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getCode", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取验证码", tags = {"用户端-获取验证码"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil getCode(String phone){ |
| | | try { |
| | | CusApplicationExample.smsCode(phone); |
| | | return ResultUtil.success(); |
| | | }catch (UpyztException e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.GetOpenBodySig; |
| | | import com.stylefeng.guns.core.util.NotifyDemo; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.model.OrderCharteredCar; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.account.model.TEnterpriseWithdrawal; |
| | | import com.stylefeng.guns.modular.account.server.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.Base64Util; |
| | | import com.stylefeng.guns.modular.account.util.QrCodeConfiguration; |
| | | import com.stylefeng.guns.modular.account.util.Util; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.DepositExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.UserInfoMapper; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | |
| | | import com.stylefeng.guns.modular.system.service.ITaxiCardService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import com.unionpay.upyzt.resp.DepositResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @program: openPlatform |
| | |
| | | TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>() |
| | | .eq("companyId", company.getId())); // TODO 替换为公司id |
| | | |
| | | DepositReq depositReq = new DepositReq(); |
| | | // DepositReq depositReq = new DepositReq(); |
| | | |
| | | |
| | | if(integer==7){ // 充值回调 |
| | |
| | | // depositReq.setProductName("用户支付充值"); |
| | | // depositReq.setProductCount(1); |
| | | } |
| | | depositReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | depositReq.setTotalAmount(totalAmount); // 总金额 |
| | | depositReq.setAmount(buyerPayAmount); // 支付金额 |
| | | depositReq.setDiscountAmount(couponAmount); // 优惠金额 |
| | | depositReq.setBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); |
| | | depositReq.setDepositType("1"); |
| | | depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode()); |
| | | depositReq.setPaymentTradeNo(targetOrderId); // 系统交易流水号 |
| | | depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())); |
| | | depositReq.setOrderNo(targetOrderId); |
| | | depositReq.setOrderAmount(Long.valueOf(totalAmount)); |
| | | depositReq.setProductName("用户支付充值"); |
| | | depositReq.setProductCount(1); |
| | | |
| | | // depositReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | // depositReq.setTotalAmount(totalAmount); // 总金额 |
| | | // depositReq.setAmount(buyerPayAmount); // 支付金额 |
| | | // depositReq.setDiscountAmount(couponAmount); // 优惠金额 |
| | | // depositReq.setBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); |
| | | // depositReq.setDepositType("1"); |
| | | // depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode()); |
| | | // depositReq.setPaymentTradeNo(targetOrderId); // 系统交易流水号 |
| | | // depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())); |
| | | // depositReq.setOrderNo(targetOrderId); |
| | | // depositReq.setOrderAmount(Long.valueOf(totalAmount)); |
| | | // depositReq.setProductName("用户支付充值"); |
| | | // depositReq.setProductCount(1); |
| | | |
| | | try { |
| | | // DepositResp depositResp = DepositExample.create(depositReq); |
| | | // System.err.println(depositResp); |
| | | // log.info("支付充值成功:{}",depositResp); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("支付充值失败:{}",e.getMessage()); |
| | | log.error("支付充值失败:{}", e.getMessage()); |
| | | PrintWriter writer = response.getWriter(); |
| | | response.setStatus(200); |
| | | writer.write("FAILED"); |
| | |
| | | } |
| | | } |
| | | |
| | | public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money) { |
| | | List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); |
| | | UserInfo tUser = userInfoService.selectById(userId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if (userWithdrawals.size() == 0) { |
| | | return "error"; |
| | | } |
| | | |
| | | // AllocationReq allocationReq= new AllocationReq(); |
| | | // allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | // if(type==1){ |
| | | // allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | // |
| | | // allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | // }else { |
| | | // allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | // } |
| | | // money = money * 100; |
| | | // allocationReq.setAmount((int) money); |
| | | // allocationReq.setProductName("分账"); |
| | | // allocationReq.setProductCount(1); |
| | | // allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | // allocationReq.setOrderAmount(1l); |
| | | // try { |
| | | // AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | // System.out.println(allocationResp); |
| | | // return "ok"; |
| | | // } catch (UpyztException e) { |
| | | // e.printStackTrace(); |
| | | // return e.getMessage(); |
| | | // } |
| | | return "ok"; |
| | | } |
| | | |
| | | public ResultUtil moneyPay(Integer id,Integer userId,Double money){ |
| | | |
| | |
| | | TEnterpriseWithdrawal enterpriseWithdrawal = enterpriseWithdrawalService.selectOne(new EntityWrapper<TEnterpriseWithdrawal>() |
| | | .eq("companyId", company.getId())); |
| | | UserInfo userInfo = userInfoService.selectById(userId); |
| | | System.out.println("用户信息:"+userInfo); |
| | | System.out.println("用户信息:" + userInfo); |
| | | UserWithdrawal driverWith = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", userInfo.getPhone()) |
| | | .last("LIMIT 1")); |
| | | System.out.println("用户进件信息:"+driverWith); |
| | | if(driverWith==null){ |
| | | System.out.println("用户进件信息:" + driverWith); |
| | | if (driverWith == null) { |
| | | return ResultUtil.error("领取失败,请先设置进件信息"); |
| | | } |
| | | AllocationReq allocationReq = new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setProductCount(1); |
| | | allocationReq.setPayBalanceAcctId(driverWith.getBalanceAcctId()); |
| | | // allocationReq.setPayBalanceAcctId("2008322294132024868"); |
| | | allocationReq.setOrderAmount((long) (money*100)); |
| | | allocationReq.setAmount((int) (money*100)); |
| | | allocationReq.setProductName("余额支付"); |
| | | allocationReq.setRecvBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); |
| | | // allocationReq.setRecvBalanceAcctId("2007982285722883157"); |
| | | allocationReq.setOrderNo(id.toString()); |
| | | allocationReq.setPassword(Base64Util.decode(driverWith.getTransactionAuthorizationCode())); |
| | | // AllocationReq allocationReq = new AllocationReq(); |
| | | // allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | // allocationReq.setProductCount(1); |
| | | // allocationReq.setPayBalanceAcctId(driverWith.getBalanceAcctId()); |
| | | //// allocationReq.setPayBalanceAcctId("2008322294132024868"); |
| | | // allocationReq.setOrderAmount((long) (money * 100)); |
| | | // allocationReq.setAmount((int) (money * 100)); |
| | | // allocationReq.setProductName("余额支付"); |
| | | // allocationReq.setRecvBalanceAcctId(enterpriseWithdrawal.getBalanceAcctId()); |
| | | //// allocationReq.setRecvBalanceAcctId("2007982285722883157"); |
| | | // allocationReq.setOrderNo(id.toString()); |
| | | // allocationReq.setPassword(Base64Util.decode(driverWith.getTransactionAuthorizationCode())); |
| | | // allocationReq.setPassword("MTIzNDU2"); |
| | | System.out.println("余额支付请求信息:"+allocationReq); |
| | | try { |
| | | |
| | | AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println("余额支付操作:"+allocationResp); |
| | | return ResultUtil.success(); |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | System.out.println("余额支付操作error:"+e); |
| | | System.out.println(e.getIssue()); |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money){ |
| | | List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); |
| | | UserInfo tUser = userInfoService.selectById(userId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | return "error"; |
| | | } |
| | | |
| | | AllocationReq allocationReq= new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | if(type==1){ |
| | | allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | |
| | | allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | }else { |
| | | allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | } |
| | | money=money*100; |
| | | allocationReq.setAmount((int)money); |
| | | allocationReq.setProductName("分账"); |
| | | allocationReq.setProductCount(1); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setOrderAmount(1l); |
| | | try { |
| | | AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println(allocationResp); |
| | | return "ok"; |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | // System.out.println("余额支付请求信息:" + allocationReq); |
| | | // try { |
| | | // |
| | | // AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | // System.out.println("余额支付操作:"+allocationResp); |
| | | // return ResultUtil.success(); |
| | | // } catch (UpyztException e) { |
| | | // e.printStackTrace(); |
| | | // System.out.println("余额支付操作error:"+e); |
| | | // System.out.println(e.getIssue()); |
| | | // return ResultUtil.error(e.getMessage()); |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | public String createAllocationReqDriver(Integer companyId,Integer userId,int type,double money){ |
| | | |
| | | public String createAllocationReqDriver(Integer companyId,Integer userId,int type,double money) { |
| | | List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = enterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); |
| | | Driver tUser = driverService.selectById(userId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | if (userWithdrawals.size() == 0) { |
| | | return "error"; |
| | | } |
| | | |
| | | AllocationReq allocationReq= new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | if(type==1){ |
| | | allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | |
| | | allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | }else { |
| | | allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | } |
| | | money=money*100; |
| | | allocationReq.setAmount((int)money); |
| | | allocationReq.setProductName("分账"); |
| | | allocationReq.setProductCount(1); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setOrderAmount(1l); |
| | | try { |
| | | AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | System.out.println(allocationResp); |
| | | return "ok"; |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | // AllocationReq allocationReq= new AllocationReq(); |
| | | // allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | // if(type==1){ |
| | | // allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | // |
| | | // allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | // }else { |
| | | // allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); |
| | | // allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); |
| | | // } |
| | | // money = money * 100; |
| | | // allocationReq.setAmount((int) money); |
| | | // allocationReq.setProductName("分账"); |
| | | // allocationReq.setProductCount(1); |
| | | // allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | // allocationReq.setOrderAmount(1l); |
| | | // try { |
| | | // AllocationResp allocationResp = AllocationExample.create(allocationReq); |
| | | // System.out.println(allocationResp); |
| | | // return "ok"; |
| | | // } catch (UpyztException e) { |
| | | // e.printStackTrace(); |
| | | // return e.getMessage(); |
| | | // } |
| | | return "ok"; |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.account.controller; |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.model.ElectronicLedger; |
| | | import com.stylefeng.guns.modular.account.model.TUserBankAccount; |
| | | import com.stylefeng.guns.modular.account.req.UserWithdrawalReq; |
| | | import com.stylefeng.guns.modular.account.server.ElectronicLedgerService; |
| | | import com.stylefeng.guns.modular.account.server.UserBankAccountService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.Base64Util; |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.*; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.BalanceAcctReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.UserBankAccountReq; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IBankCardService; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.param.FailureMsgParam; |
| | | import com.unionpay.upyzt.resp.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.util.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | @Transactional(rollbackFor = UpyztException.class,propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil addElectronicLedger( UserWithdrawalReq userWithdrawalReq,HttpServletRequest request) throws UnsupportedEncodingException { |
| | | System.out.println("进件信息:"+userWithdrawalReq); |
| | | // TODO 用户有无提现密码,无则设置开户密码 |
| | | if(StringUtils.hasLength(userWithdrawalReq.getBankName())){ |
| | | userWithdrawalReq.setBankName(userWithdrawalReq.getBankName().replace("& #40;","(")); |
| | | userWithdrawalReq.setBankName(userWithdrawalReq.getBankName().replace("& #41;",")")); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | // userWithdrawalReq.setOpenAccountName(new String(userWithdrawalReq.getOpenAccountName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | // userWithdrawalReq.setBankName(new String(userWithdrawalReq.getBankName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | // userWithdrawalReq.setCertificateName(new String(userWithdrawalReq.getCertificateName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | // userWithdrawalReq.setLicenceIssuingAuthority(new String(userWithdrawalReq.getLicenceIssuingAuthority().getBytes("ISO-8859-1"),"UTF-8")); |
| | | System.out.println("编码后:"+userWithdrawalReq); |
| | | |
| | | |
| | | |
| | | userWithdrawalReq.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | UserWithdrawal userWithdrawal = new UserWithdrawal(); |
| | | BeanUtils.copyProperties(userWithdrawalReq,userWithdrawal); |
| | | try { |
| | | String password=userWithdrawal.getTransactionAuthorizationCode(); |
| | | Integer id = userInfoService.getUserIdFormRedis(request); |
| | | if(null == id){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | System.out.println("验证码:"+userWithdrawalReq.getCode()); |
| | | userWithdrawalReq.setCopy1(userWithdrawalReq.getCopy1().replaceAll(" ","+")); |
| | | userWithdrawalReq.setCopy2(userWithdrawalReq.getCopy2().replaceAll(" ","+")); |
| | | // 用户进件 |
| | | CusApplicationResp cusApplicationResp = CusApplicationExample.create(userWithdrawalReq); |
| | | System.out.println("进件状态:"+cusApplicationResp); |
| | | if("succeeded".equals(cusApplicationResp.getApplicationStatus())) { |
| | | userWithdrawal.setTransactionAuthorizationCode(Base64Util.encode(password)); |
| | | userWithdrawal.setUserType(1); |
| | | userWithdrawal.setUserId(id); |
| | | userWithdrawal.setImgUrl(userWithdrawalReq.getIdCardFrontPicture()); |
| | | userWithdrawal.setImgUrlOne(userWithdrawalReq.getIdCardReversePicture()); |
| | | userWithdrawal.setIdCardFrontPicture(userWithdrawalReq.getCopy1()); |
| | | userWithdrawal.setIdCardReversePicture(userWithdrawalReq.getCopy2()); |
| | | |
| | | userWithdrawalService.insert(userWithdrawal); |
| | | UserWithdrawal userWithdrawal1 = new UserWithdrawal(); |
| | | userWithdrawal1.setId(userWithdrawal.getId()); |
| | | BeanUtils.copyProperties(cusApplicationResp, userWithdrawal1); |
| | | userWithdrawalService.updateById(userWithdrawal1); |
| | | // 开通电子账簿 |
| | | BalanceAcctReq balanceAcctReq = new BalanceAcctReq(); |
| | | balanceAcctReq.setCusId(userWithdrawal1.getCusId()); |
| | | balanceAcctReq.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | balanceAcctReq.setPassword(password); |
| | | ElectronicLedger electronicLedger = new ElectronicLedger(); |
| | | electronicLedger.setBalanceAcctId(cusApplicationResp.getBalanceAcctId()); |
| | | electronicLedger.setCreateTime(new Date()); |
| | | electronicLedger.setCusId(cusApplicationResp.getCusId()); |
| | | electronicLedger.setOutRequestNo(cusApplicationResp.getOutRequestNo()); |
| | | electronicLedger.setUserId(userWithdrawal.getUserId()); |
| | | electronicLedger.setPassword(SecureUtil.md5(password)); |
| | | electronicLedger.setRelAcctNo(cusApplicationResp.getRelAcctNo()); |
| | | electronicLedger.setUserType(1); |
| | | electronicLedgerService.insert(electronicLedger); |
| | | // 绑卡 存卡 |
| | | UserBankAccount userBankAccount = new UserBankAccount(); |
| | | userBankAccount.setBankAcctType("1"); |
| | | userBankAccount.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | userBankAccount.setUserType(1); |
| | | userBankAccount.setCreateTime(new Date()); |
| | | userBankAccount.setBankCardCode(userWithdrawal.getBankCardCode()); |
| | | // TODO 页面没有输入地方 需要查询 |
| | | userBankAccount.setBankCode(userWithdrawal.getBankCode()); |
| | | // TODO 行联号 |
| | | userBankAccount.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | userBankAccount.setPhone(userWithdrawal.getPhone()); |
| | | |
| | | userBankAccount.setUserId(userWithdrawal.getUserId()); |
| | | userBankAccount.setBankName(userWithdrawal.getBankName()); |
| | | userBankAccount.setOpenAccountName(userWithdrawalReq.getOpenAccountName()); |
| | | int count = userBankAccountService.selectCount(new EntityWrapper<UserBankAccount>() |
| | | .eq("bankCardCode", userWithdrawalReq.getBankCardCode()).eq("phone",userWithdrawalReq.getPhone()).eq("status",1)); |
| | | if(count<1){ |
| | | userBankAccountService.insert(userBankAccount); |
| | | } |
| | | BankCard bankCard = new BankCard(); |
| | | bankCard.setDriverId(userWithdrawal.getUserId()); |
| | | bankCard.setBankAcctType("1"); |
| | | bankCard.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | bankCard.setInsertTime(new Date()); |
| | | bankCard.setCode(userWithdrawal.getBankCardCode()); |
| | | bankCard.setBankCode(userWithdrawal.getBankCode()); |
| | | bankCard.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | bankCard.setBank(userWithdrawal.getBankName()); |
| | | bankCard.setPhone(userWithdrawal.getPhone()); |
| | | bankCard.setName(userWithdrawal.getOpenAccountName()); |
| | | bankCard.setIfDefault(true); |
| | | bankCardService.insert(bankCard); |
| | | |
| | | |
| | | UserBankAccountReq userBankAccountReq = new UserBankAccountReq(); |
| | | BeanUtils.copyProperties(userBankAccount, userBankAccountReq); |
| | | System.err.println(userWithdrawalReq.getCode()); |
| | | userBankAccountReq.setCusId(cusApplicationResp.getCusId()); |
| | | userBankAccountReq.setCode(userWithdrawalReq.getCode()); |
| | | return ResultUtil.success(); |
| | | } |
| | | if("failed".equals(cusApplicationResp.getApplicationStatus())){ |
| | | List<FailureMsgParam> failureMsgs = cusApplicationResp.getFailureMsgs(); |
| | | if(failureMsgs != null && failureMsgs.size()>0){ |
| | | return ResultUtil.error(failureMsgs.get(0).getReason()); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (UpyztException e){ |
| | | if(e.getCode().equals("100101")){ |
| | | return ResultUtil.error(e.getIssue()); |
| | | } |
| | | e.printStackTrace(); |
| | | String message = e.getMessage(); |
| | | return ResultUtil.error(message); |
| | | }catch (Exception e){ |
| | | String message = e.getMessage(); |
| | | return ResultUtil.error(message); |
| | | } |
| | | // System.out.println("进件信息:"+userWithdrawalReq); |
| | | // // TODO 用户有无提现密码,无则设置开户密码 |
| | | // if(StringUtils.hasLength(userWithdrawalReq.getBankName())){ |
| | | // userWithdrawalReq.setBankName(userWithdrawalReq.getBankName().replace("& #40;","(")); |
| | | // userWithdrawalReq.setBankName(userWithdrawalReq.getBankName().replace("& #41;",")")); |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | //// userWithdrawalReq.setOpenAccountName(new String(userWithdrawalReq.getOpenAccountName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | //// userWithdrawalReq.setBankName(new String(userWithdrawalReq.getBankName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | //// userWithdrawalReq.setCertificateName(new String(userWithdrawalReq.getCertificateName().getBytes("ISO-8859-1"),"UTF-8")); |
| | | //// userWithdrawalReq.setLicenceIssuingAuthority(new String(userWithdrawalReq.getLicenceIssuingAuthority().getBytes("ISO-8859-1"),"UTF-8")); |
| | | // System.out.println("编码后:"+userWithdrawalReq); |
| | | // |
| | | // |
| | | // |
| | | // userWithdrawalReq.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // UserWithdrawal userWithdrawal = new UserWithdrawal(); |
| | | // BeanUtils.copyProperties(userWithdrawalReq,userWithdrawal); |
| | | // try { |
| | | // String password=userWithdrawal.getTransactionAuthorizationCode(); |
| | | // Integer id = userInfoService.getUserIdFormRedis(request); |
| | | // if(null == id){ |
| | | // return ResultUtil.tokenErr(); |
| | | // } |
| | | // System.out.println("验证码:"+userWithdrawalReq.getCode()); |
| | | // userWithdrawalReq.setCopy1(userWithdrawalReq.getCopy1().replaceAll(" ","+")); |
| | | // userWithdrawalReq.setCopy2(userWithdrawalReq.getCopy2().replaceAll(" ","+")); |
| | | // // 用户进件 |
| | | // CusApplicationResp cusApplicationResp = CusApplicationExample.create(userWithdrawalReq); |
| | | // System.out.println("进件状态:"+cusApplicationResp); |
| | | // if("succeeded".equals(cusApplicationResp.getApplicationStatus())) { |
| | | // userWithdrawal.setTransactionAuthorizationCode(Base64Util.encode(password)); |
| | | // userWithdrawal.setUserType(1); |
| | | // userWithdrawal.setUserId(id); |
| | | // userWithdrawal.setImgUrl(userWithdrawalReq.getIdCardFrontPicture()); |
| | | // userWithdrawal.setImgUrlOne(userWithdrawalReq.getIdCardReversePicture()); |
| | | // userWithdrawal.setIdCardFrontPicture(userWithdrawalReq.getCopy1()); |
| | | // userWithdrawal.setIdCardReversePicture(userWithdrawalReq.getCopy2()); |
| | | // |
| | | // userWithdrawalService.insert(userWithdrawal); |
| | | // UserWithdrawal userWithdrawal1 = new UserWithdrawal(); |
| | | // userWithdrawal1.setId(userWithdrawal.getId()); |
| | | // BeanUtils.copyProperties(cusApplicationResp, userWithdrawal1); |
| | | // userWithdrawalService.updateById(userWithdrawal1); |
| | | // // 开通电子账簿 |
| | | // BalanceAcctReq balanceAcctReq = new BalanceAcctReq(); |
| | | // balanceAcctReq.setCusId(userWithdrawal1.getCusId()); |
| | | // balanceAcctReq.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // balanceAcctReq.setPassword(password); |
| | | // ElectronicLedger electronicLedger = new ElectronicLedger(); |
| | | // electronicLedger.setBalanceAcctId(cusApplicationResp.getBalanceAcctId()); |
| | | // electronicLedger.setCreateTime(new Date()); |
| | | // electronicLedger.setCusId(cusApplicationResp.getCusId()); |
| | | // electronicLedger.setOutRequestNo(cusApplicationResp.getOutRequestNo()); |
| | | // electronicLedger.setUserId(userWithdrawal.getUserId()); |
| | | // electronicLedger.setPassword(SecureUtil.md5(password)); |
| | | // electronicLedger.setRelAcctNo(cusApplicationResp.getRelAcctNo()); |
| | | // electronicLedger.setUserType(1); |
| | | // electronicLedgerService.insert(electronicLedger); |
| | | // // 绑卡 存卡 |
| | | // UserBankAccount userBankAccount = new UserBankAccount(); |
| | | // userBankAccount.setBankAcctType("1"); |
| | | // userBankAccount.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // userBankAccount.setUserType(1); |
| | | // userBankAccount.setCreateTime(new Date()); |
| | | // userBankAccount.setBankCardCode(userWithdrawal.getBankCardCode()); |
| | | // // TODO 页面没有输入地方 需要查询 |
| | | // userBankAccount.setBankCode(userWithdrawal.getBankCode()); |
| | | // // TODO 行联号 |
| | | // userBankAccount.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | // userBankAccount.setPhone(userWithdrawal.getPhone()); |
| | | // |
| | | // userBankAccount.setUserId(userWithdrawal.getUserId()); |
| | | // userBankAccount.setBankName(userWithdrawal.getBankName()); |
| | | // userBankAccount.setOpenAccountName(userWithdrawalReq.getOpenAccountName()); |
| | | // int count = userBankAccountService.selectCount(new EntityWrapper<UserBankAccount>() |
| | | // .eq("bankCardCode", userWithdrawalReq.getBankCardCode()).eq("phone",userWithdrawalReq.getPhone()).eq("status",1)); |
| | | // if(count<1){ |
| | | // userBankAccountService.insert(userBankAccount); |
| | | // } |
| | | // BankCard bankCard = new BankCard(); |
| | | // bankCard.setDriverId(userWithdrawal.getUserId()); |
| | | // bankCard.setBankAcctType("1"); |
| | | // bankCard.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // bankCard.setInsertTime(new Date()); |
| | | // bankCard.setCode(userWithdrawal.getBankCardCode()); |
| | | // bankCard.setBankCode(userWithdrawal.getBankCode()); |
| | | // bankCard.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | // bankCard.setBank(userWithdrawal.getBankName()); |
| | | // bankCard.setPhone(userWithdrawal.getPhone()); |
| | | // bankCard.setName(userWithdrawal.getOpenAccountName()); |
| | | // bankCard.setIfDefault(true); |
| | | // bankCardService.insert(bankCard); |
| | | // |
| | | // |
| | | // UserBankAccountReq userBankAccountReq = new UserBankAccountReq(); |
| | | // BeanUtils.copyProperties(userBankAccount, userBankAccountReq); |
| | | // System.err.println(userWithdrawalReq.getCode()); |
| | | // userBankAccountReq.setCusId(cusApplicationResp.getCusId()); |
| | | // userBankAccountReq.setCode(userWithdrawalReq.getCode()); |
| | | // return ResultUtil.success(); |
| | | // } |
| | | // if("failed".equals(cusApplicationResp.getApplicationStatus())){ |
| | | // List<FailureMsgParam> failureMsgs = cusApplicationResp.getFailureMsgs(); |
| | | // if(failureMsgs != null && failureMsgs.size()>0){ |
| | | // return ResultUtil.error(failureMsgs.get(0).getReason()); |
| | | // } |
| | | // } |
| | | // return ResultUtil.success(); |
| | | // }catch (UpyztException e){ |
| | | // if(e.getCode().equals("100101")){ |
| | | // return ResultUtil.error(e.getIssue()); |
| | | // } |
| | | // e.printStackTrace(); |
| | | // String message = e.getMessage(); |
| | | // return ResultUtil.error(message); |
| | | // }catch (Exception e){ |
| | | // String message = e.getMessage(); |
| | | // return ResultUtil.error(message); |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | |
| | | String copy2, |
| | | String code, |
| | | String bankCode, |
| | | HttpServletRequest request){ |
| | | try { |
| | | Integer driverId = userInfoService.getUserIdFormRedis(request); |
| | | if(null == driverId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(driverId); |
| | | UserWithdrawal userWithdrawal1 = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", userInfo.getPhone()) |
| | | .last("LIMIT 1")); |
| | | if(userWithdrawal1==null|| userWithdrawal1.getCusId()==null){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | UserWithdrawal userWithdrawal = new UserWithdrawal(); |
| | | userWithdrawal.setIdCardFrontPicture(copy1); |
| | | userWithdrawal.setIdCardReversePicture(copy2); |
| | | userWithdrawal.setCertificateCode(certificateCode); |
| | | userWithdrawal.setCertificateName(certificateName); |
| | | userWithdrawal.setCertificateExpireTime(certificateExpireTime); |
| | | userWithdrawal.setOpenAccountName(openAccountName); |
| | | userWithdrawal.setBankCardCode(bankCardCode); |
| | | userWithdrawal.setPhone(phone); |
| | | userWithdrawal.setCusId(userWithdrawal1.getCusId()); |
| | | userWithdrawal.setBankBranchCode(bankBranchCode); |
| | | userWithdrawal.setBankName(bankName); |
| | | userWithdrawal.setCode(code); |
| | | userWithdrawal.setBankCode(bankCode); |
| | | CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | log.info("修改个人用户进件信息返回:{}",renew); |
| | | if("succeeded".equals(renew.getApplicationStatus())){ |
| | | userWithdrawal1.setIdCardFrontPicture(copy1); |
| | | userWithdrawal1.setIdCardReversePicture(copy2); |
| | | userWithdrawal1.setCertificateCode(certificateCode); |
| | | userWithdrawal1.setCertificateName(certificateName); |
| | | userWithdrawal1.setCertificateExpireTime(certificateExpireTime); |
| | | userWithdrawal1.setOpenAccountName(openAccountName); |
| | | userWithdrawal1.setBankCardCode(bankCardCode); |
| | | userWithdrawal1.setPhone(phone); |
| | | userWithdrawal1.setBankName(bankName); |
| | | userWithdrawal1.setImgUrl(idCardFrontPicture); |
| | | userWithdrawal1.setImgUrlOne(idCardReversePicture); |
| | | userWithdrawalService.updateById(userWithdrawal1); |
| | | |
| | | int count = userBankAccountService.selectCount(new EntityWrapper<UserBankAccount>() |
| | | .eq("bankCardCode", bankCardCode).eq("userId",driverId).eq("userType",1).eq("status",1)); |
| | | System.out.println(count); |
| | | if(count<1){ |
| | | UserBankAccount userBankAccount = new UserBankAccount(); |
| | | userBankAccount.setBankAcctType("1"); |
| | | userBankAccount.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | userBankAccount.setUserType(1); |
| | | userBankAccount.setCreateTime(new Date()); |
| | | userBankAccount.setBankCardCode(userWithdrawal.getBankCardCode()); |
| | | userBankAccount.setBankCode(userWithdrawal.getBankCode()); |
| | | userBankAccount.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | userBankAccount.setPhone(userWithdrawal.getPhone()); |
| | | |
| | | userBankAccount.setUserId(driverId); |
| | | userBankAccount.setBankName(userWithdrawal.getBankName()); |
| | | userBankAccountService.insert(userBankAccount); |
| | | |
| | | |
| | | BankCard bankCard = new BankCard(); |
| | | bankCard.setDriverId(userWithdrawal.getUserId()); |
| | | bankCard.setBankAcctType("1"); |
| | | bankCard.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | bankCard.setInsertTime(new Date()); |
| | | bankCard.setCode(userWithdrawal.getBankCardCode()); |
| | | bankCard.setBankCode(userWithdrawal.getBankCode()); |
| | | bankCard.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | bankCard.setBank(userWithdrawal.getBankName()); |
| | | bankCard.setPhone(userWithdrawal.getPhone()); |
| | | bankCard.setName(userWithdrawal.getOpenAccountName()); |
| | | bankCard.setIfDefault(true); |
| | | bankCardService.insert(bankCard); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | if("failed".equals(renew.getApplicationStatus())){ |
| | | List<FailureMsgParam> failureMsgs = renew.getFailureMsgs(); |
| | | if(failureMsgs != null && failureMsgs.size()>0){ |
| | | return ResultUtil.error(failureMsgs.get(0).getReason()); |
| | | } |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | String message = e.getMessage(); |
| | | return ResultUtil.error(message); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | HttpServletRequest request) { |
| | | // try { |
| | | // Integer driverId = userInfoService.getUserIdFormRedis(request); |
| | | // if(null == driverId){ |
| | | // return ResultUtil.tokenErr(); |
| | | // } |
| | | // UserInfo userInfo = userInfoService.selectById(driverId); |
| | | // UserWithdrawal userWithdrawal1 = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | // .eq("phone", userInfo.getPhone()) |
| | | // .last("LIMIT 1")); |
| | | // if(userWithdrawal1==null|| userWithdrawal1.getCusId()==null){ |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | // UserWithdrawal userWithdrawal = new UserWithdrawal(); |
| | | // userWithdrawal.setIdCardFrontPicture(copy1); |
| | | // userWithdrawal.setIdCardReversePicture(copy2); |
| | | // userWithdrawal.setCertificateCode(certificateCode); |
| | | // userWithdrawal.setCertificateName(certificateName); |
| | | // userWithdrawal.setCertificateExpireTime(certificateExpireTime); |
| | | // userWithdrawal.setOpenAccountName(openAccountName); |
| | | // userWithdrawal.setBankCardCode(bankCardCode); |
| | | // userWithdrawal.setPhone(phone); |
| | | // userWithdrawal.setCusId(userWithdrawal1.getCusId()); |
| | | // userWithdrawal.setBankBranchCode(bankBranchCode); |
| | | // userWithdrawal.setBankName(bankName); |
| | | // userWithdrawal.setCode(code); |
| | | // userWithdrawal.setBankCode(bankCode); |
| | | // CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | // log.info("修改个人用户进件信息返回:{}",renew); |
| | | // if("succeeded".equals(renew.getApplicationStatus())){ |
| | | // userWithdrawal1.setIdCardFrontPicture(copy1); |
| | | // userWithdrawal1.setIdCardReversePicture(copy2); |
| | | // userWithdrawal1.setCertificateCode(certificateCode); |
| | | // userWithdrawal1.setCertificateName(certificateName); |
| | | // userWithdrawal1.setCertificateExpireTime(certificateExpireTime); |
| | | // userWithdrawal1.setOpenAccountName(openAccountName); |
| | | // userWithdrawal1.setBankCardCode(bankCardCode); |
| | | // userWithdrawal1.setPhone(phone); |
| | | // userWithdrawal1.setBankName(bankName); |
| | | // userWithdrawal1.setImgUrl(idCardFrontPicture); |
| | | // userWithdrawal1.setImgUrlOne(idCardReversePicture); |
| | | // userWithdrawalService.updateById(userWithdrawal1); |
| | | // |
| | | // int count = userBankAccountService.selectCount(new EntityWrapper<UserBankAccount>() |
| | | // .eq("bankCardCode", bankCardCode).eq("userId",driverId).eq("userType",1).eq("status",1)); |
| | | // System.out.println(count); |
| | | // if(count<1){ |
| | | // UserBankAccount userBankAccount = new UserBankAccount(); |
| | | // userBankAccount.setBankAcctType("1"); |
| | | // userBankAccount.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // userBankAccount.setUserType(1); |
| | | // userBankAccount.setCreateTime(new Date()); |
| | | // userBankAccount.setBankCardCode(userWithdrawal.getBankCardCode()); |
| | | // userBankAccount.setBankCode(userWithdrawal.getBankCode()); |
| | | // userBankAccount.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | // userBankAccount.setPhone(userWithdrawal.getPhone()); |
| | | // |
| | | // userBankAccount.setUserId(driverId); |
| | | // userBankAccount.setBankName(userWithdrawal.getBankName()); |
| | | // userBankAccountService.insert(userBankAccount); |
| | | // |
| | | // |
| | | // BankCard bankCard = new BankCard(); |
| | | // bankCard.setDriverId(userWithdrawal.getUserId()); |
| | | // bankCard.setBankAcctType("1"); |
| | | // bankCard.setOutRequestNo(ToolUtil.getRandomString(32)); |
| | | // bankCard.setInsertTime(new Date()); |
| | | // bankCard.setCode(userWithdrawal.getBankCardCode()); |
| | | // bankCard.setBankCode(userWithdrawal.getBankCode()); |
| | | // bankCard.setBankBranchCode(userWithdrawal.getBankBranchCode()); |
| | | // bankCard.setBank(userWithdrawal.getBankName()); |
| | | // bankCard.setPhone(userWithdrawal.getPhone()); |
| | | // bankCard.setName(userWithdrawal.getOpenAccountName()); |
| | | // bankCard.setIfDefault(true); |
| | | // bankCardService.insert(bankCard); |
| | | // } |
| | | // return ResultUtil.success(); |
| | | // } |
| | | // if("failed".equals(renew.getApplicationStatus())){ |
| | | // List<FailureMsgParam> failureMsgs = renew.getFailureMsgs(); |
| | | // if(failureMsgs != null && failureMsgs.size()>0){ |
| | | // return ResultUtil.error(failureMsgs.get(0).getReason()); |
| | | // } |
| | | // } |
| | | // return ResultUtil.success(); |
| | | // }catch (UpyztException e) { |
| | | // e.printStackTrace(); |
| | | // String message = e.getMessage(); |
| | | // return ResultUtil.error(message); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil withdrawDepositGetMoney(HttpServletRequest request) throws Exception { |
| | | |
| | | |
| | | UserInfo user = userInfoService.selectById(userInfoService.getUserIdFormRedis(request)); |
| | | UserWithdrawal driverWith = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", user.getPhone()) |
| | | .last("LIMIT 1")); |
| | | if(driverWith==null){ |
| | | return ResultUtil.error("请先进行进件操作"); |
| | | if (driverWith == null) { |
| | | return ResultUtil.error("请先进行进件操作"); |
| | | } |
| | | try { |
| | | BalanceAcctReq balanceAcctReq = new BalanceAcctReq(); |
| | | balanceAcctReq.setCusId(driverWith.getCusId()); |
| | | BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq); |
| | | List<BalanceAcctItem> balanceAccts = balanceAcctListResp.getBalanceAccts(); |
| | | for (BalanceAcctItem balanceAcct : balanceAccts) { |
| | | if(balanceAcct.getBalanceAcctId().equals(driverWith.getBalanceAcctId())){ |
| | | if(balanceAcct.getSettledAmount().doubleValue()==0){ |
| | | return ResultUtil.success(new BigDecimal(0)); |
| | | } |
| | | return ResultUtil.success(new BigDecimal(balanceAcct.getSettledAmount()).divide(new BigDecimal(100))); |
| | | } |
| | | } |
| | | } catch (UpyztException e) { |
| | | e.printStackTrace(); |
| | | System.out.println("用户获取可提现余额:"+e); |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | return ResultUtil.success(new BigDecimal(0)); |
| | | // try { |
| | | // BalanceAcctReq balanceAcctReq = new BalanceAcctReq(); |
| | | // balanceAcctReq.setCusId(driverWith.getCusId()); |
| | | // BalanceAcctListResp balanceAcctListResp = BalanceAcctExample.retrieveByUserId(balanceAcctReq); |
| | | // List<BalanceAcctItem> balanceAccts = balanceAcctListResp.getBalanceAccts(); |
| | | // for (BalanceAcctItem balanceAcct : balanceAccts) { |
| | | // if(balanceAcct.getBalanceAcctId().equals(driverWith.getBalanceAcctId())){ |
| | | // if(balanceAcct.getSettledAmount().doubleValue()==0){ |
| | | // return ResultUtil.success(new BigDecimal(0)); |
| | | // } |
| | | // return ResultUtil.success(new BigDecimal(balanceAcct.getSettledAmount()).divide(new BigDecimal(100))); |
| | | // } |
| | | // } |
| | | // } catch (UpyztException e) { |
| | | // e.printStackTrace(); |
| | | // System.out.println("用户获取可提现余额:"+e); |
| | | // return ResultUtil.error(e.getMessage()); |
| | | // } |
| | | return ResultUtil.success(new BigDecimal(0)); |
| | | } |
| | | |
| | | |
| | |
| | | }) |
| | | public ResultUtil uploadImg(MultipartFile multipartFile,HttpServletRequest request){ |
| | | try { |
| | | MediaResp mediaResp = MediaExample.uploadImage(multipartFile); |
| | | String pictureName = OssUploadUtil.ossUpload(request, multipartFile); |
| | | String mediaId = mediaResp.getMediaId(); |
| | | userService.insertImg(mediaId,pictureName); |
| | | return ResultUtil.success(mediaId); |
| | | // MediaResp mediaResp = MediaExample.uploadImage(multipartFile); |
| | | // String pictureName = OssUploadUtil.ossUpload(request, multipartFile); |
| | | // String mediaId = mediaResp.getMediaId(); |
| | | // userService.insertImg(mediaId,pictureName); |
| | | // return ResultUtil.success(mediaId); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | package com.stylefeng.guns.modular.account.server; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.account.model.ElectronicLedger; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | |
| | | public interface UserWithdrawalService extends IService<UserWithdrawal> { |
| | | AllocationReq createAllocationReq(String balanceAcctId, String balanceAcctId1, Integer amount,String password); |
| | | |
| | | WithdrawalReq createWithdrawalReq(String balanceAcctId, Integer amount, String password, String code); |
| | | |
| | | /** |
| | | * 用户提现 |
| | | * @param amount |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.dao.UserBankAccountMapper; |
| | | import com.stylefeng.guns.modular.account.dao.UserWithdrawalMapper; |
| | | import com.stylefeng.guns.modular.account.model.ElectronicLedger; |
| | | import com.stylefeng.guns.modular.account.server.ElectronicLedgerService; |
| | | import com.stylefeng.guns.modular.account.server.UserBankAccountService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.WithdrawalExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.WithdrawalReq; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.UserBankAccount; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import com.unionpay.upyzt.resp.CusApplicationResp; |
| | | import com.unionpay.upyzt.resp.WithdrawalResp; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ElectronicLedgerService electronicLedgerService; |
| | | |
| | | @Override |
| | | public AllocationReq createAllocationReq(String balanceAcctId, String companyBalanceAcctId, Integer amount,String password) { |
| | | AllocationReq allocationReq = new AllocationReq(); |
| | | allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setPayBalanceAcctId(companyBalanceAcctId); |
| | | allocationReq.setRecvBalanceAcctId(balanceAcctId); |
| | | allocationReq.setAmount(amount*100); |
| | | allocationReq.setOrderNo(ToolUtil.getRandomString(32)); |
| | | allocationReq.setPassword(password); |
| | | allocationReq.setOrderAmount(Long.valueOf(amount)); |
| | | allocationReq.setProductName("用户提现"); |
| | | allocationReq.setProductCount(1); |
| | | return allocationReq; |
| | | } |
| | | |
| | | @Override |
| | | public WithdrawalReq createWithdrawalReq(String balanceAcctId, Integer amount, String password, String code) { |
| | | WithdrawalReq withdrawalReq = new WithdrawalReq(); |
| | | withdrawalReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | withdrawalReq.setBalanceAcctId(balanceAcctId); |
| | | withdrawalReq.setAmount(amount*100); |
| | | withdrawalReq.setBankAcctNo(code); |
| | | withdrawalReq.setPassword(password); |
| | | return withdrawalReq; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean withdrawDeposit(Integer amount, String bankAcctNo, String password) { |
| | | // 查询当前操作电子用户 |
| | | UserWithdrawal userWithdrawal = this.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("userId", Objects.requireNonNull(ShiroKit.getUser()).getId()) |
| | | .eq("userType", 1) |
| | | .last("LIMIT 1")); |
| | | |
| | | |
| | | // 先从平台进行分账到用户电子账簿 |
| | | // 查询平台账户 |
| | | Company company = companyService.selectOne(new EntityWrapper<Company>() |
| | |
| | | .eq("userId", company.getId()) |
| | | .eq("userType", 3) |
| | | .last("LIMIT 1")); |
| | | try { |
| | | // 进行平台分账到用户电子账簿 |
| | | log.info("平台分账到用户电子账簿========="); |
| | | AllocationResp allocationResp = AllocationExample.create(this.createAllocationReq(userWithdrawal.getBalanceAcctId(), electronicLedger.getBalanceAcctId(), amount,password)); |
| | | log.info("平台分账到用户电子账簿完成=========:{}",allocationResp); |
| | | |
| | | // 用户电子账簿进行提现操作 |
| | | WithdrawalResp withdrawalResp = WithdrawalExample.create(this.createWithdrawalReq(userWithdrawal.getBalanceAcctId(), amount, password, bankAcctNo)); |
| | | log.info("用户电子账簿提现完成=========:{}",withdrawalResp); |
| | | return true; |
| | | }catch (Exception e){ |
| | | log.info("用户提现失败=========:{}",e.getMessage()); |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | // try { |
| | | // // 进行平台分账到用户电子账簿 |
| | | // log.info("平台分账到用户电子账簿========="); |
| | | // AllocationResp allocationResp = AllocationExample.create(this.createAllocationReq(userWithdrawal.getBalanceAcctId(), electronicLedger.getBalanceAcctId(), amount,password)); |
| | | // log.info("平台分账到用户电子账簿完成=========:{}",allocationResp); |
| | | // |
| | | // // 用户电子账簿进行提现操作 |
| | | // WithdrawalResp withdrawalResp = WithdrawalExample.create(this.createWithdrawalReq(userWithdrawal.getBalanceAcctId(), amount, password, bankAcctNo)); |
| | | // log.info("用户电子账簿提现完成=========:{}",withdrawalResp); |
| | | // return true; |
| | | // }catch (Exception e){ |
| | | // log.info("用户提现失败=========:{}",e.getMessage()); |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } |
| | | return true; |
| | | } |
| | | } |
| | |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | 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.cloudPayment.example.DepositExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.DepositResp; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; |
| | | import org.apache.shiro.crypto.hash.Md5Hash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.CharteredCar.server.IOrderCharteredCarService; |
| | | import com.stylefeng.guns.modular.account.model.TEnterpriseWithdrawal; |
| | | import com.stylefeng.guns.modular.account.server.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.call.server.IOrderCallService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.DepositExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import com.unionpay.upyzt.resp.DepositResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import sun.security.krb5.internal.crypto.Des; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IAdditionalFeeService additionalFeeService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITEnterpriseWithdrawalService enterpriseWithdrawalService; |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | private ICompanyService companyService; |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private SystemPriceMapper systemPriceMapper; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | /** |
| | | * 获取正在进行中的订单 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private SystemPriceMapper systemPriceMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的详情数据 |
| | | * @param orderId |
| | |
| | | } |
| | | orderList= orderPrivateCarService.queryOrderInfo2(orderId,6,null,null); |
| | | if(orderInfoWarpper.getState()>1 && orderInfoWarpper.getDriverId()!=0){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderInfoWarpper.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderInfoWarpper.getDriverId())); |
| | | if(value==null || value.equals("")){ |
| | | if(orderList.isEmpty()){ |
| | | orderList= orderPrivateCarService.queryOrderInfo2(orderId,5,"0","0"); |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.controller.AppOrderController; |
| | | import com.stylefeng.guns.modular.account.model.TEnterpriseWithdrawal; |
| | | import com.stylefeng.guns.modular.account.server.ITEnterpriseWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.DepositExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.util.PayMoneyUtil; |
| | | import com.unionpay.upyzt.resp.DepositResp; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public void cloudPay(Integer uid,String total_fee,String transaction_id,int type) { |
| | | if(type==1){ |
| | | BigDecimal divide = new BigDecimal(total_fee).divide(new BigDecimal(100)); |
| | | total_fee=divide.toString(); |
| | | } |
| | | System.out.println("回调参数:"+total_fee+"---"+transaction_id); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | UserWithdrawal driverWith = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", userInfo.getPhone()) |
| | | .last("LIMIT 1")); |
| | | DepositReq depositReq = new DepositReq(); |
| | | depositReq.setOutOrderNo(ToolUtil.getRandomString(32)); |
| | | depositReq.setTotalAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 总金额 |
| | | depositReq.setAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).intValue()); // 支付金额 |
| | | depositReq.setDiscountAmount(0); // 优惠金额 |
| | | depositReq.setBalanceAcctId(driverWith.getBalanceAcctId()); |
| | | depositReq.setDepositType("1"); |
| | | depositReq.setPaymentType(PaymentTypeEnum.CUP_APP.getCode()); |
| | | depositReq.setPaymentTradeNo(transaction_id); // 系统交易流水号 |
| | | depositReq.setPaymentSucceededAt(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(new Date())); |
| | | depositReq.setOrderNo(transaction_id); |
| | | depositReq.setOrderAmount(new BigDecimal(total_fee).multiply(new BigDecimal(100)).longValue()); |
| | | depositReq.setProductName("用户支付充值"); |
| | | depositReq.setProductCount(1); |
| | | try { |
| | | DepositResp depositResp = DepositExample.create(depositReq); |
| | | System.err.println(depositResp); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.constant.JwtConstants; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.DepositExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.DepositReq; |
| | | import com.stylefeng.guns.modular.enums.PaymentTypeEnum; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.DriverService; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ISmsrecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IVerifiedService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.VerifiedWarpper; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.DepositResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.codec.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.spec.IvParameterSpec; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.security.InvalidAlgorithmParameterException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.spec.AlgorithmParameterSpec; |
| | | import java.text.SimpleDateFormat; |
| | | import java.io.InputStream; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private ISmsrecordService smsrecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private WeChatUtil weChatUtil; |
| | |
| | | public ResultUtil freeze(Integer uid){ |
| | | try { |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | String value = redisUtil.getValue(userInfo.getPhone()); |
| | | redisUtil.remove(value); |
| | | redisUtil.remove(userInfo.getPhone()); |
| | | String value = (String) redisTemplate.opsForValue().get(userInfo.getPhone()); |
| | | redisTemplate.delete(value); |
| | | redisTemplate.delete(userInfo.getPhone()); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | String requestHeader = request.getHeader(JwtConstants.AUTH_HEADER); |
| | | requestHeader = requestHeader.substring(requestHeader.indexOf(" ") + 1); |
| | | String value = redisUtil.getValue("USER_" + uid); |
| | | String value = (String) redisTemplate.opsForValue().get("USER_" + uid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("match", requestHeader.equals(value) ? 1 : 2); |
| | | return ResultUtil.success(map); |
| | |
| | | userInfo.setState(2); |
| | | userInfoService.updateById(userInfo); |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("USER_" + uid); |
| | | if(ToolUtil.isNotEmpty(value)){//将另外设备上的强迫下线 |
| | | String value = (String) redisTemplate.opsForValue().get("USER_" + uid); |
| | | if(ToolUtil.isNotEmpty(value)) {//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | String key = redisUtil.getValue("USER_" + userInfo.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("USER_" + userInfo.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("USER_" + uid);//清除存储的token |
| | | String key = (String) redisTemplate.opsForValue().get("USER_" + userInfo.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("USER_" + userInfo.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("USER_" + uid);//清除存储的token |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | |
| | | import com.stylefeng.guns.modular.account.model.TBankNext; |
| | | import com.stylefeng.guns.modular.account.server.UserBankAccountService; |
| | | import com.stylefeng.guns.modular.account.server.UserWithdrawalService; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.CusApplicationExample; |
| | | import com.stylefeng.guns.modular.system.model.UserBankAccount; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.model.UserWithdrawal; |
| | |
| | | import com.stylefeng.guns.modular.system.service.IWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.WithdrawalWarpper; |
| | | import com.unionpay.upyzt.resp.CusApplicationResp; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | UserWithdrawal userWithdrawal = userWithdrawalService.selectOne(new EntityWrapper<UserWithdrawal>() |
| | | .eq("phone", userInfo.getPhone()) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(userWithdrawal)){ |
| | | if (Objects.isNull(userWithdrawal)) { |
| | | return ResultUtil.error("请先进行个人用户进件信息填写"); |
| | | } |
| | | TBankNext bankName1 = tBankNextMapper.selectList(new EntityWrapper<TBankNext>().eq("bankName", bankName)).get(0); |
| | |
| | | userWithdrawal.setBankCode(bankName1.getDrecCode()); |
| | | userWithdrawal.setBankBranchCode(bankName1.getBankCode()); |
| | | userWithdrawal.setCode(smsCode); |
| | | CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | System.err.println("修改个人用户进件信息返回"+renew); |
| | | if("succeeded".equals(renew.getApplicationStatus())){ |
| | | // 修改银行卡信息 |
| | | bankCard.setSettleAcctId(renew.getSettleAcctId()); |
| | | bankAccountService.updateById(bankCard); |
| | | |
| | | userWithdrawal.setBankCardCode(code); |
| | | userWithdrawal.setBankCode(bankCard.getBankCode()); |
| | | userWithdrawal.setBankBranchCode(bankCard.getBankBranchCode()); |
| | | userWithdrawal.setBankName(bankCard.getBankName()); |
| | | userWithdrawal.setSettleAcctId(renew.getSettleAcctId()); |
| | | userWithdrawal.setBalanceAcctId(renew.getBalanceAcctId()); |
| | | userWithdrawalService.updateById(userWithdrawal); |
| | | return withdrawalService.withdrawal(money, bankName, code, name, uid); |
| | | }else { |
| | | return ResultUtil.error(renew.getFailureMsgs().get(0).getReason()); |
| | | } |
| | | |
| | | |
| | | // CusApplicationResp renew = CusApplicationExample.renew(userWithdrawal); |
| | | // System.err.println("修改个人用户进件信息返回"+renew); |
| | | // if("succeeded".equals(renew.getApplicationStatus())){ |
| | | // // 修改银行卡信息 |
| | | // bankCard.setSettleAcctId(renew.getSettleAcctId()); |
| | | // bankAccountService.updateById(bankCard); |
| | | // |
| | | // userWithdrawal.setBankCardCode(code); |
| | | // userWithdrawal.setBankCode(bankCard.getBankCode()); |
| | | // userWithdrawal.setBankBranchCode(bankCard.getBankBranchCode()); |
| | | // userWithdrawal.setBankName(bankCard.getBankName()); |
| | | // userWithdrawal.setSettleAcctId(renew.getSettleAcctId()); |
| | | // userWithdrawal.setBalanceAcctId(renew.getBalanceAcctId()); |
| | | // userWithdrawalService.updateById(userWithdrawal); |
| | | // return withdrawalService.withdrawal(money, bankName, code, name, uid); |
| | | // }else { |
| | | // return ResultUtil.error(renew.getFailureMsgs().get(0).getReason()); |
| | | // } |
| | | |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.SystemException; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | |
| | |
| | | List<Map<String, Object>> s = lineSiteMapper.queryDriver(lineId, sdf.parse(day), driverId); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(sdf.parse(day)); |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import com.stylefeng.guns.modular.crossCity.dao.LinePriceMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineService; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.impl.OrderPrivateCarServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysIntegralMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.stylefeng.guns.modular.taxi.service.impl.OrderTaxiServiceImpl.orderIds; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | |
| | | map.put("startCity", geocode.get("city")); |
| | | geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString()); |
| | | map.put("endCity", geocode.get("city")); |
| | | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 3); |
| | | return map; |
| | |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderCrossCity.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderCrossCity.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | |
| | | @Override |
| | | public void run() { |
| | | List<Map<String, Integer>> datas = list; |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | |
| | | import com.stylefeng.guns.modular.account.controller.AppOrderController; |
| | | import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogisticsSpread; |
| | |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsSpreadService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | 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.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsSpreadService orderLogisticsSpreadService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RegionMapper regionMapper; |
| | |
| | | try { |
| | | Integer id = orderLogistics.getId(); |
| | | orderIds.add(orderLogistics.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = UpyztException.class,propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil payLogisticsOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type) throws Exception { |
| | | OrderLogistics orderLogistics = this.selectById(orderId); |
| | | if(orderLogistics.getState() != 7){ |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aliyun.oss.ServiceException; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import javafx.concurrent.Task; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(spellOrderRule.getContent()); |
| | | //判断时间 |
| | | if(travelTime.getTime()>=order.getTravelTime().getTime()-jsonObject.getInteger("num5")*60000L && travelTime.getTime()<=order.getTravelTime().getTime()+jsonObject.getInteger("num6")*60000L){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(order.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(order.getDriverId())); |
| | | // Double dis1 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 1).get("distance").toString()); |
| | | // Double dis2 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(), order.getEndLon() + "," + order.getEndLat(), 1).get("distance").toString()); |
| | | |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(spellOrderRule.getContent()); |
| | | //判断时间 |
| | | if(travelTime.getTime()>=order.getTravelTime().getTime()-jsonObject.getInteger("num5")*60000L && travelTime.getTime()<=order.getTravelTime().getTime()+jsonObject.getInteger("num6")*60000L){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(order.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(order.getDriverId())); |
| | | // Double dis1 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 1).get("distance").toString()); |
| | | // Double dis2 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(), order.getEndLon() + "," + order.getEndLat(), 1).get("distance").toString()); |
| | | |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(spellOrderRule.getContent()); |
| | | //判断时间 |
| | | if(orderPrivateCar.getTravelTime().getTime()>=order.getTravelTime().getTime()-jsonObject.getInteger("num5")*60000L && orderPrivateCar.getTravelTime().getTime()<=order.getTravelTime().getTime()+jsonObject.getInteger("num6")*60000L){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(order.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(order.getDriverId())); |
| | | // Double dis1 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 1).get("distance").toString()); |
| | | // Double dis2 = Double.valueOf(gdMapElectricFenceUtil.getDistance(orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(), order.getEndLon() + "," + order.getEndLat(), 1).get("distance").toString()); |
| | | // TODO: 2023/11/4 已改成计算直线距离 |
| | |
| | | CancleOrder query = cancleOrderService.query(orderPrivateCar.getOrderType(), 1, orderPrivateCar.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 推送抢单数据 |
| | | * @param orderPrivateCar |
| | | * @throws Exception |
| | | */ |
| | | public void pushOrder(OrderPrivateCar orderPrivateCar) throws Exception{ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Integer id = orderPrivateCar.getId(); |
| | | Integer orderType = orderPrivateCar.getRideType()==1?1:orderPrivateCar.getRideType()==2?9:8; |
| | | orderIds.add(orderPrivateCar.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | System.out.println("pushOrder:"+pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | | i2=1; |
| | | } |
| | | for (int i1 = 0; i1 < i2 ; i1++) { |
| | | if (orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderType, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | Thread.sleep(10000);//设置等待时间 |
| | | Integer state = orderPrivateCar.getState(); |
| | | if (state > 1) { |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | return; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer uid, Integer orderId) throws Exception { |
| | | Map<String, Object> map = orderPrivateCarMapper.queryOrderInfo(orderId); |
| | | if(null == map){ |
| | | OrderTaxi orderTaxi = orderTaxiService.selectOne(new EntityWrapper<OrderTaxi>() |
| | | .eq("userId", uid) |
| | | .eq("isDelete", 1) |
| | | .in("state", Arrays.asList(2, 3, 4, 5, 6, 7)) |
| | | ); |
| | | return orderTaxiService.queryOrderInfo(orderTaxi.getId()); |
| | | } |
| | | if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | orderPrivateCar.setReassignNotice(0); |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){ |
| | | map.put("redPacketMoney", null); |
| | | map.put("couponMoney", null); |
| | | } |
| | | |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 1); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(null == orderPrivateCar){ |
| | | return orderTaxiService.queryOrderServer(orderId, uid); |
| | | } |
| | | //计算预计距离和剩余时间 |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | | |
| | | public void pushOrder(Integer id, Integer rideType, Integer serverCarModelId, Double startLon, Double startLat) throws Exception{ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Integer orderType = rideType==1?1:rideType==2?9:8; |
| | | orderIds.add(id);//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(startLon.toString(), startLat.toString());//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | System.out.println("pushOrder:"+pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | | i2=1; |
| | | } |
| | | for (int i1 = 0; i1 < i2 ; i1++) { |
| | | if (orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderType, serverCarModelId, startLon, startLat, pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), id, 1, 1, pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | Thread.sleep(10000);//设置等待时间 |
| | | Integer state = orderPrivateCarMapper.selectById(orderPrivateCar.getId()).getState(); |
| | | if (state > 1) { |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | break; |
| | | } |
| | | if (i == querys.size()) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //调用获取轨迹中的数据 |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, 2); |
| | | if(list.size() > 0){ |
| | | Map<String, Object> map = list.get(list.size() - 1); |
| | | value = map.get("lon") + "," + map.get("lat"); |
| | | } |
| | | }).start(); |
| | | |
| | | } |
| | | |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderServerWarpper.setOrderType(1); |
| | | orderServerWarpper.setState(orderPrivateCar.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[0] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setReassignNotice(orderPrivateCar.getReassignNotice()); |
| | | if(orderPrivateCar.getState() == 2 || orderPrivateCar.getState() == 3){//前往预约地 |
| | | // TODO: 2023/11/4 无法修改 |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage(d); |
| | | orderServerWarpper.setReservationTime(t); |
| | | orderServerWarpper.setServedMileage("0"); |
| | | orderServerWarpper.setServedTime("0"); |
| | | orderServerWarpper.setLaveMileage("0"); |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderPrivateCar.getState() == 5 || orderPrivateCar.getState() == 6){//服务中 |
| | | // TODO: 2023/11/4 无法修改 |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | | orderServerWarpper.setServedMileage(String.valueOf((null == orderPrivateCar.getMileage() ? 0 : orderPrivateCar.getMileage()) / 1000)); |
| | | orderServerWarpper.setServedTime(Long.valueOf((new Date().getTime() - orderPrivateCar.getStartServiceTime().getTime()) / 60000).intValue() + ""); |
| | | orderServerWarpper.setLaveMileage(d); |
| | | orderServerWarpper.setLaveTime(t); |
| | | } |
| | | |
| | | return orderServerWarpper; |
| | | } |
| | | |
| | | |
| | |
| | | return orderPrivateCarMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> queryOrderInfo(Integer uid, Integer orderId) throws Exception { |
| | | Map<String, Object> map = orderPrivateCarMapper.queryOrderInfo(orderId); |
| | | if(null == map){ |
| | | OrderTaxi orderTaxi = orderTaxiService.selectOne(new EntityWrapper<OrderTaxi>() |
| | | .eq("userId", uid) |
| | | .eq("isDelete", 1) |
| | | .in("state", Arrays.asList(2, 3, 4, 5, 6, 7)) |
| | | ); |
| | | return orderTaxiService.queryOrderInfo(orderTaxi.getId()); |
| | | } |
| | | if(null != map.get("reassignNotice") && Integer.valueOf(String.valueOf(map.get("reassignNotice"))) == 2){//改派完成,重新获取了新的司机数据,开始修改数据防止继续调用 |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | orderPrivateCar.setReassignNotice(0); |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){ |
| | | map.put("redPacketMoney", null); |
| | | map.put("couponMoney", null); |
| | | } |
| | | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 1); |
| | | return map; |
| | | public void pushOrder(Integer id, Integer rideType, Integer serverCarModelId, Double startLon, Double startLat) throws Exception{ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Integer orderType = rideType==1?1:rideType==2?9:8; |
| | | orderIds.add(id);//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(startLon.toString(), startLat.toString());//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | System.out.println("pushOrder:"+pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | | i2=1; |
| | | } |
| | | for (int i1 = 0; i1 < i2 ; i1++) { |
| | | if (orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderType, serverCarModelId, startLon, startLat, pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), id, 1, 1, pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | Thread.sleep(10000);//设置等待时间 |
| | | Integer state = orderPrivateCarMapper.selectById(orderPrivateCar.getId()).getState(); |
| | | if (state > 1) { |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | break; |
| | | } |
| | | if (i == querys.size()) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return orderPrivateCarMapper.queryMyTravelRecord(uid); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * @param uid |
| | | * @return |
| | | * 推送抢单数据 |
| | | * @param orderPrivateCar |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(null == orderPrivateCar){ |
| | | return orderTaxiService.queryOrderServer(orderId, uid); |
| | | } |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | | //调用获取轨迹中的数据 |
| | | List<Map<String, Object>> list = orderPositionService.queryTrack(orderId, 2); |
| | | if(list.size() > 0){ |
| | | Map<String, Object> map = list.get(list.size() - 1); |
| | | value = map.get("lon") + "," + map.get("lat"); |
| | | public void pushOrder(OrderPrivateCar orderPrivateCar) throws Exception{ |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | Integer id = orderPrivateCar.getId(); |
| | | Integer orderType = orderPrivateCar.getRideType()==1?1:orderPrivateCar.getRideType()==2?9:8; |
| | | orderIds.add(orderPrivateCar.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0); |
| | | System.out.println("pushOrder:"+pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if(i2==0){ |
| | | i2=1; |
| | | } |
| | | for (int i1 = 0; i1 < i2 ; i1++) { |
| | | if (orderPrivateCar.getState() > 1) { |
| | | break; |
| | | } |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(orderType, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), pushOrder.getPushTime()); |
| | | } |
| | | } |
| | | Thread.sleep(10000);//设置等待时间 |
| | | Integer state = orderPrivateCar.getState(); |
| | | if (state > 1) { |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | return; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderPrivateCar.getId()); |
| | | orderServerWarpper.setOrderType(1); |
| | | orderServerWarpper.setState(orderPrivateCar.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[0] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setReassignNotice(orderPrivateCar.getReassignNotice()); |
| | | if(orderPrivateCar.getState() == 2 || orderPrivateCar.getState() == 3){//前往预约地 |
| | | // TODO: 2023/11/4 无法修改 |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage(d); |
| | | orderServerWarpper.setReservationTime(t); |
| | | orderServerWarpper.setServedMileage("0"); |
| | | orderServerWarpper.setServedTime("0"); |
| | | orderServerWarpper.setLaveMileage("0"); |
| | | orderServerWarpper.setLaveTime("0"); |
| | | } |
| | | if(orderPrivateCar.getState() == 5 || orderPrivateCar.getState() == 6){//服务中 |
| | | // TODO: 2023/11/4 无法修改 |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(value, orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(), 1); |
| | | String d = "0"; |
| | | String t = "0"; |
| | | if(null == distance){ |
| | | System.err.println("查询距离出错了"); |
| | | }else{ |
| | | d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString(); |
| | | t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + ""; |
| | | } |
| | | orderServerWarpper.setReservationMileage("0"); |
| | | orderServerWarpper.setReservationTime("0"); |
| | | orderServerWarpper.setServedMileage(String.valueOf((null == orderPrivateCar.getMileage() ? 0 : orderPrivateCar.getMileage()) / 1000)); |
| | | orderServerWarpper.setServedTime(Long.valueOf((new Date().getTime() - orderPrivateCar.getStartServiceTime().getTime()) / 60000).intValue() + ""); |
| | | orderServerWarpper.setLaveMileage(d); |
| | | orderServerWarpper.setLaveTime(t); |
| | | } |
| | | |
| | | return orderServerWarpper; |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.core.datascope.DataScope; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.unionpay.upyzt.resp.MediaResp; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.DriverMapper; |
| | | import com.stylefeng.guns.modular.system.dao.DriverServiceMapper; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.DriverService; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.GeodesyUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.BaseWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private DriverServiceMapper driverServiceMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | |
| | | List<Driver> drivers = driverMapper.queryIdleDriver(type, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | Map<String, Double> distance1 = geodesyUtil.getDistance(lon + "," + lat, value); |
| | | double d = Double.valueOf(distance1.get("WGS84")).doubleValue(); |
| | |
| | | List<Driver> drivers = driverMapper.queryIdleDriver_(type, serverCarModelId, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | Map<String, Double> distance1 = geodesyUtil.getDistance(lon + "," + lat, value); |
| | | double d = Double.valueOf(distance1.get("WGS84")).doubleValue(); |
| | |
| | | List<Driver> drivers = driverMapper.queryIdleDriver1(type, companyId); |
| | | List<Driver> list = new ArrayList<>(); |
| | | for(Driver driver : drivers){ |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driver.getId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driver.getId())); |
| | | if(null != value){ |
| | | Map<String, Double> distance1 = geodesyUtil.getDistance(lon + "," + lat, value); |
| | | double d = Double.valueOf(distance1.get("WGS84")).doubleValue(); |
| | |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.service.INettyService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.EndPushWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.OrderStatusWarpper; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | |
| | | } |
| | | return ResultUtil.success(endPushWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 获取服务中的订单数据 |
| | |
| | | |
| | | |
| | | //从redis中拿取最后的距离参数 |
| | | String value = redisUtil.getValue("DISTANCE:"+orderServerWarpper.getState()+":"+ orderId); |
| | | String value = (String) redisTemplate.opsForValue().get("DISTANCE:" + orderServerWarpper.getState() + ":" + orderId); |
| | | if (value==null){ |
| | | redisUtil.setStrValue("DISTANCE:" + orderId,reservationMileage); |
| | | redisTemplate.opsForValue().set("DISTANCE:" + orderId, reservationMileage); |
| | | String s = new BigDecimal(reservationMileage).setScale(2, RoundingMode.HALF_UP).toString(); |
| | | orderServerWarpper.setReservationMileage(s); |
| | | }else { |
| | | //最近的一次距离 |
| | | String recent = redisUtil.getValue("DISTANCE:"+orderServerWarpper.getState()+":"+orderId); |
| | | BigDecimal recentDecimal = new BigDecimal(recent).setScale(2, RoundingMode.HALF_UP); |
| | | String recent = (String) redisTemplate.opsForValue().get("DISTANCE:" + orderServerWarpper.getState() + ":" + orderId); |
| | | BigDecimal recentDecimal = new BigDecimal(recent).setScale(2, RoundingMode.HALF_UP); |
| | | BigDecimal bigDecimal = new BigDecimal(reservationMileage).setScale(2, RoundingMode.HALF_UP); |
| | | if (bigDecimal.compareTo(recentDecimal)<0){ |
| | | orderServerWarpper.setReservationMileage(bigDecimal.toString()); |
| | | redisUtil.setStrValue("DISTANCE:" +orderServerWarpper.getState()+":"+ orderId,reservationMileage); |
| | | orderServerWarpper.setReservationMileage(bigDecimal.toString()); |
| | | redisTemplate.opsForValue().set("DISTANCE:" + orderServerWarpper.getState() + ":" + orderId, reservationMileage); |
| | | }else { |
| | | orderServerWarpper.setReservationMileage(recentDecimal.toString()); |
| | | } |
| | |
| | | } |
| | | String reservationTime = orderServerWarpper.getReservationTime(); |
| | | if (reservationTime!=null){ |
| | | String value = redisUtil.getValue("TIME:"+orderServerWarpper.getState()+":"+ orderId); |
| | | String value = (String) redisTemplate.opsForValue().get("TIME:" + orderServerWarpper.getState() + ":" + orderId); |
| | | if (value==null){ |
| | | redisUtil.setStrValue("TIME:" + orderId,reservationTime); |
| | | redisTemplate.opsForValue().set("TIME:" + orderId, reservationTime); |
| | | String s = new BigDecimal(reservationTime).setScale(2, RoundingMode.HALF_UP).toString(); |
| | | orderServerWarpper.setReservationTime(s); |
| | | }else { |
| | | //最近的一次距离 |
| | | String recent = redisUtil.getValue("TIME:"+orderServerWarpper.getState()+":"+orderId); |
| | | BigDecimal recentDecimal = new BigDecimal(recent).setScale(2, RoundingMode.HALF_UP); |
| | | String recent = (String) redisTemplate.opsForValue().get("TIME:" + orderServerWarpper.getState() + ":" + orderId); |
| | | BigDecimal recentDecimal = new BigDecimal(recent).setScale(2, RoundingMode.HALF_UP); |
| | | BigDecimal bigDecimal = new BigDecimal(reservationTime).setScale(2, RoundingMode.HALF_UP); |
| | | if (bigDecimal.compareTo(recentDecimal)<0){ |
| | | orderServerWarpper.setReservationTime(bigDecimal.toString()); |
| | | redisUtil.setStrValue("TIME:" +orderServerWarpper.getState()+":"+ orderId,reservationTime); |
| | | orderServerWarpper.setReservationTime(bigDecimal.toString()); |
| | | redisTemplate.opsForValue().set("TIME:" + orderServerWarpper.getState() + ":" + orderId, reservationTime); |
| | | }else { |
| | | orderServerWarpper.setReservationTime(recentDecimal.toString()); |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.crypto.Cipher; |
| | |
| | | import java.security.spec.AlgorithmParameterSpec; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private UserActivityInviteMapper userActivityInviteMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | |
| | | templateCode = "SMS_154775431";//修改密码 |
| | | break; |
| | | } |
| | | String sData = aLiSendSms.sendSms(phone, "SMS_229715276", "{\"code\":\"" + authCode + "\"}"); |
| | | JSONObject jsonObject = JSON.parseObject(sData); |
| | | String message = jsonObject.getString("Message"); |
| | | if(!"OK".equals(message)){ |
| | | System.err.println(message); |
| | | return ResultUtil.error(message); |
| | | } |
| | | // String sData = aLiSendSms.sendSms(phone, "SMS_229715276", "{\"code\":\"" + authCode + "\"}"); |
| | | // JSONObject jsonObject = JSON.parseObject(sData); |
| | | // String message = jsonObject.getString("Message"); |
| | | // if(!"OK".equals(message)){ |
| | | // System.err.println(message); |
| | | // return ResultUtil.error(message); |
| | | // } |
| | | SMSUtil.sendVerifyCode(phone); |
| | | String sms = "短信验证码【" + authCode + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"; |
| | | //发送验证码短信 |
| | | redisUtil.setStrValue(phone, authCode, 5 * 60);//设置五分钟过期 |
| | | redisTemplate.opsForValue().set(phone, authCode, 5, TimeUnit.MINUTES);//设置五分钟过期 |
| | | System.out.println("【" + phone + "】" + sms); |
| | | return ResultUtil.success(); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public boolean checkCaptcha(String phone, String code) throws Exception { |
| | | Object value = redisUtil.getValue(phone); |
| | | Object value = redisTemplate.opsForValue().get(phone); |
| | | if("1234".equals(code)){ |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | if(type == 2){//小程序登录 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | JSONObject jsonObject = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | jsonObject = JSON.parseObject(value); |
| | |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userInfo.getId().toString(), userInfo.getAppletsOpenId()); |
| | | redisUtil.setStrValue("appletOpenId", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | |
| | | } |
| | | |
| | | if(type == 2){//小程序登录 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | JSONObject jsonObject = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | jsonObject = JSON.parseObject(value); |
| | |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userInfo.getId().toString(), userInfo.getAppletsOpenId()); |
| | | redisUtil.setStrValue("appletOpenId", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | |
| | | this.updateById(userInfo1); |
| | | |
| | | if(ToolUtil.isNotEmpty(loginType) && loginType.equals("Applets")){//小程序登录后绑定手机号码 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | JSONObject jsonObject = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | jsonObject = JSON.parseObject(value); |
| | |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userInfo1.getId().toString(), userInfo.getAppletsOpenId()); |
| | | redisUtil.setStrValue("appletOpenId", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | } |
| | | |
| | | |
| | |
| | | }else{ |
| | | key = requestHeader; |
| | | } |
| | | String value = redisUtil.getValue(key); |
| | | String value = (String) redisTemplate.opsForValue().get(key); |
| | | return null != value ? Integer.valueOf(value) : null; |
| | | }else{ |
| | | return null; |
| | |
| | | return ResultUtil.error("支付金额必须大于0元"); |
| | | } |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | String openid = map.get("openid"); |
| | | String unionid = map.get("unionid"); |
| | | //将当前小程序openid存储到缓存中用后面的支付时使用 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | JSONObject jsonObject = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | jsonObject = JSON.parseObject(value); |
| | |
| | | jsonObject = new JSONObject(); |
| | | } |
| | | jsonObject.put(userId.toString(), openid); |
| | | redisUtil.setStrValue("appletOpenId", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("appletOpenId", jsonObject.toJSONString()); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | return "JYX" + String.valueOf(num).substring(1); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取token |
| | | * @param userInfo |
| | | * @param password |
| | | * @return |
| | | * 单点登录 |
| | | * @param id |
| | | */ |
| | | private String getToken(UserInfo userInfo, String password,String type) throws Exception{ |
| | | private void singlePointLogin(Integer id,String type) throws Exception{ |
| | | if(ToolUtil.isEmpty(type))type="APP"; |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(userInfo.getPhone(), password.toCharArray()); |
| | | String credentials = userInfo.getPassWord(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(userInfo.getId())); |
| | | redisUtil.setStrValue(s.substring(s.length() - 32), String.valueOf(userInfo.getId()), 180 * 24 * 60 * 60); |
| | | redisUtil.setStrValue("USER_"+type+"_" + userInfo.getPhone(), s.substring(s.length() - 32)); |
| | | redisUtil.setStrValue("USER_"+type +"_"+ userInfo.getId(), s); |
| | | return s; |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = (String) redisTemplate.opsForValue().get("USER_" + type + "_" + id); |
| | | if(ToolUtil.isNotEmpty(value)) {//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | UserInfo userInfo = userInfoMapper.selectById(id); |
| | | String key = (String) redisTemplate.opsForValue().get("USER_" + type + "_" + userInfo.getPhone()); |
| | | redisTemplate.delete(key);//删除个人信息数据 |
| | | redisTemplate.delete("USER_" + type + "_" + userInfo.getPhone());//删除后台冻结相关缓存 |
| | | redisTemplate.delete("USER_" + type + "_" + id);//清除存储的token |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 单点登录 |
| | | * @param id |
| | | * 获取token |
| | | * @param userInfo |
| | | * @param password |
| | | * @return |
| | | */ |
| | | private void singlePointLogin(Integer id,String type) throws Exception{ |
| | | private String getToken(UserInfo userInfo, String password,String type) throws Exception{ |
| | | if(ToolUtil.isEmpty(type))type="APP"; |
| | | //开始验证当前账号是否在别处登录 |
| | | String value = redisUtil.getValue("USER_"+type+"_" + id); |
| | | if(ToolUtil.isNotEmpty(value)){//将另外设备上的强迫下线 |
| | | //开始清除redis中无效的数据 |
| | | UserInfo userInfo = userInfoMapper.selectById(id); |
| | | String key = redisUtil.getValue("USER_"+type+"_" + userInfo.getPhone()); |
| | | redisUtil.remove(key);//删除个人信息数据 |
| | | redisUtil.remove("USER_"+type+"_" + userInfo.getPhone());//删除后台冻结相关缓存 |
| | | redisUtil.remove("USER_"+type+"_" + id);//清除存储的token |
| | | } |
| | | //封装请求账号密码为shiro可验证的token |
| | | UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(userInfo.getPhone(), password.toCharArray()); |
| | | String credentials = userInfo.getPassWord(); |
| | | ByteSource credentialsSalt = new Md5Hash(salt); |
| | | SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo( |
| | | new ShiroUser(), credentials, credentialsSalt, ""); |
| | | |
| | | //校验用户账号密码 |
| | | HashedCredentialsMatcher md5CredentialsMatcher = new HashedCredentialsMatcher(); |
| | | md5CredentialsMatcher.setHashAlgorithmName(ShiroKit.hashAlgorithmName); |
| | | md5CredentialsMatcher.setHashIterations(ShiroKit.hashIterations); |
| | | boolean passwordTrueFlag = md5CredentialsMatcher.doCredentialsMatch( |
| | | usernamePasswordToken, simpleAuthenticationInfo); |
| | | String s = JwtTokenUtil.generateToken(String.valueOf(userInfo.getId())); |
| | | redisTemplate.opsForValue().set(s.substring(s.length() - 32), String.valueOf(userInfo.getId()), 180, TimeUnit.DAYS); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getPhone(), s.substring(s.length() - 32)); |
| | | redisTemplate.opsForValue().set("USER_" + type + "_" + userInfo.getId(), s); |
| | | return s; |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.UserMerchantCouponMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.MerchantCouponListWarpper; |
| | |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | |
| | | |
| | | @Autowired |
| | | private IUserInfoService userInfoService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public synchronized List<MerchantCouponListWarpper> getMerchantCoupon(Integer uid) throws Exception { |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | String value = redisUtil.getValue("merchantVoucher"); |
| | | String value = (String) redisTemplate.opsForValue().get("merchantVoucher"); |
| | | List<MerchantCouponListWarpper> listWarppers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | listWarppers = jsonArray.toJavaList(MerchantCouponListWarpper.class); |
| | | } |
| | | jsonObject.put(userInfo.getPhone(), new JSONArray()); |
| | | redisUtil.setStrValue("merchantVoucher", jsonObject.toJSONString()); |
| | | redisTemplate.opsForValue().set("merchantVoucher", jsonObject.toJSONString()); |
| | | } |
| | | |
| | | return listWarppers; |
| | |
| | | // 设置鉴权参数,初始化客户端 |
| | | private DefaultProfile profile = DefaultProfile.getProfile( |
| | | "cn-hangzhou",// 地域ID |
| | | "LTAI5tCeHnZXREQBcVf3NHLB",// 您的AccessKey ID |
| | | "OEX6AtRb3qOCyp53xOFdDEYgBjzZzS");// 您的AccessKey Secret |
| | | "111",// 您的AccessKey ID |
| | | "111");// 您的AccessKey Secret |
| | | private IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | private static void log_print(String functionName, Object result) { |
| | |
| | | // 接收短信的手机号码 |
| | | request.putQueryParameter("PhoneNumbers", phone); |
| | | // 短信签名名称。请在控制台签名管理页面签名名称一列查看(必须是已添加、并通过审核的短信签名)。 |
| | | request.putQueryParameter("SignName", "嘉易行"); |
| | | request.putQueryParameter("SignName", "黔云通"); |
| | | // 短信模板ID |
| | | request.putQueryParameter("TemplateCode", templateCode); |
| | | // 短信模板变量对应的实际值,JSON格式。 |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.aliyun.dyplsapi20170525.models.*; |
| | | import com.aliyun.teaopenapi.models.*; |
| | | import com.aliyun.dyplsapi20170525.models.BindAxbRequest; |
| | | import com.aliyun.dyplsapi20170525.models.BindAxbResponse; |
| | | import com.aliyun.dyplsapi20170525.models.UnbindSubscriptionRequest; |
| | | import com.aliyun.dyplsapi20170525.models.UnbindSubscriptionResponse; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | |
| | | @Component |
| | | public class ChinaMobileUtil { |
| | | |
| | | private String accessKeyId = "LTAI5tCeHnZXREQBcVf3NHLB"; |
| | | |
| | | private String accessKeySecret = "OEX6AtRb3qOCyp53xOFdDEYgBjzZzS"; |
| | | |
| | | private String poolKey = "FC100000145494178";//号码池KEY |
| | | private String accessKeyId = "111"; |
| | | |
| | | private String accessKeySecret = "111"; |
| | | |
| | | private String poolKey = "111";//号码池KEY |
| | | |
| | | |
| | | |
| | |
| | | @Component |
| | | public class GDFalconUtil implements ApplicationRunner { |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | //import com.stylefeng.guns.modular.system.model.GDFence; |
| | | //import com.stylefeng.guns.modular.system.service.IGDFenceService; |
| | | import com.stylefeng.guns.modular.system.service.IGDInterfaceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | |
| | | @Autowired |
| | | private IGDInterfaceService gdInterfaceService; |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | private JSONArray jsonArray = new JSONArray(); |
| | | |
| | |
| | | @Component |
| | | public class GDMapGeocodingUtil { |
| | | |
| | | private String key = "ba2915f8d8c1428df72e964a5f94f167"; |
| | | private String key = "ea7326a77175aba0e9435859b17bca36"; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("id", userId); |
| | | data.put("type", 1); |
| | | String str = redisUtil.getValue(orderId + "_" + orderType); |
| | | String str = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType); |
| | | if(ToolUtil.isEmpty(str)){ |
| | | redisUtil.setStrValue(orderId + "_" + orderType, data.toJSONString()); |
| | | redisTemplate.opsForValue().set(orderId + "_" + orderType, data.toJSONString()); |
| | | createTask(orderId, orderType); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driverId)); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driverId)); |
| | | if(null == value || "".equals(value)){ |
| | | return; |
| | | } |
| | |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | String value1 = redisUtil.getValue(orderId + "_" + orderType); |
| | | String value1 = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | this.removeTask(orderId, orderType); |
| | | return; |
| | |
| | | if (null != timer){ |
| | | timer.cancel(); |
| | | taskMap.remove(orderId + "_" + orderType); |
| | | redisUtil.remove(orderId + "_" + orderType); |
| | | redisTemplate.delete(orderId + "_" + orderType); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.account.controller.AppOrderController; |
| | | import com.stylefeng.guns.modular.account.util.Base64Util; |
| | | import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; |
| | | import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserMerchantCouponService; |
| | | import com.stylefeng.guns.modular.system.service.IUserTaxiCardService; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.unionpay.upyzt.exception.UpyztException; |
| | | import com.unionpay.upyzt.resp.AllocationResp; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void taskDay(){ |
| | | try { |
| | | List<Integer> integers = Arrays.asList(8, 9, 10, 12); |
| | | // 获取快车的已完成订单 |
| | | List<OrderPrivateCar> status = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().in("state", integers)); |
| | | for (OrderPrivateCar orderPrivateCar : status) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(),orderPrivateCar.getTelX(),10000l); |
| | | } |
| | | |
| | | // 获取出租车订单 |
| | | List<OrderTaxi> status1 = orderTaxiService.selectList(new EntityWrapper<OrderTaxi>().in("state", integers)); |
| | | for (OrderTaxi orderTaxi : status1) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderTaxi.getBindId(),orderTaxi.getTelX(),10000l); |
| | | } |
| | | |
| | | // 获取跨城出行订单 |
| | | List<OrderCrossCity> status2 = orderCrossCityService.selectList(new EntityWrapper<OrderCrossCity>().eq("state", integers)); |
| | | for (OrderCrossCity orderCrossCity : status2) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(),orderCrossCity.getTelX(),10000l); |
| | | } |
| | | |
| | | // 获取小件物流订单 |
| | | List<OrderLogistics> status3 = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("state", Arrays.asList(6,10))); |
| | | for (OrderLogistics orderLogistics : status3) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX(),10000l); |
| | | chinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindIdOne(),orderLogistics.getTelXOne(),10000l); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 企业员工工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:17 |
| | | */ |
| | | @Slf4j |
| | | public class EmployeeUtil { |
| | | |
| | | |
| | | /** |
| | | * 企业增加员工 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static SaveStaffNode saveStaffNode(SaveStaffNodeRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/saveStaffNode"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【企业增加员工】请求地址:" + url); |
| | | log.info("【企业增加员工】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【企业增加员工】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【企业增加员工】请求失败:" + result); |
| | | throw new RuntimeException("【企业增加员工】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【企业增加员工】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【企业增加员工】失败:" + object.toJSONString()); |
| | | } |
| | | SaveStaffNode saveStaffNode = jsonObject.getObject("object", SaveStaffNode.class); |
| | | return saveStaffNode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 企业修改员工信息 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static Boolean editStaffNode(EditStaffNodeRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/editStaffNode"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【企业修改员工信息】请求地址:" + url); |
| | | log.info("【企业修改员工信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【企业修改员工信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【企业修改员工信息】请求失败:" + result); |
| | | throw new RuntimeException("【企业修改员工信息】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【企业修改员工信息】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【企业修改员工信息】失败:" + object.toJSONString()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 企业删除人员 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static Boolean ecrmDeleteStafNode(DeleteStafNodeRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/ecrmDeleteStafNode"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | String content = "";//业务参数 |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【企业删除人员】请求地址:" + url); |
| | | log.info("【企业删除人员】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【企业删除人员】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【企业删除人员】请求失败:" + result); |
| | | throw new RuntimeException("【企业删除人员】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【企业删除人员】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【企业删除人员】失败:" + object.toJSONString()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据员工ID获取人员信息 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static StaffNodeInfo getStaffNode(GetStaffNodeRequest request){ |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/getStaffNode"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【根据员工ID获取人员信息】请求地址:" + url); |
| | | log.info("【根据员工ID获取人员信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据员工ID获取人员信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据员工ID获取人员信息】请求失败:" + result); |
| | | throw new RuntimeException("【根据员工ID获取人员信息】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据员工ID获取人员信息】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据员工ID获取人员信息】失败:" + object.toJSONString()); |
| | | } |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 企业工具类 |
| | | * |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 17:06 |
| | | */ |
| | | @Slf4j |
| | | public class EnterpriseUtil { |
| | | |
| | | |
| | | /** |
| | | * 根据社会信用代码判断企业是否已存在 |
| | | * |
| | | * @param uscc |
| | | * @return |
| | | */ |
| | | public static CheckEnterExist checkEnterExistByEnterIdCardNo(String uscc) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/check_enter_exist_by_enterIdCardNo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", "{\"uscc\":\"" + uscc + "\"}"); |
| | | log.info("【根据社会信用代码判断企业是否已存在】请求地址:" + url); |
| | | log.info("【根据社会信用代码判断企业是否已存在】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, map); |
| | | log.info("【根据社会信用代码判断企业是否已存在】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据社会信用代码判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据社会信用代码判断企业是否已存在】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据社会信用代码判断企业是否已存在】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据社会信用代码判断企业是否已存在】失败:" + object.toJSONString()); |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据企业名称判断企业是否已存在 |
| | | * |
| | | * @param enterName |
| | | * @return |
| | | */ |
| | | public static CheckEnterExist checkEnterNameExist(String enterName) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/checkEnterNameExist"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", "{\"enterName\":\"" + enterName + "\"}"); |
| | | log.info("【根据企业名称判断企业是否已存在】请求地址:" + url); |
| | | log.info("【根据企业名称判断企业是否已存在】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, map); |
| | | log.info("【根据企业名称判断企业是否已存在】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据企业名称判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据企业名称判断企业是否已存在】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据企业名称判断企业是否已存在】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据企业名称判断企业是否已存在】失败:" + object.toJSONString()); |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询企业详情 |
| | | * |
| | | * @param enter_code 企业编号 |
| | | * @return |
| | | */ |
| | | public static EnterpriseInfo getEnterpriseDetail(String enter_code) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/getEnterpriseDetail"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", "{\"enter_code\":\"" + enter_code + "\"}"); |
| | | log.info("【查询企业详情】请求地址:" + url); |
| | | log.info("【查询企业详情】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, map); |
| | | log.info("【查询企业详情】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【查询企业详情】请求失败:" + result); |
| | | throw new RuntimeException("【查询企业详情】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【查询企业详情】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【查询企业详情】失败:" + object.toJSONString()); |
| | | } |
| | | EnterpriseInfo enterpriseInfo = jsonObject.getObject("object", EnterpriseInfo.class); |
| | | return enterpriseInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改企业基本信息 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static Boolean modifyEnterpriseInfo(ModifyEnterpriseInfoRequest request) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/modifyEnterpriseInfo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", new Gson().toJson(request)); |
| | | log.info("【修改企业基本信息】请求地址:" + url); |
| | | log.info("【修改企业基本信息】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, map); |
| | | log.info("【修改企业基本信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String status = jsonObject.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【修改企业基本信息】请求失败:" + result); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建企业 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static CreateEnterprise createEnterprise(CreateEnterpriseRequest request) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/createEnterprise"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | String content = "";//业务参数 |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | map.put(SystemParameterNames.getAppKey(), appKey); |
| | | map.put(SystemParameterNames.getMessage_id(), messageId); |
| | | map.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | map.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | map.put("content", new Gson().toJson(request)); |
| | | |
| | | log.info("【创建企业】请求地址:" + url); |
| | | log.info("【创建企业】请求参数:" + JSON.toJSONString(map)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, map); |
| | | log.info("【创建企业】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | } |
| | | return object.getObject("data", CreateEnterprise.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | /** |
| | | * 黔云通配置 |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 15:03 |
| | | */ |
| | | public interface QianYunTongProperties { |
| | | /** |
| | | * appkey |
| | | */ |
| | | String appkey = "10001104"; |
| | | /** |
| | | * 私钥地址 |
| | | */ |
| | | String privateKeyPath = "E:\\IDEA Workspaces\\QianYunTong\\private_key_test.pem"; |
| | | /** |
| | | * 消费者账号 |
| | | */ |
| | | String userName = "xiaofei"; |
| | | /** |
| | | * 状态 |
| | | * 1:生产环境 |
| | | * 2:测试环境 |
| | | */ |
| | | String status = "1"; |
| | | /** |
| | | * API地址 |
| | | */ |
| | | String apiUrl = "https://test-zhongtai.stqcloud.com:10070"; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * 短信工具类 |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/10 10:48 |
| | | */ |
| | | @Slf4j |
| | | public class SMSUtil { |
| | | |
| | | |
| | | /** |
| | | * 获取易信验证码 |
| | | * @param mobile |
| | | * @return |
| | | */ |
| | | public static String sendVerifyCode(String mobile) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/sendVerifyCode"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", "{\"mobile\":\"" + mobile + "\"}"); |
| | | log.info("【获取易信验证码】请求地址:" + url); |
| | | log.info("【获取易信验证码】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【获取易信验证码】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【获取易信验证码】请求失败:" + result); |
| | | throw new RuntimeException("【获取易信验证码】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【获取易信验证码】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【获取易信验证码】失败:" + object.toJSONString()); |
| | | } |
| | | return object.getString("code"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 用户工具类 |
| | | * |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 14:47 |
| | | */ |
| | | @Slf4j |
| | | public class UserUtil { |
| | | |
| | | |
| | | /** |
| | | * 根据手机号码获取人员信息 |
| | | * |
| | | * @param mobile 手机号码 |
| | | * @param enterNum 企业编号 |
| | | */ |
| | | public static List<QYTUserInfo> getUserInfoByPhone(String mobile, String enterNum) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/getUserInfoByPhone"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", "{\"mobile\":\"" + mobile + "\",\"enterNum\":\"" + enterNum + "\"}"); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求地址:" + url); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | } |
| | | JSONArray data = object.getJSONArray("data"); |
| | | List<QYTUserInfo> list = new ArrayList<>(); |
| | | for (int i = 0; i < data.size(); i++) { |
| | | data.getJSONObject(i).getString("enter_code"); |
| | | QYTUserInfo userInfo = data.getObject(i, QYTUserInfo.class); |
| | | list.add(userInfo); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据手机号注册用户 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static RegisterViaMobile registerViaMobile(RegisterViaMobileRequest request) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/m1_register_via_mobile"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【根据手机号注册用户】请求地址:" + url); |
| | | log.info("【根据手机号注册用户】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据手机号注册用户】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据手机号注册用户】请求失败:" + result); |
| | | throw new RuntimeException("【根据手机号注册用户】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号注册用户】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据手机号注册用户】失败:" + object.toJSONString()); |
| | | } |
| | | return jsonObject.getObject("object", RegisterViaMobile.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 易信用户修改密码 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static Boolean modifyPwd(ModifyPwdRequest request) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/modifyPwd"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【易信用户修改密码】请求地址:" + url); |
| | | log.info("【易信用户修改密码】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【易信用户修改密码】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【易信用户修改密码】请求失败:" + result); |
| | | throw new RuntimeException("【易信用户修改密码】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【易信用户修改密码】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【易信用户】失败:" + object.toJSONString()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 易信重置密码 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static Boolean resetPwd(ResetPwdRequest request) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/resetPwd"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = QianYunTongProperties.appkey;//appkey |
| | | Map<String, String> headers = new HashMap<>(); |
| | | headers.put("Content-Type", "application/json"); |
| | | Map<String, Object> contentMap = new HashMap<String, Object>(); |
| | | Date nowdate = new Date(); |
| | | SimpleDateFormat date = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), QianYunTongProperties.userName); |
| | | contentMap.put(SystemParameterNames.getStatus(), QianYunTongProperties.status); |
| | | contentMap.put("content", new Gson().toJson(request)); |
| | | log.info("【易信重置密码】请求地址:" + url); |
| | | log.info("【易信重置密码】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【易信重置密码】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【易信重置密码】请求失败:" + result); |
| | | throw new RuntimeException("【易信重置密码】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【易信重置密码】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【易信重置密码】失败:" + object.toJSONString()); |
| | | } |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 18:12 |
| | | */ |
| | | @Data |
| | | public class CheckEnterExist { |
| | | /** |
| | | * 企业ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 是否在公有云注册,1:已注册;0:未注册 |
| | | */ |
| | | private String isReg; |
| | | /** |
| | | * 创建者手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private String createTime; |
| | | /** |
| | | * 法人姓名 |
| | | */ |
| | | private String larName; |
| | | /** |
| | | * 企业编码 |
| | | */ |
| | | private String enterCode; |
| | | /** |
| | | * 认证状态 |
| | | * 0:已认证;1:未认证,初始状态;2:认证不通过;3:认证中 |
| | | */ |
| | | private Integer auth; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/9 19:43 |
| | | */ |
| | | @Data |
| | | public class CreateEnterprise { |
| | | /** |
| | | * 企业ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 开通易信状态 |
| | | * 0:成功 1:失败 |
| | | */ |
| | | private String callYixinApi; |
| | | /** |
| | | * 开通办公门户状态 |
| | | * 0:成功 1:失败 |
| | | */ |
| | | private String callItdSaveCompany; |
| | | /** |
| | | * 开通企业官网状态 |
| | | * 0:成功 1:失败 |
| | | */ |
| | | private String callItdDredgeWebsite; |
| | | /** |
| | | * 电话号码 |
| | | */ |
| | | private String phone; |
| | | /** |
| | | * 企业idcode |
| | | */ |
| | | private String idCode; |
| | | /** |
| | | * 企业节点ID |
| | | */ |
| | | private String noteId; |
| | | /** |
| | | * 是否新注册企业 |
| | | */ |
| | | private String isNew; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/9 18:20 |
| | | */ |
| | | @Data |
| | | public class CreateEnterpriseRequest { |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 企业简称/昵称 |
| | | */ |
| | | private String nickName; |
| | | /** |
| | | * 行业编码 |
| | | */ |
| | | private String industry_code; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | | private String area; |
| | | /** |
| | | * 企业地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 二级域名 |
| | | */ |
| | | private String secondRealmName; |
| | | /** |
| | | * 企业密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 一级行业分类描述 |
| | | */ |
| | | private String industry_level1; |
| | | /** |
| | | * 二级行业分类描述 |
| | | */ |
| | | private String industry_level2; |
| | | /** |
| | | * 企业来源编码 |
| | | */ |
| | | private String sourceCode; |
| | | /** |
| | | * 企业分类编码 |
| | | */ |
| | | private String typeCode; |
| | | /** |
| | | * 代理商id |
| | | */ |
| | | private String elecsId; |
| | | /** |
| | | * 是否发送短信 |
| | | * 0:不发送,1:发送 |
| | | */ |
| | | private String smsFlag; |
| | | /** |
| | | * 是否激活 |
| | | * 1:激活;0:未激活 |
| | | */ |
| | | private String mobileFlag; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 邮箱是否激活 |
| | | * 1:激活;0:未激活 |
| | | */ |
| | | private String emailFlag; |
| | | /** |
| | | * 是否同步通讯录 |
| | | */ |
| | | private String contact_source; |
| | | /** |
| | | * 所属行业通用编码 |
| | | */ |
| | | private String trade_code; |
| | | /** |
| | | * 营业执照扫描件url |
| | | */ |
| | | private String operScanPic; |
| | | /** |
| | | * 运营人员姓名 |
| | | */ |
| | | private String idcardName; |
| | | /** |
| | | * 运营者身份证号码 |
| | | */ |
| | | private String idcardNum; |
| | | /** |
| | | * 运营者身份证照片url |
| | | */ |
| | | private String idcardPic; |
| | | /** |
| | | * 企业工号 |
| | | */ |
| | | private String enterID; |
| | | /** |
| | | * 推荐人 |
| | | */ |
| | | private String recommender; |
| | | /** |
| | | * 创建者姓名 |
| | | */ |
| | | private String creatorName; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:39 |
| | | */ |
| | | @Data |
| | | public class DeleteStafNodeRequest { |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Long empId; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 企业编号 |
| | | */ |
| | | private String entercode; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:32 |
| | | */ |
| | | @Data |
| | | public class EditStaffNodeRequest { |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Integer empId; |
| | | /** |
| | | * 操作人手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 操作人企业ID |
| | | */ |
| | | private String entercode; |
| | | /** |
| | | * 企业ID |
| | | */ |
| | | private Long enterId; |
| | | /** |
| | | * 人员显示名 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 人员显示名 |
| | | */ |
| | | private String empNickname; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | private String mphone; |
| | | /** |
| | | * 登录账号 |
| | | */ |
| | | private String loginNo; |
| | | /** |
| | | * 人员性别(男\女) |
| | | */ |
| | | private String empSex; |
| | | /** |
| | | * 人员邮箱 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 员工所属部门ID多个部门英文; 分割 |
| | | */ |
| | | private Integer deptId; |
| | | /** |
| | | * 员工职务ID |
| | | */ |
| | | private Integer positionId; |
| | | /** |
| | | * 员工职务名称,如不知道ID可以直接传入名称 |
| | | */ |
| | | private String positionName; |
| | | /** |
| | | * 高管模式 1 是 0 不是 |
| | | */ |
| | | private Integer superLevel; |
| | | /** |
| | | * 隐藏号码 1 是 0 不是 |
| | | */ |
| | | private Integer hideMobile; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 17:14 |
| | | */ |
| | | @Data |
| | | public class EnterpriseInfo { |
| | | /** |
| | | * 企业ID |
| | | */ |
| | | private String id; |
| | | /** |
| | | * 企业编号 |
| | | */ |
| | | private String enter_code; |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String enter_name; |
| | | /** |
| | | * 是否是全员号码可见,0:是,1:否 |
| | | */ |
| | | private String visible; |
| | | /** |
| | | * 认证状态,0:已认证;1:未认证,初始状态;2:认证不通过;3:认证中 |
| | | */ |
| | | private String auth; |
| | | /** |
| | | * 认证时间 |
| | | */ |
| | | private String auth_time; |
| | | /** |
| | | * 认证注释 |
| | | */ |
| | | private String authRemark; |
| | | /** |
| | | * 运营者姓名(委托人) |
| | | */ |
| | | private String idcard_name; |
| | | /** |
| | | * 运营者证件号 |
| | | */ |
| | | private String idcard_num; |
| | | /** |
| | | * 运营者证件扫描件URL |
| | | */ |
| | | private String idcard_pic; |
| | | /** |
| | | * 统一社会信用代码 |
| | | */ |
| | | private String uscc; |
| | | /** |
| | | * 法人姓名 |
| | | */ |
| | | private String larName; |
| | | /** |
| | | * 法人电话 |
| | | */ |
| | | private String larPhone; |
| | | /** |
| | | * 法人身份证 |
| | | */ |
| | | private String larIdCard; |
| | | /** |
| | | * 法人身份证扫描件URL |
| | | */ |
| | | private String larIdCardPic; |
| | | /** |
| | | * 发票名称 |
| | | */ |
| | | private String invoiceName; |
| | | /** |
| | | * 纳税人识别号(发票) |
| | | */ |
| | | private String invoiceTIN; |
| | | /** |
| | | * 开户行名称(发票) |
| | | */ |
| | | private String invoiceBankersName; |
| | | /** |
| | | * 开户行账号(发票) |
| | | */ |
| | | private String invoiceBankersAccount; |
| | | /** |
| | | * 资质机构名称 |
| | | */ |
| | | private String qualificationOrgName; |
| | | /** |
| | | * 资质注册号/登记号 |
| | | */ |
| | | private String qualificationRegNum; |
| | | /** |
| | | * 资质有效开始时间 |
| | | */ |
| | | private String qualificationStartTime; |
| | | /** |
| | | * 资质有效结束时间 |
| | | */ |
| | | private String qualificationEndTime; |
| | | /** |
| | | * 资格证书扫描件URL |
| | | */ |
| | | private String qualificationCertUrl; |
| | | /** |
| | | * 省份编码 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 地市编码 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 区县编码 |
| | | */ |
| | | private String areaCode; |
| | | /** |
| | | * 乡镇编码 |
| | | */ |
| | | private String townshipCode; |
| | | /** |
| | | * 企业创建时间 |
| | | */ |
| | | private String enter_createdate; |
| | | /** |
| | | * 地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 营业期开始时间,格式:yyyy-MM-dd HH:mm:ss |
| | | */ |
| | | private String businessTermStartTime; |
| | | /** |
| | | * 营业期结束时间,格式:yyyy-MM-dd HH:mm:ss |
| | | */ |
| | | private String businessTermEndTime; |
| | | /** |
| | | * 企业规模 |
| | | */ |
| | | private String enterScale; |
| | | /** |
| | | * 创建者职位 |
| | | */ |
| | | private String creatorPosition; |
| | | /** |
| | | * 企业备注/介绍 |
| | | */ |
| | | private String enterRemark; |
| | | /** |
| | | * 企业logo |
| | | */ |
| | | private String enterLogo; |
| | | /** |
| | | * 企业邮箱 |
| | | */ |
| | | private String enterEmail; |
| | | /** |
| | | * 企业联系电话rg_company_info.enter_tel |
| | | */ |
| | | private String enterTel; |
| | | /** |
| | | * 一级行业分类编码 |
| | | */ |
| | | private String industryStr; |
| | | /** |
| | | * 二级行业分类编码 |
| | | */ |
| | | private String industryStr2; |
| | | /** |
| | | * 企业联系人姓名 |
| | | */ |
| | | private String enterLinkman; |
| | | /** |
| | | * 营业执照扫描件ur |
| | | */ |
| | | private String operScanPic; |
| | | /** |
| | | * 身份证有效期 |
| | | */ |
| | | private String larIdCardValidity; |
| | | /** |
| | | * 经营地址 |
| | | */ |
| | | private String operationAddress; |
| | | /** |
| | | * 法人身份证背面照片 |
| | | */ |
| | | private String larIdCardPicBack; |
| | | /** |
| | | * 法人身份证手持 |
| | | */ |
| | | private String larIdCardPicHold; |
| | | /** |
| | | * 开户许可证 |
| | | */ |
| | | private String accountOpeningPermit; |
| | | /** |
| | | * 自定义的,例如:企业类型 |
| | | */ |
| | | private String tag1; |
| | | /** |
| | | * 自定义的,例如:行业类型 |
| | | */ |
| | | private String tag2; |
| | | /** |
| | | * 企业扩展信息 |
| | | */ |
| | | private String iformContentId; |
| | | /** |
| | | * 国家统计局网站提供的行政地区编码 |
| | | */ |
| | | private String area; |
| | | /** |
| | | * 行业编码 |
| | | */ |
| | | private String industryCode; |
| | | /** |
| | | * 企业创建人姓名 |
| | | */ |
| | | private String creatorName; |
| | | /** |
| | | * 企业创建人手机号 |
| | | */ |
| | | private String creatorMobile; |
| | | /** |
| | | * 管理员邮箱 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 企业简称 |
| | | */ |
| | | private String enterAbbreviation; |
| | | /** |
| | | * 营业期限 |
| | | */ |
| | | private String businessTermLong; |
| | | /** |
| | | * 一级行业名称 |
| | | */ |
| | | private String industryL1Name; |
| | | /** |
| | | * 二级行业名称 |
| | | */ |
| | | private String industryL2Name; |
| | | /** |
| | | * 企业介绍(全文本) |
| | | */ |
| | | private String enterIntro; |
| | | /** |
| | | * 法人身份证正面照片 |
| | | */ |
| | | private String larIdCardPicFront; |
| | | /** |
| | | * 企业主税机关 |
| | | */ |
| | | private String enterTaxAuthority; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:42 |
| | | */ |
| | | @Data |
| | | public class GetStaffNodeRequest { |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Long empId; |
| | | /** |
| | | * 操作人手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 操作人企业ID |
| | | */ |
| | | private String entercode; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/9 18:13 |
| | | */ |
| | | @Data |
| | | public class ModifyEnterpriseInfoRequest { |
| | | /** |
| | | * 企业编码 |
| | | */ |
| | | private String enter_code; |
| | | /** |
| | | * 操作人员手机号 |
| | | */ |
| | | private String operator; |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String enter_name; |
| | | /** |
| | | * 企业简称 |
| | | */ |
| | | private String enter_nickname; |
| | | /** |
| | | * 企业地址 |
| | | */ |
| | | private String enter_address; |
| | | /** |
| | | * 企业邮箱 |
| | | */ |
| | | private String enter_email; |
| | | /** |
| | | * 联系人姓名 |
| | | */ |
| | | private String contact_name; |
| | | /** |
| | | * 联系人手机号 |
| | | */ |
| | | private String contact_mobile; |
| | | /** |
| | | * 营业执照扫描件URL |
| | | */ |
| | | private String operscanpic; |
| | | /** |
| | | * 营业期开始时间 |
| | | */ |
| | | private String businessTermStartTime; |
| | | /** |
| | | * 营业期结束时间 |
| | | */ |
| | | private String businessTermEndTime; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | | private String area; |
| | | /** |
| | | * 二级域名 |
| | | */ |
| | | private String second_realms; |
| | | /** |
| | | * 企业来源编码 |
| | | */ |
| | | private String source_code; |
| | | /** |
| | | * 店铺所属行业编码 |
| | | */ |
| | | private String trade_code; |
| | | /** |
| | | * 企业分类编码 |
| | | */ |
| | | private String type_code; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/10 10:42 |
| | | */ |
| | | @Data |
| | | public class ModifyPwdRequest { |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 旧密码 |
| | | */ |
| | | private String oldPwd; |
| | | /** |
| | | * 新密码 |
| | | */ |
| | | private String newPwd; |
| | | /** |
| | | * 验证码 |
| | | */ |
| | | private String code; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 15:11 |
| | | */ |
| | | @Data |
| | | public class QYTUserInfo { |
| | | /** |
| | | * 员工名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 企业编号 |
| | | */ |
| | | private String enterNum; |
| | | /** |
| | | * 节点路径 |
| | | */ |
| | | private String nodePath; |
| | | /** |
| | | * 员工昵称 |
| | | */ |
| | | private String nickName; |
| | | /** |
| | | * 员工编号 |
| | | */ |
| | | private String empId; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mphone; |
| | | /** |
| | | * 员工在企业内部的编号 |
| | | */ |
| | | private String loginNo; |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | private String deptId; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/10 11:34 |
| | | */ |
| | | @Data |
| | | public class RegisterViaMobile { |
| | | /** |
| | | * 响应码 |
| | | * 0:成功;1:失败;2:手机号非法;3:验证码已过期;4:验证码错误;5、用户已存在;9:弱密码 |
| | | */ |
| | | private String status; |
| | | /** |
| | | * 响应描述 |
| | | */ |
| | | private String desc; |
| | | /** |
| | | * web登录密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 用户UUID |
| | | */ |
| | | private String onconUUID; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:59 |
| | | */ |
| | | @Data |
| | | public class RegisterViaMobileRequest { |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 客户端appid |
| | | */ |
| | | private String appId; |
| | | /** |
| | | * 用户密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 短信验证码 |
| | | */ |
| | | private String verify_code; |
| | | /** |
| | | * 验证码类型 |
| | | * 0:短信发送的验证码;1:一键获取手机号返回注册验证码;2、验证码验证成功后生成的Ticket |
| | | */ |
| | | private String verify_code_type; |
| | | /** |
| | | * 加密类型 |
| | | * 第三方系统可以填写空 |
| | | */ |
| | | private String encryptType; |
| | | /** |
| | | * 用户类型 |
| | | * 0:普通用户 |
| | | */ |
| | | private String user_type; |
| | | /** |
| | | * 昵称 |
| | | */ |
| | | private String nickname; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/10 10:42 |
| | | */ |
| | | @Data |
| | | public class ResetPwdRequest { |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 验证码 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 客户端appid |
| | | */ |
| | | private String appid; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2025/6/14 14:10 |
| | | */ |
| | | @Data |
| | | public class SaveStaffNode { |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Long empId; |
| | | /** |
| | | * 员工名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 员工昵称 |
| | | */ |
| | | private String empNickname; |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | private String mphone; |
| | | /** |
| | | * 登录账号 |
| | | */ |
| | | private String loginNo; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:22 |
| | | */ |
| | | @Data |
| | | public class SaveStaffNodeRequest { |
| | | /** |
| | | * 操作人手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 操作人企业ID |
| | | */ |
| | | private String entercode; |
| | | /** |
| | | * 人员名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 人员显示名 |
| | | */ |
| | | private String empNickname; |
| | | /** |
| | | * 人员账号 |
| | | */ |
| | | private String loginNo; |
| | | /** |
| | | * 人员性别 |
| | | */ |
| | | private String empSex; |
| | | /** |
| | | * 人员手机号 |
| | | */ |
| | | private String mphone; |
| | | /** |
| | | * 人员邮箱 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 员工所属部分ID |
| | | */ |
| | | private Integer deptId; |
| | | /** |
| | | * 员工职务ID |
| | | */ |
| | | private Integer positionId; |
| | | /** |
| | | * 员工职务名称 |
| | | */ |
| | | private String positionName; |
| | | /** |
| | | * 高管模式 1 是 0 不是 |
| | | */ |
| | | private Integer superLevel; |
| | | /** |
| | | * 隐藏号码 1 是 0 不是 |
| | | */ |
| | | private Integer hideMobile; |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:44 |
| | | */ |
| | | @Data |
| | | public class StaffNodeInfo { |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Integer empId; |
| | | /** |
| | | * 主要号码 |
| | | */ |
| | | private String mainMphone; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | /** |
| | | * 企业ID |
| | | */ |
| | | private String enterNum; |
| | | /** |
| | | * 加密企业名称 |
| | | */ |
| | | private String empNameEncode; |
| | | /** |
| | | * 人员名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 人员显示名 |
| | | */ |
| | | private String empNickname; |
| | | /** |
| | | * 人员账号 |
| | | */ |
| | | private String loginNo; |
| | | /** |
| | | * 人员性别(男\女) |
| | | */ |
| | | private String empSex; |
| | | /** |
| | | * 人员手机号 |
| | | */ |
| | | private String mphone; |
| | | /** |
| | | * 人员邮箱加密 |
| | | */ |
| | | private String mainEmailEncode; |
| | | /** |
| | | * 所属企业id |
| | | */ |
| | | private Long enterId; |
| | | /** |
| | | * 唯一编号 |
| | | */ |
| | | private String onconuuid; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | private String email; |
| | | /** |
| | | * 员工所属部门ID多个部门英文; 分割 |
| | | */ |
| | | private Integer deptId; |
| | | /** |
| | | * 员工职位ID |
| | | */ |
| | | private Long positionId; |
| | | /** |
| | | * 员工职位名称 |
| | | */ |
| | | private String positionName; |
| | | /** |
| | | * 高管模式 1 是 0 不是 |
| | | */ |
| | | private Integer superLevel; |
| | | /** |
| | | * 隐藏手机号 1 是 0 否 |
| | | */ |
| | | private Integer hideMobile; |
| | | /** |
| | | * 有效状态(0=否,1=是) |
| | | */ |
| | | private String isValid; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.dao.RegionMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SysIntegralMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.bouncycastle.crypto.tls.MACAlgorithm; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | |
| | | System.out.println("取消订单:"+query); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | }).start(); |
| | | |
| | | //用户付款后,删除限制司机6分钟不能接单的标识 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | } |
| | |
| | | }).start(); |
| | | |
| | | //用户付款后,删除限制司机6分钟不能接单的标识 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | |
| | |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) == 11){ |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 2); |
| | | return map; |
| | |
| | | return orderServerWarpper; |
| | | } |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderTaxi.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderTaxi.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | |
| | | }).start(); |
| | | |
| | | //用户付款后,删除限制司机6分钟不能接单的标识 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | JSONArray jsonArray = JSON.parseArray(vehicle); |
| | | for(int i = 0; i < jsonArray.size(); i++){ |
| | |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | |
| | | |
| | |
| | | public void run() { |
| | | try { |
| | | orderIds.add(orderTaxi.getId());//添加记录,防止调用接口重复提醒无人接单 |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
New file |
| | |
| | | server: |
| | | port: 8006 |
| | | |
| | | guns: |
| | | swagger-open: true #是否开启swagger (true/false) |
| | | kaptcha-open: false #是否开启登录时验证码 (true/false) |
| | | file-upload-path: d:/tmp #文件上传目录(不配置的话为java.io.tmpdir目录) |
| | | picture-server-address: http://192.168.0.43/resources/ #图片服务器地址 |
| | | spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) |
| | | session-invalidate-time: 1800 #session失效时间(只在单机环境下生效,多机环境在SpringSessionConfig类中配置) 单位:秒 |
| | | session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 |
| | | |
| | | spring: |
| | | application: |
| | | name: user-server |
| | | profiles: |
| | | # active: dev |
| | | active: local |
| | | mvc: |
| | | static-path-pattern: /static/** |
| | | view: |
| | | prefix: /WEB-INF/view |
| | | devtools: |
| | | restart: |
| | | enabled: false |
| | | additional-paths: src/main/java |
| | | exclude: static/**,WEB-INF/view/** |
| | | servlet: |
| | | multipart: |
| | | max-request-size: 100MB |
| | | max-file-size: 100MB |
| | | redis: |
| | | url: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| | | |
| | | mybatis-plus: |
| | | typeAliasesPackage: com.stylefeng.guns.modular |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl |
| | | |
| | | |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: #注册中心地址 |
| | | defaultZone: http://sinata:sinata@127.0.0.1:8000/eureka #启用身份验证的方式连接 |
| | | register-with-eureka: true #在注册中心进行注册 |
| | | fetch-registry: true #从Eureka中获取注册信息。 |
| | | |
| | | --- |
| | | |
| | | |
| | | #配置Swagger接口扫描范围 |
| | | swagger: |
| | | base-package: com.stylefeng.guns.modular |
| | | |
| | | |
| | | spring: |
| | | profiles: local |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/qyttravel?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | db-name: jyxtravel #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | --- |
| | | |
| | | |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: wxcc3c9058e2b294db #小程序APPid |
| | | appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # |
| | | mchId: 111 #微信支付分配的商户号 |
| | | key: 111 #key为商户平台设置的密钥key: |
| | | |
| | | --- |
| | | |
| | | alipay: |
| | | appid: 111 #应用程序唯一标识 |
| | | appPrivateKey: 111 #开发者应用私钥 |
| | | alipayPublicKey: ; #应用公钥 |
| | | alipay_public_key: 111 #支付宝公钥 |
| | | |
| | | --- |
| | | |
| | | juhe: #聚合数据 |
| | | appKey: 111 # |
| | | |
| | | |
| | | --- |
| | | |
| | | filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://zhentonggongsi.com:443/user |
| | | |
| | | |
| | | --- |
| | | |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
New file |
| | |
| | | package com.stylefeng.guns.generator.action; |
| | | |
| | | |
| | | import com.stylefeng.guns.generator.action.config.GunsGeneratorConfig; |
| | | |
| | | /** |
| | | * 代码生成器,可以生成实体,dao,service,controller,html,js |
| | | * |
| | | * @author stylefeng |
| | | * @Date 2017/5/21 12:38 |
| | | */ |
| | | public class GunsCodeGenerator { |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | /** |
| | | * Mybatis-Plus的代码生成器: |
| | | * mp的代码生成器可以生成实体,mapper,mapper对应的xml,service |
| | | */ |
| | | GunsGeneratorConfig gunsGeneratorConfig = new GunsGeneratorConfig(); |
| | | gunsGeneratorConfig.doMpGeneration(); |
| | | |
| | | /** |
| | | * guns的生成器: |
| | | * guns的代码生成器可以生成controller,html页面,页面对应的js |
| | | */ |
| | | gunsGeneratorConfig.doGunsGeneration(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.action.config; |
| | | |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; |
| | | import com.baomidou.mybatisplus.generator.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.generator.config.PackageConfig; |
| | | import com.baomidou.mybatisplus.generator.config.StrategyConfig; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.stylefeng.guns.core.util.FileUtil; |
| | | import com.stylefeng.guns.generator.engine.SimpleTemplateEngine; |
| | | import com.stylefeng.guns.generator.engine.base.GunsTemplateEngine; |
| | | import com.stylefeng.guns.generator.engine.config.ContextConfig; |
| | | import com.stylefeng.guns.generator.engine.config.SqlConfig; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 代码生成的抽象配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-10-28-下午8:22 |
| | | */ |
| | | public abstract class AbstractGeneratorConfig { |
| | | |
| | | /** |
| | | * mybatis-plus代码生成器配置 |
| | | */ |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | |
| | | DataSourceConfig dataSourceConfig = new DataSourceConfig(); |
| | | |
| | | StrategyConfig strategyConfig = new StrategyConfig(); |
| | | |
| | | PackageConfig packageConfig = new PackageConfig(); |
| | | |
| | | TableInfo tableInfo = null; |
| | | |
| | | /** |
| | | * Guns代码生成器配置 |
| | | */ |
| | | ContextConfig contextConfig = new ContextConfig(); |
| | | |
| | | SqlConfig sqlConfig = new SqlConfig(); |
| | | |
| | | protected abstract void config(); |
| | | |
| | | public void init() { |
| | | config(); |
| | | |
| | | packageConfig.setService(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service"); |
| | | packageConfig.setServiceImpl(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service.impl"); |
| | | |
| | | //controller没用掉,生成之后会自动删掉 |
| | | packageConfig.setController("TTT"); |
| | | |
| | | if (!contextConfig.getEntitySwitch()) { |
| | | packageConfig.setEntity("TTT"); |
| | | } |
| | | |
| | | if (!contextConfig.getDaoSwitch()) { |
| | | packageConfig.setMapper("TTT"); |
| | | packageConfig.setXml("TTT"); |
| | | } |
| | | |
| | | if (!contextConfig.getServiceSwitch()) { |
| | | packageConfig.setService("TTT"); |
| | | packageConfig.setServiceImpl("TTT"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除不必要的代码 |
| | | */ |
| | | public void destory() { |
| | | String outputDir = globalConfig.getOutputDir() + "/TTT"; |
| | | FileUtil.deleteDir(new File(outputDir)); |
| | | } |
| | | |
| | | public AbstractGeneratorConfig() { |
| | | } |
| | | |
| | | public void doMpGeneration() { |
| | | init(); |
| | | AutoGenerator autoGenerator = new AutoGenerator(); |
| | | autoGenerator.setGlobalConfig(globalConfig); |
| | | autoGenerator.setDataSource(dataSourceConfig); |
| | | autoGenerator.setStrategy(strategyConfig); |
| | | autoGenerator.setPackageInfo(packageConfig); |
| | | autoGenerator.execute(); |
| | | destory(); |
| | | |
| | | //获取table信息,用于guns代码生成 |
| | | List<TableInfo> tableInfoList = autoGenerator.getConfig().getTableInfoList(); |
| | | if (tableInfoList != null && tableInfoList.size() > 0) { |
| | | this.tableInfo = tableInfoList.get(0); |
| | | } |
| | | } |
| | | |
| | | public void doGunsGeneration() { |
| | | GunsTemplateEngine GunsTemplateEngine = new SimpleTemplateEngine(); |
| | | GunsTemplateEngine.setContextConfig(contextConfig); |
| | | sqlConfig.setConnection(dataSourceConfig.getConn()); |
| | | GunsTemplateEngine.setSqlConfig(sqlConfig); |
| | | GunsTemplateEngine.setTableInfo(tableInfo); |
| | | GunsTemplateEngine.start(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.action.config; |
| | | |
| | | import com.baomidou.mybatisplus.generator.config.rules.DbType; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | |
| | | /** |
| | | * 默认的代码生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-10-28-下午8:27 |
| | | */ |
| | | public class GunsGeneratorConfig extends AbstractGeneratorConfig { |
| | | |
| | | protected void globalConfig() { |
| | | globalConfig.setOutputDir("D:\\ttt");//写自己项目的绝对路径,注意具体到java目录 |
| | | globalConfig.setFileOverride(true); |
| | | globalConfig.setEnableCache(false); |
| | | globalConfig.setBaseResultMap(true); |
| | | globalConfig.setBaseColumnList(true); |
| | | globalConfig.setOpen(false); |
| | | globalConfig.setAuthor("stylefeng"); |
| | | } |
| | | |
| | | protected void dataSourceConfig() { |
| | | dataSourceConfig.setDbType(DbType.MYSQL); |
| | | dataSourceConfig.setDriverName("com.mysql.jdbc.Driver"); |
| | | dataSourceConfig.setUsername("root"); |
| | | dataSourceConfig.setPassword("root"); |
| | | dataSourceConfig.setUrl("jdbc:mysql://127.0.0.1:3306/guns?characterEncoding=utf8"); |
| | | } |
| | | |
| | | protected void strategyConfig() { |
| | | strategyConfig.setTablePrefix(new String[]{"sys_"});// 此处可以修改为您的表前缀 |
| | | strategyConfig.setNaming(NamingStrategy.underline_to_camel); |
| | | } |
| | | |
| | | protected void packageConfig() { |
| | | packageConfig.setParent(null); |
| | | packageConfig.setEntity("com.stylefeng.guns.admin.common.persistence.model"); |
| | | packageConfig.setMapper("com.stylefeng.guns.admin.common.persistence.dao"); |
| | | packageConfig.setXml("com.stylefeng.guns.admin.common.persistence.dao.mapping"); |
| | | } |
| | | |
| | | protected void contextConfig() { |
| | | contextConfig.setProPackage("com.stylefeng.guns.admin"); |
| | | contextConfig.setCoreBasePackage("com.stylefeng.guns.core"); |
| | | contextConfig.setBizChName("字典管理"); |
| | | contextConfig.setBizEnName("sysDict"); |
| | | contextConfig.setModuleName("system"); |
| | | contextConfig.setProjectPath("D:\\ideaSpace\\guns\\guns-admin");//写自己项目的绝对路径 |
| | | contextConfig.setEntityName("SysDict"); |
| | | sqlConfig.setParentMenuName(null);//这里写已有菜单的名称,当做父节点 |
| | | |
| | | /** |
| | | * mybatis-plus 生成器开关 |
| | | */ |
| | | contextConfig.setEntitySwitch(true); |
| | | contextConfig.setDaoSwitch(true); |
| | | contextConfig.setServiceSwitch(true); |
| | | |
| | | /** |
| | | * guns 生成器开关 |
| | | */ |
| | | contextConfig.setControllerSwitch(true); |
| | | contextConfig.setIndexPageSwitch(true); |
| | | contextConfig.setAddPageSwitch(true); |
| | | contextConfig.setEditPageSwitch(true); |
| | | contextConfig.setJsSwitch(true); |
| | | contextConfig.setInfoJsSwitch(true); |
| | | contextConfig.setSqlSwitch(true); |
| | | } |
| | | |
| | | @Override |
| | | protected void config() { |
| | | globalConfig(); |
| | | dataSourceConfig(); |
| | | strategyConfig(); |
| | | packageConfig(); |
| | | contextConfig(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.action.config; |
| | | |
| | | import com.baomidou.mybatisplus.generator.config.rules.DbType; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import com.stylefeng.guns.core.support.StrKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.generator.action.model.GenQo; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * 默认的代码生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-10-28-下午8:27 |
| | | */ |
| | | public class WebGeneratorConfig extends AbstractGeneratorConfig { |
| | | |
| | | private GenQo genQo; |
| | | |
| | | public WebGeneratorConfig(GenQo genQo) { |
| | | this.genQo = genQo; |
| | | } |
| | | |
| | | @Override |
| | | protected void config() { |
| | | /** |
| | | * 数据库配置 |
| | | */ |
| | | dataSourceConfig.setDbType(DbType.MYSQL); |
| | | dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver"); |
| | | dataSourceConfig.setUsername(genQo.getUserName()); |
| | | dataSourceConfig.setPassword(genQo.getPassword()); |
| | | dataSourceConfig.setUrl(genQo.getUrl()); |
| | | |
| | | /** |
| | | * 全局配置 |
| | | */ |
| | | globalConfig.setOutputDir(genQo.getProjectPath() + File.separator + "src" + File.separator + "main" + File.separator + "java"); |
| | | globalConfig.setFileOverride(true); |
| | | globalConfig.setEnableCache(false); |
| | | globalConfig.setBaseResultMap(true); |
| | | globalConfig.setBaseColumnList(true); |
| | | globalConfig.setOpen(false); |
| | | globalConfig.setAuthor(genQo.getAuthor()); |
| | | contextConfig.setProPackage(genQo.getProjectPackage()); |
| | | contextConfig.setCoreBasePackage(genQo.getCorePackage()); |
| | | |
| | | /** |
| | | * 生成策略 |
| | | */ |
| | | if (genQo.getIgnoreTabelPrefix() != null) { |
| | | strategyConfig.setTablePrefix(new String[]{genQo.getIgnoreTabelPrefix()}); |
| | | } |
| | | strategyConfig.setInclude(new String[]{genQo.getTableName()}); |
| | | strategyConfig.setNaming(NamingStrategy.underline_to_camel); |
| | | packageConfig.setParent(null); |
| | | packageConfig.setEntity(genQo.getProjectPackage() + ".modular.system.model"); |
| | | packageConfig.setMapper(genQo.getProjectPackage() + ".modular.system.dao"); |
| | | packageConfig.setXml(genQo.getProjectPackage() + ".modular.system.dao.mapping"); |
| | | |
| | | /** |
| | | * 业务代码配置 |
| | | */ |
| | | contextConfig.setBizChName(genQo.getBizName()); |
| | | contextConfig.setModuleName(genQo.getModuleName()); |
| | | contextConfig.setProjectPath(genQo.getProjectPath());//写自己项目的绝对路径 |
| | | if(ToolUtil.isEmpty(genQo.getIgnoreTabelPrefix())){ |
| | | String entityName = StrKit.toCamelCase(genQo.getTableName()); |
| | | contextConfig.setEntityName(StrKit.firstCharToUpperCase(entityName)); |
| | | contextConfig.setBizEnName(StrKit.firstCharToLowerCase(entityName)); |
| | | }else{ |
| | | String entiyName = StrKit.toCamelCase(StrKit.removePrefix(genQo.getTableName(), genQo.getIgnoreTabelPrefix())); |
| | | contextConfig.setEntityName(StrKit.firstCharToUpperCase(entiyName)); |
| | | contextConfig.setBizEnName(StrKit.firstCharToLowerCase(entiyName)); |
| | | } |
| | | sqlConfig.setParentMenuName(genQo.getParentMenuName());//这里写已有菜单的名称,当做父节点 |
| | | |
| | | /** |
| | | * mybatis-plus 生成器开关 |
| | | */ |
| | | contextConfig.setEntitySwitch(genQo.getEntitySwitch()); |
| | | contextConfig.setDaoSwitch(genQo.getDaoSwitch()); |
| | | contextConfig.setServiceSwitch(genQo.getServiceSwitch()); |
| | | |
| | | /** |
| | | * guns 生成器开关 |
| | | */ |
| | | contextConfig.setControllerSwitch(genQo.getControllerSwitch()); |
| | | contextConfig.setIndexPageSwitch(genQo.getIndexPageSwitch()); |
| | | contextConfig.setAddPageSwitch(genQo.getAddPageSwitch()); |
| | | contextConfig.setEditPageSwitch(genQo.getEditPageSwitch()); |
| | | contextConfig.setJsSwitch(genQo.getJsSwitch()); |
| | | contextConfig.setInfoJsSwitch(genQo.getInfoJsSwitch()); |
| | | contextConfig.setSqlSwitch(genQo.getSqlSwitch()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.action.model; |
| | | |
| | | /** |
| | | * 代码生成的查询参数 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-11-30-下午2:05 |
| | | */ |
| | | public class GenQo { |
| | | |
| | | /** |
| | | * 数据库账号 |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * 数据库密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 数据库url |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * 项目地址 |
| | | */ |
| | | private String projectPath; |
| | | |
| | | /** |
| | | * 作者 |
| | | */ |
| | | private String author; |
| | | |
| | | /** |
| | | * 项目的包 |
| | | */ |
| | | private String projectPackage; |
| | | |
| | | /** |
| | | * 核心模块的包 |
| | | */ |
| | | private String corePackage; |
| | | |
| | | /** |
| | | * 表名称 |
| | | */ |
| | | private String tableName; |
| | | |
| | | /** |
| | | * 忽略的表前缀 |
| | | */ |
| | | private String ignoreTabelPrefix; |
| | | |
| | | /** |
| | | * 业务名称 |
| | | */ |
| | | private String bizName; |
| | | |
| | | /** |
| | | * 模块名 |
| | | */ |
| | | private String moduleName; |
| | | |
| | | /** |
| | | * 父级菜单名称 |
| | | */ |
| | | private String parentMenuName; |
| | | |
| | | /** |
| | | * 是否生成控制器代码开关 |
| | | */ |
| | | private Boolean controllerSwitch = false; |
| | | |
| | | /** |
| | | * 主页 |
| | | */ |
| | | private Boolean indexPageSwitch = false; |
| | | |
| | | /** |
| | | * 添加页面 |
| | | */ |
| | | private Boolean addPageSwitch = false; |
| | | |
| | | /** |
| | | * 编辑页面 |
| | | */ |
| | | private Boolean editPageSwitch = false; |
| | | |
| | | /** |
| | | * 主页的js |
| | | */ |
| | | private Boolean jsSwitch = false; |
| | | |
| | | /** |
| | | * 详情页面js |
| | | */ |
| | | private Boolean infoJsSwitch = false; |
| | | |
| | | /** |
| | | * dao的开关 |
| | | */ |
| | | private Boolean daoSwitch = false; |
| | | |
| | | /** |
| | | * service |
| | | */ |
| | | private Boolean serviceSwitch = false; |
| | | |
| | | /** |
| | | * 生成实体的开关 |
| | | */ |
| | | private Boolean entitySwitch = false; |
| | | |
| | | /** |
| | | * 生成sql的开关 |
| | | */ |
| | | private Boolean sqlSwitch = false; |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getProjectPath() { |
| | | return projectPath; |
| | | } |
| | | |
| | | public void setProjectPath(String projectPath) { |
| | | this.projectPath = projectPath; |
| | | } |
| | | |
| | | public String getAuthor() { |
| | | return author; |
| | | } |
| | | |
| | | public void setAuthor(String author) { |
| | | this.author = author; |
| | | } |
| | | |
| | | public String getCorePackage() { |
| | | return corePackage; |
| | | } |
| | | |
| | | public void setCorePackage(String corePackage) { |
| | | this.corePackage = corePackage; |
| | | } |
| | | |
| | | public String getProjectPackage() { |
| | | |
| | | return projectPackage; |
| | | } |
| | | |
| | | public void setProjectPackage(String projectPackage) { |
| | | this.projectPackage = projectPackage; |
| | | } |
| | | |
| | | public String getTableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | public void setTableName(String tableName) { |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | public String getIgnoreTabelPrefix() { |
| | | return ignoreTabelPrefix; |
| | | } |
| | | |
| | | public void setIgnoreTabelPrefix(String ignoreTabelPrefix) { |
| | | this.ignoreTabelPrefix = ignoreTabelPrefix; |
| | | } |
| | | |
| | | public String getBizName() { |
| | | return bizName; |
| | | } |
| | | |
| | | public void setBizName(String bizName) { |
| | | this.bizName = bizName; |
| | | } |
| | | |
| | | public String getModuleName() { |
| | | return moduleName; |
| | | } |
| | | |
| | | public void setModuleName(String moduleName) { |
| | | this.moduleName = moduleName; |
| | | } |
| | | |
| | | public Boolean getControllerSwitch() { |
| | | return controllerSwitch; |
| | | } |
| | | |
| | | public void setControllerSwitch(Boolean controllerSwitch) { |
| | | this.controllerSwitch = controllerSwitch; |
| | | } |
| | | |
| | | public Boolean getIndexPageSwitch() { |
| | | return indexPageSwitch; |
| | | } |
| | | |
| | | public void setIndexPageSwitch(Boolean indexPageSwitch) { |
| | | this.indexPageSwitch = indexPageSwitch; |
| | | } |
| | | |
| | | public Boolean getAddPageSwitch() { |
| | | return addPageSwitch; |
| | | } |
| | | |
| | | public void setAddPageSwitch(Boolean addPageSwitch) { |
| | | this.addPageSwitch = addPageSwitch; |
| | | } |
| | | |
| | | public Boolean getEditPageSwitch() { |
| | | return editPageSwitch; |
| | | } |
| | | |
| | | public void setEditPageSwitch(Boolean editPageSwitch) { |
| | | this.editPageSwitch = editPageSwitch; |
| | | } |
| | | |
| | | public Boolean getJsSwitch() { |
| | | return jsSwitch; |
| | | } |
| | | |
| | | public void setJsSwitch(Boolean jsSwitch) { |
| | | this.jsSwitch = jsSwitch; |
| | | } |
| | | |
| | | public Boolean getInfoJsSwitch() { |
| | | return infoJsSwitch; |
| | | } |
| | | |
| | | public void setInfoJsSwitch(Boolean infoJsSwitch) { |
| | | this.infoJsSwitch = infoJsSwitch; |
| | | } |
| | | |
| | | public Boolean getDaoSwitch() { |
| | | return daoSwitch; |
| | | } |
| | | |
| | | public void setDaoSwitch(Boolean daoSwitch) { |
| | | this.daoSwitch = daoSwitch; |
| | | } |
| | | |
| | | public Boolean getServiceSwitch() { |
| | | return serviceSwitch; |
| | | } |
| | | |
| | | public void setServiceSwitch(Boolean serviceSwitch) { |
| | | this.serviceSwitch = serviceSwitch; |
| | | } |
| | | |
| | | public Boolean getEntitySwitch() { |
| | | return entitySwitch; |
| | | } |
| | | |
| | | public void setEntitySwitch(Boolean entitySwitch) { |
| | | this.entitySwitch = entitySwitch; |
| | | } |
| | | |
| | | public Boolean getSqlSwitch() { |
| | | return sqlSwitch; |
| | | } |
| | | |
| | | public void setSqlSwitch(Boolean sqlSwitch) { |
| | | this.sqlSwitch = sqlSwitch; |
| | | } |
| | | |
| | | public String getParentMenuName() { |
| | | return parentMenuName; |
| | | } |
| | | |
| | | public void setParentMenuName(String parentMenuName) { |
| | | this.parentMenuName = parentMenuName; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine; |
| | | |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.generator.engine.base.GunsTemplateEngine; |
| | | |
| | | /** |
| | | * 通用的模板生成引擎 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-09 20:32 |
| | | */ |
| | | public class SimpleTemplateEngine extends GunsTemplateEngine { |
| | | |
| | | @Override |
| | | protected void generatePageEditHtml() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageEditPathTemplate(), |
| | | super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_edit.html.btl", path); |
| | | System.out.println("生成编辑页面成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generatePageAddHtml() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageAddPathTemplate(), |
| | | super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_add.html.btl", path); |
| | | System.out.println("生成添加页面成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generatePageInfoJs() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageInfoJsPathTemplate(), |
| | | super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page_info.js.btl", path); |
| | | System.out.println("生成页面详情js成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generatePageJs() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPageJsPathTemplate(), |
| | | super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page.js.btl", path); |
| | | System.out.println("生成页面js成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generatePageHtml() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + getPageConfig().getPagePathTemplate(), |
| | | super.getContextConfig().getBizEnName(), super.getContextConfig().getBizEnName()); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/page.html.btl", path); |
| | | System.out.println("生成页面成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generateController() { |
| | | String controllerPath = ToolUtil.format(super.getContextConfig().getProjectPath() + super.getControllerConfig().getControllerPathTemplate(), |
| | | ToolUtil.firstLetterToUpper(super.getContextConfig().getBizEnName())); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/Controller.java.btl", controllerPath); |
| | | System.out.println("生成控制器成功!"); |
| | | } |
| | | |
| | | @Override |
| | | protected void generateSqls() { |
| | | String path = ToolUtil.format(super.getContextConfig().getProjectPath() + super.sqlConfig.getSqlPathTemplate(), |
| | | ToolUtil.firstLetterToUpper(super.getContextConfig().getBizEnName())); |
| | | generateFile(super.getContextConfig().getTemplatePrefixPath() + "/menu_sql.sql.btl", path); |
| | | System.out.println("生成sql成功!"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.base; |
| | | |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.stylefeng.guns.generator.engine.config.*; |
| | | |
| | | /** |
| | | * 模板生成父类 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-08 20:17 |
| | | */ |
| | | public class AbstractTemplateEngine { |
| | | |
| | | protected ContextConfig contextConfig; //全局配置 |
| | | protected ControllerConfig controllerConfig; //控制器的配置 |
| | | protected PageConfig pageConfig; //页面的控制器 |
| | | protected DaoConfig daoConfig; //Dao配置 |
| | | protected ServiceConfig serviceConfig; //Service配置 |
| | | protected SqlConfig sqlConfig; //sql配置 |
| | | protected TableInfo tableInfo; //表的信息 |
| | | |
| | | public void initConfig() { |
| | | if (this.contextConfig == null) { |
| | | this.contextConfig = new ContextConfig(); |
| | | } |
| | | if (this.controllerConfig == null) { |
| | | this.controllerConfig = new ControllerConfig(); |
| | | } |
| | | if (this.pageConfig == null) { |
| | | this.pageConfig = new PageConfig(); |
| | | } |
| | | if (this.daoConfig == null) { |
| | | this.daoConfig = new DaoConfig(); |
| | | } |
| | | if (this.serviceConfig == null) { |
| | | this.serviceConfig = new ServiceConfig(); |
| | | } |
| | | if (this.sqlConfig == null) { |
| | | this.sqlConfig = new SqlConfig(); |
| | | } |
| | | this.contextConfig.init(); |
| | | |
| | | this.controllerConfig.setContextConfig(this.contextConfig); |
| | | this.controllerConfig.init(); |
| | | |
| | | this.serviceConfig.setContextConfig(this.contextConfig); |
| | | this.serviceConfig.init(); |
| | | |
| | | this.daoConfig.setContextConfig(this.contextConfig); |
| | | this.daoConfig.init(); |
| | | |
| | | this.pageConfig.setContextConfig(this.contextConfig); |
| | | this.pageConfig.init(); |
| | | |
| | | this.sqlConfig.setContextConfig(this.contextConfig); |
| | | this.sqlConfig.init(); |
| | | } |
| | | |
| | | public PageConfig getPageConfig() { |
| | | return pageConfig; |
| | | } |
| | | |
| | | public void setPageConfig(PageConfig pageConfig) { |
| | | this.pageConfig = pageConfig; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | |
| | | public ControllerConfig getControllerConfig() { |
| | | return controllerConfig; |
| | | } |
| | | |
| | | public void setControllerConfig(ControllerConfig controllerConfig) { |
| | | this.controllerConfig = controllerConfig; |
| | | } |
| | | |
| | | public DaoConfig getDaoConfig() { |
| | | return daoConfig; |
| | | } |
| | | |
| | | public void setDaoConfig(DaoConfig daoConfig) { |
| | | this.daoConfig = daoConfig; |
| | | } |
| | | |
| | | public ServiceConfig getServiceConfig() { |
| | | return serviceConfig; |
| | | } |
| | | |
| | | public void setServiceConfig(ServiceConfig serviceConfig) { |
| | | this.serviceConfig = serviceConfig; |
| | | } |
| | | |
| | | public SqlConfig getSqlConfig() { |
| | | return sqlConfig; |
| | | } |
| | | |
| | | public void setSqlConfig(SqlConfig sqlConfig) { |
| | | this.sqlConfig = sqlConfig; |
| | | } |
| | | |
| | | public TableInfo getTableInfo() { |
| | | return tableInfo; |
| | | } |
| | | |
| | | public void setTableInfo(TableInfo tableInfo) { |
| | | this.tableInfo = tableInfo; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.base; |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.sun.javafx.PlatformUtil; |
| | | import org.beetl.core.Configuration; |
| | | import org.beetl.core.GroupTemplate; |
| | | import org.beetl.core.Template; |
| | | import org.beetl.core.resource.ClasspathResourceLoader; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * ADI项目模板生成 引擎 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-07 22:15 |
| | | */ |
| | | public abstract class GunsTemplateEngine extends AbstractTemplateEngine { |
| | | |
| | | private GroupTemplate groupTemplate; |
| | | |
| | | public GunsTemplateEngine() { |
| | | initBeetlEngine(); |
| | | } |
| | | |
| | | protected void initBeetlEngine() { |
| | | Properties properties = new Properties(); |
| | | properties.put("RESOURCE.root", ""); |
| | | properties.put("DELIMITER_STATEMENT_START", "<%"); |
| | | properties.put("DELIMITER_STATEMENT_END", "%>"); |
| | | properties.put("HTML_TAG_FLAG", "##"); |
| | | Configuration cfg = null; |
| | | try { |
| | | cfg = new Configuration(properties); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(); |
| | | groupTemplate = new GroupTemplate(resourceLoader, cfg); |
| | | groupTemplate.registerFunctionPackage("tool", new ToolUtil()); |
| | | } |
| | | |
| | | protected void configTemplate(Template template) { |
| | | template.binding("controller", super.controllerConfig); |
| | | template.binding("context", super.contextConfig); |
| | | template.binding("dao", super.daoConfig); |
| | | template.binding("service", super.serviceConfig); |
| | | template.binding("sqls", super.sqlConfig); |
| | | template.binding("table", super.tableInfo); |
| | | } |
| | | |
| | | protected void generateFile(String template, String filePath) { |
| | | Template pageTemplate = groupTemplate.getTemplate(template); |
| | | configTemplate(pageTemplate); |
| | | if (PlatformUtil.isWindows()) { |
| | | filePath = filePath.replaceAll("/+|\\\\+", "\\\\"); |
| | | } else { |
| | | filePath = filePath.replaceAll("/+|\\\\+", "/"); |
| | | } |
| | | File file = new File(filePath); |
| | | File parentFile = file.getParentFile(); |
| | | if (!parentFile.exists()) { |
| | | parentFile.mkdirs(); |
| | | } |
| | | FileOutputStream fileOutputStream = null; |
| | | try { |
| | | fileOutputStream = new FileOutputStream(file); |
| | | pageTemplate.renderTo(fileOutputStream); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | fileOutputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void start() { |
| | | //配置之间的相互依赖 |
| | | super.initConfig(); |
| | | |
| | | //生成模板 |
| | | if (super.contextConfig.getControllerSwitch()) { |
| | | generateController(); |
| | | } |
| | | if (super.contextConfig.getIndexPageSwitch()) { |
| | | generatePageHtml(); |
| | | } |
| | | if (super.contextConfig.getAddPageSwitch()) { |
| | | generatePageAddHtml(); |
| | | } |
| | | if (super.contextConfig.getEditPageSwitch()) { |
| | | generatePageEditHtml(); |
| | | } |
| | | if (super.contextConfig.getJsSwitch()) { |
| | | generatePageJs(); |
| | | } |
| | | if (super.contextConfig.getInfoJsSwitch()) { |
| | | generatePageInfoJs(); |
| | | } |
| | | if (super.contextConfig.getSqlSwitch()) { |
| | | generateSqls(); |
| | | } |
| | | } |
| | | |
| | | protected abstract void generatePageEditHtml(); |
| | | |
| | | protected abstract void generatePageAddHtml(); |
| | | |
| | | protected abstract void generatePageInfoJs(); |
| | | |
| | | protected abstract void generatePageJs(); |
| | | |
| | | protected abstract void generatePageHtml(); |
| | | |
| | | protected abstract void generateController(); |
| | | |
| | | protected abstract void generateSqls(); |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | /** |
| | | * 全局配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-08 20:21 |
| | | */ |
| | | public class ContextConfig { |
| | | |
| | | private String templatePrefixPath = "gunsTemplate/advanced"; |
| | | private String projectPath = "D:\\ideaSpace\\guns";//模板输出的项目目录 |
| | | private String bizChName; //业务名称 |
| | | private String bizEnName; //业务英文名称 |
| | | private String bizEnBigName;//业务英文名称(大写) |
| | | private String moduleName = "system"; //模块名称 |
| | | |
| | | private String proPackage = "com.stylefeng.guns.admin"; |
| | | private String coreBasePackage = "com.stylefeng.guns.core"; |
| | | private String modelPackageName = "com.stylefeng.guns.modular.system.model"; //model的包名 |
| | | private String modelMapperPackageName = "com.stylefeng.guns.modular.system.dao"; //model的dao |
| | | private String entityName; //实体的名称 |
| | | |
| | | private Boolean controllerSwitch = true; //是否生成控制器代码开关 |
| | | private Boolean indexPageSwitch = true; //主页 |
| | | private Boolean addPageSwitch = true; //添加页面 |
| | | private Boolean editPageSwitch = true; //编辑页面 |
| | | private Boolean jsSwitch = true; //js |
| | | private Boolean infoJsSwitch = true; //详情页面js |
| | | private Boolean daoSwitch = true; //dao |
| | | private Boolean serviceSwitch = true; //service |
| | | private Boolean entitySwitch = true; //生成实体的开关 |
| | | private Boolean sqlSwitch = true; //生成sql的开关 |
| | | |
| | | public void init() { |
| | | if (entityName == null) { |
| | | entityName = bizEnBigName; |
| | | } |
| | | modelPackageName = proPackage + "." + "modular.system.model"; |
| | | modelMapperPackageName = proPackage + "." + "modular.system.dao"; |
| | | } |
| | | |
| | | public String getBizEnBigName() { |
| | | return bizEnBigName; |
| | | } |
| | | |
| | | public void setBizEnBigName(String bizEnBigName) { |
| | | this.bizEnBigName = bizEnBigName; |
| | | } |
| | | |
| | | public String getBizChName() { |
| | | return bizChName; |
| | | } |
| | | |
| | | public void setBizChName(String bizChName) { |
| | | this.bizChName = bizChName; |
| | | } |
| | | |
| | | public String getBizEnName() { |
| | | return bizEnName; |
| | | } |
| | | |
| | | public void setBizEnName(String bizEnName) { |
| | | this.bizEnName = bizEnName; |
| | | this.bizEnBigName = ToolUtil.firstLetterToUpper(this.bizEnName); |
| | | } |
| | | |
| | | public String getProjectPath() { |
| | | return projectPath; |
| | | } |
| | | |
| | | public void setProjectPath(String projectPath) { |
| | | this.projectPath = projectPath; |
| | | } |
| | | |
| | | public String getModuleName() { |
| | | return moduleName; |
| | | } |
| | | |
| | | public void setModuleName(String moduleName) { |
| | | this.moduleName = moduleName; |
| | | } |
| | | |
| | | public Boolean getControllerSwitch() { |
| | | return controllerSwitch; |
| | | } |
| | | |
| | | public void setControllerSwitch(Boolean controllerSwitch) { |
| | | this.controllerSwitch = controllerSwitch; |
| | | } |
| | | |
| | | public Boolean getIndexPageSwitch() { |
| | | return indexPageSwitch; |
| | | } |
| | | |
| | | public void setIndexPageSwitch(Boolean indexPageSwitch) { |
| | | this.indexPageSwitch = indexPageSwitch; |
| | | } |
| | | |
| | | public Boolean getAddPageSwitch() { |
| | | return addPageSwitch; |
| | | } |
| | | |
| | | public void setAddPageSwitch(Boolean addPageSwitch) { |
| | | this.addPageSwitch = addPageSwitch; |
| | | } |
| | | |
| | | public Boolean getEditPageSwitch() { |
| | | return editPageSwitch; |
| | | } |
| | | |
| | | public void setEditPageSwitch(Boolean editPageSwitch) { |
| | | this.editPageSwitch = editPageSwitch; |
| | | } |
| | | |
| | | public Boolean getJsSwitch() { |
| | | return jsSwitch; |
| | | } |
| | | |
| | | public void setJsSwitch(Boolean jsSwitch) { |
| | | this.jsSwitch = jsSwitch; |
| | | } |
| | | |
| | | public Boolean getInfoJsSwitch() { |
| | | return infoJsSwitch; |
| | | } |
| | | |
| | | public void setInfoJsSwitch(Boolean infoJsSwitch) { |
| | | this.infoJsSwitch = infoJsSwitch; |
| | | } |
| | | |
| | | public Boolean getDaoSwitch() { |
| | | return daoSwitch; |
| | | } |
| | | |
| | | public void setDaoSwitch(Boolean daoSwitch) { |
| | | this.daoSwitch = daoSwitch; |
| | | } |
| | | |
| | | public Boolean getServiceSwitch() { |
| | | return serviceSwitch; |
| | | } |
| | | |
| | | public void setServiceSwitch(Boolean serviceSwitch) { |
| | | this.serviceSwitch = serviceSwitch; |
| | | } |
| | | |
| | | public String getTemplatePrefixPath() { |
| | | return templatePrefixPath; |
| | | } |
| | | |
| | | public void setTemplatePrefixPath(String templatePrefixPath) { |
| | | this.templatePrefixPath = templatePrefixPath; |
| | | } |
| | | |
| | | public String getModelPackageName() { |
| | | return modelPackageName; |
| | | } |
| | | |
| | | public void setModelPackageName(String modelPackageName) { |
| | | this.modelPackageName = modelPackageName; |
| | | } |
| | | |
| | | public String getEntityName() { |
| | | return entityName; |
| | | } |
| | | |
| | | public void setEntityName(String entityName) { |
| | | this.entityName = entityName; |
| | | } |
| | | |
| | | public String getModelMapperPackageName() { |
| | | return modelMapperPackageName; |
| | | } |
| | | |
| | | public void setModelMapperPackageName(String modelMapperPackageName) { |
| | | this.modelMapperPackageName = modelMapperPackageName; |
| | | } |
| | | |
| | | public Boolean getEntitySwitch() { |
| | | return entitySwitch; |
| | | } |
| | | |
| | | public void setEntitySwitch(Boolean entitySwitch) { |
| | | this.entitySwitch = entitySwitch; |
| | | } |
| | | |
| | | public Boolean getSqlSwitch() { |
| | | return sqlSwitch; |
| | | } |
| | | |
| | | public void setSqlSwitch(Boolean sqlSwitch) { |
| | | this.sqlSwitch = sqlSwitch; |
| | | } |
| | | |
| | | public String getProPackage() { |
| | | return proPackage; |
| | | } |
| | | |
| | | public void setProPackage(String proPackage) { |
| | | this.proPackage = proPackage; |
| | | } |
| | | |
| | | public String getCoreBasePackage() { |
| | | return coreBasePackage; |
| | | } |
| | | |
| | | public void setCoreBasePackage(String coreBasePackage) { |
| | | this.coreBasePackage = coreBasePackage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 控制器模板生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-07 22:12 |
| | | */ |
| | | public class ControllerConfig { |
| | | |
| | | private ContextConfig contextConfig; |
| | | |
| | | private String controllerPathTemplate; |
| | | private String packageName;//包名称 |
| | | private List<String> imports;//所引入的包 |
| | | |
| | | public void init() { |
| | | ArrayList<String> imports = new ArrayList<>(); |
| | | imports.add(contextConfig.getCoreBasePackage() + ".base.controller.BaseController"); |
| | | imports.add("org.springframework.stereotype.Controller"); |
| | | imports.add("org.springframework.web.bind.annotation.RequestMapping"); |
| | | imports.add("org.springframework.web.bind.annotation.ResponseBody"); |
| | | imports.add("org.springframework.ui.Model"); |
| | | imports.add("org.springframework.web.bind.annotation.PathVariable"); |
| | | imports.add("org.springframework.beans.factory.annotation.Autowired"); |
| | | imports.add(contextConfig.getProPackage() + ".core.log.LogObjectHolder"); |
| | | imports.add("org.springframework.web.bind.annotation.RequestParam"); |
| | | imports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); |
| | | imports.add(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service" + ".I" + contextConfig.getEntityName() + "Service"); |
| | | this.imports = imports; |
| | | this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".controller"; |
| | | this.controllerPathTemplate = "\\src\\main\\java\\"+contextConfig.getProPackage().replaceAll("\\.","\\\\")+"\\modular\\" + contextConfig.getModuleName() + "\\controller\\{}Controller.java"; |
| | | } |
| | | |
| | | public String getPackageName() { |
| | | return packageName; |
| | | } |
| | | |
| | | public void setPackageName(String packageName) { |
| | | this.packageName = packageName; |
| | | } |
| | | |
| | | public List<String> getImports() { |
| | | return imports; |
| | | } |
| | | |
| | | public void setImports(List<String> imports) { |
| | | this.imports = imports; |
| | | } |
| | | |
| | | public String getControllerPathTemplate() { |
| | | return controllerPathTemplate; |
| | | } |
| | | |
| | | public void setControllerPathTemplate(String controllerPathTemplate) { |
| | | this.controllerPathTemplate = controllerPathTemplate; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | /** |
| | | * Dao模板生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-07 22:12 |
| | | */ |
| | | public class DaoConfig { |
| | | |
| | | private ContextConfig contextConfig; |
| | | |
| | | private String daoPathTemplate; |
| | | private String xmlPathTemplate; |
| | | |
| | | private String packageName; |
| | | |
| | | public void init() { |
| | | this.daoPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\dao\\{}Dao.java"; |
| | | this.xmlPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\dao\\mapping\\{}Dao.xml"; |
| | | this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".dao"; |
| | | } |
| | | |
| | | public String getPackageName() { |
| | | return packageName; |
| | | } |
| | | |
| | | public void setPackageName(String packageName) { |
| | | this.packageName = packageName; |
| | | } |
| | | |
| | | public String getDaoPathTemplate() { |
| | | return daoPathTemplate; |
| | | } |
| | | |
| | | public void setDaoPathTemplate(String daoPathTemplate) { |
| | | this.daoPathTemplate = daoPathTemplate; |
| | | } |
| | | |
| | | public String getXmlPathTemplate() { |
| | | return xmlPathTemplate; |
| | | } |
| | | |
| | | public void setXmlPathTemplate(String xmlPathTemplate) { |
| | | this.xmlPathTemplate = xmlPathTemplate; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 |
| | | * </p> |
| | | * |
| | | * @author stylefeng |
| | | * @since 2017-07-11 |
| | | */ |
| | | public class Menu extends Model<Menu> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * 菜单编号 |
| | | */ |
| | | private String code; |
| | | /** |
| | | * 菜单父编号 |
| | | */ |
| | | private String pcode; |
| | | /** |
| | | * 当前菜单的所有父菜单编号 |
| | | */ |
| | | private String pcodes; |
| | | /** |
| | | * 菜单名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 菜单图标 |
| | | */ |
| | | private String icon; |
| | | /** |
| | | * url地址 |
| | | */ |
| | | private String url; |
| | | /** |
| | | * 菜单排序号 |
| | | */ |
| | | private Integer num; |
| | | /** |
| | | * 菜单层级 |
| | | */ |
| | | private Integer levels; |
| | | /** |
| | | * 是否是菜单(1:是 0:不是) |
| | | */ |
| | | private Integer ismenu; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String tips; |
| | | /** |
| | | * 菜单状态 : 1:启用 0:不启用 |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 是否打开: 1:打开 0:不打开 |
| | | */ |
| | | private Integer isopen; |
| | | |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getPcode() { |
| | | return pcode; |
| | | } |
| | | |
| | | public void setPcode(String pcode) { |
| | | this.pcode = pcode; |
| | | } |
| | | |
| | | public String getPcodes() { |
| | | return pcodes; |
| | | } |
| | | |
| | | public void setPcodes(String pcodes) { |
| | | this.pcodes = pcodes; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public Integer getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(Integer num) { |
| | | this.num = num; |
| | | } |
| | | |
| | | public Integer getLevels() { |
| | | return levels; |
| | | } |
| | | |
| | | public void setLevels(Integer levels) { |
| | | this.levels = levels; |
| | | } |
| | | |
| | | public Integer getIsmenu() { |
| | | return ismenu; |
| | | } |
| | | |
| | | public void setIsmenu(Integer ismenu) { |
| | | this.ismenu = ismenu; |
| | | } |
| | | |
| | | public String getTips() { |
| | | return tips; |
| | | } |
| | | |
| | | public void setTips(String tips) { |
| | | this.tips = tips; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getIsopen() { |
| | | return isopen; |
| | | } |
| | | |
| | | public void setIsopen(Integer isopen) { |
| | | this.isopen = isopen; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Menu{" + |
| | | "id=" + id + |
| | | ", code=" + code + |
| | | ", pcode=" + pcode + |
| | | ", pcodes=" + pcodes + |
| | | ", name=" + name + |
| | | ", icon=" + icon + |
| | | ", url=" + url + |
| | | ", num=" + num + |
| | | ", levels=" + levels + |
| | | ", ismenu=" + ismenu + |
| | | ", tips=" + tips + |
| | | ", status=" + status + |
| | | ", isopen=" + isopen + |
| | | "}"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | /** |
| | | * 页面 模板生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-07 22:12 |
| | | */ |
| | | public class PageConfig { |
| | | |
| | | private ContextConfig contextConfig; |
| | | |
| | | private String pagePathTemplate; |
| | | private String pageAddPathTemplate; |
| | | private String pageEditPathTemplate; |
| | | private String pageJsPathTemplate; |
| | | private String pageInfoJsPathTemplate; |
| | | |
| | | public void init() { |
| | | pagePathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}.html"; |
| | | pageAddPathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}_add.html"; |
| | | pageEditPathTemplate = "\\src\\main\\webapp\\WEB-INF\\view\\" + contextConfig.getModuleName() + "\\{}\\{}_edit.html"; |
| | | pageJsPathTemplate = "\\src\\main\\webapp\\static\\modular\\" + contextConfig.getModuleName() + "\\{}\\{}.js"; |
| | | pageInfoJsPathTemplate = "\\src\\main\\webapp\\static\\modular\\" + contextConfig.getModuleName() + "\\{}\\{}_info.js"; |
| | | } |
| | | |
| | | public String getPagePathTemplate() { |
| | | return pagePathTemplate; |
| | | } |
| | | |
| | | public void setPagePathTemplate(String pagePathTemplate) { |
| | | this.pagePathTemplate = pagePathTemplate; |
| | | } |
| | | |
| | | public String getPageJsPathTemplate() { |
| | | return pageJsPathTemplate; |
| | | } |
| | | |
| | | public void setPageJsPathTemplate(String pageJsPathTemplate) { |
| | | this.pageJsPathTemplate = pageJsPathTemplate; |
| | | } |
| | | |
| | | public String getPageAddPathTemplate() { |
| | | return pageAddPathTemplate; |
| | | } |
| | | |
| | | public void setPageAddPathTemplate(String pageAddPathTemplate) { |
| | | this.pageAddPathTemplate = pageAddPathTemplate; |
| | | } |
| | | |
| | | public String getPageEditPathTemplate() { |
| | | return pageEditPathTemplate; |
| | | } |
| | | |
| | | public void setPageEditPathTemplate(String pageEditPathTemplate) { |
| | | this.pageEditPathTemplate = pageEditPathTemplate; |
| | | } |
| | | |
| | | public String getPageInfoJsPathTemplate() { |
| | | return pageInfoJsPathTemplate; |
| | | } |
| | | |
| | | public void setPageInfoJsPathTemplate(String pageInfoJsPathTemplate) { |
| | | this.pageInfoJsPathTemplate = pageInfoJsPathTemplate; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Service模板生成的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-07 22:12 |
| | | */ |
| | | public class ServiceConfig { |
| | | |
| | | private ContextConfig contextConfig; |
| | | |
| | | private String servicePathTemplate; |
| | | private String serviceImplPathTemplate; |
| | | |
| | | private String packageName; |
| | | |
| | | private List<String> serviceInterfaceImports; |
| | | private List<String> serviceImplImports; |
| | | |
| | | public void init() { |
| | | ArrayList<String> imports = new ArrayList<>(); |
| | | imports.add("org.springframework.stereotype.Service"); |
| | | imports.add("com.baomidou.mybatisplus.service.impl.ServiceImpl"); |
| | | imports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); |
| | | imports.add(contextConfig.getModelMapperPackageName() + "." + contextConfig.getEntityName() + "Mapper"); |
| | | imports.add(contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service.I" + contextConfig.getBizEnBigName() + "Service"); |
| | | this.serviceImplImports = imports; |
| | | |
| | | ArrayList<String> interfaceImports = new ArrayList<>(); |
| | | interfaceImports.add("com.baomidou.mybatisplus.service.IService"); |
| | | interfaceImports.add(contextConfig.getModelPackageName() + "." + contextConfig.getEntityName()); |
| | | this.serviceInterfaceImports = interfaceImports; |
| | | |
| | | this.servicePathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\service\\I{}Service.java"; |
| | | this.serviceImplPathTemplate = "\\src\\main\\java\\" + contextConfig.getProPackage().replaceAll("\\.", "\\\\") + "\\modular\\" + contextConfig.getModuleName() + "\\service\\impl\\{}ServiceImpl.java"; |
| | | this.packageName = contextConfig.getProPackage() + ".modular." + contextConfig.getModuleName() + ".service"; |
| | | } |
| | | |
| | | |
| | | public String getServicePathTemplate() { |
| | | return servicePathTemplate; |
| | | } |
| | | |
| | | public void setServicePathTemplate(String servicePathTemplate) { |
| | | this.servicePathTemplate = servicePathTemplate; |
| | | } |
| | | |
| | | public String getPackageName() { |
| | | return packageName; |
| | | } |
| | | |
| | | public void setPackageName(String packageName) { |
| | | this.packageName = packageName; |
| | | } |
| | | |
| | | public String getServiceImplPathTemplate() { |
| | | return serviceImplPathTemplate; |
| | | } |
| | | |
| | | public void setServiceImplPathTemplate(String serviceImplPathTemplate) { |
| | | this.serviceImplPathTemplate = serviceImplPathTemplate; |
| | | } |
| | | |
| | | public List<String> getServiceImplImports() { |
| | | return serviceImplImports; |
| | | } |
| | | |
| | | public void setServiceImplImports(List<String> serviceImplImports) { |
| | | this.serviceImplImports = serviceImplImports; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | |
| | | public List<String> getServiceInterfaceImports() { |
| | | return serviceInterfaceImports; |
| | | } |
| | | |
| | | public void setServiceInterfaceImports(List<String> serviceInterfaceImports) { |
| | | this.serviceInterfaceImports = serviceInterfaceImports; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.generator.engine.config; |
| | | |
| | | import com.baomidou.mybatisplus.toolkit.IdWorker; |
| | | import com.stylefeng.guns.core.constant.IsMenu; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 全局配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2017-05-08 20:21 |
| | | */ |
| | | public class SqlConfig { |
| | | |
| | | private String sqlPathTemplate; |
| | | |
| | | private ContextConfig contextConfig; |
| | | |
| | | private Connection connection; |
| | | |
| | | private String parentMenuName; |
| | | |
| | | private List<Menu> menus = new ArrayList<>(6); |
| | | |
| | | public void init() { |
| | | |
| | | this.sqlPathTemplate = "\\src\\main\\java\\{}.sql"; |
| | | |
| | | if (parentMenuName == null) { |
| | | return; |
| | | } |
| | | |
| | | //根据父菜单查询数据库中的pcode和pcodes |
| | | String[] pcodeAndPcodes = getPcodeAndPcodes(); |
| | | if (pcodeAndPcodes == null) { |
| | | System.err.println("父级菜单名称输入有误!!!!"); |
| | | return; |
| | | } |
| | | |
| | | //业务菜单 |
| | | Menu menu = new Menu(); |
| | | menu.setId(IdWorker.getId()); |
| | | menu.setCode(contextConfig.getBizEnName()); |
| | | menu.setPcode(pcodeAndPcodes[0]); |
| | | menu.setPcodes(pcodeAndPcodes[1] + "[" + pcodeAndPcodes[0] + "],"); |
| | | menu.setName(contextConfig.getBizChName()); |
| | | menu.setIcon(""); |
| | | menu.setUrl("/" + contextConfig.getBizEnName()); |
| | | menu.setNum(99); |
| | | |
| | | if (parentMenuName.equals("顶级")) { |
| | | menu.setLevels(1); |
| | | } else { |
| | | menu.setLevels(2); |
| | | } |
| | | menu.setIsmenu(IsMenu.YES.getCode()); |
| | | menu.setStatus(1); |
| | | menu.setIsopen(0); |
| | | menus.add(menu); |
| | | |
| | | //列表 |
| | | Menu list = createSubMenu(menu); |
| | | list.setCode(contextConfig.getBizEnName() + "_list"); |
| | | list.setName(contextConfig.getBizChName() + "列表"); |
| | | list.setUrl("/" + contextConfig.getBizEnName() + "/list"); |
| | | menus.add(list); |
| | | |
| | | //添加 |
| | | Menu add = createSubMenu(menu); |
| | | add.setCode(contextConfig.getBizEnName() + "_add"); |
| | | add.setName(contextConfig.getBizChName() + "添加"); |
| | | add.setUrl("/" + contextConfig.getBizEnName() + "/add"); |
| | | menus.add(add); |
| | | |
| | | //更新 |
| | | Menu update = createSubMenu(menu); |
| | | update.setCode(contextConfig.getBizEnName() + "_update"); |
| | | update.setName(contextConfig.getBizChName() + "更新"); |
| | | update.setUrl("/" + contextConfig.getBizEnName() + "/update"); |
| | | menus.add(update); |
| | | |
| | | //删除 |
| | | Menu delete = createSubMenu(menu); |
| | | delete.setCode(contextConfig.getBizEnName() + "_delete"); |
| | | delete.setName(contextConfig.getBizChName() + "删除"); |
| | | delete.setUrl("/" + contextConfig.getBizEnName() + "/delete"); |
| | | menus.add(delete); |
| | | |
| | | //详情 |
| | | Menu detail = createSubMenu(menu); |
| | | detail.setCode(contextConfig.getBizEnName() + "_detail"); |
| | | detail.setName(contextConfig.getBizChName() + "详情"); |
| | | detail.setUrl("/" + contextConfig.getBizEnName() + "/detail"); |
| | | menus.add(detail); |
| | | } |
| | | |
| | | private Menu createSubMenu(Menu parentMenu) { |
| | | Menu menu = new Menu(); |
| | | menu.setId(IdWorker.getId()); |
| | | menu.setPcode(parentMenu.getCode()); |
| | | menu.setPcodes(parentMenu.getPcodes() + "[" + parentMenu.getCode() + "],"); |
| | | menu.setIcon(""); |
| | | menu.setNum(99); |
| | | menu.setLevels(parentMenu.getLevels() + 1); |
| | | menu.setIsmenu(IsMenu.NO.getCode()); |
| | | menu.setStatus(1); |
| | | menu.setIsopen(0); |
| | | return menu; |
| | | } |
| | | |
| | | public String[] getPcodeAndPcodes() { |
| | | if (parentMenuName.equals("顶级")) { |
| | | return new String[]{"0", ""}; |
| | | } |
| | | PreparedStatement preparedStatement = null; |
| | | try { |
| | | preparedStatement = connection.prepareStatement("select * from sys_menu where name like ?"); |
| | | preparedStatement.setString(1, "%" + parentMenuName + "%"); |
| | | ResultSet results = preparedStatement.executeQuery(); |
| | | while (results.next()) { |
| | | String pcode = results.getString("code"); |
| | | String pcodes = results.getString("pcodes"); |
| | | if (ToolUtil.isNotEmpty(pcode) && ToolUtil.isNotEmpty(pcodes)) { |
| | | String[] strings = {pcode, pcodes}; |
| | | return strings; |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 释放资源 |
| | | try { |
| | | if (preparedStatement != null) { |
| | | preparedStatement.close(); |
| | | } |
| | | if (connection != null) { |
| | | connection.close(); |
| | | } |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public ContextConfig getContextConfig() { |
| | | return contextConfig; |
| | | } |
| | | |
| | | public void setContextConfig(ContextConfig contextConfig) { |
| | | this.contextConfig = contextConfig; |
| | | } |
| | | |
| | | public String getParentMenuName() { |
| | | return parentMenuName; |
| | | } |
| | | |
| | | public void setParentMenuName(String parentMenuName) { |
| | | this.parentMenuName = parentMenuName; |
| | | } |
| | | |
| | | public Connection getConnection() { |
| | | return connection; |
| | | } |
| | | |
| | | public void setConnection(Connection connection) { |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public String getSqlPathTemplate() { |
| | | return sqlPathTemplate; |
| | | } |
| | | |
| | | public void setSqlPathTemplate(String sqlPathTemplate) { |
| | | this.sqlPathTemplate = sqlPathTemplate; |
| | | } |
| | | |
| | | public List<Menu> getMenus() { |
| | | return menus; |
| | | } |
| | | |
| | | public void setMenus(List<Menu> menus) { |
| | | this.menus = menus; |
| | | } |
| | | } |