代码迁移

This commit is contained in:
haozq 2024-11-09 18:37:24 +08:00
parent 52ab650831
commit 35192545de
22 changed files with 2540 additions and 13 deletions

View File

@ -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 {
}

View File

@ -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<PlanApplyBean> findByPage(EncryptedReq<PlanApplyBean> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<PlanApplyBean> list = service.findByPage(dto.getData());;
PageInfo<PlanApplyBean> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**
* 获取设备树 集合
* @param o
* @return
*/
@PostMapping(value = "getDevTreeList")
@DecryptAndVerify(decryptedClass = PlanDevBean.class)
public ServerResponse getDevTreeList(EncryptedReq<PlanDevBean> dto ) {
return service.getDevTreeList(dto.getData());
}
/**
* 获取设备树 集合
* @param o
* @return
*/
@PostMapping(value = "getProList")
@DecryptAndVerify(decryptedClass = PlanDevBean.class)
public ServerResponse getProList(EncryptedReq<PlanDevBean> dto) {
return service.getProList(dto.getData());
}
/**
* 新增计划
* @param o
* @return
*/
@PostMapping(value = "addPlan")
@DecryptAndVerify(decryptedClass = PlanApplyBean.class)
public ServerResponse addPlan(EncryptedReq<PlanApplyBean> dto) {
return service.addPlan(dto.getData());
}
/**
* 修改计划
* @param o
* @return
*/
@PostMapping(value = "updatePlan")
@DecryptAndVerify(decryptedClass = PlanApplyBean.class)
public ServerResponse updatePlan(EncryptedReq<PlanApplyBean> dto) {
return service.updatePlan(dto.getData());
}
/**
* 查看详情详情
* @param dto
* @return
*/
@PostMapping(value = "getPlanDetails")
@DecryptAndVerify(decryptedClass = PlanApplyBean.class)
public ServerResponse getPlanDetails(EncryptedReq<PlanApplyBean> dto) {
return service.getPlanDetails(dto.getData());
}
@PostMapping("export")
public void export(HttpServletRequest request, HttpServletResponse response,PlanApplyBean o) {
try {
List<PlanApplyBean> 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<PlanDataDetailBean> 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 "待审核";
}
}

View File

@ -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<PlanApplyAuditBean> getPorInfoDetail2(EncryptedReq<PlanApplyAuditBean> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<PlanApplyAuditBean> list = service.findByPage(dto.getData());
PageInfo<PlanApplyAuditBean> pageInfo = new PageInfo<>(list);
return pageInfo;
}
/**
* 计划审核
* @param
* @return
*/
@PostMapping(value = "planAudit")
@DecryptAndVerify(decryptedClass = AuditBean.class)
public ServerResponse planAudit(EncryptedReq<AuditBean> dto) {
return service.planAudit(dto.getData());
}
}

View File

@ -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<ProPlanInfoVo> pageInfo = service.getProPlanPage(dto.getData());;
return pageInfo;
}
/**
* 发货查询接口
* @param dto
@ -79,8 +75,6 @@ public class PlanOutController {
PageInfo<ProNeedInfo> pageInfo = service.getPorInfoDetail2(dto.getData());;
return pageInfo;
}
/**
* 查询下拉选
* -一级+二级
@ -92,7 +86,6 @@ public class PlanOutController {
public ServerResponse getProDevSelected(EncryptedReq<ProDevSelect> 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<ProNeedInfo> dto) {
return service.getOutTimes(dto.getData());
}
/**
* 查询批次详情
* @return
@ -122,8 +112,6 @@ public class PlanOutController {
public ServerResponse getOutDetails(EncryptedReq<ProNeedInfo> dto) {
return service.getOutDetails(dto.getData());
}
/**
* X详情接口
* @param dto
@ -136,7 +124,6 @@ public class PlanOutController {
PageInfo<ProNeedInfo> 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<ProNeedInfo> getProPlanListByProId(EncryptedReq<ProNeedInfo> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
PageInfo<ProNeedInfo> pageInfo = service.getDfhList(dto.getData());;
return pageInfo;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,10 @@
package com.bonus.gzgqj.business.plan.entity;
/**
* @author xj
* 机具公司发货-一级页面-实体类
*
*/
public class DeliveryBean {
}

View File

@ -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<PlanDataDetailBean> details;
private List<AuditBean> 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<AuditBean> getAuditList() {
return auditList;
}
public void setAuditList(List<AuditBean> auditList) {
this.auditList = auditList;
}
public List<PlanDataDetailBean> getDetails() {
return details;
}
public void setDetails(List<PlanDataDetailBean> 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;
}
}

View File

@ -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<PlanDataDetailBean> details;
private List<AuditBean> 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<AuditBean> getAuditList() {
return auditList;
}
public void setAuditList(List<AuditBean> auditList) {
this.auditList = auditList;
}
public List<PlanDataDetailBean> getDetails() {
return details;
}
public void setDetails(List<PlanDataDetailBean> 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;
}
}

View File

@ -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;
}
}

View File

@ -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<PlanDevBean> 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<PlanDevBean> getChilder() {
return childer;
}
public void setChilder(List<PlanDevBean> 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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,14 @@
package com.bonus.gzgqj.business.plan.entity;
import lombok.Data;
/**
* 工程计划数量
*/
@Data
public class ProPlanVo {
}

View File

@ -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<PlanDevBean> 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<PlanDataDetailBean> details, @Param("param") PlanApplyBean o);
/**
* 查询计划内容
* @return
*/
PlanApplyBean getPlanDetailsbyId(PlanApplyBean o);
/**
* 查询审核记录
* @param o
* @return
*/
List<AuditBean> getAuditList(PlanApplyBean o);
/**
* 查询申请记录详情
* @param o
* @return
*/
List<PlanDataDetailBean> 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<PlanProBean> getProList(PlanDevBean o);
/**
* 分页查询
* @param data
* @return
*/
List<PlanApplyBean> findByPage(PlanApplyBean data);
}

View File

@ -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<PlanDataDetailBean> 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<PlanApplyAuditBean> findByPage(PlanApplyAuditBean data);
}

View File

@ -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<PlanDataDetailBean> getDetailsList(PlanApplyBean o);
/**
* 修改审核记录
* @param o
* @return
*/
ServerResponse updatePlan(PlanApplyBean o);
/**
* 查询
* @param o
* @return
*/
ServerResponse getProList(PlanDevBean o);
List<PlanApplyBean> findByPage(PlanApplyBean data);
}

View File

@ -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<PlanDataDetailBean> 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<PlanDataDetailBean> 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<PlanDevBean> 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<PlanDevBean> 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<AuditBean> auditList=dao.getAuditList(o);
List<PlanDataDetailBean> 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<PlanDataDetailBean> getDetailsList(PlanApplyBean o) {
List<PlanDataDetailBean> details=dao.getDetailsList(o);
return details;
}
@Override
public ServerResponse getProList(PlanDevBean o) {
try {
List<PlanProBean> list=dao.getProList(o);
return ServerResponse.createSuccess(list);
}catch (Exception e) {
log.error(e.toString(), e);
}
return ServerResponse.createSuccess(new ArrayList<PlanProBean>());
}
@Override
public List<PlanApplyBean> findByPage(PlanApplyBean data) {
try {
List<PlanApplyBean> list=dao.findByPage(data);
return list;
}catch (Exception e) {
log.error(e.toString(), e);
}
return new ArrayList<>();
}
}

View File

@ -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<PlanApplyAuditBean> findByPage(PlanApplyAuditBean data);
}

View File

@ -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<PlanApplyAuditBean> findByPage(PlanApplyAuditBean data) {
try{
return dao.findByPage(data);
}catch (Exception e){
log.error(e.toString(),e);
}
return new ArrayList<PlanApplyAuditBean>();
}
/**
* 审核通过
*/
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<PlanDataDetailBean> 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);
}
}

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bonus.gzgqj.business.plan.mapper.PlanApplicationMapper" >
<select id="findByPage" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
SELECT
plan.id,
plan.CODE,pro.name proName ,
plan.project_id projectId,
plan.project_part projectPart,
plan.project_content projectContent,
plan.need_time needTime,
plan.creator,
plan.create_time createTime,
plan.remark,
plan.STATUS,
plan.updater,
plan.status_type statusType
FROM
t_plan_apply plan
left join bm_project pro on plan.project_id=pro.ID
<where>
<if test="param.keyWord !=null and param.keyWord !=''">
and (
pro.name like concat('%',#{param.keyWord},'%') or
plan.creator like concat('%',#{param.keyWord},'%') or
plan.CODE like concat('%',#{param.keyWord},'%') or
plan.need_time like concat('%',#{param.keyWord},'%') or
plan.project_part like concat('%',#{param.keyWord},'%') or
plan.project_content like concat('%',#{param.keyWord},'%') or
plan.remark like concat('%',#{param.keyWord},'%')
)
</if>
<if test="param.auditStatus !=null and param.auditStatus !=''">
and plan.STATUS=#{param.auditStatus}
</if>
</where>
order by plan.update_time DESC
</select>
<select id="getDevTreeList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanDevBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDevBean">
SELECT mt.ID id ,mt.PARENT_ID pId,mt.`LEVEL` level,mt.UNIT unit,mt.NUM num ,mt.`NAME` name ,mt1.`NAME` pName ,
mt2.`NAME` ppName
from mm_type mt
LEFT JOIN mm_type mt1 on mt.PARENT_ID=mt1.id and mt.`LEVEL`=4 and mt1.`LEVEL`=3 and mt1.IS_ACTIVE=1
LEFT JOIN mm_type mt2 on mt1.PARENT_ID=mt2.id and mt1.`LEVEL`=3 and mt2.IS_ACTIVE=1
WHERE mt.IS_ACTIVE=1
ORDER BY mt.`NAME` desc
</select>
<select id="getTodayPlanNum" resultType="java.lang.Integer" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
select count(1)
from t_plan_apply
where DATE_FORMAT(create_time, '%Y-%m-%d')=CURRENT_DATE
</select>
<!-- 插入数据 -->
<insert id="insertData" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" useGeneratedKeys="true" keyProperty="id">
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
)
</insert>
<!--修改计划 -->
<update id="updatePlan" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" >
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}
</update>
<!-- 删除数据 -->
<delete id="deleteDetails" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
DELETE FROM t_plan_details WHERE apply_id=#{id};
</delete>
<!-- 修改计划-并提交 -->
<update id="updatePlanAndSub" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" >
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}
</update>
<!-- 插入数据详情 -->
<insert id="insertDetail">
insert INTO t_plan_details(
apply_id,model_id,need_num,
need_day,remark,type,
name,module,unit
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{param.id},#{item.moduleId},#{item.needNum},
#{item.times},#{item.remarks},#{item.type},
#{item.typeName},#{item.module},#{item.unit}
)
</foreach>
</insert>
<!-- 依据id 查询详情 -->
<select id="getPlanDetailsbyId" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
SELECT
plan.id,
plan.CODE code ,pro.name proName ,
plan.project_id projectId,
plan.project_part projectPart,
plan.project_content projectContent,
plan.need_time needTime,
plan.creator,
plan.create_time createTime,
plan.remark,
plan.STATUS,
plan.updater,
plan.status_type statusType
FROM
t_plan_apply plan
left join bm_project pro on plan.project_id=pro.ID
where plan.id=#{id}
</select>
<!-- 审核记录差寻-->
<select id="getAuditList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.AuditBean">
select tpr.id,
tpr.apply_id applyId,
tpr.auditor auditor,
tpr.audit_time auditTime,
tpr.audit_status auditStatus,
tpr.audit_remark auditRemarks,
tpr.updater updater,
tpr.update_time updateTime,
tpr.audit_type auditType,
tpr.audit_name auditUser,
tpa.create_time statrtTime ,
FLOOR(TIME_TO_SEC(TIMEDIFF(tpr.audit_time, tpa.create_time)) / 60/60) AS hours,
ROUND(MOD(TIME_TO_SEC(TIMEDIFF(tpr.audit_time, tpa.create_time)), 3600) / 60) AS minutes,
pu.TELPHONE phone
FROM t_plan_record tpr
left join pm_user pu on tpr.auditor=pu.id
LEFT JOIN t_plan_apply tpa on tpr.apply_id=tpa.id
where apply_id=#{id}
ORDER BY tpr.audit_time DESC
</select>
<!-- 查询 内容集合-->
<select id="getDetailsList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean">
select id,apply_id applyId,model_id moduleId,
need_num needNum,need_day times,
remark,type,name typeName,
module,unit
from t_plan_details
where apply_id=#{id}
ORDER BY id asc
</select>
<!-- 查询 工程集合-->
<select id="getProList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanDevBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanProBean">
select id,name
from bm_project
where IS_ACTIVE=1
ORDER BY TIME desc
</select>
</mapper>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.bonus.gzgqj.business.plan.mapper.PlanAuditMapper" >
<!-- 查询审核列表 -->
<select id="findByPage" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyAuditBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyAuditBean">
SELECT
plan.id,
plan.CODE,pro.name proName ,
plan.project_id projectId,
plan.project_part projectPart,
plan.project_content projectContent,
plan.need_time needTime,
plan.creator,
plan.create_time createTime,
plan.remark,
plan.STATUS,
plan.updater,
plan.status_type statusType
FROM
t_plan_apply plan
left join bm_project pro on plan.project_id=pro.ID
<where>
<if test="param.keyWord !=null and param.keyWord !=''">
and (
pro.name like concat('%',#{param.keyWord},'%') or
plan.creator like concat('%',#{param.keyWord},'%') or
plan.CODE like concat('%',#{param.keyWord},'%') or
plan.need_time like concat('%',#{param.keyWord},'%') or
plan.project_part like concat('%',#{param.keyWord},'%') or
plan.project_content like concat('%',#{param.keyWord},'%') or
plan.remark like concat('%',#{param.keyWord},'%')
)
</if>
<if test="param.auditStatus !=null and param.auditStatus !=''">
and plan.STATUS=#{param.auditStatus}
</if>
</where>
order by plan.update_time DESC
</select>
<!--统计本次计划所需数量-->
<select id="getPlanNeedNum" parameterType="java.lang.String" resultType="java.lang.Integer" >
select SUM(need_num)
from t_plan_details
where apply_id=#{applyId}
</select>
<!--查询工程 计划-出库 信息-->
<select id="getProPlanInfo" parameterType="java.lang.String" resultType="com.bonus.gzgqj.business.plan.entity.ProPlanInfoBean" >
select pro_id proId,need_num needNum,plan_num planNum,record_num recordNum,out_num outNum,status
from t_pro_plan_info
where pro_id=#{proId}
</select>
<!-- 查询审核内容 -->
<select id="getPlanApplyDta" parameterType="java.lang.String" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
select status,status_type statusType,project_id proId
from t_plan_apply
WHERE ID=#{applyId}
</select>
<!-- 修改审核信息 -->
<update id="updatePlanAudit" parameterType="com.bonus.gzgqj.business.plan.entity.AuditBean">
UPDATE t_plan_apply
SET status=#{auditStatus},status_type=#{auditType}
WHERE ID=#{applyId}
</update>
<!-- 插入审核记录 -->
<insert id="insertAuditRecord" parameterType="com.bonus.gzgqj.business.plan.entity.AuditBean">
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>
<!--查询计划工器具详情 -->
<select id="getPlanDetails" resultType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean" parameterType="java.lang.String">
select id,model_id moduleId,type,`name` typeName,module,unit,need_num needNum
from t_plan_details
where apply_id=#{applyId}
</select>
<!-- 查询工程所需量 -->
<select id="getProNeedInfo" resultType="com.bonus.gzgqj.business.plan.entity.ProNeedInfoBean" parameterType="java.lang.String">
select id,need_num needNum,module_id moduleId ,pro_id proId
from t_pro_need_info
where module_id=#{moduleId} and pro_id=#{proId}
</select>
<!-- 工程所需量 -->
<insert id="insertProNeedInfo" parameterType="com.bonus.gzgqj.business.plan.entity.ProNeedInfoBean">
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})
</insert>
<!-- 更新工程所需量 -->
<update id="updateNeedNum" parameterType="com.bonus.gzgqj.business.plan.entity.ProNeedInfoBean" >
update t_pro_need_info set need_num=#{needNum},need_type=1 where id=#{id}
</update>
<!-- 更新工程数据库存量-->
<insert id="insertProPlanInfo" parameterType="com.bonus.gzgqj.business.plan.entity.ProPlanInfoBean">
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} )
</insert>
<!-- 更新工程所需量 -->
<update id="updateProPlanInfo" parameterType="com.bonus.gzgqj.business.plan.entity.ProPlanInfoBean" >
update t_pro_plan_info set need_num=#{needNum},plan_num=#{planNum},status=#{status} where pro_id=#{proId}
</update>
</mapper>