| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.entity.TCoursePackageType; |
| | | import com.dsh.course.feignclient.model.StoreOfCourseVo; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import com.dsh.course.model.BaseVo; |
| | | import com.dsh.course.model.QueryCoursePackageLists; |
| | | import com.dsh.course.model.vo.response.Details; |
| | | import com.dsh.course.model.vo.response.ExchangeCoursePackageResponse; |
| | | import com.dsh.course.service.ICoursePackagePaymentConfigService; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.PageFactory; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.TokenUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | return icppconfigService.getById(coursePackConfigId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackage/queryCoursePackageLists") |
| | | public Page<Map<String, Object>> queryCoursePackageLists(@RequestBody QueryCoursePackageLists queryCoursePackageLists){ |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(queryCoursePackageLists.getLimit(), queryCoursePackageLists.getOffset(), queryCoursePackageLists.getSort(), queryCoursePackageLists.getOrder()); |
| | | Page<Map<String, Object>> mapPage = page.setRecords(coursePackageService.queryCoursePackageLists(page, queryCoursePackageLists)); |
| | | return mapPage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | import com.dsh.course.entity.TCoursePackageType; |
| | | import com.dsh.course.service.TCoursePackageTypeService; |
| | | 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.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 12:05 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class CoursePackageTypeController { |
| | | |
| | | @Autowired |
| | | private TCoursePackageTypeService coursePackageTypeService; |
| | | |
| | | |
| | | /** |
| | | * 获取课包所有类型 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackageType/queryAllCoursePackageType") |
| | | public List<TCoursePackageType> queryAllCoursePackageType(){ |
| | | return coursePackageTypeService.list(); |
| | | } |
| | | } |
| | |
| | | package com.dsh.course.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.feignclient.model.CourseOfStoreVo; |
| | | import com.dsh.course.model.QueryCoursePackageLists; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | List<CourseOfStoreVo> queryStoreOfCourse(); |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param page |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryCoursePackageLists(Page<Map<String, Object>> page, @Param("item") QueryCoursePackageLists queryCoursePackageLists); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 15:08 |
| | | */ |
| | | @Data |
| | | public class QueryCoursePackageLists { |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 课程类型id |
| | | */ |
| | | private Integer coursePackageTypeId; |
| | | /** |
| | | * 课程名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 课包状态 |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 售卖状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | private String order; |
| | | private Integer offset; |
| | | private Integer limit; |
| | | private String sort; |
| | | } |
| | |
| | | package com.dsh.course.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.feignclient.model.CourseOfStoreVo; |
| | | import com.dsh.course.model.CoursePackageInfo; |
| | | import com.dsh.course.model.CoursePackageList; |
| | | import com.dsh.course.model.CoursePackageListVo; |
| | | import com.dsh.course.model.PaymentCourseVo; |
| | | import com.dsh.course.model.*; |
| | | import com.dsh.course.util.ResultUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil paymentCourse(Integer uid, PaymentCourseVo paymentCourseVo) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryCoursePackageLists(Page<Map<String, Object>> page, QueryCoursePackageLists queryCoursePackageLists); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.CoursePackagePaymentConfig; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | |
| | | appUserClient.updateAppUser(appUser); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCoursePackageLists(Page<Map<String, Object>> page, QueryCoursePackageLists queryCoursePackageLists) { |
| | | List<Map<String, Object>> list = this.baseMapper.queryCoursePackageLists(page, queryCoursePackageLists); |
| | | for (Map<String, Object> map : list) { |
| | | Integer id = Integer.valueOf(map.get("id").toString()); |
| | | Integer integer = coursePackagePaymentService.queryCountNumber(id); |
| | | map.put("paymentNumber", integer); |
| | | |
| | | boolean cash = false; |
| | | boolean coin = false; |
| | | List<CoursePackagePaymentConfig> coursePackagePaymentConfigs = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", id)); |
| | | for (CoursePackagePaymentConfig coursePackagePaymentConfig : coursePackagePaymentConfigs) { |
| | | if(0 != coursePackagePaymentConfig.getCashPayment()){ |
| | | cash = true; |
| | | } |
| | | if(0 != coursePackagePaymentConfig.getPlayPaiCoin()){ |
| | | coin = true; |
| | | } |
| | | } |
| | | map.put("payType", (cash ? "现金支付" : "") + (coin ? cash ? "&玩湃币支付" : "玩湃币支付" : "")); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | and ts.`state` = 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryCoursePackageLists" resultType="map"> |
| | | select |
| | | a.id, |
| | | CONCAT(a.province, a.city) as city, |
| | | a.storeId, |
| | | b.`name` as coursePackageType, |
| | | a.`name`, |
| | | a.maxSubscribeNumber, |
| | | CONCAT('购买后', a.validDays, '天内有效') as validDays, |
| | | a.sort, |
| | | a.`status`, |
| | | a.state |
| | | from t_course_package a |
| | | left join t_course_package_type b on (a.coursePackageTypeId = b.id) |
| | | where a.state != 3 |
| | | <if test="null != item.provinceCode and '' != item.provinceCode"> |
| | | and a.provinceCode = #{item.provinceCode} |
| | | </if> |
| | | <if test="null != item.cityCode and '' != item.cityCode"> |
| | | and a.cityCode = #{item.cityCode} |
| | | </if> |
| | | <if test="null != item.coursePackageTypeId"> |
| | | and a.coursePackageTypeId = #{item.coursePackageTypeId} |
| | | </if> |
| | | <if test="null != item.name and '' != item.name"> |
| | | and a.name line CONCAT('%', #{item.name}, '%') |
| | | </if> |
| | | <if test="null != item.status"> |
| | | and a.status = #{item.status} |
| | | </if> |
| | | <if test="null != item.state"> |
| | | and a.state = #{item.state} |
| | | </if> |
| | | order by a.insertTime desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | package com.dsh.course.feignClient.course; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.course.model.QueryCoursePackageLists; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 15:12 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CoursePackageClient { |
| | | |
| | | |
| | | /** |
| | | * 获取课包管理列表数据 |
| | | * @param queryCoursePackageLists |
| | | * @return |
| | | */ |
| | | @PostMapping("/coursePackage/queryCoursePackageLists") |
| | | Page<Map<String, Object>> queryCoursePackageLists(QueryCoursePackageLists queryCoursePackageLists); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.course; |
| | | |
| | | import com.dsh.course.feignClient.course.model.TCoursePackageType; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 12:02 |
| | | */ |
| | | @FeignClient("mb-cloud-course") |
| | | public interface CoursePackageTypeClient { |
| | | |
| | | |
| | | /** |
| | | * 获取课包所有类型 |
| | | * @return |
| | | */ |
| | | @PostMapping("/coursePackageType/queryAllCoursePackageType") |
| | | List<TCoursePackageType> queryAllCoursePackageType(); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.course.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 15:08 |
| | | */ |
| | | @Data |
| | | public class QueryCoursePackageLists { |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 课程类型id |
| | | */ |
| | | private Integer coursePackageTypeId; |
| | | /** |
| | | * 课程名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 课包状态 |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 售卖状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | private String order; |
| | | private Integer offset; |
| | | private Integer limit; |
| | | private String sort; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.course.model; |
| | | |
| | | |
| | | 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; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 课程包类型 |
| | | * </p> |
| | | * |
| | | * @author administrator |
| | | * @since 2023-06-14 |
| | | */ |
| | | @Data |
| | | public class TCoursePackageType{ |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Integer id; |
| | | /** |
| | | * 类型名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/6 16:51 |
| | | */ |
| | | public interface StoreMapper extends BaseMapper<TStore> { |
| | | |
| | | |
| | | /** |
| | | * 获取所有省 |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryProvince(); |
| | | |
| | | |
| | | /** |
| | | * 根据省编号获取所有市 |
| | | * @param provinceCode |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryCity(@Param("provinceCode") Integer provinceCode); |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.course.CoursePackageTypeClient; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackageType; |
| | | import com.dsh.guns.modular.system.service.ICoursePackageService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 11:50 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/coursePackage") |
| | | public class TCoursePackageController { |
| | | |
| | | private String PREFIX = "/system/coursePackage/"; |
| | | |
| | | @Autowired |
| | | private ICoursePackageService coursePackageService; |
| | | |
| | | @Resource |
| | | private CoursePackageTypeClient coursePackageTypeClient; |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到列表页 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("/openCoursePackageListPage") |
| | | public String openCoursePackageListPage(Model model){ |
| | | List<TCoursePackageType> tCoursePackageTypes = coursePackageTypeClient.queryAllCoursePackageType(); |
| | | model.addAttribute("coursePackageType", tCoursePackageTypes); |
| | | List<Map<String, Object>> list = storeService.queryProvince(); |
| | | model.addAttribute("province", list); |
| | | return PREFIX + "coursePackage.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取城市列表 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryCity") |
| | | public List<Map<String, Object>> queryCity(Integer code){ |
| | | return storeService.queryCity(code); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param provinceCode |
| | | * @param cityCode |
| | | * @param coursePackageTypeId |
| | | * @param name |
| | | * @param status |
| | | * @param state |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryCoursePackageLists") |
| | | public Object queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer status, Integer state){ |
| | | Page<Map<String, Object>> mapPage = coursePackageService.queryCoursePackageLists(provinceCode, cityCode, coursePackageTypeId, name, status, state); |
| | | return mapPage; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 14:02 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/store") |
| | | public class TStoreController { |
| | | } |
| | |
| | | if (Objects.isNull(roleId)) { |
| | | throw new GunsException(BizExceptionEnum.REQUEST_NULL); |
| | | } |
| | | Role role = roleService.getById(roleId); |
| | | model.addAttribute("roleId", roleId); |
| | | model.addAttribute("roleName", ConstantFactory.me().getSingleRoleName(roleId)); |
| | | model.addAttribute("roleName", role.getName()); |
| | | return PREFIX + "/role_assign.html"; |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 11:51 |
| | | */ |
| | | public interface ICoursePackageService { |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param provinceCode |
| | | * @param cityCode |
| | | * @param coursePackageTypeId |
| | | * @param name |
| | | * @param status |
| | | * @param state |
| | | * @return |
| | | */ |
| | | Page<Map<String, Object>> queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer status, Integer state); |
| | | } |
| | |
| | | */ |
| | | public interface IStoreService extends IService<TStore> { |
| | | |
| | | /** |
| | | * 获取所有省 |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryProvince(); |
| | | |
| | | |
| | | /** |
| | | * 根据省编号获取所有市 |
| | | * @param provinceCode |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> queryCity(Integer provinceCode); |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.course.CoursePackageClient; |
| | | import com.dsh.course.feignClient.course.model.QueryCoursePackageLists; |
| | | import com.dsh.guns.core.support.HttpKit; |
| | | import com.dsh.guns.modular.system.service.ICoursePackageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2023/8/1 11:51 |
| | | */ |
| | | @Service |
| | | public class CoursePackageService implements ICoursePackageService { |
| | | |
| | | @Resource |
| | | private CoursePackageClient coursePackageClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @param provinceCode |
| | | * @param cityCode |
| | | * @param coursePackageTypeId |
| | | * @param name |
| | | * @param status |
| | | * @param state |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Page<Map<String, Object>> queryCoursePackageLists(String provinceCode, String cityCode, Integer coursePackageTypeId, String name, Integer status, Integer state) { |
| | | QueryCoursePackageLists queryCoursePackageLists = new QueryCoursePackageLists(); |
| | | queryCoursePackageLists.setProvinceCode(provinceCode); |
| | | queryCoursePackageLists.setCityCode(cityCode); |
| | | queryCoursePackageLists.setCoursePackageTypeId(coursePackageTypeId); |
| | | queryCoursePackageLists.setName(name); |
| | | queryCoursePackageLists.setState(state); |
| | | queryCoursePackageLists.setStatus(status); |
| | | HttpServletRequest request = HttpKit.getRequest(); |
| | | queryCoursePackageLists.setLimit(Integer.valueOf(request.getParameter("limit"))); |
| | | queryCoursePackageLists.setOffset(Integer.valueOf(request.getParameter("offset"))); |
| | | queryCoursePackageLists.setSort(request.getParameter("sort")); |
| | | queryCoursePackageLists.setOrder(request.getParameter("order")); |
| | | return coursePackageClient.queryCoursePackageLists(queryCoursePackageLists); |
| | | } |
| | | } |
| | |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class StoreServiceImpl extends ServiceImpl<StoreMapper, TStore> implements IStoreService { |
| | | |
| | | |
| | | /** |
| | | * 获取所有省 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryProvince() { |
| | | return this.baseMapper.queryProvince(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据省编号获取所有市 |
| | | * @param provinceCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryCity(Integer provinceCode) { |
| | | return this.baseMapper.queryCity(provinceCode); |
| | | } |
| | | } |
| | |
| | | spring.profiles.active=@pro files.active@ |
| | | spring.profiles.active=@profiles.active@ |
| | | spring.application.name=@artifactId@ |
| | | spring.cloud.nacos.username=@profiles.nacos-username@ |
| | | spring.cloud.nacos.password=@profiles.nacos-password@ |
| | |
| | | <mapper namespace="com.dsh.course.mapper.StoreMapper"> |
| | | |
| | | |
| | | <select id="queryProvince" resultType="map"> |
| | | select * from (select provinceCode as code, province as name from t_store where state = 1 group by provinceCode) as aa order by aa.code |
| | | </select> |
| | | |
| | | |
| | | <select id="queryCity" resultType="map"> |
| | | select * from (select cityCode as code, city as name from t_store where state = 1 and provinceCode = #{provinceCode} group by cityCode) as aa order by aa.code |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <link rel="stylesheet" href="${ctxPath}/static/js/layui/css/layui.css" media="all"> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>课包管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-lg-10 col-sm-9"> |
| | | <div class="row"> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#SelectCon id="provinceCode" name="所在省"> |
| | | <option value="">全部</option> |
| | | @for(obj in province){ |
| | | <option value="${obj.code}">${obj.name}</option> |
| | | @} |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#SelectCon id="cityCode" name="所在市"> |
| | | <option value="">全部</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#SelectCon id="coursePackageTypeId" name="课包类型"> |
| | | <option value="">全部</option> |
| | | @for(obj in coursePackageType){ |
| | | <option value="${obj.id}">${obj.name}</option> |
| | | @} |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#NameCon id="name" name="课包名称"/> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#SelectCon id="status" name="课包状态"> |
| | | <option value="">全部</option> |
| | | <option value="1">未开始</option> |
| | | <option value="2">售卖中</option> |
| | | <option value="3">已结束</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-lg-4 col-sm-12"> |
| | | <#SelectCon id="state" name="售卖状态"> |
| | | <option value="">全部</option> |
| | | <option value="1">上架中</option> |
| | | <option value="2">下架中</option> |
| | | </#SelectCon> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="col-lg-2 col-sm-3"> |
| | | <div class="row"> |
| | | <div class="col-lg-12 col-sm-12"> |
| | | <#button name="搜索" icon="fa-search" clickFun="CoursePackage.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="CoursePackage.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="managerTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/coursePackage/addCoursePackage")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="CoursePackage.addCoursePackage()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/editCoursePackage")){ |
| | | <#button name="编辑" icon="fa-edit" clickFun="CoursePackage.editCoursePackage()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/upCoursePackage")){ |
| | | <#button name="上架" icon="fa-refresh" clickFun="CoursePackage.editCoursePackageState(1)" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/downCoursePackage")){ |
| | | <#button name="下架" icon="fa-warning" clickFun="CoursePackage.editCoursePackageState(2)" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/coursePackageDiscount")){ |
| | | <#button name="折扣管理" icon="fa-check-circle" clickFun="CoursePackage.detailsCoursePackage()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/detailsCoursePackage")){ |
| | | <#button name="详情" icon="fa-check-circle" clickFun="CoursePackage.detailsCoursePackage()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/coursePackage/registrationRecord")){ |
| | | <#button name="报名信息" icon="fa-check-circle" clickFun="CoursePackage.detailsCoursePackage()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="managerTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/coursePackage/coursePackage.js"></script> |
| | | <script src="${ctxPath}/js/layui/layui.js" charset="utf-8"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#beginTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | </script> |
| | | @} |
New file |
| | |
| | | /** |
| | | * 系统管理--用户管理的单例对象 |
| | | */ |
| | | let CoursePackage = { |
| | | id: "managerTable",//表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | deptid:0 |
| | | }; |
| | | let language =$("#language").val() |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | CoursePackage.initColumn = function () { |
| | | let columns = [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '视频类型', field: 'type', align: 'center', valign: 'middle', |
| | | formatter: function (v) { |
| | | switch (v) { |
| | | case 1: |
| | | return '课后练习'; |
| | | case 2: |
| | | return '运动教学视频'; |
| | | case 3: |
| | | return '器材教学视频'; |
| | | } |
| | | |
| | | } |
| | | }, |
| | | {title: '课程封面', field: 'coverDrawing', align: 'center', valign: 'middle', |
| | | formatter: function (v) { |
| | | return '<img src="' + v + '" height="100px" onclick="lookBigImg(' + v + ')"/>' |
| | | } |
| | | }, |
| | | {title: '课程名称', field: 'name', align: 'center', valign: 'middle'}, |
| | | {title: '课程简介', field: 'introduce', align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'state', align: 'center', valign: 'middle', |
| | | formatter: function (v) { |
| | | return v == 1 ? '上架' : '下架'; |
| | | } |
| | | } |
| | | ]; |
| | | return columns; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | CoursePackage.check = function () { |
| | | let selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | if(language==1){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | }else if(language==2){ |
| | | Feng.info("Please select a record in the table first!"); |
| | | }else { |
| | | Feng.info("Pilih catatan di tabel terlebih dahulu!"); |
| | | } |
| | | return false; |
| | | } else { |
| | | CoursePackage.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加管理员 |
| | | */ |
| | | CoursePackage.addCoursePackage = function () { |
| | | let index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/course/showAddCoursePackage' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 点击修改按钮时 |
| | | * @param userId 管理员id |
| | | */ |
| | | CoursePackage.editCoursePackage = function () { |
| | | if (this.check()) { |
| | | let index = layer.open({ |
| | | type: 2, |
| | | title: '编辑', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/course/showEditCoursePackage?id=' + this.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | CoursePackage.delCoursePackage = function () { |
| | | if (this.check()) { |
| | | let operation = function(){ |
| | | let ajax = new $ax(Feng.ctxPath + "/course/delCoursePackage", function () { |
| | | Feng.success("删除成功!"); |
| | | CoursePackage.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", CoursePackage.seItem.id); |
| | | ajax.start(); |
| | | }; |
| | | |
| | | Feng.confirm("是否删除课程",operation); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 上下架 |
| | | * @param userId |
| | | */ |
| | | CoursePackage.editCoursePackageState = function (state) { |
| | | if (this.check()) { |
| | | if(CoursePackage.seItem.state == state){ |
| | | Feng.error("不能重复操作"); |
| | | return |
| | | } |
| | | let ajax = new $ax(Feng.ctxPath + "/course/editCoursePackageState", function (data) { |
| | | Feng.success("下架成功!"); |
| | | CoursePackage.table.refresh(); |
| | | }, function (data) { |
| | | Feng.error("下架失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", CoursePackage.seItem.id); |
| | | ajax.set("state", state); |
| | | ajax.start(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | CoursePackage.detailsCoursePackage = function () { |
| | | if (this.check()) { |
| | | let index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/course/showCoursePackageDetails?id=' + this.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | CoursePackage.resetSearch = function () { |
| | | $("#provinceCode").val(""); |
| | | $("#cityCode").val(""); |
| | | $("#coursePackageTypeId").val(""); |
| | | $("#name").val(""); |
| | | $("#status").val(""); |
| | | $("#state").val(""); |
| | | CoursePackage.search(); |
| | | } |
| | | |
| | | CoursePackage.search = function () { |
| | | let queryData = {}; |
| | | queryData['provinceCode'] = $("#provinceCode").val(); |
| | | queryData['cityCode'] = $("#cityCode").val(); |
| | | queryData['coursePackageTypeId'] = $("#coursePackageTypeId").val(); |
| | | queryData['name'] = $("#name").val(); |
| | | queryData['status'] = $("#status").val(); |
| | | queryData['state'] = $("#state").val(); |
| | | CoursePackage.table.refresh({query: queryData}); |
| | | } |
| | | |
| | | |
| | | $(function () { |
| | | let defaultColunms = CoursePackage.initColumn(); |
| | | let table = new BSTable(CoursePackage.id, "/coursePackage/queryCoursePackageLists", defaultColunms); |
| | | // 设置物理分页server(逻辑分页client) |
| | | table.setPaginationType("server"); |
| | | CoursePackage.table = table.init(); |
| | | |
| | | |
| | | $('#provinceCode').change(function () { |
| | | let ajax = new $ax(Feng.ctxPath + "/coursePackage/queryCity", function (data) { |
| | | let htmlStr = '<option value="">全部</option>'; |
| | | for (let i = 0; i < data.length; i++) { |
| | | htmlStr += '<option value="' + data[i].code + '">' + data[i].name + '</option>' |
| | | } |
| | | $('#cityCode').html(htmlStr); |
| | | }, function (data) { |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("code", $(this).val()); |
| | | ajax.start(); |
| | | }) |
| | | }); |