| | |
| | | import com.zt.common.validator.group.UpdateGroup; |
| | | import com.zt.life.modules.configItemWarehouse.dto.ConfigItemWarehouseDto; |
| | | 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.itemCirculatOrder.dto.ItemCirculatOrderDto; |
| | | import com.zt.life.modules.itemCirculatOrder.model.ItemCirculatOrderTechnical; |
| | | import com.zt.life.sys.dto.OssDto; |
| | | import com.zt.life.sys.service.SysOssConfigService; |
| | | import com.zt.modules.coderule.service.SysCodeRuleService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ConfigItemWarehouseService configItemWarehouseService; |
| | | |
| | | @Autowired |
| | | private SysCodeRuleService sysCodeRuleService; |
| | | |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | |
| | | @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 = "project_code^LK"), |
| | | @ApiImplicitParam(name = "projectName", value = "项目名称", dataType = Constant.QT.STRING, format = "project_name^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){ |
| | | |
| | | return PageResult.ok(configItemWarehouseService.page(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()) { |
| | | Long configItemId = configItem.getId(); |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(configItemId, "config_item_warehouse"); |
| | | if (ossDto != null) { |
| | | configItem.setFiles(ossDto); |
| | | } |
| | | } |
| | | } |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody ConfigItemWarehouse configItemWarehouse){ |
| | | public Result insert(@RequestBody ConfigItemWarehouseDto configItemDto){ |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemWarehouse, AddGroup.class, DefaultGroup.class); |
| | | configItemWarehouseService.insert(configItemWarehouse); |
| | | |
| | | 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()); |
| | | configItemDto.getConfigItemWarehouse().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = configItemWarehouseService.save(configItemDto); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody ConfigItemWarehouse configItemWarehouse){ |
| | | public Result update(@RequestBody ConfigItemWarehouseDto configItemDto){ |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemWarehouse, UpdateGroup.class, DefaultGroup.class); |
| | | configItemWarehouseService.update(configItemWarehouse); |
| | | ValidatorUtils.validateEntity(configItemDto, UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = configItemWarehouseService.save(configItemDto); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @DeleteMapping("deleteConfigItem") |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids){ |