diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/DeliveryController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/DeliveryController.java new file mode 100644 index 0000000..2546d1f --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/DeliveryController.java @@ -0,0 +1,23 @@ +package com.bonus.gzgqj.business.plan.controller; + +import com.bonus.gzgqj.business.plan.entity.DeliveryBean; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + + + +/** + * @author xj + * 机具公司发货 + */ +@Controller +@RequestMapping("/backstage/delivery/") +public class DeliveryController { + + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanApplicationController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanApplicationController.java new file mode 100644 index 0000000..77f1b0b --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanApplicationController.java @@ -0,0 +1,195 @@ +package com.bonus.gzgqj.business.plan.controller; + +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import com.bonus.gzgqj.business.plan.entity.*; +import com.bonus.gzgqj.business.plan.service.PlanApplicationService; +import com.bonus.gzgqj.manager.annotation.DecryptAndVerify; +import com.bonus.gzgqj.manager.core.entity.EncryptedReq; +import com.bonus.gzgqj.manager.webResult.ServerResponse; +import com.bonus.gzgqj.manager.webResult.StringUtils; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + + +/** + * 计划申请 控制层 + * @author xj + */ +@RestController +@RequestMapping("/backstage/planApplication") +@Slf4j +public class PlanApplicationController { + + @Autowired + private PlanApplicationService service; + + @GetMapping("findByPage") + @DecryptAndVerify(decryptedClass = PlanApplyBean.class) + public PageInfo findByPage(EncryptedReq dto) { + PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); + List list = service.findByPage(dto.getData());; + PageInfo pageInfo = new PageInfo<>(list); + return pageInfo; + } + + /** + * 获取设备树 集合 + * @param o + * @return + */ + @PostMapping(value = "getDevTreeList") + @DecryptAndVerify(decryptedClass = PlanDevBean.class) + public ServerResponse getDevTreeList(EncryptedReq dto ) { + return service.getDevTreeList(dto.getData()); + } + /** + * 获取设备树 集合 + * @param o + * @return + */ + @PostMapping(value = "getProList") + @DecryptAndVerify(decryptedClass = PlanDevBean.class) + public ServerResponse getProList(EncryptedReq dto) { + return service.getProList(dto.getData()); + } + + /** + * 新增计划 + * @param o + * @return + */ + @PostMapping(value = "addPlan") + @DecryptAndVerify(decryptedClass = PlanApplyBean.class) + public ServerResponse addPlan(EncryptedReq dto) { + return service.addPlan(dto.getData()); + } + + + + /** + * 修改计划 + * @param o + * @return + */ + @PostMapping(value = "updatePlan") + @DecryptAndVerify(decryptedClass = PlanApplyBean.class) + public ServerResponse updatePlan(EncryptedReq dto) { + return service.updatePlan(dto.getData()); + } + + + + /** + * 查看详情详情 + * @param dto + * @return + */ + @PostMapping(value = "getPlanDetails") + @DecryptAndVerify(decryptedClass = PlanApplyBean.class) + public ServerResponse getPlanDetails(EncryptedReq dto) { + return service.getPlanDetails(dto.getData()); + } + + + + + @PostMapping("export") + public void export(HttpServletRequest request, HttpServletResponse response,PlanApplyBean o) { + try { + List list = service.findByPage(o); + if(StringUtils.isEmpty(list)){ + list=new ArrayList<>(); + } + list.forEach(vo->{ + vo.setStatusName(getStatus(o.getStatusType(),o.getStatus())); + }); + ExportParams exportParams = new ExportParams("需求计划申请", "需求计划申请", ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, list); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("需求计划申请" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error(e.toString(), e); + } + } + + + + @PostMapping("exportDetail") + public void exportDetail(HttpServletRequest request, HttpServletResponse response,PlanApplyBean o) { + try { + List results = service.getDetailsList(o); + ExportParams exportParams = new ExportParams("机具明细", "机具明细", ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, results); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("机具明细" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error(e.toString(), e); + } + } + + /** + * 获取审核状态 + * @param statusType + * @param status + * @return + */ + private String getStatus(String statusType,String status) { + try { + String company =""; + if("1".equals(statusType)) { + return "审核通过"; + }else if("2".equals(statusType)) { + company="分公司"; + }else if("3".equals(statusType)) { + company="项目管理中心"; + }else if("4".equals(statusType)) { + company="机具公司"; + } + if("1".equals(status)) { + return "待"+company+"审核"; + + }else if("2".equals(status)) { + return "审核通过"; + + }else if("3".equals(status)) { + return company+"审核驳回"; + } + }catch (Exception e) { + log.error(e.toString(), e); + } + return "待审核"; + + } + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanAuditController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanAuditController.java new file mode 100644 index 0000000..c0e7084 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanAuditController.java @@ -0,0 +1,80 @@ +package com.bonus.gzgqj.business.plan.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.bonus.gzgqj.business.plan.entity.AuditBean; +import com.bonus.gzgqj.business.plan.entity.PlanApplyAuditBean; +import com.bonus.gzgqj.business.plan.entity.PlanApplyBean; +import com.bonus.gzgqj.business.plan.entity.ProNeedInfo; +import com.bonus.gzgqj.business.plan.service.PlanAuditService; +import com.bonus.gzgqj.manager.annotation.DecryptAndVerify; +import com.bonus.gzgqj.manager.core.entity.EncryptedReq; +import com.bonus.gzgqj.manager.webResult.ServerResponse; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + + +/** + * 计划审核 + * @author xj + */ +@RestController +@RequestMapping("/backstage/planAudit") +@Slf4j +public class PlanAuditController { + + + @Autowired + private PlanAuditService service; + + + + + /** + * X详情接口 + * @param dto + * @return + */ + @GetMapping("findByPage") + @DecryptAndVerify(decryptedClass = PlanApplyAuditBean.class) + public PageInfo getPorInfoDetail2(EncryptedReq dto) { + PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); + List list = service.findByPage(dto.getData()); + PageInfo pageInfo = new PageInfo<>(list); + return pageInfo; + } + + + + + /** + * 计划审核 + * @param + * @return + */ + @PostMapping(value = "planAudit") + @DecryptAndVerify(decryptedClass = AuditBean.class) + public ServerResponse planAudit(EncryptedReq dto) { + return service.planAudit(dto.getData()); + } + + + + + + + + + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java index 7e58415..8361256 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java @@ -31,7 +31,6 @@ public class PlanOutController { @Autowired private PlanOutService service; - /** * 发货 统计查询 * @return @@ -40,8 +39,6 @@ public class PlanOutController { public ServerResponse getStatistics(HttpServletRequest request) { return service.getStatistics(); } - - /** * 数据详情分页接口 * @param dto @@ -54,7 +51,6 @@ public class PlanOutController { PageInfo pageInfo = service.getProPlanPage(dto.getData());; return pageInfo; } - /** * 发货查询接口 * @param dto @@ -79,8 +75,6 @@ public class PlanOutController { PageInfo pageInfo = service.getPorInfoDetail2(dto.getData());; return pageInfo; } - - /** * 查询下拉选 * -一级+二级 @@ -92,7 +86,6 @@ public class PlanOutController { public ServerResponse getProDevSelected(EncryptedReq dto) { return service.getProDevSelected(dto.getData()); } - /** * 发货接口 * @return @@ -101,7 +94,6 @@ public class PlanOutController { public ServerResponse insertProOutPutInfo(HttpServletRequest request, @RequestParam("file[]") MultipartFile[] files) { return service.insertProOutPutInfo(request,files); } - /** * 查询批次数量 * @return @@ -111,8 +103,6 @@ public class PlanOutController { public ServerResponse getOutTimes(EncryptedReq dto) { return service.getOutTimes(dto.getData()); } - - /** * 查询批次详情 * @return @@ -122,8 +112,6 @@ public class PlanOutController { public ServerResponse getOutDetails(EncryptedReq dto) { return service.getOutDetails(dto.getData()); } - - /** * X详情接口 * @param dto @@ -136,7 +124,6 @@ public class PlanOutController { PageInfo pageInfo = service.getOutDetailList(dto.getData());; return pageInfo; } - /** * X详情接口 * @param dto @@ -151,4 +138,30 @@ public class PlanOutController { } + + + /** + * X详情接口 + * @param dto + * @return + */ + @GetMapping("getProPlanListByProId") + @DecryptAndVerify(decryptedClass = ProNeedInfo.class) + public PageInfo getProPlanListByProId(EncryptedReq dto) { + PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); + PageInfo pageInfo = service.getDfhList(dto.getData());; + return pageInfo; + } + + + + + + + + + + + + } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/AuditBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/AuditBean.java new file mode 100644 index 0000000..53c56d6 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/AuditBean.java @@ -0,0 +1,139 @@ +package com.bonus.gzgqj.business.plan.entity; +/** + * 审核 详情 + * @author xj + * + * + */ +public class AuditBean { + + /** + * 计划id + */ + private String applyId; + /** + * 审核人 + */ + private int auditor; + /** + * 审核时间 + */ + private String auditTime; + /** + * 审核状态 2 审核通过 3 审核驳回 + */ + private String auditStatus; + + /** + * 备注 + */ + private String auditRemarks; + /** + * 修改人 + */ + private int updater; + + /** + * 修改时间 + */ + private String updateTime; + /** + * 审核类型 + */ + private String auditType; + + private String auditUser; + + private int hours; + + private int minutes; + + private String createTime; + + private String phone; + + + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + public int getHours() { + return hours; + } + public void setHours(int hours) { + this.hours = hours; + } + public int getMinutes() { + return minutes; + } + public void setMinutes(int minutes) { + this.minutes = minutes; + } + public String getCreateTime() { + return createTime; + } + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + public String getAuditUser() { + return auditUser; + } + public void setAuditUser(String auditUser) { + this.auditUser = auditUser; + } + public String getApplyId() { + return applyId; + } + public void setApplyId(String applyId) { + this.applyId = applyId; + } + public int getAuditor() { + return auditor; + } + public void setAuditor(int auditor) { + this.auditor = auditor; + } + public String getAuditTime() { + return auditTime; + } + public void setAuditTime(String auditTime) { + this.auditTime = auditTime; + } + public String getAuditStatus() { + return auditStatus; + } + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + public String getAuditRemarks() { + return auditRemarks; + } + public void setAuditRemarks(String auditRemarks) { + this.auditRemarks = auditRemarks; + } + public int getUpdater() { + return updater; + } + public void setUpdater(int updater) { + this.updater = updater; + } + public String getUpdateTime() { + return updateTime; + } + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + public String getAuditType() { + return auditType; + } + public void setAuditType(String auditType) { + this.auditType = auditType; + } + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/DeliveryBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/DeliveryBean.java new file mode 100644 index 0000000..7055381 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/DeliveryBean.java @@ -0,0 +1,10 @@ +package com.bonus.gzgqj.business.plan.entity; + +/** + * @author xj + * 机具公司发货-一级页面-实体类 + * + */ +public class DeliveryBean { + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyAuditBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyAuditBean.java new file mode 100644 index 0000000..a0bbc66 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyAuditBean.java @@ -0,0 +1,260 @@ +package com.bonus.gzgqj.business.plan.entity; + +import java.util.List; + +/** + *计划申请实体类 + * @author xj + + */ +public class PlanApplyAuditBean { + + + private String id; + /** + * 计划编号 + */ + private String code; + + /** + * 计划编号 + */ + private String proId; + + /** + * 工程id + */ + private String projectId; + + /** + * 项目部分 + */ + private String projectPart; + + /** + * 施工地点 + */ + private String projectContent; + + + /** + * 施工地点 + */ + private String remark; + + + + /** + * 需要时间 + */ + private String needTime; + /** + * 创建人 + */ + private String creator; + /** + * 创建时间 + */ + private String createTime; + /** + * 状态 + */ + private String status; + /** + * 更新人 + */ + private String updater; + /** + * 更新时间 + */ + private String updateTime; + + + private String keyWord; + + + private String statusType; + + private String proName; + + + private String jsonData; + + private List details; + + + private List auditList; + + /** + * 审核状态 + */ + private String auditStatus; + + + + + public String getProId() { + return proId; + } + + public void setProId(String proId) { + this.proId = proId; + } + + public String getAuditStatus() { + return auditStatus; + } + + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + + public List getAuditList() { + return auditList; + } + + public void setAuditList(List auditList) { + this.auditList = auditList; + } + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + public String getJsonData() { + return jsonData; + } + + public void setJsonData(String jsonData) { + this.jsonData = jsonData; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getProjectPart() { + return projectPart; + } + + public void setProjectPart(String projectPart) { + this.projectPart = projectPart; + } + + public String getProjectContent() { + return projectContent; + } + + public void setProjectContent(String projectContent) { + this.projectContent = projectContent; + } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public String getNeedTime() { + return needTime; + } + + public void setNeedTime(String needTime) { + this.needTime = needTime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getKeyWord() { + return keyWord; + } + + public void setKeyWord(String keyWord) { + this.keyWord = keyWord; + } + + public String getStatusType() { + return statusType; + } + + public void setStatusType(String statusType) { + this.statusType = statusType; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java new file mode 100644 index 0000000..66f63da --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBean.java @@ -0,0 +1,278 @@ +package com.bonus.gzgqj.business.plan.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.List; + +/** + *计划申请实体类 + * @author xj + */ +@Data +public class PlanApplyBean { + + + private String id; + /** + * 计划编号 + */ + @Excel(name = "计划编号", width = 10.0,height = 20.0, orderNum = "1") + private String code; + + @Excel(name = "工程名称", width = 10.0,height = 20.0, orderNum = "2") + private String proName; + + /** + * 需要时间 + */ + @Excel(name = "需用日期", width = 10.0,height = 20.0, orderNum = "3") + private String needTime; + + /** + * 创建人 + */ + @Excel(name = "申请人", width = 10.0,height = 20.0, orderNum = "4") + private String creator; + /** + * 创建时间 + */ + @Excel(name = "申请时间", width = 10.0,height = 20.0, orderNum = "5") + private String createTime; + + /** + * 计划编号 + */ + + private String proId; + + /** + * 工程id + */ + private String projectId; + + /** + * 项目部分 + */ + @Excel(name = "项目部分", width = 10.0,height = 20.0, orderNum = "6") + private String projectPart; + + /** + * 施工地点 + */ + @Excel(name = "施工地点", width = 10.0,height = 20.0, orderNum = "7") + private String projectContent; + + + /** + * 施工地点 + */ + @Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "8") + private String remark; + /** + * 状态 + */ + @Excel(name = "审核状态", width = 10.0,height = 20.0, orderNum = "9") + private String statusName; + + /** + * 状态 + */ + private String status; + /** + * 更新人 + */ + private String updater; + /** + * 更新时间 + */ + private String updateTime; + + + private String keyWord; + + + private String statusType; + + + + private String jsonData; + + private List details; + + + private List auditList; + + /** + * 审核状态 + */ + private String auditStatus; + + + + + public String getProId() { + return proId; + } + + public void setProId(String proId) { + this.proId = proId; + } + + public String getAuditStatus() { + return auditStatus; + } + + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + + public List getAuditList() { + return auditList; + } + + public void setAuditList(List auditList) { + this.auditList = auditList; + } + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + public String getJsonData() { + return jsonData; + } + + public void setJsonData(String jsonData) { + this.jsonData = jsonData; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getProjectPart() { + return projectPart; + } + + public void setProjectPart(String projectPart) { + this.projectPart = projectPart; + } + + public String getProjectContent() { + return projectContent; + } + + public void setProjectContent(String projectContent) { + this.projectContent = projectContent; + } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public String getNeedTime() { + return needTime; + } + + public void setNeedTime(String needTime) { + this.needTime = needTime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getKeyWord() { + return keyWord; + } + + public void setKeyWord(String keyWord) { + this.keyWord = keyWord; + } + + public String getStatusType() { + return statusType; + } + + public void setStatusType(String statusType) { + this.statusType = statusType; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDataDetailBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDataDetailBean.java new file mode 100644 index 0000000..41e6a03 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDataDetailBean.java @@ -0,0 +1,155 @@ +package com.bonus.gzgqj.business.plan.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; + +/** + * 新增内容详情 + * @author xj + * + * + */ +public class PlanDataDetailBean { + + /** + * 类型 + */ + private String applyId; + + /** + * 类型 + */ + @Excel(name = "物机类型", width = 10.0,height = 20.0, orderNum = "1") + private String type; + /** + * 名称 + */ + @Excel(name = "物机名称", width = 10.0,height = 20.0, orderNum = "2") + private String typeName; + /** + * 规格 + */ + @Excel(name = "规格型号", width = 10.0,height = 20.0, orderNum = "3") + private String module; + /** + * 单位 + */ + @Excel(name = "单位", width = 10.0,height = 20.0, orderNum = "4") + private String unit; + /** + * 需用量 + */ + @Excel(name = "需用量", width = 10.0,height = 20.0, orderNum = "5") + private int needNum; + /** + * 需用天数 + */ + @Excel(name = "需用天数", width = 10.0,height = 20.0, orderNum = "6") + private String times; + /** + * 备注 + */ + @Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "1") + private String remarks; + + /** + * 规格id + */ + private String moduleId; + + + + + public String getApplyId() { + return applyId; + } + + + public void setApplyId(String applyId) { + this.applyId = applyId; + } + + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public String getTypeName() { + return typeName; + } + + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + + public String getModule() { + return module; + } + + + public void setModule(String module) { + this.module = module; + } + + + public String getUnit() { + return unit; + } + + + public void setUnit(String unit) { + this.unit = unit; + } + + + public int getNeedNum() { + return needNum; + } + + + public void setNeedNum(int needNum) { + this.needNum = needNum; + } + + + public String getTimes() { + return times; + } + + + public void setTimes(String times) { + this.times = times; + } + + + public String getRemarks() { + return remarks; + } + + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + + public String getModuleId() { + return moduleId; + } + + + public void setModuleId(String moduleId) { + this.moduleId = moduleId; + } + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDevBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDevBean.java new file mode 100644 index 0000000..8ea165c --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanDevBean.java @@ -0,0 +1,94 @@ +package com.bonus.gzgqj.business.plan.entity; + +import java.util.List; + +public class PlanDevBean { + + private String id; + + private String name; + + + private String pId; + + private String unit; + + private String level; + + + private String pName; + + + private String ppName; + /** + * 子集合 + */ + private List childer; + /** + * + * 子设备数量 + * */ + private String num; + + + + public String getpName() { + return pName; + } + public void setpName(String pName) { + this.pName = pName; + } + public String getPpName() { + return ppName; + } + public void setPpName(String ppName) { + this.ppName = ppName; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getpId() { + return pId; + } + public void setpId(String pId) { + this.pId = pId; + } + public List getChilder() { + return childer; + } + public void setChilder(List childer) { + this.childer = childer; + } + public String getNum() { + return num; + } + public void setNum(String num) { + this.num = num; + } + public String getLevel() { + return level; + } + public void setLevel(String level) { + this.level = level; + } + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanProBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanProBean.java new file mode 100644 index 0000000..a22c572 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanProBean.java @@ -0,0 +1,33 @@ +package com.bonus.gzgqj.business.plan.entity; + +/** + * 工程 实体类 + * @author xj + * + * + */ +public class PlanProBean { + + + private String id; + + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoBean.java new file mode 100644 index 0000000..e836d59 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfoBean.java @@ -0,0 +1,132 @@ +package com.bonus.gzgqj.business.plan.entity; + + +/** + * 工程需要数据 + */ + +public class ProNeedInfoBean { + /** + * 主键 + */ + private String id; + /** + * 工程id + */ + private String proId; + /** + * 类型 + */ + private String type; + /** + * 名称 + */ + private String name; + /** + * 规格型号 + */ + private String module; + /** + * 规格id + */ + private String moduleId; + /** + * 需求类型 1计划 2新增 + */ + private String needType; + /** + * 单位 + */ + private String unit; + /** + * 需要数量 + */ + private int needNum; + /** + * 发货数量 + */ + private int fhNum; + /** + * 调整量 + */ + private int tzNum; + /** + * 备注 + */ + private String remarks; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getProId() { + return proId; + } + public void setProId(String proId) { + this.proId = proId; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getModule() { + return module; + } + public void setModule(String module) { + this.module = module; + } + public String getModuleId() { + return moduleId; + } + public void setModuleId(String moduleId) { + this.moduleId = moduleId; + } + public String getNeedType() { + return needType; + } + public void setNeedType(String needType) { + this.needType = needType; + } + public String getUnit() { + return unit; + } + public void setUnit(String unit) { + this.unit = unit; + } + public int getNeedNum() { + return needNum; + } + public void setNeedNum(int needNum) { + this.needNum = needNum; + } + public int getFhNum() { + return fhNum; + } + public void setFhNum(int fhNum) { + this.fhNum = fhNum; + } + public int getTzNum() { + return tzNum; + } + public void setTzNum(int tzNum) { + this.tzNum = tzNum; + } + public String getRemarks() { + return remarks; + } + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoBean.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoBean.java new file mode 100644 index 0000000..d32bf86 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanInfoBean.java @@ -0,0 +1,124 @@ +package com.bonus.gzgqj.business.plan.entity; +/** + * 工程 计划-发货-汇总表 + * @author xj + * + */ +public class ProPlanInfoBean { + + private String id; + /** + * 工程id + */ + private String proId; + + /** + * 计划 量 + */ + private int planNum; + /** + * 出库单量 + */ + private int recordNum; + + /** + * 出库单量 + */ + private int tzNum; + + + /** + * 需用数量 + */ + private int needNum; + /** + * 出库量 + */ + private int outNum; + + private int outNum2; + + private int recordNum2; + /** + * 状态 + */ + private int status; + /** + * 最后发货时间 + */ + private String lastDay; + + + + + public int getOutNum2() { + return outNum2; + } + public void setOutNum2(int outNum2) { + this.outNum2 = outNum2; + } + public int getRecordNum2() { + return recordNum2; + } + public void setRecordNum2(int recordNum2) { + this.recordNum2 = recordNum2; + } + public int getTzNum() { + return tzNum; + } + public void setTzNum(int tzNum) { + this.tzNum = tzNum; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getProId() { + return proId; + } + public void setProId(String proId) { + this.proId = proId; + } + public int getPlanNum() { + return planNum; + } + public void setPlanNum(int planNum) { + this.planNum = planNum; + } + public int getRecordNum() { + return recordNum; + } + public void setRecordNum(int recordNum) { + this.recordNum = recordNum; + } + public int getNeedNum() { + return needNum; + } + public void setNeedNum(int needNum) { + this.needNum = needNum; + } + public int getOutNum() { + return outNum; + } + public void setOutNum(int outNum) { + this.outNum = outNum; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public String getLastDay() { + return lastDay; + } + public void setLastDay(String lastDay) { + this.lastDay = lastDay; + } + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanVo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanVo.java new file mode 100644 index 0000000..1d4b971 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProPlanVo.java @@ -0,0 +1,14 @@ +package com.bonus.gzgqj.business.plan.entity; + +import lombok.Data; + +/** + * 工程计划数量 + */ +@Data +public class ProPlanVo { + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanApplicationMapper.java b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanApplicationMapper.java new file mode 100644 index 0000000..3c2adfe --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanApplicationMapper.java @@ -0,0 +1,91 @@ +package com.bonus.gzgqj.business.plan.mapper; + +import java.util.List; + +import com.bonus.gzgqj.business.plan.entity.*; +import org.apache.ibatis.annotations.Param; + + +import org.springframework.stereotype.Repository; + +/** + * + * @author 黑子 + */ +@Repository +public interface PlanApplicationMapper { + + /** + * 查询设备集合 + * @param o + * @return + */ + List getDevTreeList(PlanDevBean o); + /** + * 数据u插入 + * @param o + * @return + */ + int insertData(PlanApplyBean o); + /** + * 查询当日数量 + * @param o + * @return + */ + int getTodayPlanNum(PlanApplyBean o); + /** + * 插入 list数据 + * @param details + * @param o + */ + int insertDetail(@Param("list") List details, @Param("param") PlanApplyBean o); + /** + * 查询计划内容 + * @return + */ + PlanApplyBean getPlanDetailsbyId(PlanApplyBean o); + /** + * 查询审核记录 + * @param o + * @return + */ + List getAuditList(PlanApplyBean o); + /** + * 查询申请记录详情 + * @param o + * @return + */ + List getDetailsList(PlanApplyBean o); + /** + * 删除详情数据 + * @param o + */ + void deleteDetails(PlanApplyBean o); + /** + * 修改计划内容 + * @param o + * @return + */ + int updatePlan(PlanApplyBean o); + + + /** + * 修改计划内容 + * @param o + * @return + */ + int updatePlanAndSub(PlanApplyBean o); + /** + * 工程下拉选 + * @param o + * @return + */ + List getProList(PlanDevBean o); + + /** + * 分页查询 + * @param data + * @return + */ + List findByPage(PlanApplyBean data); +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanAuditMapper.java b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanAuditMapper.java new file mode 100644 index 0000000..4e6f5f0 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanAuditMapper.java @@ -0,0 +1,81 @@ +package com.bonus.gzgqj.business.plan.mapper; + +import java.util.List; + +import com.bonus.gzgqj.business.plan.entity.*; +import org.apache.ibatis.annotations.Param; + + + + +public interface PlanAuditMapper { + + /** + * 获取 日计划 + * @param applyId + * @return + */ + PlanApplyBean getPlanApplyDta(@Param("applyId")String applyId); + /** + * 修改审核数据 + * @param o + */ + void updatePlanAudit(AuditBean o); + /** + * 插入审核记录 + * @param vo + */ + void insertAuditRecord(AuditBean vo); + /** + * 查询本次审核的数据数量 + * @param applyId + * @return + */ + List getPlanDetails(@Param("applyId")String applyId); + /** + * 依据modoule 和类型 查询 历史工程所需 + * @param proId + * @param moduleId + * @return + */ + ProNeedInfoBean getProNeedInfo(@Param("proId")String proId, @Param("moduleId")String moduleId); + /** + * 新增工程所需量 + * @param bean + */ + void insertProNeedInfo(ProNeedInfoBean bean); + /** + * 更新工程needNum + * @param bean + */ + void updateNeedNum(ProNeedInfoBean bean); + /** + * 按照工程查询 计划 -发货信息 + * @param proId + * @return + */ + ProPlanInfoBean getProPlanInfo(@Param("proId")String proId); + /** + * 查询本次计划申请需要总量 + * @param applyId + * @return + */ + int getPlanNeedNum(@Param("applyId")String applyId); + /** + * 插入工程数据 + * @param proPlanInfo + */ + void insertProPlanInfo(ProPlanInfoBean proPlanInfo); + /** + * 更新工程数据 + * @param proPlanInfo + */ + void updateProPlanInfo(ProPlanInfoBean proPlanInfo); + + /** + * 分页查询 + * @param data + * @return + */ + List findByPage(PlanApplyAuditBean data); +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationService.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationService.java new file mode 100644 index 0000000..2a771d2 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationService.java @@ -0,0 +1,60 @@ +package com.bonus.gzgqj.business.plan.service; + + +import java.util.List; + +import com.bonus.gzgqj.business.plan.entity.PlanApplyBean; +import com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean; +import com.bonus.gzgqj.business.plan.entity.PlanDevBean; +import com.bonus.gzgqj.manager.webResult.ServerResponse; + + + +/** + * 计划申请 接口层 + * @author xj + * + * + */ +public interface PlanApplicationService { + /** + * 新增计划信息 + * @param o + * @return + */ + ServerResponse addPlan(PlanApplyBean o); + /** + * + * @param o + * @return + */ + ServerResponse getDevTreeList(PlanDevBean o); + /** + * 查看计划详情 + * @param o + * @return + */ + ServerResponse getPlanDetails(PlanApplyBean o); + + /** + * 导出数据 + * @param o + * @return + */ + List getDetailsList(PlanApplyBean o); + /** + * 修改审核记录 + * @param o + * @return + */ + ServerResponse updatePlan(PlanApplyBean o); + /** + * 查询 + * @param o + * @return + */ + ServerResponse getProList(PlanDevBean o); + + + List findByPage(PlanApplyBean data); +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationServiceImp.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationServiceImp.java new file mode 100644 index 0000000..ed3203d --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanApplicationServiceImp.java @@ -0,0 +1,217 @@ +package com.bonus.gzgqj.business.plan.service; + + +import com.bonus.gzgqj.business.plan.entity.*; +import com.bonus.gzgqj.business.plan.mapper.PlanApplicationMapper; +import com.bonus.gzgqj.business.plan.mapper.PlanAuditMapper; +import com.bonus.gzgqj.manager.common.util.DateTimeHelper; +import com.bonus.gzgqj.manager.common.util.UserUtil; +import com.bonus.gzgqj.manager.security.entity.SelfUserEntity; +import com.bonus.gzgqj.manager.webResult.ServerResponse; +import com.sun.org.apache.bcel.internal.generic.NEW; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.alibaba.fastjson.JSON; + +import java.util.ArrayList; +import java.util.List; + + +/** + * 计划申请服务层 + * @author xj + */ +@Service("PlanApplicationServiceImp") +@Slf4j +public class PlanApplicationServiceImp implements PlanApplicationService { + + @Autowired + private PlanApplicationMapper dao; + + + + @Autowired + private PlanAuditMapper auditDao; + /** + * -- 新增计划接口 + */ + @Override + public ServerResponse addPlan(PlanApplyBean o) { + try { + // shiro获取用户信息,shiro管理的session + SelfUserEntity acount= UserUtil.getLoginUser(); + String userName=UserUtil.getLoginUser().getUsername(); + + o.setCreator(userName); + o.setUpdater(userName); + List details=JSON.parseArray(o.getJsonData(), PlanDataDetailBean.class); + if(details==null || details.size()<1) { + return ServerResponse.createErroe("请填写机具明细"); + }else { + int num=dao.getTodayPlanNum(o); + String code=getCode(num); + o.setCode(code); + int suNum=dao.insertData(o); + if(suNum>0) { + int success=dao.insertDetail(details,o); + insetRescord(acount,o,"0"); + } + + } + return ServerResponse.createBySuccessMsg("提交成功"); + }catch (Exception e) { + log.error(e.toString(), e); + return ServerResponse.createErroe("提交失败,请联系管理员"); + } + + + } + + + /** + * 添加发起流程 + * @param acount + * @param o + */ + public void insetRescord(SelfUserEntity acount,PlanApplyBean o,String setAuditType) { + AuditBean bean=new AuditBean(); + //流程节点 0 发起申请 + bean.setAuditType(setAuditType); + bean.setAuditStatus("0"); + bean.setAuditor(Integer.parseInt(acount.getUserId()+"")); + bean.setUpdater(Integer.parseInt(acount.getUserId()+"")); + bean.setAuditUser(acount.getUsername()); + bean.setApplyId(o.getId()); + auditDao.insertAuditRecord(bean); + } + + /** + * 修改计划信息 + */ + @Override + public ServerResponse updatePlan(PlanApplyBean o) { + try { + // shiro获取用户信息,shiro管理的session + SelfUserEntity acount= UserUtil.getLoginUser(); + String userName=UserUtil.getLoginUser().getUsername(); + + o.setCreator(userName); + o.setUpdater(userName); + List details=JSON.parseArray(o.getJsonData(), PlanDataDetailBean.class); + if(details==null || details.size()<1) { + return ServerResponse.createErroe("请填写机具明细"); + }else { + //修改并提交 + int suNum=dao.updatePlanAndSub(o); + if(suNum>0) { + dao.deleteDetails(o); + int success=dao.insertDetail(details,o); + insetRescord(acount,o,"1"); + } + } + return ServerResponse.createBySuccessMsg("提交成功"); + }catch (Exception e) { + log.error(e.toString(), e); + return ServerResponse.createErroe("提交失败,请联系管理员"); + } + + } + + + private static String getCode(int num) { + num++; + String year= DateTimeHelper.getNowYMD(); + if(num<10) { + return year+"00"+num; + }else if(num<100) { + return year+"0"+num; + } + return year+num; + } + + + + /** + * 获取设备集合树 + */ + @Override + public ServerResponse getDevTreeList(PlanDevBean o) { + try { + List list=dao.getDevTreeList(o); + return ServerResponse.createSuccess(list); + }catch (Exception e) { + log.error(e.toString(), e); + } + return ServerResponse.createSuccess(new ArrayList<>()); + + } + + public void getChilderList(PlanDevBean vo ) { + List childer=dao.getDevTreeList(vo); + if(childer!=null && childer.size()>0) { + for (PlanDevBean planDevBean : childer) { + getChilderList(planDevBean); + } + vo.setChilder(childer); + } + + } + + + /** + * 查询计划详情 + */ + @Override + public ServerResponse getPlanDetails(PlanApplyBean o) { + try { + PlanApplyBean vo=dao.getPlanDetailsbyId(o); + List auditList=dao.getAuditList(o); + List details=dao.getDetailsList(o); + vo.setAuditList(auditList); + vo.setDetails(details); + return ServerResponse.createSuccess(vo); + }catch (Exception e) { + log.error(e.toString(), e); + } + return ServerResponse.createSuccess(new PlanDevBean()); + } + + + + /** + * 获取数据详情 + */ + @Override + public List getDetailsList(PlanApplyBean o) { + List details=dao.getDetailsList(o); + return details; + } + @Override + public ServerResponse getProList(PlanDevBean o) { + try { + List list=dao.getProList(o); + return ServerResponse.createSuccess(list); + }catch (Exception e) { + log.error(e.toString(), e); + + } + return ServerResponse.createSuccess(new ArrayList()); + + } + + @Override + public List findByPage(PlanApplyBean data) { + try { + List list=dao.findByPage(data); + return list; + }catch (Exception e) { + log.error(e.toString(), e); + + } + return new ArrayList<>(); + } + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditService.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditService.java new file mode 100644 index 0000000..2e5fa85 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditService.java @@ -0,0 +1,30 @@ +package com.bonus.gzgqj.business.plan.service; + + +import com.bonus.gzgqj.business.plan.entity.AuditBean; +import com.bonus.gzgqj.business.plan.entity.PlanApplyAuditBean; +import com.bonus.gzgqj.manager.webResult.ServerResponse; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +/** + * 审核业务接口层 + * @author xj + */ +public interface PlanAuditService { + /** + * 计划审核 + * @param o + * @return + */ + ServerResponse planAudit(AuditBean o); + + /** + * 分页查询 + * @param data + * @return + */ + + List findByPage(PlanApplyAuditBean data); +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditServiceImpl.java new file mode 100644 index 0000000..365e8c0 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanAuditServiceImpl.java @@ -0,0 +1,212 @@ +package com.bonus.gzgqj.business.plan.service; + + +import com.bonus.gzgqj.business.plan.entity.*; +import com.bonus.gzgqj.business.plan.mapper.PlanAuditMapper; +import com.bonus.gzgqj.manager.common.util.UserUtil; +import com.bonus.gzgqj.manager.security.entity.SelfUserEntity; +import com.bonus.gzgqj.manager.webResult.ServerResponse; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 系统审核业务流程 + * @author xj + */ +@Service("PlanAuditServiceImpl") +@Slf4j +public class PlanAuditServiceImpl implements PlanAuditService { + + + @Autowired + private PlanAuditMapper dao; + + /** + * 计划审核 + */ + @Override + @Transactional + public ServerResponse planAudit(AuditBean o) { + try { + + // shiro获取用户信息,shiro管理的session + SelfUserEntity acount= UserUtil.getLoginUser(); + String userName=UserUtil.getLoginUser().getUsername(); + + System.err.println("userName===="+userName); + String applyId=o.getApplyId(); + if(StringUtils.isEmpty(applyId)) { + return ServerResponse.createErroe("请选择计划进行审核"); + }else { + //需要配置审核流程节点 、按照不同的用户 角色权限 进行审核 + //查询计划节点 及状态 + PlanApplyBean plan= dao.getPlanApplyDta(applyId); + //目前未配置角色 全部都可以审核 + String statusType=plan.getStatusType(); + String status=plan.getStatus(); + if(!"1".equals(status)) { + return ServerResponse.createErroe("该计划已被审核,请刷新重试"); + } + String auditStatus=o.getAuditStatus(); + //审核通过 + if("2".equals(auditStatus)) { + auditSuccess(o,statusType,acount,plan); + return ServerResponse.createSuccess("审核成功"); + }else {//审核驳回 + aduitError(o,statusType,acount); + return ServerResponse.createSuccess("驳回成功"); + } + } + }catch (Exception e) { + log.error(e.toString(),e); + + } + return ServerResponse.createErroe("审核失败,请联系管理员"); + } + + /** + * 分页查询 + * @param data + * @return + */ + @Override + public List findByPage(PlanApplyAuditBean data) { + try{ + return dao.findByPage(data); + }catch (Exception e){ + log.error(e.toString(),e); + } + return new ArrayList(); + } + + /** + * 审核通过 + */ + public void auditSuccess(AuditBean vo,String statusType,SelfUserEntity user,PlanApplyBean plan) { + //添加审核记录 + vo.setAuditType(statusType);//审核节点 + vo.setAuditor(Integer.parseInt(user.getUserId()+"")); + vo.setUpdater(Integer.parseInt(user.getUserId()+"")); + vo.setAuditUser(user.getUsername()); + dao.insertAuditRecord(vo); + //修改下次 审核流程 + vo.setAuditStatus("1"); + if("2".equals(statusType)){ + vo.setAuditType("3"); + }else if("3".equals(statusType)){ + vo.setAuditType("4"); + }else if("4".equals(statusType)){ + vo.setAuditType("1"); + vo.setAuditStatus("2"); + //全部审核通过 将需求同步到 工程需求表中 + String proId=plan.getProId(); + String applyId=vo.getApplyId(); + //依据applyId去吧本次审核的数据全部找到 进行 + insertProNeed(proId,applyId); + } + //修改审核状态 + dao.updatePlanAudit(vo); + } + + public void insertProNeed(String proId,String applyId) { + try { + //工程 计划-出库 统计 + ProPlanInfoBean proPlanInfo=dao.getProPlanInfo(proId); + int count=dao.getPlanNeedNum(applyId); + if(proPlanInfo==null || StringUtils.isEmpty(proPlanInfo.getProId())) { + proPlanInfo=new ProPlanInfoBean(); + proPlanInfo.setPlanNum(1); + proPlanInfo.setNeedNum(count); + proPlanInfo.setStatus(0); + proPlanInfo.setOutNum(0); + proPlanInfo.setRecordNum(0); + proPlanInfo.setOutNum2(0); + proPlanInfo.setRecordNum2(0); + proPlanInfo.setLastDay("-"); + proPlanInfo.setProId(proId); + proPlanInfo.setTzNum(0); + dao.insertProPlanInfo(proPlanInfo); + }else { + int planNum=proPlanInfo.getPlanNum(); + int needNum=proPlanInfo.getNeedNum(); + int status=proPlanInfo.getStatus(); + planNum=planNum+1; + needNum=needNum+count; + if(status==2) { + status=1; + } + proPlanInfo.setPlanNum(planNum); + proPlanInfo.setNeedNum(needNum); + proPlanInfo.setStatus(status); + dao.updateProPlanInfo(proPlanInfo); + } + //工程 计划-出库 详情 + List list=dao.getPlanDetails(applyId); + for (PlanDataDetailBean vo : list) { + ProNeedInfoBean bean=dao.getProNeedInfo(proId,vo.getModuleId()); + //源工程无此数据 + if(bean==null || StringUtils.isEmpty(bean.getId())) { + bean=new ProNeedInfoBean(); + bean.setProId(proId); + bean.setType(vo.getType()); + bean.setModule(vo.getModule()); + bean.setName(vo.getTypeName()); + bean.setModuleId(vo.getModuleId()); + bean.setNeedNum(vo.getNeedNum()); + bean.setUnit(vo.getUnit()); + bean.setNeedType("1"); + bean.setFhNum(0); + bean.setTzNum(0); + dao.insertProNeedInfo(bean); + }else { + int needNum=bean.getNeedNum(); + int num=vo.getNeedNum(); + int newNum=needNum+num; + bean.setNeedNum(newNum); + dao.updateNeedNum(bean); + } + } + }catch (Exception e) { + throw new RuntimeException("审核失败"); + } + + + } + + + /** + * 审核驳回 + */ + public void aduitError(AuditBean vo,String statusType,SelfUserEntity user) { + //修改审核状态 + vo.setAuditStatus(statusType);//审核节点 + dao.updatePlanAudit(vo); + vo.setAuditor(Integer.parseInt(user.getUserId()+"")); + vo.setUpdater(Integer.parseInt(user.getUserId()+"")); + vo.setAuditUser(user.getUsername()); + dao.insertAuditRecord(vo); + } + + + + + + + + + + + + + + +} diff --git a/src/main/resources/mappers/plan/PlanApplicationMapper.xml b/src/main/resources/mappers/plan/PlanApplicationMapper.xml new file mode 100644 index 0000000..b8ae292 --- /dev/null +++ b/src/main/resources/mappers/plan/PlanApplicationMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + insert into t_plan_apply( + code,project_id, project_part,project_content, + need_time, creator,create_time,remark,updater, + status,update_time,status_type + )values( + #{code},#{projectId},#{projectPart},#{projectContent}, + #{needTime},#{creator},now(),#{remark},#{updater}, + 1,now(),2 + ) + + + + + + update t_plan_apply + set project_id=#{projectId},project_part=#{projectPart},project_content=#{projectContent} + need_time=#{needTime},updater=#{updater},update_time=now() + where id=#{id} + + + + + DELETE FROM t_plan_details WHERE apply_id=#{id}; + + + + update t_plan_apply + set project_id=#{projectId},project_part=#{projectPart},project_content=#{projectContent} + need_time=#{needTime},updater=#{updater},update_time=now(),status=1,status_type=2 + where id=#{id} + + + + + insert INTO t_plan_details( + apply_id,model_id,need_num, + need_day,remark,type, + name,module,unit + ) VALUES + + ( + #{param.id},#{item.moduleId},#{item.needNum}, + #{item.times},#{item.remarks},#{item.type}, + #{item.typeName},#{item.module},#{item.unit} + ) + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/plan/PlanAuditMapper.xml b/src/main/resources/mappers/plan/PlanAuditMapper.xml new file mode 100644 index 0000000..d8601c2 --- /dev/null +++ b/src/main/resources/mappers/plan/PlanAuditMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + UPDATE t_plan_apply + SET status=#{auditStatus},status_type=#{auditType} + WHERE ID=#{applyId} + + + + + insert into t_plan_record + (apply_id,auditor,audit_time, + audit_status,audit_remark,updater, + update_time,audit_type,audit_name) + values + (#{applyId},#{auditor},now(), + #{auditStatus},#{auditRemarks},#{updater}, + now(),#{auditType},#{auditUser}) + + + + + + + + + + + insert into t_pro_need_info + (pro_id,type,name,module,module_id,need_type,unit,need_num,fh_num, tz_num) values + (#{proId},#{type},#{name},#{module},#{moduleId},#{needType},#{unit},#{needNum},#{fhNum},#{tzNum}) + + + + + update t_pro_need_info set need_num=#{needNum},need_type=1 where id=#{id} + + + + + + insert into t_pro_plan_info + (pro_id,need_num,plan_num,record_num,out_num,status,last_day,tz_num) values + (#{proId},#{needNum},#{planNum},#{recordNum},#{outNum},#{status},#{lastDay},#{tzNum} ,out2_num=#{outNum2},record2_num=#{recordNum2} ) + + + + + update t_pro_plan_info set need_num=#{needNum},plan_num=#{planNum},status=#{status} where pro_id=#{proId} + + \ No newline at end of file