From 17f6c8bdaad74c136ef4569527a55204dc317f22 Mon Sep 17 00:00:00 2001 From: zhuyiyi <649091362@qq.com> Date: Fri, 29 Aug 2025 10:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/lingtao/net/bean/TipContent.java | 28 ++ .../net/controller/TipContentController.java | 64 ++++ .../lingtao/net/dao/TipContentMapper.java | 18 ++ .../lingtao/net/service/ProductService.java | 8 +- .../net/service/TipContentService.java | 58 ++++ .../resources/mapper/TipContentMapper.xml | 51 ++++ src/main/webapp/js/ossUploader.js | 59 ++++ .../instructions/manage/addPrinting.jsp | 172 +++++++++++ .../system/instructions/manage/printing.jsp | 276 ++++++++++++++++++ .../system/instructions/reveal/printing.jsp | 259 ++++++++++++++++ 10 files changed, 989 insertions(+), 4 deletions(-) create mode 100644 src/main/java/lingtao/net/bean/TipContent.java create mode 100644 src/main/java/lingtao/net/controller/TipContentController.java create mode 100644 src/main/java/lingtao/net/dao/TipContentMapper.java create mode 100644 src/main/java/lingtao/net/service/TipContentService.java create mode 100644 src/main/resources/mapper/TipContentMapper.xml create mode 100644 src/main/webapp/js/ossUploader.js create mode 100644 src/main/webapp/views/system/instructions/manage/addPrinting.jsp create mode 100644 src/main/webapp/views/system/instructions/manage/printing.jsp create mode 100644 src/main/webapp/views/system/instructions/reveal/printing.jsp diff --git a/src/main/java/lingtao/net/bean/TipContent.java b/src/main/java/lingtao/net/bean/TipContent.java new file mode 100644 index 0000000..64acc7f --- /dev/null +++ b/src/main/java/lingtao/net/bean/TipContent.java @@ -0,0 +1,28 @@ +package lingtao.net.bean; + +import lombok.Data; + +import java.util.Date; + +@Data +public class TipContent { + private Integer id; + + private int type; + + private String content; + + private String createBy; + + private Date createDate; + + private String updateBy; + + private Date updateDate; + + private String title; + /** + * 附件 + */ + private String attachment; +} diff --git a/src/main/java/lingtao/net/controller/TipContentController.java b/src/main/java/lingtao/net/controller/TipContentController.java new file mode 100644 index 0000000..f039593 --- /dev/null +++ b/src/main/java/lingtao/net/controller/TipContentController.java @@ -0,0 +1,64 @@ +package lingtao.net.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lingtao.net.bean.Msg; +import lingtao.net.bean.StandardMemo; +import lingtao.net.bean.TipContent; +import lingtao.net.service.StandardMemoService; +import lingtao.net.service.TipContentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpSession; +import java.util.List; + +@RestController +public class TipContentController { + + @Autowired + private TipContentService tipContentService; + + /** + * 产品知识列表 + * + * @return + */ + @RequestMapping("/getTipContent") + public Msg getStandard(@RequestParam(value = "page", defaultValue = "1") Integer page, + @RequestParam(value = "limit", defaultValue = "10") Integer limit, TipContent tipContent) { + PageHelper.startPage(page, limit); + List tipContentList = tipContentService.getTipContents(tipContent); + PageInfo pageInfo = new PageInfo<>(tipContentList); + return Msg.success().add("list", pageInfo); + } + + /** + * 添加产品知识 + */ + @RequestMapping("/addTipContent") + public Msg addStandard(TipContent tipContent, HttpSession session) { + tipContentService.addTipContent(tipContent, session); + return Msg.success(); + } + + /** + * 修改产品知识 + */ + @RequestMapping("/updateTipContent") + public Msg updateStandard(TipContent tipContent, HttpSession session) { + tipContentService.updateTipContentById(tipContent, session); + return Msg.success(); + } + + /** + * 删除 + */ + @RequestMapping("/deleteTipContent") + public Msg deleteStandard(@RequestParam("id") Integer id) { + tipContentService.deleteTipContentById(id); + return Msg.success(); + } +} diff --git a/src/main/java/lingtao/net/dao/TipContentMapper.java b/src/main/java/lingtao/net/dao/TipContentMapper.java new file mode 100644 index 0000000..b47a92b --- /dev/null +++ b/src/main/java/lingtao/net/dao/TipContentMapper.java @@ -0,0 +1,18 @@ +package lingtao.net.dao; + +import lingtao.net.bean.StandardMemo; +import lingtao.net.bean.TipContent; + +import java.util.List; + +public interface TipContentMapper { + + List getTipContents(TipContent standardMemo); + + void addTipContent(TipContent standardMemo); + + void updateTipContentById(TipContent standardMemo); + + void deleteTipContentById(Integer id); + +} diff --git a/src/main/java/lingtao/net/service/ProductService.java b/src/main/java/lingtao/net/service/ProductService.java index dec5f6b..af179ac 100644 --- a/src/main/java/lingtao/net/service/ProductService.java +++ b/src/main/java/lingtao/net/service/ProductService.java @@ -688,16 +688,16 @@ public class ProductService { for (Product product : priceList) { double carft_price = 0; if (craftList.contains("压痕")) { - carft_price += Math.max(0.02 * product.getCount(), 10); + carft_price += Math.max(0.02 * product.getCount(), 10) * number; } if (craftList.contains("压点线")) { - carft_price += Math.max(0.02 * product.getCount(), 10); + carft_price += Math.max(0.02 * product.getCount(), 10) * number; } if (craftList.contains("圆角")) { - carft_price += Math.max(0.02 * product.getCount(), 10); + carft_price += Math.max(0.02 * product.getCount(), 10) * number; } //腰封的模切费单独计算 - product.setPrice(Math.ceil((product.getPrice() + carft_price) * number)); + product.setPrice(Math.ceil((product.getPrice() + carft_price))); product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86)); } if (isMq) { diff --git a/src/main/java/lingtao/net/service/TipContentService.java b/src/main/java/lingtao/net/service/TipContentService.java new file mode 100644 index 0000000..465ffa4 --- /dev/null +++ b/src/main/java/lingtao/net/service/TipContentService.java @@ -0,0 +1,58 @@ +package lingtao.net.service; + +import lingtao.net.bean.Msg; +import lingtao.net.bean.StandardMemo; +import lingtao.net.bean.SysUser; +import lingtao.net.bean.TipContent; +import lingtao.net.dao.StandardMemoMapper; +import lingtao.net.dao.TipContentMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpSession; +import java.util.List; + +@Service +public class TipContentService { + + @Autowired + private TipContentMapper tipContentMapper; + + public List getTipContents(TipContent tipContent) { + return tipContentMapper.getTipContents(tipContent); + } + + public Msg addTipContent(TipContent tipContent, HttpSession session) { + SysUser user = (SysUser) session.getAttribute("USER_SESSION"); + tipContent.setCreateBy(user.getRealname()); + try { + tipContentMapper.addTipContent(tipContent); + return Msg.success(); + } catch (Exception e) { + return Msg.fail(); + } + } + + public Msg updateTipContentById(TipContent tipContent, HttpSession session) { + SysUser user = (SysUser) session.getAttribute("USER_SESSION"); + tipContent.setUpdateBy(user.getRealname()); + try { + tipContentMapper.updateTipContentById(tipContent); + return Msg.success(); + } catch (Exception e) { + return Msg.fail(); + } + + } + + public Msg deleteTipContentById(Integer id) { + try { + tipContentMapper.deleteTipContentById(id); + return Msg.success(); + } catch (Exception e) { + return Msg.fail(); + } + + } + +} diff --git a/src/main/resources/mapper/TipContentMapper.xml b/src/main/resources/mapper/TipContentMapper.xml new file mode 100644 index 0000000..792da3b --- /dev/null +++ b/src/main/resources/mapper/TipContentMapper.xml @@ -0,0 +1,51 @@ + + + + + + + insert into tbl_tip_content + (content, createBy, createDate, title,attachment,type) + values (#{content}, #{createBy}, now(), #{title}, #{attachment}, #{type}) + + + + update tbl_tip_content + + + content = #{content,jdbcType=VARCHAR}, + + + updateBy = #{updateBy,jdbcType=VARCHAR}, + + + updateDate = now(), + + + title = #{title,jdbcType=VARCHAR}, + + + attachment = #{attachment,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + delete + from tbl_tip_content + where id = #{id} + + \ No newline at end of file diff --git a/src/main/webapp/js/ossUploader.js b/src/main/webapp/js/ossUploader.js new file mode 100644 index 0000000..b85771e --- /dev/null +++ b/src/main/webapp/js/ossUploader.js @@ -0,0 +1,59 @@ +const client = new OSS({ + // yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。 + region: "oss-cn-fuzhou", + // 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。 + accessKeyId: "LTAI5tE7wuNkeT9jZ42bQnyr", + accessKeySecret: "NnutvWhKl4HbQFSad3HosYbCkEkbjN", + // 填写存储空间名称。 + bucket: "dfdiyfile", + endpoint: "https://oss-cn-fuzhou.aliyuncs.com", +}); + +async function uploadFile(file) { + let fileDir = dateFtt("yyyyMMdd", new Date()) + let name = "priceImages/" + fileDir + "/" + guid() + getSuff(file.name); + // 填写Object完整路径。Object完整路径中不能包含Bucket名称。 + // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。 + // data对象可以自定义为file对象、Blob数据或者OSS Buffer。 + const options = { + headers: {"Content-Type": "text/plain"}, + }; + let index = layer.load(); + const result = await client.put(name, file, options); + layer.close(index); + return result.url; +} + +function dateFtt(fmt, date) { + var o = { + "M+": date.getMonth() + 1, //月份 + "d+": date.getDate(), //日 + "h+": date.getHours(), //小时 + "m+": date.getMinutes(), //分 + "s+": date.getSeconds(), //秒 + "q+": Math.floor((date.getMonth() + 3) / 3), //季度 + "S": date.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); + } + for (var k in o) { + if (new RegExp("(" + k + ")").test(fmt)) + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); + + } + return fmt; + +} + +function getSuff(name) { + return name.substring(name.lastIndexOf(".")); +} + +function guid() { + return "xxxxxxxx-xxxx-4xxx-yxxx".replace(/[xy]/g, function (c) { + var r = (Math.random() * 16) | 0, + v = c == "x" ? r : (r & 0x3) | 0x8; + return v.toString(16); + }); +} \ No newline at end of file diff --git a/src/main/webapp/views/system/instructions/manage/addPrinting.jsp b/src/main/webapp/views/system/instructions/manage/addPrinting.jsp new file mode 100644 index 0000000..d018976 --- /dev/null +++ b/src/main/webapp/views/system/instructions/manage/addPrinting.jsp @@ -0,0 +1,172 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + 添加产品须知 + <%@include file="/views/common.jsp" %> + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ + + +
+
+
+ +
+
+
+
+ + +
+
+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/views/system/instructions/manage/printing.jsp b/src/main/webapp/views/system/instructions/manage/printing.jsp new file mode 100644 index 0000000..9e08a3b --- /dev/null +++ b/src/main/webapp/views/system/instructions/manage/printing.jsp @@ -0,0 +1,276 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + 产品知识列表 + <%@include file="/views/common.jsp" %> + + + + + + +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/views/system/instructions/reveal/printing.jsp b/src/main/webapp/views/system/instructions/reveal/printing.jsp new file mode 100644 index 0000000..876e039 --- /dev/null +++ b/src/main/webapp/views/system/instructions/reveal/printing.jsp @@ -0,0 +1,259 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + 产品知识列表 + <%@include file="/views/common.jsp" %> + + + + + + +
+
+
+ +
+ +
+
+
+
+ + +
+
+
+
+ + + \ No newline at end of file