New file |
| | |
| | | package com.dsh.course.feignClient.other; |
| | | |
| | | import com.dsh.course.feignClient.other.model.EditHonorVO; |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface HonorClient { |
| | | |
| | | @RequestMapping(value = "/base/honor/list") |
| | | public Map<Integer, List<HonorRules>> getList(); |
| | | |
| | | /** |
| | | * 修改荣誉规则 并返回新的荣誉规则列表 |
| | | */ |
| | | @RequestMapping(value = "/base/honor/edit") |
| | | @ResponseBody |
| | | public Object edit(@RequestBody EditHonorVO vo); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other; |
| | | |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import com.dsh.course.feignClient.other.model.Phone; |
| | | import com.dsh.guns.modular.system.model.UpdatePhoneVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface PhoneClient { |
| | | |
| | | @RequestMapping(value = "/base/phone/list") |
| | | List<Phone> list(); |
| | | |
| | | /** |
| | | * 修改客服电话 |
| | | */ |
| | | @RequestMapping("/update") |
| | | @ResponseBody |
| | | Object update(@RequestBody Phone phone); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other; |
| | | |
| | | import com.dsh.course.feignClient.other.model.FrequentlyAskedQuestions; |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import com.dsh.guns.modular.system.model.QuestionChangeStateVO; |
| | | import com.dsh.guns.modular.system.model.QuestionSearchVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 常见问题 |
| | | */ |
| | | @FeignClient(value = "mb-cloud-other") |
| | | public interface QuestionClient { |
| | | |
| | | /** |
| | | * 获取所有常见问题 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/question/listAll") |
| | | List<FrequentlyAskedQuestions> listAll(@RequestBody QuestionSearchVO vo); |
| | | |
| | | /** |
| | | * 添加常见问题 |
| | | */ |
| | | @RequestMapping("/base/question/addQuestion") |
| | | Object addQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions); |
| | | |
| | | /** |
| | | * 上/下架、删除常见问题 type=1为上架 2为下架 3为删除 |
| | | */ |
| | | @RequestMapping("/base/question/changeState") |
| | | Object changeState(@RequestBody QuestionChangeStateVO vo); |
| | | |
| | | /** |
| | | * 查看详情 |
| | | */ |
| | | @RequestMapping("/base/question/getInfo") |
| | | public FrequentlyAskedQuestions getInfo(@RequestBody Integer id); |
| | | |
| | | /** |
| | | * 修改常见问题 |
| | | */ |
| | | @RequestMapping("/base/question/editQuestion") |
| | | public Object editQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions); |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.model; |
| | | |
| | | import lombok.Data; |
| | | import java.util.List; |
| | | /** |
| | | * 荣誉规则修改对象 |
| | | */ |
| | | @Data |
| | | public class EditHonorVO { |
| | | private data type1; |
| | | private data type2; |
| | | private data type3; |
| | | private data type4; |
| | | |
| | | |
| | | public static class data { |
| | | private Integer type; |
| | | private List<String> condition; |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public List<String> getCondition() { |
| | | return condition; |
| | | } |
| | | |
| | | public void setCondition(List<String> condition) { |
| | | this.condition = condition; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.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.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 常见问题 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-03 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_frequently_asked_questions") |
| | | public class FrequentlyAskedQuestions extends Model<FrequentlyAskedQuestions> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 常见问题 |
| | | */ |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @TableField("sort") |
| | | private Integer sort; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | @TableField("state") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date insertTime; |
| | | /** |
| | | * 答复内容 |
| | | */ |
| | | @TableField("answer") |
| | | private String answer; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class HonorList { |
| | | private Integer id; |
| | | private Integer type; |
| | | private String level; |
| | | private String condition; |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.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 lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 荣誉规则 |
| | | * </p> |
| | | * |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_honor_rules") |
| | | public class HonorRules extends Model<HonorRules> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 等级 |
| | | */ |
| | | @TableField("level") |
| | | private String level; |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | @TableField("condition") |
| | | private String condition; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.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 lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 客服电话 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-07-03 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_phone") |
| | | public class Phone extends Model<Phone> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | private Date insertTime; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignClient.other.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UpdatePhoneVO { |
| | | private Integer id; |
| | | private String phone; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.other.HonorClient; |
| | | import com.dsh.course.feignClient.other.QuestionClient; |
| | | import com.dsh.course.feignClient.other.model.FrequentlyAskedQuestions; |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.tips.SuccessTip; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.CouponDataVo; |
| | | import com.dsh.guns.modular.system.model.QuestionChangeStateVO; |
| | | import com.dsh.guns.modular.system.model.QuestionSearchVO; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 优惠券管理 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tQuestion") |
| | | public class QuestionController { |
| | | |
| | | private String PREFIX = "/system/tQuestion/"; |
| | | |
| | | @Resource |
| | | private IRegionService regiService; |
| | | |
| | | @Resource |
| | | private IStoreService storeService; |
| | | |
| | | @Resource |
| | | private CouponClient client; |
| | | |
| | | @Resource |
| | | private QuestionClient questionClient; |
| | | @Resource |
| | | private CityManagerClient cmgrClient; |
| | | |
| | | /** |
| | | * 跳转常见问题首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | return PREFIX + "TQuestion.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取常见问题列表 |
| | | * @param content 模糊查询标题 |
| | | * @param state 查询状态 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @ResponseBody |
| | | public List<FrequentlyAskedQuestions> list(String content, Integer state) { |
| | | QuestionSearchVO questionSearchVO = new QuestionSearchVO(); |
| | | questionSearchVO.setContent(content); |
| | | questionSearchVO.setState(state); |
| | | return questionClient.listAll(questionSearchVO); |
| | | } |
| | | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String addQuestion(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("userType",objectType); |
| | | return PREFIX + "TQuestionAdd.html"; |
| | | } |
| | | |
| | | /** |
| | | * 批量上/下架 删除常见问题 type=1 上架 2下架 3删除 |
| | | */ |
| | | @RequestMapping("/changeState") |
| | | @ResponseBody |
| | | public Object changeState(@RequestBody QuestionChangeStateVO vo) { |
| | | questionClient.changeState(vo); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | /** |
| | | * 添加常见问题 |
| | | */ |
| | | @RequestMapping("/addQuestion") |
| | | @ResponseBody |
| | | public Object addQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions) { |
| | | questionClient.addQuestion(frequentlyAskedQuestions); |
| | | return new SuccessTip<>(); |
| | | } |
| | | /** |
| | | * 修改常见问题 |
| | | */ |
| | | @RequestMapping("/editQuestion") |
| | | @ResponseBody |
| | | public Object editQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions) { |
| | | questionClient.editQuestion(frequentlyAskedQuestions); |
| | | return new SuccessTip<>(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到编辑 |
| | | */ |
| | | @RequestMapping("/editQuestion/{id}") |
| | | public String editQuestion(Model model,@PathVariable("id") Integer id) { |
| | | FrequentlyAskedQuestions info = questionClient.getInfo(id); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("userType",objectType); |
| | | model.addAttribute("info",info); |
| | | return PREFIX + "TQuestionEdit.html"; |
| | | } |
| | | /** |
| | | * 跳转到详情 |
| | | */ |
| | | @RequestMapping("/infoQuestion/{id}") |
| | | public String infoQuestion(Model model,@PathVariable("id") Integer id) { |
| | | FrequentlyAskedQuestions info = questionClient.getInfo(id); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("userType",objectType); |
| | | model.addAttribute("info",info); |
| | | return PREFIX + "TQuestionInfo.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到门店管理列表页 |
| | | */ |
| | | @RequestMapping("/storeList") |
| | | public String storePage(Model model) { |
| | | return PREFIX + "TQuestionEdit.html"; |
| | | } |
| | | |
| | | @RequestMapping("/storeDetailsOfSearch") |
| | | @ResponseBody |
| | | public Object listOfStore(Integer provinceId,Integer cityId,Integer cityManagerId,String storeName){ |
| | | System.out.println("provinceId"+provinceId); |
| | | System.out.println("cityId"+cityId); |
| | | System.out.println("cityManagerId"+cityManagerId); |
| | | System.out.println("storeName"+storeName); |
| | | String provinceCode = null; |
| | | String cityCode = null; |
| | | if (ToolUtil.isNotEmpty(provinceId)){ |
| | | Region provinceRegion = regiService.getById(provinceId); |
| | | provinceCode = provinceRegion.getCode(); |
| | | } |
| | | if (ToolUtil.isNotEmpty(cityId)){ |
| | | Region cityRegion = regiService.getById(cityId); |
| | | cityCode = cityRegion.getCode(); |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String,Object>> storeList = storeService.queryListOfpage(provinceCode,cityCode,cityManagerId,storeName,page); |
| | | if (storeList.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : storeList) { |
| | | String provinceName = (String) stringObjectMap.get("province"); |
| | | String cityName = (String) stringObjectMap.get("city"); |
| | | stringObjectMap.put("provinceCity",provinceName+cityName); |
| | | Integer managerId = (Integer) stringObjectMap.get("cityManagerId"); |
| | | CityManager cityManager = cmgrClient.queryCityManagerById(managerId); |
| | | if (ToolUtil.isNotEmpty(cityManager)){ |
| | | stringObjectMap.put("accountName",cityManager.getName()+"+"+cityManager.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | return storeList; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getProvince") |
| | | @ResponseBody |
| | | public Object getProvince(){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,0)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getCity") |
| | | @ResponseBody |
| | | public Object getCity(Integer province){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,province)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/uploadPic") |
| | | @ResponseBody |
| | | public Object add(@RequestParam("file") MultipartFile imgFile) throws IOException { |
| | | String originalFilename = imgFile.getOriginalFilename(); |
| | | String newName = originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf(".")); |
| | | String url = OBSUploadUtil.inputStreamUpload(imgFile); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | //是否上传成功 |
| | | map.put("state", "SUCCESS"); |
| | | //现在文件名称 |
| | | map.put("title", newName); |
| | | //文件原名称 |
| | | map.put("original", originalFilename); |
| | | //文件类型 .+后缀名 |
| | | map.put("type", originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf("."))); |
| | | //文件路径 |
| | | map.put("url", url); |
| | | //文件大小(字节数) |
| | | map.put("size", imgFile.getSize() + ""); |
| | | System.out.println(map); |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | @PostMapping(value = "/commitData") |
| | | @ResponseBody |
| | | public Object commitData( CouponDataVo dataVo){ |
| | | System.out.println(dataVo); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | dataVo.setUserType(objectType); |
| | | client.insertIntoData(dataVo); |
| | | return new SuccessTip<>(); |
| | | } |
| | | } |
| | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("userType",objectType); |
| | | return PREFIX + "TCouponAdd.html"; |
| | | return PREFIX + "TQuestionAdd.html"; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/storeList") |
| | | public String storePage(Model model) { |
| | | return PREFIX + "TStoreList.html"; |
| | | return PREFIX + "TQuestionEdit.html"; |
| | | } |
| | | |
| | | @RequestMapping("/storeDetailsOfSearch") |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.activity.model.CouponListOfSearch; |
| | | import com.dsh.course.feignClient.other.HonorClient; |
| | | import com.dsh.course.feignClient.other.model.EditHonorVO; |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.tips.SuccessTip; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.CouponDataVo; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 荣誉管理 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tHonor") |
| | | public class THonorController { |
| | | |
| | | |
| | | |
| | | private String PREFIX = "/system/tHonor/"; |
| | | |
| | | |
| | | @Resource |
| | | private IRegionService regiService; |
| | | |
| | | @Resource |
| | | private IStoreService storeService; |
| | | |
| | | @Resource |
| | | private CouponClient client; |
| | | |
| | | @Resource |
| | | private HonorClient honorClient; |
| | | @Resource |
| | | private CityManagerClient cmgrClient; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到荣誉管理首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String index(Model model) { |
| | | return PREFIX + "THonor.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取荣誉规则列表 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @ResponseBody |
| | | public Map<Integer, List<HonorRules>> list() { |
| | | return honorClient.getList(); |
| | | } |
| | | /** |
| | | * 修改荣誉规则 |
| | | */ |
| | | @RequestMapping("/edit") |
| | | @ResponseBody |
| | | public Object edit(@RequestBody EditHonorVO vo) { |
| | | |
| | | return honorClient.edit(vo); |
| | | } |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/coupon_add") |
| | | public String memberCouponAdd(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | System.out.println(objectType); |
| | | model.addAttribute("userType",objectType); |
| | | return PREFIX + "TQuestionAdd.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到门店管理列表页 |
| | | */ |
| | | @RequestMapping("/storeList") |
| | | public String storePage(Model model) { |
| | | return PREFIX + "TQuestionEdit.html"; |
| | | } |
| | | |
| | | @RequestMapping("/storeDetailsOfSearch") |
| | | @ResponseBody |
| | | public Object listOfStore(Integer provinceId,Integer cityId,Integer cityManagerId,String storeName){ |
| | | System.out.println("provinceId"+provinceId); |
| | | System.out.println("cityId"+cityId); |
| | | System.out.println("cityManagerId"+cityManagerId); |
| | | System.out.println("storeName"+storeName); |
| | | String provinceCode = null; |
| | | String cityCode = null; |
| | | if (ToolUtil.isNotEmpty(provinceId)){ |
| | | Region provinceRegion = regiService.getById(provinceId); |
| | | provinceCode = provinceRegion.getCode(); |
| | | } |
| | | if (ToolUtil.isNotEmpty(cityId)){ |
| | | Region cityRegion = regiService.getById(cityId); |
| | | cityCode = cityRegion.getCode(); |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String,Object>> storeList = storeService.queryListOfpage(provinceCode,cityCode,cityManagerId,storeName,page); |
| | | if (storeList.size() > 0 ){ |
| | | for (Map<String, Object> stringObjectMap : storeList) { |
| | | String provinceName = (String) stringObjectMap.get("province"); |
| | | String cityName = (String) stringObjectMap.get("city"); |
| | | stringObjectMap.put("provinceCity",provinceName+cityName); |
| | | Integer managerId = (Integer) stringObjectMap.get("cityManagerId"); |
| | | CityManager cityManager = cmgrClient.queryCityManagerById(managerId); |
| | | if (ToolUtil.isNotEmpty(cityManager)){ |
| | | stringObjectMap.put("accountName",cityManager.getName()+"+"+cityManager.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | return storeList; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getProvince") |
| | | @ResponseBody |
| | | public Object getProvince(){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,0)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/getCity") |
| | | @ResponseBody |
| | | public Object getCity(Integer province){ |
| | | return regiService.list(new LambdaQueryWrapper<Region>() |
| | | .eq(Region::getParentId,province)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/uploadPic") |
| | | @ResponseBody |
| | | public Object add(@RequestParam("file") MultipartFile imgFile) throws IOException { |
| | | String originalFilename = imgFile.getOriginalFilename(); |
| | | String newName = originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf(".")); |
| | | String url = OBSUploadUtil.inputStreamUpload(imgFile); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | //是否上传成功 |
| | | map.put("state", "SUCCESS"); |
| | | //现在文件名称 |
| | | map.put("title", newName); |
| | | //文件原名称 |
| | | map.put("original", originalFilename); |
| | | //文件类型 .+后缀名 |
| | | map.put("type", originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf("."))); |
| | | //文件路径 |
| | | map.put("url", url); |
| | | //文件大小(字节数) |
| | | map.put("size", imgFile.getSize() + ""); |
| | | System.out.println(map); |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | @PostMapping(value = "/commitData") |
| | | @ResponseBody |
| | | public Object commitData( CouponDataVo dataVo){ |
| | | System.out.println(dataVo); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | dataVo.setUserType(objectType); |
| | | client.insertIntoData(dataVo); |
| | | return new SuccessTip<>(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.feignClient.account.CityManagerClient; |
| | | import com.dsh.course.feignClient.account.model.CityManager; |
| | | import com.dsh.course.feignClient.activity.CouponClient; |
| | | import com.dsh.course.feignClient.other.HonorClient; |
| | | import com.dsh.course.feignClient.other.PhoneClient; |
| | | import com.dsh.course.feignClient.other.model.HonorRules; |
| | | import com.dsh.course.feignClient.other.model.Phone; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.tips.SuccessTip; |
| | | import com.dsh.guns.core.common.constant.factory.PageFactory; |
| | | import com.dsh.guns.core.util.ToolUtil; |
| | | import com.dsh.guns.modular.system.model.CouponDataVo; |
| | | import com.dsh.guns.modular.system.model.Region; |
| | | import com.dsh.guns.modular.system.model.UpdatePhoneVO; |
| | | import com.dsh.guns.modular.system.service.IRegionService; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import com.dsh.guns.modular.system.util.OBSUploadUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 客服电话 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("/tPhone") |
| | | public class TPhoneController { |
| | | |
| | | @Resource |
| | | private PhoneClient phoneClient; |
| | | |
| | | /** |
| | | * 获取客服电话 |
| | | */ |
| | | @RequestMapping("/list") |
| | | @ResponseBody |
| | | public List<Phone> list() { |
| | | return phoneClient.list(); |
| | | } |
| | | /** |
| | | * 修改客服电话 |
| | | */ |
| | | @RequestMapping("/update") |
| | | @ResponseBody |
| | | public Object update(@RequestBody Phone phone) { |
| | | phoneClient.update(phone); |
| | | return new SuccessTip<>(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionChangeStateVO { |
| | | /** |
| | | * 常见问题Id |
| | | */ |
| | | List<Integer> questionId; |
| | | /** |
| | | * 上/下架 删除常见问题 type=1 上架 2下架 3删除 |
| | | */ |
| | | Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QuestionSearchVO { |
| | | /** |
| | | * 常见问题 |
| | | */ |
| | | String content; |
| | | /** |
| | | * 上/下架 删除常见问题 type=1 上架 2下架 3删除 |
| | | */ |
| | | Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.guns.modular.system.model; |
| | | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UpdatePhoneVO { |
| | | private Integer id; |
| | | private String phone; |
| | | } |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .row { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .table-container { |
| | | flex-basis: 48%; |
| | | } |
| | | table { |
| | | border-collapse: collapse; |
| | | width: 300px; |
| | | table-layout: fixed; |
| | | margin-top: 10px; |
| | | } |
| | | th, td { |
| | | border: 1px solid #e0e0e0; |
| | | padding: 8px; |
| | | } |
| | | th { |
| | | background-color: #f2f2f2; |
| | | } |
| | | input { |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | border: 1px solid #e0e0e0; |
| | | padding: 8px; |
| | | background-color: transparent; |
| | | } |
| | | .title { |
| | | margin-bottom: 10px; |
| | | font-size: 18px; |
| | | color: black; |
| | | } |
| | | #table-container-2{ |
| | | margin-top: 10px; |
| | | } |
| | | #buttonEdit { |
| | | margin-left: 520px; |
| | | } |
| | | |
| | | </style> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>荣誉管理</h5> |
| | | </div> |
| | | <div class="ibox-title"> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="table-container" id = "table-container-1"> |
| | | <h3 class = "title">俱乐部之星:</h3> |
| | | <div id="table1"></div> |
| | | </div> |
| | | <div class="table-container"> |
| | | <h3 class = "title">运动达人:</h3> |
| | | <div id="table2"></div> |
| | | </div> |
| | | </div> |
| | | <div class="row" id = "table-container-2"> |
| | | <div class="table-container"> |
| | | <h3 class = "title">社区之王:</h3> |
| | | <div id="table3"></div> |
| | | </div> |
| | | <div class="table-container"> |
| | | <h3 class = "title">深度玩家:</h3> |
| | | <div id="table4"></div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5" id = "buttonEdit"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="THonor.edit();" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/tHonor/THonor.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .data-item { |
| | | position: relative; |
| | | border: 1px solid #ccc; |
| | | padding: 10px; |
| | | margin-bottom: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | max-width: 200px; |
| | | margin-right: 10px; |
| | | } |
| | | |
| | | .delete-button { |
| | | position: absolute; |
| | | top: -10px; |
| | | right: -10px; |
| | | cursor: pointer; |
| | | color: black; |
| | | width: 20px; |
| | | height: 20px; |
| | | text-align: center; |
| | | line-height: 20px; |
| | | border-radius: 50%; |
| | | } |
| | | </style> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>客服管理</h5> |
| | | </div> |
| | | <div class="ibox-title"> |
| | | <h5>客服电话</h5> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="addPhone" name="添加联系方式" /> |
| | | <div id="phone"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button id="addButton" name="添加" icon="fa-search"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <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-sm-3"> |
| | | <#NameCon id="content" name="问题标题" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="state" name="状态" > |
| | | <option value="">全部</option> |
| | | <option value="1">已上架</option> |
| | | <option value="2">已下架</option> |
| | | <option value="3">已删除</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TQuestion.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TQuestion.resetSearch()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TCouponTableToolbar" role="group"> |
| | | <#button name="添加" icon="fa-plus" clickFun="TQuestion.openAdd()"/> |
| | | <#button name="编辑" icon="fa-edit" clickFun="TQuestion.openChange()" space="true"/> |
| | | <#button name="删除" icon="fa-remove" clickFun="TQuestion.delete()" space="true"/> |
| | | <#button name="上架" icon="fa-check" clickFun="TQuestion.onShelf()" space="true"/> |
| | | <#button name="下架" icon="fa-remove" clickFun="TQuestion.offShelf()" space="true"/> |
| | | <#button name="查看详情" icon="fa-search" clickFun="TQuestion.getInfo()" space="true"/> |
| | | </div> |
| | | <#table id="TQuestionTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/tQuestion/TQuestion.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:350px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">添加常见问题</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | <label class="label1" for="questionTitle">*问题标题:</label> |
| | | <input class="textarea" type="text" id="questionTitle" placeholder="请输入问题标题"> |
| | | <div> |
| | | <label for="editor_1">*答复内容:</label> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;"></textarea> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="add();" /> |
| | | </div> |
| | | </div> |
| | | <label for="sort">*排 序:</label> |
| | | <input type="text" id="sort" placeholder="请输入排序"><span> 数字越大,权重越大</span> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="text/javascript"> |
| | | const data1 = { |
| | | content:"", |
| | | sort:null, |
| | | answer:"" |
| | | } |
| | | var editor_1 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | }); |
| | | function add(){ |
| | | const input1 = document.getElementById('questionTitle'); |
| | | const value1 = input1.value; |
| | | const input2 = document.getElementById('sort'); |
| | | const value2 = input2.value; |
| | | |
| | | if (editor_1.getContent() === ""){ |
| | | Feng.error("答复内容不能为空!"); |
| | | return; |
| | | }if (value1 === ""){ |
| | | Feng.error("问题标题不能为空!"); |
| | | return; |
| | | }if (value2 === ""){ |
| | | Feng.error("排序不能为空!"); |
| | | return; |
| | | } |
| | | data1.content = value1; |
| | | data1.sort = value2; |
| | | data1.answer =editor_1.getContent(); |
| | | console.log(data1); |
| | | submitData(data1); |
| | | } |
| | | function submitData(data) { |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/addQuestion", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("添加成功!"); |
| | | window.parent.TQuestion.table.refresh(); }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "添加失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | } |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:350px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <input id = "id" style="display: none;" value="${info.id}"/> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">编辑常见问题</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | |
| | | <label class="label1" for="questionTitle">*问题标题:</label> |
| | | <input class="textarea" value="${info.content}" type="text" id="questionTitle" placeholder="请输入问题标题"> |
| | | <div> |
| | | <label for="editor_1">*答复内容:</label> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${info.answer}</textarea> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="edit();" /> |
| | | </div> |
| | | </div> |
| | | <label for="sort">*排 序:</label> |
| | | <input type="text" id="sort" value="${info.sort}" placeholder="请输入排序"><span> 数字越大,权重越大</span> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="text/javascript"> |
| | | |
| | | |
| | | const data1 = { |
| | | id:null, |
| | | content:"", |
| | | sort:null, |
| | | answer:"" |
| | | } |
| | | var editor_1 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | }); |
| | | |
| | | |
| | | function edit(){ |
| | | const input1 = document.getElementById('questionTitle'); |
| | | const value1 = input1.value; |
| | | const input2 = document.getElementById('sort'); |
| | | const value2 = input2.value; |
| | | const input3 = document.getElementById('id'); |
| | | const value3 = input3.value; |
| | | |
| | | if (editor_1.getContent() == ""){ |
| | | Feng.error("答复内容不能为空!"); |
| | | return; |
| | | }if (value1 == ""){ |
| | | Feng.error("问题标题不能为空!"); |
| | | return; |
| | | }if (value2 == ""){ |
| | | Feng.error("排序不能为空!"); |
| | | return; |
| | | } |
| | | data1.id = value3; |
| | | data1.content = value1; |
| | | data1.sort = value2; |
| | | data1.answer =editor_1.getContent(); |
| | | console.log(data1); |
| | | submitData(data1); |
| | | } |
| | | function submitData(data) { |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/editQuestion", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | window.parent.TQuestion.table.refresh(); |
| | | Feng.success("修改成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "修改失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:350px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <input id = "id" style="display: none;" value="${info.id}"/> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">常见问题详情</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="panel-body"> |
| | | |
| | | <label class="label1" for="questionTitle">*问题标题:</label> |
| | | <input class="textarea" value="${info.content}" type="text" id="questionTitle" placeholder="请输入问题标题"> |
| | | <div> |
| | | <label for="editor_1">*答复内容:</label> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${info.answer}</textarea> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | </div> |
| | | <label for="sort">*排 序:</label> |
| | | <input type="text" id="sort" value="${info.sort}" placeholder="请输入排序"><span> 数字越大,权重越大</span> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script type="text/javascript"> |
| | | |
| | | |
| | | const data1 = { |
| | | id:null, |
| | | content:"", |
| | | sort:null, |
| | | answer:"" |
| | | } |
| | | var editor_1 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | |
| | | }); |
| | | function edit(){ |
| | | const input1 = document.getElementById('questionTitle'); |
| | | const value1 = input1.value; |
| | | const input2 = document.getElementById('sort'); |
| | | const value2 = input2.value; |
| | | const input3 = document.getElementById('id'); |
| | | const value3 = input3.value; |
| | | |
| | | if (editor_1.getContent() == ""){ |
| | | Feng.error("答复内容不能为空!"); |
| | | return; |
| | | }if (value1 == ""){ |
| | | Feng.error("问题标题不能为空!"); |
| | | return; |
| | | }if (value2 == ""){ |
| | | Feng.error("排序不能为空!"); |
| | | return; |
| | | } |
| | | data1.id = value3; |
| | | data1.content = value1; |
| | | data1.sort = value2; |
| | | data1.answer =editor_1.getContent(); |
| | | console.log(data1); |
| | | submitData(data1); |
| | | } |
| | | function submitData(data) { |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/editQuestion", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("修改成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "修改失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var THonor = { |
| | | id: "THonorTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | // 修改荣誉规则对象 |
| | | const data1 = { |
| | | type1:{ |
| | | type:null, |
| | | condition:[] |
| | | },type2:{ |
| | | type:null, |
| | | condition:[] |
| | | },type3:{ |
| | | type:null, |
| | | condition:[] |
| | | },type4:{ |
| | | type:null, |
| | | condition:[] |
| | | } |
| | | }; |
| | | THonor.edit = function(){ |
| | | var inputs1 = document.querySelectorAll('#input1'); |
| | | |
| | | for (let i = 0; i < inputs1.length-1; i++) { |
| | | data1.type1.condition.push(inputs1[i].value); |
| | | if (Number(inputs1[i].value)>Number(inputs1[i+1].value)){ |
| | | return Feng.error("俱乐部之星等级满足条件值设置错误!错误在等级"+(i+1)+"和等级"+(i+1+1)); |
| | | } |
| | | if (i === inputs1.length-1-1){ |
| | | data1.type1.condition.push(inputs1[i+1].value); |
| | | } |
| | | } |
| | | |
| | | var inputs2 = document.querySelectorAll('#input2'); |
| | | for (let i = 0; i < inputs2.length-1; i++) { |
| | | data1.type2.condition.push(inputs2[i].value); |
| | | console.log(inputs2[i].value); |
| | | if (Number(inputs2[i].value)>Number(inputs2[i+1].value)){ |
| | | return Feng.error("运动达人等级满足条件值设置错误!错误在等级"+(i+1)+"和等级"+(i+1+1)); |
| | | } |
| | | if (i === inputs2.length-1-1){ |
| | | data1.type2.condition.push(inputs2[i+1].value); |
| | | } |
| | | } |
| | | |
| | | var inputs3 = document.querySelectorAll('#input3'); |
| | | for (let i = 0; i < inputs3.length-1; i++) { |
| | | data1.type3.condition.push(inputs3[i].value); |
| | | if (Number(inputs3[i].value)>Number(inputs3[i+1].value)){ |
| | | return Feng.error("社区之王等级满足条件值设置错误!错误在等级"+(i+1)+"和等级"+(i+1+1)); |
| | | } |
| | | if (i === inputs3.length-1-1){ |
| | | data1.type3.condition.push(inputs3[i+1].value); |
| | | } |
| | | } |
| | | |
| | | var inputs4 = document.querySelectorAll('#input4'); |
| | | for (let i = 0; i < inputs4.length-1; i++) { |
| | | data1.type4.condition.push(inputs4[i].value); |
| | | if (Number(inputs4[i].value)>Number(inputs4[i+1].value)){ |
| | | return Feng.error("深度玩家等级满足条件值设置错误!错误在等级"+(i+1)+"和等级"+(i+1+1)); |
| | | } |
| | | if (i === inputs4.length-1-1){ |
| | | data1.type4.condition.push(inputs4[i+1].value); |
| | | } |
| | | } |
| | | |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tHonor/edit", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | data1.type1.condition= []; |
| | | data1.type2.condition= []; |
| | | data1.type3.condition= []; |
| | | data1.type4.condition= []; |
| | | Feng.success("修改成功!"); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | data1.type1.condition= []; |
| | | data1.type2.condition= []; |
| | | data1.type3.condition= []; |
| | | data1.type4.condition= []; |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | $(function () { |
| | | // 获取表格的 DOM 元素 |
| | | var tableContainer1 = document.getElementById('table1'); |
| | | var tableContainer2 = document.getElementById('table2'); |
| | | var tableContainer3 = document.getElementById('table3'); |
| | | var tableContainer4 = document.getElementById('table4'); |
| | | |
| | | // 初始化四个表格 |
| | | var table1 = createTable(['等级', '上课打卡次数'], tableContainer1); |
| | | var table2 = createTable(['等级', '赛事报名次数'], tableContainer2); |
| | | var table3 = createTable(['等级', '预约场地次数'], tableContainer3); |
| | | var table4 = createTable(['等级', '作业、任务完成次数'], tableContainer4); |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tHonor/list", function(data){ |
| | | populateTable(table1, data[1],1); |
| | | data1.type1.type = data[1][1].type; |
| | | populateTable(table2, data[2],2); |
| | | data1.type2.type = data[2][1].type; |
| | | populateTable(table3, data[3],3); |
| | | data1.type3.type = data[3][1].type; |
| | | populateTable(table4, data[4],4); |
| | | data1.type4.type = data[4][1].type; |
| | | },function(data){ |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.start(); |
| | | |
| | | // 创建表格函数 |
| | | function createTable(headerData, container) { |
| | | var table = document.createElement('table'); |
| | | var thead = document.createElement('thead'); |
| | | var tbody = document.createElement('tbody'); |
| | | |
| | | // 创建表头行 |
| | | var headerRow = document.createElement('tr'); |
| | | for (var i = 0; i < headerData.length; i++) { |
| | | var th = document.createElement('th'); |
| | | th.textContent = headerData[i]; |
| | | headerRow.appendChild(th); |
| | | } |
| | | thead.appendChild(headerRow); |
| | | table.appendChild(thead); |
| | | table.appendChild(tbody); |
| | | container.appendChild(table); |
| | | |
| | | return tbody; |
| | | } |
| | | // 填充表格函数 |
| | | function populateTable(tbody, rowData,num) { |
| | | for (var i = 0; i < rowData.length; i++) { |
| | | var row = document.createElement('tr'); |
| | | var data1 = document.createElement('td'); |
| | | data1.textContent = rowData[i].level; |
| | | var input = document.createElement('input'); |
| | | input.value = rowData[i].condition; |
| | | // 设置id属性 用于修改时获取input输入框内的值 |
| | | input.setAttribute("id","input"+num); |
| | | row.appendChild(data1); |
| | | row.appendChild(input); |
| | | tbody.appendChild(row); |
| | | } |
| | | } |
| | | }); |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TQuestion = { |
| | | id: "TQuestionTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TQuestion.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '问题标题', field: 'content', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row, index) { |
| | | var date = new Date(value); |
| | | date.setHours(date.getHours() + 8); |
| | | return date.toLocaleString('zh-CN', { |
| | | year: 'numeric', |
| | | month: '2-digit', |
| | | day: '2-digit', |
| | | hour: '2-digit', |
| | | minute: '2-digit', |
| | | second: '2-digit', |
| | | timeZone: 'Asia/Shanghai' // 替换为您想要的时区 |
| | | }); |
| | | }}, |
| | | {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row, index) { |
| | | return {1: "已上架", 2: "已下架", 3: "已删除"}[value] |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TQuestion.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TQuestion.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | TQuestion.dataCount = 0; |
| | | TQuestion.phone = ""; |
| | | TQuestion.phoneId = ""; |
| | | |
| | | /** |
| | | * 点击添加 |
| | | */ |
| | | TQuestion.openAdd = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加常见问题', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tQuestion/add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 点击编辑 |
| | | */ |
| | | TQuestion.openChange = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一个问题进行编辑!"); |
| | | }else { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tQuestion/editQuestion/' + TQuestion.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 上架 |
| | | */ |
| | | |
| | | TQuestion.onShelf = function () { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | const data1 = { |
| | | questionId:[], |
| | | type:null |
| | | }; |
| | | selected.forEach(function(obj) { |
| | | var id = obj.id; |
| | | data1.questionId.push(id); |
| | | }); |
| | | data1.type = 1; |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/changeState", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("上架成功!"); |
| | | window.parent.TQuestion.table.refresh(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 下架 |
| | | */ |
| | | TQuestion.offShelf = function () { |
| | | |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | const data1 = { |
| | | questionId:[], |
| | | type:null |
| | | }; |
| | | selected.forEach(function(obj) { |
| | | var id = obj.id; |
| | | data1.questionId.push(id); |
| | | }); |
| | | data1.type = 2; |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/changeState", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("下架成功!"); |
| | | window.parent.TQuestion.table.refresh(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; |
| | | Feng.error("您的网络异常!"); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | /** |
| | | * 查看详情 |
| | | */ |
| | | TQuestion.getInfo = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length >1 ){ |
| | | Feng.info("只能选择一条进行查看!"); |
| | | }else { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tQuestion/infoQuestion/' + TQuestion.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | TQuestion.delete = function () { |
| | | if (this.check()){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | |
| | | const data1 = { |
| | | questionId:[], |
| | | type:null |
| | | }; |
| | | selected.forEach(function(obj) { |
| | | var id = obj.id; |
| | | data1.questionId.push(id); |
| | | }); |
| | | data1.type = 3; |
| | | |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tQuestion/changeState", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("删除成功!"); |
| | | window.parent.TQuestion.table.refresh(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "删除失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | /** |
| | | * 打开查看详情 |
| | | */ |
| | | TQuestion.openDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tQuestion/editQuestion/' + TQuestion.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TQuestion.search = function () { |
| | | var queryData = {}; |
| | | queryData['content'] = $("#content").val(); |
| | | queryData['state'] = $("#state").val(); |
| | | TQuestion.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 重置搜索 |
| | | */ |
| | | TQuestion.resetSearch = function () { |
| | | $("#content").val(''); |
| | | $("#state").val(''); |
| | | TQuestion.search(); |
| | | }; |
| | | |
| | | $(function () { |
| | | const data1 = { |
| | | id:null, |
| | | phone:null, |
| | | insertTime:null |
| | | }; |
| | | // 获取客服电话 |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tPhone/list", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | success: function(response) { |
| | | var phoneValue = null; |
| | | var split = []; |
| | | // 遍历列表数据使用 forEach() 方法 |
| | | response.forEach(function (item) { |
| | | TQuestion.phoneId = item.id; |
| | | phoneValue = item.phone; |
| | | split = phoneValue.split(","); |
| | | }); |
| | | if (response[0].phone !== "" && response[0].phone!== null) { |
| | | var dataContainer = document.getElementById('phone'); |
| | | split.forEach(function (item) { |
| | | if (item !== ''){ |
| | | // 创建新的数据项 |
| | | var dataItem = document.createElement('div'); |
| | | dataItem.className = 'data-item'; |
| | | dataItem.innerText = item; |
| | | // 创建删除按钮 |
| | | var deleteButton = document.createElement('div'); |
| | | deleteButton.className = 'delete-button'; |
| | | deleteButton.innerHTML = '×'; |
| | | // 为删除按钮添加点击事件监听器 |
| | | deleteButton.addEventListener('click', function () { |
| | | TQuestion.dataCount--; |
| | | // 在点击事件处理程序中删除数据项 |
| | | dataContainer.removeChild(dataItem); |
| | | }); |
| | | // 将删除按钮添加到数据项 |
| | | dataItem.appendChild(deleteButton); |
| | | // 将数据项添加到容器中 |
| | | dataContainer.appendChild(dataItem); |
| | | TQuestion.dataCount++; |
| | | // 获取item元素的文本内容(不包含"x") |
| | | var itemValues = Array.from(dataContainer.getElementsByClassName('data-item')).map(function (item) { |
| | | return item.innerText.replace(/[\u00D7]/g, '').trim(); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | var addButton = document.getElementById('addButton'); |
| | | addButton.addEventListener('click', function () { |
| | | var phoneRegex = /^1[0-9]{10}$/; |
| | | var inputField = document.getElementById('addPhone'); |
| | | var dataContainer = document.getElementById('phone'); |
| | | var inputData = inputField.value.trim(); |
| | | if (TQuestion.dataCount>=2){ |
| | | Feng.info("最多添加两个客服电话!"); |
| | | // todo 添加正则表达式验证电话号码合法性 |
| | | }else if(!phoneRegex.test(inputData)){ |
| | | Feng.info("客服电话不合法,请重新输入!"); |
| | | }else { |
| | | if (inputData !== '' || document.querySelectorAll('.data-item').length !==0) { |
| | | TQuestion.phone = ""; |
| | | // 创建新的数据项 |
| | | var dataItem = document.createElement('div'); |
| | | if (inputData !== ''){ |
| | | dataItem.className = 'data-item'; |
| | | dataItem.innerText = inputData; |
| | | // 创建删除按钮 |
| | | var deleteButton = document.createElement('div'); |
| | | deleteButton.className = 'delete-button'; |
| | | deleteButton.innerHTML = '×'; |
| | | // 为删除按钮添加点击事件监听器 |
| | | deleteButton.addEventListener('click', function () { |
| | | TQuestion.dataCount--; |
| | | // 在点击事件处理程序中删除数据项 |
| | | dataContainer.removeChild(dataItem); |
| | | }); |
| | | // 将删除按钮添加到数据项 |
| | | dataItem.appendChild(deleteButton); |
| | | // 将数据项添加到容器中 |
| | | dataContainer.appendChild(dataItem); |
| | | // 清空输入框的内容 |
| | | inputField.value = ''; |
| | | TQuestion.dataCount++; |
| | | } |
| | | var dataItems = document.querySelectorAll('.data-item'); |
| | | for(var i = 0; i < dataItems.length; i++) { |
| | | var dataItem1 = dataItems[i]; |
| | | TQuestion.phone = TQuestion.phone+dataItem1.textContent.slice(0, -1)+","; |
| | | } |
| | | data1.phone = TQuestion.phone; |
| | | data1.id = TQuestion.phoneId; |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tPhone/update", |
| | | type: "POST", |
| | | contentType: "application/json", // 设置请求头的 Content-Type |
| | | data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 |
| | | success: function(response) { |
| | | Feng.success("添加成功!"); |
| | | // window.parent.TQuestion.table.refresh(); |
| | | TQuestion.phone = ""; |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | TQuestion.phone = ""; |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "添加失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | } else { |
| | | Feng.info("请输入客服电话!"); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | // window.parent.TQuestion.table.refresh(); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMessage = xhr.responseText ? xhr.responseText : "删除失败!"; |
| | | Feng.error(errorMessage); |
| | | } |
| | | }); |
| | | var defaultColunms = TQuestion.initColumn(); |
| | | var table = new BSTable(TQuestion.id, "/tQuestion/list", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TQuestion.table = table.init(); |
| | | }); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.FrequentlyAskedQuestions; |
| | | import com.dsh.other.model.vo.questionVo.QuestionChangeStateVO; |
| | | import com.dsh.other.model.vo.questionVo.QuestionDetailsVo; |
| | | import com.dsh.other.model.vo.questionVo.QuestionIns; |
| | | import com.dsh.other.model.vo.questionVo.QuestionSearchVO; |
| | | import com.dsh.other.service.FrequentlyAskedQuestionsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | /** |
| | | * 添加常见问题 |
| | | */ |
| | | @RequestMapping("/base/question/addQuestion") |
| | | public Object addQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ |
| | | frequentlyAskedQuestions.setInsertTime(new Date()); |
| | | frequentlyAskedQuestions.setState(1); |
| | | return faqService.save(frequentlyAskedQuestions); |
| | | } |
| | | /** |
| | | * 修改常见问题 |
| | | */ |
| | | @RequestMapping("/base/question/editQuestion") |
| | | public Object editQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ |
| | | return faqService.updateById(frequentlyAskedQuestions); |
| | | } |
| | | /** |
| | | * 上/下架、删除常见问题 type=1为上架 2为下架 3为删除 |
| | | */ |
| | | @RequestMapping("/base/question/changeState") |
| | | public Object changeState(@RequestBody QuestionChangeStateVO vo){ |
| | | return faqService.changeState(vo); |
| | | } |
| | | |
| | | /** |
| | | * 查看详情 |
| | | */ |
| | | @RequestMapping("/base/question/getInfo") |
| | | public FrequentlyAskedQuestions getInfo(@RequestBody Integer id){ |
| | | return faqService.getInfo(id); |
| | | } |
| | | |
| | | /** |
| | | * 编辑常见问题 |
| | | */ |
| | | @RequestMapping("/base/question/updateQuestion") |
| | | public Object updateQuestion(@RequestBody FrequentlyAskedQuestions frequentlyAskedQuestions){ |
| | | return faqService.updateById(frequentlyAskedQuestions); |
| | | } |
| | | /** |
| | | * 获取所有常见问题 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/question/listAll") |
| | | public List<FrequentlyAskedQuestions> listAll(@RequestBody QuestionSearchVO vo){ |
| | | QueryWrapper<FrequentlyAskedQuestions> frequentlyAskedQuestionsQueryWrapper = new QueryWrapper<>(); |
| | | if (vo.getState()!=null){ |
| | | frequentlyAskedQuestionsQueryWrapper.eq("state",vo.getState()); |
| | | } |
| | | if (vo.getContent()!=null && !vo.getContent().equals("") ){ |
| | | frequentlyAskedQuestionsQueryWrapper.like("content",vo.getContent()); |
| | | } |
| | | frequentlyAskedQuestionsQueryWrapper.ne("state",3); |
| | | frequentlyAskedQuestionsQueryWrapper.orderByDesc("sort"); |
| | | List<FrequentlyAskedQuestions> list = faqService.list(frequentlyAskedQuestionsQueryWrapper); |
| | | return list; |
| | | } |
| | | |
| | | @PostMapping("/base/notice/queryQuestionDetails") |
| | | public List<QuestionIns> getSysQuestionDetails(){ |
| | |
| | | package com.dsh.other.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.other.entity.HonorRules; |
| | | import com.dsh.other.feignclient.model.StuMedalVo; |
| | | import com.dsh.other.model.vo.honorVo.EditHonorVO; |
| | | import com.dsh.other.service.HonorRulesService; |
| | | import com.dsh.other.util.ResultUtil; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("") |
| | |
| | | @Autowired |
| | | private HonorRulesService hrService; |
| | | |
| | | /** |
| | | * 获取 荣誉规则列表 |
| | | */ |
| | | @RequestMapping(value = "/base/honor/list") |
| | | public Map<Integer, List<HonorRules>> getList() { |
| | | List<HonorRules> list= hrService.getList(); |
| | | return list.stream().collect(Collectors.groupingBy(HonorRules::getType)); |
| | | } |
| | | |
| | | /** |
| | | * 修改荣誉规则 并返回新的荣誉规则列表 |
| | | */ |
| | | @RequestMapping(value = "/base/honor/edit") |
| | | @ResponseBody |
| | | public Object edit(@RequestBody EditHonorVO vo) { |
| | | Integer type1 = vo.getType1().getType(); |
| | | List<String> condition1 = vo.getType1().getCondition(); |
| | | QueryWrapper<HonorRules> wrapper1 = new QueryWrapper<>(); |
| | | wrapper1.eq("type",type1); |
| | | List<HonorRules> list1 = hrService.list(wrapper1); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list1.get(i).setCondition(condition1.get(i)); |
| | | } |
| | | hrService.updateBatchById(list1); |
| | | |
| | | Integer type2 = vo.getType2().getType(); |
| | | List<String> condition2 = vo.getType2().getCondition(); |
| | | QueryWrapper<HonorRules> wrapper2 = new QueryWrapper<>(); |
| | | wrapper2.eq("type",type2); |
| | | List<HonorRules> list2 = hrService.list(wrapper2); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list2.get(i).setCondition(condition2.get(i)); |
| | | } |
| | | hrService.updateBatchById(list2); |
| | | |
| | | Integer type3 = vo.getType3().getType(); |
| | | List<String> condition3 = vo.getType3().getCondition(); |
| | | QueryWrapper<HonorRules> wrapper3 = new QueryWrapper<>(); |
| | | wrapper3.eq("type",type3); |
| | | List<HonorRules> list3 = hrService.list(wrapper3); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list3.get(i).setCondition(condition3.get(i)); |
| | | } |
| | | hrService.updateBatchById(list3); |
| | | |
| | | Integer type4 = vo.getType4().getType(); |
| | | List<String> condition4 = vo.getType4().getCondition(); |
| | | QueryWrapper<HonorRules> wrapper4 = new QueryWrapper<>(); |
| | | wrapper4.eq("type",type4); |
| | | List<HonorRules> list4 = hrService.list(wrapper4); |
| | | for (int i = 0; i < list1.size(); i++) { |
| | | list4.get(i).setCondition(condition4.get(i)); |
| | | } |
| | | hrService.updateBatchById(list4); |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @PostMapping("/base/honor/stuHonors") |
| | | public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds){ |
New file |
| | |
| | | package com.dsh.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.Phone; |
| | | import com.dsh.other.model.vo.questionVo.UpdatePhoneVO; |
| | | import com.dsh.other.service.PhoneService; |
| | | import com.dsh.other.util.ResultUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 客服电话 控制器 |
| | | */ |
| | | |
| | | @Controller |
| | | @RequestMapping("") |
| | | public class TPhoneController { |
| | | |
| | | @Resource |
| | | private PhoneService phoneService; |
| | | |
| | | @RequestMapping(value = "/base/phone/list") |
| | | @ResponseBody |
| | | public List<Phone> list(){ |
| | | return phoneService.list(new QueryWrapper<>()); |
| | | } |
| | | /** |
| | | * 修改客服电话 |
| | | */ |
| | | @RequestMapping("/update") |
| | | @ResponseBody |
| | | public Object update(@RequestBody Phone phone){ |
| | | String phone1 = phone.getPhone(); |
| | | String substring = phone1.substring(0, phone1.length() - 1); |
| | | phone.setPhone(substring); |
| | | phone.setInsertTime(new Date()); |
| | | phoneService.updateById(phone); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | * 添加时间 |
| | | */ |
| | | @TableField("insertTime") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date insertTime; |
| | | /** |
| | | * 答复内容 |
| | |
| | | /** |
| | | * 满足条件值 |
| | | */ |
| | | @TableField("condition") |
| | | private String condition; |
| | | |
| | | @TableField(value = "`condition`") |
| | | private String condition; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.other.entity.FrequentlyAskedQuestions; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2023-07-03 |
| | | */ |
| | | public interface FrequentlyAskedQuestionsMapper extends BaseMapper<FrequentlyAskedQuestions> { |
| | | int changeState(@Param("questionIds") List<Integer> questionIds, @Param("type")Integer type); |
| | | |
| | | FrequentlyAskedQuestions getInfo(Integer id); |
| | | } |
| | |
| | | |
| | | List<HonorRules> querylistOfIds(@Param("honorIds") List<Integer> honorIds); |
| | | |
| | | |
| | | List<HonorRules> getList(); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.other.model.vo.honorVo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 荣誉规则修改对象 |
| | | */ |
| | | @Data |
| | | public class EditHonorVO { |
| | | private data type1; |
| | | private data type2; |
| | | private data type3; |
| | | private data type4; |
| | | |
| | | |
| | | public static class data { |
| | | private Integer id; |
| | | private Integer type; |
| | | private List<String> condition; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public List<String> getCondition() { |
| | | return condition; |
| | | } |
| | | |
| | | public void setCondition(List<String> condition) { |
| | | this.condition = condition; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.other.model.vo.questionVo; |
| | | |
| | | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionChangeStateVO { |
| | | /** |
| | | * 常见问题Id |
| | | */ |
| | | List<Integer> questionId; |
| | | /** |
| | | * 上/下架 删除常见问题 type=1 上架 2下架 3删除 |
| | | */ |
| | | Integer type; |
| | | } |
New file |
| | |
| | | package com.dsh.other.model.vo.questionVo; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionSearchVO { |
| | | /** |
| | | * 常见问题 |
| | | */ |
| | | String content; |
| | | /** |
| | | * 上/下架 删除常见问题 type=1 上架 2下架 3删除 |
| | | */ |
| | | Integer state; |
| | | } |
New file |
| | |
| | | package com.dsh.other.model.vo.questionVo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UpdatePhoneVO { |
| | | private Integer id; |
| | | private String phone; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.other.entity.FrequentlyAskedQuestions; |
| | | import com.dsh.other.model.vo.questionVo.QuestionChangeStateVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface FrequentlyAskedQuestionsService extends IService<FrequentlyAskedQuestions> { |
| | | |
| | | int changeState(QuestionChangeStateVO vo); |
| | | |
| | | FrequentlyAskedQuestions getInfo(Integer id); |
| | | } |
| | |
| | | |
| | | List<HonorRules> querylistOfIds(List<Integer> honorIds); |
| | | |
| | | List<HonorRules> getList(); |
| | | |
| | | List<HonorRules> selectByType(Integer type1); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.other.entity.FrequentlyAskedQuestions; |
| | | import com.dsh.other.mapper.FrequentlyAskedQuestionsMapper; |
| | | import com.dsh.other.model.vo.questionVo.QuestionChangeStateVO; |
| | | import com.dsh.other.service.FrequentlyAskedQuestionsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class FrequentlyAskedQuestionsServiceImpl extends ServiceImpl<FrequentlyAskedQuestionsMapper, FrequentlyAskedQuestions> implements FrequentlyAskedQuestionsService { |
| | | |
| | | @Resource |
| | | private FrequentlyAskedQuestionsMapper frequentlyAskedQuestionsMapper; |
| | | @Override |
| | | public int changeState(QuestionChangeStateVO vo) { |
| | | List<Integer> questionIds = vo.getQuestionId(); |
| | | |
| | | Integer type = vo.getType(); |
| | | return frequentlyAskedQuestionsMapper.changeState(questionIds,type); |
| | | } |
| | | |
| | | @Override |
| | | public FrequentlyAskedQuestions getInfo(Integer id) { |
| | | |
| | | return frequentlyAskedQuestionsMapper.getInfo(id); |
| | | } |
| | | } |
| | |
| | | package com.dsh.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.other.entity.HonorRules; |
| | | import com.dsh.other.mapper.HonorRulesMapper; |
| | |
| | | public List<HonorRules> querylistOfIds(List<Integer> honorIds) { |
| | | return this.baseMapper.querylistOfIds(honorIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<HonorRules> getList() { |
| | | return this.baseMapper.getList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<HonorRules> selectByType(Integer type1) { |
| | | QueryWrapper<HonorRules> wrapper = new QueryWrapper<>(); |
| | | |
| | | return this.baseMapper.selectList(wrapper.eq("type",type1)); |
| | | } |
| | | } |
| | |
| | | <mapper namespace="com.dsh.other.mapper.FrequentlyAskedQuestionsMapper"> |
| | | |
| | | |
| | | <update id="changeState"> |
| | | update t_frequently_asked_questions set |
| | | state = #{type} |
| | | <where> |
| | | <if test="questionIds != null and questionIds.size()>0"> |
| | | AND t_frequently_asked_questions.id IN |
| | | <foreach collection="questionIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </update> |
| | | <select id="getInfo" resultType="com.dsh.other.entity.FrequentlyAskedQuestions"> |
| | | select * from t_frequently_asked_questions where id = #{id} |
| | | </select> |
| | | </mapper> |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="getList" resultType="com.dsh.other.entity.HonorRules"> |
| | | select * from t_honor_rules |
| | | </select> |
| | | |
| | | </mapper> |