From 12570a5997b63e1937213555dc9ddec2faf9159b Mon Sep 17 00:00:00 2001 From: yinq Date: Fri, 24 Nov 2023 10:00:58 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20add=E7=94=9F=E4=BA=A7=E6=97=A5?= =?UTF-8?q?=E5=8E=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CalendarInfoController.java | 115 ++++++++ .../aucma/production/domain/CalendarInfo.java | 255 ++++++++++++++++++ .../production/mapper/CalendarInfoMapper.java | 61 +++++ .../service/ICalendarInfoService.java | 69 +++++ .../service/impl/CalendarInfoServiceImpl.java | 110 ++++++++ .../mapper/production/CalendarInfoMapper.xml | 126 +++++++++ 6 files changed, 736 insertions(+) create mode 100644 aucma-production/src/main/java/com/aucma/production/controller/CalendarInfoController.java create mode 100644 aucma-production/src/main/java/com/aucma/production/domain/CalendarInfo.java create mode 100644 aucma-production/src/main/java/com/aucma/production/mapper/CalendarInfoMapper.java create mode 100644 aucma-production/src/main/java/com/aucma/production/service/ICalendarInfoService.java create mode 100644 aucma-production/src/main/java/com/aucma/production/service/impl/CalendarInfoServiceImpl.java create mode 100644 aucma-production/src/main/resources/mapper/production/CalendarInfoMapper.xml diff --git a/aucma-production/src/main/java/com/aucma/production/controller/CalendarInfoController.java b/aucma-production/src/main/java/com/aucma/production/controller/CalendarInfoController.java new file mode 100644 index 0000000..54949ef --- /dev/null +++ b/aucma-production/src/main/java/com/aucma/production/controller/CalendarInfoController.java @@ -0,0 +1,115 @@ +package com.aucma.production.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.aucma.common.utils.DateUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.aucma.common.annotation.Log; +import com.aucma.common.core.controller.BaseController; +import com.aucma.common.core.domain.AjaxResult; +import com.aucma.common.enums.BusinessType; +import com.aucma.production.domain.CalendarInfo; +import com.aucma.production.service.ICalendarInfoService; +import com.aucma.common.utils.poi.ExcelUtil; +import com.aucma.common.core.page.TableDataInfo; + +/** + * 生产日历Controller + * + * @author Yinq + * @date 2023-11-23 + */ +@RestController +@RequestMapping("/production/calendarInfo" ) +public class CalendarInfoController extends BaseController { + @Autowired + private ICalendarInfoService calendarInfoService; + + /** + * 查询生产日历列表 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:list')" ) + @GetMapping("/list" ) + public TableDataInfo list(CalendarInfo calendarInfo) { + startPage(); + List list = calendarInfoService.selectCalendarInfoList(calendarInfo); + return getDataTable(list); + } + + /** + * 导出生产日历列表 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:export')" ) + @Log(title = "生产日历" , businessType = BusinessType.EXPORT) + @PostMapping("/export" ) + public void export(HttpServletResponse response, CalendarInfo calendarInfo) { + List list = calendarInfoService.selectCalendarInfoList(calendarInfo); + ExcelUtil util = new ExcelUtil(CalendarInfo. class); + util.exportExcel(response, list, "生产日历数据" ); + } + + /** + * 获取生产日历详细信息 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:query')" ) + @GetMapping(value = "/{objId}" ) + public AjaxResult getInfo(@PathVariable("objId" ) Long objId) { + return success(calendarInfoService.selectCalendarInfoByObjId(objId)); + } + + /** + * 新增生产日历 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:add')" ) + @Log(title = "生产日历" , businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CalendarInfo calendarInfo) { + calendarInfo.setCreatedBy(getUsername()); + calendarInfo.setCreatedTime(DateUtils.getNowDate()); + return toAjax(calendarInfoService.insertCalendarInfo(calendarInfo)); + } + + /** + * 修改生产日历 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:edit')" ) + @Log(title = "生产日历" , businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CalendarInfo calendarInfo) { + calendarInfo.setUpdatedBy(getUsername()); + calendarInfo.setUpdatedTime(DateUtils.getNowDate()); + return toAjax(calendarInfoService.updateCalendarInfo(calendarInfo)); + } + + /** + * 删除生产日历 + */ + @PreAuthorize("@ss.hasPermi('production:calendarInfo:remove')" ) + @Log(title = "生产日历" , businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}" ) + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(calendarInfoService.deleteCalendarInfoByObjIds(objIds)); + } + + + /** + * 手动同步生产日历 + * @param calendarInfo + * @return + */ + @Log(title = "生产日历" , businessType = BusinessType.INSERT) + @PostMapping("/addSAPCalendar") + public AjaxResult addSAPCalendar(@RequestBody CalendarInfo calendarInfo) { + return toAjax(calendarInfoService.addSAPCalendar(calendarInfo)); + } +} diff --git a/aucma-production/src/main/java/com/aucma/production/domain/CalendarInfo.java b/aucma-production/src/main/java/com/aucma/production/domain/CalendarInfo.java new file mode 100644 index 0000000..92e2d50 --- /dev/null +++ b/aucma-production/src/main/java/com/aucma/production/domain/CalendarInfo.java @@ -0,0 +1,255 @@ +package com.aucma.production.domain; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.aucma.common.annotation.Excel; +import com.aucma.common.core.domain.BaseEntity; + +/** + * 生产日历对象 product_calendar_info + * + * @author Yinq + * @date 2023-11-23 + */ +public class CalendarInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long objId; + + /** + * SAP计划编号 + */ + @Excel(name = "SAP计划编号") + private String sapPlanCode; + + /** + * 物料编号 + */ + @Excel(name = "物料编号") + private String materialCode; + + /** + * 物料名称 + */ + @Excel(name = "物料名称") + private String materialName; + + /** + * 计划开始日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planStartDate; + + /** + * 计划结束日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planEndDate; + + /** + * 计划数量 + */ + @Excel(name = "计划数量") + private BigDecimal planAmount; + + /** + * 计划排产日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划排产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date schedulingDate; + + /** + * 是否已排产(0-是;1否) + */ + @Excel(name = "是否已排产", readConverterExp = "0=是,1=否") + private Long isScheduling; + + /** + * 排产班组 + */ + @Excel(name = "排产班组") + private String schedulingTeam; + + /** + * 是否标识 + */ + @Excel(name = "是否标识") + private Long isFlag; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + /** + * 更新人 + */ + @Excel(name = "更新人") + private String updatedBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date updatedTime; + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setSapPlanCode(String sapPlanCode) { + this.sapPlanCode = sapPlanCode; + } + + public String getSapPlanCode() { + return sapPlanCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getMaterialName() { + return materialName; + } + + public void setPlanStartDate(Date planStartDate) { + this.planStartDate = planStartDate; + } + + public Date getPlanStartDate() { + return planStartDate; + } + + public void setPlanEndDate(Date planEndDate) { + this.planEndDate = planEndDate; + } + + public Date getPlanEndDate() { + return planEndDate; + } + + public void setPlanAmount(BigDecimal planAmount) { + this.planAmount = planAmount; + } + + public BigDecimal getPlanAmount() { + return planAmount; + } + + public void setSchedulingDate(Date schedulingDate) { + this.schedulingDate = schedulingDate; + } + + public Date getSchedulingDate() { + return schedulingDate; + } + + public void setIsScheduling(Long isScheduling) { + this.isScheduling = isScheduling; + } + + public Long getIsScheduling() { + return isScheduling; + } + + public void setSchedulingTeam(String schedulingTeam) { + this.schedulingTeam = schedulingTeam; + } + + public String getSchedulingTeam() { + return schedulingTeam; + } + + public void setIsFlag(Long isFlag) { + this.isFlag = isFlag; + } + + public Long getIsFlag() { + return isFlag; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("sapPlanCode", getSapPlanCode()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("planStartDate", getPlanStartDate()) + .append("planEndDate", getPlanEndDate()) + .append("planAmount", getPlanAmount()) + .append("schedulingDate", getSchedulingDate()) + .append("isScheduling", getIsScheduling()) + .append("schedulingTeam", getSchedulingTeam()) + .append("isFlag", getIsFlag()) + .append("createdBy", getCreatedBy()) + .append("createdTime", getCreatedTime()) + .append("updatedBy", getUpdatedBy()) + .append("updatedTime", getUpdatedTime()) + .toString(); + } +} diff --git a/aucma-production/src/main/java/com/aucma/production/mapper/CalendarInfoMapper.java b/aucma-production/src/main/java/com/aucma/production/mapper/CalendarInfoMapper.java new file mode 100644 index 0000000..2b8cbd8 --- /dev/null +++ b/aucma-production/src/main/java/com/aucma/production/mapper/CalendarInfoMapper.java @@ -0,0 +1,61 @@ +package com.aucma.production.mapper; + +import java.util.List; +import com.aucma.production.domain.CalendarInfo; + +/** + * 生产日历Mapper接口 + * + * @author Yinq + * @date 2023-11-23 + */ +public interface CalendarInfoMapper +{ + /** + * 查询生产日历 + * + * @param objId 生产日历主键 + * @return 生产日历 + */ + public CalendarInfo selectCalendarInfoByObjId(Long objId); + + /** + * 查询生产日历列表 + * + * @param calendarInfo 生产日历 + * @return 生产日历集合 + */ + public List selectCalendarInfoList(CalendarInfo calendarInfo); + + /** + * 新增生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + public int insertCalendarInfo(CalendarInfo calendarInfo); + + /** + * 修改生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + public int updateCalendarInfo(CalendarInfo calendarInfo); + + /** + * 删除生产日历 + * + * @param objId 生产日历主键 + * @return 结果 + */ + public int deleteCalendarInfoByObjId(Long objId); + + /** + * 批量删除生产日历 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCalendarInfoByObjIds(Long[] objIds); +} diff --git a/aucma-production/src/main/java/com/aucma/production/service/ICalendarInfoService.java b/aucma-production/src/main/java/com/aucma/production/service/ICalendarInfoService.java new file mode 100644 index 0000000..dd3602f --- /dev/null +++ b/aucma-production/src/main/java/com/aucma/production/service/ICalendarInfoService.java @@ -0,0 +1,69 @@ +package com.aucma.production.service; + +import java.util.List; +import com.aucma.production.domain.CalendarInfo; + +/** + * 生产日历Service接口 + * + * @author Yinq + * @date 2023-11-23 + */ +public interface ICalendarInfoService +{ + /** + * 查询生产日历 + * + * @param objId 生产日历主键 + * @return 生产日历 + */ + public CalendarInfo selectCalendarInfoByObjId(Long objId); + + /** + * 查询生产日历列表 + * + * @param calendarInfo 生产日历 + * @return 生产日历集合 + */ + public List selectCalendarInfoList(CalendarInfo calendarInfo); + + /** + * 新增生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + public int insertCalendarInfo(CalendarInfo calendarInfo); + + /** + * 修改生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + public int updateCalendarInfo(CalendarInfo calendarInfo); + + /** + * 批量删除生产日历 + * + * @param objIds 需要删除的生产日历主键集合 + * @return 结果 + */ + public int deleteCalendarInfoByObjIds(Long[] objIds); + + /** + * 删除生产日历信息 + * + * @param objId 生产日历主键 + * @return 结果 + */ + public int deleteCalendarInfoByObjId(Long objId); + + /** + * 新增SAP生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + public int addSAPCalendar(CalendarInfo calendarInfo); +} diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/CalendarInfoServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/CalendarInfoServiceImpl.java new file mode 100644 index 0000000..170f703 --- /dev/null +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/CalendarInfoServiceImpl.java @@ -0,0 +1,110 @@ +package com.aucma.production.service.impl; + +import java.util.List; + +import com.aucma.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.aucma.production.mapper.CalendarInfoMapper; +import com.aucma.production.domain.CalendarInfo; +import com.aucma.production.service.ICalendarInfoService; + +import static com.aucma.common.utils.SecurityUtils.getUsername; + +/** + * 生产日历Service业务层处理 + * + * @author Yinq + * @date 2023-11-23 + */ +@Service +public class CalendarInfoServiceImpl implements ICalendarInfoService +{ + @Autowired + private CalendarInfoMapper calendarInfoMapper; + + /** + * 查询生产日历 + * + * @param objId 生产日历主键 + * @return 生产日历 + */ + @Override + public CalendarInfo selectCalendarInfoByObjId(Long objId) + { + return calendarInfoMapper.selectCalendarInfoByObjId(objId); + } + + /** + * 查询生产日历列表 + * + * @param calendarInfo 生产日历 + * @return 生产日历 + */ + @Override + public List selectCalendarInfoList(CalendarInfo calendarInfo) + { + return calendarInfoMapper.selectCalendarInfoList(calendarInfo); + } + + /** + * 新增生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + @Override + public int insertCalendarInfo(CalendarInfo calendarInfo) + { + return calendarInfoMapper.insertCalendarInfo(calendarInfo); + } + + /** + * 修改生产日历 + * + * @param calendarInfo 生产日历 + * @return 结果 + */ + @Override + public int updateCalendarInfo(CalendarInfo calendarInfo) + { + return calendarInfoMapper.updateCalendarInfo(calendarInfo); + } + + /** + * 批量删除生产日历 + * + * @param objIds 需要删除的生产日历主键 + * @return 结果 + */ + @Override + public int deleteCalendarInfoByObjIds(Long[] objIds) + { + return calendarInfoMapper.deleteCalendarInfoByObjIds(objIds); + } + + /** + * 删除生产日历信息 + * + * @param objId 生产日历主键 + * @return 结果 + */ + @Override + public int deleteCalendarInfoByObjId(Long objId) + { + return calendarInfoMapper.deleteCalendarInfoByObjId(objId); + } + + /** + * 新增SAP生产日历 + * @param calendarInfo 生产日历 + * @return + */ + @Override + public int addSAPCalendar(CalendarInfo calendarInfo) { + + + return 1; + } + +} diff --git a/aucma-production/src/main/resources/mapper/production/CalendarInfoMapper.xml b/aucma-production/src/main/resources/mapper/production/CalendarInfoMapper.xml new file mode 100644 index 0000000..43a538c --- /dev/null +++ b/aucma-production/src/main/resources/mapper/production/CalendarInfoMapper.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + select obj_id, sap_plan_code, material_code, material_name, plan_start_date, plan_end_date, plan_amount, scheduling_date, is_scheduling, scheduling_team, is_flag, created_by, created_time, updated_by, updated_time from product_calendar_info + + + + + + + + + SELECT seq_product_calendar_info.NEXTVAL as objId FROM DUAL + + insert into product_calendar_info + + obj_id, + sap_plan_code, + material_code, + material_name, + plan_start_date, + plan_end_date, + plan_amount, + scheduling_date, + is_scheduling, + scheduling_team, + is_flag, + created_by, + created_time, + updated_by, + updated_time, + + + #{objId}, + #{sapPlanCode}, + #{materialCode}, + #{materialName}, + #{planStartDate}, + #{planEndDate}, + #{planAmount}, + #{schedulingDate}, + #{isScheduling}, + #{schedulingTeam}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + + + + + update product_calendar_info + + sap_plan_code = #{sapPlanCode}, + material_code = #{materialCode}, + material_name = #{materialName}, + plan_start_date = #{planStartDate}, + plan_end_date = #{planEndDate}, + plan_amount = #{planAmount}, + scheduling_date = #{schedulingDate}, + is_scheduling = #{isScheduling}, + scheduling_team = #{schedulingTeam}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + + where obj_id = #{objId} + + + + delete from product_calendar_info where obj_id = #{objId} + + + + delete from product_calendar_info where obj_id in + + #{objId} + + + \ No newline at end of file