diff --git a/src/main/java/com/zcloud/controller/beidou/BeidouController.java b/src/main/java/com/zcloud/controller/beidou/BeidouController.java index 4350e08..67fabb8 100644 --- a/src/main/java/com/zcloud/controller/beidou/BeidouController.java +++ b/src/main/java/com/zcloud/controller/beidou/BeidouController.java @@ -7,12 +7,17 @@ import com.zcloud.logs.LogAnno; import com.zcloud.service.beidou.BeidouService; import com.zcloud.service.maintenance.MaintenanceService; import com.zcloud.service.system.ImgFilesService; +import com.zcloud.util.Const; import com.zcloud.util.DateUtil; import com.zcloud.util.Jurisdiction; +import com.zcloud.util.Smb; +import org.apache.commons.lang.StringUtils; 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.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; import java.util.Date; import java.util.HashMap; @@ -30,6 +35,8 @@ public class BeidouController extends BaseController { private BeidouService beidouService; @Autowired private ImgFilesService imgfilesService; + @Autowired + private Smb smb; /** * 新增 @@ -41,7 +48,7 @@ public class BeidouController extends BaseController { // @RequiresPermissions( value = {"question:add" , "courseware:add"}, logical = Logical.OR) @ResponseBody @LogAnno(menuType = "机务档案", menuServer = "北斗管理", instructionsOperate = "北斗管理", instructionsType = "新增") - public Object add() throws Exception { + public Object add(@RequestParam(value="FFILE",required=false) MultipartFile file) throws Exception { Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); @@ -52,8 +59,25 @@ public class BeidouController extends BaseController { pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间 pd.put("ISDELETE", "0"); //是否删除(0:有效 1:删除) pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业ID + pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 运输企业 pd.put("ARCHIVES_TYPE", "正常"); //档案状态 + String ffile = DateUtil.getDays(); + if (file != null && StringUtils.isNotBlank(pd.getString("CREATORNAME"))){ + String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); + if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName)) { + errInfo = "fail"; + map.put("result", errInfo); + map.put("msg", "文件格式不正确!"); + return map; + } + String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile); + pd.put("CONTRACT", Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile + "/" + fileName); + pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); + pd.put("CONFIRM_MESSAGE_TIME",DateUtil.date2Str(new Date())); + } + beidouService.save(pd); map.put("pd", pd); map.put("result", errInfo); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyOccupationalHazardsController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyOccupationalHazardsController.java index be2e47e..f94c8f0 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyOccupationalHazardsController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyOccupationalHazardsController.java @@ -60,7 +60,8 @@ public class TrafficSafetyOccupationalHazardsController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); @@ -109,7 +110,8 @@ public class TrafficSafetyOccupationalHazardsController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyResponsibilityController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyResponsibilityController.java index c691ccc..2c3ccd0 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyResponsibilityController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSafetyResponsibilityController.java @@ -59,7 +59,8 @@ public class TrafficSafetyResponsibilityController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); @@ -103,7 +104,8 @@ public class TrafficSafetyResponsibilityController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java index 4b29b3a..5fdfde0 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityCommitmentController.java @@ -59,7 +59,8 @@ public class TrafficSecurityCommitmentController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); @@ -102,7 +103,8 @@ public class TrafficSecurityCommitmentController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); diff --git a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLaborContractController.java b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLaborContractController.java index e38ce8a..f576042 100644 --- a/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLaborContractController.java +++ b/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityLaborContractController.java @@ -58,7 +58,8 @@ public class TrafficSecurityLaborContractController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName = file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); @@ -107,7 +108,8 @@ public class TrafficSecurityLaborContractController extends BaseController { map.put("msg", "文件格式不正确!"); return map; } - String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); +// String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); + String fileName =file.getOriginalFilename(); smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile); pd.put("ATTACHMENT_ROUTE", Const.FILEPATHFILE + pd.getString("OPERATINGCOMPANY") + "/" + ffile + "/" + fileName); pd.put("ATTACHMENT_NAME",pd.getString("CREATORNAME")); diff --git a/src/main/java/com/zcloud/controller/freighttrailer/FreighttTrailerController.java b/src/main/java/com/zcloud/controller/freighttrailer/FreighttTrailerController.java index f6c1a78..cddfea7 100644 --- a/src/main/java/com/zcloud/controller/freighttrailer/FreighttTrailerController.java +++ b/src/main/java/com/zcloud/controller/freighttrailer/FreighttTrailerController.java @@ -14,7 +14,9 @@ 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 org.springframework.web.servlet.ModelAndView; +import javax.servlet.http.HttpServletResponse; import java.util.*; /** @@ -154,6 +156,18 @@ public class FreighttTrailerController extends BaseController { return map; } + /** + * 下载模版 + * + * @param response + * @throws Exception + */ + @RequestMapping(value = "/downExcel") + public void downExcel(HttpServletResponse response) throws Exception { + FileDownload.fileDownload(response, PathUtil.getProjectpath() + Const.FILEPATHFILE + "truckExcelTemplate.xls", "货车挂车导入模板.xls"); + } + + /** * 列表 * @@ -214,6 +228,43 @@ public class FreighttTrailerController extends BaseController { return map; } + /**导出到excel + * @param + * @throws Exception + */ + @RequestMapping(value="/excel") +// // @RequiresPermissions("toExcel") + public ModelAndView exportExcel() throws Exception{ + ModelAndView mv = new ModelAndView(); + PageData pd = new PageData(); + pd = this.getPageData(); + String DATA_IDS = pd.getString("DATA_IDS"); + if(Tools.notEmpty(DATA_IDS)){ + String[] ArrayDATA_IDS = DATA_IDS.split(","); + pd.put("ArrayDATA_IDS",ArrayDATA_IDS); + } + pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + Map dataMap = new HashMap(); + List titles = new ArrayList(); + titles.add("所属企业"); //1 + titles.add("风险点(单元)名称"); //2 + titles.add("所属部门"); //3 + dataMap.put("titles", titles); + List varOList = freightTrailerService.listOut(pd); + List varList = new ArrayList(); + for(int i=0;i vehicleList(PageData pd); + + List listOut(PageData pd); } diff --git a/src/main/java/com/zcloud/service/freighttrailer/FreightTrailerService.java b/src/main/java/com/zcloud/service/freighttrailer/FreightTrailerService.java index be1428d..5be0879 100644 --- a/src/main/java/com/zcloud/service/freighttrailer/FreightTrailerService.java +++ b/src/main/java/com/zcloud/service/freighttrailer/FreightTrailerService.java @@ -75,5 +75,6 @@ public interface FreightTrailerService { */ public List vehicleList(PageData pd) throws Exception; + List listOut(PageData pd); } diff --git a/src/main/java/com/zcloud/service/freighttrailer/impl/FreightTrailerServiceImpl.java b/src/main/java/com/zcloud/service/freighttrailer/impl/FreightTrailerServiceImpl.java index 3d0d7bb..60bca84 100644 --- a/src/main/java/com/zcloud/service/freighttrailer/impl/FreightTrailerServiceImpl.java +++ b/src/main/java/com/zcloud/service/freighttrailer/impl/FreightTrailerServiceImpl.java @@ -103,5 +103,10 @@ public class FreightTrailerServiceImpl implements FreightTrailerService { return freightTrailerMapper.vehicleList(pd); } + @Override + public List listOut(PageData pd) { + return freightTrailerMapper.listOut(pd); + } + } diff --git a/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml b/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml index 2b33edd..d380f02 100644 --- a/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml +++ b/src/main/resources/mybatis/datasource/beidou/BeidouMapper.xml @@ -40,6 +40,9 @@ BEIDOUINFO, NOTES, NUM, + CONTRACT, + CERTIFICATE, + TRANSPORTATIONCOMPANY, ISDELETE, CREATOR, CREATORNAME, @@ -84,6 +87,9 @@ #{BEIDOUINFO}, #{NOTES}, #{NUM}, + #{CONTRACT}, + #{CERTIFICATE}, + #{TRANSPORTATIONCOMPANY}, #{ISDELETE}, #{CREATOR}, #{CREATORNAME}, @@ -182,7 +188,9 @@ f.REMINDER_DAYS, f.REMINDER_DATE, f.REMINDER_STATUS, + f.CERTIFICATE, (select t.FILEPATH from bus_imgfiles t where t.TYPE = 128 and t.FOREIGN_KEY = f.BEIDOU_ID limit 1) as BEIDOUINFO, + (select t.FILEPATH from bus_imgfiles t where t.TYPE = 129 and t.FOREIGN_KEY = f.BEIDOU_ID limit 1) as CONTRACTINFO, -- 新增合同图片路径 f.NOTES, f.ARCHIVES_TYPE, f.ISDELETE, diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyOccupationalHazardsMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyOccupationalHazardsMapper.xml index ed167ba..bc4c11c 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyOccupationalHazardsMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyOccupationalHazardsMapper.xml @@ -21,6 +21,7 @@ f.EXPIRYDATE, f.ATTACHMENT_ROUTE, f.USER_ID, + f.CONTENT, f.ISDELETE, f.DELETOR, f.DELETORNAME, @@ -43,6 +44,7 @@ EXPIRYDATE, ATTACHMENT_ROUTE, USER_ID, + CONTENT, ISDELETE, DELETOR, DELETORNAME, @@ -65,6 +67,7 @@ #{EXPIRYDATE}, #{ATTACHMENT_ROUTE}, #{USER_ID}, + #{CONTENT}, #{ISDELETE}, #{DELETOR}, #{DELETORNAME}, @@ -97,6 +100,7 @@ OPERATORNAME = #{OPERATORNAME}, OPERATTIME = #{OPERATTIME}, EXPIRYDATE = #{EXPIRYDATE}, + CONTENT = #{CONTENT}, ATTACHMENT_ROUTE=#{ATTACHMENT_ROUTE} , VALIDSTATUS = #{VALIDSTATUS} @@ -127,24 +131,25 @@ c.COMPLETIONSTATUS, c.VALIDSTATUS, c.EXPIRYDATE, + c.CONTENT, c.CREATETIME, c.OPERATTIME, c.OCCUPATIONALHAZARDS_ID from sys_user u left join bus_corp_info i on u.CORPINFO_ID = i.CORPINFO_ID - left join BUS_TRAFFIC_OCCUPATIONAL_HAZARDS c on u.USER_ID = c.USER_ID + left join BUS_TRAFFIC_OCCUPATIONAL_HAZARDS c on u.USER_ID = c.USER_ID and c.ISDELETE !='1' where u.ISDELETE = '0' and u.ISMAIN != '1' and (c.VALIDSTATUS != '2' or c.VALIDSTATUS is null) and c.OCCUPATIONALNAME like CONCAT('%',#{pd.OCCUPATIONALNAME},'%') - - and c.COMPLETIONSTATUS = #{pd.COMPLETIONSTATUS} + + and COALESCE(c.COMPLETIONSTATUS, '0') = #{pd.COMPLETIONSTATUS} - - and c.VALIDSTATUS = #{pd.VALIDSTATUS} + + and COALESCE(c.VALIDSTATUS, '0') = #{pd.VALIDSTATUS} diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyProductionMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyProductionMapper.xml index 4462090..34c2ccd 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyProductionMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSafetyProductionMapper.xml @@ -131,26 +131,8 @@ and f.VALIDSTATUS = #{pd.VALIDSTATUS} + ORDER BY f.CREATETIME DESC - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml index 98202c8..512ca30 100644 --- a/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml +++ b/src/main/resources/mybatis/datasource/comprehensive/TrafficSecurityCommitmentMapper.xml @@ -23,6 +23,7 @@ f.PRACTITIONER, f.ATTACHMENT_ROUTE, f.USER_ID, + f.CONTENT, f.ISDELETE, f.DELETOR, f.DELETORNAME, @@ -47,6 +48,7 @@ PRACTITIONER, ATTACHMENT_ROUTE, USER_ID, + CONTENT, ISDELETE, DELETOR, DELETORNAME, @@ -71,6 +73,7 @@ #{PRACTITIONER}, #{ATTACHMENT_ROUTE}, #{USER_ID}, + #{CONTENT}, #{ISDELETE}, #{DELETOR}, #{DELETORNAME}, @@ -103,6 +106,7 @@ OPERATORNAME = #{OPERATORNAME}, OPERATTIME = #{OPERATTIME}, EXPIRYDATE = #{EXPIRYDATE}, + CONTENT = #{CONTENT}, ATTACHMENT_ROUTE=#{ATTACHMENT_ROUTE} , VALIDSTATUS = #{VALIDSTATUS} @@ -123,52 +127,38 @@ - - - - - - - - - - - - - - - - select u.NAME, @@ -149,24 +134,25 @@ c.COMPLETIONSTATUS, c.VALIDSTATUS, c.EXPIRYDATE, + c.CONTENT, c.CREATETIME, c.OPERATTIME, c.LABORCONTRACT_ID from sys_user u left join bus_corp_info i on u.CORPINFO_ID = i.CORPINFO_ID - left join BUS_TRAFFIC_LABOR_CONTRACT c on u.USER_ID = c.USER_ID + left join BUS_TRAFFIC_LABOR_CONTRACT c on u.USER_ID = c.USER_ID and c.ISDELETE !='1' where u.ISDELETE = '0' and u.ISMAIN != '1' and (c.VALIDSTATUS != '2' or c.VALIDSTATUS is null) and c.CONTRACTNAME like CONCAT('%',#{pd.CONTRACTNAME},'%') - - and c.COMPLETIONSTATUS = #{pd.COMPLETIONSTATUS} + + and COALESCE(c.COMPLETIONSTATUS, '0') = #{pd.COMPLETIONSTATUS} - - and c.VALIDSTATUS = #{pd.VALIDSTATUS} + + and COALESCE(c.VALIDSTATUS, '0') = #{pd.VALIDSTATUS} diff --git a/src/main/resources/mybatis/datasource/freighttrailer/FreightTrailerMapper.xml b/src/main/resources/mybatis/datasource/freighttrailer/FreightTrailerMapper.xml index 700f454..ffdbda3 100644 --- a/src/main/resources/mybatis/datasource/freighttrailer/FreightTrailerMapper.xml +++ b/src/main/resources/mybatis/datasource/freighttrailer/FreightTrailerMapper.xml @@ -240,4 +240,16 @@ + + diff --git a/src/main/webapp/TrafficFile/uploadFiles/file/truckExcelTemplate.xls b/src/main/webapp/TrafficFile/uploadFiles/file/truckExcelTemplate.xls new file mode 100644 index 0000000..3cce609 Binary files /dev/null and b/src/main/webapp/TrafficFile/uploadFiles/file/truckExcelTemplate.xls differ