songguoqiang
7 months ago
29 changed files with 984 additions and 7 deletions
@ -0,0 +1,139 @@ |
|||
package com.win.module.eam.controller.itemnewturnin; |
|||
|
|||
import com.win.module.eam.controller.itemnewturnin.vo.*; |
|||
import io.swagger.v3.oas.annotations.Parameters; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import javax.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
|
|||
import javax.validation.constraints.*; |
|||
import javax.validation.*; |
|||
import javax.servlet.http.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.ZoneOffset; |
|||
import java.util.*; |
|||
import java.io.IOException; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
import com.win.framework.common.pojo.CommonResult; |
|||
import static com.win.framework.common.pojo.CommonResult.success; |
|||
|
|||
import com.win.framework.excel.core.util.ExcelUtils; |
|||
|
|||
import com.win.framework.operatelog.core.annotations.OperateLog; |
|||
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
|||
|
|||
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|||
import com.win.module.eam.convert.itemnewturnin.ItemNewTurnInConvert; |
|||
import com.win.module.eam.service.itemnewturnin.ItemNewTurnInService; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
@Tag(name = "管理后台 - 备件台账新到货转账内变更记录") |
|||
@RestController |
|||
@RequestMapping("/eam/item-new-turn-in") |
|||
@Validated |
|||
public class ItemNewTurnInController { |
|||
|
|||
@Resource |
|||
private ItemNewTurnInService itemNewTurnInService; |
|||
|
|||
@PostMapping("/create") |
|||
@Operation(summary = "创建备件台账新到货转账内变更记录") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:create')") |
|||
public CommonResult<Long> createItemNewTurnIn(@Valid @RequestBody ItemNewTurnInCreateReqVO createReqVO) { |
|||
return success(itemNewTurnInService.createItemNewTurnIn(createReqVO)); |
|||
} |
|||
|
|||
@PutMapping("/update") |
|||
@Operation(summary = "更新备件台账新到货转账内变更记录") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:update')") |
|||
public CommonResult<Boolean> updateItemNewTurnIn(@Valid @RequestBody ItemNewTurnInUpdateReqVO updateReqVO) { |
|||
int result = itemNewTurnInService.updateItemNewTurnIn(updateReqVO); |
|||
return success(result > 0); |
|||
} |
|||
|
|||
@DeleteMapping("/delete") |
|||
@Operation(summary = "删除备件台账新到货转账内变更记录") |
|||
@Parameter(name = "id", description = "编号", required = true) |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:delete')") |
|||
public CommonResult<Boolean> deleteItemNewTurnIn(@RequestParam("id") Long id) { |
|||
int result = itemNewTurnInService.deleteItemNewTurnIn(id); |
|||
return success(result > 0); |
|||
} |
|||
|
|||
@GetMapping("/get") |
|||
@Operation(summary = "获得备件台账新到货转账内变更记录") |
|||
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')") |
|||
public CommonResult<ItemNewTurnInRespVO> getItemNewTurnIn(@RequestParam("id") Long id) { |
|||
ItemNewTurnInDO itemNewTurnIn = itemNewTurnInService.getItemNewTurnIn(id); |
|||
return success(ItemNewTurnInConvert.INSTANCE.convert(itemNewTurnIn)); |
|||
} |
|||
|
|||
@GetMapping("/list") |
|||
@Operation(summary = "获得备件台账新到货转账内变更记录列表") |
|||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')") |
|||
public CommonResult<List<ItemNewTurnInRespVO>> getItemNewTurnInList(@RequestParam("ids") Collection<Long> ids) { |
|||
List<ItemNewTurnInDO> list = itemNewTurnInService.getItemNewTurnInList(ids); |
|||
return success(ItemNewTurnInConvert.INSTANCE.convertList(list)); |
|||
} |
|||
|
|||
@GetMapping("/page") |
|||
@Operation(summary = "获得备件台账新到货转账内变更记录分页") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')") |
|||
public CommonResult<PageResult<ItemNewTurnInRespVO>> getItemNewTurnInPage(@Valid ItemNewTurnInPageReqVO pageVO) { |
|||
PageResult<ItemNewTurnInDO> pageResult = itemNewTurnInService.getItemNewTurnInPage(pageVO); |
|||
return success(ItemNewTurnInConvert.INSTANCE.convertPage(pageResult)); |
|||
} |
|||
|
|||
@GetMapping("/export-excel") |
|||
@Operation(summary = "导出备件台账新到货转账内变更记录 Excel") |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:export')") |
|||
@OperateLog(type = EXPORT) |
|||
public void exportItemNewTurnInExcel(@Valid ItemNewTurnInExportReqVO exportReqVO, |
|||
HttpServletResponse response) throws IOException { |
|||
List<ItemNewTurnInDO> list = itemNewTurnInService.getItemNewTurnInList(exportReqVO); |
|||
// 导出 Excel
|
|||
List<ItemNewTurnInExcelVO> datas = ItemNewTurnInConvert.INSTANCE.convertList02(list); |
|||
ExcelUtils.write(response, "备件台账新到货转账内变更记录.xls", "数据", ItemNewTurnInExcelVO.class, datas); |
|||
} |
|||
|
|||
@GetMapping("/get-import-template") |
|||
@Operation(summary = "获得导入备件台账新到货转账内变更记录模板") |
|||
public void importTemplate(HttpServletResponse response) throws IOException { |
|||
List<ItemNewTurnInExcelVO> list = Arrays.asList(); |
|||
// 输出
|
|||
ExcelUtils.write(response, "备件台账新到货转账内变更记录基本信息导入模板.xls", "备件台账新到货转账内变更记录基本信息列表", ItemNewTurnInExcelVO.class, list); |
|||
} |
|||
|
|||
@PostMapping("/import") |
|||
@Operation(summary = "导入备件台账新到货转账内变更记录基本信息") |
|||
@Parameters({ |
|||
@Parameter(name = "file", description = "Excel 文件", required = true), |
|||
@Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"), |
|||
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") |
|||
}) |
|||
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:import')") |
|||
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, |
|||
@RequestParam("file") MultipartFile file, |
|||
@RequestParam(value = "mode") Integer mode, |
|||
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { |
|||
|
|||
List<ItemNewTurnInExcelVO> list = ExcelUtils.read(file, ItemNewTurnInExcelVO.class); |
|||
List<ItemNewTurnInExcelVO> errorList = itemNewTurnInService.importItemNewTurnInList(list, mode, updatePart); |
|||
|
|||
Map<String, Object> returnMap = new HashMap<>(); |
|||
returnMap.put("errorCount", errorList.size()); |
|||
if(!errorList.isEmpty()) { |
|||
String url = ExcelUtils.writeLocalFile("备件台账新到货转账内变更记录基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); |
|||
returnMap.put("errorFile", url); |
|||
} |
|||
|
|||
return success(returnMap); |
|||
} |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import javax.validation.constraints.*; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Base VO,提供给添加、修改、详细的子 VO 使用 |
|||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
|||
*/ |
|||
@Data |
|||
public class ItemNewTurnInBaseVO { |
|||
|
|||
@Schema(description = "备件编码", requiredMode = Schema.RequiredMode.REQUIRED) |
|||
@NotNull(message = "备件编码不能为空") |
|||
private String itemNumber; |
|||
|
|||
@Schema(description = "库位编码", requiredMode = Schema.RequiredMode.REQUIRED) |
|||
@NotNull(message = "库位编码不能为空") |
|||
private String locationNumber; |
|||
|
|||
@Schema(description = "库区编码", requiredMode = Schema.RequiredMode.REQUIRED) |
|||
@NotNull(message = "库区编码不能为空") |
|||
private String areaNumber; |
|||
|
|||
@Schema(description = "描述", example = "随便") |
|||
private String description; |
|||
|
|||
@Schema(description = "新到货数量") |
|||
private BigDecimal newQty; |
|||
|
|||
@Schema(description = "账内数量") |
|||
private BigDecimal inQty; |
|||
|
|||
@Schema(description = "转换后账内数量") |
|||
private BigDecimal qty; |
|||
|
|||
@Schema(description = "地点ID", example = "4783") |
|||
private String siteId; |
|||
|
|||
@Schema(description = "是否可用") |
|||
private String available; |
|||
|
|||
@Schema(description = "变更操作字典") |
|||
private String type; |
|||
|
|||
@Schema(description = "并发乐观锁") |
|||
private Integer concurrencyStamp; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import javax.validation.constraints.*; |
|||
|
|||
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录创建 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class ItemNewTurnInCreateReqVO extends ItemNewTurnInBaseVO { |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Excel VO |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Data |
|||
public class ItemNewTurnInExcelVO { |
|||
|
|||
@ExcelProperty("备件编码") |
|||
private String itemNumber; |
|||
|
|||
@ExcelProperty("库位编码") |
|||
private String locationNumber; |
|||
|
|||
@ExcelProperty("库区编码") |
|||
private String areaNumber; |
|||
|
|||
@ExcelProperty("描述") |
|||
private String description; |
|||
|
|||
@ExcelProperty("新到货数量") |
|||
private BigDecimal newQty; |
|||
|
|||
@ExcelProperty("账内数量") |
|||
private BigDecimal inQty; |
|||
|
|||
@ExcelProperty("转换后账内数量") |
|||
private BigDecimal qty; |
|||
|
|||
@ExcelProperty("创建时间") |
|||
private LocalDateTime createTime; |
|||
|
|||
@ExcelProperty("地点ID") |
|||
private String siteId; |
|||
|
|||
@ExcelProperty("是否可用") |
|||
private String available; |
|||
|
|||
@ExcelProperty("并发乐观锁") |
|||
private Integer concurrencyStamp; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import com.win.framework.common.pojo.PageParam; |
|||
|
|||
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录 Excel 导出 Request VO,参数和 ItemNewTurnInPageReqVO 是一致的") |
|||
@Data |
|||
public class ItemNewTurnInExportReqVO { |
|||
|
|||
@Schema(description = "备件编码") |
|||
private String itemNumber; |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import com.win.framework.common.pojo.PageParam; |
|||
|
|||
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录分页 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class ItemNewTurnInPageReqVO extends PageParam { |
|||
|
|||
@Schema(description = "备件编码") |
|||
private String itemNumber; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.time.LocalDateTime; |
|||
|
|||
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录 Response VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class ItemNewTurnInRespVO extends ItemNewTurnInBaseVO { |
|||
|
|||
@Schema(description = "创建时间") |
|||
private LocalDateTime createTime; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.win.module.eam.controller.itemnewturnin.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import javax.validation.constraints.*; |
|||
|
|||
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录更新 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
public class ItemNewTurnInUpdateReqVO extends ItemNewTurnInBaseVO { |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.win.module.eam.convert.itemnewturnin; |
|||
|
|||
import java.util.*; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInCreateReqVO; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInExcelVO; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInRespVO; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInUpdateReqVO; |
|||
import org.mapstruct.Mapper; |
|||
import org.mapstruct.factory.Mappers; |
|||
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Convert |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Mapper |
|||
public interface ItemNewTurnInConvert { |
|||
|
|||
ItemNewTurnInConvert INSTANCE = Mappers.getMapper(ItemNewTurnInConvert.class); |
|||
|
|||
ItemNewTurnInDO convert(ItemNewTurnInCreateReqVO bean); |
|||
|
|||
ItemNewTurnInDO convert(ItemNewTurnInUpdateReqVO bean); |
|||
|
|||
ItemNewTurnInRespVO convert(ItemNewTurnInDO bean); |
|||
|
|||
List<ItemNewTurnInRespVO> convertList(List<ItemNewTurnInDO> list); |
|||
|
|||
PageResult<ItemNewTurnInRespVO> convertPage(PageResult<ItemNewTurnInDO> page); |
|||
|
|||
List<ItemNewTurnInExcelVO> convertList02(List<ItemNewTurnInDO> list); |
|||
|
|||
} |
@ -0,0 +1,77 @@ |
|||
package com.win.module.eam.dal.dataobject.itemnewturnin; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.win.framework.mybatis.core.dataobject.BaseDO; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 DO |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@TableName("record_item_new_turn_in") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
@Builder |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ItemNewTurnInDO extends BaseDO { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId |
|||
private Long id; |
|||
/** |
|||
* 备件编码 |
|||
*/ |
|||
private String itemNumber; |
|||
/** |
|||
* 库位编码 |
|||
*/ |
|||
private String locationNumber; |
|||
/** |
|||
* 库区编码 |
|||
*/ |
|||
private String areaNumber; |
|||
/** |
|||
* 变更操作字典 |
|||
*/ |
|||
private String type; |
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String description; |
|||
/** |
|||
* 新到货数量 |
|||
*/ |
|||
private BigDecimal newQty; |
|||
/** |
|||
* 账内数量 |
|||
*/ |
|||
private BigDecimal inQty; |
|||
/** |
|||
* 转换后账内数量 |
|||
*/ |
|||
private BigDecimal qty; |
|||
/** |
|||
* 地点ID |
|||
*/ |
|||
private String siteId; |
|||
/** |
|||
* 是否可用 |
|||
*/ |
|||
private String available; |
|||
/** |
|||
* 并发乐观锁 |
|||
*/ |
|||
private Integer concurrencyStamp; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.win.module.eam.dal.mysql.itemnewturnin; |
|||
|
|||
import java.util.*; |
|||
|
|||
import com.win.framework.common.pojo.PageResult; |
|||
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; |
|||
import com.win.framework.mybatis.core.mapper.BaseMapperX; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInExportReqVO; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInPageReqVO; |
|||
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Mapper |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Mapper |
|||
public interface ItemNewTurnInMapper extends BaseMapperX<ItemNewTurnInDO> { |
|||
|
|||
default PageResult<ItemNewTurnInDO> selectPage(ItemNewTurnInPageReqVO reqVO) { |
|||
return selectPage(reqVO, new LambdaQueryWrapperX<ItemNewTurnInDO>() |
|||
.eqIfPresent(ItemNewTurnInDO::getItemNumber, reqVO.getItemNumber()) |
|||
.orderByDesc(ItemNewTurnInDO::getId)); |
|||
} |
|||
|
|||
default List<ItemNewTurnInDO> selectList(ItemNewTurnInExportReqVO reqVO) { |
|||
return selectList(new LambdaQueryWrapperX<ItemNewTurnInDO>() |
|||
.eqIfPresent(ItemNewTurnInDO::getItemNumber, reqVO.getItemNumber()) |
|||
.orderByDesc(ItemNewTurnInDO::getId)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.win.module.eam.enums.itemAccount; |
|||
|
|||
public enum ItemAccountStatusEnum { |
|||
|
|||
IN("0", "账内"), |
|||
OUT("1", "账外"), |
|||
NEW("2", "新到货"), |
|||
; |
|||
private String code; |
|||
private String name; |
|||
|
|||
ItemAccountStatusEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return this.code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return this.name; |
|||
} |
|||
|
|||
/** |
|||
* 用状态值获取枚举 |
|||
* |
|||
* @param code |
|||
* @return |
|||
*/ |
|||
static ItemAccountStatusEnum getOrderStatusEnum(String code) { |
|||
for (ItemAccountStatusEnum orderStatusEnum : values()) { |
|||
if (orderStatusEnum.getCode().equals(code)) { |
|||
return orderStatusEnum; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.win.module.eam.service.itemnewturnin; |
|||
|
|||
import java.util.*; |
|||
import javax.validation.*; |
|||
|
|||
import com.win.module.eam.controller.itemnewturnin.vo.*; |
|||
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Service 接口 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
public interface ItemNewTurnInService { |
|||
|
|||
/** |
|||
* 创建备件台账新到货转账内变更记录 |
|||
* |
|||
* @param createReqVO 创建信息 |
|||
* @return 编号 |
|||
*/ |
|||
Long createItemNewTurnIn(@Valid ItemNewTurnInCreateReqVO createReqVO); |
|||
|
|||
/** |
|||
* 更新备件台账新到货转账内变更记录 |
|||
* |
|||
* @param updateReqVO 更新信息 |
|||
*/ |
|||
Integer updateItemNewTurnIn(@Valid ItemNewTurnInUpdateReqVO updateReqVO); |
|||
|
|||
/** |
|||
* 删除备件台账新到货转账内变更记录 |
|||
* |
|||
* @param id 编号 |
|||
*/ |
|||
Integer deleteItemNewTurnIn(Long id); |
|||
|
|||
/** |
|||
* 获得备件台账新到货转账内变更记录 |
|||
* |
|||
* @param id 编号 |
|||
* @return 备件台账新到货转账内变更记录 |
|||
*/ |
|||
ItemNewTurnInDO getItemNewTurnIn(Long id); |
|||
|
|||
/** |
|||
* 获得备件台账新到货转账内变更记录列表 |
|||
* |
|||
* @param ids 编号 |
|||
* @return 备件台账新到货转账内变更记录列表 |
|||
*/ |
|||
List<ItemNewTurnInDO> getItemNewTurnInList(Collection<Long> ids); |
|||
|
|||
/** |
|||
* 获得备件台账新到货转账内变更记录分页 |
|||
* |
|||
* @param pageReqVO 分页查询 |
|||
* @return 备件台账新到货转账内变更记录分页 |
|||
*/ |
|||
PageResult<ItemNewTurnInDO> getItemNewTurnInPage(ItemNewTurnInPageReqVO pageReqVO); |
|||
|
|||
/** |
|||
* 获得备件台账新到货转账内变更记录列表, 用于 Excel 导出 |
|||
* |
|||
* @param exportReqVO 查询条件 |
|||
* @return 备件台账新到货转账内变更记录列表 |
|||
*/ |
|||
List<ItemNewTurnInDO> getItemNewTurnInList(ItemNewTurnInExportReqVO exportReqVO); |
|||
|
|||
/** |
|||
* 导入备件台账新到货转账内变更记录主信息 |
|||
* |
|||
* @param datas 导入备件台账新到货转账内变更记录主信息列表 |
|||
* @param mode 导入模式1更新2追加3覆盖 |
|||
* @param updatePart 是否支持更新 |
|||
* @return 导入结果 |
|||
*/ |
|||
public List<ItemNewTurnInExcelVO> importItemNewTurnInList(List<ItemNewTurnInExcelVO> datas, Integer mode, boolean updatePart); |
|||
} |
@ -0,0 +1,107 @@ |
|||
package com.win.module.eam.service.itemnewturnin; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.win.module.eam.controller.itemnewturnin.vo.*; |
|||
import org.springframework.stereotype.Service; |
|||
import javax.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.*; |
|||
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO; |
|||
import com.win.framework.common.pojo.PageResult; |
|||
|
|||
import com.win.module.eam.convert.itemnewturnin.ItemNewTurnInConvert; |
|||
import com.win.module.eam.dal.mysql.itemnewturnin.ItemNewTurnInMapper; |
|||
|
|||
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|||
import static com.win.module.eam.enums.ErrorCodeConstants.*; |
|||
|
|||
/** |
|||
* 备件台账新到货转账内变更记录 Service 实现类 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Service |
|||
@Validated |
|||
public class ItemNewTurnInServiceImpl implements ItemNewTurnInService { |
|||
|
|||
@Resource |
|||
private ItemNewTurnInMapper itemNewTurnInMapper; |
|||
|
|||
@Override |
|||
public Long createItemNewTurnIn(ItemNewTurnInCreateReqVO createReqVO) { |
|||
// 插入
|
|||
ItemNewTurnInDO itemNewTurnIn = ItemNewTurnInConvert.INSTANCE.convert(createReqVO); |
|||
itemNewTurnInMapper.insert(itemNewTurnIn); |
|||
// 返回
|
|||
return itemNewTurnIn.getId(); |
|||
} |
|||
|
|||
@Override |
|||
public Integer updateItemNewTurnIn(ItemNewTurnInUpdateReqVO updateReqVO) { |
|||
// 校验存在
|
|||
//validateItemNewTurnInExists(updateReqVO.getId());
|
|||
// 更新
|
|||
ItemNewTurnInDO updateObj = ItemNewTurnInConvert.INSTANCE.convert(updateReqVO); |
|||
return itemNewTurnInMapper.updateById(updateObj); |
|||
} |
|||
|
|||
@Override |
|||
public Integer deleteItemNewTurnIn(Long id) { |
|||
// 校验存在
|
|||
validateItemNewTurnInExists(id); |
|||
// 删除
|
|||
return itemNewTurnInMapper.deleteById(id); |
|||
} |
|||
|
|||
private void validateItemNewTurnInExists(Long id) { |
|||
if (itemNewTurnInMapper.selectById(id) == null) { |
|||
throw exception(ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public ItemNewTurnInDO getItemNewTurnIn(Long id) { |
|||
return itemNewTurnInMapper.selectById(id); |
|||
} |
|||
|
|||
@Override |
|||
public List<ItemNewTurnInDO> getItemNewTurnInList(Collection<Long> ids) { |
|||
return itemNewTurnInMapper.selectBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public PageResult<ItemNewTurnInDO> getItemNewTurnInPage(ItemNewTurnInPageReqVO pageReqVO) { |
|||
return itemNewTurnInMapper.selectPage(pageReqVO); |
|||
} |
|||
|
|||
@Override |
|||
public List<ItemNewTurnInDO> getItemNewTurnInList(ItemNewTurnInExportReqVO exportReqVO) { |
|||
return itemNewTurnInMapper.selectList(exportReqVO); |
|||
} |
|||
|
|||
@Override |
|||
public List<ItemNewTurnInExcelVO> importItemNewTurnInList(List<ItemNewTurnInExcelVO> datas, Integer mode, boolean updatePart) { |
|||
if (CollUtil.isEmpty(datas)) { |
|||
throw exception(ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY); |
|||
} |
|||
|
|||
List<ItemNewTurnInExcelVO> errorList = new ArrayList<>(); |
|||
datas.forEach(item -> { |
|||
// if(errorList == null){
|
|||
// // 判断如果不存在,在进行插入
|
|||
// ItemNewTurnInDO obj = itemNewTurnInMapper.selectByCode(item.getCode());
|
|||
// if (obj == null&& mode != 3) {
|
|||
// itemNewTurnInMapper.insert(ItemNewTurnInConvert.INSTANCE.convert(item));
|
|||
// }
|
|||
// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新
|
|||
// ItemNewTurnInDO itemNewTurnInDO = ItemNewTurnInConvert.INSTANCE.convert(item);
|
|||
// itemNewTurnInDO.setId(obj.getId());
|
|||
// itemNewTurnInMapper.updateById(obj);
|
|||
// }
|
|||
// }
|
|||
}); |
|||
|
|||
return errorList; |
|||
} |
|||
} |
Loading…
Reference in new issue