From d9e69f5333ed3ff60aa2d98fd5e982c9bf4de9dc Mon Sep 17 00:00:00 2001 From: wente <329538422@qq.com> Date: 星期二, 14 十一月 2023 15:37:22 +0800 Subject: [PATCH] 项目表 --- modules/mainPart/src/main/java/com/zt/life/modules/project/controller/SoftwareTestOrderController.java | 78 +++++++++++++++++++++++---------------- 1 files changed, 46 insertions(+), 32 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/project/controller/SoftwareTestOrderController.java b/modules/mainPart/src/main/java/com/zt/life/modules/project/controller/SoftwareTestOrderController.java index b74ea00..d362da1 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/project/controller/SoftwareTestOrderController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/project/controller/SoftwareTestOrderController.java @@ -12,72 +12,78 @@ 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.ProjectDto; +import com.zt.life.modules.project.dto.SoftwareTestOrderDto; +import com.zt.life.modules.project.model.Project; import com.zt.life.modules.project.model.SoftwareTestOrder; +import com.zt.life.modules.project.model.SoftwareTestOrderDeliverable; +import com.zt.life.modules.project.model.SoftwareTestOrderMeasured; import com.zt.life.modules.project.service.ProjectService; import com.zt.life.modules.project.service.SoftwareTestOrderDeliverableService; import com.zt.life.modules.project.service.SoftwareTestOrderMeasuredService; import com.zt.life.modules.project.service.SoftwareTestOrderService; -import com.zt.life.modules.sysBaseInfo.model.TestAgencyInfo; import com.zt.life.modules.sysBaseInfo.service.TestAgencyInfoService; +import com.zt.modules.coderule.service.SysCodeRuleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * software_test_order * - * @author zt generator + * @author zt generator * @since 1.0.0 2023-11-08 */ @RestController @RequestMapping("/project/SoftwareTestOrder/") -@Api(tags="software_test_order") +@Api(tags = "software_test_order") public class SoftwareTestOrderController { @Autowired - private ProjectService projectService; - @Autowired private SoftwareTestOrderService softwareTestOrderService; + + @Autowired + private ProjectService projectService; @Autowired private SoftwareTestOrderDeliverableService softwareTestOrderDeliverableService; @Autowired private SoftwareTestOrderMeasuredService softwareTestOrderMeasuredService; @Autowired private TestAgencyInfoService testAgencyInfoService; + @Autowired + private SysCodeRuleService sysCodeRuleService; @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 = "testBasis", value = "娴嬭瘯渚濇嵁", dataType = Constant.QT.STRING, format = "test_basis^EQ"), - @ApiImplicitParam(name = "testType", value = "娴嬭瘯绫诲瀷", dataType = Constant.QT.STRING, format = "test_type^EQ"), - @ApiImplicitParam(name = "testStandard", value = "娴嬭瘯鏍囧噯", dataType = Constant.QT.STRING, format = "test_standard^EQ"), - @ApiImplicitParam(name = "articleNature", value = "鐗╁搧鎬ц川", dataType = Constant.QT.STRING, format = "article_nature^EQ")}) - public PageResult<SoftwareTestOrder> 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 = "testBasis", value = "娴嬭瘯渚濇嵁", dataType = Constant.QT.STRING, format = "test_basis^EQ"), + @ApiImplicitParam(name = "testType", value = "娴嬭瘯绫诲瀷", dataType = Constant.QT.STRING, format = "test_type^EQ"), + @ApiImplicitParam(name = "testStandard", value = "娴嬭瘯鏍囧噯", dataType = Constant.QT.STRING, format = "test_standard^EQ"), + @ApiImplicitParam(name = "articleNature", value = "鐗╁搧鎬ц川", dataType = Constant.QT.STRING, format = "article_nature^EQ")}) + public PageResult<SoftwareTestOrder> page(@ApiIgnore @QueryParam QueryFilter queryFilter) { return PageResult.ok(softwareTestOrderService.page(queryFilter)); } - @GetMapping("{id}") + @GetMapping("getDto") @ApiOperation("淇℃伅") - public Result<ProjectDto> get(@PathVariable("id") Long id){ - ProjectDto data = new ProjectDto(); - SoftwareTestOrder softwareTestOrder = softwareTestOrderService.get(id); - data.setSoftwareTestOrder(softwareTestOrder); - data.setProject(projectService.get(softwareTestOrder.getProjectId())); - data.setTestAgencyInfo(testAgencyInfoService.get(softwareTestOrder.getAgencyId())); - data.setChildrenTable2(softwareTestOrderDeliverableService.childrenTables(softwareTestOrder.getId())); - data.setChildrenTable1(softwareTestOrderMeasuredService.childrenTables(softwareTestOrder.getId())); + public Result<SoftwareTestOrderDto> getDto(Long projectId,Long orderId) { + SoftwareTestOrderDto data = softwareTestOrderService.getDto(orderId, projectId); return Result.ok(data); } @@ -85,29 +91,31 @@ @PostMapping @ApiOperation("鏂板") @LogOperation("鏂板") - public Result insert(@RequestBody SoftwareTestOrder softwareTestOrder){ + public Result insert(@RequestBody SoftwareTestOrderDto softwareTestOrderDto) { //鏁堥獙鏁版嵁 - ValidatorUtils.validateEntity(softwareTestOrder, AddGroup.class, DefaultGroup.class); - softwareTestOrderService.insert(softwareTestOrder); + ValidatorUtils.validateEntity(softwareTestOrderDto.getSoftwareTestOrder(), AddGroup.class, DefaultGroup.class); + Map<String,String> map = new HashMap<>(); + map.put("funCode","software_test_order"); + softwareTestOrderDto.getSoftwareTestOrder().setCode(sysCodeRuleService.getNewCode(map)); + Boolean result = softwareTestOrderService.save(softwareTestOrderDto); return Result.ok(); } @PutMapping @ApiOperation("淇敼") @LogOperation("淇敼") - public Result update(@RequestBody SoftwareTestOrder softwareTestOrder){ + public Result update(@RequestBody SoftwareTestOrderDto softwareTestOrderDtor) { //鏁堥獙鏁版嵁 - ValidatorUtils.validateEntity(softwareTestOrder, UpdateGroup.class, DefaultGroup.class); - softwareTestOrderService.update(softwareTestOrder); - + ValidatorUtils.validateEntity(softwareTestOrderDtor.getSoftwareTestOrder(), UpdateGroup.class, DefaultGroup.class); + Boolean result = softwareTestOrderService.save(softwareTestOrderDtor); return Result.ok(); } @DeleteMapping @ApiOperation("鍒犻櫎") @LogOperation("鍒犻櫎") - public Result delete(@RequestBody Long[] ids){ + public Result delete(@RequestBody Long[] ids) { //鏁堥獙鏁版嵁 AssertUtils.isArrayEmpty(ids, "id"); softwareTestOrderService.delete(ids); @@ -115,4 +123,10 @@ return Result.ok(); } + @GetMapping("exportWord/{id}") + @ApiOperation("鎵撳嵃娴嬭瘯濮旀墭鍗�") + @LogOperation("鎵撳嵃娴嬭瘯濮旀墭鍗�") + public void exportWord(@PathVariable("id") Long id, HttpServletRequest request, HttpServletResponse response) { + softwareTestOrderService.exportWord(id, request, response); + } } -- Gitblit v1.9.1