From 1a0c0fc8b02415e919e17c0b6ffbf99d08dec8f5 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 07 四月 2023 17:40:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THtmlController.java | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 237 insertions(+), 0 deletions(-) diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THtmlController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THtmlController.java new file mode 100644 index 0000000..9f27ad3 --- /dev/null +++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/THtmlController.java @@ -0,0 +1,237 @@ +package com.stylefeng.guns.modular.system.controller.general; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.stylefeng.guns.core.base.controller.BaseController; +import com.stylefeng.guns.modular.system.controller.util.LabelReplaceUtil; +import com.stylefeng.guns.modular.system.enums.HtmlTypeEnum; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.beans.factory.annotation.Autowired; +import com.stylefeng.guns.core.log.LogObjectHolder; +import org.springframework.web.bind.annotation.RequestParam; +import com.stylefeng.guns.modular.system.model.THtml; +import com.stylefeng.guns.modular.system.service.ITHtmlService; + +import java.util.Objects; + +/** + * 控制器 + * + * @author fengshuonan + * @Date 2023-03-24 10:50:08 + */ +@Controller +@RequestMapping("/tHtml") +public class THtmlController extends BaseController { + + private String PREFIX = "/system/tHtml/"; + + @Autowired + private ITHtmlService tHtmlService; + + /** + * 跳转到首页 + */ + @RequestMapping("") + public String index() { + return PREFIX + "tHtml.html"; + } + + /** + * 跳转到添加 + */ + @RequestMapping("/tHtml_add") + public String tHtmlAdd() { + return PREFIX + "tHtml_add.html"; + } + + /** + * 跳转到修改 + */ + @RequestMapping("/tHtml_update/{tHtmlId}") + public String tHtmlUpdate(@PathVariable Integer tHtmlId, Model model) { + THtml tHtml = tHtmlService.selectById(tHtmlId); + model.addAttribute("item",tHtml); + LogObjectHolder.me().set(tHtml); + return PREFIX + "tHtml_edit.html"; + } + + /** + * 跳转到积分说明 + */ + @RequestMapping("/integralExplain") + public String integralExplain(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.INTEGRAL_EXPLAIN.getCode()); + model.addAttribute("html",html); + return PREFIX + "integralExplain.html"; + } + + /** + * 跳转到佣金规则说明 + */ + @RequestMapping("/commissionRuleExplain") + public String commissionRuleExplain(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.COMMISSION_RULE_EXPLAIN.getCode()); + model.addAttribute("html",html); + return PREFIX + "commissionRuleExplain.html"; + } + + /** + * 跳转到行程录音说明 + */ + @RequestMapping("/tripRecordingExplain") + public String tripRecordingExplain(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.TRIP_RECORDING_EXPLAIN.getCode()); + model.addAttribute("html",html); + return PREFIX + "tripRecordingExplain.html"; + } + + /** + * 跳转到预估价格说明 + */ + @RequestMapping("/estimatedPriceExplain") + public String estimatedPriceExplain(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.ESTIMATED_PRICE_EXPLAIN.getCode()); + model.addAttribute("html",html); + return PREFIX + "estimatedPriceExplain.html"; + } + + /** + * 跳转到起步价说明 + */ + @RequestMapping("/startingFareExplain") + public String startingFareExplain(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.SPECIFICATION_STARTING_PRICE.getCode()); + model.addAttribute("html",html); + return PREFIX + "estimatedPriceExplain.html"; + } + + /** + * 跳转到注销协议 + */ + @RequestMapping("/cancellationAgreement") + public String cancellationAgreement(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.CANCELLATION_AGREEMENT.getCode()); + model.addAttribute("html",html); + return PREFIX + "cancellationAgreement.html"; + } + + /** + * 跳转到关于我们 + */ + @RequestMapping("/aboutUs") + public String aboutUs(Model model) { + THtml html = queryHtmlByType(HtmlTypeEnum.ABOUT_US.getCode()); + model.addAttribute("html",html); + return PREFIX + "aboutUs.html"; + } + + /** + * 跳转到代驾服务协议与隐私政策保护,法律条款,个人信息处理规则 + */ + @RequestMapping("/agreementExplain") + public String agentDrivingServiceExplain(Integer type,Model model) { + THtml one = queryHtmlByType(HtmlTypeEnum.AGENT_DRIVING_SERVICE_EXPLAIN.getCode()); + model.addAttribute("one",one); + THtml two = queryHtmlByType(HtmlTypeEnum.CLAUSE.getCode()); + model.addAttribute("two",two); + THtml three = queryHtmlByType(HtmlTypeEnum.PERSONAL_INFORMATION_RULES.getCode()); + model.addAttribute("three",three); + return PREFIX + "agreementExplain.html"; + } + + /** + * 跳转到加盟基本要求 + */ + @RequestMapping("/requirementsJoinExplain") + public String requirementsJoinExplain(Model model) { + THtml tHtml = queryHtmlByType(HtmlTypeEnum.BASIC_REQUIREMENTS_JOINING.getCode()); + JSONObject jsonObject = JSONObject.parseObject(tHtml.getHtml()); + JSONArray rules = jsonObject.getJSONArray("rules"); + JSONArray objects = new JSONArray(); + for (int i = 0; i < rules.size(); i++) { + JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(rules.get(i))); + if(i == 0){ + jsonObject1.put("key",0); + }else { + jsonObject1.put("key",1); + } + objects.add(jsonObject1); + } + model.addAttribute("array",objects); + model.addAttribute("id",tHtml.getId()); + return PREFIX + "requirementsJoinExplain.html"; + } + + /** + * 跳转到代驾服务协议与隐私政策保护,法律条款,个人信息处理规则 + */ + @RequestMapping("/agreement") + @ResponseBody + public Object agreement(Integer type) { + return queryHtmlByType(type); + } + + /** + * 获取列表 + */ + @RequestMapping(value = "/list") + @ResponseBody + public Object list(String condition) { + return tHtmlService.selectList(null); + } + + /** + * 通过类型查询配置 + */ + @RequestMapping(value = "/queryHtmlByType") + @ResponseBody + public THtml queryHtmlByType(Integer type) { + return tHtmlService.selectOne(new EntityWrapper<THtml>().eq("type", type).last("LIMIT 1")); + } + + /** + * 新增 + */ + @RequestMapping(value = "/add") + @ResponseBody + public Object add(THtml tHtml) { + tHtmlService.insert(tHtml); + return SUCCESS_TIP; + } + + /** + * 删除 + */ + @RequestMapping(value = "/delete") + @ResponseBody + public Object delete(@RequestParam Integer tHtmlId) { + tHtmlService.deleteById(tHtmlId); + return SUCCESS_TIP; + } + + /** + * 修改 + */ + @RequestMapping(value = "/update") + @ResponseBody + public Object update(THtml tHtml) { + tHtml.setHtml(LabelReplaceUtil.replace(tHtml.getHtml())); + tHtmlService.updateById(tHtml); + return SUCCESS_TIP; + } + + /** + * 详情 + */ + @RequestMapping(value = "/detail/{tHtmlId}") + @ResponseBody + public Object detail(@PathVariable("tHtmlId") Integer tHtmlId) { + return tHtmlService.selectById(tHtmlId); + } +} -- Gitblit v1.7.1