|
|
|
|
@ -26,7 +26,11 @@ import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.basic.excel.CoatingThicknessExcel; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.CoatingThickness; |
|
|
|
|
import org.springblade.desk.basic.util.ExcelExtUtil; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.DsPartEntity; |
|
|
|
|
import org.springblade.desk.dashboard.service.IDsPartService; |
|
|
|
|
import org.springblade.desk.quality.constant.QAModuleConst; |
|
|
|
|
import org.springblade.desk.quality.excel.RemindMsgExcel; |
|
|
|
|
import org.springblade.desk.quality.pojo.entity.RemindMsg; |
|
|
|
|
@ -38,6 +42,7 @@ import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
@ -60,6 +65,8 @@ public class RemindMsgController extends BladeController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IRemindMsgService service; |
|
|
|
|
@Resource |
|
|
|
|
private IDsPartService dsPartService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [提醒信息] 详情 |
|
|
|
|
@ -84,11 +91,15 @@ public class RemindMsgController extends BladeController { |
|
|
|
|
public R<IPage<RemindMsgVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> map, |
|
|
|
|
Query query) { |
|
|
|
|
RemindMsgSearch search = BeanUtil.toBean(map, RemindMsgSearch.class); |
|
|
|
|
String partName = ""; |
|
|
|
|
if (map.containsKey("partName")) { |
|
|
|
|
String partName = map.get("partName").toString(); |
|
|
|
|
partName = map.get("partName").toString(); |
|
|
|
|
} |
|
|
|
|
QueryWrapper<RemindMsg> qw = Condition.getQueryWrapper(map, RemindMsg.class); |
|
|
|
|
qw.like(map.containsKey("partName"), RemindMsg.PART_NAME, map.get("partName")); |
|
|
|
|
if(!partName.isEmpty()){ |
|
|
|
|
qw.like(RemindMsg.PART_NAME, partName); |
|
|
|
|
} |
|
|
|
|
// qw.like(map.containsKey("partName"), RemindMsg.PART_NAME, map.get("partName"));
|
|
|
|
|
IPage<RemindMsg> pages = service.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<RemindMsgVO> pagesVO = RemindMsgWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
@ -222,6 +233,18 @@ public class RemindMsgController extends BladeController { |
|
|
|
|
"[提醒信息]数据表", list, RemindMsgExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [提醒信息] 导出Excel |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/downloadExcel") |
|
|
|
|
@ApiOperationSupport(order = 70) |
|
|
|
|
@Operation(summary = "导出Excel", description = "传入RemindMsg") |
|
|
|
|
public void downloadExcel(HttpServletResponse response) { |
|
|
|
|
List<RemindMsgExcel> list = new ArrayList<>(); |
|
|
|
|
ExcelUtil.export(response, "[提醒信息]数据" + DateUtil.time(), |
|
|
|
|
"[提醒信息]数据表", list, RemindMsgExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* [提醒信息] 下载Excel模板 |
|
|
|
|
*/ |
|
|
|
|
@ -241,13 +264,30 @@ public class RemindMsgController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 72) |
|
|
|
|
@Operation(summary = "导入Excel", description = "MultipartFile") |
|
|
|
|
public R importExcel(@RequestParam("file") MultipartFile file) { |
|
|
|
|
R checkR = ExcelExtUtil.importExcelCheck(file); |
|
|
|
|
if (checkR != null) { |
|
|
|
|
return checkR; |
|
|
|
|
List<RemindMsg> noticeList = new ArrayList<>(); |
|
|
|
|
List<RemindMsgExcel> list = ExcelUtil.read(file, RemindMsgExcel.class); |
|
|
|
|
list.forEach(noticeExcel -> { |
|
|
|
|
RemindMsg notice = BeanUtil.copy(noticeExcel, RemindMsg.class); |
|
|
|
|
String partCode = noticeExcel.getPartCode(); |
|
|
|
|
String subPartCode = noticeExcel.getSubPartCode(); |
|
|
|
|
|
|
|
|
|
QueryWrapper<DsPartEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.lambda().eq(DsPartEntity::getPartCode, partCode); |
|
|
|
|
List<DsPartEntity> parts = dsPartService.list(queryWrapper); |
|
|
|
|
if(null != parts && parts.size() > 0){ |
|
|
|
|
notice.setPartId(parts.get(0).getId()); |
|
|
|
|
} |
|
|
|
|
List<RemindMsg> importList = ExcelUtil.read( |
|
|
|
|
file, 0, 1, RemindMsg.class |
|
|
|
|
); |
|
|
|
|
return R.status(service.saveBatch(importList)); |
|
|
|
|
|
|
|
|
|
QueryWrapper<DsPartEntity> queryWrappersub = new QueryWrapper<>(); |
|
|
|
|
queryWrappersub.lambda().eq(DsPartEntity::getPartCode, subPartCode); |
|
|
|
|
List<DsPartEntity> partsubs = dsPartService.list(queryWrappersub); |
|
|
|
|
if(null != partsubs && partsubs.size() > 0){ |
|
|
|
|
notice.setSubPartId(partsubs.get(0).getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noticeList.add(notice); |
|
|
|
|
}); |
|
|
|
|
return R.data(service.saveBatch(noticeList)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|