| | |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/javabase64-1.3.1.jar</systemPath> |
| | | </dependency> |
| | | <!--证联sdk--> |
| | | <dependency> |
| | | <groupId>zl</groupId> |
| | | <artifactId>security</artifactId> |
| | | <version>1.2.2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${pom.basedir}/lib/zl-util-security-1.2.2.jar</systemPath> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.supersavedriving.driver.modular.system.dao.MonthOrderMapper; |
| | | import com.supersavedriving.driver.modular.system.dao.TCompanyMapper; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.ALiSendSms; |
| | |
| | | import com.supersavedriving.driver.modular.system.util.MiniPay.MiniAppPay; |
| | | import com.supersavedriving.driver.modular.system.util.juhe.OCRUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.UserUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.SendSmsRequest; |
| | | import com.supersavedriving.driver.modular.system.util.separateAccounts.StrUtil; |
| | | import com.supersavedriving.driver.modular.system.util.separateAccounts.TransferUtil; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.TokenUtil; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.model.TokenRequest; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.model.TradeTerminalInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | |
| | | |
| | | @Value("${qyt.admin_url}") |
| | | private String adminUrl; |
| | | |
| | | @Autowired |
| | | private TCompanyMapper companyMapper; |
| | | |
| | | |
| | | |
| | |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | Driver driver1 = driverService.selectById(uid); |
| | | TCompany company = companyMapper.selectById(driver1.getBranchOfficeId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(driver1.getPhone(), company.getEnterCode()); |
| | | if (null == userInfoByPhone || userInfoByPhone.size() == 0) { |
| | | return new ResponseWarpper(500, "账号未注册"); |
| | | } |
| | | |
| | | ResultUtil resultUtil = driverService.updatePassword(uid, oldPass, newPass); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | Driver driver1 = driverService.selectById(uid); |
| | | TCompany company = companyMapper.selectById(driver1.getBranchOfficeId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(driver1.getPhone(), company.getEnterCode()); |
| | | if (null == userInfoByPhone || userInfoByPhone.size() == 0) { |
| | | return new ResponseWarpper(500, "账号未注册"); |
| | | } |
| | | ResultUtil resultUtil = driverService.recoverPassword(uid, password); |
| | | return ResponseWarpper.success(resultUtil); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/getZLToken") |
| | | @ApiOperation(value = "获取证联token(黔云通)", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "当前设备IP地址", name = "ip", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前设备mac地址", name = "mac", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "01 证联收银台支付\n" + |
| | | "\t 04 HOME 页\n" + |
| | | "\t 06 申请免密签约\n" + |
| | | "\t 07 商户收银台支付\n" + |
| | | "\t 08 开户(绑卡)\n" + |
| | | "\t 09 开通支付账户\n" + |
| | | "\t 10 打开付款码", name = "type", required = true, dataType = "String"), |
| | | }) |
| | | public ResponseWarpper<String> getZLToken(String ip, String mac, String type, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | TokenRequest tokenRequest = new TokenRequest(); |
| | | tokenRequest.setAppUserId(driver.getEmpId().toString()); |
| | | tokenRequest.setUserName(driver.getName()); |
| | | tokenRequest.setCertNo(driver.getIdcard()); |
| | | tokenRequest.setPhone(driver.getPhone()); |
| | | TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo(); |
| | | tradeTerminalInfo.setIp(ip); |
| | | tradeTerminalInfo.setTerminal("1"); |
| | | tradeTerminalInfo.setMac(mac); |
| | | tokenRequest.setTradeTerminalInfo(tradeTerminalInfo); |
| | | tokenRequest.setType(type); |
| | | String token = TokenUtil.getToken(tokenRequest); |
| | | return ResponseWarpper.success(token); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField("havDiscount") |
| | | private Integer havDiscount; |
| | | /** |
| | | * 中台用户ID |
| | | */ |
| | | @TableField("onconUUID") |
| | | private String onconUUID; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigInteger; |
| | |
| | | @TableField("checkServer") |
| | | // 是否有车检服务 1有 2没有 |
| | | private Integer checkServer; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | |
| | | @ApiModelProperty("证联客户号") |
| | | private String custId; |
| | | |
| | | @ApiModelProperty("是否已开通支付账户(0:否,1:是)") |
| | | private Integer accOpenFlag; |
| | | |
| | | @ApiModelProperty("是否已同步到中台(0:否,1:是)") |
| | | private Integer isSynchronous; |
| | | } |
| | |
| | | */ |
| | | @TableField("endTime") |
| | | private Date endTime; |
| | | /** |
| | | * 中台订单id |
| | | */ |
| | | @TableField("travelId") |
| | | private String travelId; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.driver.modular.system.dao.OrderMapper; |
| | | import com.supersavedriving.driver.modular.system.dao.TCompanyMapper; |
| | | import com.supersavedriving.driver.modular.system.model.*; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.*; |
| | |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.AddAccountInfoRequest; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.CreateTravelItineraryRequest; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.ModifyTravelItineraryRequest; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.ZhengLianUtil; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.model.TradeTerminalInfo; |
| | | import com.supersavedriving.driver.modular.system.util.zhenglian.model.ZLUserInfo; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.util.GaoDe.model.District; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.InetAddress; |
| | | import java.net.NetworkInterface; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Autowired |
| | | private TCompanyMapper companyMapper; |
| | | |
| | | |
| | | |
| | |
| | | order.setState(null == order.getDriverId() ? 101 : 102); |
| | | } |
| | | order.setStatus(1); |
| | | |
| | | this.insert(order); |
| | | driverService.updateById(driver); |
| | | if(null != appUser && null != order.getDriverId()){ |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | //调三方订单中心创建行程单 |
| | | CreateTravelItineraryRequest request = new CreateTravelItineraryRequest(); |
| | | request.setOrderNo("DJ" + order.getId()); |
| | | request.setCustomerId(appUser.getOnconUUID()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | request.setServiceType(5); |
| | | String travelItinerary = OrderUtil.createTravelItinerary(request); |
| | | order.setTravelId(travelItinerary); |
| | | this.updateById(order); |
| | | } |
| | | |
| | | |
| | | //推送状态 |
| | | if(null != order.getDriverId()){ |
| | | //推动订单数据 |
| | |
| | | */ |
| | | @Override |
| | | public List<HallOrderList> queryOrderHall(Integer uid, Integer pageNum, Integer pageSize) throws Exception { |
| | | Driver driver = driverService.selectById(uid); |
| | | //获取证联数据 |
| | | if(null == driver.getCustId() || 0 == driver.getAccOpenFlag()){ |
| | | TradeTerminalInfo tradeTerminalInfo = new TradeTerminalInfo(); |
| | | tradeTerminalInfo.setTerminal("1"); |
| | | InetAddress inetAddress = InetAddress.getLocalHost(); |
| | | String ip = inetAddress.getHostAddress(); |
| | | tradeTerminalInfo.setIp(ip); |
| | | NetworkInterface networkInterface = NetworkInterface.getByInetAddress(inetAddress); |
| | | byte[] mac = networkInterface.getHardwareAddress(); |
| | | StringBuilder macAddress = new StringBuilder(); |
| | | for (int i = 0; i < mac.length; i++) { |
| | | macAddress.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "")); |
| | | } |
| | | |
| | | tradeTerminalInfo.setMac(macAddress.toString()); |
| | | ZLUserInfo userInfo = ZhengLianUtil.getUserInfo(driver.getEmpId().toString(), tradeTerminalInfo); |
| | | if(null != userInfo){ |
| | | driver.setCustId(userInfo.getCustId()); |
| | | driver.setAccOpenFlag(userInfo.getAccOpenFlag()); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | //同步到中台 |
| | | if(null != driver.getAccOpenFlag() && 1 == driver.getAccOpenFlag() && 0 == driver.getIsSynchronous()){ |
| | | AddAccountInfoRequest request = new AddAccountInfoRequest(); |
| | | request.setCustId(driver.getCustId()); |
| | | request.setAccountNo(driver.getEmpId().toString()); |
| | | request.setAccountName(driver.getName()); |
| | | request.setMobile(driver.getPhone()); |
| | | Integer status = EmployeeUtil.addAccountInfo(request); |
| | | if(0 == status){ |
| | | driver.setIsSynchronous(1); |
| | | driverService.updateById(driver); |
| | | } |
| | | } |
| | | |
| | | pageNum = (pageNum - 1) * pageSize; |
| | | String value = redisUtil.getValue("daijia:DRIVER" + uid); |
| | | List<HallOrderList> hallOrderLists = this.baseMapper.queryOrderHall(pageNum, pageSize); |
| | |
| | | order.setState(102); |
| | | order.setOrderTakingTime(new Date()); |
| | | this.updateById(order); |
| | | |
| | | redisUtil.unlock(orderId.toString()); |
| | | |
| | | if(null != order.getUserId()){ |
| | |
| | | appUser.setCancelCount(0); |
| | | appUser.setIsException(1); |
| | | appUserService.updateById(appUser); |
| | | |
| | | if(null == order.getTravelId()){ |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | //调三方订单中心创建行程单 |
| | | CreateTravelItineraryRequest request = new CreateTravelItineraryRequest(); |
| | | request.setOrderNo("DJ" + order.getId()); |
| | | request.setCustomerId(appUser.getOnconUUID()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | request.setServiceType(5); |
| | | String travelItinerary = OrderUtil.createTravelItinerary(request); |
| | | order.setTravelId(travelItinerary); |
| | | this.updateById(order); |
| | | }else{ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | } |
| | | |
| | | driver.setServerStatus(2); |
| | |
| | | } |
| | | this.updateAllColumnById(order); |
| | | |
| | | if(null != order.getTravelId()){ |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | //推送订单状态 |
| | | pushUtil.pushOrderStatus(order.getDriverId(), 2, order.getId(), order.getState()); |
| | | if(null != order.getUserId()){ |
| | |
| | | } |
| | | this.updateById(order); |
| | | |
| | | if(null != order.getTravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | |
| | | orderTransfer.setOrderId(orderId); |
| | | orderTransfer.setOldDriverId(order.getDriverId()); |
| | |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | private Integer getState(Integer state){ |
| | | switch (state){ |
| | | case 101://待接单 |
| | | return 1; |
| | | case 102://已接单 |
| | | return 2; |
| | | case 103://前往预约点 |
| | | return 3; |
| | | case 104://到达预约点 |
| | | return 4; |
| | | case 105://开始服务 |
| | | return 5; |
| | | case 106://到达目的地 |
| | | return 6; |
| | | case 107://待支付 |
| | | return 7; |
| | | case 108://待评价 |
| | | return 8; |
| | | case 109://已完成 |
| | | return 9; |
| | | case 201://转单中 |
| | | return 11; |
| | | case 301://已取消 |
| | | return 10; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | order.setState(order.getOldState()); |
| | | order.setOldState(null); |
| | | this.updateAllColumnById(order); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | |
| | | if(null != order.getTravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | OrderTransfer orderTransfer = orderTransferService.selectOne(new EntityWrapper<OrderTransfer>().eq("orderId", orderId) |
| | | .eq("status", 1).isNull("successTime").orderBy("createTime desc limit 0, 1")); |
| | |
| | | |
| | | order.setState(301); |
| | | this.updateById(order); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != order.getTravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | |
| | | redisUtil.delSetValue("orderService", orderId.toString()); |
| | | |
| | | CancelOrder cancelOrder = new CancelOrder(); |
| | |
| | | cancelOrder.setStatus(1); |
| | | cancelOrder.setCreateTime(new Date()); |
| | | cancelOrderService.insert(cancelOrder); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != driver){ |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | |
| | | order.setPayType(3); |
| | | } |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(payType == 2 && state == 108){ |
| | | order.setPayTime(new Date()); |
| | | if(null != order.getCouponId()){ |
| | | UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); |
| | | Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | |
| | | AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); |
| | | accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(5)); |
| | | accountChangeDetail.setUserType(2); |
| | |
| | | } |
| | | this.updateById(order); |
| | | |
| | | if(null != order.getTravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | if((payType == 1 && state == 107) || (payType == 2 && state == 108)){ |
| | | //修改司机状态和积分 |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 企业员工工具类 |
| | | * |
| | | * @author zhibing.pu |
| | | * @Date 2025/6/6 16:17 |
| | | */ |
| | |
| | | |
| | | private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); |
| | | |
| | | public static void main(String[] args) { |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile("15828353127"); |
| | | request.setEntercode("981100006005951"); |
| | | request.setEmpName("蒲"); |
| | | request.setEmpNickname("蒲"); |
| | | request.setLoginNo("15828353125"); |
| | | request.setEmpSex("男"); |
| | | request.setMphone("15828353125"); |
| | | request.setEmail("15828353125@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | System.out.println(resultUtil.getData()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 企业增加员工 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static ResultUtil<SaveStaffNode> saveStaffNode(SaveStaffNodeRequest request) { |
| | | public static ResultUtil<SaveStaffNode> saveStaffNode(SaveStaffNodeRequest request){ |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/saveStaffNode"; |
| | | //私钥文件 |
| | |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【企业增加员工】请求失败:" + result); |
| | | String retMsg = jsonObject.getString("retMsg"); |
| | | if(retMsg.contains("员工昵称已存在")){ |
| | | request.setEmpName(request.getEmpName() + Double.valueOf(Math.random() * 100).intValue()); |
| | | request.setEmpNickname(request.getEmpName()); |
| | | return saveStaffNode(request); |
| | | } |
| | | retMsg = retMsg.substring(retMsg.indexOf("{")); |
| | | jsonObject = JSON.parseObject(retMsg); |
| | | return ResultUtil.error("【企业增加员工】请求失败:" + jsonObject.getString("msg")); |
| | |
| | | StaffNodeInfo staffNodeInfo = object.getObject("data", StaffNodeInfo.class); |
| | | return staffNodeInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建账号-同步证联开户信息 |
| | | * @param request |
| | | * @return 状态 0 成功 其他失败 |
| | | */ |
| | | public static Integer addAccountInfo(AddAccountInfoRequest request){ |
| | | request.setPartnerId("522700"); |
| | | request.setIndustryCode("100"); |
| | | request.setPayModeId("501101"); |
| | | request.setAccessMode("APP"); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/addAccountInfo"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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("【创建账号-同步证联开户信息】请求失败:" + jsonObject.getString("retMsg")); |
| | | return -1; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | return object.getInteger("status"); |
| | | } |
| | | } |
| | |
| | | import com.open.common.util.OpenApiClient; |
| | | import com.open.common.util.SystemParameterNames; |
| | | import com.supersavedriving.driver.modular.system.util.SpringContextsUtil; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.*; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.CheckEnterExist; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.EnterpriseInfo; |
| | | import com.supersavedriving.driver.modular.system.util.qianyuntong.model.ModifyEnterpriseInfoRequest; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | |
| | | |
| | | private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // CheckEnterExist checkEnterNameExist = checkEnterNameExist("黔南云码通数字产业运营有限公司"); |
| | | // System.err.println(checkEnterNameExist); |
| | | |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName("成都喜望科技有限公司"); |
| | | request.setNickName("成都喜望"); |
| | | request.setIndustry_code("123456"); |
| | | request.setMobile("15828353127"); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | System.out.println(enterprise); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 根据社会信用代码判断企业是否已存在 |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建企业 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static CreateEnterprise createEnterprise(CreateEnterpriseRequest request) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/createEnterprise"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | map.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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); |
| | | 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.getObject("data", CreateEnterprise.class); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除企业信息 |
| | | * |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterNameExist("成都喜望科技有限公司"); |
| | | System.out.println(checkEnterExist); |
| | | } |
| | | |
| | | /** |
| | | * 创建企业 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public static CreateEnterprise createEnterprise(CreateEnterpriseRequest request) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/createEnterprise"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | map.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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); |
| | | 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.getObject("data", CreateEnterprise.class); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public static PayInfo tradePayOff1(TradePayOff1Data tradePayOff1Data) { |
| | | tradePayOff1Data.setPartnerId("5400004"); |
| | | tradePayOff1Data.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | tradePayOff1Data.setTimeout("72H"); |
| | | tradePayOff1Data.setScene("TRAFFIC"); |
| | | tradePayOff1Data.setCurrency("RMB"); |
| | | tradePayOff1Data.setNeedLoginFlag("N"); |
| | | tradePayOff1Data.setAccessMode("APP"); |
| | | tradePayOff1Data.getGoodsInfo().forEach(goodsInfoRequest -> { |
| | | goodsInfoRequest.setId("981100006005901"); |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); |
| | | goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); |
| | | |
| | | goodsInfoRequest.setAreaInfo("520100"); |
| | |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradePayOff1Data>(); |
| | | request.setSceneId("1911676727023968256"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954795404533583872" : "1911676727023968256"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | tradeOrderCreateData.setTimeout("72H"); |
| | | tradeOrderCreateData.setOrderAppId("52270015"); |
| | | tradeOrderCreateData.setChannelSource("GRJYCXWXXCX"); |
| | | tradeOrderCreateData.setPayPartnerId("5400004"); |
| | | tradeOrderCreateData.setPayPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | tradeOrderCreateData.setCurrency("RMB"); |
| | | tradeOrderCreateData.setNeedLoginFlag("N"); |
| | | tradeOrderCreateData.setAccessMode("APP"); |
| | | tradeOrderCreateData.getGoodsInfo().forEach(goodsInfoRequest -> { |
| | | goodsInfoRequest.setId("981100006005901"); |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); |
| | | goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); |
| | | goodsInfoRequest.setAreaInfo("520100"); |
| | | goodsInfoRequest.setPayType("0"); |
| | |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderCreateData>(); |
| | | request.setSceneId("1945688132719169536"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954793280550756352" : "1945688132719169536"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | createOrderRequest.setChannelSource("GRJYCXWXXCX"); |
| | | |
| | | TradeRequest request = new TradeRequest<CreateOrderRequest>(); |
| | | request.setSceneId("1948289607125864448"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954792737421942784" : "1948289607125864448"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | * @return |
| | | */ |
| | | public static PayInfo tradePayOff(TradePayOffData tradePayOffData) { |
| | | tradePayOffData.setPartnerId("5400005"); |
| | | tradePayOffData.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401008" : "5400005"); |
| | | tradePayOffData.setTimeout("72H"); |
| | | tradePayOffData.setScene("TRAFFIC"); |
| | | tradePayOffData.setCurrency("RMB"); |
| | |
| | | tradePayOffData.setPaymentInfos(paymentInfoRequests); |
| | | List<GoodsInfo> goodsInfo = new ArrayList<>(); |
| | | GoodsInfo goodsInfo1 = new GoodsInfo(); |
| | | goodsInfo1.setMerchantCode("B00000905"); |
| | | goodsInfo1.setCustId("CB0000004686"); |
| | | goodsInfo1.setCustName("证联消费平台交易客户"); |
| | | goodsInfo1.setMerchantCode("prod".equals(qianYunTongConfig.getActiveProfile()) ? "B00001404" : "B00000905"); |
| | | goodsInfo1.setCustId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "CB0000004853" : "CB0000004686"); |
| | | goodsInfo1.setCustName("prod".equals(qianYunTongConfig.getActiveProfile()) ? "黔南云码通数字产业运营有限公司" : "证联消费平台交易客户"); |
| | | goodsInfo1.setBusinessType("10408"); |
| | | goodsInfo1.setAgreementNo("00000000468618354161754464398681"); |
| | | goodsInfo1.setAgreementNo("prod".equals(qianYunTongConfig.getActiveProfile()) ? "00000402485377063581755054680461" : "00000000468618354161754464398681"); |
| | | goodsInfo1.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfo1); |
| | | tradePayOffData.setGoodsInfo(goodsInfo); |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradePayOffData>(); |
| | | request.setSceneId("1774717104844095488"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954794605782913024" : "1774717104844095488"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(2); |
| | | request.setConfigVersion("prod".equals(qianYunTongConfig.getActiveProfile()) ? 1 : 2); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(tradePayOffData); |
| | | //请求路径 |
| | |
| | | * @return |
| | | */ |
| | | public static GetPaymentInfo paymentInfo(GetPaymentInfoDataRequest getPaymentInfoDataRequest) { |
| | | getPaymentInfoDataRequest.setPartnerId("5400004"); |
| | | getPaymentInfoDataRequest.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | |
| | | GetPaymentInfoRequest request = new GetPaymentInfoRequest(); |
| | | request.setRequstType("POST"); |
| | |
| | | request.setMhltiCenterAppId("52270015"); |
| | | request.setPayType(4); |
| | | request.setPayChannel(6); |
| | | request.setIsCompensate(1); |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/paymentOrder"; |
| | | //私钥文件 |
| | |
| | | OrderInfo orderInfo = jsonObject.getObject("busiResp", OrderInfo.class); |
| | | return orderInfo; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单退款 |
| | | * @param request1 |
| | | * @return |
| | | */ |
| | | public static TradeOrderRefund tradeOrderRefund(TradeOrderRefundRequest request1) { |
| | | request1.setPayPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/tradeOrderRefund"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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"); |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderRefundRequest>(); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1968487381046722560" : "1726529285264269312"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion("prod".equals(qianYunTongConfig.getActiveProfile()) ? 1 : 6); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(request1); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单退款】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | JSONObject refundInfo = jsonObject.getJSONObject("busiResp").getJSONObject("refundInfo"); |
| | | String retCode = refundInfo.getString("retCode"); |
| | | if(!"0".equals(retCode)){ |
| | | log.error("【订单退款】失败:" + refundInfo.getString("retMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + refundInfo.getString("retMsg")); |
| | | } |
| | | JSONObject object = refundInfo.getJSONObject("object"); |
| | | String retCode1 = object.getString("retCode"); |
| | | if(!"000000".equals(retCode1)){ |
| | | log.error("【订单退款】失败:" + object.getString("retMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + object.getString("retMsg")); |
| | | } |
| | | |
| | | TradeOrderRefund tradeOrderRefund = object.getObject("data", TradeOrderRefund.class); |
| | | return tradeOrderRefund; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单退款通知 |
| | | * @param request |
| | | */ |
| | | public static void orderRefundNotice(OrderRefundNoticeRequest request) { |
| | | request.setScene("TRAFFIC"); |
| | | request.setMhltiCenterAppId("52270015"); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/orderRefundNotice"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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 = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单退款通知】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单退款通知】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单取消 |
| | | * @param orderId |
| | | */ |
| | | public static void tradeOrderCancel(String orderId) { |
| | | TradeOrderCancelRequest request1 = new TradeOrderCancelRequest(); |
| | | request1.setScene("TRAFFIC"); |
| | | request1.setMhltiCenterAppId("52270015"); |
| | | request1.setOrderId(orderId); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/tradeOrderCancel"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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"); |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderRefundRequest>(); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1968487841979760640" : "1963507067318833152"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(request1); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单取消】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单取消】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.supersavedriving.driver.modular.system.util.qianyuntong; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | * @author zhibing.pu |
| | | * @Date 2025/7/8 11:31 |
| | | */ |
| | | @Data |
| | | @Component |
| | | public class QianYunTongConfig { |
| | | |
| | |
| | | * 向UAAS服务请求到的secret_key |
| | | */ |
| | | private String secretKey; |
| | | |
| | | public String getActiveProfile() { |
| | | return activeProfile; |
| | | } |
| | | |
| | | public void setActiveProfile(String activeProfile) { |
| | | this.activeProfile = activeProfile; |
| | | } |
| | | |
| | | public String getAppkey() { |
| | | return appkey; |
| | | } |
| | | |
| | | public void setAppkey(String appkey) { |
| | | this.appkey = appkey; |
| | | } |
| | | |
| | | public String getPrivateKeyPath() { |
| | | return privateKeyPath; |
| | | } |
| | | |
| | | public void setPrivateKeyPath(String privateKeyPath) { |
| | | this.privateKeyPath = privateKeyPath; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getApiUrl() { |
| | | return apiUrl; |
| | | } |
| | | |
| | | public void setApiUrl(String apiUrl) { |
| | | this.apiUrl = apiUrl; |
| | | } |
| | | |
| | | public String getBucketName() { |
| | | return bucketName; |
| | | } |
| | | |
| | | public void setBucketName(String bucketName) { |
| | | this.bucketName = bucketName; |
| | | } |
| | | |
| | | public String getAppId() { |
| | | return appId; |
| | | } |
| | | |
| | | public void setAppId(String appId) { |
| | | this.appId = appId; |
| | | } |
| | | |
| | | public String getEndPoint() { |
| | | return endPoint; |
| | | } |
| | | |
| | | public void setEndPoint(String endPoint) { |
| | | this.endPoint = endPoint; |
| | | } |
| | | |
| | | public String getAccount() { |
| | | return account; |
| | | } |
| | | |
| | | public void setAccount(String account) { |
| | | this.account = account; |
| | | } |
| | | |
| | | public String getAccessKey() { |
| | | return accessKey; |
| | | } |
| | | |
| | | public void setAccessKey(String accessKey) { |
| | | this.accessKey = accessKey; |
| | | } |
| | | |
| | | public String getSecretKey() { |
| | | return secretKey; |
| | | } |
| | | |
| | | public void setSecretKey(String secretKey) { |
| | | this.secretKey = secretKey; |
| | | } |
| | | |
| | | /** |
| | | * 场景编号 |
| | | */ |
| | | String sceneId; |
| | | |
| | | |
| | | public QianYunTongConfig getQianYunTongConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.appkey = "10001104"; |
| | | this.privateKeyPath = "C:\\Users\\Admin\\Desktop\\qyt\\private_key_test.pem"; |
| | | this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; |
| | | this.userName = "xiaofei"; |
| | | this.status = "1"; |
| | | this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); |
| | |
| | | this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); |
| | | this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); |
| | | this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); |
| | | this.sceneId = "1948289607125864448"; |
| | | } |
| | | if("test".equals(activeProfile)){ |
| | | this.setAppkey("10001104"); |
| | |
| | | this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); |
| | | this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); |
| | | this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); |
| | | this.sceneId = "1948289607125864448"; |
| | | } |
| | | if("prod".equals(activeProfile)){ |
| | | this.setAppkey("10001104"); |
| | |
| | | this.setAccount("d8bef0a04db511f0b79d01a3e2b7587e"); |
| | | this.setAccessKey("TYMFTFD5SIIT15DCCUD7"); |
| | | this.setSecretKey("AoI1dkH3yoAvXoaQlREO3ed9mwQJFluLTliS9T1z"); |
| | | this.sceneId = ""; |
| | | } |
| | | return this; |
| | | } |
| | |
| | | return object.getString("code"); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | SendSmsRequest request = new SendSmsRequest(); |
| | | request.setDestAddress("15828353127"); |
| | | request.setTemplateId("TPL202507300002"); |
| | | Map<String, String> templateParams = new HashMap<>(); |
| | | // templateParams.put("code", "1234"); |
| | | request.setTemplateParams(templateParams); |
| | | // request.setCode("code"); |
| | | request.setSpId("Y86asr7J"); |
| | | SMSUtil.sendSms(request); |
| | | } |
| | | |
| | | /** |
| | | * 根据模板发送短信 |
| | |
| | | private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // List<QYTUserInfo> userInfoByPhone = getUserInfoByPhone("15828353127"); |
| | | // System.out.println(userInfoByPhone); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据手机号码获取人员信息 |
| | | * |
| | |
| | | JSONArray data = object.getJSONObject("data").getJSONArray("list"); |
| | | List<QYTUserInfo> list = new ArrayList<>(); |
| | | for (int i = 0; i < data.size(); i++) { |
| | | QYTUserInfo userInfo = data.getObject(i, QYTUserInfo.class); |
| | | list.add(userInfo); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 根据手机号码获取人员信息 |
| | | * |
| | | * @param mobile 手机号码 |
| | | * @param enterNum 企业编号 |
| | | */ |
| | | public static List<QYTUserInfo> getUserInfoByPhone(String mobile, String enterNum) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/getUserInfoByPhone"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("mobile", mobile); |
| | | if (null != enterNum) { |
| | | map.put("enterNum", enterNum); |
| | | } |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | 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); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号码获取人员信息】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | 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); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 根据手机号码获取人员信息 |
| | | * |
| | | * @param mobile 手机号码 |
| | | * @param enterNum 企业编号 |
| | | */ |
| | | public static List<QYTUserInfo> getUserInfoByPhone(String mobile, String enterNum) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/getUserInfoByPhone"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("mobile", mobile); |
| | | if (null != enterNum) { |
| | | map.put("enterNum", enterNum); |
| | | } |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | 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); |
| | | return null; |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | String status = object.getString("status"); |
| | | if (!"0".equals(status)) { |
| | | log.error("【根据手机号码获取人员信息】失败:" + object.toJSONString()); |
| | | return null; |
| | | } |
| | | 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 realName |
| | | * @param cardNo |
| | |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | return object.getBoolean("isok"); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | private String totalFee; |
| | | /** |
| | | * 支付工单状态 |
| | | * 0 待支付 |
| | | * 1 部分支付成功 |
| | | * 2 支付成功 |
| | | * 3 支付失败 |
| | | */ |
| | | private String status; |
| | | /** |
| | | * 商品信息 |
| | | */ |
| | | private List<GoodsInfoRequest> goodsInfo; |
| | |
| | | * 付款方式,6:微信 7:支付宝 8:银行卡 9:银联二维码 10银联购物车收银台 |
| | | */ |
| | | private Integer payChannel; |
| | | /** |
| | | * 是否补偿单。1、是,0、否 |
| | | */ |
| | | private Integer isCompensate; |
| | | } |
| | |
| | | @Data |
| | | public class QYTPaymentCallbackData { |
| | | /** |
| | | * 业务侧行程编号 |
| | | */ |
| | | private String orderNo; |
| | | /** |
| | | * 商户单标识。行程单ID |
| | | */ |
| | | private String partnerPayId; |
| | |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <!--设置共享session--> |
| | | <dependency> |
| | | <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> |
| | |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.7.7</version> |
| | | </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>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> |
| | | <dependency> |
| | | <groupId>com.ncoss</groupId> |
| | | <artifactId>ncoss-java-sdk</artifactId> |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; |
| | | |
| | | /** |
| | | * spring session配置 |
| | |
| | | * @author fengshuonan |
| | | * @date 2017-07-13 21:05 |
| | | */ |
| | | //@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 1800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | @EnableRedisHttpSession(maxInactiveIntervalInSeconds = 28800) //session过期时间 如果部署多机环境,需要打开注释 |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public class SpringSessionConfig { |
| | | |
| | |
| | | package com.stylefeng.guns.config.web; |
| | | |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.intercept.GunsUserFilter; |
| | | import com.stylefeng.guns.core.shiro.ShiroDbRealm; |
| | | import org.apache.shiro.cache.CacheManager; |
| | | import org.apache.shiro.cache.ehcache.EhCacheManager; |
| | | import org.apache.shiro.codec.Base64; |
| | | import org.apache.shiro.session.mgt.SessionManager; |
| | | import org.apache.shiro.spring.LifecycleBeanPostProcessor; |
| | | import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; |
| | | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; |
| | | import org.apache.shiro.web.mgt.CookieRememberMeManager; |
| | | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; |
| | | import org.apache.shiro.web.servlet.Cookie; |
| | | import org.apache.shiro.web.servlet.ShiroHttpSession; |
| | | import org.apache.shiro.web.servlet.SimpleCookie; |
| | | import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; |
| | | import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; |
| | | import org.springframework.beans.factory.config.MethodInvokingFactoryBean; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.servlet.Filter; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * shiro权限管理的配置 |
| | | * |
| | | * @author fengshuonan |
| | | * @date 2016年11月14日 下午3:03:44 |
| | | */ |
| | | @Configuration |
| | | public class ShiroConfig { |
| | | |
| | | /** |
| | | * 安全管理器 |
| | | */ |
| | | @Bean |
| | | public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) { |
| | | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); |
| | | securityManager.setRealm(this.shiroDbRealm()); |
| | | securityManager.setCacheManager(cacheShiroManager); |
| | | securityManager.setRememberMeManager(rememberMeManager); |
| | | securityManager.setSessionManager(sessionManager); |
| | | return securityManager; |
| | | } |
| | | |
| | | /** |
| | | * spring session管理器(多机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | public ServletContainerSessionManager servletContainerSessionManager() { |
| | | return new ServletContainerSessionManager(); |
| | | } |
| | | |
| | | /** |
| | | * session管理器(单机环境) |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "false") |
| | | public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) { |
| | | DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); |
| | | sessionManager.setCacheManager(cacheShiroManager); |
| | | sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000); |
| | | sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000); |
| | | sessionManager.setDeleteInvalidSessions(true); |
| | | sessionManager.setSessionValidationSchedulerEnabled(true); |
| | | Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME); |
| | | cookie.setName("shiroCookie"); |
| | | cookie.setHttpOnly(true); |
| | | sessionManager.setSessionIdCookie(cookie); |
| | | return sessionManager; |
| | | } |
| | | |
| | | /** |
| | | * 缓存管理器 使用Ehcache实现 |
| | | */ |
| | | @Bean |
| | | public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { |
| | | EhCacheManager ehCacheManager = new EhCacheManager(); |
| | | ehCacheManager.setCacheManager(ehcache.getObject()); |
| | | return ehCacheManager; |
| | | } |
| | | |
| | | /** |
| | | * 项目自定义的Realm |
| | | */ |
| | | @Bean |
| | | public ShiroDbRealm shiroDbRealm() { |
| | | return new ShiroDbRealm(); |
| | | } |
| | | |
| | | /** |
| | | * rememberMe管理器, cipherKey生成见{@code Base64Test.java} |
| | | */ |
| | | @Bean |
| | | public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { |
| | | CookieRememberMeManager manager = new CookieRememberMeManager(); |
| | | // manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); |
| | | manager.setCookie(rememberMeCookie); |
| | | return manager; |
| | | } |
| | | |
| | | /** |
| | | * 记住密码Cookie |
| | | */ |
| | | @Bean |
| | | public SimpleCookie rememberMeCookie() { |
| | | // SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); |
| | | SimpleCookie simpleCookie = new SimpleCookie(""); |
| | | simpleCookie.setHttpOnly(true); |
| | | simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天 |
| | | return simpleCookie; |
| | | } |
| | | |
| | | /** |
| | | * Shiro的过滤器链 |
| | | */ |
| | | @Bean |
| | | public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { |
| | | ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); |
| | | shiroFilter.setSecurityManager(securityManager); |
| | | /** |
| | | * 默认的登陆访问url |
| | | */ |
| | | shiroFilter.setLoginUrl("/login"); |
| | | /** |
| | | * 登陆成功后跳转的url |
| | | */ |
| | | shiroFilter.setSuccessUrl("/"); |
| | | /** |
| | | * 没有权限跳转的url |
| | | */ |
| | | shiroFilter.setUnauthorizedUrl("/global/error"); |
| | | |
| | | /** |
| | | * 覆盖默认的user拦截器(默认拦截器解决不了ajax请求 session超时的问题,若有更好的办法请及时反馈作者) |
| | | */ |
| | | HashMap<String, Filter> myFilters = new HashMap<>(); |
| | | myFilters.put("user", new GunsUserFilter()); |
| | | shiroFilter.setFilters(myFilters); |
| | | |
| | | /** |
| | | * 配置shiro拦截器链 |
| | | * |
| | | * anon 不需要认证 |
| | | * authc 需要认证 |
| | | * user 验证通过或RememberMe登录的都可以 |
| | | * |
| | | * 当应用开启了rememberMe时,用户下次访问时可以是一个user,但不会是authc,因为authc是需要重新认证的 |
| | | * |
| | | * 顺序从上到下,优先级依次降低 |
| | | * |
| | | * api开头的接口,走rest api鉴权,不走shiro鉴权 |
| | | * |
| | | */ |
| | | Map<String, String> hashMap = new LinkedHashMap<>(); |
| | | hashMap.put("/static/**", "anon"); |
| | | hashMap.put("/base/**", "anon"); |
| | | hashMap.put("/upload/**", "anon"); |
| | | hashMap.put("/gunsApi/**", "anon"); |
| | | hashMap.put("/login", "anon"); |
| | | hashMap.put("/global/sessionError", "anon"); |
| | | hashMap.put("/kaptcha", "anon"); |
| | | hashMap.put("/**", "user"); |
| | | shiroFilter.setFilterChainDefinitionMap(hashMap); |
| | | return shiroFilter; |
| | | } |
| | | |
| | | /** |
| | | * 在方法中 注入 securityManager,进行代理控制 |
| | | */ |
| | | @Bean |
| | | public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) { |
| | | MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean(); |
| | | bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); |
| | | bean.setArguments(new Object[]{securityManager}); |
| | | return bean; |
| | | } |
| | | |
| | | /** |
| | | * Shiro生命周期处理器: |
| | | * 用于在实现了Initializable接口的Shiro bean初始化时调用Initializable接口回调(例如:UserRealm) |
| | | * 在实现了Destroyable接口的Shiro bean销毁时调用 Destroyable接口回调(例如:DefaultSecurityManager) |
| | | */ |
| | | @Bean |
| | | public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { |
| | | return new LifecycleBeanPostProcessor(); |
| | | } |
| | | |
| | | /** |
| | | * 启用shrio授权注解拦截方式,AOP式方法级权限检查 |
| | | */ |
| | | @Bean |
| | | public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) { |
| | | AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = |
| | | new AuthorizationAttributeSourceAdvisor(); |
| | | authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); |
| | | return authorizationAttributeSourceAdvisor; |
| | | } |
| | | |
| | | } |
| | | //package com.stylefeng.guns.config.web; |
| | | // |
| | | //import com.stylefeng.guns.config.properties.GunsProperties; |
| | | //import com.stylefeng.guns.core.intercept.GunsUserFilter; |
| | | //import com.stylefeng.guns.core.shiro.ShiroDbRealm; |
| | | //import org.apache.shiro.cache.CacheManager; |
| | | //import org.apache.shiro.cache.ehcache.EhCacheManager; |
| | | //import org.apache.shiro.codec.Base64; |
| | | //import org.apache.shiro.session.mgt.SessionManager; |
| | | //import org.apache.shiro.spring.LifecycleBeanPostProcessor; |
| | | //import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; |
| | | //import org.apache.shiro.spring.web.ShiroFilterFactoryBean; |
| | | //import org.apache.shiro.web.mgt.CookieRememberMeManager; |
| | | //import org.apache.shiro.web.mgt.DefaultWebSecurityManager; |
| | | //import org.apache.shiro.web.servlet.Cookie; |
| | | //import org.apache.shiro.web.servlet.ShiroHttpSession; |
| | | //import org.apache.shiro.web.servlet.SimpleCookie; |
| | | //import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; |
| | | //import org.apache.shiro.web.session.mgt.ServletContainerSessionManager; |
| | | //import org.springframework.beans.factory.config.MethodInvokingFactoryBean; |
| | | //import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | //import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; |
| | | //import org.springframework.context.annotation.Bean; |
| | | //import org.springframework.context.annotation.Configuration; |
| | | // |
| | | //import javax.servlet.Filter; |
| | | //import java.util.HashMap; |
| | | //import java.util.LinkedHashMap; |
| | | //import java.util.Map; |
| | | // |
| | | ///** |
| | | // * shiro权限管理的配置 |
| | | // * |
| | | // * @author fengshuonan |
| | | // * @date 2016年11月14日 下午3:03:44 |
| | | // */ |
| | | //@Configuration |
| | | //public class ShiroConfig { |
| | | // |
| | | // /** |
| | | // * 安全管理器 |
| | | // */ |
| | | // @Bean |
| | | // public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) { |
| | | // DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); |
| | | // securityManager.setRealm(this.shiroDbRealm()); |
| | | // securityManager.setCacheManager(cacheShiroManager); |
| | | // securityManager.setRememberMeManager(rememberMeManager); |
| | | // securityManager.setSessionManager(sessionManager); |
| | | // return securityManager; |
| | | // } |
| | | // |
| | | // /** |
| | | // * spring session管理器(多机环境) |
| | | // */ |
| | | // @Bean |
| | | // @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "true") |
| | | // public ServletContainerSessionManager servletContainerSessionManager() { |
| | | // return new ServletContainerSessionManager(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * session管理器(单机环境) |
| | | // */ |
| | | // @Bean |
| | | // @ConditionalOnProperty(prefix = "guns", name = "spring-session-open", havingValue = "false") |
| | | // public DefaultWebSessionManager defaultWebSessionManager(CacheManager cacheShiroManager, GunsProperties gunsProperties) { |
| | | // DefaultWebSessionManager sessionManager = new DefaultWebSessionManager(); |
| | | // sessionManager.setCacheManager(cacheShiroManager); |
| | | // sessionManager.setSessionValidationInterval(gunsProperties.getSessionValidationInterval() * 1000); |
| | | // sessionManager.setGlobalSessionTimeout(gunsProperties.getSessionInvalidateTime() * 1000); |
| | | // sessionManager.setDeleteInvalidSessions(true); |
| | | // sessionManager.setSessionValidationSchedulerEnabled(true); |
| | | // Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME); |
| | | // cookie.setName("shiroCookie"); |
| | | // cookie.setHttpOnly(true); |
| | | // sessionManager.setSessionIdCookie(cookie); |
| | | // return sessionManager; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 缓存管理器 使用Ehcache实现 |
| | | // */ |
| | | // @Bean |
| | | // public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) { |
| | | // EhCacheManager ehCacheManager = new EhCacheManager(); |
| | | // ehCacheManager.setCacheManager(ehcache.getObject()); |
| | | // return ehCacheManager; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 项目自定义的Realm |
| | | // */ |
| | | // @Bean |
| | | // public ShiroDbRealm shiroDbRealm() { |
| | | // return new ShiroDbRealm(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * rememberMe管理器, cipherKey生成见{@code Base64Test.java} |
| | | // */ |
| | | // @Bean |
| | | // public CookieRememberMeManager rememberMeManager(SimpleCookie rememberMeCookie) { |
| | | // CookieRememberMeManager manager = new CookieRememberMeManager(); |
| | | //// manager.setCipherKey(Base64.decode("Z3VucwAAAAAAAAAAAAAAAA==")); |
| | | // manager.setCookie(rememberMeCookie); |
| | | // return manager; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 记住密码Cookie |
| | | // */ |
| | | // @Bean |
| | | // public SimpleCookie rememberMeCookie() { |
| | | //// SimpleCookie simpleCookie = new SimpleCookie("rememberMe"); |
| | | // SimpleCookie simpleCookie = new SimpleCookie(""); |
| | | // simpleCookie.setHttpOnly(true); |
| | | // simpleCookie.setMaxAge(7 * 24 * 60 * 60);//7天 |
| | | // return simpleCookie; |
| | | // } |
| | | // |
| | | // /** |
| | | // * Shiro的过滤器链 |
| | | // */ |
| | | // @Bean |
| | | // public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityManager) { |
| | | // ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean(); |
| | | // shiroFilter.setSecurityManager(securityManager); |
| | | // /** |
| | | // * 默认的登陆访问url |
| | | // */ |
| | | // shiroFilter.setLoginUrl("/login"); |
| | | // /** |
| | | // * 登陆成功后跳转的url |
| | | // */ |
| | | // shiroFilter.setSuccessUrl("/"); |
| | | // /** |
| | | // * 没有权限跳转的url |
| | | // */ |
| | | // shiroFilter.setUnauthorizedUrl("/global/error"); |
| | | // |
| | | // /** |
| | | // * 覆盖默认的user拦截器(默认拦截器解决不了ajax请求 session超时的问题,若有更好的办法请及时反馈作者) |
| | | // */ |
| | | // HashMap<String, Filter> myFilters = new HashMap<>(); |
| | | // myFilters.put("user", new GunsUserFilter()); |
| | | // shiroFilter.setFilters(myFilters); |
| | | // |
| | | // /** |
| | | // * 配置shiro拦截器链 |
| | | // * |
| | | // * anon 不需要认证 |
| | | // * authc 需要认证 |
| | | // * user 验证通过或RememberMe登录的都可以 |
| | | // * |
| | | // * 当应用开启了rememberMe时,用户下次访问时可以是一个user,但不会是authc,因为authc是需要重新认证的 |
| | | // * |
| | | // * 顺序从上到下,优先级依次降低 |
| | | // * |
| | | // * api开头的接口,走rest api鉴权,不走shiro鉴权 |
| | | // * |
| | | // */ |
| | | // Map<String, String> hashMap = new LinkedHashMap<>(); |
| | | // hashMap.put("/static/**", "anon"); |
| | | // hashMap.put("/base/**", "anon"); |
| | | // hashMap.put("/upload/**", "anon"); |
| | | // hashMap.put("/gunsApi/**", "anon"); |
| | | // hashMap.put("/login", "anon"); |
| | | // hashMap.put("/global/sessionError", "anon"); |
| | | // hashMap.put("/kaptcha", "anon"); |
| | | // hashMap.put("/**", "user"); |
| | | // shiroFilter.setFilterChainDefinitionMap(hashMap); |
| | | // return shiroFilter; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 在方法中 注入 securityManager,进行代理控制 |
| | | // */ |
| | | // @Bean |
| | | // public MethodInvokingFactoryBean methodInvokingFactoryBean(DefaultWebSecurityManager securityManager) { |
| | | // MethodInvokingFactoryBean bean = new MethodInvokingFactoryBean(); |
| | | // bean.setStaticMethod("org.apache.shiro.SecurityUtils.setSecurityManager"); |
| | | // bean.setArguments(new Object[]{securityManager}); |
| | | // return bean; |
| | | // } |
| | | // |
| | | // /** |
| | | // * Shiro生命周期处理器: |
| | | // * 用于在实现了Initializable接口的Shiro bean初始化时调用Initializable接口回调(例如:UserRealm) |
| | | // * 在实现了Destroyable接口的Shiro bean销毁时调用 Destroyable接口回调(例如:DefaultSecurityManager) |
| | | // */ |
| | | // @Bean |
| | | // public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { |
| | | // return new LifecycleBeanPostProcessor(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 启用shrio授权注解拦截方式,AOP式方法级权限检查 |
| | | // */ |
| | | // @Bean |
| | | // public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) { |
| | | // AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = |
| | | // new AuthorizationAttributeSourceAdvisor(); |
| | | // authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); |
| | | // return authorizationAttributeSourceAdvisor; |
| | | // } |
| | | // |
| | | //} |
| | |
| | | import com.stylefeng.guns.core.intercept.RestApiInteceptor; |
| | | import com.stylefeng.guns.core.listener.ConfigListener; |
| | | import com.stylefeng.guns.core.xss.XssFilter; |
| | | import edu.yale.its.tp.cas.client.filter.OnconMDCasFilter; |
| | | import org.jasig.cas.client.session.SingleSignOutFilter; |
| | | import org.jasig.cas.client.session.SingleSignOutHttpSessionListener; |
| | | import org.springframework.aop.Advisor; |
| | | import org.springframework.aop.support.DefaultPointcutAdvisor; |
| | | import org.springframework.aop.support.JdkRegexpMethodPointcut; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; |
| | | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
| | |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private GunsProperties gunsProperties; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String activeProfile; |
| | | |
| | | /** |
| | | * 增加swagger的支持 |
| | |
| | | defaultKaptcha.setConfig(config); |
| | | return defaultKaptcha; |
| | | } |
| | | |
| | | |
| | | /********************黔云通单点登录拦截器**********************/ |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean getOnconMDCasFilter() { |
| | | OnconMDCasFilter onconMDCasFilter = new OnconMDCasFilter(); |
| | | FilterRegistrationBean registrationBean = new FilterRegistrationBean(); |
| | | if("dev".equals(activeProfile)){ |
| | | registrationBean.setFilter(onconMDCasFilter); |
| | | List<String> urlPatterns = new ArrayList<String>(); |
| | | urlPatterns.add("/*"); |
| | | registrationBean.setUrlPatterns(urlPatterns); |
| | | registrationBean.setOrder(2); |
| | | |
| | | registrationBean.addInitParameter("oncon.com.security.urls", "/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.noCheckUrl", "/index.html,/static/**,/upload/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.nologinstatus", "/*"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.loginstatus", "/*"); |
| | | registrationBean.addInitParameter("com.oncon.sso.urlparams.nologin", "code,code2"); |
| | | |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.loginUrl", "https://testsso1.teamshub.com/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.validateUrl", "https://testsso1.teamshub.com/serviceValidate"); |
| | | registrationBean.addInitParameter("com.oncon.md.loginUrl", "https://testsso1.teamshub.com/sso-session/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.serverName", "http://127.0.0.1:8010"); |
| | | } |
| | | if("test".equals(activeProfile)){ |
| | | registrationBean.setFilter(onconMDCasFilter); |
| | | List<String> urlPatterns = new ArrayList<String>(); |
| | | urlPatterns.add("/*"); |
| | | registrationBean.setUrlPatterns(urlPatterns); |
| | | registrationBean.setOrder(2); |
| | | |
| | | registrationBean.addInitParameter("oncon.com.security.urls", "/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.noCheckUrl", "/index.html,/static/**,/upload/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.nologinstatus", "/*"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.loginstatus", "/*"); |
| | | registrationBean.addInitParameter("com.oncon.sso.urlparams.nologin", "code,code2"); |
| | | |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.loginUrl", "https://testsso1.teamshub.com/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.validateUrl", "https://testsso1.teamshub.com/serviceValidate"); |
| | | registrationBean.addInitParameter("com.oncon.md.loginUrl", "https://testsso1.teamshub.com/sso-session/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.serverName", "https://test-qncx.sitechcloud.com:443"); |
| | | } |
| | | if("prod".equals(activeProfile)){ |
| | | registrationBean.setFilter(onconMDCasFilter); |
| | | List<String> urlPatterns = new ArrayList<String>(); |
| | | urlPatterns.add("/*"); |
| | | registrationBean.setUrlPatterns(urlPatterns); |
| | | registrationBean.setOrder(2); |
| | | |
| | | registrationBean.addInitParameter("oncon.com.security.urls", "/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.noCheckUrl", "/index.html,/static/**,/upload/**"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.nologinstatus", "/*"); |
| | | registrationBean.addInitParameter("erp.si-tech.com.cn.loginstatus", "/*"); |
| | | registrationBean.addInitParameter("com.oncon.sso.urlparams.nologin", "code,code2"); |
| | | |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.loginUrl", "https://sso.teamshub.com/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.validateUrl", "https://sso.teamshub.com/serviceValidate"); |
| | | registrationBean.addInitParameter("com.oncon.md.loginUrl", "https://passport.teamshub.com/login"); |
| | | registrationBean.addInitParameter("edu.yale.its.tp.cas.client.filter.serverName", "https://traffic.qytzt.cn:443"); |
| | | } |
| | | return registrationBean; |
| | | } |
| | | |
| | | @Bean |
| | | public FilterRegistrationBean getSingleSignOutFilter() { |
| | | SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter(); |
| | | FilterRegistrationBean registrationBean = new FilterRegistrationBean(); |
| | | registrationBean.setFilter(singleSignOutFilter); |
| | | List<String> urlPatterns = new ArrayList<String>(); |
| | | urlPatterns.add("/*");//拦截路径,可以添加多个 |
| | | registrationBean.setUrlPatterns(urlPatterns); |
| | | registrationBean.setOrder(1); |
| | | |
| | | registrationBean.addInitParameter("wmall.flag", "false"); |
| | | |
| | | return registrationBean; |
| | | } |
| | | |
| | | |
| | | @Bean |
| | | public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> getSingleSignOutHttpSessionListener() { |
| | | ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> servletListenerRegistrationBean |
| | | = new ServletListenerRegistrationBean<>(); |
| | | servletListenerRegistrationBean.setListener(new SingleSignOutHttpSessionListener()); |
| | | return servletListenerRegistrationBean; |
| | | } |
| | | } |
| | |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(GunsException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(shiroExtUtil.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", e.getMessage()); |
| | | log.error("业务异常:", e); |
| | | return new ErrorTip(e.getCode(), e.getMessage()); |
| | |
| | | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
| | | @ResponseBody |
| | | public ErrorTip notFount(RuntimeException e) { |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); |
| | | LogManager.me().executeLog(LogTaskFactory.exceptionLog(shiroExtUtil.getUser().getId(), e)); |
| | | getRequest().setAttribute("tip", "服务器未知运行时异常"); |
| | | log.error("运行时异常:", e); |
| | | return new ErrorTip(BizExceptionEnum.SERVER_ERROR.getCode(), BizExceptionEnum.SERVER_ERROR.getMessage()); |
| | |
| | | String methodName = currentMethod.getName(); |
| | | |
| | | //如果当前用户未登录,不做日志 |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | if (null == user) { |
| | | return; |
| | | } |
| | |
| | | import com.stylefeng.guns.core.tag.DictSelectorTag; |
| | | import com.stylefeng.guns.core.util.KaptchaUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.util.SpringContextsUtil; |
| | | import org.beetl.core.Context; |
| | | import org.beetl.core.Function; |
| | | import org.beetl.core.Tag; |
| | |
| | | |
| | | @Override |
| | | public void initOther() { |
| | | groupTemplate.registerFunctionPackage("shiro", new ShiroExt()); |
| | | groupTemplate.registerFunctionPackage("shiro", SpringContextsUtil.getBean(ShiroExtUtil.class)); |
| | | groupTemplate.registerFunctionPackage("tool", new ToolUtil()); |
| | | groupTemplate.registerFunctionPackage("kaptcha", new KaptchaUtil()); |
| | | groupTemplate.registerTagFactory("dictSelector", new TagFactory() { |
| | |
| | | * 判断当前用户是否是超级管理员 |
| | | */ |
| | | public static boolean isAdmin() { |
| | | List<Integer> roleList = ShiroKit.getUser().getRoleList(); |
| | | List<Integer> roleList = shiroExtUtil.getUser().getRoleList(); |
| | | for (Integer integer : roleList) { |
| | | String singleRoleTip = ConstantFactory.me().getSingleRoleTip(integer); |
| | | if (singleRoleTip.equals(Const.ADMIN_NAME)) { |
| | |
| | | public List<String> roleNames; // 角色名称集 |
| | | public Integer roleType; // 角色类型 1=平台 2=分公司 3=加盟商 |
| | | public Integer objectId; // 对象ID |
| | | public List<String> menuIds; //菜单 |
| | | |
| | | public boolean isAdmin; //是否是超管 |
| | | |
| | | |
| | | public Integer getId() { |
| | |
| | | public void setObjectId(Integer objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public List<String> getMenuIds() { |
| | | return menuIds; |
| | | } |
| | | |
| | | public void setMenuIds(List<String> menuIds) { |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return isAdmin; |
| | | } |
| | | |
| | | public void setAdmin(boolean admin) { |
| | | isAdmin = admin; |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public boolean check(Object[] permissions) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | |
| | | @Override |
| | | public boolean checkAll() { |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | if (null == user) { |
| | | return false; |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getSumData") |
| | | public Object getSumData(Integer companyId, Date addDate, Date start, Date end){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | Integer id = shiroExtUtil.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | if(companyId == null && user.getRoleType() != 1){ |
| | | companyId = user.getObjectId(); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getDriverPosition") |
| | | public Object getDriverPosition(Integer companyId){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | Integer id = shiroExtUtil.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | if(companyId == null && user.getRoleType() != 1){ |
| | | companyId = user.getObjectId(); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getCompanyInfoByUserId") |
| | | public Object getCompanyInfoByUserId(){ |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | Integer id = shiroExtUtil.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | companys = new ArrayList<>(); |
| | | List<TCompany> ids = new ArrayList<>(); |
| | |
| | | } |
| | | if(SinataUtil.isNotEmpty(couponUseType)){wrapper.eq("couponUseType",couponUseType);} |
| | | if(SinataUtil.isNotEmpty(status)){wrapper.eq("status",status);} |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | if(user.getRoleType()!=1){ |
| | | wrapper.eq("companyId",user.getObjectId()); |
| | | wrapper.eq("companyType",user.getRoleType()); |
| | |
| | | sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); |
| | | sysCouponActivity.setInsertTime(new Date()); |
| | | sysCouponActivity.setCouponId(activityId); |
| | | sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysCouponActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); |
| | | sysCouponActivityService.insert(sysCouponActivity); |
| | | if(sysCouponActivity.getCompanyType()==1){ |
| | |
| | | sysCouponActivity.setFullMoney(sysCouponRecord.getFullMoney()); |
| | | sysCouponActivity.setInsertTime(new Date()); |
| | | sysCouponActivity.setCouponId(activityId); |
| | | sysCouponActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysCouponActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | sysCouponActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | sysCouponActivity.setStatus(sysCouponActivity.getCompanyType()==1?3:1); |
| | | sysCouponActivityService.updateById(sysCouponActivity); |
| | | return SUCCESS_TIP; |
| | |
| | | if(SinataUtil.isNotEmpty(createTime)){ |
| | | wrapper.between("insertTime",startTimes,endTimes); |
| | | } |
| | | wrapper.eq("companyId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("companyType",ShiroKit.getUser().getRoleType()); |
| | | wrapper.eq("companyId",shiroExtUtil.getUser().getObjectId()); |
| | | wrapper.eq("companyType",shiroExtUtil.getUser().getRoleType()); |
| | | wrapper.orderBy("id",false); |
| | | return super.packForBT(sysRedPacketRecordService.selectPage(page,wrapper)); |
| | | } |
| | |
| | | @ResponseBody |
| | | public Object add(SysRedPacketRecord sysRedPacketRecord) { |
| | | sysRedPacketRecord.setInsertTime(new Date()); |
| | | sysRedPacketRecord.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | sysRedPacketRecord.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | sysRedPacketRecord.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | sysRedPacketRecord.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | sysRedPacketRecordService.insert(sysRedPacketRecord); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | @ResponseBody |
| | | public Object add(TAdvertisement tAdvertisement) { |
| | | tAdvertisement.setInsertTime(new Date()); |
| | | tAdvertisement.setInsertUser(ShiroKit.getUser().getId()); |
| | | tAdvertisement.setInsertUser(shiroExtUtil.getUser().getId()); |
| | | tAdvertisementService.insert(tAdvertisement); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | tAdvertisement.setState(2); |
| | | } |
| | | tAdvertisement.setUpdateTime(new Date()); |
| | | tAdvertisement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAdvertisement.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tAdvertisementService.updateById(tAdvertisement); |
| | | } |
| | | return SUCCESS_TIP; |
| | |
| | | @ResponseBody |
| | | public Object update(TAdvertisement tAdvertisement) { |
| | | tAdvertisement.setUpdateTime(new Date()); |
| | | tAdvertisement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAdvertisement.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tAdvertisementService.updateById(tAdvertisement); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | model.addAttribute("userType", Objects.requireNonNull(ShiroKit.getUser()).getRoleType()); |
| | | model.addAttribute("userType", Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType()); |
| | | return PREFIX + "tBranchOffice.html"; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyCityService; |
| | | import com.stylefeng.guns.modular.system.service.ITRegionService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EnterpriseUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 分公司管理控制器 |
| | |
| | | |
| | | @Autowired |
| | | private ITCompanyCityService tCompanyCityService; |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | /** |
| | | * 跳转到修改平台信息 |
| | |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | if(ToolUtil.isEmpty(tCompany.getIdentifier())){ |
| | | return "统一社会信用代码不能为空"; |
| | | } |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterExistByEnterIdCardNo(tCompany.getIdentifier()); |
| | | String enterCode = ""; |
| | | Integer enterNew = null; |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | //企业未注册,进行注册 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setUscc(tCompany.getIdentifier()); |
| | | request.setIndustry_code("292"); |
| | | request.setMobile(account); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | enterNew = 1; |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, enterCode); |
| | | if(null != userInfoByPhone && userInfoByPhone.size() > 0){ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | }else{ |
| | | empId = 0L; |
| | | empnew = 1; |
| | | } |
| | | } |
| | | //企业已注册 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | enterNew = 0; |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, enterCode); |
| | | if(null == userInfoByPhone ||userInfoByPhone.size() == 0){ |
| | | //负责人不匹配,则创建新的员工到中台 |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(checkEnterExist.getMobile()); |
| | | request.setEntercode(enterCode); |
| | | request.setEmpName(tCompany.getName() + "管理员"); |
| | | request.setEmpNickname(tCompany.getName() + "管理员"); |
| | | request.setLoginNo(account); |
| | | request.setEmpSex("男"); |
| | | request.setMphone(account); |
| | | request.setEmail(account + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | } |
| | | |
| | | tCompany.setEnterCode(enterCode); |
| | | tCompany.setEnterNew(enterNew); |
| | | tCompany.setType(2); //2:分公司 |
| | | tCompany.setState(0); //0:正常 |
| | | tCompany.setInsertTime(new Date()); |
| | |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | user.setEmpId(empId); |
| | | user.setEntercode(enterCode); |
| | | user.setEnterId(Long.valueOf(enterCode)); |
| | | user.setEmpnew(empnew); |
| | | userService.insert(user); |
| | | |
| | | //编写异步延迟处理中台账号延迟创建的问题 |
| | | if(0 == empId){ |
| | | Timer timer = new Timer(); |
| | | String finalEnterCode = enterCode; |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, finalEnterCode); |
| | | if(null != userInfoByPhone && userInfoByPhone.size() > 0){ |
| | | Long empId1 = userInfoByPhone.get(0).getEmpId(); |
| | | user.setEmpId(empId1); |
| | | userService.updateById(user); |
| | | } |
| | | } |
| | | },120*1000); |
| | | } |
| | | //添加经营区域 |
| | | addSocpe(subArr,tCompany.getId()); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | |
| | | //添加经营区域 |
| | | public void addSocpe(String subArr,Integer id){ |
| | | JSONArray jsonArray = JSON.parseArray(subArr); |
| | |
| | | if (count > 0){ |
| | | return "error"; |
| | | } |
| | | if(ToolUtil.isEmpty(tCompany.getIdentifier())){ |
| | | return "统一社会信用代码不能为空"; |
| | | } |
| | | //调用中台接口创建企业 |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterExistByEnterIdCardNo(tCompany.getIdentifier()); |
| | | String enterCode = ""; |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | Integer enterNew = null; |
| | | |
| | | //企业未注册,进行注册 |
| | | if (null == checkEnterExist || "0".equals(checkEnterExist.getIsReg())) { |
| | | CreateEnterpriseRequest request = new CreateEnterpriseRequest(); |
| | | request.setName(tCompany.getName()); |
| | | request.setNickName(tCompany.getName()); |
| | | request.setUscc(tCompany.getIdentifier()); |
| | | request.setIndustry_code("292"); |
| | | request.setMobile(account); |
| | | CreateEnterprise enterprise = EnterpriseUtil.createEnterprise(request); |
| | | enterCode = enterprise.getIdCode(); |
| | | enterNew = 1; |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, enterCode); |
| | | if(null != userInfoByPhone && userInfoByPhone.size() > 0){ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | }else{ |
| | | empId = 0L; |
| | | empnew = 1; |
| | | } |
| | | } |
| | | //企业已注册 |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | enterCode = checkEnterExist.getEnterCode(); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, enterCode); |
| | | enterNew = 0; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(checkEnterExist.getMobile()); |
| | | request.setEntercode(enterCode); |
| | | request.setEmpName(tCompany.getName() + "管理员"); |
| | | request.setEmpNickname(tCompany.getName() + "管理员"); |
| | | request.setLoginNo(account); |
| | | request.setEmpSex("女"); |
| | | request.setMphone(account); |
| | | request.setEmail(account + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | } |
| | | |
| | | tCompany.setEnterCode(enterCode); |
| | | tCompany.setEnterNew(enterNew); |
| | | tCompany.setType(3); //2:分公司 |
| | | if (ShiroKit.getUser().getRoleType() == 2){ |
| | | tCompany.setSuperiorId(ShiroKit.getUser().getObjectId()); |
| | |
| | | user.setObjectId(tCompany.getId()); |
| | | user.setName(tCompany.getName()); |
| | | user.setSex(1); |
| | | user.setEmpId(empId); |
| | | user.setEntercode(enterCode); |
| | | user.setEnterId(Long.valueOf(enterCode)); |
| | | user.setEmpnew(empnew); |
| | | userService.insert(user); |
| | | |
| | | //编写异步延迟处理中台账号延迟创建的问题 |
| | | if(0 == empId){ |
| | | Timer timer = new Timer(); |
| | | String finalEnterCode = enterCode; |
| | | timer.schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(account, finalEnterCode); |
| | | if(null != userInfoByPhone && userInfoByPhone.size() > 0){ |
| | | Long empId1 = userInfoByPhone.get(0).getEmpId(); |
| | | user.setEmpId(empId1); |
| | | userService.updateById(user); |
| | | } |
| | | } |
| | | },120*1000); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tCompanyId) { |
| | | TCompany tCompany = tCompanyService.selectById(tCompanyId); |
| | | //调用中台接口创建企业 |
| | | if(1 == tCompany.getEnterNew()){ |
| | | CheckEnterExist checkEnterExist = EnterpriseUtil.checkEnterExistByEnterIdCardNo(tCompany.getIdentifier()); |
| | | if (null != checkEnterExist && "1".equals(checkEnterExist.getIsReg())) { |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user = userService.selectById(user1.getId()); |
| | | ResultUtil resultUtil = EnterpriseUtil.delEnterprise(checkEnterExist.getEnterCode(), user.getPhone()); |
| | | if(resultUtil.getStatus() != 200){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | tCompany.setFlag("3"); |
| | | tCompanyService.updateById(tCompany); |
| | | return SUCCESS_TIP; |
| | |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | | model.addAttribute("companyList",companyList); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>() |
| | | .eq("type", 3) |
| | | .eq("superiorId",ShiroKit.getUser().getObjectId()) |
| | | .eq("superiorId",shiroExtUtil.getUser().getObjectId()) |
| | | .notIn("state",1) |
| | | .notIn("flag",3)); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | |
| | | model.addAttribute("franchiseeList",null); |
| | | } |
| | | //查询当前用户所属分公司/加盟商 |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | model.addAttribute("objectName",tCompanyService.selectById(shiroExtUtil.getUser().getObjectId()).getName()); |
| | | |
| | | //查询线路列表 |
| | | List<TLine> lineList = itLineService.selectList(new EntityWrapper<TLine>().eq("state", 1)); |
| | |
| | | model.addAttribute("item",tDriver); |
| | | LogObjectHolder.me().set(tDriver); |
| | | |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | model.addAttribute("roleType",roleType); |
| | | model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName()); |
| | | model.addAttribute("objectName",tCompanyService.selectById(shiroExtUtil.getUser().getObjectId()).getName()); |
| | | |
| | | if (1 == roleType){ |
| | | List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2)); |
| | |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tDriver.getCompanyId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | }else if (2 == roleType){ |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId())); |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",shiroExtUtil.getUser().getObjectId())); |
| | | model.addAttribute("franchiseeList",franchiseeList); |
| | | } |
| | | |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | if (shiroExtUtil.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tDriverService.getAuthDriverList(page,beginTime,endTime,companyName,phone,account,addType,authState)); |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDriverService.getDriverList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,companyName,phone,name,addType,authState)); |
| | | page.setRecords(tDriverService.getDriverList(page,shiroExtUtil.getUser().getRoleType(),shiroExtUtil.getUser().getObjectId(),beginTime,endTime,companyName,phone,name,addType,authState)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | |
| | | }*//* |
| | | //2020-08-21:新需求,已被绑定的车辆可以被继续绑定 |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tDriverService.getCanSelectCarList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),null,carLicensePlate,brandName,modelName,color,serverStr)); |
| | | page.setRecords(tDriverService.getCanSelectCarList(page,shiroExtUtil.getUser().getRoleType(),shiroExtUtil.getUser().getObjectId(),null,carLicensePlate,brandName,modelName,color,serverStr)); |
| | | return super.packForBT(page); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | |
| | | import com.stylefeng.guns.modular.system.util.DateUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | //import com.stylefeng.guns.modular.system.util.bank.BankUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.DeleteStafNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | private AccountChangeDetailMapper accountChangeDetailMapper; |
| | | |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | @RequestMapping(value = "/auditSubmit") |
| | | @ResponseBody |
| | | public Object auditSubmit(Integer id,Integer approvalStatus,String approvalNotes) { |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TDriver tDriver = tDriverService.selectById(id); |
| | | |
| | | |
| | | |
| | | tDriver.setApprovalStatus(approvalStatus); |
| | | tDriver.setApprovalNotes(approvalNotes); |
| | | // 审核用户id |
| | |
| | | tDriver.setApprovalUserId(shiroUser.getId()); |
| | | tDriver.setApprovalTime(new Date()); |
| | | if (approvalStatus==2){ |
| | | // T21000001Response t21000001Response = BankUtil.addAccount(tDriver); |
| | | // tDriver.setMerchantNumber(t21000001Response.getDATA().getUSER_ID()); |
| | | //审核通过,在中台添加司机账号 |
| | | Integer objectId = tDriver.getBranchOfficeId(); |
| | | TCompany tCompany = companyService.selectById(objectId); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDriver.getPhone(), tCompany.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(user2.getPhone()); |
| | | request.setEntercode(tCompany.getEnterCode()); |
| | | request.setEmpName(tDriver.getName()); |
| | | request.setEmpNickname(tDriver.getName()); |
| | | request.setLoginNo(tDriver.getPhone()); |
| | | request.setEmpSex(tDriver.getSex() == 1 ? "男" : "女"); |
| | | request.setMphone(tDriver.getPhone()); |
| | | request.setEmail(tDriver.getPhone() + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | tDriver.setEmpId(empId); |
| | | tDriver.setEntercode(tCompany.getEnterCode()); |
| | | tDriver.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | tDriver.setEmpnew(empnew); |
| | | } |
| | | tDriverService.updateById(tDriver); |
| | | |
| | |
| | | accountChangeDetailMapper.insert(accountChangeDetail); |
| | | tDriverService.updateById(tDriver1); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | if(count>0){ |
| | | return new SuccessTip(500,"该司机已存在!"); |
| | | } |
| | | if(ToolUtil.isEmpty(tDriver.getIdcard())){ |
| | | return "身份证号不能为空"; |
| | | } |
| | | Boolean b = UserUtil.idCardAuth(tDriver.getName(), tDriver.getIdcard()); |
| | | if(!b){ |
| | | return "司机姓名和身份证号不匹配"; |
| | | } |
| | | Object o = tDriverService.addOrUpdate(tDriver); |
| | | if(Objects.nonNull(o)){ |
| | | return o; |
| | |
| | | tDriver.setBalance(BigDecimal.ZERO); |
| | | tDriver.setBackgroundBalance(BigDecimal.ZERO); |
| | | tDriver.setCommission(BigDecimal.ZERO); |
| | | if(2 == tDriver.getApprovalStatus()){ |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user.getId()); |
| | | Integer objectId = user.getObjectId(); |
| | | TCompany tCompany = companyService.selectById(objectId); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(tDriver.getPhone(), tCompany.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request = new SaveStaffNodeRequest(); |
| | | request.setMobile(user2.getPhone()); |
| | | request.setEntercode(tCompany.getEnterCode()); |
| | | request.setEmpName(tDriver.getName()); |
| | | request.setEmpNickname(tDriver.getName()); |
| | | request.setLoginNo(tDriver.getPhone()); |
| | | request.setEmpSex(tDriver.getSex() == 1 ? "男" : "女"); |
| | | request.setMphone(tDriver.getPhone()); |
| | | request.setEmail(tDriver.getPhone() + "@qyt.com"); |
| | | request.setDeptId(0); |
| | | request.setPositionId(1); |
| | | request.setSuperLevel(0); |
| | | request.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | |
| | | TCompany tCompany1 = companyService.selectById(tDriver.getBranchOfficeId()); |
| | | tDriver.setEmpId(empId); |
| | | tDriver.setEntercode(tCompany1.getEnterCode()); |
| | | tDriver.setEnterId(Long.valueOf(tCompany1.getEnterCode())); |
| | | tDriver.setEmpnew(empnew); |
| | | } |
| | | |
| | | |
| | | tDriverService.insert(tDriver); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | @RequestMapping(value = "/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tDriverId) { |
| | | TDriver driver = tDriverService.selectById(tDriverId); |
| | | |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | TCompany tCompany = companyService.selectById(user.getObjectId()); |
| | | if (null != driver.getEmpId() && 1 == driver.getEmpnew()) { |
| | | //中台先删除司机 |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(driver.getPhone(), tCompany.getEnterCode()); |
| | | if (null != userInfoByPhone && 0 < userInfoByPhone.size() && 1 == driver.getEmpnew()) { |
| | | DeleteStafNodeRequest deleteStafNodeRequest = new DeleteStafNodeRequest(); |
| | | deleteStafNodeRequest.setEmpId(driver.getEmpId()); |
| | | deleteStafNodeRequest.setEntercode(tCompany.getEnterCode()); |
| | | deleteStafNodeRequest.setMobile(tCompany.getPrincipalPhone()); |
| | | ResultUtil resultUtil = EmployeeUtil.ecrmDeleteStafNode(deleteStafNodeRequest); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | tDriverService.deleteById(tDriverId); |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | if(Objects.nonNull(driver) && !tDriver.getId().equals(driver.getId())){ |
| | | return new SuccessTip(500,"该司机已存在!"); |
| | | } |
| | | // Object ocr = ocr("E:\\071bf986db0b00355c0ed190bbd3b16.png"); |
| | | // System.err.println(ocr); |
| | | if(ToolUtil.isEmpty(tDriver.getIdcard())){ |
| | | return "身份证号不能为空"; |
| | | } |
| | | Boolean b = UserUtil.idCardAuth(tDriver.getName(), tDriver.getIdcard()); |
| | | if(!b){ |
| | | return "司机姓名和身份证号不匹配"; |
| | | } |
| | | Object o = tDriverService.addOrUpdate(tDriver); |
| | | if(Objects.nonNull(o)){ |
| | | return o; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "导出司机佣金列表",notes="导出司机佣金列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | if (shiroExtUtil.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | page.setRecords(tSysSensitiveWordsService.getSensitiveWordList(page,beginTime,endTime,content)); |
| | |
| | | @RequestMapping(value = "/blanceList") |
| | | @ResponseBody |
| | | public Object blanceList(String createTime,Integer activityId) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | |
| | | @RequestMapping("") |
| | | public String blackboard(Model model,Integer type,Integer agentId,String dayDate,String yearDate,String monthDate) { |
| | | //查询当前用户是否有"首页"菜单的权限 |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | Integer id = shiroExtUtil.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | Integer menuNum = userService.getMenuNumByRole(user.getRoleid()); |
| | | if (menuNum > 0){ |
| | | return "/home.html"; |
| | | } else { |
| | | //查询登录次数 |
| | | // int count = loginLogService.selectCount(new EntityWrapper<LoginLog>().eq("userid", ShiroKit.getUser().getId())); |
| | | // int count = loginLogService.selectCount(new EntityWrapper<LoginLog>().eq("userid", shiroExtUtil.getUser().getId())); |
| | | // model.addAttribute("loginNum", count); |
| | | // |
| | | // Role role = roleService.selectById(user.getRoleid()); |
| | |
| | | if(Objects.isNull(type)){ |
| | | type = 1; |
| | | } |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | if(roleType == 2 && Objects.nonNull(objectId)){ |
| | | // 查询所有分公司 |
| | |
| | | model.addAttribute("agentList",agentList); |
| | | } |
| | | model.addAttribute("txt",new SimpleDateFormat("yyyy年MM月dd日").format(new Date()) + DateUtil.getWeekDay(new Date()) + ",欢迎" + |
| | | Objects.requireNonNull(ShiroKit.getUser()).getName() + "登录"); |
| | | Objects.requireNonNull(shiroExtUtil.getUser()).getName() + "登录"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(Objects.nonNull(agentId)){ |
| | | // 统计分公司 |
| | |
| | | package com.stylefeng.guns.modular.system.controller.system; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | |
| | | import com.stylefeng.guns.core.util.KaptchaUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.Menu; |
| | | import com.stylefeng.guns.modular.system.model.Relation; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.IMenuService; |
| | | import com.stylefeng.guns.modular.system.service.IRelationService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.AESUtil; |
| | | import com.stylefeng.guns.modular.system.util.AESUtils; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | | import org.apache.shiro.authc.UsernamePasswordToken; |
| | | import org.apache.shiro.subject.Subject; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.stylefeng.guns.core.support.HttpKit.getIp; |
| | | |
| | |
| | | * @author fengshuonan |
| | | * @Date 2017年1月10日 下午8:25:24 |
| | | */ |
| | | @Slf4j |
| | | @Controller |
| | | public class LoginController extends BaseController { |
| | | |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private IShiro shiro; |
| | | |
| | | @Autowired |
| | | private UserMapper userMapper; |
| | | |
| | | private Map<String, Integer> loginFailures = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | private IRelationService relationService; |
| | | |
| | | |
| | | |
| | |
| | | * 跳转到主页 |
| | | */ |
| | | @RequestMapping(value = "/", method = RequestMethod.GET) |
| | | public String index(Model model) { |
| | | public String index(Model model, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | //session中解析用户数据 |
| | | HttpSession session = request.getSession(); |
| | | String onconParam = edu.yale.its.tp.cas.client.Util.getOnconParam(session); |
| | | onconParam = new String(Base64.decodeBase64(onconParam), "UTF-8"); |
| | | LoginUser loginUser = JSON.parseObject(onconParam, LoginUser.class); |
| | | log.info("session解析结果:" + JSON.toJSONString(loginUser)); |
| | | //获取菜单列表 |
| | | List<Integer> roleList = ShiroKit.getUser().getRoleList(); |
| | | if (roleList == null || roleList.size() == 0) { |
| | | ShiroKit.getSubject().logout(); |
| | | model.addAttribute("tips", "该用户没有角色,无法登陆"); |
| | | return "/login.html"; |
| | | User user = userMapper.getByAccount(loginUser.getImUser()); |
| | | if (null == user) { |
| | | log.info("用户不存在"); |
| | | return null; |
| | | } |
| | | ShiroUser shiroUser = shiro.shiroUser(user); |
| | | List<Integer> roleList = shiroUser.getRoleList(); |
| | | if (roleList == null || roleList.size() == 0) { |
| | | roleList.add(0); |
| | | } |
| | | |
| | | List<Relation> relations = relationService.selectList(new EntityWrapper<Relation>().in("roleid", roleList)); |
| | | Set<Long> collect = relations.stream().map(Relation::getMenuid).collect(Collectors.toSet()); |
| | | List<Menu> menuList = menuService.selectBatchIds(collect); |
| | | List<MenuNode> menus = menuService.getMenusByRoleIds(roleList); |
| | | List<MenuNode> titles = MenuNode.buildTitle(menus); |
| | | titles = ApiMenuFilter.build(titles); |
| | | |
| | | |
| | | Integer id = ShiroKit.getUser().getId(); |
| | | User user = userService.selectById(id); |
| | | if (SinataUtil.isEmpty(user)){ |
| | | ShiroKit.getSubject().logout(); |
| | | model.addAttribute("tips", "请重新登录"); |
| | | return "/login.html"; |
| | | } |
| | | //设置上级ID |
| | | if (SinataUtil.isNotEmpty(user.getObjectId())){ |
| | | ShiroKit.getUser().setObjectId(user.getObjectId()); |
| | | } |
| | | //设置角色 |
| | | ShiroKit.getUser().setRoleType(user.getRoleType()); |
| | | shiroUser.setMenuIds(menuList.stream().map(Menu::getUrl).collect(Collectors.toList())); |
| | | |
| | | model.addAttribute("titles", titles); |
| | | |
| | |
| | | @RequestMapping(value = "/login", method = RequestMethod.GET) |
| | | public String login(Model model) { |
| | | model.addAttribute("number",0); |
| | | if (ShiroKit.isAuthenticated() || ShiroKit.getUser() != null) { |
| | | if (ShiroKit.isAuthenticated() || shiroExtUtil.getUser() != null) { |
| | | return REDIRECT + "/"; |
| | | } else { |
| | | return "/login.html"; |
| | |
| | | // 登录成功,错误次数值改0 |
| | | loginFailures.put(username, 0); |
| | | |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | ShiroUser shiroUser = shiroExtUtil.getUser(); |
| | | super.getSession().setAttribute("shiroUser", shiroUser); |
| | | super.getSession().setAttribute("username", shiroUser.getAccount()); |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/logout", method = RequestMethod.GET) |
| | | public String logOut() { |
| | | LogManager.me().executeLog(LogTaskFactory.exitLog(ShiroKit.getUser().getId(), getIp())); |
| | | ShiroKit.getSubject().logout(); |
| | | deleteAllCookie(); |
| | | return REDIRECT + "/login"; |
| | | return REDIRECT + "/"; |
| | | } |
| | | } |
| | |
| | | import com.heredata.hos.model.bucket.Bucket; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.ErrorTip; |
| | | import com.stylefeng.guns.core.base.tips.Tip; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.annotion.BussinessLog; |
| | | import com.stylefeng.guns.core.common.annotion.Permission; |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.transfer.UserDto; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.huawei.OBSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.EmployeeUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.NCOSSUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.QianYunTongConfig; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.UserUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.DeleteStafNodeRequest; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNode; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.SaveStaffNodeRequest; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | |
| | | @Autowired |
| | | private QianYunTongConfig qianYunTongConfig; |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RequestMapping("/user_info") |
| | | public String userInfo(Model model) { |
| | | Integer userId = ShiroKit.getUser().getId(); |
| | | Integer userId = shiroExtUtil.getUser().getId(); |
| | | if (ToolUtil.isEmpty(userId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | |
| | | if (!newPwd.equals(rePwd)) { |
| | | throw new GunsException(BizExceptionEnum.TWO_PWD_NOT_MATCH); |
| | | } |
| | | Integer userId = ShiroKit.getUser().getId(); |
| | | Integer userId = shiroExtUtil.getUser().getId(); |
| | | User user = userService.selectById(userId); |
| | | String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt()); |
| | | if (user.getPassword().equals(oldMd5)) { |
| | |
| | | page.setRecords(userService.getUserListPage(page,null, name, beginTime, endTime, deptid)); |
| | | return super.packForBT(page); |
| | | } else { |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | |
| | | if(roleType == 3){ |
| | | // 查询下级分公司账号 |
| | |
| | | if (result.hasErrors()) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | // 判断账号是否重复 |
| | | User theUser = userService.getByAccount(user.getAccount()); |
| | | if (theUser != null) { |
| | | throw new GunsException(BizExceptionEnum.USER_ALREADY_REG); |
| | | } |
| | | |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tCompany.getEnterCode()); |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request1 = new SaveStaffNodeRequest(); |
| | | request1.setMobile(user2.getPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | request1.setEmpName(user.getName()); |
| | | request1.setEmpNickname(user.getName()); |
| | | request1.setLoginNo(user.getAccount()); |
| | | request1.setEmpSex(user.getSex() == 1 ? "男" : "女"); |
| | | request1.setMphone(user.getPhone()); |
| | | request1.setEmail(user.getPhone() + "@qyt.com"); |
| | | request1.setDeptId(0); |
| | | request1.setPositionId(1); |
| | | request1.setSuperLevel(0); |
| | | request1.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request1); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | |
| | | |
| | | // 完善账号信息 |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | |
| | | user.setCreatetime(new Date()); |
| | | |
| | | User objectUser = UserFactory.createUser(user); |
| | | ShiroUser user1 = ShiroKit.getUser(); |
| | | objectUser.setRoleType(user1.getRoleType()); |
| | | objectUser.setObjectId(user1.getObjectId()); |
| | | objectUser.setPassWordUpdate(new Date()); |
| | | objectUser.setEnterId(empId); |
| | | objectUser.setEmpnew(empnew); |
| | | objectUser.setEntercode(tCompany.getEnterCode()); |
| | | objectUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | this.userService.insert(objectUser); |
| | | |
| | | return SUCCESS_TIP; |
| | |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | |
| | | |
| | | User oldUser = userService.selectById(user.getId()); |
| | | |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | //调用中台接口 |
| | | Long empId = null; |
| | | Integer empnew = null; |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(oldUser.getPhone(), tCompany.getEnterCode()); |
| | | if(null == userInfoByPhone || userInfoByPhone.size() == 0){ |
| | | SaveStaffNodeRequest request1 = new SaveStaffNodeRequest(); |
| | | request1.setMobile(user2.getPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | request1.setEmpName(user.getName()); |
| | | request1.setEmpNickname(user.getName()); |
| | | request1.setLoginNo(user.getAccount()); |
| | | request1.setEmpSex(user.getSex() == 1 ? "男" : "女"); |
| | | request1.setMphone(user.getPhone()); |
| | | request1.setEmail(user.getPhone() + "@qyt.com"); |
| | | request1.setDeptId(0); |
| | | request1.setPositionId(1); |
| | | request1.setSuperLevel(0); |
| | | request1.setHideMobile(0); |
| | | ResultUtil<SaveStaffNode> resultUtil = EmployeeUtil.saveStaffNode(request1); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | SaveStaffNode saveStaffNode = resultUtil.getData(); |
| | | empId = saveStaffNode.getEmpId(); |
| | | empnew = 1; |
| | | }else{ |
| | | empId = userInfoByPhone.get(0).getEmpId(); |
| | | empnew = 0; |
| | | } |
| | | oldUser.setEmpId(empId); |
| | | oldUser.setEntercode(tCompany.getEnterCode()); |
| | | oldUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | oldUser.setEmpnew(empnew); |
| | | if (ShiroKit.hasRole(Const.ADMIN_NAME)) { |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | | return SUCCESS_TIP; |
| | | } else { |
| | | assertAuth(user.getId()); |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | ShiroUser shiroUser = shiroExtUtil.getUser(); |
| | | if (shiroUser.getId().equals(user.getId())) { |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | | return SUCCESS_TIP; |
| | |
| | | if (userId.equals(Const.ADMIN_ID)) { |
| | | throw new GunsException(BizExceptionEnum.CANT_DELETE_ADMIN); |
| | | } |
| | | |
| | | User user = userService.selectById(userId); |
| | | ShiroUser user1 = shiroExtUtil.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | //调用中台接口 |
| | | if(1 == user.getEmpnew()){ |
| | | List<QYTUserInfo> userInfoByPhone = UserUtil.getUserInfoByPhone(user.getPhone(), tCompany.getEnterCode()); |
| | | if (null != userInfoByPhone && 0 < userInfoByPhone.size() && 1 == user.getEmpnew()) { |
| | | DeleteStafNodeRequest request1 = new DeleteStafNodeRequest(); |
| | | request1.setEmpId(user.getEnterId()); |
| | | request1.setMobile(tCompany.getPrincipalPhone()); |
| | | request1.setEntercode(tCompany.getEnterCode()); |
| | | ResultUtil resultUtil = EmployeeUtil.ecrmDeleteStafNode(request1); |
| | | if(200 != resultUtil.getStatus()){ |
| | | return new ErrorTip(resultUtil.getStatus(), resultUtil.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | assertAuth(userId); |
| | | this.userService.setStatus(userId, ManagerStatus.DELETED.getCode()); |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderTaxiService.getTaxiOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,driver,state)); |
| | | page.setRecords(tOrderTaxiService.getTaxiOrderList(page,beginTime,endTime,shiroExtUtil.getUser().getRoleType(),shiroExtUtil.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,driver,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | |
| | | private String idCardPositive; |
| | | //身份证反面 |
| | | private String idCardReverse; |
| | | /** |
| | | * 中台企业编号 |
| | | */ |
| | | private String enterCode; |
| | | /** |
| | | * 中台新增标识(0=否,1=是) |
| | | */ |
| | | private Integer enterNew; |
| | | |
| | | public String getIdCardPositive() { |
| | | return idCardPositive; |
| | |
| | | this.detailAddress = detailAddress; |
| | | } |
| | | |
| | | public String getEnterCode() { |
| | | return enterCode; |
| | | } |
| | | |
| | | public void setEnterCode(String enterCode) { |
| | | this.enterCode = enterCode; |
| | | } |
| | | |
| | | public Integer getEnterNew() { |
| | | return enterNew; |
| | | } |
| | | |
| | | public void setEnterNew(Integer enterNew) { |
| | | this.enterNew = enterNew; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "邀请人电话") |
| | | private String inviterPhone; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | /** |
| | | * 中台新增状态(0=否,1=是) |
| | | */ |
| | | @TableField("empnew") |
| | | private Integer empnew; |
| | | |
| | | |
| | | public BigDecimal getCouponBalance() { |
| | |
| | | public void setOnlineTime(Long onlineTime) { |
| | | this.onlineTime = onlineTime; |
| | | } |
| | | |
| | | public String getMerchantNumber() { |
| | | return merchantNumber; |
| | | } |
| | | |
| | | public void setMerchantNumber(String merchantNumber) { |
| | | this.merchantNumber = merchantNumber; |
| | | } |
| | | |
| | | public Integer getOpenOrderQRCode() { |
| | | return openOrderQRCode; |
| | | } |
| | | |
| | | public void setOpenOrderQRCode(Integer openOrderQRCode) { |
| | | this.openOrderQRCode = openOrderQRCode; |
| | | } |
| | | |
| | | public Integer getCheckServer() { |
| | | return checkServer; |
| | | } |
| | | |
| | | public void setCheckServer(Integer checkServer) { |
| | | this.checkServer = checkServer; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public Integer getEmpnew() { |
| | | return empnew; |
| | | } |
| | | |
| | | public void setEmpnew(Integer empnew) { |
| | | this.empnew = empnew; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | private Integer insertUser; |
| | | private Date updateTime; |
| | | private Integer updateUser; |
| | | /** |
| | | * 中台用户ID |
| | | */ |
| | | @TableField("onconUUID") |
| | | private String onconUUID; |
| | | |
| | | |
| | | public Integer getId() { |
| | |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public String getOnconUUID() { |
| | | return onconUUID; |
| | | } |
| | | |
| | | public void setOnconUUID(String onconUUID) { |
| | | this.onconUUID = onconUUID; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | */ |
| | | @TableField(value = "object_id") |
| | | private Integer objectId; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | /** |
| | | * 中台新增状态(0=否,1=是) |
| | | */ |
| | | @TableField("empnew") |
| | | private Integer empnew; |
| | | |
| | | public Integer getRoleType() { |
| | | return roleType; |
| | |
| | | this.version = version; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public Integer getEmpnew() { |
| | | return empnew; |
| | | } |
| | | |
| | | public void setEmpnew(Integer empnew) { |
| | | this.empnew = empnew; |
| | | } |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCompanyFundFlow(Page<Map<String, Object>> page, Integer type, String time) { |
| | | Integer roleType = ShiroKit.getUser().getRoleType(); |
| | | Integer roleType = shiroExtUtil.getUser().getRoleType(); |
| | | if(roleType == 3){ |
| | | roleType = 2; |
| | | } |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | String start = ""; |
| | | String end = ""; |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | |
| | | String[] timeArray = startTime.split(" - "); |
| | | Date startTimes = DateUtil.getDate_str3(timeArray[0]); |
| | | Date endTimes = DateUtil.getDate_str3(timeArray[1]); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | Date nowDay = new Date(); |
| | | //添加活动 |
| | | DriverActivity driverActivity = new DriverActivity(); |
| | | driverActivity.setInsertTime(nowDay); |
| | | driverActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | driverActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | driverActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | driverActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | driverActivity.setStatus(driverActivity.getCompanyType()==1?3:1); |
| | | driverActivity.setName(num1); |
| | | driverActivity.setStartTime(startTimes); |
| | |
| | | String[] timeArray = startTime.split(" - "); |
| | | Date startTimes = DateUtil.getDate_str3(timeArray[0]); |
| | | Date endTimes = DateUtil.getDate_str3(timeArray[1]); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | |
| | | Date nowDay = new Date(); |
| | | //添加活动 |
| | | DriverActivity driverActivity = new DriverActivity(); |
| | | driverActivity.setId(id); |
| | | driverActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | driverActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | driverActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | driverActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | driverActivity.setStatus(driverActivity.getCompanyType()==1?3:1); |
| | | driverActivity.setName(num1); |
| | | driverActivity.setStartTime(startTimes); |
| | |
| | | wrapper.between("createTime",startTime,endTime); |
| | | } |
| | | // 判断是否为代理商 |
| | | if(Objects.requireNonNull(ShiroKit.getUser()).getRoleType() == 3){ |
| | | wrapper.eq("id",ShiroKit.getUser().getObjectId()); |
| | | if(Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType() == 3){ |
| | | wrapper.eq("id",shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | // 状态 |
| | | if(Objects.nonNull(status)){ |
| | |
| | | startTime = split[0]+" 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | return tBillMapper.getPageList(startTime, endTime, addresseePhone,state,billType,billHeaderType,roleType,objectId); |
| | | } |
| | | } |
| | |
| | | wrapper.ne("status", StatusEnum.DELETE.getCode()); |
| | | wrapper.orderBy("createTime",false); |
| | | // 判断代理商 分公司 |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | if(2 == roleType){ |
| | | // 分公司 |
| | | wrapper.eq("id",objectId); |
| | |
| | | startTime = split[0]; |
| | | endTime = split[1]; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | return tCancelOrderMapper.getCancelOrderList(startTime,endTime,code,source,userName,userPhone,state,driverName,roleType,objectId); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public Page<TCheckCarActivity> getOrderList(String createTime, String branchOfficeName, String name, String activityAreaCode, Integer status) { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(createTime)){ |
| | |
| | | if (ShiroKit.isAdmin()) { |
| | | tCheckCarExplain.setBranchOfficeId(-1); |
| | | } else { |
| | | tCheckCarExplain.setBranchOfficeId(ShiroKit.getUser().getObjectId()); |
| | | tCheckCarExplain.setBranchOfficeId(shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | if (tCheckCarExplain.getId() == null) { |
| | | |
| | |
| | | startTime = split[0] + " 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | return tComplaintMapper.getPageList(startTime,endTime,userName,userPhone,driverPhone,state,roleType,objectId); |
| | | } |
| | | } |
| | |
| | | } |
| | | wrapper.orderBy(true,"approvalStatus"); |
| | | // 判断是否为代理商或者分公司 |
| | | if(Objects.requireNonNull(ShiroKit.getUser()).getRoleType() == 2){ |
| | | if(Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType() == 2){ |
| | | // 分公司 |
| | | wrapper.eq("branchOfficeId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("branchOfficeId",shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | if(Objects.requireNonNull(ShiroKit.getUser()).getRoleType() == 3){ |
| | | if(Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType() == 3){ |
| | | // 代理商 |
| | | wrapper.eq("agentId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("agentId",shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | return wrapper; |
| | | } |
| | |
| | | } |
| | | wrapper.orderBy(true,"approvalStatus"); |
| | | // 判断是否为代理商或者分公司 |
| | | if(Objects.requireNonNull(ShiroKit.getUser()).getRoleType() == 2){ |
| | | if(Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType() == 2){ |
| | | // 分公司 |
| | | wrapper.eq("branchOfficeId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("branchOfficeId",shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | if(Objects.requireNonNull(ShiroKit.getUser()).getRoleType() == 3){ |
| | | if(Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType() == 3){ |
| | | // 代理商 |
| | | wrapper.eq("agentId",ShiroKit.getUser().getObjectId()); |
| | | wrapper.eq("agentId",shiroExtUtil.getUser().getObjectId()); |
| | | } |
| | | return wrapper; |
| | | } |
| | |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | List<TEvaluateResp> list = tEvaluateMapper.selectPageList(startTime, endTime, userName, driverName, orderType, score); |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | if(3 == roleType){ |
| | | list = list.stream().filter(tEvaluate -> tEvaluate.getAgentId().equals(objectId)).collect(Collectors.toList()); |
| | | } |
| | |
| | | public Page<TOrderCheck> getOrderCheckList(String createTime, String code, Integer source, String userName, String userPhone, Integer state, String driverName) { |
| | | //获取当前登录用户身份 |
| | | boolean admin = ShiroKit.isAdmin(); |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | String startTime = null; |
| | | String endTime = null; |
| | | // 开始,结束时间 |
| | |
| | | Page<DriverDispatchInfoResp> page = new PageFactory<DriverDispatchInfoResp>().defaultPage(); |
| | | //获取当前登录信息 |
| | | boolean admin = ShiroKit.isAdmin(); |
| | | Integer branchOfficeId = admin ? null : ShiroKit.getUser().getObjectId(); |
| | | Integer branchOfficeId = admin ? null : shiroExtUtil.getUser().getObjectId(); |
| | | // 查询有车检服务权限的司机列表(支持搜索) |
| | | List<DriverDispatchInfoResp> driverList = tDriverMapper.queryCheckServiceDriversWithSearch(page, |
| | | 1, // checkServer = 1 (有车检服务权限) |
| | |
| | | TOrderCheck updateOrder = new TOrderCheck(); |
| | | updateOrder.setId(orderId); |
| | | updateOrder.setState(OrderStateEnum.PENDING_ORDER.getCode()); // 设置为待接单状态 |
| | | updateOrder.setOperatorId(ShiroKit.getUser().getId()); |
| | | updateOrder.setOperatorName(ShiroKit.getUser().getName()); |
| | | updateOrder.setOperatorId(shiroExtUtil.getUser().getId()); |
| | | updateOrder.setOperatorName(shiroExtUtil.getUser().getName()); |
| | | updateOrder.setDispatchTime(new Date()); |
| | | this.updateById(updateOrder); |
| | | } |
| | |
| | | // 设置默认状态(正常) |
| | | order.setStatus(1); |
| | | //设置分公司id |
| | | order.setBranchOfficeId(ShiroKit.getUser().getObjectId()); |
| | | order.setBranchOfficeId(shiroExtUtil.getUser().getObjectId()); |
| | | //处理费用 |
| | | handleOrderPrice(order.getBranchOfficeId(), order); |
| | | // 保存订单 |
| | |
| | | String userName, String userPhone, Integer state, String driverName) { |
| | | //获取当前登录用户身份 |
| | | boolean admin = ShiroKit.isAdmin(); |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | String startTime = null; |
| | | String endTime = null; |
| | | // 开始,结束时间 |
| | |
| | | startTime = split[0] + " 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | return tOrderMapper.getOrderList(startTime,endTime,code,source,userName,userPhone,state,driverName,isException,roleType,objectId); |
| | | } |
| | | |
| | |
| | | startTime = split[0] + " 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | if(Objects.nonNull(branchOfficeId)){ |
| | | roleType = 2; |
| | | objectId = branchOfficeId; |
| | |
| | | startTime = split[0] + " 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | if(Objects.nonNull(branchOfficeId)){ |
| | | roleType = 2; |
| | | objectId = branchOfficeId; |
| | |
| | | startTime = split[0] + " 00:00:00"; |
| | | endTime = split[1] + " 23:59:59"; |
| | | } |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(shiroExtUtil.getUser()).getRoleType(); |
| | | Integer objectId = Objects.requireNonNull(shiroExtUtil.getUser()).getObjectId(); |
| | | if(Objects.nonNull(branchOfficeId)){ |
| | | objectId = branchOfficeId; |
| | | roleType = 2; |
| | |
| | | String[] timeArray = startTime.split(" - "); |
| | | Date startTimes = DateUtil.getDate_str3(timeArray[0]); |
| | | Date endTimes = DateUtil.getDate_str3(timeArray[1]); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | Date nowDay = new Date(); |
| | | UserActivity userActivity = new UserActivity(); |
| | | userActivity.setInsertTime(nowDay); |
| | | userActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | userActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | userActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | userActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | userActivity.setStatus(userActivity.getCompanyType()==1?3:1); |
| | | userActivity.setName(name); |
| | | userActivity.setStartTime(startTimes); |
| | |
| | | String[] timeArray = startTime.split(" - "); |
| | | Date startTimes = DateUtil.getDate_str3(timeArray[0]); |
| | | Date endTimes = DateUtil.getDate_str3(timeArray[1]); |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | ShiroUser user = shiroExtUtil.getUser(); |
| | | Date nowDay = new Date(); |
| | | UserActivity userActivity = new UserActivity(); |
| | | userActivity.setId(id); |
| | | userActivity.setInsertTime(nowDay); |
| | | userActivity.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | userActivity.setCompanyType(ShiroKit.getUser().getRoleType()); |
| | | userActivity.setCompanyId(shiroExtUtil.getUser().getObjectId()); |
| | | userActivity.setCompanyType(shiroExtUtil.getUser().getRoleType()); |
| | | userActivity.setStatus(userActivity.getCompanyType()==1?3:1); |
| | | userActivity.setName(name); |
| | | userActivity.setStartTime(startTimes); |
| | |
| | | public QianYunTongConfig getQianYunTongConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.appkey = "10001104"; |
| | | this.privateKeyPath = "C:\\Users\\Admin\\Desktop\\qyt\\private_key_test.pem"; |
| | | this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; |
| | | this.userName = "xiaofei"; |
| | | this.status = "1"; |
| | | this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); |
| | |
| | | */ |
| | | private String nickName; |
| | | /** |
| | | * 社会信用代码 |
| | | */ |
| | | private String uscc; |
| | | /** |
| | | * 行业编码 |
| | | */ |
| | | private String industry_code; |
| | |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Long empId; |
| | | private Integer empId; |
| | | /** |
| | | * 操作人手机号 |
| | | */ |
| | |
| | | /** |
| | | * 员工所属部门ID多个部门英文; 分割 |
| | | */ |
| | | private String deptIds; |
| | | private Integer deptId; |
| | | /** |
| | | * 员工职务ID |
| | | */ |
| | |
| | | @Data |
| | | public class QYTUserInfo { |
| | | /** |
| | | * 员工名称 |
| | | */ |
| | | private String empName; |
| | | /** |
| | | * 企业编号 |
| | | */ |
| | | private String enterNum; |
| | | /** |
| | | * 节点路径 |
| | | */ |
| | | private String nodePath; |
| | | /** |
| | | * 员工昵称 |
| | | */ |
| | | private String nickName; |
| | | /** |
| | | * 员工编号 |
| | | * 用户id |
| | | */ |
| | | private Long empId; |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | private String mphone; |
| | | private String mobile; |
| | | /** |
| | | * 员工在企业内部的编号 |
| | | * 用户昵称 |
| | | */ |
| | | private String loginNo; |
| | | private String nickname; |
| | | /** |
| | | * 部门ID |
| | | * 小头像url |
| | | */ |
| | | private Long deptId; |
| | | private String photoUrl; |
| | | /** |
| | | * 大头像url |
| | | */ |
| | | private String photoUrlBig; |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | private String enterName; |
| | | |
| | | } |
| | |
| | | /** |
| | | * 人员ID |
| | | */ |
| | | private Long empId; |
| | | private Integer empId; |
| | | /** |
| | | * 主要号码 |
| | | */ |
| | |
| | | |
| | | spring: |
| | | datasource: |
| | | url: jdbc:mysql://192.168.110.80:3306/qyt_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://127.0.0.1:3306/qyt_driving?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | db-name: qyt_driving #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://192.168.110.80:27017/test |
| | | |
| | | |
| | | |
| | |
| | | spring: |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://192.168.110.80:27017/test |
| | | uri: mongodb://127.0.0.1:27017/test |
| | | |
| | | |
| | | filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 |
| | |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.QianYunTongConfig; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.UserUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.SendSmsRequest; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | |
| | | }) |
| | | public ResponseWarpper queryCaptcha(String phone){ |
| | | try { |
| | | AppUserUtil.queryCaptcha(phone); |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < 4; i++) { |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | String authCode = sb.toString(); |
| | | //中台没有用户数据,需要走注册接口,验证码校验走中台 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | SMSUtil.sendVerifyCode(phone); |
| | | } else { |
| | | SendSmsRequest request = new SendSmsRequest(); |
| | | request.setDestAddress(phone); |
| | | request.setTemplateId("TPL202410290001"); |
| | | Map<String, String> templateParams = new HashMap<>(); |
| | | templateParams.put("code", authCode); |
| | | request.setTemplateParams(templateParams); |
| | | request.setCode("code"); |
| | | request.setSpId("T8d5hdfg"); |
| | | SMSUtil.sendSms(request); |
| | | //发送验证码短信 |
| | | redisUtil.setStrValue(phone, authCode, 5);//设置五分钟过期 |
| | | } |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return ResponseWarpper.success(ResultUtil.tokenErr()); |
| | | } |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | if(ToolUtil.isEmpty(appUser.getOnconUUID())){ |
| | | String onconUUIDByMobile = UserUtil.getOnconUUIDByMobile(appUser.getPhone()); |
| | | appUser.setOnconUUID(onconUUIDByMobile); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | UserInfoWarpper userInfoWarpper = new UserInfoWarpper(); |
| | | BeanUtils.copyProperties(appUser, userInfoWarpper); |
| | | |
| | |
| | | |
| | | //返回success字符串,否则支付系统将重复推送通知,间隔通知频率为0/30/60/90/120/150,单位:秒 |
| | | return "false"; |
| | | |
| | | |
| | | // 验签 |
| | | // boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | // if (verify) {//验签成功业务处理逻辑 |
| | | // if("0000".equals(interfaceResponse.getCode())){ |
| | | // JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | // Integer status = jsonObject.getInteger("status"); |
| | | // String orderId = jsonObject.getString("parameter1"); |
| | | // String parameter2 = jsonObject.getString("parameter2"); |
| | | // if(2 == status){ |
| | | // Order order = orderService.selectById(orderId); |
| | | // AccountChangeDetail accountChangeDetail = accountChangeDetailService.selectById(parameter2); |
| | | // Double m = new BigDecimal(accountChangeDetail.getOldData()).subtract(new BigDecimal(accountChangeDetail.getNewData())).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | // AppUser appUser1 = appUserService.selectById(order.getUserId()); |
| | | // appUser1.setAccountBalance(new BigDecimal(appUser1.getAccountBalance()).add(new BigDecimal(m)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | // appUserService.updateById(appUser1); |
| | | // accountChangeDetailService.deleteById(accountChangeDetail.getId()); |
| | | // System.err.println("支付失败"); |
| | | // } |
| | | // if(1 == status){ |
| | | // String merOrderId = jsonObject.getString("merOrderId"); |
| | | // ResultUtil resultUtil = orderService.orderPayCallback(orderId, merOrderId); |
| | | // if(resultUtil.getCode() == 10000){ |
| | | // response.setStatus(200); |
| | | // PrintWriter out = response.getWriter(); |
| | | // out.print("OK"); |
| | | // out.flush(); |
| | | // out.close(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } else {//验签失败业务处理逻辑 |
| | | // System.err.println("支付回调验签失败"); |
| | | // } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | */ |
| | | @TableField("taxiUserId") |
| | | private Integer taxiUserId; |
| | | /** |
| | | * 中台用户ID |
| | | */ |
| | | @TableField("onconUUID") |
| | | private String onconUUID; |
| | | } |
| | |
| | | */ |
| | | @TableField("referralCode") |
| | | private String referralCode; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | | @TableField("empId") |
| | | private Long empId; |
| | | /** |
| | | * 中台员工所属企业ID |
| | | */ |
| | | @TableField("enterId") |
| | | private Long enterId; |
| | | /** |
| | | * 中台员工所属企业编号 |
| | | */ |
| | | @TableField("entercode") |
| | | private String entercode; |
| | | } |
| | |
| | | @TableField("endTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") |
| | | private Date endTime; |
| | | /** |
| | | * 中台行程id |
| | | */ |
| | | @TableField("travelId") |
| | | private String travelId; |
| | | /** |
| | | * 中台是否已创建订单(0=否,1=是) |
| | | */ |
| | | @TableField("isCreated") |
| | | private Integer isCreated; |
| | | } |
| | |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.QueryOrder; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.Transfer; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.AESUtils; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.UserUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.QYTUserInfo; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.RegisterViaMobile; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.RegisterViaMobileRequest; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WXCore; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.util.weChat.model.Code2Session; |
| | |
| | | } |
| | | String openid = code2Session.getOpenid(); |
| | | AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("phone", phone).ne("status", 3)); |
| | | |
| | | String nickName = null; |
| | | if (null == appUser) { |
| | | nickName = this.getDefaultName(); |
| | | } else { |
| | | nickName = appUser.getNickname(); |
| | | } |
| | | //调中台接口查询用户 |
| | | List<QYTUserInfo> infoByPhone = UserUtil.getUserInfoByPhone(phone); |
| | | String onconUUID = null; |
| | | if (null == infoByPhone || infoByPhone.isEmpty()) { |
| | | RegisterViaMobileRequest request = new RegisterViaMobileRequest(); |
| | | request.setMobile(phone); |
| | | request.setEncryptType("aesbase64"); |
| | | request.setPassword(AESUtils.encryptBase64("123456")); |
| | | request.setNickname(nickName); |
| | | request.setVerify_code(code); |
| | | request.setVerify_code_type("0"); |
| | | RegisterViaMobile register = UserUtil.registerViaMobile(request); |
| | | if (!"0".equals(register.getStatus())) { |
| | | return ResultUtil.error(register.getDesc()); |
| | | } |
| | | onconUUID = register.getOnconUUID(); |
| | | } else { |
| | | boolean b = AppUserUtil.checkCaptcha(phone, code); |
| | | if (!b) { |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | } |
| | | |
| | | |
| | | if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | appUser.setNickname("亲爱的用户"); |
| | |
| | | appUser.setInviterId(verificationCodeLogin.getInviterId()); |
| | | appUser.setInviterType(verificationCodeLogin.getInviterType()); |
| | | } |
| | | if(null != onconUUID){ |
| | | appUser.setOnconUUID(onconUUID); |
| | | } |
| | | //同步用户数据到打车系统 |
| | | String s = AppUserUtil.addUser(phone, code, verificationCodeLogin.getAreaCode()); |
| | | String s = AppUserUtil.addUser(phone, code, verificationCodeLogin.getAreaCode(), onconUUID); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | return ResultUtil.error("登录失败"); |
| | | } |
| | |
| | | public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取默认名称 |
| | | * @return |
| | | */ |
| | | public String getDefaultName(){ |
| | | int num = this.selectCount(new EntityWrapper<AppUser>().ne("status", 3)) + 1000001; |
| | | return "GRJY-DJ" + String.valueOf(num).substring(1); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.dao.OrderMapper; |
| | | import com.supersavedriving.user.modular.system.dao.TCompanyMapper; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.*; |
| | |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.Transfer; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.TrhRequest; |
| | | import com.supersavedriving.user.modular.system.util.mongodb.model.Location; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.*; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath;//支付回调网关地址 |
| | | |
| | | @Autowired |
| | | private TCompanyMapper companyMapper; |
| | | |
| | | |
| | | |
| | |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | |
| | | List<Order> orderList = new ArrayList<>(); |
| | | for (Integer i = 0; i < travelOrder.getDriverNum(); i++) { |
| | | order.setId(null); |
| | | order.setCode(UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(5)); |
| | | boolean insert = this.insert(order); |
| | | if(null != order.getDriverId()){ |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | TCompany company = companyMapper.selectById(order.getDriverId()); |
| | | //调三方订单中心创建行程单 |
| | | CreateTravelItineraryRequest request = new CreateTravelItineraryRequest(); |
| | | request.setOrderNo("DJ" + order.getId()); |
| | | request.setCustomerId(appUser.getOnconUUID()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | request.setServiceType(2); |
| | | String travelItinerary = OrderUtil.createTravelItinerary(request); |
| | | order.setTravelId(travelItinerary); |
| | | this.insertOrUpdate(order); |
| | | } |
| | | |
| | | if(insert){ |
| | | orderList.add(order); |
| | | } |
| | |
| | | order.setState(301); |
| | | this.updateById(order); |
| | | redisUtil.delSetValue("orderService", order.getId().toString()); |
| | | |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != order.getTravelId()){ |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | AppUser appUser = appUserService.selectById(uid); |
| | | appUser.setCancelCount(appUser.getCancelCount() + 1); |
| | | if(appUser.getCancelCount() >= 3){ |
| | | appUser.setIsException(2); |
| | | } |
| | | appUserService.updateById(appUser); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null != driver){ |
| | | driver.setServerStatus(1); |
| | | driverService.updateById(driver); |
| | |
| | | } |
| | | redisUtil.setStrValue("cancelOrder", "true"); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | private Integer getState(Integer state){ |
| | | switch (state){ |
| | | case 101://待接单 |
| | | return 1; |
| | | case 102://已接单 |
| | | return 2; |
| | | case 103://前往预约点 |
| | | return 3; |
| | | case 104://到达预约点 |
| | | return 4; |
| | | case 105://开始服务 |
| | | return 5; |
| | | case 106://到达目的地 |
| | | return 6; |
| | | case 107://待支付 |
| | | return 7; |
| | | case 108://待评价 |
| | | return 8; |
| | | case 109://已完成 |
| | | return 9; |
| | | case 201://转单中 |
| | | return 11; |
| | | case 301://已取消 |
| | | return 10; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | //开始支付操作 |
| | | if(orderPayment.getPayType() == 1){//微信支付 |
| | | return weixinPay(order, appUser, orderPayment.getCouponId()); |
| | | return weixinPay(order, appUser, orderPayment.getCouponId(), orderPayment.getPath(), orderPayment.getIp()); |
| | | } |
| | | if(orderPayment.getPayType() == 2){//余额支付 |
| | | return balancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | // if(orderPayment.getPayType() == 3){//线下支付(由司机端操作) |
| | | // } |
| | | if(orderPayment.getPayType() == 4){//微信+余额 |
| | | return weixinAndBalancePayment(order, appUser, orderPayment.getCouponId()); |
| | | } |
| | | // if(orderPayment.getPayType() == 4){//微信+余额 |
| | | // return weixinAndBalancePayment(order, appUser, orderPayment.getCouponId()); |
| | | // } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId) throws Exception{ |
| | | public ResultUtil weixinPay(Order order, AppUser appUser, Integer couponId, String path, String ip) throws Exception{ |
| | | Double payMoney = order.getPayMoney(); |
| | | order.setPayType(1); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String out_trade_no = sdf.format(new Date()) + order.getId(); |
| | | ResultUtil resultUtil = ResultUtil.success(new Object()); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | if(null == order.getIsCreated() || 0 == order.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | | tradeOrderCreateData.setTreatShopId(driver.getEmpId().toString()); |
| | | tradeOrderCreateData.setField1("{\"profitSharing\":\"1\",\"isCompensate\":\"0\",\"isPromote\":\"0\"}"); |
| | | tradeOrderCreateData.setCharge(new BigDecimal(payMoney).setScale(2, RoundingMode.HALF_EVEN)); |
| | | tradeOrderCreateData.setOrderNo("DJ" + order.getId()); |
| | | tradeOrderCreateData.setCustomerId(appUser.getOnconUUID()); |
| | | tradeOrderCreateData.setPartnerPayId(order.getTravelId()); |
| | | tradeOrderCreateData.setTotalFee(Double.valueOf(payMoney * 100).intValue() + ""); |
| | | tradeOrderCreateData.setOrderDesc("完成订单"); |
| | | tradeOrderCreateData.setRetUrl(path); |
| | | tradeOrderCreateData.setClientIp(ip); |
| | | tradeOrderCreateData.setServiceType(3); |
| | | |
| | | // |
| | | // PaymentOrder paymentOrder = new PaymentOrder(); |
| | | // paymentOrder.setBizOrderId(out_trade_no); |
| | | // paymentOrder.setAmount(new BigDecimal(payMoney).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + ""); |
| | | // paymentOrder.setOrderName("代驾服务费"); |
| | | // paymentOrder.setPayType("WX_MINI"); |
| | | // paymentOrder.setTransferType("0"); |
| | | // paymentOrder.setAsynSplitFlag("1"); |
| | | // paymentOrder.setAppid(appletsAppid); |
| | | // paymentOrder.setOpenid(appUser.getOpenid()); |
| | | // paymentOrder.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | // List<PaymentOrderGood> goodsDetail = new ArrayList<>(); |
| | | // PaymentOrderGood paymentOrderGood = new PaymentOrderGood(); |
| | | // paymentOrderGood.setGoodsName("服务费"); |
| | | // goodsDetail.add(paymentOrderGood); |
| | | // paymentOrder.setGoodsDetail(goodsDetail); |
| | | // paymentOrder.setFrontUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | // paymentOrder.setNotifyUrl(callbackPath + "/base/order/orderPayCallback"); |
| | | // paymentOrder.setParameter1(order.getId().toString()); |
| | | // |
| | | // TrhRequest<PaymentOrder> request = new TrhRequest(); |
| | | // InterfaceResponse execute = request.execute(paymentOrder, PaymentOrder.SERVICE_CODE); |
| | | return MiniAppPay.pay(appUser.getOpenid(),new BigDecimal(payMoney).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + "","/base/order/orderPayCallback",order.getCode()); |
| | | // return payMoneyUtil.weixinpay("服务费", String.valueOf(order.getId()),out_trade_no,new BigDecimal(payMoney).multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_EVEN).longValue() + "","/base/order/orderPayCallback","APP"); |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(appUser.getOpenid()); |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradeOrderCreateData.setGoodsInfo(goodsInfo); |
| | | TradeOrderCreate tradeOrderCreate = OrderUtil.tradeOrderCreate1(tradeOrderCreateData, 0); |
| | | PayInfo payInfo = tradeOrderCreate.getPayInfo(); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | order.setIsCreated(1); |
| | | order.setTravelId(tradeOrderCreate.getOrderInfo().getOrderId()); |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | | tradePayOff1Data.setPartnerPayId(order.getTravelId()); |
| | | tradePayOff1Data.setTotalFee(Double.valueOf(payMoney * 100).intValue() + ""); |
| | | tradePayOff1Data.setRetUrl(path); |
| | | tradePayOff1Data.setClientIp(ip); |
| | | tradePayOff1Data.setOrderDesc("完成订单"); |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(appUser.getOpenid()); |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradePayOff1Data.setGoodsInfo(goodsInfo); |
| | | PayInfo payInfo = OrderUtil.tradePayOff1(tradePayOff1Data, 0); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | } |
| | | this.updateById(order); |
| | | |
| | | //创建定时任务查询订单支付状态 |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor.execute(()->{ |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | Order order1 = this.selectById(order.getId()); |
| | | if (order1.getState() != 107) { |
| | | break; |
| | | } |
| | | GetTravelItineraryListRequest request = new GetTravelItineraryListRequest(); |
| | | request.setCustomerId(appUser.getOnconUUID()); |
| | | request.setOrderNo("DJ" + order1.getId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | ListPage<List<TravelItinerary>> travelItineraryList = OrderUtil.getTravelItineraryList(request); |
| | | TravelItinerary travelItinerary = travelItineraryList.getList().get(0); |
| | | if(travelItinerary.getStatus() != 7 || Arrays.asList(3, 11).contains(travelItinerary.getOrderStatus())){ |
| | | GetPaymentInfoDataRequest getPaymentInfoDataRequest1 = new GetPaymentInfoDataRequest(); |
| | | getPaymentInfoDataRequest1.setPartnerPayId(order1.getTravelId()); |
| | | GetPaymentInfo getPaymentInfo1 = OrderUtil.paymentInfo(getPaymentInfoDataRequest1); |
| | | orderPayCallback(order1.getId().toString(), getPaymentInfo1.getPayId()); |
| | | break; |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | threadPoolExecutor.shutdown(); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // |
| | | // if(!"0000".equals(execute.getCode())){ |
| | | // return ResultUtil.error(execute.getMsg()); |
| | | // } |
| | | // JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | // String status = jsonObject.getString("status"); |
| | | // if("2".equals(status)){ |
| | | // return ResultUtil.error("失败"); |
| | | // } |
| | | // String merOrderId = jsonObject.getString("merOrderId"); |
| | | // String payCode = jsonObject.getString("payCode"); |
| | | // this.updateById(order); |
| | | |
| | | // if(ToolUtil.isNotEmpty(payCode)){ |
| | | // new Thread(new Runnable() { |
| | | // @Override |
| | | // public void run() { |
| | | // try { |
| | | // int num = 1; |
| | | // int wait = 0; |
| | | // while (num <= 10){ |
| | | // int min = 5000; |
| | | // wait += (min * num); |
| | | // Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | // if(order1.getState() != 107){ |
| | | // return; |
| | | // } |
| | | // QueryOrder queryOrder = new QueryOrder(); |
| | | // queryOrder.setOriginalMerOrderId(merOrderId); |
| | | // queryOrder.setQueryType("1"); |
| | | // TrhRequest<QueryOrder> request = new TrhRequest(); |
| | | // InterfaceResponse execute1 = request.execute(queryOrder, QueryOrder.SERVICE_CODE); |
| | | // if("0000".equals(execute1.getCode())){ |
| | | // JSONObject jsonObject1 = JSON.parseObject(execute1.getResult()); |
| | | // String status1 = jsonObject1.getString("status"); |
| | | // if("0".equals(status1)){//待处理 |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // if("1".equals(status1)){//成功 |
| | | // String merOrderId = jsonObject1.getString("merOrderId"); |
| | | // ResultUtil resultUtil = orderPayCallback(order1.getId().toString(), merOrderId); |
| | | |
| | | // break; |
| | | // } |
| | | // if("2".equals(status1) || 10 == num){//失败 |
| | | // break; |
| | | // } |
| | | // }else{ |
| | | // Thread.sleep(wait); |
| | | // num++; |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }).start(); |
| | | // } |
| | | |
| | | // return ResultUtil.success(payCode); |
| | | return resultUtil; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | order.setState(109); |
| | | this.updateById(order); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | //中台修改订单状态 |
| | | if(null != order.getTravelId()){ |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(order.getTravelId()); |
| | | request.setStatus(getState(order.getState())); |
| | | TCompany company = companyMapper.selectById(driver.getBranchOfficeId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | |
| | | Evaluate evaluate = new Evaluate(); |
| | | evaluate.setOrderId(orderId.intValue()); |
| | | evaluate.setCreateTime(new Date()); |
| | |
| | | evaluate.setStatus(1); |
| | | evaluate.setUserId(uid); |
| | | evaluateService.insert(evaluate); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | driver.setScore(((null == driver.getScore() ? 0 : driver.getScore()) + score) / 2); |
| | | if(score == 5){//司机积分奖励 |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String addUser(String phone, String code, String areaCode) throws Exception{ |
| | | public static String addUser(String phone, String code, String areaCode, String onconUUID) throws Exception{ |
| | | HttpRequest post = HttpUtil.createPost(qytConfig.getChuxingUrl() + "/user-server/base/user/addAppUser"); |
| | | post.form("phone", phone); |
| | | post.form("code", code); |
| | | post.form("areaCode", areaCode); |
| | | post.form("onconUUID", onconUUID); |
| | | HttpResponse execute = post.execute(); |
| | | if(200 != execute.getStatus()){ |
| | | log.error("打车系统-注册用户失败:{}", execute.body()); |
| | |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【企业增加员工】请求失败:" + result); |
| | | String retMsg = jsonObject.getString("retMsg"); |
| | | if(retMsg.contains("员工昵称已存在")){ |
| | | request.setEmpName(request.getEmpName() + Double.valueOf(Math.random() * 100).intValue()); |
| | | request.setEmpNickname(request.getEmpName()); |
| | | return saveStaffNode(request); |
| | | } |
| | | retMsg = retMsg.substring(retMsg.indexOf("{")); |
| | | jsonObject = JSON.parseObject(retMsg); |
| | | return ResultUtil.error("【企业增加员工】请求失败:" + jsonObject.getString("msg")); |
| | |
| | | * 拉起支付 |
| | | * |
| | | * @param tradePayOff1Data |
| | | * @param recoveryOrder |
| | | * @return |
| | | */ |
| | | public static PayInfo tradePayOff1(TradePayOff1Data tradePayOff1Data) { |
| | | tradePayOff1Data.setPartnerId("5400004"); |
| | | public static PayInfo tradePayOff1(TradePayOff1Data tradePayOff1Data, Integer recoveryOrder) { |
| | | tradePayOff1Data.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | tradePayOff1Data.setTimeout("72H"); |
| | | tradePayOff1Data.setScene("TRAFFIC"); |
| | | tradePayOff1Data.setCurrency("RMB"); |
| | | tradePayOff1Data.setNeedLoginFlag("N"); |
| | | tradePayOff1Data.setAccessMode("APP"); |
| | | tradePayOff1Data.getGoodsInfo().forEach(goodsInfoRequest -> { |
| | | goodsInfoRequest.setId("981100006005901"); |
| | | goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); |
| | | if(0 == recoveryOrder){ |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); |
| | | }else{ |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "981100006228370" : "981100006005901"); |
| | | } |
| | | goodsInfoRequest.setSubAppId(qianYunTongConfig.getAppId()); |
| | | |
| | | goodsInfoRequest.setAreaInfo("520100"); |
| | | goodsInfoRequest.setPayType("0"); |
| | |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradePayOff1Data>(); |
| | | request.setSceneId("1911676727023968256"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954795404533583872" : "1911676727023968256"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | * @param tradeOrderCreateData |
| | | * @return |
| | | */ |
| | | public static TradeOrderCreate tradeOrderCreate1(TradeOrderCreateData tradeOrderCreateData) { |
| | | public static TradeOrderCreate tradeOrderCreate1(TradeOrderCreateData tradeOrderCreateData, Integer recoveryOrder) { |
| | | tradeOrderCreateData.setScene("TRAFFIC"); |
| | | tradeOrderCreateData.setPartnerId("522700"); |
| | | tradeOrderCreateData.setTimeout("72H"); |
| | | tradeOrderCreateData.setOrderAppId("52270015"); |
| | | tradeOrderCreateData.setChannelSource("GRJYCXWXXCX"); |
| | | tradeOrderCreateData.setPayPartnerId("5400004"); |
| | | tradeOrderCreateData.setPayPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | tradeOrderCreateData.setCurrency("RMB"); |
| | | tradeOrderCreateData.setNeedLoginFlag("N"); |
| | | tradeOrderCreateData.setAccessMode("APP"); |
| | | tradeOrderCreateData.getGoodsInfo().forEach(goodsInfoRequest -> { |
| | | goodsInfoRequest.setId("981100006005901"); |
| | | goodsInfoRequest.setSubAppId("wxcc3c9058e2b294db"); |
| | | if(0 == recoveryOrder){ |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "9811000039358999" : "981100006005901"); |
| | | }else{ |
| | | goodsInfoRequest.setId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "981100006228370" : "981100006005901"); |
| | | } |
| | | goodsInfoRequest.setSubAppId(qianYunTongConfig.getAppId()); |
| | | goodsInfoRequest.setAreaInfo("520100"); |
| | | goodsInfoRequest.setPayType("0"); |
| | | goodsInfoRequest.setBusinessType("10408"); |
| | |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderCreateData>(); |
| | | request.setSceneId("1945688132719169536"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954793280550756352" : "1945688132719169536"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | createOrderRequest.setChannelSource("GRJYCXWXXCX"); |
| | | |
| | | TradeRequest request = new TradeRequest<CreateOrderRequest>(); |
| | | request.setSceneId("1948289607125864448"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954792737421942784" : "1948289607125864448"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | |
| | | * @return |
| | | */ |
| | | public static PayInfo tradePayOff(TradePayOffData tradePayOffData) { |
| | | tradePayOffData.setPartnerId("5400005"); |
| | | tradePayOffData.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401008" : "5400005"); |
| | | tradePayOffData.setTimeout("72H"); |
| | | tradePayOffData.setScene("TRAFFIC"); |
| | | tradePayOffData.setCurrency("RMB"); |
| | |
| | | tradePayOffData.setPaymentInfos(paymentInfoRequests); |
| | | List<GoodsInfo> goodsInfo = new ArrayList<>(); |
| | | GoodsInfo goodsInfo1 = new GoodsInfo(); |
| | | goodsInfo1.setMerchantCode("B00000905"); |
| | | goodsInfo1.setCustId("CB0000004686"); |
| | | goodsInfo1.setCustName("证联消费平台交易客户"); |
| | | goodsInfo1.setMerchantCode("prod".equals(qianYunTongConfig.getActiveProfile()) ? "B00001404" : "B00000905"); |
| | | goodsInfo1.setCustId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "CB0000004853" : "CB0000004686"); |
| | | goodsInfo1.setCustName("prod".equals(qianYunTongConfig.getActiveProfile()) ? "黔南云码通数字产业运营有限公司" : "证联消费平台交易客户"); |
| | | goodsInfo1.setBusinessType("10408"); |
| | | goodsInfo1.setAgreementNo("00000000468618354161754464398681"); |
| | | goodsInfo1.setAgreementNo("prod".equals(qianYunTongConfig.getActiveProfile()) ? "00000402485377063581755054680461" : "00000000468618354161754464398681"); |
| | | goodsInfo1.setProfitSharing("1"); |
| | | goodsInfo.add(goodsInfo1); |
| | | tradePayOffData.setGoodsInfo(goodsInfo); |
| | | |
| | | |
| | | TradeRequest request = new TradeRequest<TradePayOffData>(); |
| | | request.setSceneId("1774717104844095488"); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1954794605782913024" : "1774717104844095488"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(2); |
| | | request.setConfigVersion("prod".equals(qianYunTongConfig.getActiveProfile()) ? 1 : 2); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(tradePayOffData); |
| | | //请求路径 |
| | |
| | | * @return |
| | | */ |
| | | public static GetPaymentInfo paymentInfo(GetPaymentInfoDataRequest getPaymentInfoDataRequest) { |
| | | getPaymentInfoDataRequest.setPartnerId("5400004"); |
| | | getPaymentInfoDataRequest.setPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | |
| | | GetPaymentInfoRequest request = new GetPaymentInfoRequest(); |
| | | request.setRequstType("POST"); |
| | |
| | | request.setMhltiCenterAppId("52270015"); |
| | | request.setPayType(4); |
| | | request.setPayChannel(6); |
| | | request.setIsCompensate(1); |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/paymentOrder"; |
| | | //私钥文件 |
| | |
| | | OrderInfo orderInfo = jsonObject.getObject("busiResp", OrderInfo.class); |
| | | return orderInfo; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单退款 |
| | | * @param request1 |
| | | * @return |
| | | */ |
| | | public static TradeOrderRefund tradeOrderRefund(TradeOrderRefundRequest request1) { |
| | | request1.setPayPartnerId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "5401007" : "5400004"); |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/tradeOrderRefund"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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"); |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderRefundRequest>(); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1968487381046722560" : "1726529285264269312"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion("prod".equals(qianYunTongConfig.getActiveProfile()) ? 1 : 6); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(request1); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单退款】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | JSONObject refundInfo = jsonObject.getJSONObject("busiResp").getJSONObject("refundInfo"); |
| | | String retCode = refundInfo.getString("retCode"); |
| | | if(!"0".equals(retCode)){ |
| | | log.error("【订单退款】失败:" + refundInfo.getString("retMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + refundInfo.getString("retMsg")); |
| | | } |
| | | JSONObject object = refundInfo.getJSONObject("object"); |
| | | String retCode1 = object.getString("retCode"); |
| | | if(!"000000".equals(retCode1)){ |
| | | log.error("【订单退款】失败:" + object.getString("retMsg")); |
| | | throw new RuntimeException("【订单退款】失败:" + object.getString("retMsg")); |
| | | } |
| | | |
| | | TradeOrderRefund tradeOrderRefund = object.getObject("data", TradeOrderRefund.class); |
| | | return tradeOrderRefund; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 订单退款通知 |
| | | * @param request |
| | | */ |
| | | public static void orderRefundNotice(OrderRefundNoticeRequest request) { |
| | | request.setScene("TRAFFIC"); |
| | | request.setMhltiCenterAppId("52270015"); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/orderRefundNotice"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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 = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单退款通知】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单退款通知】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单取消 |
| | | * @param orderId |
| | | */ |
| | | public static void tradeOrderCancel(String orderId) { |
| | | TradeOrderCancelRequest request1 = new TradeOrderCancelRequest(); |
| | | request1.setScene("TRAFFIC"); |
| | | request1.setMhltiCenterAppId("52270015"); |
| | | request1.setOrderId(orderId); |
| | | |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/tradeOrderCancel"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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"); |
| | | |
| | | TradeRequest request = new TradeRequest<TradeOrderRefundRequest>(); |
| | | request.setSceneId("prod".equals(qianYunTongConfig.getActiveProfile()) ? "1968487841979760640" : "1963507067318833152"); |
| | | request.setAppId(qianYunTongConfig.getAppkey()); |
| | | request.setConfigVersion(1); |
| | | request.setRequestId(UUIDUtil.getRandomCode()); |
| | | request.setData(request1); |
| | | |
| | | String timeStamp = date.format(nowdate); |
| | | String messageId = UUIDUtil.getRandomCode(); |
| | | contentMap.put(SystemParameterNames.getAppKey(), appKey); |
| | | contentMap.put(SystemParameterNames.getMessage_id(), messageId); |
| | | contentMap.put(SystemParameterNames.getUserName(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | 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 resCode = jsonObject.getString("resCode"); |
| | | if (!"000000".equals(resCode)) { |
| | | log.error("【订单取消】失败:" + jsonObject.getString("resMsg")); |
| | | throw new RuntimeException("【订单取消】失败:" + jsonObject.getString("resMsg")); |
| | | } |
| | | } |
| | | } |
| | |
| | | public QianYunTongConfig getQianYunTongConfig() { |
| | | if("dev".equals(activeProfile)){ |
| | | this.appkey = "10001104"; |
| | | this.privateKeyPath = "C:\\Users\\Admin\\Desktop\\qyt\\private_key_test.pem"; |
| | | this.privateKeyPath = "C:\\Users\\39373\\Desktop\\黔云通\\private_key_test.pem"; |
| | | this.userName = "xiaofei"; |
| | | this.status = "1"; |
| | | this.setApiUrl("https://test-zhongtai.stqcloud.com:10070"); |
| | |
| | | private static QianYunTongConfig qianYunTongConfig = SpringContextsUtil.getBean(QianYunTongConfig.class).getQianYunTongConfig(); |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // List<QYTUserInfo> userInfoByPhone = getUserInfoByPhone("15828353127"); |
| | | // System.out.println(userInfoByPhone); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return object.getBoolean("isok"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据手机号码获取易信uuid |
| | | * @param mobile |
| | | * @return |
| | | */ |
| | | public static String getOnconUUIDByMobile(String mobile) { |
| | | //请求路径 |
| | | String url = qianYunTongConfig.getApiUrl() + "/openapi/rest/1.0/getOnconUUIDByMobile"; |
| | | //私钥文件 |
| | | String skprivateKeyFile = qianYunTongConfig.getPrivateKeyPath(); |
| | | //注意:私钥文件需要开发者手动新建.pem文件,将委办局提供的私钥串复制进文件里用于sign加密 |
| | | String appKey = qianYunTongConfig.getAppkey();//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(), qianYunTongConfig.getUserName()); |
| | | contentMap.put(SystemParameterNames.getStatus(), qianYunTongConfig.getStatus()); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("mobile", mobile); |
| | | contentMap.put("content", JSON.toJSONString(map)); |
| | | log.info("【根据手机号码获取易信uuid】请求地址:" + url); |
| | | log.info("【根据手机号码获取易信uuid】请求参数:" + JSON.toJSONString(contentMap)); |
| | | String result = OpenApiClient.sendCommonHttpRequst(url, headers, "POST", skprivateKeyFile, timeStamp, contentMap); |
| | | log.info("【根据手机号码获取易信uuid】请求结果:" + result); |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | String retCode = jsonObject.getString("retCode"); |
| | | if (!"0".equals(retCode)) { |
| | | log.error("【根据手机号码获取易信uuid】请求失败:" + result); |
| | | throw new RuntimeException("【根据手机号码获取易信uuid】请求失败:" + result); |
| | | } |
| | | JSONObject object = jsonObject.getJSONObject("object"); |
| | | Integer status = object.getInteger("status"); |
| | | if(0 != status){ |
| | | log.error("【身份证实名认证】请求失败:" + object.getString("desc")); |
| | | throw new RuntimeException("【身份证实名认证】请求失败:" + object.getString("desc")); |
| | | } |
| | | return object.getString("onconUUID"); |
| | | } |
| | | |
| | | } |
| | |
| | | * 业务类型,默认传10408 |
| | | */ |
| | | private String businessType; |
| | | /** |
| | | * 结算日期yyyyMMdd |
| | | */ |
| | | private String settleDate; |
| | | } |
| | |
| | | * 付款方式,6:微信 7:支付宝 8:银行卡 9:银联二维码 10银联购物车收银台 |
| | | */ |
| | | private Integer payChannel; |
| | | /** |
| | | * 是否补偿单。1、是,0、否 |
| | | */ |
| | | private Integer isCompensate; |
| | | } |
| | |
| | | */ |
| | | private String customerId; |
| | | /** |
| | | * 推广人id |
| | | */ |
| | | private String promoterId; |
| | | /** |
| | | * 服务商商户ID(serviceType为3时必传) |
| | | */ |
| | | private String supplierShopId; |
| | | /** |
| | | * 场景服务类型。1、出租;2、网约车;3、城际;4、顺风车,5、代驾 |
| | | */ |
| | | private Integer serviceType; |
| | | /** |
| | | * 商户号,由支付中心分配。测试环境5400004 |
| | | */ |
| | | private String payPartnerId; |
| | |
| | | */ |
| | | private Integer serviceType; |
| | | /** |
| | | * 订单状态。1、待支付,11、已完结(可结算) |
| | | * 订单状态。1、待支付,3=已支付,11、已完结(可结算),16、已取消,32、已全部退款 |
| | | */ |
| | | private Integer orderStatus; |
| | | /** |
| | |
| | | private Integer payType; |
| | | @ApiModelProperty(value = "优惠券id", required = false, dataType = "int") |
| | | private Integer couponId; |
| | | @ApiModelProperty(value = "支付成功后的回调页面地址", required = true, dataType = "string") |
| | | private String path; |
| | | @ApiModelProperty(value = "ip地址", required = true, dataType = "string") |
| | | private String ip; |
| | | } |