|
|
|
|
@ -37,12 +37,17 @@ import org.springblade.core.secure.annotation.IsAdmin; |
|
|
|
|
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.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.CoatingThickness; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.PlatingSmall; |
|
|
|
|
import org.springblade.desk.basic.pojo.vo.PlatingSmallVO; |
|
|
|
|
import org.springblade.scheduling.pojo.entity.CraftAbilityEntity; |
|
|
|
|
import org.springblade.scheduling.scheduling.excel.CraftAbilityExcel; |
|
|
|
|
import org.springblade.scheduling.scheduling.service.ICraftAbilityService; |
|
|
|
|
import org.springblade.scheduling.scheduling.vo.CraftAbilityVO; |
|
|
|
|
import org.springblade.scheduling.scheduling.wrapper.CraftAbilityWrapper; |
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
@ -50,9 +55,13 @@ import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.excel.util.ExcelUtil; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 工艺能力 控制器 |
|
|
|
|
@ -85,8 +94,24 @@ public class CraftAbilityController extends BladeController { |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@Operation(summary = "分页", description = "传入CraftAbility") |
|
|
|
|
public R<IPage<CraftAbilityVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> craftAbility, Query query) { |
|
|
|
|
IPage<CraftAbilityEntity> pages = craftAbilityService.page(Condition.getPage(query), Condition.getQueryWrapper(craftAbility, CraftAbilityEntity.class)); |
|
|
|
|
return R.data(CraftAbilityWrapper.build().pageVO(pages)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<CraftAbilityEntity> qw = Condition.getQueryWrapper(craftAbility, CraftAbilityEntity.class); |
|
|
|
|
// 名称
|
|
|
|
|
qw.like(craftAbility.containsKey("caName"), "CA_NAME", Func.toStr(craftAbility.get("caName"))); |
|
|
|
|
qw.eq(craftAbility.containsKey("caCode"), "CA_CODE", Func.toInt(craftAbility.get("caCode"))); |
|
|
|
|
qw.eq(craftAbility.containsKey("wtId"), "WT_ID", Func.toInt(craftAbility.get("wtId"))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IPage<CraftAbilityEntity> pages = craftAbilityService.page(Condition.getPage(query), qw); |
|
|
|
|
IPage<CraftAbilityVO> pagesVO = CraftAbilityWrapper.build().pageVO(pages); |
|
|
|
|
pagesVO.getRecords() |
|
|
|
|
.stream() |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
return R.data(pagesVO); |
|
|
|
|
|
|
|
|
|
// IPage<CraftAbilityEntity> pages = craftAbilityService.page(Condition.getPage(query), Condition.getQueryWrapper(craftAbility, CraftAbilityEntity.class));
|
|
|
|
|
// return R.data(CraftAbilityWrapper.build().pageVO(pages));
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -158,6 +183,51 @@ public class CraftAbilityController extends BladeController { |
|
|
|
|
ExcelUtil.export(response, "工艺能力数据" + DateUtil.time(), "工艺能力数据表", list, CraftAbilityExcel.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/submitBatWt") |
|
|
|
|
@ApiOperationSupport(order = 51) |
|
|
|
|
@Operation(summary = "批量维护厚度", description = "传入CoatingThickness List") |
|
|
|
|
public R submitBatWt(@Valid @RequestBody CraftAbilityEntity mergeOne) { |
|
|
|
|
|
|
|
|
|
List<Long> ids = mergeOne.getIds(); |
|
|
|
|
if(CollectionUtils.isEmpty(ids)){ |
|
|
|
|
return R.fail("数据为空"); |
|
|
|
|
} |
|
|
|
|
for(Long id : ids){ |
|
|
|
|
CraftAbilityEntity one = craftAbilityService.getById(id); |
|
|
|
|
one.setWtId(mergeOne.getWtId()); |
|
|
|
|
craftAbilityService.updateById(one); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/importExcel") |
|
|
|
|
@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<PlatingSmall> importList = ExcelUtil.read(
|
|
|
|
|
// file, 0, 1, PlatingSmall.class
|
|
|
|
|
// );
|
|
|
|
|
// return R.status(service.saveBatch(importList));
|
|
|
|
|
|
|
|
|
|
List<CraftAbilityEntity> noticeList = new ArrayList<>(); |
|
|
|
|
List<CraftAbilityExcel> list = ExcelUtil.read(file, CraftAbilityExcel.class); |
|
|
|
|
list.forEach(noticeExcel -> { |
|
|
|
|
|
|
|
|
|
CraftAbilityEntity notice = BeanUtil.copy(noticeExcel, CraftAbilityEntity.class); |
|
|
|
|
noticeList.add(notice); |
|
|
|
|
}); |
|
|
|
|
return R.data(craftAbilityService.saveBatch(noticeList)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 工艺能力表查询列表 |
|
|
|
|
*/ |
|
|
|
|
|