From 8694b17db423ae8509cddbcdb63a882251b1c8cd Mon Sep 17 00:00:00 2001 From: wenshijun Date: Tue, 27 May 2025 14:38:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E8=AE=A1=E5=88=92=EF=BC=8C?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=98=A0=E5=B0=84=E6=8E=A5=E5=8F=A3=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zg/framework/config/SecurityConfig.java | 2 + .../security/service/SysLoginService.java | 24 ++ .../controller/SceneMappingController.java | 105 +++++++ .../Information/domain/SceneMapping.java | 67 ++++ .../Information/domain/StockInType.java | 132 ++++++++ .../Information/domain/WarehouseInfo.java | 147 +++++++++ .../mapper/SceneMappingMapper.java | 62 ++++ .../service/ISceneMappingService.java | 62 ++++ .../service/impl/SceneMappingServiceImpl.java | 94 ++++++ .../project/wisdom/login/LoginController.java | 49 +++ .../plan/controller/GysJhController.java | 124 ++++++++ .../zg/project/wisdom/plan/domain/GysJh.java | 295 ++++++++++++++++++ .../wisdom/plan/mapper/GysJhMapper.java | 69 ++++ .../wisdom/plan/service/IGysJhService.java | 71 +++++ .../plan/service/impl/GysJhServiceImpl.java | 135 ++++++++ src/main/resources/application-druid.yml | 4 +- src/main/resources/application.yml | 6 +- src/main/resources/banner.txt | 38 +-- .../information/SceneMappingMapper.xml | 61 ++++ .../resources/mybatis/query/GysJhMapper.xml | 166 ++++++++++ 20 files changed, 1687 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/zg/project/Information/controller/SceneMappingController.java create mode 100644 src/main/java/com/zg/project/Information/domain/SceneMapping.java create mode 100644 src/main/java/com/zg/project/Information/domain/StockInType.java create mode 100644 src/main/java/com/zg/project/Information/domain/WarehouseInfo.java create mode 100644 src/main/java/com/zg/project/Information/mapper/SceneMappingMapper.java create mode 100644 src/main/java/com/zg/project/Information/service/ISceneMappingService.java create mode 100644 src/main/java/com/zg/project/Information/service/impl/SceneMappingServiceImpl.java create mode 100644 src/main/java/com/zg/project/wisdom/login/LoginController.java create mode 100644 src/main/java/com/zg/project/wisdom/plan/controller/GysJhController.java create mode 100644 src/main/java/com/zg/project/wisdom/plan/domain/GysJh.java create mode 100644 src/main/java/com/zg/project/wisdom/plan/mapper/GysJhMapper.java create mode 100644 src/main/java/com/zg/project/wisdom/plan/service/IGysJhService.java create mode 100644 src/main/java/com/zg/project/wisdom/plan/service/impl/GysJhServiceImpl.java create mode 100644 src/main/resources/mybatis/information/SceneMappingMapper.xml create mode 100644 src/main/resources/mybatis/query/GysJhMapper.xml diff --git a/src/main/java/com/zg/framework/config/SecurityConfig.java b/src/main/java/com/zg/framework/config/SecurityConfig.java index b35d8e3..1ea5ef0 100644 --- a/src/main/java/com/zg/framework/config/SecurityConfig.java +++ b/src/main/java/com/zg/framework/config/SecurityConfig.java @@ -114,6 +114,8 @@ public class SecurityConfig requests.antMatchers("/login", "/register", "/captchaImage", + "/user/**", + "/query/jh/**", "/AutoInventory/**", "/ws/**", "/information/device/**", diff --git a/src/main/java/com/zg/framework/security/service/SysLoginService.java b/src/main/java/com/zg/framework/security/service/SysLoginService.java index 5487970..aa57414 100644 --- a/src/main/java/com/zg/framework/security/service/SysLoginService.java +++ b/src/main/java/com/zg/framework/security/service/SysLoginService.java @@ -178,4 +178,28 @@ public class SysLoginService sysUser.setLoginDate(DateUtils.getNowDate()); userService.updateUserProfile(sysUser); } + + public LoginUser loginWithoutCaptcha(String username, String password) { + loginPreCheck(username, password); + + Authentication authentication; + + try { + UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password); + + AuthenticationContextHolder.setContext(token); + + authentication = authenticationManager.authenticate(token); + }catch (Exception e){ + throw new ServiceException("登录失败"); + }finally { + AuthenticationContextHolder.clearContext(); + } + + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + + recordLoginInfo(loginUser.getUserId()); + + return loginUser; + } } diff --git a/src/main/java/com/zg/project/Information/controller/SceneMappingController.java b/src/main/java/com/zg/project/Information/controller/SceneMappingController.java new file mode 100644 index 0000000..9474f4d --- /dev/null +++ b/src/main/java/com/zg/project/Information/controller/SceneMappingController.java @@ -0,0 +1,105 @@ +package com.zg.project.Information.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zg.project.Information.domain.SceneMapping; +import com.zg.project.Information.service.ISceneMappingService; +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.zg.framework.aspectj.lang.annotation.Log; +import com.zg.framework.aspectj.lang.enums.BusinessType; +import com.zg.framework.web.controller.BaseController; +import com.zg.framework.web.domain.AjaxResult; +import com.zg.common.utils.poi.ExcelUtil; +import com.zg.framework.web.page.TableDataInfo; + +/** + * 场景编号Controller + * + * @author zg + * @date 2025-05-24 + */ +@RestController +@RequestMapping("/information/scene") +public class SceneMappingController extends BaseController +{ + @Autowired + private ISceneMappingService sceneMappingService; + + /** + * 查询场景编号列表 + */ + @PreAuthorize("@ss.hasPermi('information:scene:list')") + @GetMapping("/list") + public TableDataInfo list(SceneMapping sceneMapping) + { + startPage(); + List list = sceneMappingService.selectSceneMappingList(sceneMapping); + return getDataTable(list); + } + + /** + * 导出场景编号列表 + */ + @PreAuthorize("@ss.hasPermi('information:scene:export')") + @Log(title = "场景编号", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SceneMapping sceneMapping) + { + List list = sceneMappingService.selectSceneMappingList(sceneMapping); + ExcelUtil util = new ExcelUtil(SceneMapping.class); + util.exportExcel(response, list, "场景编号数据"); + } + + /** + * 获取场景编号详细信息 + */ + @PreAuthorize("@ss.hasPermi('information:scene:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sceneMappingService.selectSceneMappingById(id)); + } + + /** + * 新增场景编号 + */ + @PreAuthorize("@ss.hasPermi('information:scene:add')") + @Log(title = "场景编号", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SceneMapping sceneMapping) + { + return toAjax(sceneMappingService.insertSceneMapping(sceneMapping)); + } + + /** + * 修改场景编号 + */ + @PreAuthorize("@ss.hasPermi('information:scene:edit')") + @Log(title = "场景编号", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SceneMapping sceneMapping) + { + return toAjax(sceneMappingService.updateSceneMapping(sceneMapping)); + } + + /** + * 删除场景编号 + */ + @PreAuthorize("@ss.hasPermi('information:scene:remove')") + @Log(title = "场景编号", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sceneMappingService.deleteSceneMappingByIds(ids)); + } +} diff --git a/src/main/java/com/zg/project/Information/domain/SceneMapping.java b/src/main/java/com/zg/project/Information/domain/SceneMapping.java new file mode 100644 index 0000000..4f6e651 --- /dev/null +++ b/src/main/java/com/zg/project/Information/domain/SceneMapping.java @@ -0,0 +1,67 @@ +package com.zg.project.Information.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zg.framework.aspectj.lang.annotation.Excel; +import com.zg.framework.web.domain.BaseEntity; + +/** + * 场景编号对象 scene_mapping + * + * @author zg + * @date 2025-05-24 + */ +public class SceneMapping extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 自增主键 */ + private Long id; + + /** 场景编号 */ + @Excel(name = "场景编号") + private String sceneCode; + + /** 场景名称 */ + @Excel(name = "场景名称") + private String sceneName; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setSceneCode(String sceneCode) + { + this.sceneCode = sceneCode; + } + + public String getSceneCode() + { + return sceneCode; + } + + public void setSceneName(String sceneName) + { + this.sceneName = sceneName; + } + + public String getSceneName() + { + return sceneName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("sceneCode", getSceneCode()) + .append("sceneName", getSceneName()) + .toString(); + } +} diff --git a/src/main/java/com/zg/project/Information/domain/StockInType.java b/src/main/java/com/zg/project/Information/domain/StockInType.java new file mode 100644 index 0000000..6e3c42f --- /dev/null +++ b/src/main/java/com/zg/project/Information/domain/StockInType.java @@ -0,0 +1,132 @@ +package com.zg.project.Information.domain; + +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.zg.framework.aspectj.lang.annotation.Excel; +import com.zg.framework.web.domain.BaseEntity; + +/** + * 入库类型对象 stock_in_type + * + * @author zg + * @date 2025-05-24 + */ +public class StockInType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 入库类型编码 */ + @Excel(name = "入库类型编码") + private String typeCode; + + /** 入库类型名称 */ + @Excel(name = "入库类型名称") + private String typeName; + + /** 状态(1=启用,0=禁用) */ + @Excel(name = "状态", readConverterExp = "1==启用,0=禁用") + private Long status; + + /** 排序值 */ + @Excel(name = "排序值") + private Long sort; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setTypeCode(String typeCode) + { + this.typeCode = typeCode; + } + + public String getTypeCode() + { + return typeCode; + } + + public void setTypeName(String typeName) + { + this.typeName = typeName; + } + + public String getTypeName() + { + return typeName; + } + + public void setStatus(Long status) + { + this.status = status; + } + + public Long getStatus() + { + return status; + } + + public void setSort(Long sort) + { + this.sort = sort; + } + + public Long getSort() + { + return sort; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("typeCode", getTypeCode()) + .append("typeName", getTypeName()) + .append("status", getStatus()) + .append("sort", getSort()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/src/main/java/com/zg/project/Information/domain/WarehouseInfo.java b/src/main/java/com/zg/project/Information/domain/WarehouseInfo.java new file mode 100644 index 0000000..dd4e65f --- /dev/null +++ b/src/main/java/com/zg/project/Information/domain/WarehouseInfo.java @@ -0,0 +1,147 @@ +package com.zg.project.Information.domain; + +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.zg.framework.aspectj.lang.annotation.Excel; +import com.zg.framework.web.domain.BaseEntity; + +/** + * 仓库信息对象 warehouse_info + * + * @author zg + * @date 2025-05-24 + */ +public class WarehouseInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 仓库地址 */ + @Excel(name = "仓库地址") + private String address; + + /** 状态(1=启用,0=禁用) */ + @Excel(name = "状态", readConverterExp = "1==启用,0=禁用") + private Long status; + + /** 排序值 */ + @Excel(name = "排序值") + private Long sort; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + + public void setAddress(String address) + { + this.address = address; + } + + public String getAddress() + { + return address; + } + + public void setStatus(Long status) + { + this.status = status; + } + + public Long getStatus() + { + return status; + } + + public void setSort(Long sort) + { + this.sort = sort; + } + + public Long getSort() + { + return sort; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("address", getAddress()) + .append("status", getStatus()) + .append("sort", getSort()) + .append("remark", getRemark()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/src/main/java/com/zg/project/Information/mapper/SceneMappingMapper.java b/src/main/java/com/zg/project/Information/mapper/SceneMappingMapper.java new file mode 100644 index 0000000..70e7dd3 --- /dev/null +++ b/src/main/java/com/zg/project/Information/mapper/SceneMappingMapper.java @@ -0,0 +1,62 @@ +package com.zg.project.Information.mapper; + +import com.zg.project.Information.domain.SceneMapping; + +import java.util.List; + +/** + * 场景编号Mapper接口 + * + * @author zg + * @date 2025-05-24 + */ +public interface SceneMappingMapper +{ + /** + * 查询场景编号 + * + * @param id 场景编号主键 + * @return 场景编号 + */ + public SceneMapping selectSceneMappingById(Long id); + + /** + * 查询场景编号列表 + * + * @param sceneMapping 场景编号 + * @return 场景编号集合 + */ + public List selectSceneMappingList(SceneMapping sceneMapping); + + /** + * 新增场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + public int insertSceneMapping(SceneMapping sceneMapping); + + /** + * 修改场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + public int updateSceneMapping(SceneMapping sceneMapping); + + /** + * 删除场景编号 + * + * @param id 场景编号主键 + * @return 结果 + */ + public int deleteSceneMappingById(Long id); + + /** + * 批量删除场景编号 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSceneMappingByIds(Long[] ids); +} diff --git a/src/main/java/com/zg/project/Information/service/ISceneMappingService.java b/src/main/java/com/zg/project/Information/service/ISceneMappingService.java new file mode 100644 index 0000000..af06f03 --- /dev/null +++ b/src/main/java/com/zg/project/Information/service/ISceneMappingService.java @@ -0,0 +1,62 @@ +package com.zg.project.Information.service; + +import com.zg.project.Information.domain.SceneMapping; + +import java.util.List; + +/** + * 场景编号Service接口 + * + * @author zg + * @date 2025-05-24 + */ +public interface ISceneMappingService +{ + /** + * 查询场景编号 + * + * @param id 场景编号主键 + * @return 场景编号 + */ + public SceneMapping selectSceneMappingById(Long id); + + /** + * 查询场景编号列表 + * + * @param sceneMapping 场景编号 + * @return 场景编号集合 + */ + public List selectSceneMappingList(SceneMapping sceneMapping); + + /** + * 新增场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + public int insertSceneMapping(SceneMapping sceneMapping); + + /** + * 修改场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + public int updateSceneMapping(SceneMapping sceneMapping); + + /** + * 批量删除场景编号 + * + * @param ids 需要删除的场景编号主键集合 + * @return 结果 + */ + public int deleteSceneMappingByIds(Long[] ids); + + /** + * 删除场景编号信息 + * + * @param id 场景编号主键 + * @return 结果 + */ + public int deleteSceneMappingById(Long id); +} diff --git a/src/main/java/com/zg/project/Information/service/impl/SceneMappingServiceImpl.java b/src/main/java/com/zg/project/Information/service/impl/SceneMappingServiceImpl.java new file mode 100644 index 0000000..77c5177 --- /dev/null +++ b/src/main/java/com/zg/project/Information/service/impl/SceneMappingServiceImpl.java @@ -0,0 +1,94 @@ +package com.zg.project.Information.service.impl; + +import java.util.List; + +import com.zg.project.Information.domain.SceneMapping; +import com.zg.project.Information.mapper.SceneMappingMapper; +import com.zg.project.Information.service.ISceneMappingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 场景编号Service业务层处理 + * + * @author zg + * @date 2025-05-24 + */ +@Service +public class SceneMappingServiceImpl implements ISceneMappingService +{ + @Autowired + private SceneMappingMapper sceneMappingMapper; + + /** + * 查询场景编号 + * + * @param id 场景编号主键 + * @return 场景编号 + */ + @Override + public SceneMapping selectSceneMappingById(Long id) + { + return sceneMappingMapper.selectSceneMappingById(id); + } + + /** + * 查询场景编号列表 + * + * @param sceneMapping 场景编号 + * @return 场景编号 + */ + @Override + public List selectSceneMappingList(SceneMapping sceneMapping) + { + return sceneMappingMapper.selectSceneMappingList(sceneMapping); + } + + /** + * 新增场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + @Override + public int insertSceneMapping(SceneMapping sceneMapping) + { + return sceneMappingMapper.insertSceneMapping(sceneMapping); + } + + /** + * 修改场景编号 + * + * @param sceneMapping 场景编号 + * @return 结果 + */ + @Override + public int updateSceneMapping(SceneMapping sceneMapping) + { + return sceneMappingMapper.updateSceneMapping(sceneMapping); + } + + /** + * 批量删除场景编号 + * + * @param ids 需要删除的场景编号主键 + * @return 结果 + */ + @Override + public int deleteSceneMappingByIds(Long[] ids) + { + return sceneMappingMapper.deleteSceneMappingByIds(ids); + } + + /** + * 删除场景编号信息 + * + * @param id 场景编号主键 + * @return 结果 + */ + @Override + public int deleteSceneMappingById(Long id) + { + return sceneMappingMapper.deleteSceneMappingById(id); + } +} diff --git a/src/main/java/com/zg/project/wisdom/login/LoginController.java b/src/main/java/com/zg/project/wisdom/login/LoginController.java new file mode 100644 index 0000000..f363581 --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/login/LoginController.java @@ -0,0 +1,49 @@ +package com.zg.project.wisdom.login; + +import com.zg.common.constant.Constants; +import com.zg.framework.security.LoginBody; +import com.zg.framework.security.LoginUser; +import com.zg.framework.security.service.SysLoginService; +import com.zg.framework.security.service.TokenService; +import com.zg.framework.web.domain.AjaxResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/user") +public class LoginController { + + @Autowired + private SysLoginService loginService; + + @Autowired + private TokenService tokenService; + + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @PostMapping("/login") + public AjaxResult login(@RequestBody LoginBody loginBody) { + String username = loginBody.getUsername(); + String password = loginBody.getPassword(); + + LoginUser loginUser = loginService.loginWithoutCaptcha(username, password); + + String token = tokenService.createToken(loginUser); + + Map data = new HashMap<>(); + data.put("token", token); + data.put("user", loginUser.getUser()); + + return AjaxResult.success(data); + } +} diff --git a/src/main/java/com/zg/project/wisdom/plan/controller/GysJhController.java b/src/main/java/com/zg/project/wisdom/plan/controller/GysJhController.java new file mode 100644 index 0000000..817420e --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/plan/controller/GysJhController.java @@ -0,0 +1,124 @@ +package com.zg.project.wisdom.plan.controller; + +import java.io.IOException; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zg.framework.aspectj.lang.annotation.Log; +import com.zg.framework.aspectj.lang.enums.BusinessType; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import com.zg.project.wisdom.plan.domain.GysJh; +import com.zg.project.wisdom.plan.service.IGysJhService; +import com.zg.framework.web.controller.BaseController; +import com.zg.framework.web.domain.AjaxResult; +import com.zg.common.utils.poi.ExcelUtil; +import com.zg.framework.web.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 供应计划Controller + * + * @author zg + * @date 2025-05-12 + */ +@RestController +@RequestMapping("/plan/jh") +public class GysJhController extends BaseController { + + @Autowired + private IGysJhService gysJhService; + + /** + * 查询供应计划列表 + */ + @PreAuthorize("@ss.hasPermi('query:jh:list')") + @GetMapping("/list") + public TableDataInfo list(GysJh gysJh) { + + startPage(); + List list = gysJhService.selectGysJhList(gysJh); + return getDataTable(list); + + } + + /** + * 导出供应计划列表 + */ + @PreAuthorize("@ss.hasPermi('query:jh:export')") + @Log(title = "供应计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, GysJh gysJh) { + + List list = gysJhService.selectGysJhList(gysJh); + ExcelUtil util = new ExcelUtil(GysJh.class); + util.exportExcel(response, list, "供应计划数据"); + + } + + /** + * 获取供应计划详细信息 + */ + @PreAuthorize("@ss.hasPermi('query:jh:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + + return success(gysJhService.selectGysJhById(id)); + + } + + /** + * 新增供应计划 + */ + @PreAuthorize("@ss.hasPermi('query:jh:add')") + @Log(title = "供应计划", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody GysJh gysJh) { + + return toAjax(gysJhService.insertGysJh(gysJh)); + + } + + /** + * 供应计划导入 + */ + @PreAuthorize("@ss.hasPermi('query:jh:import')") + @Log(title = "供应计划", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(@RequestParam("file") MultipartFile file, boolean updateSupport) throws IOException { + + ExcelUtil util = new ExcelUtil<>(GysJh.class); + List list = util.importExcel(file.getInputStream()); + String operator = getUsername(); + String message = gysJhService.importGysJh(list, updateSupport, "zhangsan"); + + return AjaxResult.success(message); + } + + /** + * 修改供应计划 + */ + @PreAuthorize("@ss.hasPermi('query:jh:edit')") + @Log(title = "供应计划", businessType = BusinessType.UPDATE) + @PutMapping("/update") + public AjaxResult edit(@RequestBody GysJh gysJh) { + + return toAjax(gysJhService.updateGysJh(gysJh)); + + } + + /** + * 删除供应计划 + */ + @PreAuthorize("@ss.hasPermi('query:jh:remove')") + @Log(title = "供应计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + + return toAjax(gysJhService.deleteGysJhByIds(ids)); + + } + +} diff --git a/src/main/java/com/zg/project/wisdom/plan/domain/GysJh.java b/src/main/java/com/zg/project/wisdom/plan/domain/GysJh.java new file mode 100644 index 0000000..224cd02 --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/plan/domain/GysJh.java @@ -0,0 +1,295 @@ +package com.zg.project.wisdom.plan.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zg.framework.aspectj.lang.annotation.Excel; +import com.zg.framework.web.domain.BaseEntity; + +/** + * 供应计划对象 gys_jh + * + * @author zg + * @date 2025-05-12 + */ +public class GysJh extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 县局 */ + @Excel(name = "县局") + private String xj; + + /** 项目号 */ + @Excel(name = "项目号") + private String xmNo; + + /** 项目描述 */ + @Excel(name = "项目描述") + private String xmMs; + + /** 物料号 */ + @Excel(name = "物料号") + private String wlNo; + + /** 物料描述 */ + @Excel(name = "物料描述") + private String wlMs; + + /** 供应商编码 */ + @Excel(name = "供应商编码") + private String gysNo; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String gysMc; + + /** 计划交货金额 */ + @Excel(name = "计划交货金额") + private BigDecimal jhAmt; + + /** 合同单价 */ + @Excel(name = "合同单价") + private BigDecimal htDj; + + /** SAP订单编号 */ + @Excel(name = "SAP订单编号") + private String sapNo; + + /** 行号 */ + @Excel(name = "行号") + private String xh; + + /** 计划交货数量 */ + @Excel(name = "计划交货数量") + private Long jhQty; + + /** 合同数量 */ + @Excel(name = "合同数量") + private Long htQty; + + /** 计量单位 */ + @Excel(name = "计量单位") + private String dw; + + /** 备注 */ + @Excel(name = "备注") + private String remark; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0:未到货,1:已入库") + private String status; + + /** 是否删除(0正常 1删除) */ + @Excel(name = "是否删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setXj(String xj) + { + this.xj = xj; + } + + public String getXj() + { + return xj; + } + + public void setXmNo(String xmNo) + { + this.xmNo = xmNo; + } + + public String getXmNo() + { + return xmNo; + } + + public void setXmMs(String xmMs) + { + this.xmMs = xmMs; + } + + public String getXmMs() + { + return xmMs; + } + + public void setWlNo(String wlNo) + { + this.wlNo = wlNo; + } + + public String getWlNo() + { + return wlNo; + } + + public void setWlMs(String wlMs) + { + this.wlMs = wlMs; + } + + public String getWlMs() + { + return wlMs; + } + + public void setGysNo(String gysNo) + { + this.gysNo = gysNo; + } + + public String getGysNo() + { + return gysNo; + } + + public void setGysMc(String gysMc) + { + this.gysMc = gysMc; + } + + public String getGysMc() + { + return gysMc; + } + + public void setJhAmt(BigDecimal jhAmt) + { + this.jhAmt = jhAmt; + } + + public BigDecimal getJhAmt() + { + return jhAmt; + } + + public void setHtDj(BigDecimal htDj) + { + this.htDj = htDj; + } + + public BigDecimal getHtDj() + { + return htDj; + } + + public void setSapNo(String sapNo) + { + this.sapNo = sapNo; + } + + public String getSapNo() + { + return sapNo; + } + + public void setXh(String xh) + { + this.xh = xh; + } + + public String getXh() + { + return xh; + } + + public void setJhQty(Long jhQty) + { + this.jhQty = jhQty; + } + + public Long getJhQty() + { + return jhQty; + } + + public void setHtQty(Long htQty) + { + this.htQty = htQty; + } + + public Long getHtQty() + { + return htQty; + } + + public void setDw(String dw) + { + this.dw = dw; + } + + public String getDw() + { + return dw; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + public void setIsDelete(String isDelete) + { + this.isDelete = isDelete; + } + + public String getIsDelete() + { + return isDelete; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("xj", getXj()) + .append("xmNo", getXmNo()) + .append("xmMs", getXmMs()) + .append("wlNo", getWlNo()) + .append("wlMs", getWlMs()) + .append("gysNo", getGysNo()) + .append("gysMc", getGysMc()) + .append("jhAmt", getJhAmt()) + .append("htDj", getHtDj()) + .append("sapNo", getSapNo()) + .append("xh", getXh()) + .append("jhQty", getJhQty()) + .append("htQty", getHtQty()) + .append("dw", getDw()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("isDelete", getIsDelete()) + .append("status", getStatus()) + .toString(); + } +} diff --git a/src/main/java/com/zg/project/wisdom/plan/mapper/GysJhMapper.java b/src/main/java/com/zg/project/wisdom/plan/mapper/GysJhMapper.java new file mode 100644 index 0000000..655b9b5 --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/plan/mapper/GysJhMapper.java @@ -0,0 +1,69 @@ +package com.zg.project.wisdom.plan.mapper; + +import java.util.List; +import com.zg.project.wisdom.plan.domain.GysJh; + +/** + * 供应计划Mapper接口 + * + * @author zg + * @date 2025-05-12 + */ +public interface GysJhMapper +{ + /** + * 查询供应计划 + * + * @param id 供应计划主键 + * @return 供应计划 + */ + public GysJh selectGysJhById(Long id); + + /** + * 查询供应计划列表 + * + * @param gysJh 供应计划 + * @return 供应计划集合 + */ + public List selectGysJhList(GysJh gysJh); + + /** + * 新增供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + public int insertGysJh(GysJh gysJh); + + /** + * 修改供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + public int updateGysJh(GysJh gysJh); + + /** + * 删除供应计划 + * + * @param id 供应计划主键 + * @return 结果 + */ + public int deleteGysJhById(Long id); + + /** + * 批量删除供应计划 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteGysJhByIds(Long[] ids); + + /** + * 根据订单号查询是否已存在 + * @param sapNo + * @param xh + * @return + */ + GysJh selectExistByKey(String sapNo, String xh); +} diff --git a/src/main/java/com/zg/project/wisdom/plan/service/IGysJhService.java b/src/main/java/com/zg/project/wisdom/plan/service/IGysJhService.java new file mode 100644 index 0000000..08550ae --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/plan/service/IGysJhService.java @@ -0,0 +1,71 @@ +package com.zg.project.wisdom.plan.service; + +import java.rmi.ServerException; +import java.util.List; +import com.zg.project.wisdom.plan.domain.GysJh; + +/** + * 供应计划Service接口 + * + * @author zg + * @date 2025-05-12 + */ +public interface IGysJhService +{ + /** + * 查询供应计划 + * + * @param id 供应计划主键 + * @return 供应计划 + */ + public GysJh selectGysJhById(Long id); + + /** + * 查询供应计划列表 + * + * @param gysJh 供应计划 + * @return 供应计划集合 + */ + public List selectGysJhList(GysJh gysJh); + + /** + * 新增供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + public int insertGysJh(GysJh gysJh); + + /** + * 修改供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + public int updateGysJh(GysJh gysJh); + + /** + * 批量删除供应计划 + * + * @param ids 需要删除的供应计划主键集合 + * @return 结果 + */ + public int deleteGysJhByIds(Long[] ids); + + /** + * 删除供应计划信息 + * + * @param id 供应计划主键 + * @return 结果 + */ + public int deleteGysJhById(Long id); + + /** + * 供应计划导入 + * @param list + * @param updateSupport + * @param operator + * @return + */ + String importGysJh(List list, boolean updateSupport, String operator) throws ServerException; +} diff --git a/src/main/java/com/zg/project/wisdom/plan/service/impl/GysJhServiceImpl.java b/src/main/java/com/zg/project/wisdom/plan/service/impl/GysJhServiceImpl.java new file mode 100644 index 0000000..76f07bc --- /dev/null +++ b/src/main/java/com/zg/project/wisdom/plan/service/impl/GysJhServiceImpl.java @@ -0,0 +1,135 @@ +package com.zg.project.wisdom.plan.service.impl; + +import java.rmi.ServerException; +import java.util.List; +import com.zg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zg.project.wisdom.plan.mapper.GysJhMapper; +import com.zg.project.wisdom.plan.domain.GysJh; +import com.zg.project.wisdom.plan.service.IGysJhService; + +/** + * 供应计划Service业务层处理 + * + * @author zg + * @date 2025-05-12 + */ +@Service +public class GysJhServiceImpl implements IGysJhService +{ + @Autowired + private GysJhMapper gysJhMapper; + + /** + * 查询供应计划 + * + * @param id 供应计划主键 + * @return 供应计划 + */ + @Override + public GysJh selectGysJhById(Long id) + { + return gysJhMapper.selectGysJhById(id); + } + + /** + * 查询供应计划列表 + * + * @param gysJh 供应计划 + * @return 供应计划 + */ + @Override + public List selectGysJhList(GysJh gysJh) + { + return gysJhMapper.selectGysJhList(gysJh); + } + + /** + * 新增供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + @Override + public int insertGysJh(GysJh gysJh) + { + if (gysJh.getStatus() == null) { + gysJh.setStatus("0"); + } + + gysJh.setCreateTime(DateUtils.getNowDate()); +// String operator = getUsername(); + gysJh.setCreateBy("张三"); + return gysJhMapper.insertGysJh(gysJh); + } + + /** + * 修改供应计划 + * + * @param gysJh 供应计划 + * @return 结果 + */ + @Override + public int updateGysJh(GysJh gysJh) + { + gysJh.setUpdateTime(DateUtils.getNowDate()); +// String operator = getUsername(); + gysJh.setUpdateBy("张三"); + return gysJhMapper.updateGysJh(gysJh); + } + + /** + * 批量删除供应计划 + * + * @param ids 需要删除的供应计划主键 + * @return 结果 + */ + @Override + public int deleteGysJhByIds(Long[] ids) + { + return gysJhMapper.deleteGysJhByIds(ids); + } + + /** + * 删除供应计划信息 + * + * @param id 供应计划主键 + * @return 结果 + */ + @Override + public int deleteGysJhById(Long id) + { + return gysJhMapper.deleteGysJhById(id); + } + + @Override + public String importGysJh(List list, boolean updateSupport, String operator) throws ServerException { + + if (list == null || list.isEmpty()){ + throw new ServerException("导入数据不能为空"); + } + int insertCount = 0 , updateCount = 0; + for (GysJh jh : list) { + if (jh.getStatus() == null) { + jh.setStatus("0"); + } + + GysJh exist = gysJhMapper.selectExistByKey(jh.getSapNo(), jh.getXh()); + + if (exist == null){ + jh.setCreateBy(operator); + jh.setCreateTime(DateUtils.getNowDate()); + gysJhMapper.insertGysJh(jh); + insertCount++; + }else if (updateSupport){ + jh.setId(exist.getId()); + jh.setUpdateBy(operator); + jh.setUpdateTime(DateUtils.getNowDate()); + gysJhMapper.updateGysJh(jh); + updateCount++; + } + } + return String.format("导入成功:新增 %d 条,更新 %d 条。", insertCount, updateCount); + } +} diff --git a/src/main/resources/application-druid.yml b/src/main/resources/application-druid.yml index 3467c64..c438d06 100644 --- a/src/main/resources/application-druid.yml +++ b/src/main/resources/application-druid.yml @@ -6,8 +6,8 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://192.168.1.20:3306/pdxt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 -# url: jdbc:mysql://localhost:3306/pdxt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/pdxt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: shzg # 从库数据源 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b62598b..ac9e02f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,7 +16,7 @@ zg: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 8084 + port: 8086 servlet: # 应用的访问路径 context-path: / @@ -68,8 +68,8 @@ spring: # redis 配置 redis: # 地址 - host: 192.168.1.20 -# host: localhost +# host: 192.168.1.20 + host: localhost # 端口,默认为6379 port: 6379 # 数据库索引 diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 2ee88f6..0f25e88 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -1,24 +1,20 @@ Application Version: ${zg.version} Spring Boot Version: ${spring-boot.version} //////////////////////////////////////////////////////////////////// -// _ooOoo_ // -// o8888888o // -// 88" . "88 // -// (| ^_^ |) // -// O\ = /O // -// ____/`---'\____ // -// .' \\| |// `. // -// / \\||| : |||// \ // -// / _||||| -:- |||||- \ // -// | | \\\ - /// | | // -// | \_| ''\---/'' | | // -// \ .-\__ `-` ___/-. / // -// ___`. .' /--.--\ `. . ___ // -// ."" '< `.___\_<|>_/___.' >'"". // -// | | : `- \`.;`\ _ /`;.`/ - ` : | | // -// \ \ `-. \_ __\ /__ _/ .-` / / // -// ========`-.____`-.___\_____/___.-`____.-'======== // -// `=---=' // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// 上海洲固先登营 一路长虹无阻 // -//////////////////////////////////////////////////////////////////// \ No newline at end of file +// // +// ███████╗██╗ ██╗ █████╗ ██████╗ ███████╗███████╗ // +// ██╔════╝██║ ██║██╔══██╗██╔══██╗██╔════╝██╔════╝ // +// ███████╗███████║███████║██████╔╝█████╗ █████╗ // +// ╚════██║██╔══██║██╔══██║██╔═══╝ ██╔══╝ ██╔══╝ // +// ███████║██║ ██║██║ ██║██║ ███████╗███████╗ // +// ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ // +// // +// ███████╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ // +// ██╔════╝██╔═══██╗██║ ██║██╔═══██╗██╔════╝ ██║ // +// ███████╗██║ ██║██║ ██║██║ ██║██║ ███╗██║ // +// ╚════██║██║ ██║╚██╗ ██╔╝██║ ██║██║ ██║██║ // +// ███████║╚██████╔╝ ╚████╔╝ ╚██████╔╝╚██████╔╝███████╗ // +// ╚══════╝ ╚═════╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝ // +// // +// —— 上海洲固 · 专注智慧物联,筑牢实体管理 —— // +//////////////////////////////////////////////////////////////////// diff --git a/src/main/resources/mybatis/information/SceneMappingMapper.xml b/src/main/resources/mybatis/information/SceneMappingMapper.xml new file mode 100644 index 0000000..bd443f9 --- /dev/null +++ b/src/main/resources/mybatis/information/SceneMappingMapper.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + select id, scene_code, scene_name from scene_mapping + + + + + + + + insert into scene_mapping + + scene_code, + scene_name, + + + #{sceneCode}, + #{sceneName}, + + + + + update scene_mapping + + scene_code = #{sceneCode}, + scene_name = #{sceneName}, + + where id = #{id} + + + + delete from scene_mapping where id = #{id} + + + + delete from scene_mapping where id in + + #{id} + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/query/GysJhMapper.xml b/src/main/resources/mybatis/query/GysJhMapper.xml new file mode 100644 index 0000000..2ff448b --- /dev/null +++ b/src/main/resources/mybatis/query/GysJhMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, xj, xm_no, xm_ms, wl_no, wl_ms, gys_no, gys_mc, jh_amt, ht_dj, sap_no, xh, jh_qty, ht_qty, dw, remark, create_by, create_time, update_by, update_time, is_delete from gys_jh + + + + + + + + + + insert into gys_jh + + xj, + xm_no, + xm_ms, + wl_no, + wl_ms, + gys_no, + gys_mc, + jh_amt, + ht_dj, + sap_no, + xh, + jh_qty, + ht_qty, + dw, + remark, + create_by, + create_time, + update_by, + update_time, + is_delete, + + + #{xj}, + #{xmNo}, + #{xmMs}, + #{wlNo}, + #{wlMs}, + #{gysNo}, + #{gysMc}, + #{jhAmt}, + #{htDj}, + #{sapNo}, + #{xh}, + #{jhQty}, + #{htQty}, + #{dw}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{isDelete}, + + + + + update gys_jh + + xj = #{xj}, + xm_no = #{xmNo}, + xm_ms = #{xmMs}, + wl_no = #{wlNo}, + wl_ms = #{wlMs}, + gys_no = #{gysNo}, + gys_mc = #{gysMc}, + jh_amt = #{jhAmt}, + ht_dj = #{htDj}, + sap_no = #{sapNo}, + xh = #{xh}, + jh_qty = #{jhQty}, + ht_qty = #{htQty}, + dw = #{dw}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + is_delete = #{isDelete}, + + where id = #{id} + + + + delete from gys_jh where id = #{id} + + + + update gys_jh + set is_delete = '1' + where id in + + #{id} + + + \ No newline at end of file