hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/entity/TBigDevice.java
@@ -1,6 +1,7 @@ package com.thhy.engineering.modules.biz.device.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.thhy.general.annotations.Excel; import lombok.Data; import lombok.Getter; import lombok.Setter; @@ -23,23 +24,36 @@ /** * 设备名称 */ @Excel(sort = 1,title = "设备名称") private String bigDeviceName; /** * 规格型号 */ @Excel(sort = 2,title = "规格型号") private String bigDeviceModel; /** * 设备型号 */ @Excel(sort = 3,title = "设备编号") private String bigNumber; /** * 设备类型 */ private String bigType; @Excel(sort = 4,title = "设备类型") private String bigTypeName; public String getBigTypeName() { if ("1".equals(bigType)){ return "特种设备"; }else if ("2".equals(bigType)){ return "一般设备"; } return ""; } /** * 安装位置 @@ -66,6 +80,7 @@ /** * 使用年限 */ @Excel(sort = 8,title = "使用年限") private String useLife; /** @@ -77,6 +92,11 @@ * 责任人 */ private String userId; /** * 责任人电话 */ private String zrrPhone; private String realName; @@ -120,4 +140,126 @@ * @mbg.generated Mon May 15 16:41:32 CST 2023 */ private static final long serialVersionUID = 1L; /** * 分公司id */ private String companyId; /** * 生产厂家 */ @Excel(sort = 5,title = "生产厂家") private String manufacturer; /** * 出厂年月 */ @JsonFormat(pattern = "yyyy-MM") @Excel(sort = 6,title = "出厂年月") private Date dateOfProduction; /** * 使用年月 */ @Excel(sort = 7,title = "使用年月") @JsonFormat(pattern = "yyyy-MM") private Date useYearMonth; /** * 外形尺寸mm(长*宽*高) */ @Excel(sort = 9,title = "外形尺寸mm(长*宽*高)") private String shapeSize; /** * 总功率kw */ @Excel(sort = 10,title = "总功率kw") private String totalPower; /** * 总重量kg */ @Excel(sort = 11,title = "总重量kg") private String totalWeight; /** * 原值(元) */ @Excel(sort = 12,title = "原值(元)") private String originalValue; /** * 年折旧率 */ @Excel(sort = 13,title = "年折旧率") private String yearDepreciationRate; /** * 已提折旧 */ @Excel(sort = 14,title = "已提折旧") private String accumulatedDepreciation; /** * 净值 */ @Excel(sort = 15,title = "净值(元)") private String netWorth; /** * 使用状况 1、良好 2、老化 */ private Integer useStatus; @Excel(sort = 16,title = "使用状况") private String useStatusName; public String getUseStatusName() { if (useStatus == 1){ return "良好"; }else if (useStatus == 2){ return "老化"; } return ""; } /** * 是否满足需要 1是 、2否 */ private Integer isNeed; @Excel(sort = 17,title = "是否满足需要") private String isNeedName; public String getIsNeedName() { if (isNeed == 1){ return "是"; }else if (isNeed == 2){ return "否"; } return ""; } /** * 设备来源 */ @Excel(sort = 18,title = "设备来源") private String deviceSource; /** * 设备配属关系 */ @Excel(sort = 19,title = "设备配属关系") private String deviceNexus; /** * 定机人 */ @Excel(sort = 20,title = "定机人") private String fixedPerson; /** * 管理员电话 */ private String adminPhone; } hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/device/service/impl/TBigDeviceServiceImpl.java
@@ -16,6 +16,8 @@ import com.thhy.engineering.modules.biz.file.service.FileService; import com.thhy.general.common.BasicResult; import com.thhy.general.config.SysUserInfo; import com.thhy.general.utils.ExcelUtils; import com.thhy.general.utils.UUIDUtils; import com.thhy.general.utils.UserInfoUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +26,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -37,6 +40,7 @@ @Resource private FileService fileService; private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); @Override @Transactional @@ -50,35 +54,40 @@ if(!StringUtil.isEmpty(bigDeviceId)){ return BasicResult.faild("11111","设备编号重复","error"); } values.put("bigDeviceId",""); values.put("bigDeviceId", UUIDUtils.create()); values.put("companyId",companyId); values.put("createUser",sysUserInfo.getUserId()); try { values.put("dateOfProduction",sdf.parse((String) values.get("dateOfProduction"))); values.put("useYearMonth",sdf.parse((String) values.get("useYearMonth"))); }catch (Exception e){} bigDeviceMapper.bigDeviceInsert(values); //大型生产设备id String bigDeviceId1 = values.get("bigDeviceId").toString(); //图片 列表 List<String> pictures = (List<String>) values.get("pictures"); if(pictures!=null && pictures.size()>0){ for (String p:pictures){ HashMap<String, Object> val = new HashMap<>(); val.put("bigDeviceId",bigDeviceId1); val.put("id",""); val.put("fileType",1); val.put("filePath",p); bigDeviceMapper.picturesInsert(val); } } //文件 List<String> files = (List<String>) values.get("files"); if(files!=null && files.size()>0){ for (String f:files){ HashMap<String, Object> val = new HashMap<>(); val.put("bigDeviceId",bigDeviceId1); val.put("id",""); val.put("fileType",2); val.put("filePath",f); bigDeviceMapper.picturesInsert(val); } } // //大型生产设备id // String bigDeviceId1 = values.get("bigDeviceId").toString(); // //图片 列表 // List<String> pictures = (List<String>) values.get("pictures"); // if(pictures!=null && pictures.size()>0){ // for (String p:pictures){ // HashMap<String, Object> val = new HashMap<>(); // val.put("bigDeviceId",bigDeviceId1); // val.put("id",""); // val.put("fileType",1); // val.put("filePath",p); // bigDeviceMapper.picturesInsert(val); // } // } // //文件 // List<String> files = (List<String>) values.get("files"); // if(files!=null && files.size()>0){ // for (String f:files){ // HashMap<String, Object> val = new HashMap<>(); // val.put("bigDeviceId",bigDeviceId1); // val.put("id",""); // val.put("fileType",2); // val.put("filePath",f); // bigDeviceMapper.picturesInsert(val); // } // } return BasicResult.success("添加成功"); } @@ -98,22 +107,6 @@ @Override public BasicResult bigDeviceInfo(String bigDeviceId) { TBigDevice tBigDevices = bigDeviceMapper.bigDeviceInfo(bigDeviceId); List<TBigPath> bigPaths = bigDeviceMapper.devicePath(bigDeviceId); bigPaths.stream().forEach(fl->{ JSONObject json = new JSONObject(); json.put("fullpath",fl.getFilePath()); BasicResult basicResult = fileService.fileinfo(json.toJSONString()); if(basicResult.isSuccess()){ JSONArray jsonArray = JSONArray.parseArray(basicResult.getData().toString()); for(Object obj : jsonArray){ JSONObject j = JSON.parseObject(obj.toString()); if(j.containsKey("name")&&"name".equals(j.getString("name"))){ fl.setFilePathName(j.getString("value")); } } } }); tBigDevices.setTBigPaths(bigPaths); return BasicResult.success(tBigDevices); } @@ -136,31 +129,35 @@ if(!StringUtil.isEmpty(bigDeviceId)&&!bigDeviceId.equals(bigDeviceId1)){ return BasicResult.faild("11111","设备编号重复","error"); } bigDeviceMapper.bigDevicePathDel(bigDeviceId1); List<String> pictures = (List<String>) values.get("pictures"); if(pictures!=null && pictures.size()>0){ for (String p:pictures){ HashMap<String, Object> val = new HashMap<>(); val.put("bigDeviceId",bigDeviceId1); val.put("id",""); val.put("fileType",1); val.put("filePath",p); bigDeviceMapper.picturesInsert(val); } } //文件 List<String> files = (List<String>) values.get("files"); if(files!=null && files.size()>0){ for (String f:files){ HashMap<String, Object> val = new HashMap<>(); val.put("bigDeviceId",bigDeviceId1); val.put("id",""); val.put("fileType",2); val.put("filePath",f); bigDeviceMapper.picturesInsert(val); } } // bigDeviceMapper.bigDevicePathDel(bigDeviceId1); // // List<String> pictures = (List<String>) values.get("pictures"); // if(pictures!=null && pictures.size()>0){ // for (String p:pictures){ // HashMap<String, Object> val = new HashMap<>(); // val.put("bigDeviceId",bigDeviceId1); // val.put("id",""); // val.put("fileType",1); // val.put("filePath",p); // bigDeviceMapper.picturesInsert(val); // } // } // //文件 // List<String> files = (List<String>) values.get("files"); // if(files!=null && files.size()>0){ // for (String f:files){ // HashMap<String, Object> val = new HashMap<>(); // val.put("bigDeviceId",bigDeviceId1); // val.put("id",""); // val.put("fileType",2); // val.put("filePath",f); // bigDeviceMapper.picturesInsert(val); // } // } try { values.put("dateOfProduction",sdf.parse((String) values.get("dateOfProduction"))); values.put("useYearMonth",sdf.parse((String) values.get("useYearMonth"))); }catch (Exception e){} bigDeviceMapper.bigDeviceUpdate(values); return BasicResult.success("修改成功"); } @@ -179,50 +176,6 @@ String companyId = sysUserInfo.getCompanyId(); values.put("companyId",companyId); List<TBigDevice> tBigDevices = bigDeviceMapper.bigDeviceList(values); List<BigDeviceExcelDto> bigDeviceExcelDtos = new ArrayList<>(); for (TBigDevice bigDevice : tBigDevices){ BigDeviceExcelDto bigDeviceExcelDto = new BigDeviceExcelDto(); bigDeviceExcelDto.setBigDeviceName(bigDevice.getBigDeviceName()); bigDeviceExcelDto.setBigDeviceModel(bigDevice.getBigDeviceModel()); bigDeviceExcelDto.setBigNumber(bigDevice.getBigNumber()); bigDeviceExcelDto.setBigTypeName(bigDevice.getBigTypeName()); bigDeviceExcelDto.setBigPosition(bigDevice.getBigPosition()); if(bigDevice.getBigState()!=null&&bigDevice.getBigState()==1){ bigDeviceExcelDto.setBigState("在线"); }else{ bigDeviceExcelDto.setBigState("离线"); } bigDeviceExcelDto.setRealName(bigDevice.getRealName()); bigDeviceExcelDto.setSupplierName(bigDevice.getSupplierName()); bigDeviceExcelDto.setKeyCabinet(bigDevice.getKeyCabinet()); bigDeviceExcelDto.setUseLife(bigDevice.getUseLife()); bigDeviceExcelDtos.add(bigDeviceExcelDto); } ExcelWriter excel = new ExcelWriter();//定义excel excel.addHeaderAlias("bigDeviceName", "设备名称"); excel.addHeaderAlias("bigDeviceModel", "规格型号"); excel.addHeaderAlias("bigNumber", "设备编号"); excel.addHeaderAlias("bigTypeName", "设备类型"); excel.addHeaderAlias("bigPosition", "安装位置"); excel.addHeaderAlias("bigState", "设备状态"); excel.addHeaderAlias("realName", "操作工人"); excel.addHeaderAlias("supplierName", "供应商"); excel.addHeaderAlias("keyCabinet", "钥匙柜编号"); excel.addHeaderAlias("useLife", "使用年限"); response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setHeader("Content-Disposition", "attachment;filename=test.xls"); OutputStream out = null; try { out = response.getOutputStream(); excel.write(bigDeviceExcelDtos); excel.flush(out, true); } catch (IOException e) { e.printStackTrace(); } finally { // 关闭writer,释放内存 excel.close(); } IoUtil.close(out); ExcelUtils.downExcel(tBigDevices,TBigDevice.class,response,"设备信息管理"); } } hd/pipe/engineeringManage/src/main/resources/mapping/TBigDeviceMapper.xml
@@ -25,6 +25,23 @@ <result column="is_use" jdbcType="INTEGER" property="isUse" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="company_id" jdbcType="VARCHAR" property="companyId" /> <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer" /> <result column="date_of_production" jdbcType="TIMESTAMP" property="dateOfProduction" /> <result column="use_year_month" jdbcType="TIMESTAMP" property="useYearMonth" /> <result column="shape_size" jdbcType="VARCHAR" property="shapeSize" /> <result column="total_power" jdbcType="VARCHAR" property="totalPower" /> <result column="total_weight" jdbcType="VARCHAR" property="totalWeight" /> <result column="original_value" jdbcType="VARCHAR" property="originalValue" /> <result column="year_depreciation_rate" jdbcType="VARCHAR" property="yearDepreciationRate" /> <result column="accumulated_depreciation" jdbcType="VARCHAR" property="accumulatedDepreciation" /> <result column="net_worth" jdbcType="VARCHAR" property="netWorth" /> <result column="use_status" jdbcType="INTEGER" property="useStatus" /> <result column="is_need" jdbcType="INTEGER" property="isNeed" /> <result column="device_source" jdbcType="VARCHAR" property="deviceSource" /> <result column="device_nexus" jdbcType="VARCHAR" property="deviceNexus" /> <result column="fixed_person" jdbcType="VARCHAR" property="fixedPerson" /> </resultMap> @@ -92,6 +109,54 @@ <if test="companyId != null"> company_id, </if> <if test="manufacturer != null"> manufacturer, </if> <if test="dateOfProduction != null"> date_of_production, </if> <if test="useYearMonth != null"> use_year_month, </if> <if test="shapeSize != null"> shape_size, </if> <if test="totalPower != null"> total_power, </if> <if test="totalWeight != null"> total_weight, </if> <if test="originalValue != null"> original_value, </if> <if test="yearDepreciationRate != null"> year_depreciation_rate, </if> <if test="accumulatedDepreciation != null"> accumulated_depreciation, </if> <if test="netWorth != null"> net_worth, </if> <if test="useStatus != null"> use_status, </if> <if test="isNeed != null"> is_need, </if> <if test="deviceSource != null"> device_source, </if> <if test="deviceNexus != null"> device_nexus, </if> <if test="fixedPerson != null"> fixed_person, </if> <if test="adminPhone != null"> admin_phone, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="bigDeviceId != null"> @@ -151,6 +216,55 @@ <if test="companyId != null"> #{companyId,jdbcType=VARCHAR}, </if> <if test="manufacturer != null"> #{manufacturer,jdbcType=VARCHAR}, </if> <if test="dateOfProduction != null"> #{dateOfProduction,jdbcType=TIMESTAMP}, </if> <if test="useYearMonth != null"> #{useYearMonth,jdbcType=TIMESTAMP}, </if> <if test="shapeSize != null"> #{shapeSize,jdbcType=VARCHAR}, </if> <if test="totalPower != null"> #{totalPower}, </if> <if test="totalWeight != null"> #{totalWeight,jdbcType=VARCHAR}, </if> <if test="originalValue != null"> #{originalValue,jdbcType=VARCHAR}, </if> <if test="yearDepreciationRate != null"> #{yearDepreciationRate,jdbcType=VARCHAR}, </if> <if test="accumulatedDepreciation != null"> #{accumulatedDepreciation,jdbcType=VARCHAR}, </if> <if test="netWorth != null"> #{netWorth,jdbcType=VARCHAR}, </if> <if test="useStatus != null"> #{useStatus,jdbcType=INTEGER}, </if> <if test="isNeed != null"> #{isNeed,jdbcType=INTEGER}, </if> <if test="deviceSource != null"> #{deviceSource,jdbcType=VARCHAR}, </if> <if test="deviceNexus != null"> #{deviceNexus,jdbcType=VARCHAR}, </if> <if test="fixedPerson != null"> #{fixedPerson,jdbcType=VARCHAR}, </if> <if test="adminPhone != null"> #{adminPhone,jdbcType=VARCHAR}, </if> </trim> </insert> <insert id="picturesInsert" > @@ -185,26 +299,52 @@ </trim> </insert> <select id="bigDeviceList" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice"> SELECT tbd.big_device_id AS bigDeviceId, tbd.big_device_Name AS bigDeviceName, tbd.big_device_model AS bigDeviceModel, tbd.big_number AS bigNumber, sd.dict_name AS bigTypeName, tbd.big_position AS bigPosition, tbd.big_state AS bigState, spu.real_name AS realName, ss.supplier_name AS supplierName, tbd.key_cabinet AS keyCabinet, tbd.use_life AS useLife FROM t_big_device tbd LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id where tbd.is_use=1 SELECT tbd.big_device_id AS bigDeviceId, tbd.big_device_Name AS bigDeviceName, tbd.big_device_model AS bigDeviceModel, tbd.big_number AS bigNumber, sd.dict_name AS bigTypeName, tbd.big_position AS bigPosition, tbd.big_state AS bigState, spu.real_name AS realName, ss.supplier_name AS supplierName, tbd.key_cabinet AS keyCabinet, tbd.use_life AS useLife, tbd.purchase_time as purchaseTime, tbd.use_life as useLife, tbd.big_type as bigType, tbd.key_cabinet as keyCabinet, tbd.big_notes AS bigNotes, tbd.safety_code AS safetyCode, tbd.is_certificate AS isCertificate, tbd.create_time AS createTime, tbd.manufacturer AS manufacturer, tbd.date_of_production AS dateOfProduction, tbd.use_year_month AS useYearMonth, tbd.shape_size AS shapeSize, tbd.total_power AS totalPower, tbd.total_weight AS totalWeight, tbd.original_value AS originalValue, tbd.year_depreciation_rate AS yearDepreciationRate, tbd.accumulated_depreciation AS accumulatedDepreciation, tbd.net_worth AS netWorth, tbd.use_status AS useStatus, tbd.is_need AS isNeed, tbd.device_source AS deviceSource, tbd.device_nexus AS deviceNexus, tbd.fixed_person AS fixedPerson FROM t_big_device tbd LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id where tbd.is_use=1 <if test="bigDeviceName!=null and bigDeviceName!='' "> and tbd.big_device_Name like concat('%',#{bigDeviceName},'%') </if> <if test="bigNumber!=null and bigNumber!='' "> and tbd.big_number like concat('%',#{bigNumber},'%') </if> <if test="supplierId!=null and supplierId!='' "> and tbd.supplier_id=#{supplierId} @@ -231,29 +371,48 @@ <select id="bigDeviceInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice"> SELECT tbd.big_device_id AS bigDeviceId, tbd.big_device_Name AS bigDeviceName, tbd.big_device_model AS bigDeviceModel, tbd.big_number AS bigNumber, sd.dict_name AS bigTypeName, tbd.big_position AS bigPosition, tbd.big_state AS bigState, spu.real_name AS realName, ss.supplier_name AS supplierName, tbd.key_cabinet AS keyCabinet, tbd.use_life AS useLife, tbd.big_type as bigType, tbd.supplier_id as supplierId, tbd.purchase_time as purchaseTime, tbd.big_notes as bigNotes, tbd.user_id as userId, tbd.safety_code as safetyCode, tbd.is_certificate as isCertificate tbd.big_device_id AS bigDeviceId, tbd.big_device_Name AS bigDeviceName, tbd.big_device_model AS bigDeviceModel, tbd.big_number AS bigNumber, sd.dict_name AS bigTypeName, tbd.big_position AS bigPosition, tbd.big_state AS bigState, spu.real_name AS realName, spu.phone AS zrrPhone, ss.supplier_name AS supplierName, tbd.key_cabinet AS keyCabinet, tbd.use_life AS useLife, tbd.big_type as bigType, tbd.supplier_id as supplierId, tbd.purchase_time as purchaseTime, tbd.big_notes as bigNotes, tbd.user_id as userId, tbd.safety_code as safetyCode, tbd.is_certificate as isCertificate, tbd.manufacturer AS manufacturer, tbd.date_of_production AS dateOfProduction, tbd.use_year_month AS useYearMonth, tbd.shape_size AS shapeSize, tbd.total_power AS totalPower, tbd.total_weight AS totalWeight, tbd.original_value AS originalValue, tbd.year_depreciation_rate AS yearDepreciationRate, tbd.accumulated_depreciation AS accumulatedDepreciation, tbd.net_worth AS netWorth, tbd.use_status AS useStatus, tbd.is_need AS isNeed, tbd.device_source AS deviceSource, tbd.device_nexus AS deviceNexus, tbd.fixed_person AS fixedPerson, su.real_name AS adminRealName, tbd.admin_phone AS adminPhone FROM t_big_device tbd LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id t_big_device tbd LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id LEFT JOIN sys_users su ON su.user_id = tbd.create_user where tbd.is_use=1 and tbd.big_device_id=#{bigDeviceId} </select> @@ -329,6 +488,55 @@ <if test="createUser != null"> create_user = #{createUser,jdbcType=VARCHAR}, </if> <if test="manufacturer != null"> manufacturer = #{manufacturer,jdbcType=VARCHAR}, </if> <if test="dateOfProduction != null"> date_of_production = #{dateOfProduction,jdbcType=TIMESTAMP}, </if> <if test="useYearMonth != null"> use_year_month = #{useYearMonth,jdbcType=TIMESTAMP}, </if> <if test="shapeSize != null"> shape_size = #{shapeSize,jdbcType=VARCHAR}, </if> <if test="totalPower != null"> total_power = #{totalPower}, </if> <if test="totalWeight != null"> total_weight = #{totalWeight,jdbcType=VARCHAR}, </if> <if test="originalValue != null"> original_value = #{originalValue,jdbcType=VARCHAR}, </if> <if test="yearDepreciationRate != null"> year_depreciation_rate = #{yearDepreciationRate,jdbcType=VARCHAR}, </if> <if test="accumulatedDepreciation != null"> accumulated_depreciation = #{accumulatedDepreciation,jdbcType=VARCHAR}, </if> <if test="netWorth != null"> net_worth = #{netWorth,jdbcType=VARCHAR}, </if> <if test="useStatus != null"> use_status = #{useStatus,jdbcType=INTEGER}, </if> <if test="isNeed != null"> is_need = #{isNeed,jdbcType=INTEGER}, </if> <if test="deviceSource != null"> device_source = #{deviceSource,jdbcType=VARCHAR}, </if> <if test="deviceNexus != null"> device_nexus = #{deviceNexus,jdbcType=VARCHAR}, </if> <if test="fixedPerson != null"> fixed_person = #{fixedPerson,jdbcType=VARCHAR}, </if> <if test="adminPhone != null"> admin_phone = #{adminPhone,jdbcType=VARCHAR}, </if> </set> where big_device_id = #{bigDeviceId,jdbcType=VARCHAR} </update> hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/rebarprint/controller/TSteelPrintController.java
@@ -50,7 +50,7 @@ @GetMapping("/test") public void dowanload(@RequestParam String num public void dowanload(@RequestParam(required = false) String num ,@RequestParam(required = false) Integer type ,@RequestParam(required = false) String mouldId ,@RequestParam(required = false) String steelProduceId