Search in sources :

Example 1 with OptimizeTest

use of com.eservice.api.model.optimizeTest.OptimizeTest in project sinsim by WilsonHu.

the class OptimizeTestController method update.

@PostMapping("/update")
public Result update(String jsonOptimizeFormAllInfo) {
    OptimizeTest optimizeTest = JSON.parseObject(jsonOptimizeFormAllInfo, OptimizeTest.class);
    if (optimizeTest == null || optimizeTest.equals("")) {
        return ResultGenerator.genFailResult("JSON数据异常");
    }
    if (optimizeTest.getId() == null) {
        return ResultGenerator.genFailResult("异常,Id为空");
    }
    OptimizeTest optimizeTestOld = optimizeTestService.findById(optimizeTest.getId());
    if (optimizeTestOld == null) {
        return ResultGenerator.genFailResult("异常,根据Id找不到对应的优化");
    }
    optimizeTest.setUpdateDate(new Date());
    optimizeTestService.update(optimizeTest);
    return ResultGenerator.genSuccessResult();
}
Also used : OptimizeTest(com.eservice.api.model.optimizeTest.OptimizeTest) Date(java.util.Date) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with OptimizeTest

use of com.eservice.api.model.optimizeTest.OptimizeTest in project sinsim by WilsonHu.

the class OptimizeTestController method getOptimizeAttachedFile.

/**
 * 根据优化ID 返回 对应的附件的文件名称 下载路径的前面部分是统一的,放在xxx_ip/download/下(nginx配置),
 * 比如,访问下面地址可以下载优化单附件
 * http://xx.xx.xx.xx/optimizeAttached/曹457B__optimize__0.png
 *
 * @param optimizeTestId
 * @return 类似 曹457B__optimize__0.png
 */
@PostMapping("/getOptimizeAttachedFile")
public Result getOptimizeAttachedFile(@RequestParam Integer optimizeTestId) {
    OptimizeTest ot = optimizeTestService.findById(optimizeTestId);
    if (null == ot) {
        return ResultGenerator.genFailResult("根据该 optimizeTestId 找不到对应的联系单");
    }
    if (ot.getFiles() == null) {
        return ResultGenerator.genFailResult("该优化单没有附件");
    }
    String fileName = null;
    fileName = ot.getFiles().substring(optimizeSavedDir.length());
    return ResultGenerator.genSuccessResult(fileName);
}
Also used : OptimizeTest(com.eservice.api.model.optimizeTest.OptimizeTest) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 3 with OptimizeTest

use of com.eservice.api.model.optimizeTest.OptimizeTest in project sinsim by WilsonHu.

the class OptimizeTestController method list.

@PostMapping("/list")
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
    PageHelper.startPage(page, size);
    List<OptimizeTest> list = optimizeTestService.findAll();
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : OptimizeTest(com.eservice.api.model.optimizeTest.OptimizeTest) PageInfo(com.github.pagehelper.PageInfo) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 4 with OptimizeTest

use of com.eservice.api.model.optimizeTest.OptimizeTest in project sinsim by WilsonHu.

the class OptimizeTestController method add.

@PostMapping("/add")
public Result add(String jsonOptimizeFormAllInfo) {
    OptimizeTest optimizeTest = JSON.parseObject(jsonOptimizeFormAllInfo, OptimizeTest.class);
    if (optimizeTest == null || optimizeTest.equals("")) {
        return ResultGenerator.genFailResult("JSON数据异常");
    }
    if (optimizeTest.getOrderNum() == null) {
        return ResultGenerator.genFailResult("异常,getOrderNum 为空");
    }
    optimizeTestService.saveAndGetID(optimizeTest);
    return ResultGenerator.genSuccessResult(optimizeTest.getId());
}
Also used : OptimizeTest(com.eservice.api.model.optimizeTest.OptimizeTest) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 5 with OptimizeTest

use of com.eservice.api.model.optimizeTest.OptimizeTest in project sinsim by WilsonHu.

the class OptimizeTestController method selectOptimizeList.

/**
 * @param projectName
 * @param optimizePart
 * @param orderNum
 * @param queryStartTimeCreate 创建日期
 * @param queryFinishTimeCreate
 * @param machineType
 * @param purpose
 * @param owner
 * @param queryStartTimeUpdate 更新日期
 * @param queryFinishTimeUpdate
 * @return
 */
@PostMapping("/selectOptimizeList")
public Result selectOptimizeList(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, String projectName, String optimizePart, String orderNum, String queryStartTimeCreate, String queryFinishTimeCreate, String machineType, String purpose, String owner, String queryStartTimeUpdate, String queryFinishTimeUpdate) {
    PageHelper.startPage(page, size);
    String strMachineTypeName = null;
    if (machineType != null && !machineType.isEmpty()) {
        MachineType mt = machineTypeService.findById(Integer.valueOf(machineType));
        if (mt != null) {
            strMachineTypeName = mt.getName();
        }
    }
    List<OptimizeTest> list = optimizeTestService.selectOptimizeList(projectName, optimizePart, orderNum, queryStartTimeCreate, queryFinishTimeCreate, strMachineTypeName, purpose, owner, queryStartTimeUpdate, queryFinishTimeUpdate);
    PageInfo pageInfo = new PageInfo(list);
    return ResultGenerator.genSuccessResult(pageInfo);
}
Also used : OptimizeTest(com.eservice.api.model.optimizeTest.OptimizeTest) PageInfo(com.github.pagehelper.PageInfo) MachineType(com.eservice.api.model.machine_type.MachineType) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

OptimizeTest (com.eservice.api.model.optimizeTest.OptimizeTest)5 PostMapping (org.springframework.web.bind.annotation.PostMapping)5 PageInfo (com.github.pagehelper.PageInfo)2 MachineType (com.eservice.api.model.machine_type.MachineType)1 Date (java.util.Date)1