Search in sources :

Example 1 with Abnormal

use of com.eservice.api.model.abnormal.Abnormal in project sinsim by WilsonHu.

the class AbnormalController method list.

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

Example 2 with Abnormal

use of com.eservice.api.model.abnormal.Abnormal in project sinsim by WilsonHu.

the class AbnormalRecordController method updateAbnormalRecordDetail.

/**
 * 根据传入的strAbnormalRecordDetail,更新对应多表:
 * "machine_id":"", --> machine.machine_id
 * "安装是否异常":"", --> task_record.status  task状态,“1”==>未开始, “2”==>进行中,“3”==>安装完成, “4”==>质检完成,“5“===>异常
 * "异常类型":"",	--> abnormal_record.abnormal_type
 * "异常原因":"", --> abnormal_record.comment
 * "异常照片":"", -->abnormal_image.image
 * "安装完成":"",  -->   task_record.status或machine.status都可以,反正这两个表都更新
 * 注意:有外键的字段,需要上传实际存在的外键数据。
 * 一项update失败的情况下,全部update无效(事务OK)
 *
 * @param strAbnormalRecordDetail
 * @return
 */
@PostMapping("/updateAbnormalRecordDetail")
@Transactional
public Result updateAbnormalRecordDetail(@RequestParam String strAbnormalRecordDetail) {
    // 获取整体detail
    AbnormalRecordDetail abnormalRecordDetail1 = JSON.parseObject(strAbnormalRecordDetail, AbnormalRecordDetail.class);
    Integer abnormalRecordDetail_ID = abnormalRecordDetail1.getId();
    AbnormalRecord abnormalRecord = abnormalRecordService.findById(abnormalRecordDetail_ID);
    abnormalRecord.setAbnormalType(abnormalRecordDetail1.getAbnormalType());
    abnormalRecord.setTaskRecordId(abnormalRecordDetail1.getTaskRecordId());
    abnormalRecord.setSubmitUser(abnormalRecordDetail1.getSubmitUser());
    abnormalRecord.setSolutionUser(abnormalRecordDetail1.getSolutionUser());
    abnormalRecord.setComment(abnormalRecordDetail1.getComment());
    abnormalRecord.setSolution(abnormalRecordDetail1.getSolution());
    Abnormal abnormal = abnormalRecordDetail1.getAbnormal();
    AbnormalImage abnormalImage = abnormalRecordDetail1.getAbnormalImage();
    TaskRecord taskRecord = abnormalRecordDetail1.getTaskRecord();
    Machine machine = abnormalRecordDetail1.getMachine();
    abnormalRecordService.update(abnormalRecord);
    abnormalService.update(abnormal);
    abnormalImageService.update(abnormalImage);
    taskRecordService.update(taskRecord);
    machineService.update(machine);
    return ResultGenerator.genSuccessResult();
}
Also used : TaskRecord(com.eservice.api.model.task_record.TaskRecord) AbnormalRecord(com.eservice.api.model.abnormal_record.AbnormalRecord) AbnormalImage(com.eservice.api.model.abnormal_image.AbnormalImage) AbnormalRecordDetail(com.eservice.api.model.abnormal_record.AbnormalRecordDetail) Abnormal(com.eservice.api.model.abnormal.Abnormal) Machine(com.eservice.api.model.machine.Machine) PostMapping(org.springframework.web.bind.annotation.PostMapping) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Abnormal (com.eservice.api.model.abnormal.Abnormal)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 AbnormalImage (com.eservice.api.model.abnormal_image.AbnormalImage)1 AbnormalRecord (com.eservice.api.model.abnormal_record.AbnormalRecord)1 AbnormalRecordDetail (com.eservice.api.model.abnormal_record.AbnormalRecordDetail)1 Machine (com.eservice.api.model.machine.Machine)1 TaskRecord (com.eservice.api.model.task_record.TaskRecord)1 PageInfo (com.github.pagehelper.PageInfo)1 Transactional (org.springframework.transaction.annotation.Transactional)1