| | |
| | | import com.zt.common.validator.group.AddGroup; |
| | | import com.zt.common.validator.group.DefaultGroup; |
| | | import com.zt.common.validator.group.UpdateGroup; |
| | | import com.zt.life.modules.baselineRelease.model.BaselineReleaseRemark; |
| | | import com.zt.life.modules.configItemChange.dto.ConfigItemChangeDto; |
| | | import com.zt.life.modules.configItemChange.model.ConfigItemChange; |
| | | import com.zt.life.modules.configItemChange.service.ConfigItemChangeService; |
| | | import com.zt.life.modules.configItemWarehouse.model.WarehouseConfigItem; |
| | | import com.zt.life.modules.configItemWarehouse.service.WarehouseConfigItemService; |
| | | 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; |
| | | import java.util.Map; |
| | |
| | | /** |
| | | * config_item_Change |
| | | * |
| | | * @author zt generator |
| | | * @author zt generator |
| | | * @since 1.0.0 2023-11-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/configItemChange/ConfigItemChange/") |
| | | @Api(tags="config_item_Change") |
| | | @Api(tags = "config_item_change") |
| | | public class ConfigItemChangeController { |
| | | @Autowired |
| | | private ConfigItemChangeService configItemChangeService; |
| | |
| | | |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | |
| | | @Autowired |
| | | private WarehouseConfigItemService configItemService; |
| | | |
| | | @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 = "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<ConfigItemChange> page(@ApiIgnore @QueryParam QueryFilter 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<ConfigItemChange> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | List<ConfigItemChange> configItemChange = configItemChangeService.page(queryFilter); |
| | | return PageResult.ok(configItemChange); |
| | | } |
| | | |
| | | @GetMapping("getDto") |
| | | @ApiOperation("信息") |
| | | public Result<ConfigItemChangeDto> getDto(Long projectId, Long ChangeId) { |
| | | ConfigItemChangeDto data = configItemChangeService.getDto(projectId, ChangeId); |
| | | if (ChangeId!=null) { |
| | | for (WarehouseConfigItem configItem : data.getConfigItemList()) { |
| | | public Result<ConfigItemChangeDto> getDto(Long projectId, Long changeId) { |
| | | ConfigItemChangeDto data = configItemChangeService.getDto(projectId, changeId); |
| | | if (changeId != null) { |
| | | for (WarehouseConfigItem configItem : data.getConfigChangeList()) { |
| | | Long configItemId = configItem.getId(); |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(configItemId, "config_item_warehouse"); |
| | | if (ossDto != null) { |
| | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody ConfigItemChangeDto configItemDto){ |
| | | public Result insert(@RequestBody ConfigItemChangeDto configItemDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemDto, AddGroup.class, DefaultGroup.class); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "config_item_Change"); |
| | | map.put("projectId",configItemDto.getProjectId().toString()); |
| | | map.put("projectId", configItemDto.getProjectId().toString()); |
| | | configItemDto.getConfigItemChange().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = configItemChangeService.save(configItemDto); |
| | | return Result.ok(); |
| | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody ConfigItemChangeDto configItemDto){ |
| | | public Result update(@RequestBody ConfigItemChangeDto configItemDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configItemDto, UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = configItemChangeService.save(configItemDto); |
| | |
| | | @DeleteMapping("deleteConfigChange") |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids){ |
| | | public Result delete(@RequestBody Long[] ids) { |
| | | //效验数据 |
| | | AssertUtils.isArrayEmpty(ids, "id"); |
| | | configItemChangeService.delete(ids); |
| | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("getItemList") |
| | | @ApiOperation("获取入库配置项列表") |
| | | public PageResult<WarehouseConfigItem> getItemList(Long projectId, String ids, String pageCode) { |
| | | String type = ""; |
| | | if ("demand".equals(pageCode)) { |
| | | type = "1"; |
| | | } else if ("product".equals(pageCode)) { |
| | | type = "2"; |
| | | } |
| | | List<WarehouseConfigItem> resultList = configItemService.warehouseConfigList(projectId, ids, type); |
| | | for (WarehouseConfigItem result : resultList) { |
| | | if (result.getSelectId() != null) { |
| | | Long configItemId = result.getSelectId(); |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(configItemId, "config_item_warehouse"); |
| | | if (ossDto != null) { |
| | | result.setFiles(ossDto); |
| | | } |
| | | } |
| | | } |
| | | return PageResult.ok(resultList); |
| | | } |
| | | |
| | | @GetMapping("exportConfigChange") |
| | | @ApiOperation("打印变更申请单") |
| | | @LogOperation("打印变更申请单") |
| | | public void exportConfigChange(Long id, HttpServletRequest request, HttpServletResponse response) { |
| | | configItemChangeService.exportConfigChange(id, request, response); |
| | | } |
| | | } |