更新参数类型

This commit is contained in:
liuchengqian 2022-03-01 11:59:54 +08:00
parent 5ef4df2d6f
commit b0afd5f4aa
7 changed files with 19 additions and 26 deletions

View File

@ -43,7 +43,7 @@ public class FileController {
* @throws IOException * @throws IOException
*/ */
@PostMapping("/insertFileExcel") @PostMapping("/insertFileExcel")
public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { public String insertFileExcel(@RequestBody FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
return fileService.insertFileExcel(fileQo, fileExcel); return fileService.insertFileExcel(fileQo, fileExcel);
} }
@ -57,7 +57,7 @@ public class FileController {
*/ */
@PostMapping("/updateFileUploadPath") @PostMapping("/updateFileUploadPath")
@Transactional(rollbackOn = Exception.class) @Transactional(rollbackOn = Exception.class)
public String updateFileUploadPath(FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
String file = ExcelUploadUtil.memoryFile(fileExcel); String file = ExcelUploadUtil.memoryFile(fileExcel);
fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file); fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file);

View File

@ -6,10 +6,7 @@ import com.xkrs.model.entity.PictureEntity;
import com.xkrs.model.qo.PictureQo; import com.xkrs.model.qo.PictureQo;
import com.xkrs.service.PictureService; import com.xkrs.service.PictureService;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@ -6,12 +6,11 @@ import com.xkrs.model.entity.SpecEntity;
import com.xkrs.model.qo.SpecQo; import com.xkrs.model.qo.SpecQo;
import com.xkrs.service.SpecService; import com.xkrs.service.SpecService;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Locale; import java.util.Locale;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -34,22 +33,20 @@ public class SpecController {
* @param specQo * @param specQo
*/ */
@PostMapping("/insertSpec") @PostMapping("/insertSpec")
public String insertSpec(SpecQo specQo) { public String insertSpec(@RequestBody SpecQo specQo) {
return specService.insertSpec(specQo); return specService.insertSpec(specQo);
} }
/** /**
* 查询规格信息 * 查询规格信息
*/ */
@PostMapping("/selectSpec") @GetMapping("/selectSpec")
public String selectSpec(@RequestBody SpecQo specQo) { public String selectSpec(@RequestParam("partNo") String partNo, @RequestParam("inspectionItemCode") String inspectionItemCode) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
String partNo = specQo.getPartNo(); Optional<SpecEntity> byPartNoAndInspectionItemCode = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode);
String inspectionItemCode = specQo.getInspectionItemCode(); if (byPartNoAndInspectionItemCode.isEmpty()) {
SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode).get();
if (specEntity == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale);
} }
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntity, locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byPartNoAndInspectionItemCode.get(), locale);
} }
} }

View File

@ -34,9 +34,9 @@ public interface DataDictDao extends JpaRepository<DataDict,Long>, JpaSpecificat
/** /**
* 根据id修改字典的信息 * 根据id修改字典的信息
* @param id * @param id
* @param chineseName * @param inspectionItemName
*/ */
@Modifying(clearAutomatically=true) @Modifying(clearAutomatically=true)
@Query(value = "update data_dict set dict_chinese_name = ?2 where id = ?1",nativeQuery = true) @Query(value = "UPDATE qc_inspection_item_dict SET inspection_item_name = ?2 where id = ?1",nativeQuery = true)
void updateDict(Integer id, String chineseName); void updateDict(Integer id, String inspectionItemName);
} }

View File

@ -39,8 +39,8 @@ public class DataSourceServiceImpl implements DataSourceService {
public String insertDataSource(DataSourceQo dataSourceQo) { public String insertDataSource(DataSourceQo dataSourceQo) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()); Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode());
if (byInspectionItemCode.isPresent()) { if (byInspectionItemCode.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "存在该字典类型!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "存在该字典类型!", locale);
} }
DataSource dataSource = new DataSource(); DataSource dataSource = new DataSource();
dataSource.setLotNo(dataSourceQo.getLotNo()); dataSource.setLotNo(dataSourceQo.getLotNo());

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Locale; import java.util.Locale;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -22,8 +23,8 @@ public class SpecServiceImpl implements SpecService {
@Override @Override
public String insertSpec(SpecQo specQo) { public String insertSpec(SpecQo specQo) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode()).get(); Optional<SpecEntity> inspectionItemCode = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode());
if (specEntity != null) { if (inspectionItemCode.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale);
} }
SpecEntity specEntity1 = new SpecEntity(); SpecEntity specEntity1 = new SpecEntity();

View File

@ -52,8 +52,6 @@ public class ExcelUploadUtil {
String uploadsImage = uploadPath + newName; String uploadsImage = uploadPath + newName;
//实现上传 //实现上传
fileExcel.transferTo(new File(path)); fileExcel.transferTo(new File(path));
return path; return path;
} }
return null; return null;