| | |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.amazonaws.util.Md5Utils; |
| | | import com.amazonaws.util.StringUtils; |
| | | import com.doumee.biz.system.SystemDataPermissionBiz; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.biz.zbom.ZbomCRMService; |
| | | import com.doumee.biz.zbom.ZbomZhongTaiService; |
| | | import com.doumee.config.annotation.LoginRequired; |
| | | import com.doumee.config.annotation.UserLoginRequired; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.News; |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.dao.web.reqeust.GenerateQRCodeRequest; |
| | | import com.doumee.dao.web.response.DailyUpdatesResponse; |
| | | import com.doumee.dao.web.response.ZSZXCatalogResponse; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.codec.digest.Md5Crypt; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.apache.tomcat.util.security.MD5Encoder; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @UserLoginRequired |
| | | @ApiOperation(value = "【B端小程序】每日上新数据") |
| | | @GetMapping("/getDailyUpdates") |
| | |
| | | }) |
| | | public ApiResponse<PageData<News>> newsPage (@RequestBody PageWrap<News> pageWrap) { |
| | | pageWrap.getModel().setIsPublish(Constants.ONE); |
| | | pageWrap.getModel().setStatus(Constants.ZERO); |
| | | return ApiResponse.success(newsService.findPage(pageWrap)); |
| | | } |
| | | |
| | | |
| | | |
| | | @UserLoginRequired |
| | | @ApiOperation(value = "获取客户管理授权-列表跳转地址", notes = "获取客户管理授权跳转地址") |
| | |
| | | @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "类型 0客户列表 1跳转新增意向客户", required = true) |
| | | }) |
| | | public ApiResponse<String> getCrmAuthUrl(@RequestParam Integer type) { |
| | | return ApiResponse.success(zbomCRMService.getCrmGoUrl(this.getLoginUserInfo().getIamUsername(),type)); |
| | | Users users = this.getLoginUserInfo(); |
| | | return ApiResponse.success(zbomCRMService.getCrmGoUrl(users.getIamUsername(),type,users.getIamId())); |
| | | } |
| | | |
| | | @ApiOperation(value = "生成小程序码", notes = "PAD端") |
| | | @PostMapping("/getQrCode") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "interfaceToken", value = "token", required = true), |
| | | @ApiImplicitParam(paramType = "header", dataType = "String", name = "timestamp", value = "时间戳", required = true), |
| | | }) |
| | | public void getQrCode(@RequestBody GenerateQRCodeRequest generateQRCodeRequest, HttpServletRequest httpServletRequest, HttpServletResponse response) { |
| | | String interfaceToken = httpServletRequest.getHeader("interfaceToken"); |
| | | String timestamp = httpServletRequest.getHeader("timestamp"); |
| | | String interfaceKey = systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_PAD_INTERFACE_KEY).getCode(); |
| | | String token = DigestUtils.md5Hex(timestamp+interfaceKey); |
| | | if(!token.equals(interfaceToken)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"token已失效!"); |
| | | } |
| | | try{ |
| | | response.setHeader("Cache-Control", "no-store, no-cache"); |
| | | response.setContentType("image/jpeg"); |
| | | InputStream inputStream = usersService.getQrCode(generateQRCodeRequest); |
| | | ImageIO.write(ImageIO.read(inputStream),"png",response.getOutputStream()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |