| | |
| | | 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.project.dto.SoftwareTestOrderDto; |
| | | import com.zt.life.modules.project.dto.EnvironDto; |
| | | import com.zt.life.modules.project.model.Environ; |
| | | import com.zt.life.modules.project.service.EnvironService; |
| | | import com.zt.life.sys.dto.OssDto; |
| | | import com.zt.life.sys.service.SysOssConfigService; |
| | | import com.zt.modules.coderule.service.SysCodeRuleService; |
| | | import com.zt.modules.oss.model.SysOss; |
| | | import com.zt.modules.oss.service.SysOssService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.swing.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | |
| | | @Autowired |
| | | private SysCodeRuleService sysCodeRuleService; |
| | | |
| | | @Autowired |
| | | private SysOssService sysOssService; |
| | | |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | |
| | | @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 = "code", value = "编号", dataType = Constant.QT.STRING, format = "a.CODE^LK"), |
| | | @ApiImplicitParam(name = "softwareName", value = "软件名称", dataType = Constant.QT.STRING, format = "p.software_name^EQ"),}) |
| | | public PageResult<Environ> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { |
| | | |
| | | return PageResult.ok(environService.page(queryFilter)); |
| | |
| | | |
| | | @GetMapping("getDto") |
| | | @ApiOperation("信息") |
| | | public Result<SoftwareTestOrderDto> getDto(Long environId, Long projectId) { |
| | | SoftwareTestOrderDto data = environService.getDto(environId, projectId); |
| | | if (projectId != null) { |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(projectId, "environ"); |
| | | if (ossDto != null) { |
| | | data.setFiles(ossDto); |
| | | } |
| | | } |
| | | public Result<EnvironDto> getDto(Long environId, Long projectId) { |
| | | EnvironDto data = environService.getDto(environId, projectId); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody SoftwareTestOrderDto softwareTestOrderDto) { |
| | | public Result insert(@RequestBody EnvironDto environDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(softwareTestOrderDto, AddGroup.class, DefaultGroup.class); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | String year = sdf.format(new Date()); |
| | | ValidatorUtils.validateEntity(environDto, AddGroup.class, DefaultGroup.class); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "environ"); |
| | | map.put("year",year); |
| | | softwareTestOrderDto.getEnviron().setYear(year); |
| | | softwareTestOrderDto.getEnviron().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = environService.save(softwareTestOrderDto); |
| | | map.put("projectId",environDto.getProjectId().toString()); |
| | | environDto.getEnviron().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = environService.save(environDto); |
| | | |
| | | return Result.ok(); |
| | | } |
| | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody Environ environ) { |
| | | public Result update(@RequestBody EnvironDto environDto) { |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(environ, UpdateGroup.class, DefaultGroup.class); |
| | | environService.update(environ); |
| | | ValidatorUtils.validateEntity(environDto, UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = environService.save(environDto); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @DeleteMapping("deleteEnviron") |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids) { |
| | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("exportEnviron") |
| | | @ApiOperation("打印测试环境建立确认表") |
| | | @LogOperation("打印测试环境建立确认表") |
| | | public void exportEnviron(Long id, HttpServletRequest request, HttpServletResponse response) { |
| | | environService.exportEnviron(id, request, response); |
| | | } |
| | | } |