WxAuthApi.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. package com.caimei.controller.wechat;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.caimei.annotation.CurrentUser;
  4. import com.caimei.aop.IpSave;
  5. import com.caimei.model.ResponseJson;
  6. import com.caimei.model.dto.ProductSaveDto;
  7. import com.caimei.model.po.CmBrandAuthPo;
  8. import com.caimei.model.po.SysUser;
  9. import com.caimei.model.vo.*;
  10. import com.caimei.service.auth.*;
  11. import com.github.pagehelper.PageInfo;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiImplicitParam;
  14. import io.swagger.annotations.ApiImplicitParams;
  15. import io.swagger.annotations.ApiOperation;
  16. import lombok.RequiredArgsConstructor;
  17. import lombok.extern.slf4j.Slf4j;
  18. import org.apache.commons.lang3.StringUtils;
  19. import org.springframework.web.bind.annotation.*;
  20. import java.io.IOException;
  21. import java.math.BigDecimal;
  22. import java.text.SimpleDateFormat;
  23. import java.util.Date;
  24. import java.util.List;
  25. /**
  26. * @author Aslee
  27. */
  28. @Api(tags = "微信认证数据API")
  29. @Slf4j
  30. @RestController
  31. @RequiredArgsConstructor
  32. @RequestMapping("/wx/auth")
  33. public class WxAuthApi {
  34. private final AuthClubService authClubService;
  35. private final AuthService authService;
  36. private final AuthProductService authProductService;
  37. private final DoctorService doctorService;
  38. private final ShopService shopService;
  39. @ApiOperation("供应商信息")
  40. @ApiImplicitParams({
  41. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
  42. @ApiImplicitParam(name = "appId", required = false, value = "供应商公众号appId")
  43. })
  44. @GetMapping("/shop/info")
  45. public ResponseJson<WxShopVo> getWxShopInfo(Integer authUserId, String appId) {
  46. if (null == authUserId && StringUtils.isEmpty(appId)) {
  47. return ResponseJson.error("参数异常,供应商用户id和appId不能同时为空", null);
  48. }
  49. return authClubService.getWxShopInfo(authUserId, appId);
  50. }
  51. @ApiOperation("已认证机构列表")
  52. @ApiImplicitParams({
  53. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
  54. @ApiImplicitParam(name = "appId", required = false, value = "供应商公众号appId"),
  55. @ApiImplicitParam(name = "lngAndLat", required = false, value = "用户当前经纬度"),
  56. @ApiImplicitParam(name = "authParty", required = false, value = "机构名称"),
  57. @ApiImplicitParam(name = "provinceId", required = false, value = "省id"),
  58. @ApiImplicitParam(name = "cityId", required = false, value = "市id"),
  59. @ApiImplicitParam(name = "townId", required = false, value = "区id"),
  60. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  61. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  62. })
  63. @IpSave(saveName = "已认证机构列表",saveParams = true)
  64. @GetMapping("/club/list")
  65. public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(Integer authUserId, String appId, String lngAndLat, String authParty, Integer provinceId,
  66. Integer cityId, Integer townId,
  67. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  68. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  69. if (null == authUserId && StringUtils.isEmpty(appId)) {
  70. return ResponseJson.error("参数异常,供应商用户id和appId不能同时为空", null);
  71. }
  72. return authClubService.getWxClubList(authUserId, appId, lngAndLat, authParty, provinceId, cityId, townId, pageNum, pageSize);
  73. }
  74. @ApiOperation("明星机构列表")
  75. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id")
  76. @GetMapping("/club/star/list")
  77. public ResponseJson<List<WxClubListVo>> getStarClubList(Integer authUserId) {
  78. if (null == authUserId) {
  79. return ResponseJson.error("参数异常,供应商用户id不能为空", null);
  80. }
  81. return authClubService.getWxStarClubList(authUserId);
  82. }
  83. @ApiOperation("已认证机构详情")
  84. @ApiImplicitParam(required = false, name = "authId", value = "正品联盟机构Id")
  85. @IpSave(saveName = "已认证机构详情",saveParams = true)
  86. @GetMapping("/club/details")
  87. public ResponseJson<WxClubDetailsVo> getWxClubDetails(Integer authId) {
  88. return authClubService.getWxClubDetails(authId);
  89. }
  90. @ApiOperation("设备分类列表")
  91. @ApiImplicitParams({
  92. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
  93. @ApiImplicitParam(name = "appId", required = false, value = "供应商公众号appId"),
  94. @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
  95. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  96. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  97. })
  98. @GetMapping("/product/type/list")
  99. public ResponseJson<PageInfo<WxProductTypeListVo>> getWxProductTypeList(Integer authUserId, String appId, String name,
  100. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  101. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  102. if (null == authUserId && StringUtils.isEmpty(appId)) {
  103. return ResponseJson.error("参数异常,供应商用户id和appId不能同时为空", null);
  104. }
  105. return authProductService.getWxProductTypeList(authUserId, appId, name, pageNum, pageSize);
  106. }
  107. @ApiOperation("认证商品列表")
  108. @ApiImplicitParams({
  109. @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1已上线设备列表 2设备认证记录列表"),
  110. @ApiImplicitParam(name = "authId", required = false, value = "机构id"),
  111. @ApiImplicitParam(name = "authParty", required = false, value = "机构名称"),
  112. @ApiImplicitParam(name = "productTypeId", required = false, value = "设备分类id"),
  113. @ApiImplicitParam(name = "snCode", required = false, value = "sn码"),
  114. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  115. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  116. })
  117. @IpSave(saveName = "认证商品列表",saveParams = true)
  118. @GetMapping("/product/list")
  119. public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer listType, Integer authId, Integer productTypeId,
  120. String authParty, String snCode,
  121. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  122. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  123. return authProductService.getWxProductList(listType, authId, authParty, productTypeId, snCode, pageNum, pageSize);
  124. }
  125. /**
  126. * 获取授权商品回显数据
  127. */
  128. @ApiOperation("授权商品回显数据")
  129. @ApiImplicitParam(name = "relationId", required = true, value = "机构设备关联id")
  130. @GetMapping("/product/form/data")
  131. public ResponseJson<ProductFormVo> getProductFormData(Integer relationId) {
  132. return authProductService.getProductFormData(relationId);
  133. }
  134. /**
  135. * 品牌列表
  136. *
  137. * @return AuthVo
  138. */
  139. @ApiOperation("品牌列表")
  140. @ApiImplicitParam(name = "authUserId", value = "供应商用户id", required = false)
  141. @GetMapping("/shop/info/list")
  142. public ResponseJson<List<ShopInfoVo>> getShopInfoList(Integer authUserId) {
  143. return shopService.getShopInfoList(authUserId);
  144. }
  145. /**
  146. * 添加/编辑授权商品
  147. * @param productSaveDto {
  148. * productId 授权商品id
  149. * authId 授权id
  150. * infoId 品牌信息id
  151. * productTypeId 设备分类id
  152. * snCode 商品SN码
  153. * productImage 商品图片
  154. * purchaseWay 购买渠道
  155. * invoiceImage 发票图片
  156. * status 上线状态:0已下线,1已上线,2待上线
  157. * createBy 创建人id
  158. * source 来源:1供应商保存,2机构保存
  159. * paramList 商品参数列表
  160. * }
  161. */
  162. @ApiOperation("添加/编辑授权商品")
  163. @PostMapping("/product/save")
  164. public ResponseJson saveProduct(@RequestBody ProductSaveDto productSaveDto) throws IOException {
  165. return authProductService.saveProduct(productSaveDto);
  166. }
  167. /**
  168. * 授权机构回显数据
  169. */
  170. @ApiOperation("授权机构回显数据")
  171. @ApiImplicitParam(name = "authId", required = true, value = "机构用户id")
  172. @GetMapping("/form/data")
  173. public ResponseJson<AuthFormVo> getAuthFormData(Integer authId) {
  174. return authService.getAuthFormData(authId);
  175. }
  176. @ApiOperation("添加/编辑授权")
  177. @ApiImplicitParam(name = "params", value = "authId:授权id;authUserId:供应商用户id;authParty:授权机构;provinceId;cityId;" +
  178. "townId;address;lngAndLat;mobile;userMobile:对应机构用户手机号;" +
  179. "firstClubType:一级分类为医美=1,生美=2,项目公司=3,个人=4,其他=5;" +
  180. "secondClubType:医美的二级分类为诊所=1、门诊=2、医院=3,其他=4。生美二级分类,美容院=5,养生馆=6,其他=7;" +
  181. "medicalLicenseImage:医疗许可证图;empNum:员工人数;"+
  182. "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id;source:1供应商保存,2机构保存", required = true)
  183. @PostMapping("/save")
  184. public ResponseJson saveAuth(@RequestBody String params) {
  185. JSONObject paramsMap = JSONObject.parseObject(params);
  186. Integer authId = paramsMap.getInteger("authId");
  187. Integer authUserId = paramsMap.getInteger("authUserId");
  188. Integer provinceId = paramsMap.getInteger("provinceId");
  189. Integer cityId = paramsMap.getInteger("cityId");
  190. Integer townId = paramsMap.getInteger("townId");
  191. String address = paramsMap.getString("address");
  192. String lngAndLat = paramsMap.getString("lngAndLat");
  193. String mobile = paramsMap.getString("mobile");
  194. String userMobile = paramsMap.getString("userMobile");
  195. Integer firstClubType = paramsMap.getInteger("firstClubType");
  196. Integer secondClubType = paramsMap.getInteger("secondClubType");
  197. String medicalLicenseImage = paramsMap.getString("medicalLicenseImage");
  198. Integer empNum = paramsMap.getInteger("empNum");
  199. String logo = paramsMap.getString("logo");
  200. Integer customFlag = paramsMap.getInteger("customFlag");
  201. String remarks = paramsMap.getString("remarks");
  202. List<String> bannerList = (List<String>) paramsMap.get("bannerList");
  203. String authParty = paramsMap.getString("authParty");
  204. Integer createBy = paramsMap.getInteger("createBy");
  205. String linkMan = paramsMap.getString("linkMan");
  206. String linkMobile = paramsMap.getString("linkMobile");
  207. /*
  208. 组装授权数据
  209. */
  210. CmBrandAuthPo auth = new CmBrandAuthPo();
  211. auth.setId(authId);
  212. auth.setAuthUserId(authUserId);
  213. auth.setAuthParty(authParty);
  214. auth.setProvinceId(provinceId);
  215. auth.setCityId(cityId);
  216. auth.setTownId(townId);
  217. auth.setAddress(address);
  218. auth.setCustomFlag(customFlag);
  219. auth.setRemarks(remarks);
  220. if (StringUtils.isEmpty(lngAndLat)) {
  221. return ResponseJson.error("参数异常,经纬度不能为空");
  222. }
  223. String[] split = lngAndLat.split(",");
  224. auth.setLng(new BigDecimal(split[0]));
  225. auth.setLat(new BigDecimal(split[1]));
  226. auth.setMobile(mobile);
  227. auth.setUserMobile(userMobile);
  228. auth.setFirstClubType(firstClubType);
  229. auth.setSecondClubType(secondClubType);
  230. auth.setMedicalLicenseImage(medicalLicenseImage);
  231. auth.setEmpNum(empNum);
  232. auth.setLogo(logo);
  233. auth.setCreateBy(createBy);
  234. auth.setLinkMan(linkMan);
  235. auth.setLinkMobile(linkMobile);
  236. // 机构用户编辑授权
  237. return authService.saveAuth(auth, bannerList, false, 2);
  238. }
  239. @ApiOperation("设备分类下拉框列表")
  240. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
  241. @GetMapping("/product/type/select")
  242. public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
  243. if (null == authUserId) {
  244. return ResponseJson.error("参数异常,供应商用户id不能为空", null);
  245. }
  246. return authProductService.getProductTypeSelectList(authUserId);
  247. }
  248. @ApiOperation("已认证商品详情")
  249. @ApiImplicitParam(required = false, name = "productId", value = "正品联盟商品Id")
  250. @GetMapping("/product/details")
  251. public ResponseJson<AuthProductVo> getAuthProductDetails(Integer productId) {
  252. return authProductService.getAuthProductDetails(productId);
  253. }
  254. @ApiOperation("关联设备获取设备信息")
  255. @ApiImplicitParams({
  256. @ApiImplicitParam(name = "productId", required = false, value = "设备id"),
  257. @ApiImplicitParam(name = "snCode", required = false, value = "sn码")
  258. })
  259. @GetMapping("/product/info")
  260. public ResponseJson<ProductFormVo> getProductInfo(Integer productId, String snCode) {
  261. if (null == productId && null == snCode) {
  262. return ResponseJson.error("设备id和sn码不能同时为空", null);
  263. }
  264. return authProductService.getProductInfo(productId, snCode);
  265. }
  266. @ApiOperation("已认证医师列表")
  267. @ApiImplicitParams({
  268. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
  269. @ApiImplicitParam(name = "appId", required = false, value = "供应商公众号appId"),
  270. @ApiImplicitParam(name = "doctorType", required = false, value = "医师类型:1操作医师,2培训医师"),
  271. @ApiImplicitParam(name = "doctorName", required = false, value = "医师名称"),
  272. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  273. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  274. })
  275. @GetMapping("/doctor/list")
  276. public ResponseJson<PageInfo<WxDoctorListVo>> getWxDoctorList(Integer authUserId, String appId, Integer doctorType, String doctorName,
  277. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  278. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  279. if (null == authUserId && StringUtils.isEmpty(appId)) {
  280. return ResponseJson.error("参数异常,供应商用户id和appId不能同时为空", null);
  281. }
  282. return doctorService.getWxDoctorList(authUserId, appId, doctorType, doctorName, pageNum, pageSize);
  283. }
  284. @ApiOperation("已认证医师详情")
  285. @ApiImplicitParam(required = false, name = "doctorId", value = "正品联盟医师Id")
  286. @GetMapping("/doctor/details")
  287. public ResponseJson<DoctorFormVo> getAuthDoctorDetails(Integer doctorId) {
  288. return doctorService.getAuthDoctorDetails(doctorId);
  289. }
  290. @ApiOperation("获取机构下所有的设备信息")
  291. @GetMapping("/get/product/list")
  292. public ResponseJson<List<ProductListVo>> getPronductInfo(Integer authId,Integer authUserId){
  293. if (null == authUserId) {
  294. return ResponseJson.error("用户信息异常", null);
  295. }
  296. return authProductService.getPronductInfo(authId,authUserId);
  297. }
  298. /**
  299. * 保存视频信息
  300. * @return
  301. */
  302. @PostMapping("/save/video/info")
  303. public ResponseJson saveVideoInfo(@RequestBody String params){
  304. JSONObject jsonObject=JSONObject.parseObject(params);
  305. // //验证用户是否可以发布视频
  306. // //是否为机构用户
  307. Integer authId=jsonObject.getInteger("authId");
  308. // boolean flagAtuhId= authService.getauthUserId(authId);
  309. // if(flagAtuhId){
  310. // return ResponseJson.error("-1","由于您未认证机构,无法参与!");
  311. // }
  312. // //用户是否已经发不过视频
  313. String userName=jsonObject.getString("userName");
  314. // Boolean flaguserName=authService.getuserName(userName);
  315. // if(!flaguserName){
  316. // return ResponseJson.error("-1","抱歉,活动规定每个用户只能发布一个视频,您已发布过视频,请勿再次发布!");
  317. // }
  318. // //判断是否在活动时间内
  319. // Date date=new Date();
  320. // SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  321. // String releaseTime = sf.format(date).replace("T", "");
  322. // boolean flagReleaseTime= authService.checkActivityTime(releaseTime);
  323. // if(flagReleaseTime){
  324. // return ResponseJson.error("-1","抱歉,活动已结束,暂无法发布视频!");
  325. // }
  326. String title=jsonObject.getString("title");
  327. String ossName=jsonObject.getString("ossName");
  328. String cover=jsonObject.getString("cover");
  329. String ossUrl=jsonObject.getString("ossUrl");
  330. Integer authUserId=jsonObject.getInteger("authUserId");
  331. ChallengeRoundVo cr=new ChallengeRoundVo();
  332. cr.setUserName(userName);
  333. cr.setCover(cover);
  334. cr.setOssName(ossName);
  335. cr.setOssUrl(ossUrl);
  336. cr.setTitle(title);
  337. cr.setAuthId(authId);
  338. cr.setAuthUserId(authUserId);
  339. return authService.saveVideoInfo(cr);
  340. }
  341. /**
  342. * 获取已发布视频
  343. * @param sysUser
  344. * @param status
  345. * @param clubUserName
  346. * @param cursor
  347. * @param count
  348. * @return
  349. */
  350. @GetMapping("/get/published/video/list")
  351. public ResponseJson<PageInfo<ChallengeRoundVo>> getPublishedVideoList(@CurrentUser SysUser sysUser,Integer status,String clubUserName,Integer cursor,Integer count,@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  352. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,Integer authUserId){
  353. // if (null == sysUser) {
  354. // return ResponseJson.error("用户信息异常", null);
  355. // }
  356. // // 获取供应商用户id
  357. // Integer userIdentity = sysUser.getUserIdentity();
  358. // Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
  359. // if (null == authUserId) {
  360. // return ResponseJson.error("供应商用户id不能为空", null);
  361. // }
  362. if(count==null){
  363. count=10;
  364. }
  365. if(cursor==null){
  366. cursor=0;
  367. }
  368. return authService.getPublishedVideoList(clubUserName,status,cursor,count,pageNum,pageSize,authUserId);
  369. }
  370. /**
  371. * 验证视频是否符合发布条件
  372. * @param params
  373. * @return
  374. */
  375. @PostMapping("/check/video/info")
  376. public ResponseJson<ChallengeRoundVo> checkVideoInfo(@RequestBody String params){
  377. JSONObject jsonObject=JSONObject.parseObject(params);
  378. //验证用户是否可以发布视频
  379. //是否为机构用户
  380. // Integer authId=jsonObject.getInteger("authId");
  381. // boolean flagAtuhId= authService.getauthUserId(authId);
  382. // if(flagAtuhId){
  383. // return ResponseJson.success("0",null);
  384. // return ResponseJson.error("-1","由于您未认证机构,无法参与!");
  385. // }
  386. //用户是否已经发过视频
  387. String userName=jsonObject.getString("userName");
  388. Integer authUserId=jsonObject.getInteger("authUserId");
  389. Boolean flaguserName=authService.getuserName(userName);
  390. ChallengeRoundVo challengeActivityVo=new ChallengeRoundVo();
  391. ResponseJson<ChallengeActivityVo> activitty = authService.getActivitty(authUserId);
  392. ChallengeActivityVo challe = activitty.getData();
  393. if(challe!=null){
  394. challengeActivityVo.setActivityState(challe.getActivityState());
  395. }
  396. String releaseTime = authService.getReleaseTime(userName);
  397. if(!flaguserName){
  398. if(challe.getStartTime().compareTo(releaseTime)<0&&challe.getEndTime().compareTo(releaseTime)>0){
  399. challengeActivityVo.setReleaseStatus(1);
  400. }else{
  401. challengeActivityVo.setReleaseStatus(0);
  402. }
  403. return ResponseJson.success(challengeActivityVo);
  404. // return ResponseJson.error("-1","抱歉,活动规定每个用户只能发布一个视频,您已发布过视频,请勿再次发布!");
  405. }else{
  406. challengeActivityVo.setReleaseStatus(0);
  407. return ResponseJson.success(challengeActivityVo);
  408. }
  409. //判断是否在活动时间内
  410. // Date date=new Date();
  411. // SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  412. // String releaseTime = sf.format(date).replace("T", "");
  413. // boolean flagReleaseTime= authService.checkActivityTime(releaseTime);
  414. // if(flagReleaseTime){
  415. // return ResponseJson.error("-1","抱歉,活动已结束,暂无法发布视频!");
  416. // }
  417. }
  418. /**
  419. * 判断活动开启状态
  420. * @return
  421. */
  422. @GetMapping("/get/activitty")
  423. public ResponseJson<ChallengeActivityVo> getActivitty(Integer authUserId){
  424. return authService.getActivitty(authUserId);
  425. }
  426. //--------------------------------------------挑战赛1.7.7(ROSS)-------------------------------------------------------------------------------------------------
  427. /**
  428. * 新增参赛机构信息
  429. * @return
  430. */
  431. @PostMapping("save/ross/info")
  432. public ResponseJson saveRossInfo(@CurrentUser SysUser sysUser, @RequestBody String params) {
  433. // if (null == sysUser) {
  434. // return ResponseJson.error("用户信息异常", null);
  435. // }
  436. // // 获取供应商用户id
  437. // Integer userIdentity = sysUser.getUserIdentity();
  438. // Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
  439. // if (null == authUserId) {
  440. // return ResponseJson.error("供应商用户id不能为空", null);
  441. // }
  442. JSONObject jsonObject = JSONObject.parseObject(params);
  443. String mobile=jsonObject.getString("mobile");
  444. String licenseOssUrl=jsonObject.getString("licenseOssUrl");
  445. String licenseOssName=jsonObject.getString("licenseOssName");
  446. Integer authId=jsonObject.getInteger("authId");
  447. Integer authuser=jsonObject.getInteger("authUserId");
  448. // Integer clubUserId=jsonObject.getInteger("clubUserId");
  449. //判断该账号是否已经参赛
  450. List<RossChallengeRoundVo> infoByUserName = authService.getInfoByUserName(mobile);
  451. if(null !=infoByUserName&&infoByUserName.size()>0){
  452. return ResponseJson.success("您已报名",infoByUserName);
  453. }
  454. RossChallengeRoundVo rossChallengeRoundVo=new RossChallengeRoundVo();
  455. // if(null!=authUserId){
  456. // rossChallengeRoundVo.setAuthUserId(authUserId);
  457. // }else{
  458. rossChallengeRoundVo.setAuthUserId(authuser);
  459. // }
  460. rossChallengeRoundVo.setAuthUserId(authuser);
  461. rossChallengeRoundVo.setUserName(mobile);
  462. rossChallengeRoundVo.setAuthId(authId);
  463. rossChallengeRoundVo.setLicenseOssUrl(licenseOssUrl);
  464. rossChallengeRoundVo.setLicenseOssName(licenseOssName);
  465. // rossChallengeRoundVo.setClubUserId(clubUserId);
  466. if(StringUtils.isEmpty(licenseOssUrl)&&StringUtils.isEmpty(licenseOssName)){
  467. rossChallengeRoundVo.setAuthenticationStatus(1);
  468. }else{
  469. rossChallengeRoundVo.setAuthenticationStatus(0);
  470. }
  471. rossChallengeRoundVo.setContestStatus(1);
  472. Date date=new Date();
  473. SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  474. // String format = sf.format(date);
  475. rossChallengeRoundVo.setContestTime(new java.sql.Timestamp(date.getTime()));
  476. return authService.saveRossInfo(rossChallengeRoundVo);
  477. }
  478. /**
  479. * 验证用户是否已经报名
  480. * @param mobile
  481. * @return
  482. */
  483. @GetMapping("/check/contest/info")
  484. public ResponseJson<RossChallengeRoundVo> checkContestedInfo(String mobile){
  485. return authService.checkContestedInfo(mobile);
  486. }
  487. /**
  488. * 获取已报名信息列表
  489. * @return
  490. */
  491. @GetMapping("/get/contested/info")
  492. public ResponseJson<List<RossChallengeRoundVo>> getcontestedInfo(Integer authUserId){
  493. return authService.getcontestedInfo(authUserId);
  494. }
  495. /**
  496. * 根据手机号码查询该机构视频列表
  497. * @param mobile 登录账号
  498. * @return
  499. */
  500. @GetMapping("/get/video/username")
  501. public ResponseJson<List<RossChallengeVideo>> getVideoByUsername(String mobile,Integer clubUserId){
  502. return authService.getVideoByUsername(mobile,clubUserId);
  503. }
  504. /**
  505. * 查询视频列表
  506. * @param mobileOrAuthpart 电话号码或者机构名称
  507. * @return
  508. */
  509. @GetMapping("/get/video/all")
  510. public ResponseJson<PageInfo<RossChallengeVideo>> getVideoAll(String mobileOrAuthpart,Integer clubUserId,Integer authUserId,
  511. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  512. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
  513. return authService.getVideoAll(mobileOrAuthpart,clubUserId,authUserId,pageNum,pageSize);
  514. }
  515. /**
  516. * 验证机构是否已经上传了3个视频(点击上传视频时验证)
  517. * @param mobile 登录账号
  518. * @return
  519. */
  520. @GetMapping("/check/video/username")
  521. public ResponseJson<List<RossChallengeVideo>> checkVideoByUsername(String mobile){
  522. return authService.checkVideoByUsername(mobile);
  523. }
  524. /**
  525. * 点赞与取消点赞
  526. * @return
  527. */
  528. @PostMapping("/up/video/diggcount")
  529. public ResponseJson upVideoDiggCount(@RequestBody String params){
  530. JSONObject jsonObject=JSONObject.parseObject(params);
  531. Integer id=jsonObject.getInteger("id");
  532. Integer diggStatus=jsonObject.getInteger("diggStatus");
  533. String clubUserIds=jsonObject.getString("clubUserIds");
  534. Integer clubUserId=jsonObject.getInteger("clubUserId");
  535. return authService.upVideoDiggCount(id,diggStatus,clubUserId,clubUserIds);
  536. }
  537. /**
  538. * 1.7.7保存视频信息
  539. * @return
  540. */
  541. @PostMapping("/save/video")
  542. public ResponseJson saveVideo(@RequestBody String params){
  543. JSONObject jsonObject=JSONObject.parseObject(params);
  544. Integer authId=jsonObject.getInteger("authId");
  545. String userName=jsonObject.getString("userName");
  546. String title=jsonObject.getString("title");
  547. String ossName=jsonObject.getString("ossName");
  548. String cover=jsonObject.getString("cover");
  549. String ossUrl=jsonObject.getString("ossUrl");
  550. String linked=jsonObject.getString("linked");
  551. Integer authUserId=jsonObject.getInteger("authUserId");
  552. RossChallengeVideo cr=new RossChallengeVideo();
  553. cr.setUserName(userName);
  554. cr.setCover(cover);
  555. cr.setOssName(ossName);
  556. cr.setOssUrl(ossUrl);
  557. cr.setTitle(title);
  558. cr.setAuthId(authId);
  559. cr.setLinked(linked);
  560. cr.setAuthUserId(authUserId);
  561. return authService.saveVideo(cr);
  562. }
  563. }