|
@ -1,38 +1,41 @@ |
|
|
package com.win.module.wms.controller.inspectJob; |
|
|
package com.win.module.wms.controller.inspectJob; |
|
|
|
|
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
|
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
import com.win.module.wms.controller.inspectJob.vo.*; |
|
|
import com.win.module.wms.controller.inspectJob.vo.*; |
|
|
import com.win.module.wms.convert.inspectJob.InspectJobDetailConvert; |
|
|
import com.win.module.wms.convert.inspectJob.InspectJobDetailConvert; |
|
|
|
|
|
import com.win.module.wms.convert.inspectJob.InspectJobMainConvert; |
|
|
import com.win.module.wms.dal.dataobject.inspectJob.InspectJobDetailDO; |
|
|
import com.win.module.wms.dal.dataobject.inspectJob.InspectJobDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.inspectJob.InspectJobMainDO; |
|
|
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
|
|
import com.win.module.wms.enums.job.JobStatusEnum; |
|
|
import com.win.module.wms.service.inspectJob.InspectJobDetailService; |
|
|
import com.win.module.wms.service.inspectJob.InspectJobDetailService; |
|
|
|
|
|
import com.win.module.wms.service.inspectJob.InspectJobMainService; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
import jodd.util.StringUtil; |
|
|
import jodd.util.StringUtil; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.*; |
|
|
import javax.annotation.Resource; |
|
|
import javax.servlet.http.*; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.util.*; |
|
|
import javax.validation.Valid; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
import com.win.framework.excel.core.util.ExcelUtils; |
|
|
|
|
|
|
|
|
|
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
|
|
|
|
|
|
|
|
|
|
|
import com.win.module.wms.dal.dataobject.inspectJob.InspectJobMainDO; |
|
|
|
|
|
import com.win.module.wms.convert.inspectJob.InspectJobMainConvert; |
|
|
|
|
|
import com.win.module.wms.service.inspectJob.InspectJobMainService; |
|
|
|
|
|
|
|
|
|
|
|
@Tag(name = "管理后台 - 检验任务主") |
|
|
@Tag(name = "管理后台 - 检验任务主") |
|
|
@RestController |
|
|
@RestController |
|
@ -49,48 +52,6 @@ public class InspectJobMainController { |
|
|
@Resource |
|
|
@Resource |
|
|
private AdminUserApi userApi; |
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
|
|
|
@Operation(summary = "创建检验任务主") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:create')") |
|
|
|
|
|
public CommonResult<Long> createInspectJobMain(@Valid @RequestBody InspectJobMainCreateReqVO createReqVO) { |
|
|
|
|
|
return success(inspectJobMainService.createInspectJobMain(createReqVO)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PutMapping("/update") |
|
|
|
|
|
@Operation(summary = "更新检验任务主") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:update')") |
|
|
|
|
|
public CommonResult<Boolean> updateInspectJobMain(@Valid @RequestBody InspectJobMainUpdateReqVO updateReqVO) { |
|
|
|
|
|
inspectJobMainService.updateInspectJobMain(updateReqVO); |
|
|
|
|
|
return success(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/delete") |
|
|
|
|
|
@Operation(summary = "删除检验任务主") |
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:delete')") |
|
|
|
|
|
public CommonResult<Boolean> deleteInspectJobMain(@RequestParam("id") Long id) { |
|
|
|
|
|
inspectJobMainService.deleteInspectJobMain(id); |
|
|
|
|
|
return success(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/get") |
|
|
|
|
|
@Operation(summary = "获得检验任务主") |
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:query')") |
|
|
|
|
|
public CommonResult<InspectJobMainRespVO> getInspectJobMain(@RequestParam("id") Long id) { |
|
|
|
|
|
InspectJobMainDO inspectJobMain = inspectJobMainService.getInspectJobMain(id); |
|
|
|
|
|
return success(InspectJobMainConvert.INSTANCE.convert(inspectJobMain)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
|
|
@Operation(summary = "获得检验任务主列表") |
|
|
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:query')") |
|
|
|
|
|
public CommonResult<List<InspectJobMainRespVO>> getInspectJobMainList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
|
|
List<InspectJobMainDO> list = inspectJobMainService.getInspectJobMainList(ids); |
|
|
|
|
|
return success(InspectJobMainConvert.INSTANCE.convertList(list)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
@GetMapping("/page") |
|
|
@Operation(summary = "获得检验任务主分页") |
|
|
@Operation(summary = "获得检验任务主分页") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:query')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:query')") |
|
@ -112,21 +73,66 @@ public class InspectJobMainController { |
|
|
} |
|
|
} |
|
|
return success(result); |
|
|
return success(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
@GetMapping("/export-excel") |
|
|
@Operation(summary = "导出检验任务主 Excel") |
|
|
@Operation(summary = "导出检验任务主 Excel") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:export')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:export')") |
|
|
@OperateLog(type = EXPORT) |
|
|
@OperateLog(type = EXPORT) |
|
|
public void exportInspectJobMainExcel(@Valid InspectJobMainExportReqVO exportReqVO, |
|
|
public void exportInspectJobMainExcel(@Valid InspectJobMainExportReqVO exportReqVO, HttpServletResponse response) throws IOException { |
|
|
HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<InspectJobMainDO> list = inspectJobMainService.getInspectJobMainList(exportReqVO); |
|
|
List<InspectJobMainDO> list = inspectJobMainService.getInspectJobMainList(exportReqVO); |
|
|
// 导出 Excel
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
List<InspectJobMainExcelVO> datas = InspectJobMainConvert.INSTANCE.convertList02(list); |
|
|
List<InspectJobMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
for(InspectJobMainExcelVO vo : datas) { |
|
|
ExcelUtils.write(response, "检验任务主.xls", "数据", InspectJobMainExcelVO.class, resultList, mapDropDown); |
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
} |
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
@GetMapping("/export-excel-senior") |
|
|
|
|
|
@Operation(summary = "导出检验任务主 Excel") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:export')") |
|
|
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
|
|
public void exportInspectJobMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<InspectJobMainDO> list = inspectJobMainService.getInspectJobMainList(conditions); |
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<InspectJobMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
ExcelUtils.write(response, "检验任务主.xls", "数据", InspectJobMainExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<InspectJobMainExcelVO> getExcelVo(List<InspectJobMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
|
|
//组装vo
|
|
|
|
|
|
String[] status = JobStatusEnum.getStatusNameArray(); |
|
|
|
|
|
mapDropDown.put(6, status); |
|
|
|
|
|
String[] transferMode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRANSFER_MODE); |
|
|
|
|
|
mapDropDown.put(6, transferMode); |
|
|
|
|
|
String[] inspectType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INSPECT_TYPE); |
|
|
|
|
|
mapDropDown.put(24, inspectType); |
|
|
|
|
|
String[] nextAction = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.NEXT_ACTION); |
|
|
|
|
|
mapDropDown.put(25, nextAction); |
|
|
|
|
|
String[] sampleMethod = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.SAMPLE_METHOD); |
|
|
|
|
|
mapDropDown.put(26, sampleMethod); |
|
|
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
|
|
mapDropDown.put(27, uom); |
|
|
|
|
|
String[] trueFalse = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
|
|
mapDropDown.put(31, trueFalse); |
|
|
|
|
|
mapDropDown.put(32, trueFalse); |
|
|
|
|
|
mapDropDown.put(33, trueFalse); |
|
|
|
|
|
mapDropDown.put(34, trueFalse); |
|
|
|
|
|
mapDropDown.put(35, trueFalse); |
|
|
|
|
|
mapDropDown.put(36, trueFalse); |
|
|
|
|
|
mapDropDown.put(37, trueFalse); |
|
|
|
|
|
mapDropDown.put(38, trueFalse); |
|
|
|
|
|
mapDropDown.put(39, trueFalse); |
|
|
|
|
|
mapDropDown.put(40, trueFalse); |
|
|
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
|
|
mapDropDown.put(43, inventoryStatus); |
|
|
|
|
|
List<InspectJobMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
|
|
// 导出
|
|
|
|
|
|
for(InspectJobMainDO mainDO : list) { |
|
|
|
|
|
List<InspectJobDetailDO> subList = inspectJobDetailService.selectList(mainDO.getId()); |
|
|
|
|
|
for(InspectJobDetailDO detailDO : subList) { |
|
|
|
|
|
InspectJobMainExcelVO vo = InspectJobMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
|
|
resultList.add(vo); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
ExcelUtils.write(response, "检验任务主.xls", "数据", InspectJobMainExcelVO.class, datas); |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/getInspectJobById") |
|
|
@GetMapping("/getInspectJobById") |
|
@ -184,4 +190,29 @@ public class InspectJobMainController { |
|
|
return success(countByStatus); |
|
|
return success(countByStatus); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "承接任务") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:accept')") |
|
|
|
|
|
@PostMapping(value = "/accept/{id}") |
|
|
|
|
|
public CommonResult<Boolean> accept(@PathVariable("id") Long id) { |
|
|
|
|
|
int result = inspectJobMainService.accept(id); |
|
|
|
|
|
return success(result > 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "取消承接任务") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:cancel-accept')") |
|
|
|
|
|
@PostMapping(value = "/cancelAccept/{id}") |
|
|
|
|
|
public CommonResult<Boolean> cancelAccept(@PathVariable("id") Long id) { |
|
|
|
|
|
int result = inspectJobMainService.cancelAccept(id); |
|
|
|
|
|
return success(result > 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PutMapping("/execute") |
|
|
|
|
|
@Operation(summary = "执行任务") |
|
|
|
|
|
@Parameter(name = "id", description = "编号", required = true) |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inspect-job-main:execute')") |
|
|
|
|
|
public CommonResult<Boolean> excute(@Valid @RequestBody InspectJobMainUpdateReqVO updateReqVO) { |
|
|
|
|
|
Integer count = inspectJobMainService.excute(updateReqVO); |
|
|
|
|
|
return success(count > 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|