| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.lettuce</groupId> |
| | | <artifactId>lettuce-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.penggle</groupId> |
| | |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | |
| | | <!--打包jar包方式--> |
| | | <plugins> |
| | | <plugin> |
| | |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("黔云通 Doc") |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | .title("黔云通 Doc") |
| | | .description("所有接口前需要加 /driver 前缀,例如:/driver/base/agreement/queryByType <br>所有以 /api/*** 路径的接口需要上传签名参数sign") |
| | | // .termsOfServiceUrl("http://git.oschina.net/naan1993/guns") |
| | | .contact("stylefeng") |
| | | .contact(new Contact("", "", "")) |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | |
| | | }) |
| | | public ResultUtil isElectronicLede(HttpServletRequest request){ |
| | | try { |
| | | Integer driverId = driverService.getUserIdFormRedis(request); |
| | | if(null == driverId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(driverId); |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", driver.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | return ResultUtil.success("yes"); |
| | | } |
| | | //临时关闭 |
| | | // Integer driverId = driverService.getUserIdFormRedis(request); |
| | | // if(null == driverId){ |
| | | // return ResultUtil.tokenErr(); |
| | | // } |
| | | // Driver driver = driverService.selectById(driverId); |
| | | // List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", driver.getPhone())); |
| | | // if(userWithdrawals.size()==0){ |
| | | // return ResultUtil.success("yes"); |
| | | // } |
| | | return ResultUtil.success("no"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.InputStream; |
| | |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/base/driver/uploadImg", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "上传图片", tags = {"司机端-注册"}, notes = "") |
| | | // public ResultUtil uploadImg(MultipartFile file) { |
| | | // try { |
| | | // String bucketName = "grjy_test"; |
| | | // Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | | // if (null == grjyTest) { |
| | | // //创建桶 |
| | | // Boolean bucket = NCOSSUtil.createBucket(bucketName); |
| | | // if (!bucket) { |
| | | // return ResultUtil.error("创建存储桶失败"); |
| | | // } |
| | | // //设置桶策略 |
| | | // String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"]" + |
| | | // ",\"Effect\":\"Allow\",\"Resource\":[\"" + bucketName + "\"/*],\"Principal\":{*}}]}"; |
| | | // Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); |
| | | // if (!bucketPolicy) { |
| | | // return ResultUtil.error("设置桶策略失败"); |
| | | // } |
| | | // } |
| | | // //上传对象 |
| | | // String key = "image/driver/" + UUID.randomUUID().toString() + ".png"; |
| | | // String object = NCOSSUtil.putObject(bucketName, key, file.getInputStream()); |
| | | // if (null == object) { |
| | | // return ResultUtil.error("上传图片失败"); |
| | | // } |
| | | // |
| | | // return ResultUtil.success("http://" + QianYunTongProperties.endPoint + "/" + key); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | // } |
| | | } |
| | |
| | | |
| | | @Resource |
| | | private LineShiftMapper lineShiftMapper; |
| | | |
| | | |
| | | @Resource |
| | | private LocationMapper locationMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private DateUtil dateUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据线路id获取排班数据 |
| | | * @param lineId |
| | |
| | | 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.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Resource |
| | | private OrderPrivateCarMapper orderPrivateCarMapper; |
| | | |
| | | |
| | | @Resource |
| | | private OrderTaxiMapper orderTaxiMapper; |
| | | |
| | | |
| | | @Resource |
| | | private PhoneMapper phoneMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | |
| | | @Autowired |
| | | private GeodesyUtil geodesyUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderAdditionalFeeService orderAdditionalFeeService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IMerchantActivityService merchantActivityService; |
| | | |
| | | |
| | | @Autowired |
| | | private IMerchantActivitySlaveService merchantActivitySlaveService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserMerchantCouponService userMerchantCouponService; |
| | | |
| | | |
| | | @Autowired |
| | | private IMerchantCouponService merchantCouponService; |
| | | @Autowired |
| | | private QrCodeConfiguration qrCodeConfiguration; |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | |
| | | orderPosition.setInsertTime(new Date()); |
| | | //将数据存储到文件中 |
| | | List<OrderPosition> orderPositions = orderPositionService.queryPosition(orderCrossCity.getId(), 3); |
| | | File file = new File(filePath + orderCrossCity.getId() + "_3" + ".txt"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | orderPositions.add(orderPosition); |
| | | System.err.println("存储新数据:" + JSON.toJSONString(orderPositions)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | mongoTemplate.save(orderPositions); |
| | | } |
| | | } |
| | | return false;//上层不需要处理 |
| | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsSpreadService orderLogisticsSpreadService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | | |
| | | |
| | | @Resource |
| | | private UserInfoMapper userInfoMapper; |
| | | |
| | |
| | | @Resource |
| | | private CarServiceMapper carServiceMapper; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | |
| | | /** |
| | | * 获取司机端首页订单列表 |
| | | * @param state 1=服务中,2=待服务(30分钟定义预约) |
| | | * |
| | | * @param state 1=服务中,2=待服务(30分钟定义预约) |
| | | * @param driverId |
| | | * @return |
| | | * @throws Exception |
| | |
| | | |
| | | |
| | | <select id="queryByPhone" resultType="Driver"> |
| | | select |
| | | id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phone as phone, |
| | | password as password, |
| | | name as name, |
| | | sex as sex, |
| | | idCard as idCard, |
| | | companyId as companyId, |
| | | franchiseeId as franchiseeId, |
| | | headImgUrl as headImgUrl, |
| | | faceImgUrl as faceImgUrl, |
| | | idCardImgUrl1 as idCardImgUrl1, |
| | | idCardImgUrl2 as idCardImgUrl2, |
| | | placeOfEmployment as placeOfEmployment, |
| | | birthday as birthday, |
| | | bankCardNumber as bankCardNumber, |
| | | driverNationality as driverNationality, |
| | | driverNation as driverNation, |
| | | driverMaritalStatus as driverMaritalStatus, |
| | | driverLanguageLevel as driverLanguageLevel, |
| | | driverEducation as driverEducation, |
| | | driverCensus as driverCensus, |
| | | driverAddress as driverAddress, |
| | | driverContactAddress as driverContactAddress, |
| | | driverAge as driverAge, |
| | | driveCard as driveCard, |
| | | driveCardImgUrl as driveCardImgUrl, |
| | | driverType as driverType, |
| | | getDriverLicenseDate as getDriverLicenseDate, |
| | | driverLicenseOn as driverLicenseOn, |
| | | driverLicenseOff as driverLicenseOff, |
| | | taxiDriver as taxiDriver, |
| | | taxiAptitudeCard as taxiAptitudeCard, |
| | | networkCarlssueImg as networkCarlssueImg, |
| | | networkCarlssueOrganization as networkCarlssueOrganization, |
| | | networkCarlssueDate as networkCarlssueDate, |
| | | getNetworkCarProofDate as getNetworkCarProofDate, |
| | | networkCarProofOn as networkCarProofOn, |
| | | networkCarProofOff as networkCarProofOff, |
| | | registerDate as registerDate, |
| | | fullTimeDriver as fullTimeDriver, |
| | | inDriverBlacklist as inDriverBlacklist, |
| | | commercialType as commercialType, |
| | | contractCompany as contractCompany, |
| | | contractOn as contractOn, |
| | | contractOff as contractOff, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactPhone as emergencyContactPhone, |
| | | emergencyContactAddress as emergencyContactAddress, |
| | | remark as remark, |
| | | isPlatCar as isPlatCar, |
| | | carId as carId, |
| | | authState as authState, |
| | | state as state, |
| | | addType as addType, |
| | | balance as balance, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_driver where flag != 3 and authState != 4 and phone = #{phone} |
| | | select id as id, |
| | | account as account, |
| | | jobNumber as jobNumber, |
| | | phone as phone, |
| | | password as password, |
| | | name as name, |
| | | sex as sex, |
| | | idCard as idCard, |
| | | companyId as companyId, |
| | | franchiseeId as franchiseeId, |
| | | headImgUrl as headImgUrl, |
| | | faceImgUrl as faceImgUrl, |
| | | idCardImgUrl1 as idCardImgUrl1, |
| | | idCardImgUrl2 as idCardImgUrl2, |
| | | placeOfEmployment as placeOfEmployment, |
| | | birthday as birthday, |
| | | bankCardNumber as bankCardNumber, |
| | | driverNationality as driverNationality, |
| | | driverNation as driverNation, |
| | | driverMaritalStatus as driverMaritalStatus, |
| | | driverLanguageLevel as driverLanguageLevel, |
| | | driverEducation as driverEducation, |
| | | driverCensus as driverCensus, |
| | | driverAddress as driverAddress, |
| | | driverContactAddress as driverContactAddress, |
| | | driverAge as driverAge, |
| | | driveCard as driveCard, |
| | | driveCardImgUrl as driveCardImgUrl, |
| | | driverType as driverType, |
| | | getDriverLicenseDate as getDriverLicenseDate, |
| | | driverLicenseOn as driverLicenseOn, |
| | | driverLicenseOff as driverLicenseOff, |
| | | taxiDriver as taxiDriver, |
| | | taxiAptitudeCard as taxiAptitudeCard, |
| | | networkCarlssueImg as networkCarlssueImg, |
| | | networkCarlssueOrganization as networkCarlssueOrganization, |
| | | networkCarlssueDate as networkCarlssueDate, |
| | | getNetworkCarProofDate as getNetworkCarProofDate, |
| | | networkCarProofOn as networkCarProofOn, |
| | | networkCarProofOff as networkCarProofOff, |
| | | registerDate as registerDate, |
| | | fullTimeDriver as fullTimeDriver, |
| | | inDriverBlacklist as inDriverBlacklist, |
| | | commercialType as commercialType, |
| | | contractCompany as contractCompany, |
| | | contractOn as contractOn, |
| | | contractOff as contractOff, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactPhone as emergencyContactPhone, |
| | | emergencyContactAddress as emergencyContactAddress, |
| | | remark as remark, |
| | | isPlatCar as isPlatCar, |
| | | carId as carId, |
| | | authState as authState, |
| | | state as state, |
| | | addType as addType, |
| | | balance as balance, |
| | | activityMoney as activityMoney, |
| | | laveActivityMoney as laveActivityMoney, |
| | | businessMoney as businessMoney, |
| | | laveBusinessMoney as laveBusinessMoney, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser, |
| | | empId, |
| | | enterId, |
| | | entercode |
| | | from t_driver |
| | | where flag != 3 and authState != 4 and phone = #{phone} |
| | | </select> |
| | | |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 订单坐标信息表 |
| | | * |
| | | * @author Pu Zhibing |
| | | */ |
| | | @TableName("t_order_position") |
| | | @Data |
| | | @Document(collection = "order_position") |
| | | public class OrderPosition { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableField("id") |
| | | private Integer id; |
| | | /** |
| | | * 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | */ |
| | | @TableField("orderType") |
| | | private Integer orderType; |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("orderId") |
| | | private Integer orderId; |
| | | /** |
| | | * 司机id |
| | | */ |
| | | @TableField("driverId") |
| | | private Integer driverId; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @TableField("lon") |
| | | private String lon; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @TableField("lat") |
| | | private String lat; |
| | | /** |
| | | * 方向角 |
| | | */ |
| | | @TableField("directionAngle") |
| | | private String directionAngle; |
| | | /** |
| | | * 海拔 |
| | | */ |
| | | @TableField("altitude") |
| | | private String altitude; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getOrderType() { |
| | | return orderType; |
| | | } |
| | | |
| | | public void setOrderType(Integer orderType) { |
| | | this.orderType = orderType; |
| | | } |
| | | |
| | | public Integer getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(Integer orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public Integer getDriverId() { |
| | | return driverId; |
| | | } |
| | | |
| | | public void setDriverId(Integer driverId) { |
| | | this.driverId = driverId; |
| | | } |
| | | |
| | | public String getLon() { |
| | | return lon; |
| | | } |
| | | |
| | | public void setLon(String lon) { |
| | | this.lon = lon; |
| | | } |
| | | |
| | | public String getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(String lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public String getDirectionAngle() { |
| | | return directionAngle; |
| | | } |
| | | |
| | | public void setDirectionAngle(String directionAngle) { |
| | | this.directionAngle = directionAngle; |
| | | } |
| | | |
| | | public String getAltitude() { |
| | | return altitude; |
| | | } |
| | | |
| | | public void setAltitude(String altitude) { |
| | | this.altitude = altitude; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OrderPosition{" + |
| | | "id=" + id + |
| | | ", orderType=" + orderType + |
| | | ", orderId=" + orderId + |
| | | ", driverId=" + driverId + |
| | | ", lon='" + lon + '\'' + |
| | | ", lat='" + lat + '\'' + |
| | | ", directionAngle='" + directionAngle + '\'' + |
| | | ", altitude='" + altitude + '\'' + |
| | | ", insertTime=" + insertTime + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | @Resource |
| | | private DriverOrdersMapper driverOrdersMapper; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private ALiSendSms aLiSendSms; |
| | |
| | | |
| | | @Service |
| | | public class NettyServiceImpl implements INettyService { |
| | | |
| | | |
| | | @Resource |
| | | private DriverWorkMapper driverWorkMapper; |
| | | |
| | | |
| | | @Resource |
| | | private PushOrderMapper pushOrderMapper; |
| | | |
| | | |
| | | @Resource |
| | | private PushAuxiliaryMapper pushAuxiliaryMapper; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderTaxiService orderTaxiService; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverOrdersService driverOrdersService; |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.OrderPositionMapper; |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.IOrderPositionService; |
| | | import com.stylefeng.guns.modular.system.service.IOrderService; |
| | | import com.stylefeng.guns.modular.system.util.GDMapElectricFenceUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | 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.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class OrderPositionServiceImpl extends ServiceImpl<OrderPositionMapper, OrderPosition> implements IOrderPositionService { |
| | | |
| | | |
| | | @Resource |
| | | private OrderPositionMapper orderPositionMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加数据 |
| | | * |
| | | * @param orderPosition |
| | | * @throws Exception |
| | | */ |
| | |
| | | orderPosition.setInsertTime(new Date()); |
| | | //将数据存储到文件中 |
| | | List<OrderPosition> orderPositions = this.queryPosition(orderPosition.getOrderId(), orderPosition.getOrderType()); |
| | | File file = new File(filePath + orderPosition.getOrderId() + "_" + orderPosition.getOrderType() + ".txt"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | file.setReadable(true, false);//设置读取权限 |
| | | file.setWritable(true, false);//设置写入权限 |
| | | |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | orderPositions.add(orderPosition); |
| | | System.err.println("存储新数据:" + JSON.toJSONString(orderPositions)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | mongoTemplate.save(orderPositions); |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | List<OrderPosition> orderPositions = this.queryPosition(orderId, orderType); |
| | | return orderPositions.size() > 0 ? orderPositions.get(orderPositions.size() - 1) : null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取坐标文件中的坐标数据 |
| | | * |
| | | * @param orderId |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<OrderPosition> queryPosition(Integer orderId, Integer orderType) throws Exception{ |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderId + "_" + orderType + ".txt"); |
| | | if(!file.exists()){ |
| | | return new ArrayList<>(); |
| | | } |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<OrderPosition> list = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(sb.toString())){ |
| | | list = JSONArray.parseArray(sb.toString(), OrderPosition.class); |
| | | } |
| | | System.err.println("坐标:" + sb); |
| | | return list; |
| | | public List<OrderPosition> queryPosition(Integer orderId, Integer orderType) throws Exception { |
| | | Query query = new Query() |
| | | .addCriteria(Criteria.where("orderId").is(orderId).and("orderType").is(orderType)) |
| | | .with(new Sort(Sort.Direction.ASC, "insertTime")); |
| | | List<OrderPosition> positions = mongoTemplate.find(query, OrderPosition.class); |
| | | return positions; |
| | | } |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | @Autowired |
| | | private TaskUtil taskUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private SystemPriceMapper systemPriceMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Resource |
| | | private ServerCarModelMapper serverCarModelMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private ITransactionDetailsService transactionDetailsService; |
| | | |
| | | |
| | | @Autowired |
| | | private GeodesyUtil geodesyUtil; |
| | | |
| | | |
| | | private String path = "http://120.77.11.218:8868/"; |
| | | |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | 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 org.springframework.stereotype.Component; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @Autowired |
| | | private IOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderLogisticsService orderLogisticsService; |
| | | |
| | | |
| | | private Map<String, Timer> taskMap = new HashMap<>();//存储定时推送的定时器 |
| | | |
| | | |
| | | |
| | | |
| | | private final String socket_uri = "http://172.21.35.142:6000"; |
| | | |
| | | |
| | | /** |
| | | * 推送订单状态 |
| | | * @param type 1=用户,2=司机 |
| | | * @param uid 对象id |
| | | * @param orderId 订单id |
| | | * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | * @param state 订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中) |
| | | * |
| | | * @param type 1=用户,2=司机 |
| | | * @param uid 对象id |
| | | * @param orderId 订单id |
| | | * @param orderType 订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车) |
| | | * @param state 订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中) |
| | | */ |
| | | public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state){ |
| | | public void pushOrderState(Integer type, Integer uid, Integer orderId, Integer orderType, Integer state) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code", 200); |
| | | jsonObject.put("msg", "SUCCESS"); |
| | |
| | | map.put("orderType", orderType); |
| | | map.put("state", state); |
| | | jsonObject.put("data", map); |
| | | |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", jsonObject.toJSONString()); |
| | | params.put("id", uid); |
| | | params.put("type", type); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | map.put("orderId", orderId); |
| | | map.put("orderType", orderType); |
| | | jsonObject.put("data", map); |
| | | |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | System.out.println("result:"+s); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", jsonObject.toJSONString()); |
| | | params.put("id", uid); |
| | | params.put("type", type); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | map.put("laveMileage", d);//距离终点剩余未服务的里程数 |
| | | map.put("laveTime", t);//距离终端剩余未服务的预计时间 |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | msg.put("data", map); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | //将请求头部和参数合成一个请求 |
| | | |
| | | String value1 = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType); |
| | | if(ToolUtil.isEmpty(value1)){ |
| | | if (ToolUtil.isEmpty(value1)) { |
| | | this.removeTask(orderId, orderType); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(value1); |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", jsonObject.getString("id")); |
| | | params.add("type", jsonObject.getString("type")); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | |
| | | //调用推送 |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", msg.toJSONString()); |
| | | params.put("id", jsonObject.getIntValue("id")); |
| | | params.put("type", jsonObject.getIntValue("type")); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * @param id |
| | | * @param type |
| | | */ |
| | | public void pushOffline(Integer id, Integer type){ |
| | | public void pushOffline(Integer id, Integer type) { |
| | | JSONObject msg = new JSONObject(); |
| | | msg.put("code", 200); |
| | | msg.put("msg", "SUCCESS"); |
| | | msg.put("method", "OFFLINE"); |
| | | msg.put("data", new Object()); |
| | | |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", msg.toJSONString()); |
| | | params.add("id", id.toString()); |
| | | params.add("type", type.toString()); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", msg.toJSONString()); |
| | | params.put("id", id); |
| | | params.put("type", type); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | map.put("orderType", orderType); |
| | | map.put("state", state); |
| | | jsonObject.put("data", map); |
| | | |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", jsonObject.toJSONString()); |
| | | params.put("id", uid); |
| | | params.put("type", type); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | map.put("orderType", orderType); |
| | | map.put("money", money); |
| | | jsonObject.put("data", map); |
| | | |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | HttpRequest post = HttpUtil.createPost(socket_uri + "/netty/sendMsgToClient"); |
| | | post.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); |
| | | //将请求头部和参数合成一个请求 |
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); |
| | | params.add("msg", jsonObject.toJSONString()); |
| | | params.add("id", String.valueOf(uid)); |
| | | params.add("type", String.valueOf(type)); |
| | | HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("msg", jsonObject.toJSONString()); |
| | | params.put("id", uid); |
| | | params.put("type", type); |
| | | post.form(params); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | System.err.println("推送异常"); |
| | | } else { |
| | | JSONObject jsonObject1 = JSON.parseObject(execute.body(), JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | log.error("【企业增加员工】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【企业增加员工】失败:" + object.toJSONString()); |
| | | } |
| | | SaveStaffNode saveStaffNode = jsonObject.getObject("object", SaveStaffNode.class); |
| | | SaveStaffNode saveStaffNode = jsonObject.getObject("data", SaveStaffNode.class); |
| | | return saveStaffNode; |
| | | } |
| | | |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据员工ID获取人员信息】请求失败:" + result); |
| | | throw new RuntimeException("【根据员工ID获取人员信息】请求失败:" + result); |
| | | return null; |
| | | } |
| | | 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()); |
| | | return null; |
| | | } |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据社会信用代码判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据社会信用代码判断企业是否已存在】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据社会信用代码判断企业是否已存在】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据社会信用代码判断企业是否已存在】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据企业名称判断企业是否已存在】请求失败:" + result); |
| | | throw new RuntimeException("【根据企业名称判断企业是否已存在】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据企业名称判断企业是否已存在】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据企业名称判断企业是否已存在】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | return jsonObject.getObject("object", CheckEnterExist.class); |
| | | } |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【查询企业详情】请求失败:" + result); |
| | | throw new RuntimeException("【查询企业详情】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【查询企业详情】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【查询企业详情】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | EnterpriseInfo enterpriseInfo = jsonObject.getObject("object", EnterpriseInfo.class); |
| | | return enterpriseInfo; |
| | |
| | | String status = jsonObject.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【修改企业基本信息】请求失败:" + result); |
| | | return false; |
| | | throw new RuntimeException("【修改企业基本信息】请求失败:" + result); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 删除企业信息 |
| | | * |
| | | * @param enterNum 企业编号 |
| | | * @param operator 管理员手机号码 |
| | | * @return |
| | | */ |
| | | public static boolean delEnterprise(String enterNum, String operator) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/delCompany"; |
| | | //私钥文件 |
| | | 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<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", "{\"enterNum\":\"" + enterNum + "\",\"operator\":\"" + operator + "\"}"); |
| | | |
| | | 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 true; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | // request.setName("成都喜望科技有限公司"); |
| | | // request.setNickName("成都喜望"); |
| | | // request.setIndustry_code("123456789"); |
| | | // request.setMobile("18200000000"); |
| | | // request.setMobileFlag("1"); |
| | | // EnterpriseUtil.createEnterprise(request); |
| | | |
| | | // EnterpriseUtil.delEnterprise("981100006005878", "15828353127"); |
| | | |
| | | |
| | | //短信 |
| | | // SMSUtil.sendVerifyCode("15828353127"); |
| | | |
| | | // CheckEnterExist checkEnterNameExist = EnterpriseUtil.checkEnterNameExist("成都喜望科技有限公司"); |
| | | |
| | | // EnterpriseInfo enterpriseDetail = EnterpriseUtil.getEnterpriseDetail(checkEnterNameExist.getEnterCode()); |
| | | // System.out.println(enterpriseDetail); |
| | | |
| | | // List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone("15828353127", "981100006005878"); |
| | | |
| | | // RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setPassword("123456"); |
| | | // request.setNickname("测试"); |
| | | // request.setVerify_code("1111"); |
| | | // request.setVerify_code_type("1"); |
| | | // RegisterViaMobile registerViaMobile = UserUtil.registerViaMobile(request); |
| | | |
| | | // ModifyPwdRequest request = new ModifyPwdRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setOldPwd("111111"); |
| | | // request.setNewPwd("654321"); |
| | | // request.setCode("1111"); |
| | | // UserUtil.modifyPwd(request); |
| | | |
| | | // ResetPwdRequest request = new ResetPwdRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setPassword("654321"); |
| | | // request.setCode("1111"); |
| | | // UserUtil.resetPwd(request); |
| | | |
| | | // SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // request.setEmpName("超级管理员"); |
| | | // request.setEmpNickname("超级管理员"); |
| | | // request.setLoginNo("18200000000"); |
| | | // request.setEmpSex("男"); |
| | | // request.setMphone("18200000000"); |
| | | // request.setEmail("sn93@qq.com"); |
| | | // request.setDeptId(0); |
| | | // request.setPositionId(1); |
| | | // request.setSuperLevel(0); |
| | | // request.setHideMobile(0); |
| | | // EmployeeUtil.saveStaffNode(request); |
| | | |
| | | //接口参数有问题 |
| | | EditStaffNodeRequest request = new EditStaffNodeRequest(); |
| | | request.setEmpId(11448071); |
| | | request.setMobile("15828353127"); |
| | | request.setEntercode("981100006005901"); |
| | | request.setEnterId(981100006005901L); |
| | | request.setEmpName("蒲师傅"); |
| | | request.setEmpNickname("蒲师傅"); |
| | | request.setLoginNo("15828353127"); |
| | | request.setMphone("15828353127"); |
| | | request.setEmail("393733352@qq.com"); |
| | | request.setEmpSex("男"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | EmployeeUtil.editStaffNode(request); |
| | | |
| | | |
| | | // GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | // request.setEmpId(11448036L); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // EmployeeUtil.getStaffNode(request); |
| | | |
| | | |
| | | // DeleteStafNodeRequest request = new DeleteStafNodeRequest(); |
| | | // request.setEmpId(11448036); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // EmployeeUtil.ecrmDeleteStafNode(request); |
| | | } |
| | | |
| | | /** |
| | | * 创建企业 |
| | |
| | | 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>(); |
| | |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | throw new RuntimeException("【创建企业】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【创建企业】请求失败:" + result); |
| | | return null; |
| | | log.error("【创建企业】请求失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【创建企业】请求失败:" + object.toJSONString()); |
| | | } |
| | | return object.getObject("data", CreateEnterprise.class); |
| | | } |
New file |
| | |
| | | //package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | // |
| | | //import com.heredata.hos.HOS; |
| | | //import com.heredata.hos.HOSClientBuilder; |
| | | //import com.heredata.hos.model.CreateBucketRequest; |
| | | //import com.heredata.hos.model.HOSObject; |
| | | //import com.heredata.hos.model.PutObjectRequest; |
| | | //import com.heredata.hos.model.PutObjectResult; |
| | | //import com.heredata.hos.model.bucket.Bucket; |
| | | //import com.heredata.model.VoidResult; |
| | | //import lombok.extern.slf4j.Slf4j; |
| | | // |
| | | //import java.io.InputStream; |
| | | // |
| | | ///** |
| | | // * OSS 工具类 |
| | | // * @author zhibing.pu |
| | | // * @Date 2025/6/23 17:50 |
| | | // */ |
| | | //@Slf4j |
| | | //public class NCOSSUtil { |
| | | // |
| | | // /** |
| | | // * 创建桶 |
| | | // * @param bucketName |
| | | // * @return |
| | | // */ |
| | | // public static Boolean createBucket(String bucketName) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // // 创建请求对象,并且设置创建桶名为"example"的桶 |
| | | // CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); |
| | | // VoidResult result = hos.createBucket(createBucketRequest); |
| | | // if (result.getResponse().isSuccessful()) { |
| | | // log.info("创建桶成功:" + bucketName); |
| | | // return true; |
| | | // } |
| | | // } catch (Exception e){ |
| | | // log.info("创建桶失败:" + bucketName); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return false; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 查询桶详情 |
| | | // * @param bucketName |
| | | // * @return |
| | | // */ |
| | | // public static Bucket getBucketInfo(String bucketName) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // // 查询桶名为"example"的详情 |
| | | // Bucket bucket = hos.getBucketInfo(bucketName); |
| | | // return bucket; |
| | | // } catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 删除桶 |
| | | // * @param bucketName |
| | | // * @return |
| | | // */ |
| | | // public static Boolean deleteBucket(String bucketName) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // VoidResult result = hos.deleteBucket(bucketName); |
| | | // if (result.getResponse().isSuccessful()) { |
| | | // log.info("删除桶成功:" + bucketName); |
| | | // return true; |
| | | // } |
| | | // } catch (Exception e){ |
| | | // log.info("删除桶成功:" + bucketName); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return false; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 设置桶策略 |
| | | // * @param bucketName 桶名 |
| | | // * @param policyText 策略规则字符串 |
| | | // * { |
| | | // * // 策略配置的版本号,由用户定义 |
| | | // * "Version": "2012-10-17", |
| | | // * // 策略规则配置,可指定多条策略规则 |
| | | // * "Statement": [{ |
| | | // * // 策略规则ID,可用户指定,如不指定则服务自动生成一条 |
| | | // * "Sid": "sid", |
| | | // * // 策略规则指定的HOS API接口标识,可参照下表填写 |
| | | // * "Action": [ |
| | | // * "action" |
| | | // * ], |
| | | // * // 策略规则效果,具体表现为允许或拒绝,有效值为Allow(允许),Deny(拒绝); |
| | | // * "Effect": "Allow", |
| | | // * // 策略规则指定的资源参照下面resource配置 |
| | | // * "Resource": "resource", |
| | | // * // 策略规则指定的授权人 参照下面Principal配置 |
| | | // * "Principal": { |
| | | // * "HWS": [ |
| | | // * "account_id:root" |
| | | // * ] |
| | | // * } |
| | | // * } |
| | | // * ] |
| | | // * } |
| | | // * @return |
| | | // */ |
| | | // public static Boolean setBucketPolicy(String bucketName, String policyText) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // // 桶策略字符串 |
| | | // try { |
| | | // VoidResult result = hos.setBucketPolicy(bucketName, policyText); |
| | | // if (result.getResponse().isSuccessful()) { |
| | | // log.info("设置桶策略成功:" + bucketName); |
| | | // return true; |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.info("设置桶策略失败:" + bucketName); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return false; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 上传对象 |
| | | // * @param bucketName 桶名称 |
| | | // * @param key 存储文件名 |
| | | // * @param inputStream 上传文件流 |
| | | // * @return 对象唯一标识 |
| | | // */ |
| | | // public static String putObject(String bucketName, String key, InputStream inputStream) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key , inputStream); |
| | | // PutObjectResult example = hos.putObject(putObjectRequest); |
| | | // if (example.getResponse().isSuccessful()) { |
| | | // log.info("上传对象成功:" + bucketName + "--->" + key); |
| | | // return example.getETag(); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.info("上传对象成功:" + bucketName); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 查询对象 |
| | | // * @param bucketName 桶名称 |
| | | // * @param key 存储文件名 |
| | | // * @return |
| | | // */ |
| | | // public static HOSObject getObject(String bucketName, String key) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // HOSObject example = hos.getObject(bucketName, key); |
| | | // if (example.getResponse().isSuccessful()) { |
| | | // log.info("查询对象成功:" + bucketName + "--->" + key); |
| | | // return example; |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.info("查询对象失败:" + bucketName); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * 删除对象 |
| | | // * @param bucketName 桶名称 |
| | | // * @param key 存储文件名 |
| | | // * @return |
| | | // */ |
| | | // public static Boolean deleteObject(String bucketName, String key) { |
| | | // /** |
| | | // * endPoint:HOS的基础路径(公共前缀) |
| | | // * account:账户的ID |
| | | // * accessKey:向UAAS服务请求到的access_key |
| | | // * secretKey:向UAAS服务请求到的secret_key |
| | | // */ |
| | | // HOS hos = new HOSClientBuilder().build(QianYunTongProperties.endPoint, QianYunTongProperties.account, QianYunTongProperties.accessKey, QianYunTongProperties.secretKey); |
| | | // try { |
| | | // VoidResult example = hos.deleteObject(bucketName, key); |
| | | // if (example.getResponse().isSuccessful()) { |
| | | // log.info("删除对象成功:" + bucketName + "--->" + key); |
| | | // return true; |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.info("删除对象失败:" + bucketName + "--->" + key); |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return false; |
| | | // } |
| | | //} |
| | |
| | | |
| | | /** |
| | | * 黔云通配置 |
| | | * |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 15:03 |
| | | */ |
| | | public interface QianYunTongProperties { |
| | | /** |
| | | * 小程序appId |
| | | */ |
| | | String appId = "wxcc3c9058e2b294db"; |
| | | /** |
| | | * |
| | | */ |
| | | String encryptedData = "645HaSm7meo0GLKQZZvagq3JkWZXYlOfvhf8YKqNjWklpzx3IjM2S/wkmlUOz/iPvDVYRgBD2+V1WCHT6fMbOjJnR/0W9bwVGOSSaoyYpZdPR5x8f/6OR1B3e3qfJWFKJf0Za4n9JJTwStCTuMHWRIE0IgYtj3zSb2WI1AzDyLeR7MMgW0q+red2ujtrKGR4pe0NoXB2qZKHj4whBuGUiw=="; |
| | | /** |
| | | * |
| | | */ |
| | | String iv = "Zz2ZL9Yu43pp38p5CcocJA=="; |
| | | /** |
| | | * appkey |
| | | */ |
| | |
| | | /** |
| | | * 私钥地址 |
| | | */ |
| | | String privateKeyPath = "E:\\IDEA Workspace\\QianYunTong\\private_key_test.pem"; |
| | | String privateKeyPath = "/root/server/app/key/private_key_test.pem"; |
| | | /** |
| | | * 消费者账号 |
| | | */ |
| | |
| | | * API地址 |
| | | */ |
| | | String apiUrl = "https://test-zhongtai.stqcloud.com:10070"; |
| | | /** |
| | | * HOS的基础路径(公共前缀) |
| | | */ |
| | | String endPoint = "119.4.112.68:27741"; |
| | | /** |
| | | * 账户的ID |
| | | */ |
| | | String account = "d8bef0a04db511f0b79d01a3e2b7587e"; |
| | | /** |
| | | * 向UAAS服务请求到的access_key |
| | | */ |
| | | String accessKey = "TYMFTFD5SIIT15DCCUD7"; |
| | | /** |
| | | * 向UAAS服务请求到的secret_key |
| | | */ |
| | | String secretKey = "AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"; |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | 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.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | /** |
| | | * 根据手机号码获取人员信息 |
| | | * |
| | | * @param mobile 手机号码 |
| | | * @param enterNum 企业编号 |
| | | * @param mobile 手机号码 |
| | | */ |
| | | public static List<QYTUserInfo> getUserInfoByPhone(String mobile, String enterNum) { |
| | | public static List<QYTUserInfo> getUserInfoByPhone(String mobile) { |
| | | //请求路径 |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/1.0/getUserInfoByPhone"; |
| | | String url = QianYunTongProperties.apiUrl + "/openapi/rest/2.0/queryUserinfoByMobilev2"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = QianYunTongProperties.privateKeyPath; |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | |
| | | 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)); |
| | | contentMap.put("content", "{\"list\":[{\"mobile\":\"" + mobile + "\"}]}"); |
| | | log.info("【根据手机号码获取人员信息】请求地址:" + url); |
| | | log.info("【根据手机号码获取人员信息】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "GET", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据手机号和企业编号查询用户信息】请求结果:" + result); |
| | | log.info("【根据手机号码获取人员信息】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】请求失败:" + result); |
| | | log.error("【根据手机号码获取人员信息】请求失败:" + result); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | throw new RuntimeException("【根据手机号和企业编号查询用户信息】失败:" + object.toJSONString()); |
| | | log.error("【根据手机号码获取人员信息】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | JSONArray data = object.getJSONArray("data"); |
| | | JSONArray data = object.getJSONObject("data").getJSONArray("list"); |
| | | 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 true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信小程序登录 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static LoginWeChatXiao loginWeChatXiao(String code) { |
| | | HttpRequest post = HttpUtil.createPost("https://casme.teamshub.com/webapp-backstage/ajax/loginWeChatXiao/v1.0"); |
| | | post.header("Content-Type", "text/plain;charset=UTF-8"); |
| | | post.header("Accept-encodeing", "UTF-8"); |
| | | JSONObject body = new JSONObject(); |
| | | body.put("version", "1.0"); |
| | | try { |
| | | body.put("id", UUIDUtil.getRandomCode(6)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | body.put("type", "loginWeChatXiao"); |
| | | body.put("action", "request"); |
| | | body.put("code", code); |
| | | body.put("appId", QianYunTongProperties.appId); |
| | | body.put("encryptedData", QianYunTongProperties.encryptedData); |
| | | body.put("iv", QianYunTongProperties.iv); |
| | | post.body(body.toJSONString()); |
| | | HttpResponse execute = post.execute(); |
| | | if (200 != execute.getStatus()) { |
| | | log.error("微信登录失败"); |
| | | return null; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(execute.body()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if (0 != status) { |
| | | log.error("微信登录失败:" + jsonObject.getString("desc")); |
| | | return null; |
| | | } |
| | | LoginWeChatXiao loginWeChatXiao = jsonObject.getObject("data", LoginWeChatXiao.class); |
| | | return loginWeChatXiao; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.qianyuntong.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/16 23:50 |
| | | */ |
| | | @Data |
| | | public class LoginWeChatXiao { |
| | | /** |
| | | * token |
| | | */ |
| | | private String token; |
| | | /** |
| | | * 用户UUID |
| | | */ |
| | | private String userUUID; |
| | | /** |
| | | * 用户手机号 |
| | | */ |
| | | private String mobile; |
| | | /** |
| | | * 企业名称,无企业时为空 |
| | | */ |
| | | private String enterName; |
| | | /** |
| | | * 企业编码 |
| | | */ |
| | | private String enterCode; |
| | | /** |
| | | * 企业认证状态 |
| | | */ |
| | | private String enterAuth; |
| | | /** |
| | | * 是否是管理员,是:1;否:0 |
| | | */ |
| | | private String isAdmin; |
| | | } |
| | |
| | | @Data |
| | | public class QYTUserInfo { |
| | | /** |
| | | * 员工名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 企业编号 |
| | | */ |
| | | private String enterNum; |
| | | /** |
| | | * 节点路径 |
| | | */ |
| | | private String nodePath; |
| | | /** |
| | | * 员工昵称 |
| | | */ |
| | | private String nickName; |
| | | /** |
| | | * 员工编号 |
| | | */ |
| | | private String empId; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mphone; |
| | | private String mobile; |
| | | /** |
| | | * 员工在企业内部的编号 |
| | | * 用户昵称 |
| | | */ |
| | | private String loginNo; |
| | | private String nickname; |
| | | /** |
| | | * 部门ID |
| | | * 小头像url |
| | | */ |
| | | private String deptId; |
| | | private String photoUrl; |
| | | /** |
| | | * 大头像url |
| | | */ |
| | | private String photoUrlBig; |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String enterName; |
| | | |
| | | } |
| | |
| | | |
| | | @Resource |
| | | private OrderTaxiMapper orderTaxiMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ISystemNoticeService systemNoticeService; |
| | | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GeodesyUtil geodesyUtil; |
| | | |
| | |
| | | port: 8007 |
| | | |
| | | 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(只在单机环境下生效) 单位:秒 |
| | | 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: |
| | | application: |
| | | name: driver-server |
| | | profiles: |
| | | active: dev |
| | | # active: produce |
| | | 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 |
| | | profiles: |
| | | active: dev |
| | | # active: prod |
| | | 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: |
| | | password: SC_cache@20#25 |
| | | database: 0 |
| | | timeout: 1000 |
| | | cluster: |
| | | nodes: 172.21.35.151:6512,172.21.35.152:6512,172.21.35.153:6512,172.21.35.151:6513,172.21.35.152:6513,172.21.35.153:6513 |
| | | max-redirects: 3 |
| | | lettuce: |
| | | pool: |
| | | max-idle: 16 |
| | | max-active: 32 |
| | | min-idle: 8 |
| | | |
| | | mybatis-plus: |
| | | typeAliasesPackage: com.stylefeng.guns.modular |
| | | global-config: |
| | | id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) |
| | | db-column-underline: false |
| | | configuration: |
| | | configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 |
| | | logging: |
| | | file: |
| | | # path 及 name只能二选一,自定义名称选name,path的默认文件名spring.log |
| | | # path: /logs |
| | | name: logs/app.log |
| | | logback: |
| | | rollingpolicy: |
| | | max-history: 3 |
| | | level: |
| | | com: |
| | | stylefeng: |
| | | guns: debug |
| | | typeAliasesPackage: com.stylefeng.guns.modular |
| | | global-config: |
| | | id-type: 0 #0:数据库ID自增 1:用户输入id 2:全局唯一id(IdWorker) 3:全局唯一ID(uuid) |
| | | db-column-underline: false |
| | | configuration: |
| | | configuration.map-underscore-to-camel-case: true #是否开启自动驼峰命名规则(camel case)映射 |
| | | log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #输出Sql,如需打印Sql注释该配置 |
| | | |
| | | |
| | | eureka: |
| | |
| | | --- |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/jyxtravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: 123456 |
| | | db-name: qyttravel #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | redis: |
| | | #测试环境 |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | password: 123456 |
| | | datasource: |
| | | url: jdbc:mysql://172.21.35.140:8066/traffic_scdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: traffic_scusr |
| | | password: QYT_sc@20#25 |
| | | db-name: traffic_scdb #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://qyt_jtcx:qyt_jtcx2025@172.21.35.195:27017,172.21.35.196:27017/traveling_track |
| | | |
| | | --- |
| | | |
| | | wx: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: wxcc3c9058e2b294db #小程序APPid |
| | | appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # |
| | | mchId: 111 #微信支付分配的商户号 |
| | | key: 111 #key为商户平台设置的密钥key: |
| | | grantType: authorization_code #填authorization_code |
| | | appid: 111 #应用唯一标识,在微信开放平台提交应用审核通过后获得 |
| | | appSecret: 111 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 |
| | | appletsAppid: wxcc3c9058e2b294db #小程序APPid |
| | | appletsAppSecret: 5610fc6126255ca5f7bd9fa4330338b6 # |
| | | mchId: 111 #微信支付分配的商户号 |
| | | key: 111 #key为商户平台设置的密钥key: |
| | | |
| | | --- |
| | | |
| | |
| | | |
| | | --- |
| | | |
| | | filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 |
| | | |
| | | |
| | | |
| | | #支付回调地址 |
| | | #正式环境 |
| | | callbackPath: https://zhentonggongsi.com:443/driver |
| | | callbackPath: https://traffic.qytzt.cn/driver |
| | | |
| | | --- |
| | | #交通部推送数据功能开关 |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,比如: 如果设置为WARN,则低于WARN的信息都不会输出 --> |
| | | <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> |
| | | <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> |
| | | <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> |
| | | <configuration scan="true" scanPeriod="10 seconds"> |
| | | <contextName>logback</contextName> |
| | | |
| | | <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> |
| | | <property name="log.path" value="/data/app/logs/driver"/> |
| | | |
| | | <!--0. 日志格式和颜色渲染 --> |
| | | <!-- 彩色日志依赖的渲染类 --> |
| | | <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> |
| | | <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> |
| | | <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> |
| | | <!-- 彩色日志格式 --> |
| | | <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
| | | |
| | | <!--1. 输出到控制台--> |
| | | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
| | | <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
| | | <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
| | | <level>debug</level> |
| | | </filter> |
| | | <encoder> |
| | | <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
| | | <!-- 设置字符集 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | <!--2. 输出到文档--> |
| | | <!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
| | | <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/debug.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 日志归档 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录debug级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>debug</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/info.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <!-- 每天日志归档路径以及格式 --> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录info级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>info</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
| | | <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/warn.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录warn级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>warn</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/error.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档只记录ERROR级别的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- 2.5 所有 除了DEBUG级别的其它高于DEBUG的 日志,记录到一个文件 --> |
| | | <appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <!-- 正在记录的日志文档的路径及文档名 --> |
| | | <file>${log.path}/all.log</file> |
| | | <!--日志文档输出格式--> |
| | | <encoder> |
| | | <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
| | | <charset>UTF-8</charset> <!-- 此处设置字符集 --> |
| | | </encoder> |
| | | <!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.path}/%d{yyyy-MM-dd}/all-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
| | | <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
| | | <maxFileSize>100MB</maxFileSize> |
| | | </timeBasedFileNamingAndTriggeringPolicy> |
| | | <!--日志文档保留天数--> |
| | | <maxHistory>15</maxHistory> |
| | | </rollingPolicy> |
| | | <!-- 此日志文档记录除了DEBUG级别的其它高于DEBUG的 --> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>DEBUG</level> |
| | | <onMatch>DENY</onMatch> |
| | | <onMismatch>ACCEPT</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <!-- |
| | | <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 |
| | | 以及指定<appender>。<logger>仅有一个name属性, |
| | | 一个可选的level和一个可选的addtivity属性。 |
| | | name:用来指定受此logger约束的某一个包或者具体的某一个类。 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 还有一个特殊值INHERITED或者同义词NULL,代表强制执行上级的级别。 |
| | | 如果未设置此属性,那么当前logger将会继承上级的级别。 |
| | | addtivity:是否向上级logger传递打印信息。默认是true。 |
| | | <logger name="org.springframework.web" level="info"/> |
| | | <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> |
| | | --> |
| | | |
| | | <!-- |
| | | root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 |
| | | level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, |
| | | 不能设置为INHERITED或者同义词NULL。默认是DEBUG |
| | | 可以包含零个或多个元素,标识这个appender将会添加到这个logger。 |
| | | --> |
| | | |
| | | <!-- 4 最终的策略: |
| | | 基本策略(root级) + 根据profile在启动时, logger标签中定制化package日志级别(优先级高于上面的root级)--> |
| | | <springProfile name="dev"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | <logger name="com.stylefeng.guns.modular.system.dao" level="debug"/> |
| | | </springProfile> |
| | | |
| | | <springProfile name="test"> |
| | | <root level="info"> |
| | | <appender-ref ref="CONSOLE" /> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | </springProfile> |
| | | |
| | | <springProfile name="prod"> |
| | | <root level="info"> |
| | | <!-- 生产环境最好不配置console写文件 --> |
| | | <appender-ref ref="DEBUG_FILE" /> |
| | | <appender-ref ref="INFO_FILE" /> |
| | | <appender-ref ref="WARN_FILE" /> |
| | | <appender-ref ref="ERROR_FILE" /> |
| | | <appender-ref ref="ALL_FILE" /> |
| | | </root> |
| | | </springProfile> |
| | | |
| | | </configuration> |
| | |
| | | package com.stylefeng.guns; |
| | | |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.EditStaffNodeRequest; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | |
| | | @Test |
| | | public void test() throws Exception { |
| | | // CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | // request.setName("成都喜望科技有限公司"); |
| | | // request.setNickName("成都喜望"); |
| | | // request.setIndustry_code("123456789"); |
| | | // request.setMobile("15828353127"); |
| | | // request.setMobileFlag("1"); |
| | | // EnterpriseUtil.createEnterprise(request); |
| | | |
| | | //短信 |
| | | // SMSUtil.sendVerifyCode("15828353127"); |
| | | |
| | | // CheckEnterExist checkEnterNameExist = EnterpriseUtil.checkEnterNameExist("成都喜望科技有限公司"); |
| | | |
| | | // EnterpriseInfo enterpriseDetail = EnterpriseUtil.getEnterpriseDetail(checkEnterNameExist.getEnterCode()); |
| | | // System.out.println(enterpriseDetail); |
| | | |
| | | // List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone("15828353127", "981100006005878"); |
| | | |
| | | // RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setPassword("123456"); |
| | | // request.setNickname("测试"); |
| | | // request.setVerify_code("1111"); |
| | | // request.setVerify_code_type("1"); |
| | | // RegisterViaMobile registerViaMobile = UserUtil.registerViaMobile(request); |
| | | |
| | | // ModifyPwdRequest request = new ModifyPwdRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setOldPwd("111111"); |
| | | // request.setNewPwd("654321"); |
| | | // request.setCode("1111"); |
| | | // UserUtil.modifyPwd(request); |
| | | |
| | | // ResetPwdRequest request = new ResetPwdRequest(); |
| | | // request.setMobile("15828353126"); |
| | | // request.setPassword("654321"); |
| | | // request.setCode("1111"); |
| | | // UserUtil.resetPwd(request); |
| | | |
| | | // SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // request.setEmpName("超级管理员"); |
| | | // request.setEmpNickname("超级管理员"); |
| | | // request.setLoginNo("18200000000"); |
| | | // request.setEmpSex("男"); |
| | | // request.setMphone("18200000000"); |
| | | // request.setEmail("sn93@qq.com"); |
| | | // request.setDeptId(0); |
| | | // request.setPositionId(1); |
| | | // request.setSuperLevel(0); |
| | | // request.setHideMobile(0); |
| | | // EmployeeUtil.saveStaffNode(request); |
| | | |
| | | //接口参数有问题 |
| | | EditStaffNodeRequest request = new EditStaffNodeRequest(); |
| | | request.setEmpId(11448038); |
| | | request.setMobile("15828353127"); |
| | | request.setEntercode("981100006005878"); |
| | | request.setEnterId(981100006005878l); |
| | | request.setEmpName("超级管理员"); |
| | | request.setEmpNickname("超管"); |
| | | request.setLoginNo("18200000000"); |
| | | request.setMphone("18200000000"); |
| | | request.setEmail("sn93@qq.com"); |
| | | request.setEmpSex("男"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | EmployeeUtil.editStaffNode(request); |
| | | |
| | | |
| | | // GetStaffNodeRequest request = new GetStaffNodeRequest(); |
| | | // request.setEmpId(11448036L); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // EmployeeUtil.getStaffNode(request); |
| | | |
| | | |
| | | // DeleteStafNodeRequest request = new DeleteStafNodeRequest(); |
| | | // request.setEmpId(11448036); |
| | | // request.setMobile("15828353127"); |
| | | // request.setEntercode("981100006005878"); |
| | | // EmployeeUtil.ecrmDeleteStafNode(request); |
| | | } |
| | | } |