nickchange
2023-11-25 cad9305c4cbffe978370f4c39bfde63b248619c7
11.25
3个文件已修改
163 ■■■■ 已修改文件
cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetition.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
@@ -13,7 +13,9 @@
import com.dsh.competition.feignclient.account.AppUserClient;
import com.dsh.competition.feignclient.account.model.AppUser;
import com.dsh.competition.feignclient.course.CoursePackagePaymentClient;
import com.dsh.competition.feignclient.course.model.PaymentDeductionClassHour;
import com.dsh.competition.feignclient.model.*;
import com.dsh.competition.feignclient.other.StoreClient;
import com.dsh.competition.model.*;
import com.dsh.competition.service.CompetitionService;
import com.dsh.competition.service.IParticipantService;
@@ -722,12 +724,100 @@
        }
    }
    @Resource
    private StoreClient storeClient;
    @Autowired
    private UserCompetitionService userCompetitionService;
    @PostMapping("/base/competition/cancel")
    public void cancel(@RequestBody Integer id){
        try {
            Competition byId = cttService.getById(id);
            byId.setStatus(4);
            cttService.updateById(byId);
            List<PaymentCompetition> list = paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>().eq("competitionId", byId.getId()).eq("payStatus", 2));
            for (PaymentCompetition pay : list) {
                PaymentCompetition paymentCompetition = pay;
                String code = paymentCompetition.getCode();
                Double amount = paymentCompetition.getAmount();
                Competition competition = competitionService.getById(paymentCompetition.getCompetitionId());
                String payOrderNo = paymentCompetition.getPayOrderNo();
                if(paymentCompetition.getPayType() == 1){//微信支付
                    Map<String, String> map = payMoneyUtil.wxRefund(payOrderNo, code, amount.toString(), amount.toString(), "/base/competition/weChatCancelPaymentCompetitionCallback");
                    String return_code = map.get("return_code");
                    if(!"SUCCESS".equals(return_code)){
//                        return ResultUtil.error(map.get("return_msg"));
                        continue;
                    }
                    String refund_id = map.get("refund_id");
                    paymentCompetition.setRefundOrderNo(refund_id);
                    paymentCompetitionService.updateById(paymentCompetition);
                    storeClient.addBackRecord(paymentCompetition.getAmount()+"_"+paymentCompetition.getAppUserId());
                }
                if(paymentCompetition.getPayType() == 2){//支付宝支付
                    Map<String, String> map = payMoneyUtil.aliRefund(payOrderNo, amount.toString());
                    String return_code = map.get("code");
                    if(!"10000".equals(return_code)){
//                        return ResultUtil.error(map.get("msg"));
                        continue;
                    }
                    String refund_id = map.get("trade_no");
                    paymentCompetition.setRefundOrderNo(refund_id);
                    paymentCompetition.setRefundTime(new Date());
                    paymentCompetition.setPayStatus(3);
                    paymentCompetition.setAppUserId(null);
                    paymentCompetitionService.updateById(paymentCompetition);
//            competition.setApplicantsNumber(competition.getApplicantsNumber() - 1);
                    competitionService.updateById(competition);
                }
                if(paymentCompetition.getPayType() == 3){//玩湃币支付
                    AppUser appUser = appUserClient.queryAppUser(paymentCompetition.getAppUserId());
                    appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + amount.intValue());
                    appUserClient.updateAppUser(appUser);
                    paymentCompetition.setRefundOrderNo("");
                    paymentCompetition.setRefundTime(new Date());
                    paymentCompetition.setPayStatus(3);
                    paymentCompetition.setAppUserId(null);
                    paymentCompetitionService.updateById(paymentCompetition);
//            competition.setApplicantsNumber(competition.getApplicantsNumber() - 1);
                    competitionService.updateById(competition);
                }
                if(paymentCompetition.getPayType() == 4){//课程支付
                    List<UserCompetition> list1 = userCompetitionService.list(new QueryWrapper<UserCompetition>().eq("paymentCompetitionId", paymentCompetition.getId()));
                    for (UserCompetition userCompetition : list1) {
//                Participant participant = participantService.getById(userCompetition.getId());
//                Student student = studentClient.queryStudentByPhone(participant.getPhone());
                        PaymentDeductionClassHour paymentDeductionClassHour = new PaymentDeductionClassHour();
                        paymentDeductionClassHour.setId(userCompetition.getParticipantId());
                        paymentDeductionClassHour.setClassHour(competition.getClassPrice());
                        paymentDeductionClassHour.setCode(code);
                        coursePackagePaymentClient.rollbackPaymentDeductionClassHour(paymentDeductionClassHour);
                    }
                    paymentCompetition.setRefundOrderNo("");
                    paymentCompetition.setRefundTime(new Date());
                    paymentCompetition.setPayStatus(3);
                    paymentCompetition.setAppUserId(null);
                    paymentCompetitionService.updateById(paymentCompetition);
//            competition.setApplicantsNumber(competition.getApplicantsNumber() - 1);
                    competitionService.updateById(competition);
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java
@@ -278,35 +278,41 @@
        ListQuery listQuery = new ListQuery(page.getSize(),page.getCurrent(),provinceCode,cityCode,eventName,time,state,registerCondition,ids);
        Page<Competition> competitions = competitionClient.list(listQuery);
        List<Competition> records = new ArrayList<>();
        for (Competition competition : competitions.getRecords()) {
            // 当前时间小于开始时间
            if (competition.getStartTime().after(new Date())){
                competition.setStatus(1);
            }
            if (competition.getStartTime().before(new Date())){
                if (competition.getEndTime().after(new Date())){
                    competition.setStatus(2);
                }else{
                    competition.setStatus(3);
                }
            }
            if (competition.getStatus()!=state && state != null){
            }else{
                records.add(competition);
            }
            for (TStore tStore : list) {
                String[] split = competition.getStoreId().split(",");
                for (String s : split) {
                    if(s.equals(String.valueOf(tStore.getId()))){
                        if (competition.getStoreName()==null){
                            competition.setStoreName(tStore.getName());
                        }else {
                            competition.setStoreName(competition.getStoreName()+","+tStore.getName());
                        }
                    }
                }
            }
        }
//        for (Competition competition : competitions.getRecords()) {
////            if (competition.getStatus()==4){
////                continue;
////            }
//
//            // 当前时间小于开始时间
//            if (competition.getStartTime().after(new Date())){
//                competition.setStatus(1);
//            }
//            if (competition.getStartTime().before(new Date())){
//
//
//                if (competition.getEndTime().after(new Date())){
//                    competition.setStatus(2);
//                }else{
//                    competition.setStatus(3);
//                }
//            }
//            if (competition.getStatus()!=state && state != null){
//            }else{
//                records.add(competition);
//            }
//            for (TStore tStore : list) {
//                String[] split = competition.getStoreId().split(",");
//                for (String s : split) {
//                    if(s.equals(String.valueOf(tStore.getId()))){
//                        if (competition.getStoreName()==null){
//                            competition.setStoreName(tStore.getName());
//                        }else {
//                            competition.setStoreName(competition.getStoreName()+","+tStore.getName());
//                        }
//                    }
//                }
//            }
//        }
        competitions.setRecords(records);
        System.err.println(competitions.getRecords());
        return  super.packForBT(competitions);
@@ -393,9 +399,9 @@
    @RequestMapping(value = "/cancel")
    public Object cancel(Integer id) {
    public Object cancel(Integer TCompetitionId) {
        try {
            competitionClient.cancel(id);
            competitionClient.cancel(TCompetitionId);
            return SUCCESS_TIP;
        }catch (Exception e){
            e.printStackTrace();
@@ -446,4 +452,7 @@
    }
}
cloud-server-management/src/main/webapp/static/modular/system/tCompetition/tCompetition.js
@@ -166,7 +166,7 @@
            confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'),
            closeOnConfirm: true
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/TCompetition/delete", function (data) {
            var ajax = new $ax(Feng.ctxPath + "/tCompetition/cancel", function (data) {
                  if(language==1){
                    swal("删除成功", "您已经成功删除了" + nickname + "。", "success");
                }else if(language==2){