package com.zcloud.controller.freighttrailer; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.logs.LogAnno; import com.zcloud.service.freighttrailer.FreightTrailerService; import com.zcloud.service.scrapManage.ScrapManageService; import com.zcloud.service.system.ImgFilesService; import com.zcloud.util.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.*; /** * 企业信息管理-货运挂车 */ @Controller @RequestMapping("/freightTrailer") public class FreighttTrailerController extends BaseController { @Autowired private FreightTrailerService freightTrailerService; @Autowired private ImgFilesService imgfilesService; @Autowired private ScrapManageService scrapManageService; /** * 新增 * * @param * @throws Exception */ @RequestMapping(value = "/add") // @RequiresPermissions( value = {"question:add" , "courseware:add"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "新增") public Object add() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("FREIGHTTRAILER_ID", this.get32UUID()); //主键 pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人 pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID freightTrailerService.save(pd); map.put("pd", pd); map.put("result", errInfo); return map; } /** * 删除 * * @param * @throws Exception */ @RequestMapping(value = "/delete") // @RequiresPermissions( value = {"question:del" , "courseware:del"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "删除") public Object delete() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); if(Tools.notEmpty(pd.getString("FREIGHTTRAILER_ID"))) { PageData findPageData = freightTrailerService.findById(pd); PageData scrapAddData = new PageData(); scrapAddData.put("SCRAP_ID",this.get32UUID()); scrapAddData.put("RECORD_NUMBER", findPageData.get("NUM")); scrapAddData.put("FRAMES_NUMBER", findPageData.get("VIN")); scrapAddData.put("PLATE_NUMBER", findPageData.get("PLATE_NUMBER")); scrapAddData.put("SCRAP_VEHICLEMODEL", "货运挂车"); scrapAddData.put("VEHICLEOWNER", findPageData.get("CAR_OWNERS")); scrapAddData.put("CONTACT_NUMBER", findPageData.get("CONTACT_PHONE")); scrapAddData.put("SCRAP_DATE", DateUtil.date2Str(new Date())); scrapAddData.put("REGISTRANT", Jurisdiction.getUsername()); scrapAddData.put("CREATTIME", DateUtil.date2Str(new Date())); scrapAddData.put("OPERATTIME", DateUtil.date2Str(new Date())); scrapAddData.put("VEHICLEOWNER_NUMBER", findPageData.get("CAR_OWNERS_TEL")); scrapAddData.put("FIRSTSHOW_DATE", findPageData.get("INITIAL_REGISTRATION_DATE")); scrapAddData.put("BRAND", findPageData.get("TRAILER_BRAND")); scrapAddData.put("VEHICLE_MODEL", findPageData.get("TRAILER_MODEL")); scrapAddData.put("TRANSACTION_DATE", DateUtil.date2Str(new Date())); scrapAddData.put("CORPINFO_ID", findPageData.get("CORPINFO_ID")); scrapAddData.put("SCRAP_VEHICLE", findPageData.get("PLATE_NUMBER")); scrapAddData.put("ISDELETE", "0"); scrapManageService.save(scrapAddData); } pd.put("DELETEOR", Jurisdiction.getUSER_ID()); //删除人id pd.put("DELETEORNAME", Jurisdiction.getUsername()); //删除人 pd.put("DELETTIME", DateUtil.date2Str(new Date())); //删除时间 freightTrailerService.delete(pd); map.put("result", errInfo); //返回结果 return map; } /** * 修改 * * @param * @throws Exception */ @RequestMapping(value = "/edit") // @RequiresPermissions( value = {"question:edit" , "courseware:edit"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "修改") public Object edit() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id pd.put("OPERATORNAME", Jurisdiction.getUsername()); //修改人 pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 freightTrailerService.edit(pd); map.put("pd", pd); map.put("result", errInfo); return map; } /** * 列表 * * @param page * @throws Exception */ @RequestMapping(value = "/list") // @RequiresPermissions( value = {"question:list" , "courseware:list"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "列表") public Object list(Page page) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID page.setPd(pd); List varList = freightTrailerService.list(page); //列出Question列表 map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /** * 去修改页面获取数据 * * @param * @throws Exception */ @RequestMapping(value = "/goEdit") // @RequiresPermissions( value = {"question:edit" , "courseware:edit"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "去修改页面获取数据") public Object goEdit() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd = freightTrailerService.findById(pd); //根据ID读取 pd.put("FOREIGN_KEY", pd.getString("FREIGHTTRAILER_ID")); pd.put("TYPE",120); List trailerImgs = imgfilesService.listAll(pd);//挂车照片 pd.put("TYPE",121); List drivingLicenseImgs = imgfilesService.listAll(pd);//行驶证照片 pd.put("TYPE",122); List operCertificateImgs = imgfilesService.listAll(pd);//运营证照片 pd.put("TYPE",123); List trailerInfoImgs = imgfilesService.listAll(pd);//挂车资料图片 map.put("pd", pd); map.put("trailerImgs", trailerImgs); map.put("drivingLicenseImgs", drivingLicenseImgs); map.put("operCertificateImgs", operCertificateImgs); map.put("trailerInfoImgs", trailerInfoImgs); map.put("result", errInfo); return map; } /** * 列表 * * @param * @throws Exception */ @RequestMapping(value = "/corpList") // @RequiresPermissions( value = {"question:list" , "courseware:list"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "所属企业", instructionsOperate = "所属企业", instructionsType = "列表") public Object corpList() throws Exception { Map map = new HashMap(); String errInfo = "success"; String corpId = Jurisdiction.getCORPINFO_ID(); List list = freightTrailerService.corpList(corpId); //列出Question列表 map.put("list", list); map.put("result", errInfo); return map; } /** * 列表 * * @param * @throws Exception */ @RequestMapping(value = "/trailerList") // @RequiresPermissions( value = {"question:list" , "courseware:list"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "货运挂车", instructionsOperate = "货运挂车", instructionsType = "列表") public Object trailerList() throws Exception { Map map = new HashMap(); String errInfo = "success"; String corpId = Jurisdiction.getCORPINFO_ID(); List list = freightTrailerService.trailerList(corpId); //列出Question列表 map.put("list", list); map.put("result", errInfo); return map; } /** * 列表 * * @param * @throws Exception */ @RequestMapping(value = "/vehicleList") // @RequiresPermissions( value = {"question:list" , "courseware:list"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "基础信息管理", menuServer = "营运车辆", instructionsOperate = "营运车辆", instructionsType = "列表") public Object vehicleList() throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID()); List list = freightTrailerService.vehicleList(pd); //列出Question列表 if(pd.containsKey("ID")){ pd.put("FOREIGN_KEY", pd.getString("ID")); pd.put("TYPE",121); List drivingLicenseImgs = imgfilesService.listAll(pd);//行驶证照片 map.put("drivingLicenseImgs", drivingLicenseImgs); } map.put("list", list); map.put("result", errInfo); return map; } }