开发流程与工序关系功能

pull/1/head
wangziyangyang 2020-03-17 08:29:52 +08:00
parent 3c48da6ea8
commit bc7877a1e4
5 changed files with 91 additions and 5 deletions

View File

@ -1,9 +1,13 @@
package com.wangziyang.mes.basedata.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.wangziyang.mes.basedata.dto.SpFlowDto;
import com.wangziyang.mes.basedata.entity.SpFlow;
import com.wangziyang.mes.basedata.entity.SpFlowOperRelation;
import com.wangziyang.mes.basedata.entity.SpOper;
import com.wangziyang.mes.basedata.request.SpTableManagerReq;
import com.wangziyang.mes.basedata.service.ISpFlowOperRelationService;
import com.wangziyang.mes.basedata.service.ISpFlowService;
import com.wangziyang.mes.basedata.service.ISpOperService;
import com.wangziyang.mes.basedata.vo.SpOperVo;
@ -13,13 +17,11 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -46,6 +48,11 @@ public class SpFlowOperRelationController extends BaseController {
*/
@Autowired
public ISpOperService iSpOperService;
/**
*
*/
@Autowired
public ISpFlowOperRelationService iSpFlowOperRelationService;
/**
*
@ -106,5 +113,32 @@ public class SpFlowOperRelationController extends BaseController {
return Result.success();
}
/**
* +
*
* @param spFlowDto DTO
* @return
*/
@ApiOperation("主数据表头修改")
@PostMapping("/add-or-update")
@ResponseBody
public Result addOrUpdate(@RequestBody SpFlowDto spFlowDto) throws Exception {
List<SpFlowOperRelation> spFlowOperRelationList = spFlowDto.getSpFlowOperRelationList();
if(CollectionUtil.isEmpty(spFlowOperRelationList))
{
throw new Exception("流程下的工序不能为空");
}
SpFlow spFlow =new SpFlow();
BeanUtils.copyProperties(spFlowDto,spFlow);
//保存流程头表信息
iSpFlowService.saveOrUpdate(spFlow);
iSpFlowOperRelationService.saveOrUpdateBatch(spFlowOperRelationList);
return Result.success();
}
}

View File

@ -0,0 +1,34 @@
package com.wangziyang.mes.basedata.dto;
import com.wangziyang.mes.basedata.entity.SpFlow;
import com.wangziyang.mes.basedata.entity.SpFlowOperRelation;
import java.util.List;
/**
* DTO
*/
public class SpFlowDto extends SpFlow {
/**
*
*/
private List<SpFlowOperRelation> spFlowOperRelationList;
/**
*
*
* @return spFlowOperRelationList
*/
public List<SpFlowOperRelation> getSpFlowOperRelationList() {
return this.spFlowOperRelationList;
}
/**
*
*
* @param spFlowOperRelationList
*/
public void setSpFlowOperRelationList(List<SpFlowOperRelation> spFlowOperRelationList) {
this.spFlowOperRelationList = spFlowOperRelationList;
}
}

View File

@ -1,4 +1,15 @@
package com.wangziyang.mes.basedata.dto;
public class SpFlowOperRelationDto {
import com.wangziyang.mes.basedata.entity.SpFlowOperRelation;
import java.util.List;
/**
* DTO
*
* @author wangziyang
* @since 20200316
*/
public class SpFlowOperRelationDto extends SpFlowOperRelation {
}

View File

@ -5,6 +5,12 @@ import com.wangziyang.mes.basedata.entity.SpTableManagerItem;
import java.util.List;
/**
* DTO
*
* @author wangziyang
* @since 20200316
*/
public class SpTableManagerDto extends SpTableManager {
/**
*

View File

@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISpFlowService extends IService<SpFlow> {
}