cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
@@ -8,6 +8,7 @@ import com.dsh.account.feignclient.course.CoursePaymentClient; import com.dsh.account.feignclient.course.model.TCoursePackagePayment; import com.dsh.account.model.QueryDataFee; import com.dsh.account.model.Student; import com.dsh.account.model.StudentVo; import com.dsh.account.service.*; import com.dsh.account.util.ResultUtil; @@ -173,6 +174,16 @@ } @ResponseBody @PostMapping("/base/appUser/updateTStudent") public void updateTStudent(@RequestBody TStudent student){ try { studentService.updateById(student); }catch (Exception e){ e.printStackTrace(); } } /** * 根据id获取数据 * @param id cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java
@@ -466,7 +466,9 @@ }) public ResultUtil<PointDetailsVo> redemptionDetails(Long detailsId){ try { return ResultUtil.success(uicService.queryRedemptionDetails(detailsId)); PointDetailsVo pointDetailsVo = uicService.queryRedemptionDetails(detailsId); pointDetailsVo.getPics().remove(0); return ResultUtil.success(pointDetailsVo); }catch (Exception e){ return ResultUtil.runErr(); } cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/UserConponClient.java
@@ -20,6 +20,8 @@ @PostMapping("/base/userConpon/getStuOfConpons") public List<CouponStuAvailableVo> queryUserWithConponList(@RequestParam("appUserId") Integer appUserId); @PostMapping("/coupon/queryCouponById") Coupon queryCouponById(Integer id); @PostMapping("/base/coupon/getAllCoupons") public List<Coupon> getAllCoupons(@RequestBody CommodityRequest request); @@ -33,4 +35,12 @@ @PostMapping("/userCoupon/queryCouponOfStore") List<Integer> getCouponStoreIds(@RequestBody Integer couponId); @PostMapping("/userCoupon/queryCounts") Integer queryCounts(@RequestBody List<Integer> queryIds); @PostMapping("/userCoupon/queryCounts1") Integer queryCounts1(@RequestBody List<Integer> queryIds); } cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/PointDetailsVo.java
@@ -19,7 +19,7 @@ @ApiModelProperty(value = "商品名称") private String goodName; @ApiModelProperty(value = "适用状态(1已使用 2未使用)") @ApiModelProperty(value = "适用状态(1已使用 2未使用 3已过期)") private Integer useType; @ApiModelProperty(value = "有效期开始时间") cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -1175,11 +1175,69 @@ } } @Resource private UserConponClient userConponClient; @Autowired private TAppUserService appUserService; @Override @Transactional public ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) { System.out.println("exchangeType:--->"); //如果是兑换优惠卷 if (exchangeType.getGoodsType()==4){ //查询优惠卷 Coupon coupon = userConponClient.queryCouponById(exchangeType.getGoodId()); //查询该优惠卷的数量够不够 List<Integer> queryIds = new ArrayList<>(); queryIds.add(coupon.getId()); queryIds.add(userIdFormRedis); Integer counts = userConponClient.queryCounts(queryIds); if (coupon.getQuantityIssued()-counts == 0){ return new ResultUtil(0,"当前数量不足"); } //查询该用户是否超出限领数量 Integer usercounts = userConponClient.queryCounts1(queryIds); if (usercounts == coupon.getPickUpQuantity()){ return new ResultUtil<>(0,"限领数量已达最大"); } // userConponClient.queryCouponById(exchangeType.getGoodId()); UserCoupon userCoupon = new UserCoupon(); userCoupon.setCouponId(exchangeType.getGoodId()); userCoupon.setUserId(userIdFormRedis); userCoupon.setStatus(1); userCoupon.setInsertTime(new Date()); userConponClient.insertToAppuserCoupon(userCoupon); //扣积分 TAppUser user = appUserService.getById(userIdFormRedis); if (user.getIntegral()<coupon.getIntegral().intValue()){ return new ResultUtil<>(0,"当前用户积分不足"); } user.setIntegral(user.getIntegral()-coupon.getIntegral().intValue()); appUserService.updateById(user); return ResultUtil.success(); } System.out.println(exchangeType); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); cloud-server-account/src/main/java/com/dsh/account/service/impl/UserIntegralChangesServiceImpl.java
@@ -199,6 +199,9 @@ detailsResponses.clear(); } return detailsResponses; } } cloud-server-account/src/main/java/com/dsh/account/util/ResultUtil.java
@@ -51,7 +51,7 @@ return code; } private ResultUtil(Integer code, String msg) { public ResultUtil(Integer code, String msg) { this.code = code; this.msg = msg; } cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -486,6 +486,10 @@ } return detailsVo; } @Autowired private UserCouponService userCouponService; @PostMapping("/base/pointMerchars/getGoodDetails") public ProductDetailsVo getGoodDetailsWithId(@RequestBody ProductDetailRequest detailRequest){ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); @@ -639,8 +643,15 @@ detailsVo.setBelongsScope(coupon.getUserPopulation()); // int couponNums = upmseService.count(new QueryWrapper<UserPointsMerchandise>() // .eq("pointsMerchandiseId",merchandise.getId() )); detailsVo.setRedeemedNum(coupon.getPickUpQuantity()); detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - coupon.getPickUpQuantity(), 0)); int couponCounts = userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId", coupon.getId())); // detailsVo.setRedeemedNum(coupon.getPickUpQuantity()); detailsVo.setRedeemedNum(couponCounts); detailsVo.setResidueNum(Math.max(coupon.getQuantityIssued() - couponCounts, 0)); detailsVo.setPerLimit(coupon.getPickUpQuantity()); detailsVo.setExchangeType(coupon.getRedemptionMethod()); if (coupon.getRedemptionMethod() == 1){ @@ -741,6 +752,90 @@ } } if (merchandise.getCardType()==1){ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(pointsMerchandise.getInsertTime()); calendar.add(Calendar.DAY_OF_MONTH, 1); Date end = calendar.getTime(); String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); String endDate = dateFormat.format(end); detailsResponse.setStartTime(startDate); detailsResponse.setEndTime(endDate); Date now = new Date(); Calendar cal1 = Calendar.getInstance(); cal1.setTime(pointsMerchandise.getInsertTime()); Calendar cal2 = Calendar.getInstance(); cal2.setTime(now); // Compare the year, month, and day of the two Calendar instances boolean isSameDate = cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DAY_OF_MONTH) == cal2.get(Calendar.DAY_OF_MONTH); // Print the result if (isSameDate) { detailsResponse.setUseStatus(3); } else { System.out.println("The two dates do not have the same date."); } } else if (merchandise.getCardType()==2) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(pointsMerchandise.getInsertTime()); calendar.add(Calendar.DAY_OF_MONTH, 31); Date end = calendar.getTime(); String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); String endDate = dateFormat.format(end); detailsResponse.setStartTime(startDate); detailsResponse.setEndTime(endDate); Date now = new Date(); if (now.after(end)){ detailsResponse.setUseStatus(3); } } else if (merchandise.getCardType()==3) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(pointsMerchandise.getInsertTime()); calendar.add(Calendar.DAY_OF_MONTH, 93); Date end = calendar.getTime(); String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); String endDate = dateFormat.format(end); detailsResponse.setStartTime(startDate); detailsResponse.setEndTime(endDate); Date now = new Date(); if (now.after(end)){ detailsResponse.setUseStatus(3); } } else if (merchandise.getCardType()==4) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(pointsMerchandise.getInsertTime()); calendar.add(Calendar.DAY_OF_MONTH, 365); Date end = calendar.getTime(); String startDate = dateFormat.format(pointsMerchandise.getInsertTime()); String endDate = dateFormat.format(end); detailsResponse.setStartTime(startDate); detailsResponse.setEndTime(endDate); Date now = new Date(); if (now.after(end)){ detailsResponse.setUseStatus(3); } } } responses.add(detailsResponse); } cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java
@@ -232,5 +232,23 @@ return null; } } @ResponseBody @PostMapping("/userCoupon/queryCounts") public Integer queryCounts(@RequestBody List<Integer> queryIds){ return userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId",queryIds.get(0))); } @ResponseBody @PostMapping("/userCoupon/queryCounts1") public Integer queryCounts1(@RequestBody List<Integer> queryIds){ return userCouponService.count(new QueryWrapper<UserCoupon>().eq("couponId",queryIds.get(0)).eq("userId",queryIds.get(1))); } } cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/ExchangeDetailsResponse.java
@@ -31,7 +31,7 @@ @ApiModelProperty(value = "有效期结束时间") private String endTime; @ApiModelProperty(value = "使用状态 (1已使用 2未使用)") @ApiModelProperty(value = "使用状态 (1已使用 2未使用 3 已过期)") private Integer useStatus; @ApiModelProperty(value = "商品类型 1实物 2课包 3门票 4优惠券") cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java
@@ -3,6 +3,8 @@ import com.dsh.competition.feignclient.account.AppUserClient; import com.dsh.competition.feignclient.account.StudentClient; import com.dsh.competition.feignclient.account.model.AppUser; import com.dsh.competition.feignclient.account.model.Student; import com.dsh.competition.feignclient.account.model.TStudent; import com.dsh.competition.model.AddParticipant; import com.dsh.competition.model.EditParticipant; import com.dsh.competition.model.ParticipantVo; @@ -98,6 +100,8 @@ @Resource private StudentClient studentClient; @Resource private AppUserClient appUserClient; @ResponseBody @PostMapping("/api/participant/editParticipant") @ApiOperation(value = "编辑参赛人员", tags = {"APP-赛事活动列表", ""}) @@ -110,15 +114,24 @@ if(null == uid){ return ResultUtil.tokenErr(); } int numDigits = String.valueOf(editParticipant.getId()).length(); if (editParticipant.getIsStudent()==0){ return participantService.editParticipant(uid, editParticipant);} if (numDigits==9){ return participantService.editParticipant(uid, editParticipant); } else { AppUser appUser = new AppUser(); appUser.setId(editParticipant.getId()); TStudent student = new TStudent(); student.setId(editParticipant.getId()); student.setName(editParticipant.getName()); student.setIdCard(editParticipant.getIdcard()); student.setHeight(Double.valueOf(editParticipant.getHeight())); student.setWeight(editParticipant.getWeight()); student.setPhone(editParticipant.getPhone()); studentClient.updateAppUser(student); return ResultUtil.success(); } }catch (Exception e){ cloud-server-competition/src/main/java/com/dsh/competition/feignclient/account/StudentClient.java
@@ -1,5 +1,6 @@ package com.dsh.competition.feignclient.account; import com.dsh.competition.feignclient.account.model.AppUser; import com.dsh.competition.feignclient.account.model.Student; import com.dsh.competition.feignclient.account.model.TStudent; import org.springframework.cloud.openfeign.FeignClient; @@ -15,7 +16,8 @@ @FeignClient("mb-cloud-account") public interface StudentClient { @PostMapping("/base/appUser/updateTStudent") void updateAppUser(TStudent student); /** * 根据电话号码获取学员 * @param phone cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java
@@ -16,6 +16,7 @@ import com.dsh.competition.model.ParticipantVo; import com.dsh.competition.model.SaveParticipant; import com.dsh.competition.service.IParticipantService; import com.dsh.competition.util.CodeGenerateUtils; import com.dsh.competition.util.JuHeUtil; import com.dsh.competition.util.ResultUtil; import com.dsh.competition.util.ToolUtil; @@ -71,6 +72,9 @@ Date parse = sdf.parse(addParticipant.getBirthday()); participant.setBirthday(parse); } String s = CodeGenerateUtils.generateOrderSn(); String substring = s.substring(1); participant.setId(Integer.valueOf(substring)); participant.setAppUserId(uid); participant.setState(1); participant.setInsertTime(new Date()); cloud-server-competition/src/main/java/com/dsh/competition/util/CodeGenerateUtils.java
@@ -0,0 +1,74 @@ package com.dsh.competition.util; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Calendar; /** * @Description * @Author xiaochen * @Date 2021/7/28 10:26 */ public class CodeGenerateUtils { /** * @return * @Description 获取商品编码 * 商品编码规则:nanoTime(后5位)*5位随机数(10000~99999) * @Author xiaochen */ public static String generateProductCode() { long nanoPart = System.nanoTime() % 100000L; if (nanoPart < 10000L) { nanoPart += 10000L; } long randomPart = (long) (Math.random() * (90000) + 10000); String code = "0" + new BigDecimal(nanoPart).multiply(new BigDecimal(randomPart)); return code.substring(code.length() - 10); } /** * @return * @Description 生成订单编号 10位 * 订单编号规则:(10位):(年末尾*月,取后2位)+(用户ID%3.33*日取整后2位)+(timestamp*10000以内随机数,取后6位) * @Author xiaochen */ public static String generateOrderSn() { Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); year = year % 10; if (year == 0) year = 10; int month = calendar.get(Calendar.MONTH) + 1; int yearMonth = year * month; String yearMonthPart = "0" + yearMonth; yearMonthPart = yearMonthPart.substring(yearMonthPart.length() - 2); int day = calendar.get(Calendar.DAY_OF_MONTH); double v = Math.random() * 10000; int dayNum = (int) ((v % 3.33) * day); String dayPart = "0" + dayNum; dayPart = dayPart.substring(dayPart.length() - 2); String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); timestampPart = timestampPart.replace(".", "").replace("E", ""); timestampPart = timestampPart.substring(0, 6); return yearMonthPart + dayPart + timestampPart; } /** * @return * @Description 生成统一支付单号 规则:年(2)月(2)日(2)时(2)分(2)+timestamp*5位随机整数取后5位 * @Author xiaochen */ public static String generateVolumeSn() { Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); String dateTime = dateFormat.format(calendar.getTime()); dateTime = dateTime.substring(2); String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); timestampPart = timestampPart.replace(".", "").replace("E", ""); timestampPart = timestampPart.substring(0, 5); return dateTime + timestampPart; } } cloud-server-competition/src/main/java/com/dsh/competition/util/PayMoneyUtil.java
@@ -57,7 +57,7 @@ private String key = "";//微信商户号 private String callbackPath = "";//支付回调网关地址 private String callbackPath = "http://221.182.45.100:56666/competition";//支付回调网关地址 private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径 cloud-server-course/src/main/java/com/dsh/course/controller/CourseController.java
@@ -276,6 +276,7 @@ @PostMapping("/base/course/aliPaymentCourseCallback") public void aliPaymentCourseCallback(HttpServletRequest request, HttpServletResponse response){ try { System.err.println("=====支付宝回调======="); Map<String, String> map = payMoneyUtil.alipayCallback(request); if(null != map){ String code = map.get("out_trade_no"); cloud-server-course/src/main/java/com/dsh/course/model/vo/response/CourseDetailsResponse.java
@@ -40,5 +40,6 @@ @ApiModelProperty(value = "支付状态 1未支付 2续课") private Integer payStatus; @ApiModelProperty("详情图片") private String detailDrawing; } cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -431,6 +431,7 @@ TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); response.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); response.setCoverDrawing(coursePackage.getCoverDrawing()); response.setDetailDrawing(coursePackage.getDetailDrawing()); response.setCoursePackageName(coursePackage.getName()); response.setCoursePayId(tCoursePackagePayment.getId()); List<Integer> integers = StrUtils.dealStrToList(coursePackage.getClassWeeks()); @@ -661,7 +662,7 @@ public ResultUtil AlipayPayment(String code, BigDecimal request){ TCoursePackagePaymentMapper baseMapper1 = this.baseMapper; ResultUtil alipay = payMoneyUtil.alipay("课包购买", "", "", code, request.toString(), ResultUtil alipay = payMoneyUtil.alipay("课包购买", "课包购买", "", code, request.toString(), "/base/coursePackage/alipayRegisteredCoursesCallback"); if(alipay.getCode() == 200){ new Thread(new Runnable() { cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -951,7 +951,7 @@ sid=student.getId(); } ResultUtil alipay = payMoneyUtil.alipay("购买课程", "购买课程", "", code, paymentPrice.toString(), "/base/course/aliPaymentCourseCallback"); ResultUtil alipay = payMoneyUtil.alipay("购买课程", "购买课程", student.getId().toString(), code, paymentPrice.toString(), "/base/course/aliPaymentCourseCallback"); if(alipay.getCode() == 200){ Integer finalSid = sid; new Thread(new Runnable() { cloud-server-course/src/main/java/com/dsh/course/util/PayMoneyUtil.java
@@ -59,7 +59,7 @@ private String key = "6f5e0c2dcabfa9c27b5da5836a362fef";//微信商户号 private String callbackPath = "";//支付回调网关地址 private String callbackPath = "http://221.182.45.100:5004";//支付回调网关地址 private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径 @@ -142,6 +142,7 @@ model.setPassbackParams(passbackParams);//自定义参数 request.setBizModel(model); request.setNotifyUrl(callbackPath + notifyUrl); try { //这里和普通的接口调用不同,使用的是sdkExecute AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); cloud-server-management/src/main/webapp/WEB-INF/view/system/ticket/ticket_add.html
@@ -47,7 +47,7 @@ <input type="radio" name="type" value="1" checked onclick="updateType(1)"> 日卡 <input type="radio" name="type" value="2" > 月卡 <input type="radio" name="type" value="3" > 季卡 <input type="radio" name="type" value="3" > 年卡 <input type="radio" name="type" value="4" > 年卡 </div> </div> <div class="form-group"> cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
@@ -395,15 +395,18 @@ if ($('#userType').val()==1){ // 兑换方式 let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val(); if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null){ return Feng.error('兑换方式不能为空'); if (distributionMethod === '1') { if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null) { return Feng.error('兑换方式不能为空'); } } if (exchangeMethod === '1'){ if (exchangeMethod === '1' ){ if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){ return Feng.error('所需积分不能为空'); } } if (exchangeMethod === '2'){ if (exchangeMethod === '2' && distributionMethod === '1'){ if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){ return Feng.error('所需积分不能为空'); } @@ -411,7 +414,7 @@ return Feng.error('所需现金不能为空'); } } if (exchangeMethod === '3'){ if (exchangeMethod === '3' && distributionMethod === '1'){ if (requiredCash === undefined || requiredCash === '' || requiredCash === null){ return Feng.error('所需现金不能为空'); } @@ -520,6 +523,9 @@ $(function () { getProvince(null); radio1(); var OBJradio = document.getElementsByName("prescription") @@ -604,4 +610,34 @@ $('#app1').show(); // 适用范围 } const distributionMethodOptions = document.getElementsByName('distributionMethod'); // 监听distributionMethod选项的变化 for (let i = 0; i < distributionMethodOptions.length; i++) { distributionMethodOptions[i].addEventListener('change', function() { // 获取选中的distributionMethod值 const selectedDistributionMethod = document.querySelector('input[name="distributionMethod"]:checked').value; // 判断选中的值是否不等于1 if (selectedDistributionMethod !== '1') { console.log("已经选择1") // 隐藏exchangeType document.getElementById('exchangeType').style.display = 'none'; document.getElementById('needAmount').style.display = 'none'; document.getElementById('needIntegral').style.display = 'none'; } else { // 显示exchangeType document.getElementById('exchangeType').style.display = 'block'; document.getElementById('needAmount').style.display = 'block'; document.getElementById('needIntegral').style.display = 'block'; } }); } }); cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -327,7 +327,7 @@ /** * 购买课程支付宝回调 * 预约场地支付宝回调 * @param request * @param response */ cloud-server-other/src/main/java/com/dsh/other/util/PayMoneyUtil.java
@@ -61,7 +61,7 @@ private String key = "";//微信商户号 private String callbackPath = "";//支付回调网关地址 private String callbackPath = "http://221.182.45.100:56666/other";//支付回调网关地址 private String app_cert_path = "C:/cert/alipay/user/app_cert_path.crt";//应用公钥证书路径