|
@@ -0,0 +1,313 @@
|
|
|
+package net.lab1024.sa.admin.module.gm.audit.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.domain.from.EditAuditRepairFrom;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.domain.from.editAuditCancelFrom;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.domain.from.editAuditFlowCompeletedFrom;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.domain.vo.AuditVo;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.domain.vo.ManHourVo;
|
|
|
+import net.lab1024.sa.admin.module.gm.audit.service.AuditService;
|
|
|
+import net.lab1024.sa.admin.module.gm.common.service.CommonService;
|
|
|
+import net.lab1024.sa.admin.module.gm.eq.domain.from.EquipmentQueryFrom;
|
|
|
+import net.lab1024.sa.admin.module.gm.eq.domain.vo.EquipmentBindDetailsVo;
|
|
|
+import net.lab1024.sa.admin.module.gm.maintain.domain.vo.MaintainDetailsVo;
|
|
|
+import net.lab1024.sa.admin.module.gm.partapply.domain.vo.BigPartapplyVo;
|
|
|
+import net.lab1024.sa.admin.module.gm.partapply.service.PartapplyService;
|
|
|
+import net.lab1024.sa.admin.module.gm.repair.service.RepairService;
|
|
|
+import net.lab1024.sa.admin.module.system.menu.domain.vo.MenuVO;
|
|
|
+import net.lab1024.sa.admin.module.system.menu.service.MenuService;
|
|
|
+import net.lab1024.sa.common.common.annoation.NoNeedLogin;
|
|
|
+import net.lab1024.sa.common.common.domain.EquipmentAddResponse;
|
|
|
+import net.lab1024.sa.common.common.domain.ResponseDTO;
|
|
|
+import net.lab1024.sa.common.common.util.SmartPageUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@Api(tags = "审核")
|
|
|
+@RequestMapping("/authdata")
|
|
|
+public class AuditController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RepairService repairService;
|
|
|
+ @Autowired
|
|
|
+ private AuditService auditService;
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+ @Autowired
|
|
|
+ private PartapplyService partapplyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MenuService menuService;
|
|
|
+
|
|
|
+ @GetMapping("/audit/list")
|
|
|
+
|
|
|
+ @ApiOperation("审核列表")
|
|
|
+ public ResponseDTO<List<AuditVo>> GetAuditList(@RequestParam int pageNum, @RequestParam int pageSize, @RequestParam int pastureId, @RequestParam(required = false, defaultValue = "") String eqCodeOrName, @RequestParam(required = false, defaultValue = "") String status, @RequestParam(required = false, defaultValue = "") String auditType, @RequestParam(required = false, defaultValue = "") String pick, @RequestParam(required = false, defaultValue = "") String code, @RequestParam(required = false, defaultValue = "") String sapCode, @RequestParam(required = false, defaultValue = "") String startDate, @RequestParam(required = false, defaultValue = "") String endDate, @RequestParam(required = false, defaultValue = "") String empId) {
|
|
|
+
|
|
|
+ if (auditType.equals("-1")) {
|
|
|
+ auditType = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> auditTypeList = new ArrayList<>();
|
|
|
+ List<MenuVO> menuList = menuService.getMenuEmp(Integer.parseInt(empId));
|
|
|
+ for (MenuVO menuVO : menuList) {
|
|
|
+ if (menuVO.getMenuId() == 223) {
|
|
|
+ auditTypeList.add("1");
|
|
|
+ } else if (menuVO.getMenuId() == 224) {
|
|
|
+ auditTypeList.add("3");
|
|
|
+ } else if (menuVO.getMenuId() == 222) {
|
|
|
+ auditTypeList.add("0");
|
|
|
+ } else {
|
|
|
+ auditTypeList.add("-1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(auditType);
|
|
|
+
|
|
|
+ String authAuditType = String.join(",", auditTypeList);
|
|
|
+ System.out.println(authAuditType);
|
|
|
+ EquipmentQueryFrom page = new EquipmentQueryFrom();
|
|
|
+ page.setPageNum(pageNum);
|
|
|
+ page.setPageSize(pageSize);
|
|
|
+ Page pageParam = SmartPageUtil.convert2PageQuery(page);
|
|
|
+ List<AuditVo> auditList = auditService.GetAuditList(pageParam, "", "", "2", status, eqCodeOrName,
|
|
|
+ auditType, pastureId, pick, code, sapCode, startDate, endDate, authAuditType,"");
|
|
|
+ int count = auditService.GetAuditListCount("", "", "2", status, eqCodeOrName, auditType, pastureId,
|
|
|
+ pick, code, sapCode, startDate, endDate, authAuditType,"");
|
|
|
+ ResponseDTO t = ResponseDTO.ok(auditList);
|
|
|
+ t.setCount(count);
|
|
|
+ t.setCode(200);
|
|
|
+ t.setPageSize(pageSize);
|
|
|
+ t.setPageNum(pageNum);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/audit/edit")
|
|
|
+
|
|
|
+ @ApiOperation("审核")
|
|
|
+ public ResponseDTO<Boolean> editAuditFlowCompeleted(@RequestBody editAuditFlowCompeletedFrom from) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ boolean status = false;
|
|
|
+ try {
|
|
|
+
|
|
|
+ String statusStr = "P10";
|
|
|
+ if (from.getStatus().equals(1)) {
|
|
|
+ statusStr = "P30";
|
|
|
+ } else if (from.getStatus().equals(2)) {
|
|
|
+ statusStr = "P21";
|
|
|
+ }
|
|
|
+ AuditVo auditInfo = auditService.getAudit(from.getCode());
|
|
|
+ if (from.getFlowCompeleted() > 2) {
|
|
|
+ from.setOneAudit(auditInfo.getOneAudit());
|
|
|
+ from.setOneAuditTime(auditInfo.getOneAuditTime());
|
|
|
+ from.setOneAuditName(auditInfo.getOneAuditName());
|
|
|
+ }
|
|
|
+ if (from.getFlowCompeleted() > 4) {
|
|
|
+ from.setTwoAuditName(auditInfo.getTwoAuditName());
|
|
|
+ from.setTwoAudit(auditInfo.getTwoAudit());
|
|
|
+ from.setTwoAuditTime(auditInfo.getTwoAuditTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!from.getStatus().equals(0)) {
|
|
|
+ if (from.getAuditType().equals(0)) {
|
|
|
+ MaintainDetailsVo wxRepair = repairService.GetRepairDetails(from.getCode(), "");
|
|
|
+ EquipmentAddResponse res = commonService.editSapBXPush(from.getCode(), wxRepair.getOutsource(), wxRepair.getIsOutsource(), wxRepair.getPrice_unit(), statusStr);
|
|
|
+ if (res != null) {
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else if (from.getAuditType().equals(1)) {
|
|
|
+ status = auditService.editAuditFlowCompeleted(from);
|
|
|
+
|
|
|
+ BigPartapplyVo bigpartapply = partapplyService.getBigPartapply(from.getCode());
|
|
|
+ MaintainDetailsVo wxRepair = repairService.GetRepairDetails(bigpartapply.getRuCode(), "");
|
|
|
+ System.out.println();
|
|
|
+ EquipmentAddResponse res = commonService.editSapBXPush(bigpartapply.getRuCode(), wxRepair.getOutsource(), wxRepair.getIsOutsource(), wxRepair.getPrice_unit(), "");
|
|
|
+ if (res != null) {
|
|
|
+ from.setStatus(0);
|
|
|
+ status = auditService.editAuditFlowCompeleted(from);
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+ } else if (from.getAuditType().equals(2)) {
|
|
|
+ EquipmentAddResponse res = commonService.editSapBYPush(from.getCode(), auditInfo.getSapCode(), statusStr);
|
|
|
+ if (res != null) {
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else if (from.getAuditType().equals(3)) {
|
|
|
+ status = auditService.editAuditFlowCompeleted(from);
|
|
|
+ EquipmentAddResponse res = commonService.editSapBYPush(from.getCode(), auditInfo.getSapCode(), statusStr);
|
|
|
+ if (res != null) {
|
|
|
+ from.setStatus(0);
|
|
|
+ status = auditService.editAuditFlowCompeleted(from);
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ status = auditService.editAuditFlowCompeleted(from);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if (!status) {
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok();
|
|
|
+ t.setCode(200);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/audit")
|
|
|
+
|
|
|
+ @ApiOperation("审核详情")
|
|
|
+ public ResponseDTO<AuditVo> GetAuditList(@RequestParam(required = false, defaultValue = "") String code) {
|
|
|
+ ResponseDTO t = ResponseDTO.ok(auditService.getAudit(code));
|
|
|
+ t.setCode(200);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/audit/repair/edit")
|
|
|
+
|
|
|
+ @ApiOperation("报修关单")
|
|
|
+ public ResponseDTO editAuditRepair(@RequestBody EditAuditRepairFrom from) {
|
|
|
+ ResponseDTO t = ResponseDTO.ok();
|
|
|
+ boolean status = auditService.editAuditRepair(from.getCode());
|
|
|
+ if (!status) {
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg("修改失败!");
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+ t.setCode(200);
|
|
|
+ t.setMsg("修改成功!");
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * @param pastureId
|
|
|
+ * @param eqName 设备名称
|
|
|
+ * @param startTime 报修日期
|
|
|
+ * @param endTime 报修日期
|
|
|
+ * @param startPick 接单日期
|
|
|
+ * @param endPick 接单日期
|
|
|
+ * @param startCompletion 完成日期
|
|
|
+ * @param endCompletion 完成日期
|
|
|
+ * @param startAudit 审核日期
|
|
|
+ * @param endAudit 审核日期
|
|
|
+ */
|
|
|
+ @GetMapping("/audit/manhour/list")
|
|
|
+
|
|
|
+ @ApiOperation("PC维修工时列表")
|
|
|
+ public ResponseDTO<List<ManHourVo>> getManHour(@RequestParam int pageNum, @RequestParam int pageSize, @RequestParam(required = false, defaultValue = "") String pastureId, @RequestParam(required = false, defaultValue = "") String eqName, @RequestParam(required = false, defaultValue = "") String startTime, @RequestParam(required = false, defaultValue = "") String endTime, @RequestParam(required = false, defaultValue = "") String startPick, @RequestParam(required = false, defaultValue = "") String endPick, @RequestParam(required = false, defaultValue = "") String startCompletion, @RequestParam(required = false, defaultValue = "") String endCompletion, @RequestParam(required = false, defaultValue = "") String startAudit, @RequestParam(required = false, defaultValue = "") String endAudit, @RequestParam(required = false, defaultValue = "") String repairPerson) {
|
|
|
+ EquipmentQueryFrom page = new EquipmentQueryFrom();
|
|
|
+ page.setPageNum(pageNum);
|
|
|
+ page.setPageSize(pageSize);
|
|
|
+ Page pageParam = SmartPageUtil.convert2PageQuery(page);
|
|
|
+ List<ManHourVo> manHourVoList = auditService.getManHour(pageParam, pastureId, eqName, startTime, endTime, startPick, endPick, startCompletion, endCompletion, startAudit, endAudit, repairPerson);
|
|
|
+ int count = auditService.getManHourCount(pastureId, eqName, startTime, endTime, startPick, endPick, startCompletion, endCompletion, startAudit, endAudit, repairPerson);
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ for (ManHourVo manHourVo : manHourVoList) {
|
|
|
+ i++;
|
|
|
+ manHourVo.setNumber((pageNum - 1) * pageSize + i);
|
|
|
+ }
|
|
|
+
|
|
|
+ ResponseDTO t = ResponseDTO.ok(manHourVoList);
|
|
|
+ t.setCount(count);
|
|
|
+ t.setCode(200);
|
|
|
+ t.setPageSize(pageSize);
|
|
|
+ t.setPageNum(pageNum);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/audit/edit/cancel")
|
|
|
+
|
|
|
+ @ApiOperation("审核取消")
|
|
|
+ public ResponseDTO<Boolean> editAuditCancel(@RequestBody editAuditCancelFrom from) throws Exception {
|
|
|
+ if (from.getAuditType().equals(0)) {
|
|
|
+ MaintainDetailsVo wxRepair = repairService.GetRepairDetails(from.getCode(), "");
|
|
|
+ EquipmentAddResponse res = commonService.editSapBXPush(from.getCode(), wxRepair.getOutsource(), wxRepair.getIsOutsource(), wxRepair.getPrice_unit(), "P31");
|
|
|
+ if (res != null) {
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (from.getAuditType().equals(3)) {
|
|
|
+ AuditVo auditInfo = auditService.getAudit(from.getCode());
|
|
|
+ System.out.println(from.getCode());
|
|
|
+ System.out.println(auditInfo.getSapCode());
|
|
|
+ EquipmentAddResponse res = commonService.editSapBYPush(from.getCode(), auditInfo.getSapCode(), "P31");
|
|
|
+ if (res != null) {
|
|
|
+ ResponseDTO<Boolean> t;
|
|
|
+ t = ResponseDTO.ok(false);
|
|
|
+ t.setCode(500);
|
|
|
+ t.setMsg(res.getMsg());
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ auditService.editAuditRepair(from.getCode());
|
|
|
+ ResponseDTO t = ResponseDTO.ok();
|
|
|
+ t.setCode(200);
|
|
|
+ return t;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|