New file |
| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 11:25 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class UserIntegralChangesController { |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService userIntegralChangesService; |
| | | |
| | | |
| | | /** |
| | | * 保存用户积分变动记录 |
| | | * @param vo |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/userIntegralChanges/saveUserIntegralChanges") |
| | | public void saveUserIntegralChanges(@RequestBody SaveUserIntegralChangesVo vo){ |
| | | try { |
| | | userIntegralChangesService.saveUserIntegralChanges(vo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dsh.account.entity; |
| | | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.Version; |
| | | |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 历史积分 |
| | | */ |
| | | @TableField("oldIntegral") |
| | | private Integer oldIntegral; |
| | | /** |
| | | * 新积分 |
| | | */ |
| | | @TableField("newIntegral") |
| | | private Integer newIntegral; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @TableField("remark") |
| | | private String remark; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | package com.dsh.account.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
New file |
| | |
| | | package com.dsh.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 11:26 |
| | | */ |
| | | @Data |
| | | public class SaveUserIntegralChangesVo { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | private Integer integral; |
| | | } |
| | |
| | | package com.dsh.account.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | |
| | | /** |
| | |
| | | |
| | | IntegralDetailsResponse queryUserPointsDetails(String yearMonth, Integer recordId, Integer userIdFormRedis); |
| | | |
| | | |
| | | /** |
| | | * 保存用户积分变动 |
| | | * @param vo |
| | | * @throws Exception |
| | | */ |
| | | void saveUserIntegralChanges(SaveUserIntegralChangesVo vo) throws Exception; |
| | | } |
| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.UserIntegralChanges; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.mapper.UserIntegralChangesMapper; |
| | | import com.dsh.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.IntegralDetailsResponse; |
| | | import com.dsh.account.service.UserIntegralChangesService; |
| | | import com.dsh.account.util.DateTimeHelper; |
| | |
| | | monthStart = DateTimeHelper.getCurrentMouthStart(); |
| | | monthEnd = DateTimeHelper.getCurrentMouthEnd(); |
| | | } |
| | | List<UserIntegralChanges> userIntegralChanges = this.baseMapper.selectList(new EntityWrapper<UserIntegralChanges>() |
| | | List<UserIntegralChanges> userIntegralChanges = this.baseMapper.selectList(new QueryWrapper<UserIntegralChanges>() |
| | | .eq("appUserId",userIdFormRedis ) |
| | | .between("insertTime",monthStart,monthEnd) |
| | | .orderBy("insertTime",false)); |
| | | .orderByDesc("insertTime")); |
| | | if (userIntegralChanges.size() > 0 ){ |
| | | for (UserIntegralChanges userIntegralChange : userIntegralChanges) { |
| | | IntegralDetailsResponse.IntegralsData detail= new IntegralDetailsResponse.IntegralsData(); |
| | |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 保存用户积分变动 |
| | | * @param vo |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void saveUserIntegralChanges(SaveUserIntegralChangesVo vo) throws Exception { |
| | | TAppUser appUser = tauMapper.selectById(vo.getAppUserId()); |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(vo.getAppUserId()); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setType(vo.getType()); |
| | | appUser.setIntegral(appUser.getIntegral() + vo.getIntegral()); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | this.save(userIntegralChanges); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Component |
| | | public class PayMoneyUtil { |
| | | private String aliAppid = "";//支付宝appid |
| | | private String aliAppid = "2021004103650328";//支付宝appid |
| | | |
| | | private String appPrivateKey = "";//支付宝开发者应用私钥 |
| | | private String appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCSsBy+F6k1CTL4b0qQssuhf6x2aeqSn2eBmv0mJALK9iqRgA9EG0buYVnV/tsNGYvKCgX56onb+Cv+f9/TShZzp0FVGemIcgPhrjK0WW2RJBMq9EmPzc2x+7SkygKO1H6S3CwWhYdc7TCNL9OnFAHSEa+FfGNWXg0jM0mSXI7/me8icbWZd5mdiLTV+OWx5ONAE0GfVPhUPnb9faunE6gvZCamZnS+H6ACzzidO7ksVkZq5PBsI3Jew2oAcAJSktsljMZNqDrVknzUbvKBXSw80zZD66i5twx8+8els5VLo6qu9PD80l+K430r2eMqxzXm9mRXZSPSxoOm5c+0cNiHAgMBAAECggEAR+EIlJWfkp+JXHecgD88zUx0xCmuil6WJ8o81h27SJ1LyrSHxoXfQhxuGxChYk/sUfqLZyVonGOFm1Yp5a1eRxnkR8FE0FmeUU49Bmbz67VTty6xhUgBzX9by4w5qKezxl8hM4AHDqAjtGuFOU/yfG+yJKUJQF8h7OfK22+DmveglMt+W8buCf+IJahMyxYLWnA5eG8X1KjOC5PnpQEEBBB3g8fJpdbcoUteGGKzGhkSMKXuM//m2T8bU1sNZytnV+rDblg4E9IZIJwhory7WBxDzykEGpbM+RwJ6E6bAp6MXMUKbed1Uf/40d8C5yItWhjUh1a+ZDS0XbsMP+C/IQKBgQDmYhUr5wcqNQHqpKZWd0l/UZyR+Ykjk7WNvWFQIoMZmCWCGcepyQHAdXpk29evgTqcF9v9dlGDc7waFc93L2uxEYOaSk5UK8Sf6yoXHDocKwauY5DDvAuyy2b9QQDNqisi/MN872RaefBILz/DYN2ZbTtp8i/udSaRl01h6EXQfwKBgQCi/5+eIEcQZTa4zhq5CXKKVbcU2Y8uVsM1tgLaxOwQFr0Xd0ckQiJdkN7qhjgeSuOz0BOXo1xovzN4ZIKISB5sZDadgQCZi7O1YeKc8ElLPnV/WfKBGAxSBpURyMUOYH1mno5QG+QiGmTgH0/OhmqWfp+dVWHNwlx0EwMOpCBz+QKBgBRuVlpSXrxLfyQD/gxk/8uevTfk3VieXNd5GAw3Q1EdwRXMm3xfKxyaToRrSrFx0HTPWN8dgxUZSnE1xfRX7EEDwJwKQvAMAZ/9BvqNskmVNz537fqtzovIphWHkj6q/LBZoiyOPmQXtEtyhUEacgyNN1up8r4+/XCj7mTkaGyZAoGBAIx+GG6LE7WmB8yymYX0Bq4Fw5BNFYSzc/7PqxY1teMINmQLg15VQpmzTPCIT8aMdkd+ieSiAfynEQ4sU/ZzcwWqOwj3MDUonPUyMcljs0kPxObH+KYcvEHXOpXhnzgNIwlYkQGriK98YIZtdrRkV2rwKVPLTEm1xUqnOHNeNDrBAoGASnewOvqzZQVnzbGYur7nbEBQaMKWP2IYKozr57+EHQ40QFyTzFUx+jhxnQ2TIoXQEbozNp11eWGm9TZenHxUbOZmAmPKGq5DQzBgwj/V9QPNPpulCEkgjEqIn0gdCNaEilZXTpdsLPxmZ/J9IxGJt+y/5OYhbIwfSS9gbvVEook=";//支付宝开发者应用私钥 |
| | | |
| | | private String alipayPublicKey = "";//支付宝应用公钥 |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRiMpvwg288WxCwJTBxeqQcFlkZR1p+hZn3/GshrYgRKhGu34IfnRbEnb70YJBq0N1AmdJRU4tYMS1qqFcvKdXnUrdPz+yx4F/uWv+Vz7ftzAEZ1JJh1s9IhJ1ayE4NNWBczj12cIrinUcIHNoITmPFSpcizk9jGnzZZDK4u2oZQEontseu6QyLoc4bBXgy3J1Cux7Q3kO0m3unr0j14PSOAY6kMmgPOyAyuP5Vl655OFJz1x4YDiXs6c+fHLzEZh+Bmm4kCedE7PeJ69xpxSo+i0qia9mhiR4L3LmX7yAzDffHfSQHdxzN0UR34ZF9ChZi/tGOeGABbC35tzGiWWQIDAQAB";//支付宝应用公钥 |
| | | |
| | | private String alipay_public_key = "";//支付宝支付公钥 |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String appid = "";//微信appid |
| | | |
| | |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl){ |
| | | //构造client |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | //设置网关地址 |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | //设置应用Id |
| | | certAlipayRequest.setAppId(aliAppid); |
| | | //设置应用私钥 |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | //设置请求格式,固定值json |
| | | certAlipayRequest.setFormat("json"); |
| | | //设置字符集 |
| | | certAlipayRequest.setCharset("UTF-8"); |
| | | //设置签名类型 |
| | | certAlipayRequest.setSignType("RSA2"); |
| | | //设置应用公钥证书路径 |
| | | certAlipayRequest.setCertPath(app_cert_path); |
| | | //设置支付宝公钥证书路径 |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | //设置支付宝根证书路径 |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | //构造client |
| | | AlipayClient alipayClient = null; |
| | | try { |
| | | alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | model.setBody(body); |
| | | model.setSubject (subject); |
| | | model.setOutTradeNo (outTradeNo); |
| | | model.setTimeoutExpress ("30m" ); |
| | | model.setTotalAmount (amount); |
| | | model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel ( model ); |
| | | request.setNotifyUrl (callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e ) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | // //实例化客户端 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | // model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | // model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | // model.setTimeoutExpress("30m"); |
| | | // model.setTotalAmount(amount);//付款金额 |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel(model); |
| | | // request.setNotifyUrl(callbackPath + notifyUrl); |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | // //设置网关地址 |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | // //设置应用Id |
| | | // certAlipayRequest.setAppId(aliAppid); |
| | | // //设置应用私钥 |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | // //设置请求格式,固定值json |
| | | // certAlipayRequest.setFormat("json"); |
| | | // //设置字符集 |
| | | // certAlipayRequest.setCharset("UTF-8"); |
| | | // //设置签名类型 |
| | | // certAlipayRequest.setSignType("RSA2"); |
| | | // //设置应用公钥证书路径 |
| | | // certAlipayRequest.setCertPath(app_cert_path); |
| | | // //设置支付宝公钥证书路径 |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | // //设置支付宝根证书路径 |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | // //构造client |
| | | // AlipayClient alipayClient = null; |
| | | // try { |
| | | // alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | // model.setBody(body); |
| | | // model.setSubject (subject); |
| | | // model.setOutTradeNo (outTradeNo); |
| | | // model.setTimeoutExpress ("30m" ); |
| | | // model.setTotalAmount (amount); |
| | | // model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel ( model ); |
| | | // request.setNotifyUrl (callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e) { |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.activity.entity.BenefitsVideos; |
| | | import com.dsh.activity.model.BenefitsVideoClassificationListVo; |
| | | import com.dsh.activity.model.BenefitsVideosInfoVo; |
| | | import com.dsh.activity.model.BenefitsVideosListVo; |
| | | import com.dsh.activity.service.BenefitsVideosService; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.dsh.activity.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("") |
| | |
| | | @Autowired |
| | | private BenefitsVideosService bfvService; |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("base/benefitVideo/getList") |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/benefitsVideo/queryClassificationBenefitsVideosList") |
| | | @ApiOperation(value = "获取视频列表", tags = {"APP-线上课得积分", "APP-看视频得奖励"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "位置(1=线上课得积分,2=看视频得奖励)", name = "position", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "搜索内容", name = "search", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<BenefitsVideoClassificationListVo>> queryClassificationBenefitsVideosList(Integer position, String search){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<BenefitsVideoClassificationListVo> listVos = bfvService.queryClassificationBenefitsVideosList(uid, position, search); |
| | | return ResultUtil.success(listVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/benefitsVideo/queryBenefitsVideosList") |
| | | @ApiOperation(value = "获取视频列表", tags = {"APP-线上课得积分", "APP-看视频得奖励"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "视频分类id", name = "classificationId", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageSize", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "页条数", name = "pageNo", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<BenefitsVideosListVo>> queryBenefitsVideosList(Integer classificationId, Integer pageSize, Integer pageNo){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<BenefitsVideosListVo> benefitsVideosListVos = bfvService.queryBenefitsVideosList(uid, classificationId, pageSize, pageNo); |
| | | return ResultUtil.success(benefitsVideosListVos); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/benefitsVideo/queryBenefitsVideosInfo") |
| | | @ApiOperation(value = "获取视频详情", tags = {"APP-线上课得积分", "APP-看视频得奖励"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "视频id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<BenefitsVideosInfoVo> queryBenefitsVideosInfo(Integer id){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | BenefitsVideosInfoVo benefitsVideosInfoVo = bfvService.queryBenefitsVideosInfo(uid, id); |
| | | return ResultUtil.success(benefitsVideosInfoVo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/benefitsVideo/receiveAward") |
| | | @ApiOperation(value = "观看视频结束后领取奖励", tags = {"APP-线上课得积分", "APP-看视频得奖励"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "视频id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil receiveAward(Integer id) { |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | bfvService.receiveAward(uid, id); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:28 |
| | | */ |
| | | @Data |
| | | @TableName("t_benefits_video_classification") |
| | | public class BenefitsVideoClassification { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 分类名称 |
| | | */ |
| | | @TableField("name") |
| | | private String name; |
| | | /** |
| | | * 位置(1=线上课得积分,2=看视频得奖励) |
| | | */ |
| | | @TableField("position") |
| | | private Integer position; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | |
| | | /** |
| | | * 分类id |
| | | */ |
| | | @TableField("benefitsVideoClassificationId") |
| | | private Integer benefitsVideoClassificationId; |
| | | /** |
| | | * 视频名称 |
| | | * 课程id |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 视频封面 |
| | | */ |
| | | private String cover; |
| | | /** |
| | | * 视频简介 |
| | | */ |
| | | private String introduction; |
| | | /** |
| | | * 视频地址 |
| | | */ |
| | | private String videos; |
| | | @TableField("courseId") |
| | | private Integer courseId; |
| | | /** |
| | | * 可得积分 |
| | | */ |
| | | private String integral; |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
New file |
| | |
| | | package com.dsh.activity.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:12 |
| | | */ |
| | | @Data |
| | | @TableName("t_user_benefits_videos") |
| | | public class UserBenefitsVideos { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private Long id; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableField("appUserId") |
| | | private Integer appUserId; |
| | | /** |
| | | * 分类id |
| | | */ |
| | | @TableField("benefitsVideoClassificationId") |
| | | private Integer benefitsVideoClassificationId; |
| | | /** |
| | | * 福利视频id |
| | | */ |
| | | @TableField("benefitsVideosId") |
| | | private Integer benefitsVideosId; |
| | | /** |
| | | * 获取积分 |
| | | */ |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.account; |
| | | |
| | | import com.dsh.activity.feignclient.account.model.SaveUserIntegralChangesVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 11:40 |
| | | */ |
| | | @FeignClient("mb-cloud-account") |
| | | public interface UserIntegralChangesClient { |
| | | |
| | | |
| | | /** |
| | | * 保存用户积分变动记录 |
| | | * @param vo |
| | | */ |
| | | @PostMapping("/userIntegralChanges/saveUserIntegralChanges") |
| | | void saveUserIntegralChanges(SaveUserIntegralChangesVo vo); |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.account.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 11:26 |
| | | */ |
| | | @Data |
| | | public class SaveUserIntegralChangesVo { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 积分 |
| | | */ |
| | | private Integer integral; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.course; |
| | | |
| | | import com.dsh.activity.feignclient.course.model.Course; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:57 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CourseClient { |
| | | |
| | | /** |
| | | * 根据id获取课程详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/course/queryCourseById") |
| | | Course queryCourseById(Integer id); |
| | | } |
New file |
| | |
| | | package com.dsh.activity.feignclient.course.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:58 |
| | | */ |
| | | @Data |
| | | public class Course { |
| | | private Integer id; |
| | | /** |
| | | * 课程名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 类型(1=课后练习,2=运动教学视频,3=器材教学视频) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 介绍 |
| | | */ |
| | | private String introduce; |
| | | /** |
| | | * 封面图 |
| | | */ |
| | | private String coverDrawing; |
| | | /** |
| | | * 介绍图 |
| | | */ |
| | | private String introductionDrawing; |
| | | /** |
| | | * 课程视频 |
| | | */ |
| | | private String courseVideo; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.activity.entity.BenefitsVideoClassification; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:30 |
| | | */ |
| | | public interface BenefitsVideoClassificationMapper extends BaseMapper<BenefitsVideoClassification> { |
| | | } |
| | |
| | | package com.dsh.activity.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.activity.entity.BenefitsVideos; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface BenefitsVideosMapper extends BaseMapper<BenefitsVideos> { |
| | | |
| | | |
| | | /** |
| | | * 获取福利课程列表 |
| | | * @param uid |
| | | * @param classificationId |
| | | * @param pageSize |
| | | * @param pageNo |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryBenefitsVideosList(@Param("uid") Integer uid, @Param("classificationId") Integer classificationId, |
| | | @Param("pageSize") Integer pageSize, @Param("pageNo") Integer pageNo); |
| | | } |
New file |
| | |
| | | package com.dsh.activity.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.activity.entity.UserBenefitsVideos; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:14 |
| | | */ |
| | | public interface UserBenefitsVideosMapper extends BaseMapper<UserBenefitsVideos> { |
| | | } |
New file |
| | |
| | | package com.dsh.activity.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:57 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class BenefitsVideoClassificationListVo { |
| | | @ApiModelProperty("数据id") |
| | | private Integer id; |
| | | @ApiModelProperty("分类名称") |
| | | private String name; |
| | | @ApiModelProperty("视频列表") |
| | | private List<BenefitsVideosListVo> list; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 10:36 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class BenefitsVideosInfoVo { |
| | | @ApiModelProperty("数据id") |
| | | private Integer id; |
| | | @ApiModelProperty("视频名称") |
| | | private String name; |
| | | @ApiModelProperty("封面图") |
| | | private String cover; |
| | | @ApiModelProperty("视频简介") |
| | | private String introduce; |
| | | @ApiModelProperty("视频介绍") |
| | | private String introductionDrawing; |
| | | @ApiModelProperty("视频地址") |
| | | private String courseVideo; |
| | | @ApiModelProperty("积分") |
| | | private Integer integral; |
| | | @ApiModelProperty("学习状态(0=未学习,1=已学习)") |
| | | private Integer study; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:56 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class BenefitsVideosListVo { |
| | | @ApiModelProperty("数据id") |
| | | private Integer id; |
| | | @ApiModelProperty("视频名称") |
| | | private String name; |
| | | @ApiModelProperty("封面图") |
| | | private String cover; |
| | | @ApiModelProperty("视频简介") |
| | | private String introduce; |
| | | @ApiModelProperty("积分") |
| | | private Integer integral; |
| | | @ApiModelProperty("学习状态(0=未学习,1=已学习)") |
| | | private Integer study; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.activity.entity.BenefitsVideos; |
| | | import com.dsh.activity.model.BenefitsVideoClassificationListVo; |
| | | import com.dsh.activity.model.BenefitsVideosInfoVo; |
| | | import com.dsh.activity.model.BenefitsVideosListVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface BenefitsVideosService extends IService<BenefitsVideos> { |
| | | |
| | | |
| | | /** |
| | | * 获取福利视频分类列表数据 |
| | | * @param uid |
| | | * @param search |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BenefitsVideoClassificationListVo> queryClassificationBenefitsVideosList(Integer uid, Integer position, String search) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取福利视频列表 |
| | | * @param uid |
| | | * @param classificationId |
| | | * @param pageSize |
| | | * @param pageNo |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | List<BenefitsVideosListVo> queryBenefitsVideosList(Integer uid, Integer classificationId, Integer pageSize, Integer pageNo) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取福利视频详情 |
| | | * @param uid |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | BenefitsVideosInfoVo queryBenefitsVideosInfo(Integer uid, Integer id) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 视频观看完毕后获得奖励 |
| | | * @param id |
| | | * @throws Exception |
| | | */ |
| | | void receiveAward(Integer uid, Integer id) throws Exception; |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.activity.entity.BenefitsVideoClassification; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:31 |
| | | */ |
| | | public interface IBenefitsVideoClassificationService extends IService<BenefitsVideoClassification> { |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.activity.entity.UserBenefitsVideos; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:15 |
| | | */ |
| | | public interface IUserBenefitsVideosService extends IService<UserBenefitsVideos> { |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.BenefitsVideoClassification; |
| | | import com.dsh.activity.mapper.BenefitsVideoClassificationMapper; |
| | | import com.dsh.activity.service.IBenefitsVideoClassificationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:31 |
| | | */ |
| | | @Service |
| | | public class BenefitsVideoClassificationServiceImpl extends ServiceImpl<BenefitsVideoClassificationMapper, BenefitsVideoClassification> implements IBenefitsVideoClassificationService { |
| | | } |
| | |
| | | package com.dsh.activity.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.BenefitsVideoClassification; |
| | | import com.dsh.activity.entity.BenefitsVideos; |
| | | import com.dsh.activity.entity.UserBenefitsVideos; |
| | | import com.dsh.activity.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.activity.feignclient.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.activity.feignclient.course.CourseClient; |
| | | import com.dsh.activity.feignclient.course.model.Course; |
| | | import com.dsh.activity.mapper.BenefitsVideosMapper; |
| | | import com.dsh.activity.model.BenefitsVideoClassificationListVo; |
| | | import com.dsh.activity.model.BenefitsVideosInfoVo; |
| | | import com.dsh.activity.model.BenefitsVideosListVo; |
| | | import com.dsh.activity.service.BenefitsVideosService; |
| | | import com.dsh.activity.service.IBenefitsVideoClassificationService; |
| | | import com.dsh.activity.service.IUserBenefitsVideosService; |
| | | import com.dsh.activity.util.ToolUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class BenefitsVideosServiceImpl extends ServiceImpl<BenefitsVideosMapper, BenefitsVideos> implements BenefitsVideosService { |
| | | |
| | | @Autowired |
| | | private IBenefitsVideoClassificationService benefitsVideoClassificationService; |
| | | |
| | | @Autowired |
| | | private IUserBenefitsVideosService userBenefitsVideosService; |
| | | |
| | | @Resource |
| | | private CourseClient courseClient; |
| | | |
| | | @Resource |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取福利视频分类列表数据 |
| | | * @param uid |
| | | * @param search |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<BenefitsVideoClassificationListVo> queryClassificationBenefitsVideosList(Integer uid, Integer position, String search) throws Exception { |
| | | QueryWrapper<BenefitsVideoClassification> wrapper = new QueryWrapper<BenefitsVideoClassification>().eq("position", position); |
| | | if(ToolUtil.isNotEmpty(search)){ |
| | | wrapper.like("name", search); |
| | | } |
| | | List<BenefitsVideoClassification> list = benefitsVideoClassificationService.list(wrapper.orderByAsc("sort")); |
| | | List<UserBenefitsVideos> userBenefitsVideos = userBenefitsVideosService.list(new QueryWrapper<UserBenefitsVideos>().eq("appUserId", uid)); |
| | | List<Integer> collect = userBenefitsVideos.stream().map(UserBenefitsVideos::getBenefitsVideosId).collect(Collectors.toList()); |
| | | |
| | | List<BenefitsVideoClassificationListVo> listVos = new ArrayList<>(); |
| | | for (BenefitsVideoClassification benefitsVideoClassification : list) { |
| | | BenefitsVideoClassificationListVo benefitsVideoClassificationListVo = new BenefitsVideoClassificationListVo(); |
| | | benefitsVideoClassificationListVo.setId(benefitsVideoClassification.getId()); |
| | | benefitsVideoClassificationListVo.setName(benefitsVideoClassification.getName()); |
| | | |
| | | List<BenefitsVideos> list1 = this.list(new QueryWrapper<BenefitsVideos>().eq("state", 1).notIn("id", collect).orderByDesc("insertTime").last(" limit 4")); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (BenefitsVideos benefitsVideos : list1) { |
| | | Integer courseId = benefitsVideos.getCourseId(); |
| | | Course course = courseClient.queryCourseById(courseId); |
| | | BenefitsVideosListVo benefitsVideosListVo = new BenefitsVideosListVo(); |
| | | benefitsVideosListVo.setId(benefitsVideos.getId()); |
| | | benefitsVideosListVo.setName(course.getName()); |
| | | benefitsVideosListVo.setCover(course.getCoverDrawing()); |
| | | benefitsVideosListVo.setIntroduce(course.getIntroduce()); |
| | | lists.add(benefitsVideosListVo); |
| | | } |
| | | benefitsVideoClassificationListVo.setList(lists); |
| | | listVos.add(benefitsVideoClassificationListVo); |
| | | } |
| | | return listVos; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<BenefitsVideosListVo> queryBenefitsVideosList(Integer uid, Integer classificationId, Integer pageSize, Integer pageNo) throws Exception { |
| | | pageSize = (pageSize - 1) * pageNo; |
| | | List<Map<String, Object>> benefitsVideos = this.baseMapper.queryBenefitsVideosList(uid, classificationId, pageSize, pageNo); |
| | | List<BenefitsVideosListVo> lists = new ArrayList<>(); |
| | | for (Map<String, Object> benefitsVideo : benefitsVideos) { |
| | | Integer id = Integer.valueOf(benefitsVideo.get("id").toString()); |
| | | Integer courseId = Integer.valueOf(benefitsVideo.get("courseId").toString()); |
| | | Integer integral = Integer.valueOf(benefitsVideo.get("integral").toString()); |
| | | Integer study = Integer.valueOf(benefitsVideo.get("study").toString()); |
| | | Course course = courseClient.queryCourseById(courseId); |
| | | BenefitsVideosListVo benefitsVideosListVo = new BenefitsVideosListVo(); |
| | | benefitsVideosListVo.setId(id); |
| | | benefitsVideosListVo.setName(course.getName()); |
| | | benefitsVideosListVo.setCover(course.getCoverDrawing()); |
| | | benefitsVideosListVo.setIntroduce(course.getIntroduce()); |
| | | benefitsVideosListVo.setIntegral(integral); |
| | | benefitsVideosListVo.setStudy(study); |
| | | lists.add(benefitsVideosListVo); |
| | | } |
| | | return lists; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取福利视频详情 |
| | | * @param uid |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public BenefitsVideosInfoVo queryBenefitsVideosInfo(Integer uid, Integer id) throws Exception { |
| | | BenefitsVideos benefitsVideos = this.getById(id); |
| | | Integer courseId = benefitsVideos.getCourseId(); |
| | | Course course = courseClient.queryCourseById(courseId); |
| | | BenefitsVideosInfoVo benefitsVideosInfoVo = new BenefitsVideosInfoVo(); |
| | | benefitsVideosInfoVo.setId(id); |
| | | benefitsVideosInfoVo.setName(course.getName()); |
| | | benefitsVideosInfoVo.setCover(course.getCoverDrawing()); |
| | | benefitsVideosInfoVo.setIntroduce(course.getIntroduce()); |
| | | benefitsVideosInfoVo.setIntroductionDrawing(course.getIntroductionDrawing()); |
| | | benefitsVideosInfoVo.setCourseVideo(course.getCourseVideo()); |
| | | benefitsVideosInfoVo.setIntegral(benefitsVideos.getIntegral()); |
| | | UserBenefitsVideos one = userBenefitsVideosService.getOne(new QueryWrapper<UserBenefitsVideos>().eq("appUserId", uid).eq("benefitsVideosId", id)); |
| | | benefitsVideosInfoVo.setStudy(null == one ? 0 : 1); |
| | | return benefitsVideosInfoVo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 视频观看完毕后获得奖励 |
| | | * @param uid |
| | | * @param id |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public void receiveAward(Integer uid, Integer id) throws Exception { |
| | | BenefitsVideos benefitsVideos = this.getById(id); |
| | | UserBenefitsVideos one = userBenefitsVideosService.getOne(new QueryWrapper<UserBenefitsVideos>().eq("appUserId", uid).eq("benefitsVideosId", id)); |
| | | if(null == one){ |
| | | one = new UserBenefitsVideos(); |
| | | one.setAppUserId(uid); |
| | | one.setBenefitsVideoClassificationId(benefitsVideos.getBenefitsVideoClassificationId()); |
| | | one.setBenefitsVideosId(id); |
| | | one.setInsertTime(new Date()); |
| | | one.setIntegral(benefitsVideos.getIntegral()); |
| | | userBenefitsVideosService.save(one); |
| | | |
| | | //添加积分 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(uid); |
| | | vo.setIntegral(benefitsVideos.getIntegral()); |
| | | vo.setType(4); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.activity.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.UserBenefitsVideos; |
| | | import com.dsh.activity.mapper.UserBenefitsVideosMapper; |
| | | import com.dsh.activity.service.IUserBenefitsVideosService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/12 9:15 |
| | | */ |
| | | @Service |
| | | public class UserBenefitsVideosServiceImpl extends ServiceImpl<UserBenefitsVideosMapper, UserBenefitsVideos> implements IUserBenefitsVideosService { |
| | | } |
| | |
| | | result2.getKeyGenerators().put("t_user_points_merchandise-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result2); |
| | | |
| | | //分片规则配置 |
| | | ShardingRuleConfiguration result3 = new ShardingRuleConfiguration(); |
| | | result3.getTables().add(getUserBenefitsVideosTableRuleConfiguration()); |
| | | Properties props3 = new Properties(); |
| | | props3.setProperty("algorithm-expression", "t_user_benefits_videos$->{appUserId % 5 + 1}"); |
| | | result3.getShardingAlgorithms().put("t_user_benefits_videos-inline", new AlgorithmConfiguration("INLINE", props3)); |
| | | result3.getKeyGenerators().put("t_user_benefits_videos-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties())); |
| | | linkedList.add(result3); |
| | | |
| | | return linkedList; |
| | | } |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分片算法配置 |
| | | * @return |
| | | */ |
| | | private ShardingTableRuleConfiguration getUserBenefitsVideosTableRuleConfiguration() { |
| | | ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_user_benefits_videos", "m_$->{0}.t_user_benefits_videos$->{1..5}");//30 |
| | | result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_user_benefits_videos-inline")); |
| | | result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_user_benefits_videos-snowflake")); |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.activity.mapper.BenefitsVideoClassificationMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <mapper namespace="com.dsh.activity.mapper.BenefitsVideosMapper"> |
| | | |
| | | |
| | | <select id="queryBenefitsVideosList" resultType="map"> |
| | | select * from ( |
| | | (select |
| | | id, |
| | | courseId, |
| | | integral, |
| | | 0 as study |
| | | from t_benefits_videos where state = 1 and id not in (select benefitsVideosId from t_user_benefits_videos where appUserId = #{uid}) |
| | | <if test="null != classificationId"> |
| | | and benefitsVideoClassificationId = #{classificationId} |
| | | </if> |
| | | order by insertTime desc) |
| | | |
| | | union all |
| | | |
| | | (select |
| | | id, |
| | | courseId, |
| | | integral, |
| | | 1 as study |
| | | from t_benefits_videos where state = 1 and id in (select benefitsVideosId from t_user_benefits_videos where appUserId = #{uid}) |
| | | <if test="null != classificationId"> |
| | | and benefitsVideoClassificationId = #{classificationId} |
| | | </if> |
| | | order by insertTime desc) |
| | | ) as a limit #{pageSize}, #{pageNo} |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.activity.mapper.UserBenefitsVideosMapper"> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Import; |
| | | import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | |
| | | * @author jason |
| | | */ |
| | | @EnableSwagger2 |
| | | @EnableScheduling |
| | | @EnableFeignClients |
| | | @MBCloudApplication |
| | | @Import({WebConfig.class}) |
| | |
| | | List<CompetitionListVo> queryCompetitionList(@Param("cityCode") String cityCode, @Param("content") String content, |
| | | @Param("registerCondition") Integer registerCondition, @Param("heat") Integer heat); |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改赛事状态 |
| | | */ |
| | | void taskSetStatusStart(); |
| | | |
| | | |
| | | |
| | | void taskSetStatusEnd(); |
| | | |
| | | } |
| | |
| | | private Integer apply; |
| | | @ApiModelProperty("报名参赛人员") |
| | | private List<ParticipantVo> participant; |
| | | @ApiModelProperty("状态(1=未开始,2=进行中,3=已结束,4=已取消)") |
| | | private Integer status; |
| | | } |
| | |
| | | package com.dsh.competition.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | public class EditParticipant { |
| | | @ApiModelProperty(value = "数据id", dataType = "int", required = true) |
| | | private Integer id; |
| | | @ApiModelProperty(value = "身高(CM)", dataType = "int", required = true) |
| | | @ApiModelProperty(value = "身高(CM)", dataType = "int", required = false) |
| | | private Integer height; |
| | | @ApiModelProperty(value = "体重(KG)", dataType = "double", required = true) |
| | | @ApiModelProperty(value = "体重(KG)", dataType = "double", required = false) |
| | | private Double weight; |
| | | @ApiModelProperty(value = "联系电话", dataType = "string", required = false) |
| | | private String phone; |
| | | @ApiModelProperty(value = "姓名", dataType = "string", required = false) |
| | | private String name; |
| | | @ApiModelProperty(value = "生日", dataType = "string", required = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date birthday; |
| | | @ApiModelProperty(value = "性别(1=男,2=女)", dataType = "int", required = false) |
| | | private Integer gender; |
| | | @ApiModelProperty(value = "身份证号码", dataType = "string", required = false) |
| | | private String idcard; |
| | | } |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil paymentCompetition(Integer uid, PaymentCompetitionVo paymentCompetitionVo) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改赛事状态 |
| | | */ |
| | | void taskSetStatus(); |
| | | } |
| | |
| | | competitionInfo.setImgs(competition.getImgs()); |
| | | competitionInfo.setName(competition.getName()); |
| | | competitionInfo.setRegisterCondition(competition.getRegisterCondition()); |
| | | Store store = storeClient.queryStoreById(competition.getStoreId()); |
| | | competitionInfo.setStoreName(store.getName()); |
| | | competitionInfo.setStoreAddress(store.getAddress()); |
| | | competitionInfo.setStoreLon(store.getLon()); |
| | | competitionInfo.setStoreLat(store.getLat()); |
| | | competitionInfo.setStoreCoverDrawing(store.getCoverDrawing()); |
| | | if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | competitionInfo.setDistance(wgs84); |
| | | if(null != competition.getStoreId()){ |
| | | Store store = storeClient.queryStoreById(competition.getStoreId()); |
| | | competitionInfo.setStoreName(store.getName()); |
| | | competitionInfo.setStoreAddress(store.getAddress()); |
| | | competitionInfo.setStoreLon(store.getLon()); |
| | | competitionInfo.setStoreLat(store.getLat()); |
| | | competitionInfo.setStoreCoverDrawing(store.getCoverDrawing()); |
| | | if(ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)){ |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat()); |
| | | double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | competitionInfo.setDistance(wgs84); |
| | | } |
| | | } |
| | | competitionInfo.setRegisterEndTime(sdf.format(competition.getRegisterEndTime())); |
| | | competitionInfo.setStartTime(sdf.format(competition.getStartTime())); |
| | |
| | | competitionInfo.setIntroduction(competition.getIntroduction()); |
| | | competitionInfo.setRegistrationNotes(competition.getRegistrationNotes()); |
| | | competitionInfo.setApply(0); |
| | | PaymentCompetition one = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("competitionId", id).eq("appUserId", uid).eq("payStatus", 2)); |
| | | competitionInfo.setStatus(competition.getStatus()); |
| | | PaymentCompetition one = paymentCompetitionService.getOne(new QueryWrapper<PaymentCompetition>().eq("competitionId", id).eq("appUserId", uid).ne("payStatus", 1).orderByDesc("insertTime").last(" limit 1")); |
| | | if(null != one){ |
| | | competitionInfo.setApply(1); |
| | | List<ParticipantVo> participant = new ArrayList<>(); |
| | | List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("competitionId", id).eq("appUserId", uid)); |
| | | List<UserCompetition> list = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", one.getId())); |
| | | List<Integer> collect = list.stream().map(UserCompetition::getParticipantId).collect(Collectors.toList()); |
| | | List<Participant> participants = participantService.listByIds(collect); |
| | | SimpleDateFormat sdf_year = new SimpleDateFormat("yyyy"); |
| | |
| | | participant.add(participantVo); |
| | | } |
| | | competitionInfo.setParticipant(participant); |
| | | if(one.getPayStatus() == 3){ |
| | | competitionInfo.setStatus(4); |
| | | } |
| | | } |
| | | return competitionInfo; |
| | | } |
| | |
| | | } |
| | | return alipay; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改赛事状态 |
| | | */ |
| | | @Override |
| | | public void taskSetStatus() { |
| | | this.baseMapper.taskSetStatusStart(); |
| | | this.baseMapper.taskSetStatusEnd(); |
| | | } |
| | | } |
| | |
| | | import com.dsh.competition.model.ParticipantVo; |
| | | import com.dsh.competition.model.SaveParticipant; |
| | | import com.dsh.competition.service.IParticipantService; |
| | | import com.dsh.competition.util.JuHeUtil; |
| | | import com.dsh.competition.util.ResultUtil; |
| | | import com.dsh.competition.util.ToolUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | if(null != one){ |
| | | return ResultUtil.error("电话号码重复"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(addParticipant.getName()) && ToolUtil.isNotEmpty(addParticipant.getIdcard())){ |
| | | Boolean aBoolean = JuHeUtil.idcardAuthentication(addParticipant.getIdcard(), addParticipant.getName()); |
| | | if(!aBoolean){ |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | |
| | | Participant participant = new Participant(); |
| | | BeanUtils.copyProperties(addParticipant, participant); |
| | | participant.setAppUserId(uid); |
| | |
| | | if(null != one && one.getId().compareTo(editParticipant.getId()) != 0){ |
| | | return ResultUtil.error("电话号码重复"); |
| | | } |
| | | if(ToolUtil.isNotEmpty(editParticipant.getName()) && ToolUtil.isNotEmpty(editParticipant.getIdcard())){ |
| | | Boolean aBoolean = JuHeUtil.idcardAuthentication(editParticipant.getIdcard(), editParticipant.getName()); |
| | | if(!aBoolean){ |
| | | return ResultUtil.error("身份证和姓名不匹配"); |
| | | } |
| | | } |
| | | Participant participant = this.getById(editParticipant.getId()); |
| | | participant.setHeight(editParticipant.getHeight()); |
| | | participant.setWeight(editParticipant.getWeight()); |
| | |
| | | participant.add(participantVo); |
| | | } |
| | | competitionInfo.setParticipant(participant); |
| | | competitionInfo.setStatus(competition.getStatus()); |
| | | if(paymentCompetition.getPayStatus() == 3){ |
| | | competitionInfo.setStatus(4); |
| | | } |
| | | return competitionInfo; |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.competition.util; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.dsh.competition.util.httpClinet.HttpClientUtil; |
| | | import com.dsh.competition.util.httpClinet.HttpResult; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 12:05 |
| | | */ |
| | | public class JuHeUtil { |
| | | |
| | | |
| | | /** |
| | | * 校验实名认证 |
| | | * @param idcard |
| | | * @param name |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Boolean idcardAuthentication(String idcard, String name) throws Exception{ |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("idcard", idcard); |
| | | params.put("realname", name); |
| | | params.put("key", "29fec4bbe3108e4fbf52704e5a906fe0"); |
| | | HttpResult httpResult = HttpClientUtil.pushHttpRequset("POST", "http://op.juhe.cn/idcard/query", params, null, "form"); |
| | | if(httpResult.getCode() != 200){ |
| | | return false; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(httpResult.getData()); |
| | | Integer error_code = jsonObject.getInteger("error_code"); |
| | | if(0 == error_code){ |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | Integer res = result.getInteger("res"); |
| | | return res == 1 ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | @Component |
| | | public class PayMoneyUtil { |
| | | private String aliAppid = "";//支付宝appid |
| | | private String aliAppid = "2021004103650328";//支付宝appid |
| | | |
| | | private String appPrivateKey = "";//支付宝开发者应用私钥 |
| | | private String appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCSsBy+F6k1CTL4b0qQssuhf6x2aeqSn2eBmv0mJALK9iqRgA9EG0buYVnV/tsNGYvKCgX56onb+Cv+f9/TShZzp0FVGemIcgPhrjK0WW2RJBMq9EmPzc2x+7SkygKO1H6S3CwWhYdc7TCNL9OnFAHSEa+FfGNWXg0jM0mSXI7/me8icbWZd5mdiLTV+OWx5ONAE0GfVPhUPnb9faunE6gvZCamZnS+H6ACzzidO7ksVkZq5PBsI3Jew2oAcAJSktsljMZNqDrVknzUbvKBXSw80zZD66i5twx8+8els5VLo6qu9PD80l+K430r2eMqxzXm9mRXZSPSxoOm5c+0cNiHAgMBAAECggEAR+EIlJWfkp+JXHecgD88zUx0xCmuil6WJ8o81h27SJ1LyrSHxoXfQhxuGxChYk/sUfqLZyVonGOFm1Yp5a1eRxnkR8FE0FmeUU49Bmbz67VTty6xhUgBzX9by4w5qKezxl8hM4AHDqAjtGuFOU/yfG+yJKUJQF8h7OfK22+DmveglMt+W8buCf+IJahMyxYLWnA5eG8X1KjOC5PnpQEEBBB3g8fJpdbcoUteGGKzGhkSMKXuM//m2T8bU1sNZytnV+rDblg4E9IZIJwhory7WBxDzykEGpbM+RwJ6E6bAp6MXMUKbed1Uf/40d8C5yItWhjUh1a+ZDS0XbsMP+C/IQKBgQDmYhUr5wcqNQHqpKZWd0l/UZyR+Ykjk7WNvWFQIoMZmCWCGcepyQHAdXpk29evgTqcF9v9dlGDc7waFc93L2uxEYOaSk5UK8Sf6yoXHDocKwauY5DDvAuyy2b9QQDNqisi/MN872RaefBILz/DYN2ZbTtp8i/udSaRl01h6EXQfwKBgQCi/5+eIEcQZTa4zhq5CXKKVbcU2Y8uVsM1tgLaxOwQFr0Xd0ckQiJdkN7qhjgeSuOz0BOXo1xovzN4ZIKISB5sZDadgQCZi7O1YeKc8ElLPnV/WfKBGAxSBpURyMUOYH1mno5QG+QiGmTgH0/OhmqWfp+dVWHNwlx0EwMOpCBz+QKBgBRuVlpSXrxLfyQD/gxk/8uevTfk3VieXNd5GAw3Q1EdwRXMm3xfKxyaToRrSrFx0HTPWN8dgxUZSnE1xfRX7EEDwJwKQvAMAZ/9BvqNskmVNz537fqtzovIphWHkj6q/LBZoiyOPmQXtEtyhUEacgyNN1up8r4+/XCj7mTkaGyZAoGBAIx+GG6LE7WmB8yymYX0Bq4Fw5BNFYSzc/7PqxY1teMINmQLg15VQpmzTPCIT8aMdkd+ieSiAfynEQ4sU/ZzcwWqOwj3MDUonPUyMcljs0kPxObH+KYcvEHXOpXhnzgNIwlYkQGriK98YIZtdrRkV2rwKVPLTEm1xUqnOHNeNDrBAoGASnewOvqzZQVnzbGYur7nbEBQaMKWP2IYKozr57+EHQ40QFyTzFUx+jhxnQ2TIoXQEbozNp11eWGm9TZenHxUbOZmAmPKGq5DQzBgwj/V9QPNPpulCEkgjEqIn0gdCNaEilZXTpdsLPxmZ/J9IxGJt+y/5OYhbIwfSS9gbvVEook=";//支付宝开发者应用私钥 |
| | | |
| | | private String alipayPublicKey = "";//支付宝应用公钥 |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRiMpvwg288WxCwJTBxeqQcFlkZR1p+hZn3/GshrYgRKhGu34IfnRbEnb70YJBq0N1AmdJRU4tYMS1qqFcvKdXnUrdPz+yx4F/uWv+Vz7ftzAEZ1JJh1s9IhJ1ayE4NNWBczj12cIrinUcIHNoITmPFSpcizk9jGnzZZDK4u2oZQEontseu6QyLoc4bBXgy3J1Cux7Q3kO0m3unr0j14PSOAY6kMmgPOyAyuP5Vl655OFJz1x4YDiXs6c+fHLzEZh+Bmm4kCedE7PeJ69xpxSo+i0qia9mhiR4L3LmX7yAzDffHfSQHdxzN0UR34ZF9ChZi/tGOeGABbC35tzGiWWQIDAQAB";//支付宝应用公钥 |
| | | |
| | | private String alipay_public_key = "";//支付宝支付公钥 |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String appid = "";//微信appid |
| | | |
| | |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl){ |
| | | //构造client |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | //设置网关地址 |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | //设置应用Id |
| | | certAlipayRequest.setAppId(aliAppid); |
| | | //设置应用私钥 |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | //设置请求格式,固定值json |
| | | certAlipayRequest.setFormat("json"); |
| | | //设置字符集 |
| | | certAlipayRequest.setCharset("UTF-8"); |
| | | //设置签名类型 |
| | | certAlipayRequest.setSignType("RSA2"); |
| | | //设置应用公钥证书路径 |
| | | certAlipayRequest.setCertPath(app_cert_path); |
| | | //设置支付宝公钥证书路径 |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | //设置支付宝根证书路径 |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | //构造client |
| | | AlipayClient alipayClient = null; |
| | | try { |
| | | alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | model.setBody(body); |
| | | model.setSubject (subject); |
| | | model.setOutTradeNo (outTradeNo); |
| | | model.setTimeoutExpress ("30m" ); |
| | | model.setTotalAmount (amount); |
| | | model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel ( model ); |
| | | request.setNotifyUrl (callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e ) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | // //实例化客户端 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | // model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | // model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | // model.setTimeoutExpress("30m"); |
| | | // model.setTotalAmount(amount);//付款金额 |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel(model); |
| | | // request.setNotifyUrl(callbackPath + notifyUrl); |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | // //设置网关地址 |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | // //设置应用Id |
| | | // certAlipayRequest.setAppId(aliAppid); |
| | | // //设置应用私钥 |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | // //设置请求格式,固定值json |
| | | // certAlipayRequest.setFormat("json"); |
| | | // //设置字符集 |
| | | // certAlipayRequest.setCharset("UTF-8"); |
| | | // //设置签名类型 |
| | | // certAlipayRequest.setSignType("RSA2"); |
| | | // //设置应用公钥证书路径 |
| | | // certAlipayRequest.setCertPath(app_cert_path); |
| | | // //设置支付宝公钥证书路径 |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | // //设置支付宝根证书路径 |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | // //构造client |
| | | // AlipayClient alipayClient = null; |
| | | // try { |
| | | // alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | // model.setBody(body); |
| | | // model.setSubject (subject); |
| | | // model.setOutTradeNo (outTradeNo); |
| | | // model.setTimeoutExpress ("30m" ); |
| | | // model.setTotalAmount (amount); |
| | | // model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel ( model ); |
| | | // request.setNotifyUrl (callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e) { |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.competition.util; |
| | | |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Autowired |
| | | private CompetitionService competitionService; |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMinute(){ |
| | | try { |
| | | //定时修改赛事状态 |
| | | competitionService.taskSetStatus(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | order by aa.heat desc |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <update id="taskSetStatusStart"> |
| | | update t_competition set status = 2 where status = 1 and state = 1 and auditStatus = 2 and now() between startTime and endTime |
| | | </update> |
| | | |
| | | |
| | | <update id="taskSetStatusEnd"> |
| | | update t_competition set status = 3 where status = 2 and state = 1 and auditStatus = 2 and now() >= endTime |
| | | </update> |
| | | </mapper> |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取课程数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/course/queryCourseById") |
| | | public TCourse queryCourseById(@RequestBody Integer id){ |
| | | try { |
| | | return courseService.getById(id); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | | |
| | |
| | | private String lat; |
| | | @ApiModelProperty(value = "课程类型id", dataType = "int", required = false) |
| | | private Integer coursePackageTypeId; |
| | | @ApiModelProperty(value = "门店id", dataType = "int", required = false) |
| | | @ApiModelProperty(value = "门店id", dataType = "int", required = true) |
| | | private Integer storeId; |
| | | @ApiModelProperty(value = "搜索内容", dataType = "string", required = false) |
| | | private String search; |
| | |
| | | */ |
| | | @Component |
| | | public class PayMoneyUtil { |
| | | private String aliAppid = "";//支付宝appid |
| | | private String aliAppid = "2021004103650328";//支付宝appid |
| | | |
| | | private String appPrivateKey = "";//支付宝开发者应用私钥 |
| | | private String appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCSsBy+F6k1CTL4b0qQssuhf6x2aeqSn2eBmv0mJALK9iqRgA9EG0buYVnV/tsNGYvKCgX56onb+Cv+f9/TShZzp0FVGemIcgPhrjK0WW2RJBMq9EmPzc2x+7SkygKO1H6S3CwWhYdc7TCNL9OnFAHSEa+FfGNWXg0jM0mSXI7/me8icbWZd5mdiLTV+OWx5ONAE0GfVPhUPnb9faunE6gvZCamZnS+H6ACzzidO7ksVkZq5PBsI3Jew2oAcAJSktsljMZNqDrVknzUbvKBXSw80zZD66i5twx8+8els5VLo6qu9PD80l+K430r2eMqxzXm9mRXZSPSxoOm5c+0cNiHAgMBAAECggEAR+EIlJWfkp+JXHecgD88zUx0xCmuil6WJ8o81h27SJ1LyrSHxoXfQhxuGxChYk/sUfqLZyVonGOFm1Yp5a1eRxnkR8FE0FmeUU49Bmbz67VTty6xhUgBzX9by4w5qKezxl8hM4AHDqAjtGuFOU/yfG+yJKUJQF8h7OfK22+DmveglMt+W8buCf+IJahMyxYLWnA5eG8X1KjOC5PnpQEEBBB3g8fJpdbcoUteGGKzGhkSMKXuM//m2T8bU1sNZytnV+rDblg4E9IZIJwhory7WBxDzykEGpbM+RwJ6E6bAp6MXMUKbed1Uf/40d8C5yItWhjUh1a+ZDS0XbsMP+C/IQKBgQDmYhUr5wcqNQHqpKZWd0l/UZyR+Ykjk7WNvWFQIoMZmCWCGcepyQHAdXpk29evgTqcF9v9dlGDc7waFc93L2uxEYOaSk5UK8Sf6yoXHDocKwauY5DDvAuyy2b9QQDNqisi/MN872RaefBILz/DYN2ZbTtp8i/udSaRl01h6EXQfwKBgQCi/5+eIEcQZTa4zhq5CXKKVbcU2Y8uVsM1tgLaxOwQFr0Xd0ckQiJdkN7qhjgeSuOz0BOXo1xovzN4ZIKISB5sZDadgQCZi7O1YeKc8ElLPnV/WfKBGAxSBpURyMUOYH1mno5QG+QiGmTgH0/OhmqWfp+dVWHNwlx0EwMOpCBz+QKBgBRuVlpSXrxLfyQD/gxk/8uevTfk3VieXNd5GAw3Q1EdwRXMm3xfKxyaToRrSrFx0HTPWN8dgxUZSnE1xfRX7EEDwJwKQvAMAZ/9BvqNskmVNz537fqtzovIphWHkj6q/LBZoiyOPmQXtEtyhUEacgyNN1up8r4+/XCj7mTkaGyZAoGBAIx+GG6LE7WmB8yymYX0Bq4Fw5BNFYSzc/7PqxY1teMINmQLg15VQpmzTPCIT8aMdkd+ieSiAfynEQ4sU/ZzcwWqOwj3MDUonPUyMcljs0kPxObH+KYcvEHXOpXhnzgNIwlYkQGriK98YIZtdrRkV2rwKVPLTEm1xUqnOHNeNDrBAoGASnewOvqzZQVnzbGYur7nbEBQaMKWP2IYKozr57+EHQ40QFyTzFUx+jhxnQ2TIoXQEbozNp11eWGm9TZenHxUbOZmAmPKGq5DQzBgwj/V9QPNPpulCEkgjEqIn0gdCNaEilZXTpdsLPxmZ/J9IxGJt+y/5OYhbIwfSS9gbvVEook=";//支付宝开发者应用私钥 |
| | | |
| | | private String alipayPublicKey = "";//支付宝应用公钥 |
| | | private String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRiMpvwg288WxCwJTBxeqQcFlkZR1p+hZn3/GshrYgRKhGu34IfnRbEnb70YJBq0N1AmdJRU4tYMS1qqFcvKdXnUrdPz+yx4F/uWv+Vz7ftzAEZ1JJh1s9IhJ1ayE4NNWBczj12cIrinUcIHNoITmPFSpcizk9jGnzZZDK4u2oZQEontseu6QyLoc4bBXgy3J1Cux7Q3kO0m3unr0j14PSOAY6kMmgPOyAyuP5Vl655OFJz1x4YDiXs6c+fHLzEZh+Bmm4kCedE7PeJ69xpxSo+i0qia9mhiR4L3LmX7yAzDffHfSQHdxzN0UR34ZF9ChZi/tGOeGABbC35tzGiWWQIDAQAB";//支付宝应用公钥 |
| | | |
| | | private String alipay_public_key = "";//支付宝支付公钥 |
| | | private String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB";//支付宝支付公钥 |
| | | |
| | | private String appid = "";//微信appid |
| | | |
| | |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl){ |
| | | //构造client |
| | | CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | //设置网关地址 |
| | | certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | //设置应用Id |
| | | certAlipayRequest.setAppId(aliAppid); |
| | | //设置应用私钥 |
| | | certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | //设置请求格式,固定值json |
| | | certAlipayRequest.setFormat("json"); |
| | | //设置字符集 |
| | | certAlipayRequest.setCharset("UTF-8"); |
| | | //设置签名类型 |
| | | certAlipayRequest.setSignType("RSA2"); |
| | | //设置应用公钥证书路径 |
| | | certAlipayRequest.setCertPath(app_cert_path); |
| | | //设置支付宝公钥证书路径 |
| | | certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | //设置支付宝根证书路径 |
| | | certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | //构造client |
| | | AlipayClient alipayClient = null; |
| | | try { |
| | | alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | model.setBody(body); |
| | | model.setSubject (subject); |
| | | model.setOutTradeNo (outTradeNo); |
| | | model.setTimeoutExpress ("30m" ); |
| | | model.setTotalAmount (amount); |
| | | model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel ( model ); |
| | | request.setNotifyUrl (callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e ) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | // //实例化客户端 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | // model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | // model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | // model.setTimeoutExpress("30m"); |
| | | // model.setTotalAmount(amount);//付款金额 |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel(model); |
| | | // request.setNotifyUrl(callbackPath + notifyUrl); |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | | // //设置网关地址 |
| | | // certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | // //设置应用Id |
| | | // certAlipayRequest.setAppId(aliAppid); |
| | | // //设置应用私钥 |
| | | // certAlipayRequest.setPrivateKey(appPrivateKey); |
| | | // //设置请求格式,固定值json |
| | | // certAlipayRequest.setFormat("json"); |
| | | // //设置字符集 |
| | | // certAlipayRequest.setCharset("UTF-8"); |
| | | // //设置签名类型 |
| | | // certAlipayRequest.setSignType("RSA2"); |
| | | // //设置应用公钥证书路径 |
| | | // certAlipayRequest.setCertPath(app_cert_path); |
| | | // //设置支付宝公钥证书路径 |
| | | // certAlipayRequest.setAlipayPublicCertPath(alipay_cert_path); |
| | | // //设置支付宝根证书路径 |
| | | // certAlipayRequest.setRootCertPath(alipay_root_cert_path); |
| | | // //构造client |
| | | // AlipayClient alipayClient = null; |
| | | // try { |
| | | // alipayClient = new DefaultAlipayClient(certAlipayRequest); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest (); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel (); |
| | | // model.setBody(body); |
| | | // model.setSubject (subject); |
| | | // model.setOutTradeNo (outTradeNo); |
| | | // model.setTimeoutExpress ("30m" ); |
| | | // model.setTotalAmount (amount); |
| | | // model.setProductCode ( "QUICK_MSECURITY_PAY" ); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | // request.setBizModel ( model ); |
| | | // request.setNotifyUrl (callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e) { |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | // 签名无 not sign |
| | | if (StringUtils.isBlank(sign) || !sign.equals(signUrlEncode)) { |
| | | return ResultUtil.sign(); |
| | | return ResultUtil.sign(signUrl); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | return ResultUtil.getResult(ResultUtil.SIGN_ERROR, SIGN); |
| | | } |
| | | |
| | | |
| | | public static <T> ResultUtil<T> sign(String msg){ |
| | | return ResultUtil.getResult(ResultUtil.SIGN_ERROR, msg); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.Banner; |
| | | import com.dsh.other.model.BannerVo; |
| | | import com.dsh.other.service.IBannerService; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:48 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class BannerController { |
| | | |
| | | @Autowired |
| | | private IBannerService bannerService; |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/banner/queryBannerList") |
| | | @ApiOperation(value = "获取banner数据", tags = {"APP-加入玩湃"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题)", name = "position", dataType = "int", required = true), |
| | | }) |
| | | public ResultUtil<List<BannerVo>> queryBannerList(Integer position){ |
| | | try { |
| | | List<Banner> list = bannerService.list(new QueryWrapper<Banner>().eq("position", position).eq("state", 1).orderByAsc("sort")); |
| | | List<BannerVo> list1 = new ArrayList<>(); |
| | | for (Banner banner : list) { |
| | | BannerVo bannerVo = new BannerVo(); |
| | | BeanUtils.copyProperties(banner, bannerVo); |
| | | list1.add(bannerVo); |
| | | } |
| | | return ResultUtil.success(list1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.other.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:35 |
| | | */ |
| | | @Data |
| | | @TableName("t_banner") |
| | | public class Banner { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 位置(1=首页,2=首页底部,3=线上课得积分,4=看视频得奖励,5=常见问题) |
| | | */ |
| | | @TableField("position") |
| | | private Integer position; |
| | | /** |
| | | * 图片地址 |
| | | */ |
| | | @TableField("img") |
| | | private String img; |
| | | /** |
| | | * 跳转页面 |
| | | */ |
| | | @TableField("jumpPage") |
| | | private String jumpPage; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | } |
New file |
| | |
| | | package com.dsh.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.other.entity.Banner; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:46 |
| | | */ |
| | | public interface BannerMapper extends BaseMapper<Banner> { |
| | | } |
New file |
| | |
| | | package com.dsh.other.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:50 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class BannerVo { |
| | | @ApiModelProperty("数据id") |
| | | private Integer id; |
| | | @ApiModelProperty("图片路径") |
| | | private String img; |
| | | @ApiModelProperty("跳转页面") |
| | | private String jumpPage; |
| | | } |
New file |
| | |
| | | package com.dsh.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.other.entity.Banner; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:47 |
| | | */ |
| | | public interface IBannerService extends IService<Banner> { |
| | | } |
New file |
| | |
| | | package com.dsh.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.other.entity.Banner; |
| | | import com.dsh.other.mapper.BannerMapper; |
| | | import com.dsh.other.service.IBannerService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 17:47 |
| | | */ |
| | | @Service |
| | | public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements IBannerService { |
| | | } |