diff --git a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java index 0318679..b167472 100644 --- a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java +++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java @@ -37,6 +37,6 @@ public interface ISpareClient { @PostMapping(EXCEED_LIMIT) List exceedLimit(@RequestParam("deptId") Long deptId); - @GetMapping(EXCEED_LIMIT) + @PostMapping(SPARE_PART) List sparePart(@RequestParam("basics") List basics); } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessLibraryEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessLibraryEntity.java index c354b32..72d1e33 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessLibraryEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/access/entity/OperAccessLibraryEntity.java @@ -34,6 +34,12 @@ public class OperAccessLibraryEntity extends TenantEntity { private String emCode; /** + * 设备编码 + */ + @ApiModelProperty(value = "设备名称") + private String emName; + + /** * 检修等级 */ @ApiModelProperty(value = "检修等级") diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java index 7eaa129..fc5eb87 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java @@ -14,6 +14,9 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.feign.ISysClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; @@ -137,6 +140,7 @@ public class SpareClient implements ISpareClient{ * @return */ @Override + @PostMapping(SPARE_PART) public List sparePart(List basics) { return wtSpBasicService.sparePart(basics); } diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java index 3ec89f4..2d619bf 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.java @@ -4,6 +4,7 @@ import com.hnac.hzims.spare.entity.SpTemporaryStockDetailEntity; import com.hnac.hzims.spare.entity.WtSpBasicEntity; import com.hnac.hzims.spare.vo.SparePartVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; +import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.annotation.UserDataAuth; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springframework.web.bind.annotation.RequestParam; @@ -48,5 +49,5 @@ public interface WtSpBasicMapper extends UserDataScopeBaseMapper getInList(Long spBasicId); - List sparePart(@RequestParam("basics") List basics); + List sparePart(@Param("basicIds") List basics); } diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml index 7db89ac..3e12697 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/WtSpBasicMapper.xml @@ -101,10 +101,10 @@ LEFT JOIN WT_SP_WAREHOUSE house ON total.WAREHOUSE_ID = house.id 1 = 2 OR - - and basic.ID in - - #{basic} + + basic.ID in + + #{item} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java index 896e2f3..5eeaf3b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessLibraryController.java @@ -98,4 +98,11 @@ public class OperAccessLibraryController extends BladeController { public void downLoad() { service.downLoad(); } + + @ApiOperation(value = "检修库导入") + @ApiOperationSupport(order = 7) + @PostMapping(value = "/import") + public void libraryImport(@RequestParam("library") MultipartFile multipartFile) { + service.libraryImport(multipartFile); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java index de3219d..2ebc882 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/OperAccessTaskController.java @@ -101,6 +101,7 @@ public class OperAccessTaskController extends BladeController { public R> list(OperAccessTaskDTO req, Query query) { return service.list(req, query); } + /** * 分页 */ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java index 6704dcd..0abc6f7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessLibraryService.java @@ -10,6 +10,8 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.web.multipart.MultipartFile; +import java.io.IOException; + /** * 服务类 * @@ -27,4 +29,6 @@ public interface IOperAccessLibraryService extends BaseService> list(OperAccessLibraryListDTO req, Query query); void downLoad(); + + void libraryImport(MultipartFile multipartFile); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java index f4d82a6..ef3725f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java @@ -17,25 +17,37 @@ import com.hnac.hzims.operational.access.service.IOperAccessLibraryDetailService import com.hnac.hzims.operational.access.service.IOperAccessLibraryService; import com.hnac.hzims.operational.access.vo.OperAccessLibraryVO; import com.hnac.hzims.operational.access.wrapper.OperAccessLibraryWrapper; +import com.hnac.hzims.operational.util.ExcelUtil; +import com.hnac.hzims.operational.util.PdfUtils; import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import org.apache.commons.lang.StringUtils; -import org.jfree.chart.util.ExportUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.system.cache.DictCache; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.util.*; import java.util.stream.Collectors; /** @@ -99,13 +111,95 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl details = new ArrayList<>(); + Long libraryId = null; + for (int i = 2; i <= rows + 1; i++) { + // 读取左上端单元格 + Row row = sheet.getRow(i); + // 行不为空 + if (row == null) { + continue; + } + if( (i - 1) % 4 == 1){ + if(StringUtils.isEmpty(row.getCell(1).getStringCellValue())){ + continue; + } + OperAccessLibraryEntity library = new OperAccessLibraryEntity(); + library.setEmName(row.getCell(1).getStringCellValue()); + library.setGradeCode(DictCache.getValue("gradeCode",row.getCell(2).getStringCellValue())); + library.setLastServiceTime(row.getCell(3).getDateCellValue()); + library.setPeriod((int)row.getCell(4).getNumericCellValue()); + library.setStopHours((int)row.getCell(5).getNumericCellValue()); + this.save(library); + libraryId = library.getId(); + } + if(StringUtils.isNotEmpty(row.getCell(6).getStringCellValue())){ + OperAccessLibraryDetailEntity detail = new OperAccessLibraryDetailEntity(); + detail.setName(row.getCell(6).getStringCellValue()); + detail.setContent(row.getCell(7).getStringCellValue()); + detail.setPid(libraryId); + details.add(detail); + } + } + this.libraryDetailService.saveBatch(details); + } + + /** * 调整检修库明细 * * @author xiashandong diff --git a/hzims-service/operational/src/main/resources/template/excel/access_import_template.xls b/hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx similarity index 100% rename from hzims-service/operational/src/main/resources/template/excel/access_import_template.xls rename to hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml index 2dc2cc3..3df394d 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/mapper/xml/WorkTicketInfoMapper.xml @@ -100,10 +100,10 @@ - and info.make_date_time >= #{startTime} + and info.plan_start_time >= #{startTime} - and info.make_date_time <= #{endTime} + and info.plan_start_time <= #{endTime} GROUP BY info.EM_CODE,info.`type`