|
|
|
@ -1,54 +1,43 @@ |
|
|
|
|
package org.jeecg.modules.demo.pro.controller; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyClothsComponent; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyProcess; |
|
|
|
|
import org.jeecg.modules.demo.base.mapper.ZyClothsComponentMapper; |
|
|
|
|
import org.jeecg.modules.demo.base.mapper.ZyProcessMapper; |
|
|
|
|
import org.jeecg.modules.demo.base.service.IZyClothsComponentService; |
|
|
|
|
import org.jeecg.modules.demo.base.service.IZyProcessService; |
|
|
|
|
import org.jeecg.modules.demo.pro.entity.NewZyProcessComponent; |
|
|
|
|
import org.jeecg.modules.demo.pro.entity.ZyProcessComponent; |
|
|
|
|
import org.jeecg.modules.demo.pro.mapper.ZyProcessComponentMapper; |
|
|
|
|
import org.jeecg.modules.demo.pro.service.IZyProcessComponentService; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams; |
|
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: zy_process_component |
|
|
|
|
* @Author: jeecg-boot |
|
|
|
|
* @Date: 2021-11-11 |
|
|
|
|
* @Version: V1.0 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags="zy_process_component") |
|
|
|
|
@Api(tags = "zy_process_component") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/pro/zyProcessComponent") |
|
|
|
|
@Slf4j |
|
|
|
@ -59,6 +48,10 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
private IZyProcessService zyProcessService; |
|
|
|
|
@Autowired |
|
|
|
|
private IZyClothsComponentService zyClothsComponentService; |
|
|
|
|
@Resource |
|
|
|
|
private ZyClothsComponentMapper zyClothsComponentMapper; |
|
|
|
|
@Resource |
|
|
|
|
private ZyProcessMapper zyProcessMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
@ -70,11 +63,11 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-分页列表查询") |
|
|
|
|
@ApiOperation(value="zy_process_component-分页列表查询", notes="zy_process_component-分页列表查询") |
|
|
|
|
@ApiOperation(value = "zy_process_component-分页列表查询", notes = "zy_process_component-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<?> queryPageList(ZyProcessComponent zyProcessComponent, |
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
QueryWrapper<ZyProcessComponent> queryWrapper = QueryGenerator.initQueryWrapper(zyProcessComponent, req.getParameterMap()); |
|
|
|
|
Page<ZyProcessComponent> page = new Page<ZyProcessComponent>(pageNo, pageSize); |
|
|
|
@ -86,12 +79,12 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-查询所有") |
|
|
|
|
@ApiOperation(value="zy_process_component-查询所有", notes="zy_process_component-查询所有") |
|
|
|
|
@ApiOperation(value = "zy_process_component-查询所有", notes = "zy_process_component-查询所有") |
|
|
|
|
@GetMapping(value = "/findAll") |
|
|
|
|
public Result<?> findAll() { |
|
|
|
|
List<ZyProcessComponent> list = zyProcessComponentService.list(); |
|
|
|
|
List<NewZyProcessComponent> list1 = new ArrayList<>(); |
|
|
|
|
for (ZyProcessComponent zy : list){ |
|
|
|
|
for (ZyProcessComponent zy : list) { |
|
|
|
|
NewZyProcessComponent newZy = new NewZyProcessComponent(); |
|
|
|
|
String processId = zy.getProcessId(); |
|
|
|
|
String componentId = zy.getComponentId(); |
|
|
|
@ -127,6 +120,7 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
} |
|
|
|
|
return Result.OK(list1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加 |
|
|
|
|
* |
|
|
|
@ -134,7 +128,7 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-添加") |
|
|
|
|
@ApiOperation(value="zy_process_component-添加", notes="zy_process_component-添加") |
|
|
|
|
@ApiOperation(value = "zy_process_component-添加", notes = "zy_process_component-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody ZyProcessComponent zyProcessComponent) { |
|
|
|
|
zyProcessComponentService.save(zyProcessComponent); |
|
|
|
@ -148,7 +142,7 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-编辑") |
|
|
|
|
@ApiOperation(value="zy_process_component-编辑", notes="zy_process_component-编辑") |
|
|
|
|
@ApiOperation(value = "zy_process_component-编辑", notes = "zy_process_component-编辑") |
|
|
|
|
@PutMapping(value = "/edit") |
|
|
|
|
public Result<?> edit(@RequestBody ZyProcessComponent zyProcessComponent) { |
|
|
|
|
zyProcessComponentService.updateById(zyProcessComponent); |
|
|
|
@ -162,9 +156,9 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-通过id删除") |
|
|
|
|
@ApiOperation(value="zy_process_component-通过id删除", notes="zy_process_component-通过id删除") |
|
|
|
|
@ApiOperation(value = "zy_process_component-通过id删除", notes = "zy_process_component-通过id删除") |
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
zyProcessComponentService.removeById(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
@ -176,9 +170,9 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-批量删除") |
|
|
|
|
@ApiOperation(value="zy_process_component-批量删除", notes="zy_process_component-批量删除") |
|
|
|
|
@ApiOperation(value = "zy_process_component-批量删除", notes = "zy_process_component-批量删除") |
|
|
|
|
@DeleteMapping(value = "/deleteBatch") |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|
|
|
|
this.zyProcessComponentService.removeByIds(Arrays.asList(ids.split(","))); |
|
|
|
|
return Result.OK("批量删除成功!"); |
|
|
|
|
} |
|
|
|
@ -190,13 +184,31 @@ public class ZyProcessComponentController extends JeecgController<ZyProcessCompo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "zy_process_component-通过id查询") |
|
|
|
|
@ApiOperation(value="zy_process_component-通过id查询", notes="zy_process_component-通过id查询") |
|
|
|
|
@ApiOperation(value = "zy_process_component-通过id查询", notes = "zy_process_component-通过id查询") |
|
|
|
|
@GetMapping(value = "/queryById") |
|
|
|
|
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
ZyProcessComponent zyProcessComponent = zyProcessComponentService.getById(id); |
|
|
|
|
if(zyProcessComponent==null) { |
|
|
|
|
|
|
|
|
|
if (zyProcessComponent == null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
//部件名称
|
|
|
|
|
String componentId = zyProcessComponent.getComponentId(); |
|
|
|
|
String componentNameById = zyClothsComponentMapper.getComponentNameById(componentId); |
|
|
|
|
zyProcessComponent.setComponentId(componentNameById); |
|
|
|
|
//工序名称
|
|
|
|
|
String processId = zyProcessComponent.getProcessId(); |
|
|
|
|
String processNameById = zyProcessMapper.getProcessNameById(processId); |
|
|
|
|
zyProcessComponent.setProcessId(processNameById); |
|
|
|
|
//瓶颈工序
|
|
|
|
|
String bottleneck = zyProcessComponent.getBottleneck(); |
|
|
|
|
if (bottleneck.equals("1")) { |
|
|
|
|
zyProcessComponent.setBottleneck("是"); |
|
|
|
|
} else if (bottleneck.equals("2")) { |
|
|
|
|
zyProcessComponent.setBottleneck("否"); |
|
|
|
|
} else { |
|
|
|
|
zyProcessComponent.setBottleneck("可能为空或出错了"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(zyProcessComponent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|