| | |
| | | import com.zt.life.modules.configItemWarehouse.model.ConfigItemWarehouse; |
| | | import com.zt.life.modules.configItemWarehouse.model.WarehouseConfigItem; |
| | | import com.zt.life.modules.configItemWarehouse.service.ConfigItemWarehouseService; |
| | | import com.zt.life.modules.configItemWarehouse.service.WarehouseConfigItemService; |
| | | import com.zt.life.modules.itemCirculatOrder.dto.ItemCirculatOrderDto; |
| | | import com.zt.life.modules.itemCirculatOrder.model.ItemCirculatOrderTechnical; |
| | | import com.zt.life.modules.project.model.Project; |
| | | import com.zt.life.modules.project.service.ProjectService; |
| | | import com.zt.life.sys.dto.OssDto; |
| | | import com.zt.life.sys.service.SysOssConfigService; |
| | | import com.zt.modules.coderule.service.SysCodeRuleService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * config_item_warehouse |
| | | * |
| | | * @author zt generator |
| | | * @author zt generator |
| | | * @since 1.0.0 2023-11-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/configItemWarehouse/ConfigItemWarehouse/") |
| | | @Api(tags="config_item_warehouse") |
| | | @Api(tags = "config_item_warehouse") |
| | | public class ConfigItemWarehouseController { |
| | | @Autowired |
| | | private ConfigItemWarehouseService configItemWarehouseService; |
| | | |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | |
| | | @Autowired |
| | | private SysCodeRuleService sysCodeRuleService; |
| | | |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = "code", value = "配置项入库编号", dataType = Constant.QT.STRING, format = "code^LK"), |
| | | @ApiImplicitParam(name = "projectCode", value = "项目编号", dataType = Constant.QT.STRING, format = "code1^EQ"), |
| | | @ApiImplicitParam(name = "softwareName", value = "项目名称", dataType = Constant.QT.STRING, format = "software_name^EQ"), |
| | | @ApiImplicitParam(name = "libraryType", value = "库类型", dataType = Constant.QT.STRING, format = "library_type^EQ") }) |
| | | public PageResult<ConfigItemWarehouse> page(@ApiIgnore @QueryParam QueryFilter queryFilter){ |
| | | List<ConfigItemWarehouse> configItemWarehouse=configItemWarehouseService.page(queryFilter); |
| | | @ApiImplicitParam(name = Constant.Q.PAGE, value = Constant.QV.PAGE, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = "code", value = "配置项入库编号", dataType = Constant.QT.STRING, format = "a.code^LK"), |
| | | @ApiImplicitParam(name = "projectCode", value = "项目编号", dataType = Constant.QT.STRING, format = "p.code^EQ"), |
| | | @ApiImplicitParam(name = "softwareName", value = "项目名称", dataType = Constant.QT.STRING, format = "p.software_name^EQ"), |
| | | @ApiImplicitParam(name = "libraryType", value = "库类型", dataType = Constant.QT.STRING, format = "a.library_type^EQ")}) |
| | | public PageResult<ConfigItemWarehouse> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | List<ConfigItemWarehouse> configItemWarehouse = configItemWarehouseService.page(queryFilter); |
| | | return PageResult.ok(configItemWarehouse); |
| | | } |
| | | |
| | | @GetMapping("getDto") |
| | | @ApiOperation("信息") |
| | | public Result<ConfigItemWarehouseDto> getDto(Long projectId, Long warehouseId) { |
| | | ConfigItemWarehouseDto data =configItemWarehouseService.getDto(projectId, warehouseId); |
| | | if (warehouseId!=null) { |
| | | for (WarehouseConfigItem configItem : data.getConfigItemList()) { |
| | | public Result<ConfigItemWarehouseDto> getDto(Long projectId, Long warehouseId, String libraryType) { |
| | | ConfigItemWarehouseDto data = configItemWarehouseService.getDto(projectId, warehouseId, libraryType); |
| | | if (warehouseId != null) { |
| | | for (WarehouseConfigItem configItem : data.getConfigItemList()) { |
| | | Long configItemId = configItem.getId(); |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(configItemId, "config_item_warehouse"); |
| | | if (ossDto != null) { |
| | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody ConfigItemWarehouseDto configItemDto){ |
| | | public Result insert(@RequestBody ConfigItemWarehouseDto configItemDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemDto, AddGroup.class, DefaultGroup.class); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "config_item_warehouse"); |
| | | map.put("projectId",configItemDto.getProjectId().toString()); |
| | | map.put("projectId", configItemDto.getProjectId().toString()); |
| | | configItemDto.getConfigItemWarehouse().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = configItemWarehouseService.save(configItemDto); |
| | | return Result.ok(); |
| | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody ConfigItemWarehouseDto configItemDto){ |
| | | public Result update(@RequestBody ConfigItemWarehouseDto configItemDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemDto, UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = configItemWarehouseService.save(configItemDto); |
| | |
| | | @DeleteMapping("deleteConfigItem") |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids){ |
| | | public Result delete(@RequestBody Long[] ids) { |
| | | //效验数据 |
| | | |
| | | AssertUtils.isArrayEmpty(ids, "id"); |
| | | configItemWarehouseService.delete(ids); |
| | | |
| | | projectService.deleteItem(ids,"config_item_warehouse_cm","warehouse_id"); |
| | | projectService.deleteItem(ids,"config_item_warehouse_detail","warehouse_id"); |
| | | projectService.deleteItem(ids,"config_item_warehouse_qa","warehouse_id"); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("exportWarehouseOrder") |
| | | @ApiOperation("打印入库申请单") |
| | | @LogOperation("打印入库申请单") |
| | | public void exportWarehouseOrder(Long id, HttpServletRequest request, HttpServletResponse response,String libraryType) { |
| | | configItemWarehouseService.exportWarehouseOrder(id, request, response,libraryType); |
| | | } |
| | | |
| | | } |