From 57a7c48cc4c81f7e9719c414e4abae942c93a21b Mon Sep 17 00:00:00 2001 From: liujie <liujie> Date: 星期三, 26 七月 2023 15:13:37 +0800 Subject: [PATCH] 后台代码 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCompetitionController.java | 229 ++++++++++----------------------------------------------- 1 files changed, 41 insertions(+), 188 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..8d7026f 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,25 +1,25 @@ 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.course.CourseClient; -import com.dsh.guns.config.UserExt; +import com.dsh.course.feignClient.competition.CompetitionClient; +import com.dsh.course.feignClient.competition.model.Competition; +import com.dsh.course.feignClient.competition.model.ListQuery; import com.dsh.guns.core.base.controller.BaseController; +import com.dsh.guns.core.base.tips.SuccessTip; 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.core.support.HttpKit; +import com.dsh.guns.core.util.ToolUtil; +import com.dsh.guns.modular.system.model.TStore; +import com.dsh.guns.modular.system.service.IStoreService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.*; +import java.util.stream.Collectors; /** * 车辆管理控制器 @@ -28,13 +28,16 @@ * @Date 2020-06-05 17:25:12 */ @Controller -@RequestMapping("/TCompetition") +@RequestMapping("/tCompetition") public class TCompetitionController extends BaseController { - private String PREFIX = "/system/TCompetition/"; + private String PREFIX = "/system/tCompetition/"; @Autowired - private CourseClient courseClient; + private CompetitionClient competitionClient; + + @Autowired + private IStoreService storeService; /** @@ -50,7 +53,7 @@ */ @RequestMapping("/tCompetition_add") public String tCompetitionAdd(Model model) { - return PREFIX + "tCompetition_add.html"; + return PREFIX + "TCompetition_add.html"; } @@ -59,191 +62,41 @@ */ @RequestMapping("/tCompetition_update/{id}") public String tCarUpdate(@PathVariable Integer id, Model model) { + Competition competition = competitionClient.queryById(id); + model.addAttribute("item",competition); return PREFIX + "tCompetition_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(); - } + public Object list(String provinceCode, String cityCode, String shopName, String eventName, String time, Integer state, Integer registerCondition) { + List<Integer> ids = new ArrayList<>(); + List<TStore> list = null; + // 获取门店id + if(ToolUtil.isNotEmpty(shopName)){ + list = storeService.list(new LambdaQueryWrapper<TStore>().like(TStore::getName, shopName)); + ids = list.stream().map(TStore::getId).collect(Collectors.toList()); }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(); + list = storeService.list(); + ids = storeService.list().stream().map(TStore::getId).collect(Collectors.toList()); + } + if(ids.size()==0){ + ids.add(-1); + } + Page<Competition> page = new PageFactory<Competition>().defaultPage(); + ListQuery listQuery = new ListQuery(page.getSize(),page.getCurrent(),provinceCode,cityCode,eventName,time,state,registerCondition,ids); + Page<Competition> competitions = competitionClient.list(listQuery); + for (Competition competition : competitions.getRecords()) { + for (TStore tStore : list) { + if(competition.getStoreId().equals(tStore.getId())){ + competition.setStoreName(tStore.getName()); + } } } - + return super.packForBT(competitions); } - - /** - * 判断日期是否满足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