From 1a929c5d1f6e76fe93221d1e1c28227e9e3584c7 Mon Sep 17 00:00:00 2001 From: liujie <liujie> Date: 星期三, 26 七月 2023 09:45:13 +0800 Subject: [PATCH] 后台代码 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java | 228 ++++----------------------------------------------------- 1 files changed, 16 insertions(+), 212 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java index 10b8110..b7cb005 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java @@ -1,249 +1,53 @@ package com.dsh.guns.modular.system.controller.code; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.dsh.course.feignClient.course.CourseClient; -import com.dsh.guns.config.UserExt; import com.dsh.guns.core.base.controller.BaseController; -import com.dsh.guns.core.common.constant.factory.PageFactory; -import com.dsh.guns.core.util.SinataUtil; -import com.dsh.guns.modular.system.util.DateUtil; -import com.dsh.guns.modular.system.util.ExcelExportUtil; -import com.dsh.guns.modular.system.util.ResultUtil; -import org.apache.commons.lang.time.DateUtils; +import com.dsh.guns.modular.system.client.competition.CompetitionClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; /** - * 车辆管理控制器 + * 菜单控制器 * * @author fengshuonan - * @Date 2020-06-05 17:25:12 + * @Date 2017年2月12日21:59:14 */ @Controller -@RequestMapping("/TCompetition") +@RequestMapping("/tCompetition") public class TCompetitionController extends BaseController { - private String PREFIX = "/system/TCompetition/"; + private static String PREFIX = "/system/tCompetition/"; @Autowired - private CourseClient courseClient; + private CompetitionClient competitionClient; /** - * 跳转到车辆管理首页 + * 跳转到菜单列表列表页面 */ @RequestMapping("") public String index(Model model) { - return PREFIX + "TCompetition.html"; + return PREFIX + "tCompetition.html"; } /** - * 跳转到添加车辆管理 + * 跳转到菜单列表列表页面 */ - @RequestMapping("/tCompetition_add") + @RequestMapping(value = "/tCompetition_add") public String tCompetitionAdd(Model model) { return PREFIX + "tCompetition_add.html"; } - /** - * 跳转到修改车辆管理 + * 跳转到菜单详情列表页面 */ - @RequestMapping("/tCompetition_update/{id}") - public String tCarUpdate(@PathVariable Integer id, Model model) { - return PREFIX + "tCompetition_edit.html"; + @RequestMapping(value = "/tCompetition_edit/{id}") + public String menuEdit(@PathVariable Integer id, Model model) { + return PREFIX + "menu_edit.html"; } - - - /** - * 获取车辆管理列表 - */ - @RequestMapping(value = "/list") - @ResponseBody - public Object list(String createTime, - String id, - String brandName, - String modelName, - String carColor, - String serverStr, - String carLicensePlate, - String driverName, - String companyName, - String franchiseeName) { - String beginTime = null; - String endTime = null; - if (SinataUtil.isNotEmpty(createTime)){ - String[] timeArray = createTime.split(" - "); - beginTime = timeArray[0]; - endTime = timeArray[1]; - } - Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); - return super.packForBT(page); - } - - /** - * 新增车辆管理 - */ - @RequestMapping(value = "/add") - @ResponseBody - public Object add( ) { - return ResultUtil.success(); - } - - /** - * 删除车辆管理 - */ - @RequestMapping(value = "/delete") - @ResponseBody - public Object delete(@RequestParam Integer tCarId) { - return SUCCESS_TIP; - } - - /** - * 修改车辆管理 - */ - @RequestMapping(value = "/update") - @ResponseBody - public Object update() { - return ResultUtil.success(); - } - - /** - * 车辆管理详情 - */ - @RequestMapping(value = "/detail/{tCarId}") - @ResponseBody - public Object detail(@PathVariable("tCarId") Integer tCarId) { - return null; - } - - /** - * 下载模板 - * @param request - * @param response - */ - @RequestMapping(value = "/uploadCarModel") - public void uploadCarModel(HttpServletRequest request, HttpServletResponse response) { - // 表格数据【封装】 Table datas - List<List<String>> dataList = new ArrayList<List<String>>(); - Integer language = UserExt.getLanguage(); - if(language==1){ - // 首行【封装】 first line - List<String> shellList = new ArrayList<String>(); - shellList.add("所属机构[平台车辆/加盟车辆]"); - shellList.add("所属分公司[提示:加盟车辆选填]"); - shellList.add("所属加盟商[提示:加盟车辆选填]"); - shellList.add("服务模式:摩托车车[是/否]"); - shellList.add("服务模式:同城快送[是/否]"); - shellList.add("车辆品牌"); - shellList.add("车辆类型"); - shellList.add("车辆颜色[1(黑色)/2(银色)/3(白色)/4(红色)/5(黄色)/6(橙色)/7(蓝色)]"); - shellList.add("车牌号"); - shellList.add("行驶证编号"); - shellList.add("年检到期时间[例如 2020-02-02]"); - shellList.add("商业保险到期时间[例如 2020-02-02]"); - dataList.add(shellList); - - try { - // 调用工具类进行导出 Invoke the utility class to carry out data export. - ExcelExportUtil.easySheet("平台导入车辆模板"+DateUtil.format(new Date(), "YYYYMMddHHmmss"), "平台导入车辆模板", dataList, request, response); - } catch (Exception e) { - e.printStackTrace(); - } - }else if(language==2){ - // 首行【封装】 first line - List<String> shellList = new ArrayList<String>(); - shellList.add("Affiliated Organization [Platform Vehicle/Franchised Vehicle]"); - shellList.add("Affiliated branch [Tip: Select for franchised vehicle]"); - shellList.add("Franchisee [Tip: Select Franchised vehicle]"); - shellList.add("Service mode: Motorcycle [Yes/No]"); - shellList.add("Service mode: intra-city express [Yes/No]"); - shellList.add("Vehicle brand"); - shellList.add("Vehicle type"); - shellList.add("Vehicle color [1(Black)/2(Silver)/3(white)/4(red)/5(yellow)/6(orange)/7(Blue)]"); - shellList.add("License plate number"); - shellList.add("License number"); - shellList.add("Annual inspection expiration time [e.g. 2020-02-02]"); - shellList.add("Commercial Insurance Expiration Time [e.g. 2020-02-02]"); - dataList.add(shellList); - - try { - // 调用工具类进行导出 Invoke the utility class to carry out data export. - ExcelExportUtil.easySheet("Platform import vehicle template"+DateUtil.format(new Date(), "YYYYMMddHHmmss"), "Platform import vehicle template", dataList, request, response); - } catch (Exception e) { - e.printStackTrace(); - } - }else { - // 首行【封装】 first line - List<String> shellList = new ArrayList<String>(); - shellList.add("Organisasi Berkait [Platform Vehicle/Franchised Vehicle]"); - shellList.add("Branch terkait [Tip: Pilih untuk kendaraan terkait]"); - shellList.add("Franchisee [Tip: Pilih kendaraan Franchised]"); - shellList.add("Mod layanan: Motosikal [Ya/Tidak]"); - shellList.add("Modus layanan: ekspres intra-kota [Ya/Tidak]"); - shellList.add("Tanda kendaraan"); - shellList.add("Jenis kendaraan"); - shellList.add("Warna kendaraan [1(Hitam)/2(Perak)/3(putih)/4(merah)/5(kuning)/6(oranye)/7(Biru)]"); - shellList.add("Nomor plat lisensi"); - shellList.add("Nomor lisensi"); - shellList.add("Waktu penggantian inspeksi tahunan [contohnya 2020-02-02]"); - shellList.add("Waktu Expiration Insurance Commercial [contohnya 2020-02-02]"); - dataList.add(shellList); - - try { - // 调用工具类进行导出 Invoke the utility class to carry out data export. - ExcelExportUtil.easySheet("templat kendaraan import platform"+DateUtil.format(new Date(), "YYYYMMddHHmmss"), "templat kendaraan import platform", dataList, request, response); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - } - - - /** - * 判断日期是否满足yyyy-MM-dd格式 - * @param str - * @return - */ - public static boolean isValidDate(String str) { - boolean convertSuccess=true; - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - try { - format.setLenient(false); - format.parse(str); - } catch (Exception e) { - convertSuccess=false; - } - return convertSuccess; - } - - - /** - * 转换日期 - * @return - */ - public static String importByExcelForDate(String value) {//value就是它的天数 - String currentCellValue = ""; - if(value != null && !value.equals("")){ - Calendar calendar = new GregorianCalendar(1900,0,-1); - Date d = calendar.getTime(); - Date dd = DateUtils.addDays(d,Integer.valueOf(value)); - DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); - currentCellValue = formater.format(dd); - } - return currentCellValue; - } } -- Gitblit v1.7.1