Commit d8d990b9 LN

点料历史上传修改

1 个父辈 284906eb
...@@ -5,6 +5,7 @@ import com.neotel.smfcore.common.base.IExcelDownLoad; ...@@ -5,6 +5,7 @@ import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.core.language.util.MessageUtils; import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.xRay.rest.dto.CountingHistoryDto; import com.neotel.smfcore.core.xRay.rest.dto.CountingHistoryDto;
...@@ -33,7 +34,7 @@ import java.util.*; ...@@ -33,7 +34,7 @@ import java.util.*;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("service/equipment/xRayData") @RequestMapping("service/xRayData")
public class XrayDataController { public class XrayDataController {
@Autowired @Autowired
...@@ -49,36 +50,36 @@ public class XrayDataController { ...@@ -49,36 +50,36 @@ public class XrayDataController {
Object value = paramsMap.get("data"); Object value = paramsMap.get("data");
List<CountingHistory> entities = new ArrayList<>(); List<CountingHistory> entities = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
try { try {
if (value instanceof List) { if (value instanceof List) {
List<?> rawList = (List<?>) value; List<?> rawList = (List<?>) value;
for (Object item : rawList) { for (Object item : rawList) {
CountingHistoryDto dto = mapper.convertValue(item, CountingHistoryDto.class); CountingHistory dto = JsonUtil.toObj(item.toString(),CountingHistory.class);
entities.add(countingHistoryMapper.toEntity(dto)); entities.add(dto );
} }
} else if (value instanceof String) { } else if (value instanceof String) {
String json = (String) value; String json = (String) value;
List<CountingHistoryDto> dtos = mapper.readValue(json, new TypeReference<List<CountingHistoryDto>>() {}); List<CountingHistory> dtos =JsonUtil.toList(json,CountingHistory.class);
for (CountingHistoryDto dto : dtos) { for (CountingHistory dto : dtos) {
entities.add(countingHistoryMapper.toEntity(dto)); entities.add( dto);
} }
} else { } else {
log.warn("Unsupported data payload type: {}", value == null ? "null" : value.getClass().getName()); log.warn("Unsupported data payload type: {}", value == null ? "null" : value.getClass().getName());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Failed to parse data payload: {}", e.getMessage()); log.error("Failed to parse data payload: {}", e.getMessage());
return ResultBean.newOkResult(new ArrayList<>()); return ResultBean.newErrorResult(99,"",e.getMessage());
} }
List<String> successUids = countingHistoryManager.upsertByUid(entities); List<String> successUids = countingHistoryManager.upsertByUid(entities);
log.info("uploadCountingHistory 收到"+entities.size()+"条数据,新增成功"+successUids.size()+"条: "+String.join(",",successUids));
return ResultBean.newOkResult(successUids); return ResultBean.newOkResult(successUids);
} }
@ApiOperation("查询点料结果") @ApiOperation("查询点料结果")
@GetMapping @GetMapping(value = "/list")
@PreAuthorize("@el.check('xRayData:list')") @PreAuthorize("@el.check('xRayData:list')")
public PageData<CountingHistoryDto> query(CountingHistoryQueryCriteria criteria, Pageable pageable){ public PageData<CountingHistoryDto> list(CountingHistoryQueryCriteria criteria, Pageable pageable){
Query query= QueryHelp.getQuery(criteria); Query query= QueryHelp.getQuery(criteria);
PageData<CountingHistory> pages=countingHistoryManager.findByPage(query,pageable); PageData<CountingHistory> pages=countingHistoryManager.findByPage(query,pageable);
List<CountingHistoryDto> countingHistoryDtos=countingHistoryMapper.toDto(pages.getContent()); List<CountingHistoryDto> countingHistoryDtos=countingHistoryMapper.toDto(pages.getContent());
...@@ -89,7 +90,7 @@ public class XrayDataController { ...@@ -89,7 +90,7 @@ public class XrayDataController {
@ApiOperation("导出点料列表") @ApiOperation("导出点料列表")
@GetMapping(value = "/download") @GetMapping(value = "/download")
@PreAuthorize("@el.check('xRayData:download')") @PreAuthorize("@el.check('xRayData:download')")
public void inventoryDownload(HttpServletRequest request,HttpServletResponse response, CountingHistoryQueryCriteria criteria , Pageable pageable)throws IOException { public void download(HttpServletRequest request,HttpServletResponse response, CountingHistoryQueryCriteria criteria , Pageable pageable)throws IOException {
Query query = QueryHelp.getQuery(criteria); Query query = QueryHelp.getQuery(criteria);
FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() { FileUtil.downloadExcel(query, pageable, response, new IExcelDownLoad() {
...@@ -110,7 +111,7 @@ public class XrayDataController { ...@@ -110,7 +111,7 @@ public class XrayDataController {
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.tdBarcode", locale, "条码"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.tdBarcode", locale, "条码")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.xRayFile", locale, "图片文件名"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.xRayFile", locale, "图片文件名")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.resultFile", locale, "结果文件名"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.resultFile", locale, "结果文件名")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.uploadOk", locale, "是否上传完成"))); // header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.uploadOk", locale, "是否上传完成")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.countingTime", locale, "点料时间"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.xray.countingHistory.countingTime", locale, "点料时间")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.common.createDate", locale, "创建时间"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.common.createDate", locale, "创建时间")));
header.add(Lists.newArrayList(MessageUtils.getText("smfcore.common.updateDate", locale, "更新时间"))); header.add(Lists.newArrayList(MessageUtils.getText("smfcore.common.updateDate", locale, "更新时间")));
...@@ -143,7 +144,7 @@ public class XrayDataController { ...@@ -143,7 +144,7 @@ public class XrayDataController {
row.add(item.getTdBarcode()); row.add(item.getTdBarcode());
row.add(item.getXRayFile()); row.add(item.getXRayFile());
row.add(item.getResultFile()); row.add(item.getResultFile());
row.add(item.getUploadOk()); // row.add(item.getUploadOk());
row.add(countingTime); row.add(countingTime);
row.add(createDate); row.add(createDate);
row.add(updateDate); row.add(updateDate);
......
...@@ -18,7 +18,7 @@ public class CountingHistoryDto { ...@@ -18,7 +18,7 @@ public class CountingHistoryDto {
private String ri = ""; private String ri = "";
@ApiModelProperty("是否为不良品的标识 ") @ApiModelProperty("是否为不良品的标识 ")
private boolean isNG = false; private boolean ng = false;
@ApiModelProperty("不良品信息 ") @ApiModelProperty("不良品信息 ")
private String ngMsg = ""; private String ngMsg = "";
......
package com.neotel.smfcore.core.xRay.service.po; package com.neotel.smfcore.core.xRay.service.po;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.neotel.smfcore.common.base.BasePo; import com.neotel.smfcore.common.base.BasePo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -8,6 +9,7 @@ import lombok.NoArgsConstructor; ...@@ -8,6 +9,7 @@ import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@Data @Data
@Document @Document
...@@ -73,13 +75,14 @@ public class CountingHistory extends BasePo implements Serializable { ...@@ -73,13 +75,14 @@ public class CountingHistory extends BasePo implements Serializable {
* 结果文件路径或相关标识 * 结果文件路径或相关标识
*/ */
private String resultFile; private String resultFile;
//
/** // /**
* 是否上传到smf完成,1=完成,0=未完成 // * 是否上传到smf完成,1=完成,0=未完成
*/ // */
private int uploadOk = 0; // private int uploadOk = 0;
/** /**
* 点料时间 * 点料时间
*/ */
private DateTime countingTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 时区根据实际情况调整
private Date countingTime;
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!