Compare commits

..

1 Commits

Author SHA1 Message Date
zyy d55859d479 新增单价 2025-08-25 15:16:34 +08:00
538 changed files with 8251 additions and 153052 deletions
-1
View File
@@ -1,3 +1,2 @@
.idea/*
target/*
.vscode/*
-22
View File
@@ -190,22 +190,11 @@
<artifactId>UserAgentUtils</artifactId>
<version>1.20</version>
</dependency>
<!-- Source: https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.13</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.24</version>
</dependency>
<dependency>
<groupId>com.luhuiguo</groupId>
<artifactId>aspose-pdf</artifactId>
<version>23.1</version>
</dependency>
<dependency>
<groupId>com.singularsys</groupId>
<artifactId>jep</artifactId>
@@ -213,17 +202,6 @@
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/jep-java-3.5-trial.jar</systemPath>
</dependency>
<!-- Redis依赖 -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.17.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.3</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>
@@ -176,10 +176,4 @@ public class Product {
private String plantName;
private String ui_menu_size;
private String address;
private Double lengthVU;
private Double widthUV;
private Integer cropNumber;
}
@@ -1,36 +0,0 @@
package lingtao.net.bean;
import lombok.Data;
import java.util.Date;
/**
* 产品知识点;
*
* @author Administrator
*/
@Data
public class StandardMemo {
private Integer id;
private String content;
private String createBy;
private Date createDate;
private String updateBy;
private Date updateDate;
/**
* 附件
*/
private String title;
/**
* 描述
*/
private String memo;
private Integer type;
}
@@ -1,28 +0,0 @@
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;
}
@@ -11,7 +11,6 @@ import lingtao.net.bean.SysUser;
import lingtao.net.service.PriceService;
import lingtao.net.service.ProductService;
import lingtao.net.service.QuoteLogService;
import lingtao.net.util.HuaFangPriceUtil;
import lingtao.net.vo.PricingListVo;
import lingtao.net.vo.ProductVo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,9 +103,7 @@ public class ProductController {
product.setRole(user.getRole());
if ("菜单".equals(product.getProTypeLabel())) {
if (product.getSize1() != null) {
product.setSize(product.getSize1().replace(",", ""));
}
String s = request.getParameter("kindValue5");
product.setKind1Value(s);
product.setSize(request.getParameter("ui_menu_size"));
@@ -248,8 +245,8 @@ public class ProductController {
product.setKindValue(toumingKind);
}
// 插入操作日志
// String log = quoteLogService.log(product, request, proList);
if (user == null) {
String log = quoteLogService.log(product, request, proList);
if ("登陆失效".equals(log)) {
return Msg.fail("登录信息失效~请刷新页面!");
}
@@ -358,7 +355,7 @@ public class ProductController {
}
String size = product.getSize();
if (("17".equals(product.getProTypeValue()) && "6".equals(product.getKindValue())) || ("手拉旗".equals(product.getProTypeValue()) && "常规".equals(product.getStickerKind()))) {
if (("17".equals(product.getProTypeValue()) && "6".equals(product.getKindValue())) || "手拉旗".equals(product.getProTypeValue())) {
if (!StringUtils.isEmpty(size)) {
String sizeList[] = size.split(",");
size = sizeList[0];
@@ -379,7 +376,6 @@ public class ProductController {
}
product.setRole(user.getRole());
PricingStrategy pricingStrategy = PricingStrategyFactory.getStrategy(product.getProTypeValue());
assert pricingStrategy != null;
PricingListVo listvo = pricingStrategy.calculatePrice(product, user.getRole());
if (listvo.getCode() != 0) {
return Msg.fail(listvo.getMsg());
@@ -409,52 +405,6 @@ public class ProductController {
return Msg.success().add("proList", proList);
}
@RequestMapping("/getProductCastPrice")
public Msg getProductCastPrice(Product product, HttpServletRequest request) {
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
if (StringUtils.isEmpty(product.getCount()) || product.getCount() <= 0) {
return Msg.fail("数量必须大于0");
}
String size = product.getSize();
if (!StringUtils.isEmpty(size)) {
product.setLength(Double.valueOf(size.substring(0, size.indexOf("*"))));
String other_size = size;
if (size.contains(",")) {
size = size.split(",")[0];
}
if (size.indexOf(("*"), size.indexOf("*") + 1) == -1) {
product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1)));
} else {
product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1, size.indexOf(("*"), size.indexOf("*") + 1))));
product.setLength(Math.abs(Double.parseDouble(size.substring(size.indexOf(("*"), size.indexOf("*") + 1) + 1))));
}
}
product.setRole(user.getRole());
PricingListVo listvo = priceService.getCostPrice(product);
if (listvo.getCode() != 0) {
return Msg.fail(listvo.getMsg());
}
List<ProductVo> proList = listvo.getProList();
if (proList == null || proList.size() == 0 || proList.get(0).getPrice() == 0) {
return Msg.fail("暂无报价");
}
if (listvo.getCode() != 0) {
return Msg.fail(listvo.getMsg());
}
proList = listvo.getProList();
// 把角色存入,前台判断,区分不同价格
for (ProductVo p : proList) {
p.setRole(user.getRole());
}
return Msg.success().add("proList", proList);
}
/*public List<Product> f_getPrice( int priceArr[], int count, String craftMo) {
List<Product> list = new ArrayList<Product>();
Product p = new Product();
@@ -2,7 +2,6 @@ package lingtao.net.controller;
import java.util.List;
import lingtao.net.bean.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -14,8 +13,6 @@ import com.github.pagehelper.PageInfo;
import lingtao.net.bean.QuoteLog;
import lingtao.net.service.QuoteLogService;
import javax.servlet.http.HttpServletRequest;
@RestController
public class QuoteLogController {
@@ -39,9 +36,4 @@ public class QuoteLogController {
return pageInfo;
}
@RequestMapping("/addQuoteLog")
public Msg addQuoteLog(QuoteLog quoteLog, HttpServletRequest request) {
String log = quoteLogService.log(quoteLog, request);
return Msg.success();
}
}
@@ -1,64 +0,0 @@
package lingtao.net.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lingtao.net.bean.Information;
import lingtao.net.bean.Msg;
import lingtao.net.bean.StandardMemo;
import lingtao.net.service.InformationService;
import lingtao.net.service.StandardMemoService;
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 StandardMemoController {
@Autowired
private StandardMemoService standardMemoService;
/**
* 产品知识列表
*
* @return
*/
@RequestMapping("/getStandard")
public Msg getStandard(@RequestParam(value = "page", defaultValue = "1") Integer page,
@RequestParam(value = "limit", defaultValue = "10") Integer limit, StandardMemo standardMemo) {
PageHelper.startPage(page, limit);
List<StandardMemo> standardMemoList = standardMemoService.getStandardMemos(standardMemo);
PageInfo<StandardMemo> pageInfo = new PageInfo<>(standardMemoList);
return Msg.success().add("list", pageInfo);
}
/**
* 添加产品知识
*/
@RequestMapping("/addStandard")
public Msg addStandard(StandardMemo standardMemo, HttpSession session) {
standardMemoService.addStandardMemo(standardMemo, session);
return Msg.success();
}
/**
* 修改产品知识
*/
@RequestMapping("/updateStandard")
public Msg updateStandard(StandardMemo standardMemo, HttpSession session) {
standardMemoService.updateStandardMemoById(standardMemo, session);
return Msg.success();
}
/**
* 删除
*/
@RequestMapping("/deleteStandard")
public Msg deleteStandard(@RequestParam("id") Integer id) {
standardMemoService.deleteStandardMemoById(id);
return Msg.success();
}
}
@@ -1,64 +0,0 @@
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<TipContent> tipContentList = tipContentService.getTipContents(tipContent);
PageInfo<TipContent> 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();
}
}
@@ -1,17 +0,0 @@
package lingtao.net.dao;
import lingtao.net.bean.StandardMemo;
import java.util.List;
public interface StandardMemoMapper {
List<StandardMemo> getStandardMemos(StandardMemo standardMemo);
void addStandardMemo(StandardMemo standardMemo);
void updateStandardMemoById(StandardMemo standardMemo);
void deleteStandardMemoById(Integer id);
}
@@ -1,18 +0,0 @@
package lingtao.net.dao;
import lingtao.net.bean.StandardMemo;
import lingtao.net.bean.TipContent;
import java.util.List;
public interface TipContentMapper {
List<TipContent> getTipContents(TipContent standardMemo);
void addTipContent(TipContent standardMemo);
void updateTipContentById(TipContent standardMemo);
void deleteTipContentById(Integer id);
}
@@ -3,7 +3,6 @@ package lingtao.net.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lingtao.net.bean.Product;
import lingtao.net.util.PriceUtils;
import lingtao.net.vo.PricingListVo;
import lingtao.net.vo.ProductVo;
import lingtao.net.vo.ProvidePrice;
@@ -11,7 +10,6 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
@@ -574,219 +572,4 @@ public class PriceService {
return new Province(province, city, district, detailAddress);
}
public PricingListVo getCostPrice(Product product) {
if (product.getProTypeValue() == null) {
return new PricingListVo(100, "暂无设置价格。");
}
if (!"彩印通".equals(product.getPlantName())) {
return new PricingListVo(100, "暂无设置价格。");
}
if ("彩印通".equals(product.getPlantName()) && "卡片".equals(product.getProTypeValue())) {
return getCYTCardPrice(product);
}
if ("彩印通".equals(product.getPlantName()) && "不干胶".equals(product.getProTypeValue())) {
return getCYTStickerPrice(product);
}
return null;
}
private PricingListVo getCYTStickerPrice(Product product) {
List<ProductVo> resultList = new ArrayList<>();
double width = product.getWidth();
double length = product.getLength();
int count = product.getCount();
int number = product.getNumber();
// 定义纸张尺寸(单位:毫米)
double paperLength = 287; // 纸张长度
double paperWidth = 406; // 纸张宽度
width = convertToMillimetersWithMargin(width, 2);
length = convertToMillimetersWithMargin(length, 2);
List<String> smallPaper = Arrays.asList("加厚铜版纸不干胶", "艾丽铜板不干胶", "特光不干胶", "铜板可移不干胶", "牛皮纸", "书写纸", "易碎纸", "大红洒金");
if (smallPaper.contains(product.getKind())) {
paperLength = 300; // 纸张长度
paperWidth = 420; // 纸张宽度
}
if (!isWithinPaperSize(width, length, paperLength, paperWidth)) {
return new PricingListVo(100, "超出纸张尺寸限制"); // 返回空列表表示不适用
}
double basePrice = 3;
if ("加厚铜版纸不干胶".equals(product.getKind())) {
basePrice = 2;
}
if ("铜板可移不干胶".equals(product.getKind())) {
basePrice = 2;
}
if ("牛皮纸".equals(product.getKind())) {
basePrice = 1.8;
}
if ("书写纸".equals(product.getKind())) {
basePrice = 1.8;
}
List<String> base_4 = Arrays.asList("黑胶铜版(遮盖/遮光)", "易碎纸", "洒金宣纸(白色)", "亮银", "亮金");
if (base_4.contains(product.getKind())) {
basePrice = 4;
}
List<String> base_3 = Arrays.asList("超白浮雕纹", "净白彩岩纹", "pp合成纸不干胶", "素面银镭射", "拉丝银", "拉丝金", "哑金");
if (base_3.contains(product.getKind())) {
basePrice = 3.5;
}
List<String> base_2 = Arrays.asList("艾丽铜板不干胶", "特光不干胶", "大红洒金", "白布纹纸");
if (base_2.contains(product.getKind())) {
basePrice = 2.5;
}
// 计算一张纸能容纳的最大金属标数量
double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth);
// 计算所需纸张数量
int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet);
BigDecimal price = new BigDecimal(basePrice).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP);
ProductVo pro = new ProductVo();
pro.setPrice(price.doubleValue());
pro.setCount(count);
pro.setNumber(number);
resultList.add(pro);
return new PricingListVo(resultList);
}
private PricingListVo getCYTCardPrice(Product product) {
List<ProductVo> resultList = new ArrayList<>();
double width = product.getWidth();
double length = product.getLength();
int count = product.getCount();
int number = product.getNumber();
// 定义纸张尺寸(单位:毫米)
double paperLength = 300; // 纸张长度
double paperWidth = 420; // 纸张宽度
width = convertToMillimetersWithMargin(width, 2);
length = convertToMillimetersWithMargin(length, 2);
if (!isWithinPaperSize(width, length, paperLength, paperWidth)) {
return new PricingListVo(100, "超出纸张尺寸限制"); // 返回空列表表示不适用
}
List<String> list = Arrays.asList("300克双铜纸", "300克单铜白卡", "300克冰白卡纸", "300克荷兰白卡", "300克水晶磨砂", "300克铂金磨砂", "300克米黄荷兰白", "300克雅典米白灵感纸", "300克米黄丝绵纸", "325克素面镭射卡白底", "330克超白草香纸", "350克雅柔纸", "350克冰白卡纸", "350克荷兰白卡", "350克布纹", "350克蛋壳纹", "350克安格纹", "350克刚古纹", "350克米黄刚古纹", "350克米黄冰白", "350克超白超感纸", "雅柔毯纹超白");
int[] counts = new int[]{1, 5, 10, 20, 25, 50};
double[] basePrices = new double[]{1.8, 9, 17, 34, 41.25, 82.5};
if ("300克单铜白卡".equals(product.getKind())) {
basePrices = new double[]{2, 10, 19, 38, 45, 90};
}
if ("300克冰白卡纸".equals(product.getKind())) {
basePrices = new double[]{2.5, 12.5, 24, 46, 55, 100};
}
if ("300克荷兰白卡".equals(product.getKind())) {
basePrices = new double[]{2.1, 10.5, 21, 40, 50, 90};
}
if ("300克水晶磨砂".equals(product.getKind())) {
basePrices = new double[]{5, 40, 47, 100, 107.5, 200};
}
if ("300克铂金磨砂".equals(product.getKind())) {
basePrices = new double[]{4.5, 22.5, 42, 80, 95, 175};
}
if ("300克米黄荷兰白".equals(product.getKind())) {
basePrices = new double[]{2.5, 12.5, 24, 46, 55, 100};
}
if ("300克雅典米白灵感纸".equals(product.getKind())) {
basePrices = new double[]{3, 15, 28, 52, 62.5, 115};
}
if ("300克米黄丝绵纸".equals(product.getKind())) {
basePrices = new double[]{3.5, 17.5, 34, 66, 80, 150};
}
if ("325克素面镭射卡白底".equals(product.getKind())) {
basePrices = new double[]{5, 25, 45, 86, 100, 190};
}
if ("330克超白草香纸".equals(product.getKind())) {
basePrices = new double[]{5, 25, 48, 90, 107.5, 200};
}
if ("350克雅柔纸".equals(product.getKind())) {
basePrices = new double[]{3, 15, 28, 54, 65, 125};
}
if ("350克米黄冰白".equals(product.getKind())) {
basePrices = new double[]{3, 15, 28, 54, 65, 125};
}
if ("雅柔毯纹超白".equals(product.getKind())) {
basePrices = new double[]{20, 38, 70, 82.5, 150};
}
List<String> list_100 = Arrays.asList("350克冰白卡纸", "350克荷兰白卡", "350克布纹", "350克蛋壳纹", "350克安格纹", "350克刚古纹", "350克米黄刚古纹", "350克超白超感纸");
if (list_100.contains(product.getKind())) {
basePrices = new double[]{2.5, 12.5, 24, 46, 55, 100};
}
// 计算一张纸能容纳的最大金属标数量
double maxItemsPerSheet = calculateMaxItemsPerSheet(length, width, paperLength, paperWidth);
// 计算所需纸张数量
int requiredSheets = calculateRequiredSheets(count, number, maxItemsPerSheet);
double basePrice = PriceUtils.TableCountDoublePrice(requiredSheets, basePrices, counts);
BigDecimal price = new BigDecimal(basePrice / requiredSheets).multiply(new BigDecimal(requiredSheets)).setScale(2, RoundingMode.HALF_UP);
ProductVo pro = new ProductVo();
pro.setPrice(price.doubleValue());
pro.setCount(count);
pro.setNumber(number);
resultList.add(pro);
return new PricingListVo(resultList);
}
/**
* 将给定的尺寸转换为毫米,并在每边增加3毫米的边距
*
* @param size 需要转换的原始尺寸
* @return 转换后的尺寸,单位为毫米,包括边距
*/
private double convertToMillimetersWithMargin(double size, int num) {
return size * 10 + 2 * num; // 换成毫米,每边+2
}
/**
* 检查给定的长度和宽度是否在纸张尺寸范围内
*
* @param length 需要检查的长度
* @param width 需要检查的宽度
* @param paperLength 纸张的长度
* @param paperWidth 纸张的宽度
* @return 如果给定尺寸在纸张尺寸范围内,则返回true;否则返回false
*/
private boolean isWithinPaperSize(double length, double width, double paperLength, double paperWidth) {
return (length <= paperLength && width <= paperWidth) || (length <= paperWidth && width <= paperLength);
}
/**
* 计算每张纸最多可以容纳的物品数量
*
* @param length 物品的长度
* @param width 物品的宽度
* @param paperLength 纸张的长度
* @param paperWidth 纸张的宽度
* @return 每张纸最多可以容纳的物品数量
*/
private double calculateMaxItemsPerSheet(double length, double width, double paperLength, double paperWidth) {
return Math.max(
Math.floor(paperLength / length) * Math.floor(paperWidth / width),
Math.floor(paperLength / width) * Math.floor(paperWidth / length)
);
}
/**
* 计算完成指定数量的物品所需的纸张数量
*
* @param count 物品的总数量
* @param number 每个物品需要的数量
* @param maxItemsPerSheet 每张纸最多可以容纳的物品数量
* @return 完成指定数量的物品所需的纸张数量
*/
private int calculateRequiredSheets(int count, int number, double maxItemsPerSheet) {
return (int) Math.ceil((count * number) / maxItemsPerSheet);
}
}
File diff suppressed because it is too large Load Diff
@@ -247,86 +247,4 @@ public class QuoteLogService {
}
return null;
}
public String log(QuoteLog quoteLog, HttpServletRequest request) {
long startTime, endTime = 0;
startTime = System.currentTimeMillis();
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
String remark_judge = quoteLog.getRemark();
if (user == null) {
return "登陆失效";
}
QuoteLog log = new QuoteLog();
log.setRemark(remark_judge);
log.setRealname(user.getRealname());
log.setUsername(user.getUsername());
log.setQuoteIp(IPUtils.getIpAddr(request));// 获取ip
log.setBrower(IPUtils.getBrowserName(request));// 获取浏览器名称
log.setOs(IPUtils.getOsName(request)); // 获取操作系统名称
log.setPrice((double) 0);
List<SysRole> allRoleNames = sysRoleService.getAllRoleName(null);
String roleName = "";
String[] split = user.getRole().split(",");
for (SysRole sysRole : allRoleNames) {
for (int i = 0; i < split.length; i++) {
if (split[i].equals(String.valueOf(sysRole.getRoleId()))) {
roleName += sysRole.getRoleName() + "";
}
}
}
log.setShopname(roleName);
quoteLogMapper.insertSelective(log);
endTime = System.currentTimeMillis();
System.out.println("【insertSelective】使用的时间:" + (endTime - startTime));
long startTime2, endTime2 = 0;
startTime2 = System.currentTimeMillis();
boolean flag = false;
// 查询3分钟内自己报的数据
List<String> remarkJudgeData = quoteDataMapper.getQuoteDataByMinutes(user.getUsername());
endTime2 = System.currentTimeMillis();
System.out.println("【getQuoteDataByMinutes】使用的时间:" + (endTime2 - startTime2));
if (remarkJudgeData != null && remarkJudgeData.size() > 0) {
for (String remarkJudge : remarkJudgeData) {
if (remarkJudge != null && remarkJudge.equals(remark_judge)) {
// 如果3分钟内报过相同数据
flag = true;
break;
}
}
}
// 插入数据(给客服数据新增用的)
String role = user.getRole();
// 客服报的且3分钟内没有同一个客户报的数据才插入
if (role.contains("999,") && !flag) {
QuoteData quoteData = new QuoteData();
quoteData.setUsername(user.getUsername());
quoteData.setRealname(user.getRealname());
quoteData.setPrice((double) 0);
quoteData.setProTypeLabel("");
quoteData.setRole(user.getRole());
// 默认都是没选择店铺
quoteData.setIsSelect("0");
// role = role.replace("999,", "").replace(",1049", "").replace(",1011", "");
// 规则:第一位客服,第二位主店铺
String shopname = role.substring(role.indexOf(",") + 1);
if (shopname.indexOf(",") != -1) {
shopname = shopname.substring(0, shopname.indexOf(","));
}
System.out.println(shopname);
quoteData.setShopname(shopname);
quoteData.setIsSelect("1");
// 除去【客服】只有一个店铺,所属店铺就是剩下这个店铺 切 选择状态改为已选择
// if (!role.contains(",")) {
// }
quoteData.setIsBuy("0");
quoteData.setIsBuyToDay("0");
quoteData.setRemark(remark_judge);
// 默认都是填写旺旺号
quoteData.setIsFillIn("1");
quoteDataMapper.addQuoteData(quoteData);
}
return null;
}
}
@@ -1,56 +0,0 @@
package lingtao.net.service;
import lingtao.net.bean.Msg;
import lingtao.net.bean.StandardMemo;
import lingtao.net.bean.SysUser;
import lingtao.net.dao.StandardMemoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpSession;
import java.util.List;
@Service
public class StandardMemoService {
@Autowired
private StandardMemoMapper standardMemoMapper;
public List<StandardMemo> getStandardMemos(StandardMemo standardMemo) {
return standardMemoMapper.getStandardMemos(standardMemo);
}
public Msg addStandardMemo(StandardMemo standardMemo, HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
standardMemo.setCreateBy(user.getRealname());
try {
standardMemoMapper.addStandardMemo(standardMemo);
return Msg.success();
} catch (Exception e) {
return Msg.fail();
}
}
public Msg updateStandardMemoById(StandardMemo standardMemo, HttpSession session) {
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
standardMemo.setUpdateBy(user.getRealname());
try {
standardMemoMapper.updateStandardMemoById(standardMemo);
return Msg.success();
} catch (Exception e) {
return Msg.fail();
}
}
public Msg deleteStandardMemoById(Integer id) {
try {
standardMemoMapper.deleteStandardMemoById(id);
return Msg.success();
} catch (Exception e) {
return Msg.fail();
}
}
}
@@ -1,58 +0,0 @@
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<TipContent> 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();
}
}
}
@@ -1,7 +1,5 @@
package lingtao.net.util;
import com.aspose.pdf.Document;
import com.aspose.pdf.optimization.OptimizationOptions;
import lingtao.net.bean.Product;
import java.io.File;
@@ -221,7 +219,7 @@ public class AStickersPrice {
List<Product> list = new ArrayList<Product>();
Product pro = new Product();
int bigCountArr[] = {500, 1000, 2000, 3000, 5000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000};
int priceArr[] = {65, 75, 100, 130, 180, 275, 515, 805, 1005, 1205, 1405, 1605, 1805, 2005, 2205};
int priceArr[] = {56, 63, 84, 108, 150, 240, 456, 684, 912, 1125, 1350, 1575, 1800, 2025, 2250};
if (count <= 40000) {
for (int i = 0; i < bigCountArr.length; i++) {
if (bigCountArr[i] < count || list.size() > 5) {
@@ -392,30 +390,34 @@ public class AStickersPrice {
}
public static void main(String[] args) {
String source = "C:\\Users\\231010\\Downloads\\蓝朝旺.pdf";
String target = "C:\\Users\\231010\\Downloads\\蓝朝旺1.pdf";
optimize(source, target);
String path = "Z:\\设计文件共享中心\\已下单\\2019\\1月\\年后出货\\不干胶\\dy\\已拼";
Path startPath = Paths.get(path);
try {
Files.walk(startPath).filter(Files::isRegularFile).forEach(System.out::println);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void optimize(String source, String target) {
Document doc = new Document(source);
//设置压缩属性
OptimizationOptions opt = new OptimizationOptions();
//删除PDF不必要的对象
opt.setRemoveUnusedObjects(true);
//链接重复流
opt.setLinkDuplcateStreams(false);
//删除未使用的流
opt.setRemoveUnusedStreams(false);
//删除不必要的字体
opt.setUnembedFonts(true);
//压缩PDF中的图片
opt.getImageCompressionOptions().setCompressImages(true);
//图片压缩比, 0 到100可选,越低压缩比越大
opt.getImageCompressionOptions().setImageQuality(100);
doc.optimizeResources(opt);
//优化web的PDF文档
doc.optimize();
doc.save(target);
public static String midStrEx(String source, String startStr, String endStr) {
String result = "";
int startIndex, endIndex;
try {
startIndex = source.indexOf(startStr);
if (startIndex == -1) {
return result;
}
String tmpStr = source.substring(startIndex + startStr.length());
endIndex = tmpStr.indexOf(endStr);
if (endIndex == -1) {
return result;
}
result = tmpStr.substring(0, endIndex);
} catch (Exception ex) {
System.out.println("MidStrEx Err: " + ex.getMessage());
}
return result;
}
}
+11 -9
View File
@@ -8,12 +8,12 @@ import java.util.List;
public class CanopyUtil {
public static List<Product> getPrice(Double area, int count, List<Product> priceList, String kindvalue, List<String> craft_list) {
public static List<Product> getPrice(Double area, int count, List<Product> priceList, String kindvalue, String craft) {
Product pro = null;
double price = 0;
area = area * count;//计算总面积
double basePrice = 0;
double[] priceArr = getBasePrice(kindvalue, craft_list);
double[] priceArr = getBasePrice(kindvalue, craft);
if (priceArr.length == 0) {
return priceList;
}
@@ -26,7 +26,7 @@ public class CanopyUtil {
} else {
basePrice = priceArr[3];
}
double mince = getMinPrice(kindvalue, craft_list);
double mince = getMinPrice(kindvalue, craft);
price = Math.ceil(basePrice * area);
pro = new Product();
pro.setCount(count);
@@ -37,16 +37,17 @@ public class CanopyUtil {
return priceList;
}
private static double[] getBasePrice(String kindvalue, List<String> craft) {
private static double[] getBasePrice(String kindvalue, String craft) {
List<String> craftList = craft != null ? Collections.singletonList(craft) : new ArrayList<>();
if ("银胶涤纶布".equals(kindvalue)) {
if (craft.contains("定制")) {
if (craftList.contains("定制")) {
return new double[]{27, 26, 25, 24.5};
} else {
return new double[]{12.5, 11.5, 11, 10};
}
}
if ("黑胶涤纶布".equals(kindvalue)) {
if (craft.contains("定制")) {
if (craftList.contains("定制")) {
return new double[]{29, 28, 27, 26};
} else {
return new double[]{14.5, 13.5, 13, 12};
@@ -55,16 +56,17 @@ public class CanopyUtil {
return new double[]{};
}
private static double getMinPrice(String kindvalue, List<String> craft) {
private static double getMinPrice(String kindvalue, String craft) {
List<String> craftList = craft != null ? Collections.singletonList(craft) : new ArrayList<>();
if ("银胶涤纶布".equals(kindvalue)) {
if (craft.contains("定制")) {
if (craftList.contains("定制")) {
return 80;
} else {
return 60;
}
}
if ("黑胶涤纶布".equals(kindvalue)) {
if (craft.contains("定制")) {
if (craftList.contains("定制")) {
return 80;
} else {
return 50;
+13 -31
View File
@@ -7,29 +7,26 @@ import lingtao.net.bean.Product;
public class FgqPrice {
DecimalFormat df = new DecimalFormat("0.00");
/**
* 仿古旗报价
*/
public List<Product> getPrice(int count, Double area, List<Product> list, String[] craftList, String kind, int num) {
/**仿古旗报价*/
public List<Product> getPrice(int count, Double area, List<Product> list,String[] craftList, String kind, int num) {
Product pro = new Product();
pro = new Product();
pro.setCount(count);
String craft = craftList[0];
double dj = 0, wei = 0;
if (kind.equals("1")) {
if (craft.equals("单面")) {
double dj = 0,wei = 0;
if(kind.equals("1")) {
if(craft.equals("单面")) {
dj = 90;
wei = 0.065;
} else {
}else {
dj = 100;
wei = 0.195;
}
} else {
if (craft.equals("单面")) {
}else {
if(craft.equals("单面")) {
dj = 100;
wei = 0.165;
} else {
}else {
dj = 135;
wei = 0.33;
}
@@ -43,27 +40,12 @@ public class FgqPrice {
return list;
}
/**
* 手拉旗报价
*/
/**手拉旗报价*/
public List<Product> getSlqPrice(int count, List<Product> list) {
double basePrice = 0;
if (count > 0 && count <= 10) {
basePrice = 30;
} else if (count > 10 && count <= 50) {
basePrice = 26;
} else if (count > 50 && count <= 100) {
basePrice = 22;
} else if (count > 100 && count <= 200) {
basePrice = 20;
} else {
basePrice = 18;
}
Product pro = new Product();
pro = new Product();
pro.setCount(count);
pro.setPrice(Math.ceil(basePrice * count));
pro.setPrice(Math.ceil(30 * count));
list.add(pro);
return list;
@@ -73,9 +55,9 @@ public class FgqPrice {
Product pro = new Product();
pro = new Product();
pro.setCount(count);
if (type == 1) {
if(type == 1) {
pro.setPrice(Math.ceil(16 * count));
} else {
}else {
pro.setPrice(Math.ceil(12 * count));
}
list.add(pro);
@@ -1,156 +0,0 @@
package lingtao.net.util;
import okhttp3.*;
import java.io.IOException;
import java.util.Map;
public class HttpUtils {
private static final OkHttpClient HTTP_CLIENT = new OkHttpClient();
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private static final MediaType FORM = MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");
/**
* 通用HTTP GET请求方法
*
* @param url 请求地址
* @param headers 请求头映射
* @return 响应结果字符串
*/
public static String sendGetRequest(String url, Map<String, String> headers) {
Request.Builder builder = new Request.Builder()
.header("Content-Type", "application/json")
.url(url);
// 添加请求头
if (headers != null && !headers.isEmpty()) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
Request request = builder.build();
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("请求异常: " + response.code());
}
return response.body().string();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
/**
* 通用HTTP GET请求方法(无请求头)
*
* @param url 请求地址
* @return 响应结果字符串
*/
public static String sendGetRequest(String url) {
return sendGetRequest(url, null);
}
/**
* 通用HTTP POST请求方法(JSON参数)
*
* @param url 请求地址
* @param jsonParam JSON参数
* @param headers 请求头映射
* @return 响应结果字符串
*/
public static String sendPostRequest(String url, String jsonParam, Map<String, String> headers) {
RequestBody body = RequestBody.create(JSON, jsonParam);
Request.Builder builder = new Request.Builder()
.header("Content-Type", "application/json")
.url(url)
.post(body);
// 添加请求头
if (headers != null && !headers.isEmpty()) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
Request request = builder.build();
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("请求异常: " + response.code());
}
return response.body().string();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
/**
* 通用HTTP POST请求方法(JSON参数,无请求头)
*
* @param url 请求地址
* @param jsonParam JSON参数
* @return 响应结果字符串
*/
public static String sendPostRequest(String url, String jsonParam) {
return sendPostRequest(url, jsonParam, null);
}
/**
* 通用HTTP POST请求方法(表单参数)
*
* @param url 请求地址
* @param formParams 表单参数映射
* @param headers 请求头映射
* @return 响应结果字符串
*/
public static String sendPostFormRequest(String url, Map<String, String> formParams, Map<String, String> headers) {
StringBuilder formBody = new StringBuilder();
if (formParams != null && !formParams.isEmpty()) {
for (Map.Entry<String, String> entry : formParams.entrySet()) {
if (formBody.length() > 0) {
formBody.append("&");
}
formBody.append(entry.getKey()).append("=").append(entry.getValue());
}
}
RequestBody body = RequestBody.create(FORM, formBody.toString());
Request.Builder builder = new Request.Builder()
.header("Content-Type", "application/json")
.url(url)
.post(body);
// 添加请求头
if (headers != null && !headers.isEmpty()) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
}
Request request = builder.build();
try (Response response = HTTP_CLIENT.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new IOException("请求异常: " + response.code());
}
return response.body().string();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
/**
* 通用HTTP POST请求方法(表单参数,无请求头)
*
* @param url 请求地址
* @param formParams 表单参数映射
* @return 响应结果字符串
*/
public static String sendPostFormRequest(String url, Map<String, String> formParams) {
return sendPostFormRequest(url, formParams, null);
}
}
@@ -1,38 +0,0 @@
package lingtao.net.util;
import com.alibaba.fastjson.JSONObject;
import lingtao.net.vo.HuaFangPriceRequstVo;
import lingtao.net.vo.HuaFangPriceResultVo;
import lingtao.net.vo.HuaFangTokenVo;
import lingtao.net.vo.ShengDaTokenVo;
import okhttp3.*;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
public class HuaFangPriceUtil {
private static final String userName = "001008";
private static final String password = "lt666888";
public static String getToken() {
String tokenString = HttpUtils.sendGetRequest("http://47.114.150.226:88/Handler/apichyHelper.ashx?t=apiGetToken");
System.out.println("获取token返回:" + tokenString);
ShengDaTokenVo huaFangTokenVo = JSONObject.parseObject(tokenString, ShengDaTokenVo.class);
return huaFangTokenVo.getResult();
}
public static HuaFangPriceResultVo getPrice(HuaFangPriceRequstVo params) {
Map<String, String> heards = new HashMap<>();
heards.put("Authorization", "Bearer " + getToken());
String resultText = HttpUtils.sendPostRequest("http://ds.quote.chenghuiyin.com/api/app/price/calc-price", JSONObject.toJSONString(params), heards);
HuaFangPriceResultVo result = JSONObject.parseObject(resultText, HuaFangPriceResultVo.class);
return result;
}
}
@@ -45,7 +45,7 @@ public class PVCStickersPrice {
} else if (product.getCount() == 100000) {
price = 700;
}
product.setPrice(Math.ceil(product.getPrice() + price));
product.setPrice(product.getPrice() + price);
}
} else if ((length <= 9 && width <= 5.4) || (length <= 5.4 && width <= 9)) {
for (Product product : stickersList) {
@@ -78,7 +78,7 @@ public class PVCStickersPrice {
} else if (product.getCount() == 100000) {
price = 1500;
}
product.setPrice(Math.ceil(product.getPrice() + price));
product.setPrice(product.getPrice() + price);
}
} else {
for (Product product : stickersList) {
@@ -99,7 +99,7 @@ public class PVCStickersPrice {
} else {
price = 3;
}
product.setPrice(Math.ceil(product.getPrice() + (price * area > 50 ? price * area : 50)));
product.setPrice(product.getPrice() + (price * area > 50 ? price * area : 50));
}
}
return stickersList;
+19 -64
View File
@@ -306,38 +306,14 @@ public class PosterPrice {
price = area * 380 > 380 + 15 ? area * 380 : 380 + 15;
break;
}
Product pro = new Product();
List<Product> list = new ArrayList<Product>();
pro.setCount(count);
if ("15".equals(kind2)) {
danjia = last_price;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
danjia = prices[i];
break;
}
}
price = Math.max(area * danjia, min_price) * number;
if (area < areas[0]) {
area = area * number;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
danjia = prices[i];
break;
}
}
price = Math.max(min_price, area * danjia) + 25 + 15 * (number - 1);
}
pro.setPrice(Math.ceil(price));
} else {
if (!"24".equals(kind2)) {
double area_jis = area;
if (width * length < 40 * 50) {
area_jis = area_jis * number;
}
// if ("8".equals(kind2) && width * length < 40 * 50) {
// price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
// } else {
danjia = last_price;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
@@ -346,15 +322,18 @@ public class PosterPrice {
}
}
price = Math.max(area_jis * danjia, min_price);
// }
}
Product pro = new Product();
List<Product> list = new ArrayList<Product>();
pro.setCount(count);
// 价格 = 面积 * 单价 + (款数-1) * 40
if (number > 1 && width * length >= 40 * 50) {
pro.setPrice(Math.ceil(price * number));
} else {
pro.setPrice(Math.ceil(price));
pro.setPrice(Math.ceil(price ));
}
}
pro.setWeight(weight);
list.add(pro);
return list;
@@ -383,9 +362,9 @@ public class PosterPrice {
// 户外写真白胶(国产)
case "0":
areas = new double[]{2, 5, 7, 8, 10, 20, 50};
prices = new double[]{38, 38, 33, 30, 25, 23, 21};
last_price = 19;
min_price += 50 - 5;
prices = new double[]{55, 45, 40, 37, 31, 29, 27};
last_price = 26;
min_price += 50 + 15;
// 根据面积得到单价
weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
break;
@@ -393,9 +372,9 @@ public class PosterPrice {
case "1":
// 根据面积得到单价
areas = new double[]{2, 5, 7, 8, 10, 20, 50};
prices = new double[]{38, 38, 33, 30, 25, 23, 21};
last_price = 19;
min_price += 50 - 5;
prices = new double[]{55, 45, 40, 37, 31, 29, 27};
last_price = 26;
min_price += 50 + 15;
weight = String.valueOf(DecimalFormat.format(area * 0.25 * number));
break;
// 户外写真可移白胶、黑胶
@@ -438,34 +417,10 @@ public class PosterPrice {
weight = String.valueOf(DecimalFormat.format(area * 0.24 * number));
break;
}
Product pro = new Product();
List<Product> list = new ArrayList<Product>();
pro.setCount(count);
danjia = last_price;
if ("0".equals(kind2) || "1".equals(kind2)) {
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
danjia = prices[i];
break;
}
}
price = Math.max(area * danjia, min_price) * number;
if (area < areas[0]) {
area = area * number;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
danjia = prices[i];
break;
}
}
price = Math.max(min_price, area * danjia) + 25 + 15 * (number - 1);
}
pro.setPrice(Math.ceil(price));
} else {
if (width * length < 40 * 50) {
price = new PriceUtils().getTestPrice(length, width, count, number, areas, prices, min_price, last_price);
} else {
danjia = last_price;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
danjia = prices[i];
@@ -474,15 +429,15 @@ public class PosterPrice {
}
price = Math.max(area * danjia, min_price);
}
Product pro = new Product();
List<Product> list = new ArrayList<Product>();
pro.setCount(count);
// 价格 = 面积 * 单价 + (款数-1) * 40
if (number > 1 && width * length >= 40 * 50) {
pro.setPrice(Math.ceil(price * number));
} else {
pro.setPrice(Math.ceil(price));
}
}
pro.setWeight(weight);
list.add(pro);
return list;
+41 -270
View File
@@ -8,7 +8,6 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class PriceUtils {
@@ -27,52 +26,9 @@ public class PriceUtils {
* @param yinbai
* @return
*/
public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices, Product dto) {
public List<Product> rollLabelPrice(String kind, Double area, int count, String[] craft, String yinbai, String tang, double[] tangPrices) {
List<Product> list = new ArrayList<Product>();
Product pro = new Product();
if ("封口贴".equals(dto.getKind())) {
int[] counts = {1000, 2000, 3000, 5000, 10000, 20000, 50000, 100000};
double[] prices = {180, 260, 311, 400, 558, 650, 1100, 1800};
if ("9*2".equals(dto.getSize())) {
prices = new double[]{180, 260, 311, 400, 558, 650, 1100, 1800};
}
if ("10*2".equals(dto.getSize())) {
prices = new double[]{220, 300, 337, 412, 600, 680, 1200, 1980};
}
double lastPrice = 0;
int lastCount = 0;
double price = 0;
int countItem = count;
do {
if (countItem > counts[counts.length - 1]) {
price += prices[prices.length - 1];
countItem = countItem - counts[counts.length - 1];
} else {
for (int i = 0; i < counts.length; i++) {
if (counts[i] < countItem) {
lastCount = counts[i];
lastPrice = prices[i];
continue;
}
if (lastPrice == 0 && lastCount == 0) {
price += prices[i];
} else {
price += lastPrice + (countItem - lastCount) * (prices[i] - lastPrice) / (counts[i] - lastCount);
}
break;
}
countItem = 0;
}
} while (countItem != 0);
pro = new Product();
pro.setCount(count);
pro.setPrice(Math.ceil(price));
list.add(pro);
return list;
}
// 最低收费
double lowerPrice = 0.0;
// 印工价格
@@ -85,7 +41,7 @@ public class PriceUtils {
area = Double.valueOf(df.format(area * count));
if (area <= 20) {
yinrPrice = 260;
lowerPrice = 400;
lowerPrice = 550;
} else if (area <= 150) {
yinrPrice = 300;
lowerPrice = 600;
@@ -324,9 +280,8 @@ public class PriceUtils {
// 换成毫米每边+2
length = length * 10 + 4;
width = width * 10 + 4;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -376,9 +331,8 @@ public class PriceUtils {
// 换成毫米每边+2
length = length * 10 + 4;
width = width * 10 + 4;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -1019,27 +973,12 @@ public class PriceUtils {
} else if ("单面烫黄金".equals(kind2)) {
double priceArr[] = {68, 48, 37, 36, 35, 34};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("单面烫镭射银".equals(kind2)) {
double priceArr[] = {82, 58, 45, 43, 42, 41};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("双面烫黄金".equals(kind2)) {
double priceArr[] = {108, 72, 56, 54, 52, 50};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("双面烫镭射银".equals(kind2)) {
double priceArr[] = {123, 87, 68, 65, 63, 60};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
double priceArr[] = {75, 50, 40, 40, 39, 38};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("单面烫黄金+凹凸".equals(kind2)) {
double priceArr[] = {93, 63, 48, 48, 47, 46};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("单面烫金+压凹".equals(kind2)) {
double priceArr[] = {93, 63, 48, 48, 47, 46};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
} else if ("单面烫金+击凸".equals(kind2)) {
double priceArr[] = {93, 63, 48, 48, 47, 46};
list = acountTag600Price(area, count, priceArr, shengzi, flag, list);
}
}
if ("6".equals(kind)) {
@@ -1065,15 +1004,6 @@ public class PriceUtils {
{764, 764, 877, 991, 1014, 1105, 1219, 1301, 1310, 1423, 1651, 2038, 2406, 2470, 3494, 5314, 9295},
{1495, 1495, 1716, 1937, 1981, 2158, 2379, 2538, 2555, 2776, 3218, 3970, 4686, 4810, 6799, 10335, 18070}
};
} else if ("单面烫镭射银".equals(kind2)) {
prices = new int[][]{
{190, 190, 221, 252, 258, 283, 315, 338, 340, 372, 435, 539, 641, 658, 938, 1438, 2530},
{195, 195, 226, 257, 263, 288, 319, 343, 345, 377, 439, 544, 646, 663, 943, 1443, 2535},
{315, 350, 366, 413, 418, 456, 504, 535, 538, 585, 681, 845, 1001, 1027, 1459, 2229, 3913},
{468, 468, 538, 608, 622, 678, 748, 799, 805, 876, 1016, 1254, 1482, 1521, 2152, 3276, 5733},
{764, 764, 877, 991, 1014, 1105, 1219, 1301, 1310, 1423, 1651, 2038, 2406, 2470, 3494, 5314, 9295},
{1495, 1495, 1716, 1937, 1981, 2158, 2379, 2538, 2555, 2776, 3218, 3970, 4686, 4810, 6799, 10335, 18070}
};
} else if ("击凸".equals(kind2) || "压凹".equals(kind2)) {
prices = new int[][]{
{196, 196, 229, 261, 268, 295, 326, 350, 352, 385, 450, 560, 665, 684, 976, 1496, 2635},
@@ -1092,15 +1022,6 @@ public class PriceUtils {
{1118, 1528, 1754, 1982, 2028, 2210, 2438, 2602, 2620, 2846, 3302, 4076, 4812, 4940, 6988, 10628, 18590},
{2194, 2990, 3432, 3874, 3962, 4316, 4758, 5076, 5110, 5552, 6436, 7940, 9372, 9620, 13598, 20670, 36140}
};
} else if ("双面烫镭射银".equals(kind2)) {
prices = new int[][]{
{270, 380, 442, 504, 516, 566, 630, 676, 680, 744, 870, 1078, 1282, 1316, 1876, 2876, 5060},
{278, 390, 452, 514, 526, 576, 638, 686, 690, 754, 878, 1088, 1292, 1326, 1886, 2886, 5070},
{460, 630, 732, 826, 836, 912, 1008, 1070, 1076, 1170, 1362, 1690, 2002, 2054, 2918, 4458, 7826},
{682, 936, 1076, 1216, 1244, 1356, 1496, 1598, 1610, 1752, 2032, 2508, 2964, 3042, 4304, 6552, 11466},
{1118, 1528, 1754, 1982, 2028, 2210, 2438, 2602, 2620, 2846, 3302, 4076, 4812, 4940, 6988, 10628, 18590},
{2194, 2990, 3432, 3874, 3962, 4316, 4758, 5076, 5110, 5552, 6436, 7940, 9372, 9620, 13598, 20670, 36140}
};
} else if ("单面烫黄金+凹凸".equals(kind2)) {
prices = new int[][]{
{239, 239, 279, 321, 329, 361, 403, 433, 435, 477, 559, 698, 830, 853, 1222, 1877, 3310},
@@ -1110,24 +1031,6 @@ public class PriceUtils {
{959, 959, 1111, 1264, 1294, 1417, 1570, 1680, 1692, 1844, 2150, 2670, 3165, 3250, 4625, 7069, 12415},
{1885, 1885, 2184, 2483, 2542, 2782, 3081, 3296, 3320, 3619, 4217, 5233, 6203, 6370, 9061, 13845, 24310}
};
} else if ("单面烫金+压凹".equals(kind2)) {
prices = new int[][]{
{239, 239, 279, 321, 329, 361, 403, 433, 435, 477, 559, 698, 830, 853, 1222, 1877, 3310},
{244, 244, 284, 326, 334, 366, 408, 438, 440, 482, 564, 703, 835, 858, 1227, 1882, 3315},
{397, 430, 460, 524, 537, 588, 651, 697, 702, 766, 894, 1110, 1316, 1352, 1925, 2943, 5174},
{585, 585, 678, 772, 791, 865, 959, 1027, 1034, 1128, 1315, 1634, 1937, 1989, 2831, 4329, 7605},
{959, 959, 1111, 1264, 1294, 1417, 1570, 1680, 1692, 1844, 2150, 2670, 3165, 3250, 4625, 7069, 12415},
{1885, 1885, 2184, 2483, 2542, 2782, 3081, 3296, 3320, 3619, 4217, 5233, 6203, 6370, 9061, 13845, 24310}
};
} else if ("单面烫金+击凸".equals(kind2)) {
prices = new int[][]{
{239, 239, 279, 321, 329, 361, 403, 433, 435, 477, 559, 698, 830, 853, 1222, 1877, 3310},
{244, 244, 284, 326, 334, 366, 408, 438, 440, 482, 564, 703, 835, 858, 1227, 1882, 3315},
{397, 430, 460, 524, 537, 588, 651, 697, 702, 766, 894, 1110, 1316, 1352, 1925, 2943, 5174},
{585, 585, 678, 772, 791, 865, 959, 1027, 1034, 1128, 1315, 1634, 1937, 1989, 2831, 4329, 7605},
{959, 959, 1111, 1264, 1294, 1417, 1570, 1680, 1692, 1844, 2150, 2670, 3165, 3250, 4625, 7069, 12415},
{1885, 1885, 2184, 2483, 2542, 2782, 3081, 3296, 3320, 3619, 4217, 5233, 6203, 6370, 9061, 13845, 24310}
};
}
for (int i = 0; i < count_list.length; i++) {
@@ -1254,9 +1157,9 @@ public class PriceUtils {
pro.setPrice(Math.ceil((count / kai * price + 150 + 200 + 200) * m));
list.add(pro);
} else {
pro.setCount(count);
pro.setPrice(Math.ceil((count / kai * price + (150 + Math.ceil((count - 1000) / 1000) * 50) + 200 + count * 0.3) * m));
pro.setPrice(Math.ceil(
(count / kai * price + (150 + Math.ceil((count - 1000) / 1000) * 50) + 200 + count * 0.3) * m));
list.add(pro);
}
}
@@ -1373,9 +1276,8 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5;
// 数量*款数就是张数
// count = count * number;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸29*19cm 能做多少个此类尺寸的金属标
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -1666,14 +1568,14 @@ public class PriceUtils {
}
if (!StringUtils.isEmpty(zhuan)) {
if ("烫金".equals(zhuan[0]) || "烫哑金".equals(zhuan[0]) || "烫哑银".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫亮金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "炫彩镭射".equals(zhuan[0])) {
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
// 起步价+58元
price = price + (40 * area);
price = price > 80 ? price : 80;
} else if ("印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) {
// 起步价+58元
price = price + (45 * area);
price = price > 80 ? price : 80;
price = price > 103 ? price : 103;
} else if ("双面贴".equals(zhuan[0])) {
price = price + (40 * area);
price = price > 80 ? price : 80;
@@ -1691,7 +1593,7 @@ public class PriceUtils {
int oldCount = count;
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0])) && count < 100) {
if (!StringUtils.isEmpty(zhuan) && ("专金".equals(zhuan[0]) || "专银".equals(zhuan[0]) || "印刷+烫金".equals(zhuan[0]) || "印刷+烫银".equals(zhuan[0])) && count < 100) {
// 烫金100个起
count = 100;
}
@@ -1775,7 +1677,7 @@ public class PriceUtils {
}
if (!StringUtils.isEmpty(zhuan)) {
if ("烫金".equals(zhuan[0]) || "烫哑金".equals(zhuan[0]) || "烫亮金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
// 起步价+58元
price = price + (40 * area);
price = price > 80 ? price : 80;
@@ -1842,7 +1744,7 @@ public class PriceUtils {
}
if (!StringUtils.isEmpty(zhuan)) {
if ("烫金".equals(zhuan[0]) || "烫哑金".equals(zhuan[0]) || "烫亮金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
if ("烫金".equals(zhuan[0]) || "烫银".equals(zhuan[0]) || "烫蓝".equals(zhuan[0]) || "烫红".equals(zhuan[0]) || "烫黑".equals(zhuan[0]) || "镭射银".equals(zhuan[0]) || "镭射金".equals(zhuan[0]) || "玫瑰金".equals(zhuan[0])) {
// 起步价+58元
price = price + (40 * area);
price = price > 80 ? price : 80;
@@ -2044,9 +1946,8 @@ public class PriceUtils {
width = width * 10 + 2 * 1.5;
// 数量*款数就是张数
count = count * number;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸45*40cm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -2147,9 +2048,8 @@ public class PriceUtils {
width = width * 10 + 2 * 3;
// 数量 * 款数就是张数
count = count * number;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸420*380mm 能做多少个此类尺寸的桌贴
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -2198,24 +2098,19 @@ public class PriceUtils {
// 第一张大纸价格
double price = 80;
if (craft.size() > 0) {//工艺起步价120
if (!craft.contains("内部模切")) {
price = 120;
}
if (craft.contains("内部模切") && craft.size() > 1) {
price = 120;
}
}
// 换成毫米每边+3
length = length * 10 + 2 * 1.5;
width = width * 10 + 2 * 1.5;
// 数量*款数就是张数
count = count * number;
if ((length - 3 > l || width - 3 > w) && (length - 3 > w || width - 3 > l)) {
if ((length > l || width > w) && (length > w || width > l)) {
return null;
}
// 一张大纸43*30 能做多少个此类尺寸的
double max = Math.max(Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length)), 1);
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
// 报的数量需要多少张大纸
int num = (int) Math.ceil(count / max);
if (num <= 10) {
@@ -2224,10 +2119,12 @@ public class PriceUtils {
price = num * 25;
}
price += 10 * craft.size() * num;
if (craft.contains("内部模切") && dto.getN_mq_num() > 0) {
if (dto.getN_mq_num() > 0) {
price += 10 * dto.getN_mq_num();
}
price = Math.ceil(price + (number - 1) * 5);
if (number > 1) {
price *= 1.3;
}
pro.setCount(count / number);
pro.setPrice(price);
list.add(pro);
@@ -2536,21 +2433,17 @@ public class PriceUtils {
Product pro = new Product();
double area = length * width / 10000;
double price = 0, dj = 0;
if (area < 0.3) {
price = Math.max(40, 5 * count);
} else {
if (area < 0.25) {
dj = 40;
dj = 50;
} else {
dj = 35;
dj = 40;
}
area *= count;
if ("6".equals(kind2)) {
price = price + 30;
}
price = Math.ceil(Math.max(area * dj, 40));
}
price = Math.ceil(area * dj > 58 ? area * dj : 58);
pro.setCount(count);
pro.setPrice(price * number);
list.add(pro);
@@ -2644,8 +2537,6 @@ public class PriceUtils {
pro.setPrice(Math.ceil(priceArr[i] * beishu - countArr[i] * 0.02));
} else if ("0".equals(kind)) {// 80克
pro.setPrice(Math.ceil(priceArr[i] * beishu));
} else if ("2".equals(kind)) {// 100克
pro.setPrice(Math.ceil(priceArr[i] * beishu * 1.5));
}
list.add(pro);
}
@@ -2707,28 +2598,28 @@ public class PriceUtils {
Product pro;
double price = 0;
if (length == 240 && width == 200 || length == 200 && width == 240) {
if (kind.equals("春亚布")) {
price = num * count * 2;
} else {
price = num * count * 3;
}
} else if (length == 200 && width == 140 || length == 140 && width == 200) {
if (kind.equals("春亚布")) {
price = num * count * 1.8;
} else {
price = num * count * 2.5;
}
} else if (length == 200 && width == 140 || length == 140 && width == 200) {
if (kind.equals("春亚布")) {
price = num * count * 1.5;
} else {
price = num * count * 1.3;
}
} else {
if (kind.equals("春亚布")) {
price = num * count * 1.5;
} else {
price = num * count * 2;
price = num * count * 1.8;
}
}
pro = new Product();
pro.setCount(count);
pro.setPrice(Math.max(Math.ceil(price), 30));
pro.setPrice(Math.ceil(price) > 50 ? price : 50);
list.add(pro);
return list;
}
@@ -3040,7 +2931,7 @@ public class PriceUtils {
Product pro = new Product();
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
List<String> craft_list = dto.getCraft() == null ? new ArrayList<>() : Arrays.asList(dto.getCraft());
// 报的数量需要多少张大纸
int num = (int) Math.ceil(count / max);
// if (count <= 1000) {
@@ -3054,9 +2945,6 @@ public class PriceUtils {
dj = 0.5;
}
pro.setPrice(130 + Math.ceil((num + 100) * dj));
if (craft_list.contains("异形") || craft_list.contains("异形模切")) {
pro.setPrice(Math.ceil(pro.getPrice() * 1.5));
}
double area = 0;
if ("烫金".equals(dto.getCraftTang())) {
int lszCountArr[] = new int[]{500, 1000, 2000, 3000, 5000, 10000, 20000};
@@ -3134,11 +3022,12 @@ public class PriceUtils {
Product pro = new Product();
double price = 0, dj = 0;
String[] craft = dto.getCraft();
if ("套餐".equals(dto.getStickerKind())) {
if (dto.getStickerKind().equals("套餐")) {
pro.setCount(count);
pro.setPrice(198.0);
list.add(pro);
} else {
double area = length * width * count / 10000;
double d = length * width * count / 10000;
if (length == 100 && width == 45) {
@@ -3358,9 +3247,8 @@ public class PriceUtils {
String kind = dto.getKind2Value();
length = length * 10;
width = width * 10;
if ((length > l || width > w) && (length > w || width > l)) {
if ((length > l || width > w) && (length > w || width > l))
return null;
}
// 一张大纸能做多少个此类尺寸的不干胶
double max = Math.max(Math.floor(l / length) * Math.floor(w / width),
Math.floor(l / width) * Math.floor(w / length));
@@ -3502,7 +3390,6 @@ public class PriceUtils {
} else {
pro.setPrice(Math.ceil(price));
}
pro.setWeight(String.valueOf(df.format(width * length * 0.55 / 10000)));
pro.setCount(count);
list.add(pro);
@@ -3657,51 +3544,6 @@ public class PriceUtils {
return list;
}
public double TableNextPrice(double area, double[] price_list, double[] areas) {
double price = 0;
double last_price = 0;
for (int i = 0; i < areas.length; i++) {
if (area <= areas[i]) {
price = price_list[i];
break;
}
last_price = price_list[i];
}
return price == 0 ? last_price : price;
}
public double calcByTargetN(int startN, double highPrice, int endN, double lowPrice, int targetN) {
// 高价商品个数线性插值
if (endN == startN) {
return highPrice * targetN;
}
double a = startN * (double) (endN - targetN) / (endN - startN);
double b = targetN - a;
double total = a * highPrice + b * lowPrice;
return total;
}
public double TableCountCenterPrice(int area, double[] price_list, int[] areas) {
double price = 0;
int startIndex = 0;
int endIndex = 0;
for (int i = 0; i < areas.length; i++) {
if (area > areas[i]) {
startIndex = endIndex;
endIndex = Math.min(i + 1, areas.length - 1);
}
}
if (startIndex == endIndex && startIndex == 0) {
price = price_list[endIndex];
} else if (startIndex == endIndex) {
price = (price_list[endIndex] / areas[endIndex]) * area;
} else {
price = ((areas[endIndex] - (double) area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + (((double) area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
}
return price;
}
public double TablePrice(double area, int[] price_list, double[] areas) {
double price = 0;
int startIndex = 0;
@@ -3722,46 +3564,6 @@ public class PriceUtils {
return price;
}
public static double TableDoublePrice(double area, double[] price_list, double[] areas) {
double price = 0;
int startIndex = 0;
int endIndex = 0;
for (int i = 0; i < areas.length; i++) {
if (area > areas[i]) {
startIndex = endIndex;
endIndex = Math.min(i + 1, areas.length - 1);
}
}
if (startIndex == endIndex && startIndex == 0) {
price = price_list[endIndex];
} else if (startIndex == endIndex) {
price = (price_list[endIndex] / areas[endIndex]) * area;
} else {
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
}
return price;
}
public static double TableCountDoublePrice(double area, double[] price_list, int[] areas) {
double price = 0;
int startIndex = 0;
int endIndex = 0;
for (int i = 0; i < areas.length; i++) {
if (area > areas[i]) {
startIndex = endIndex;
endIndex = Math.min(i + 1, areas.length - 1);
}
}
if (startIndex == endIndex && startIndex == 0) {
price = price_list[endIndex];
} else if (startIndex == endIndex) {
price = (price_list[endIndex]);
} else {
price = ((areas[endIndex] - area) / (areas[endIndex] - areas[startIndex])) * price_list[startIndex] + ((area - areas[startIndex]) / (areas[endIndex] - areas[startIndex])) * price_list[endIndex];
}
return price;
}
public static double TableUnitPrice(double area, int[] price_list, double[] areas, double last_price) {
double price = 0;
int startIndex = 0;
@@ -3801,10 +3603,9 @@ public class PriceUtils {
if (area < 7.5) {
basePrice = 90;
} else {
basePrice = 80;
basePrice = 70;
}
return Math.max(Math.ceil(area * basePrice * 1.2), 50);
return Math.max(Math.ceil(area * basePrice), 50);
}
double price = 0;
if (craft_list.contains("冷转印")) {
@@ -3818,47 +3619,17 @@ public class PriceUtils {
if (count > 0) {
if (count <= 5) {
price += 200;
} else if (count < 75) {
} else if (count < 100) {
price += 14 * count + banfei;
} else {
if (count < 89) {
count = 89;
}
price += 14 * count;
price += 12 * count;
}
}
price = price + (coNumber - 1) * 100;
}
return Math.ceil(price * 0.9);
}
public static List<Product> getYinBaiPrice(List<Product> productList, double width, double length) {
double miniprice = 50;
double miniarea = 9;
//cm
double[] prices = {7.2, 4.6, 4, 2.8, 2.5, 2.24, 2.02, 1.92, 1.63, 1.56, 1.34, 1.26, 1.25, 1.04, 0.86, 0.64};
double[] areas = {9, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 140, 210, 420};
double area = width * length;
double craft_price = 0;
if (area < miniarea) {
craft_price = miniprice;
} else {
for (int i = 1; i < areas.length; i++) {
if (area < areas[i]) {
craft_price = prices[i - 1] * area;
break;
}
}
if (craft_price == 0) {
craft_price = prices[prices.length - 1] * area;
}
}
for (Product pro : productList) {
pro.setPrice(Math.ceil(pro.getPrice() + craft_price));
}
return productList;
return price;
}
public FunReturnVo getBagTagPrice(String kind2Value, String kindValue) {
@@ -1,112 +0,0 @@
package lingtao.net.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@Component
public class RedisUtil implements ApplicationContextAware {
private static RedisTemplate redisTemplate;
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
applicationContext = context;
redisTemplate = (RedisTemplate) applicationContext.getBean("redisTemplate");
}
/**
* 设置缓存
*
* @param key
* @param value
*/
public static void set(String key, Object value) {
if (redisTemplate != null) {
redisTemplate.opsForValue().set(key, value);
}
}
/**
* 设置缓存带过期时间
*
* @param key
* @param value
* @param expireTime 过期时间
*/
public static void set(String key, Object value, long expireTime) {
if (redisTemplate != null) {
redisTemplate.opsForValue().set(key, value, expireTime, TimeUnit.SECONDS);
}
}
/**
* 获取缓存
*
* @param key
* @return
*/
public static Object get(String key) {
if (redisTemplate != null) {
return redisTemplate.opsForValue().get(key);
}
return null;
}
/**
* 删除缓存
*
* @param key
*/
public static void delete(String key) {
if (redisTemplate != null) {
redisTemplate.delete(key);
}
}
/**
* 检查键是否存在
*
* @param key
* @return 是否存在
*/
public static boolean exists(String key) {
if (redisTemplate != null) {
return redisTemplate.hasKey(key);
}
return false;
}
/**
* 设置过期时间
*
* @param key
* @param expireTime 过期时间
* @return 是否成功
*/
public static boolean expire(String key, long expireTime) {
if (redisTemplate != null) {
return redisTemplate.expire(key, expireTime, TimeUnit.SECONDS);
}
return false;
}
/**
* 获取剩余过期时间
*
* @param key
* @return 剩余过期时间
*/
public static long getExpire(String key) {
if (redisTemplate != null) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
return -1;
}
}
@@ -1,41 +0,0 @@
package lingtao.net.util;
import com.alibaba.fastjson.JSONObject;
import lingtao.net.vo.*;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
public class ShengDaPriceUtils {
private static final String AppId = "3a1ab376af58ec4e918b4c506480efdf";
private static final String AppSecret = "e06KAvT6ugHpQd5zjHukfMJBH0dxfA74gWk9o1lsLqOMTYExFVvWuTh0twMQvNBF";
//UV打印亚克力
private static final String productId = "UVDAYINYAKELI";
public static String getToken() {
String tokenString = HttpUtils.sendGetRequest("http://47.114.150.226:88/Handler/apiShengda.ashx?t=apiGetToken");
System.out.println("获取token返回:" + tokenString);
ShengDaTokenVo huaFangTokenVo = JSONObject.parseObject(tokenString, ShengDaTokenVo.class);
return huaFangTokenVo.getResult();
}
public static ShengDaPriceResultVo getPrice(ShengDaPriceRequstVo params) {
Map<String, String> heards = new HashMap<>();
heards.put("Authorization", "Bearer " + getToken());
String resultText = HttpUtils.sendPostRequest("https://open.sd2000.com/api/app/calculate", JSONObject.toJSONString(params), heards);
ShengDaPriceResultVo result = JSONObject.parseObject(resultText, ShengDaPriceResultVo.class);
return result;
}
public static ShengDaPriceResultVo getPrice(ShengDaPriceNoPartsRequstVo params) {
Map<String, String> heards = new HashMap<>();
heards.put("Authorization", "Bearer " + getToken());
String resultText = HttpUtils.sendPostRequest("https://open.sd2000.com/api/app/calculate", JSONObject.toJSONString(params), heards);
ShengDaPriceResultVo result = JSONObject.parseObject(resultText, ShengDaPriceResultVo.class);
return result;
}
}
@@ -43,11 +43,7 @@ public class SwzStickersPrice {
// 报的数量需要多少张大纸
int num = (int) Math.ceil(count / max);
double base_price = 5.5;
if(num >50){
base_price = 4;
}
price = 50 + (num - 1) * base_price;
price = 50 + (num - 1) * 5.5;
} else {//激凸烫金工艺一样价格
//20刀模费,20版费,5mm出血,7.5元/平方
price = (length + 0.5) * (width + 0.5) * count / 10000 * 7.5 + 40;
+23 -12
View File
@@ -1,7 +1,5 @@
package lingtao.net.util;
import com.aspose.pdf.Document;
import com.aspose.pdf.optimization.OptimizationOptions;
import lingtao.net.bean.Product;
import org.springframework.util.StringUtils;
@@ -71,21 +69,35 @@ public class ZsPrice {
if (number > 1) {
double desFee = 0;
if (!role.contains("1045") && !role.contains("1054") && !role.contains("1029")) {
if (dto.getP() == 1) {
desFee = 0.5;
} else if (dto.getP() == 2) {
desFee = 2;
} else if (dto.getP() == 3) {
desFee = 1;
} else if (dto.getP() == 4) {
desFee = 3;
} else if (dto.getP() == 5) {
desFee = 3.5;
desFee = 0.6 * (number - 1);
} else {
desFee = 10* (number - 1);
// if (number == 2) {
// desFee = 5.75;
// }
// if (number == 3) {
// desFee = 5.75 + 3.75;
// }
// if (number > 3) {
// desFee = 5.75 + 3.75 + 2.75 * (number - 3);
// }
}
price += desFee;
} else {
if (dto.getP() == 1 || dto.getP() == 2 || dto.getP() == 3) {
desFee = 3;
} else if (dto.getP() == 4) {
desFee = 5;
} else if (dto.getP() == 5) {
desFee = 6;
} else {
desFee = 10;
}
price += desFee * (number - 1);
}
}
Product pro = new Product();
@@ -100,7 +112,6 @@ public class ZsPrice {
}
public int[] twoSum(int[] nums, int target) {
List<Integer> list = new ArrayList<>();
@@ -1,13 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class HuaFangPriceProcessItemsVo {
private String processName;
private String processValue;
private List<Double> sizes;
}
@@ -1,23 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class HuaFangPriceRequstVo {
private Integer styleNum;
private List<Double> sizes;
private String productPrintFace;
private String productPrintColor;
private String productPaperCode;
private String productPaperName;
private String productName;
private Integer num;
private List<HuaFangPriceProcessItemsVo> calcProcess;
}
@@ -1,21 +0,0 @@
package lingtao.net.vo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class HuaFangPriceResultVo {
private String id;
private Double amount;
@JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXXX")
private LocalDateTime deliveryTime;
private Double totalWeight;
private Double deliveryAmount;
private Double productAmount;
}
@@ -1,11 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
@Data
public class HuaFangTokenVo {
private String accessToken;
private Integer expiresIn;
}
@@ -1,24 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class ShengDaPriceNoPartsRequstVo {
private String productCategory;
private String paper;
private List<ShengDaPriceRequstItemVo> crafts;
private String name;
private String size;
private Integer num;
private String sizeUnit;
private String doubleSideType;
private Double height;
private Double width;
private Integer printSide;
private Integer styleNum;
}
@@ -1,20 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.Map;
@Data
public class ShengDaPriceRequstItemVo {
public ShengDaPriceRequstItemVo() {
}
public ShengDaPriceRequstItemVo(String name) {
this.name = name;
}
private String name;
private Map<String, String> parameters;
}
@@ -1,16 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class ShengDaPriceRequstPartsVo {
private List<ShengDaPriceRequstItemVo> crafts;
private String name;
private Integer num;
private String sizeUnit;
private Double height;
private Double width;
private Integer printSide;
}
@@ -1,17 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.util.List;
@Data
public class ShengDaPriceRequstVo {
private String productCategory;
private String paper;
private List<ShengDaPriceRequstItemVo> baseCrafts;
private List<ShengDaPriceRequstPartsVo> parts;
}
@@ -1,19 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ShengDaPriceResultVo {
private Integer errCode;
private String errMsg;
private ResultData data;
@Data
public class ResultData {
private String productCategoryId;
private String productCategoryName;
private Double price;
}
}
@@ -1,9 +0,0 @@
package lingtao.net.vo;
import lombok.Data;
@Data
public class ShengDaTokenVo {
private String type;
private String result;
}
-46
View File
@@ -123,50 +123,4 @@
</value>
</property>
</bean>
<!-- =================配置Redis================= -->
<!-- Redis连接池配置 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="100"/>
<property name="maxIdle" value="20"/>
<property name="maxWaitMillis" value="10000"/>
<property name="testOnBorrow" value="true"/>
</bean>
<!-- Redis连接工厂 -->
<bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="hostName" value="localhost"/>
<property name="port" value="6379"/>
<property name="password" value=""/>
<property name="database" value="0"/>
<property name="poolConfig" ref="jedisPoolConfig"/>
</bean>
<!-- Redis模板 -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="jedisConnectionFactory"/>
<property name="keySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
</property>
<property name="valueSerializer">
<bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
</property>
<property name="hashKeySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
</property>
<property name="hashValueSerializer">
<bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
</property>
</bean>
<!-- StringRedisTemplate(可选,用于String类型操作) -->
<bean id="stringRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="jedisConnectionFactory"/>
</bean>
<!-- Redis缓存管理器 -->
<bean id="redisCacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
<constructor-arg name="redisOperations" ref="redisTemplate"/>
<property name="defaultExpiration" value="3600"/>
</bean>
</beans>
@@ -9,12 +9,8 @@
FROM
tbl_information
<where>
1=1
<if test="content != null and content != ''">
AND content like '%${content}%'
</if>
<if test="type != null and type != ''">
AND type = '${type}'
content like '%${content}%'
</if>
</where>
order by id
@@ -46,7 +46,6 @@
and kind2_value = #{kind2Value}
</if>
</where>
LIMIT 1
</select>
@@ -162,7 +162,7 @@
<!-- 查询3分钟内的数据 -->
<select id="getQuoteDataByMinutes" parameterType="String" resultType="String">
SELECT
remark
remarkJudge
FROM
tbl_quote_data
WHERE id >
@@ -1,55 +0,0 @@
<?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="lingtao.net.dao.StandardMemoMapper">
<select id="getStandardMemos" parameterType="lingtao.net.bean.StandardMemo"
resultType="lingtao.net.bean.StandardMemo">
SELECT
*
FROM
tbl_standard_memo
<where>
1=1
<if test="content != null and content != ''">
and (title like '%${content}%' or content like '%${content}%')
</if>
<if test="type != null and type != ''">
and `type` = #{type}
</if>
</where>
order by id desc
</select>
<insert id="addStandardMemo" parameterType="lingtao.net.bean.StandardMemo">
insert into tbl_standard_memo
(content, createBy, createDate, title, memo, type)
values (#{content}, #{createBy}, now(), #{title}, #{memo}, #{type})
</insert>
<update id="updateStandardMemoById" parameterType="lingtao.net.bean.StandardMemo">
update tbl_standard_memo
<set>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
updateBy = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateDate != null">
updateDate = now(),
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="memo != null">
memo = #{memo,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteStandardMemoById">
delete
from tbl_standard_memo
where id = #{id}
</delete>
</mapper>
@@ -55,6 +55,6 @@
select roleId from tbl_sys_user_role where userId = #{userId}
)
)
ORDER BY orderNo ASC,parentId ASC;
ORDER BY -orderNo DESC
</select>
</mapper>
@@ -1,51 +0,0 @@
<?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="lingtao.net.dao.TipContentMapper">
<select id="getTipContents" parameterType="lingtao.net.bean.TipContent"
resultType="lingtao.net.bean.TipContent">
SELECT
*
FROM
tbl_tip_content
<where>
<if test="content != null and content != ''">
title like '%${content}%' or content like '%${content}%'
</if>
</where>
order by id desc
</select>
<insert id="addTipContent" parameterType="lingtao.net.bean.TipContent">
insert into tbl_tip_content
(content, createBy, createDate, title,attachment,type)
values (#{content}, #{createBy}, now(), #{title}, #{attachment}, #{type})
</insert>
<update id="updateTipContentById" parameterType="lingtao.net.bean.TipContent">
update tbl_tip_content
<set>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
updateBy = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateDate != null">
updateDate = now(),
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="attachment != null">
attachment = #{attachment,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteTipContentById">
delete
from tbl_tip_content
where id = #{id}
</delete>
</mapper>
+1 -1
View File
@@ -19,7 +19,7 @@ layui.use(['table','form','carousel'], function(){
for (let i = 0; i < result.length; i++) {
// 只留一个remark
remark = "";
html += '<div><img style="width:100%;height: 100%;object-fit: contain" src="' + result[i].imgUrl + '"></div>';
html += '<div><img style="width:'+result[0].imgWidth+'px" src="' +result[i].imgUrl+ '"></div>';
remark += '<div><span>' +result[i].remark+ '<span/></div>';
}
$("#carousel").append(html);
+1 -1
View File
@@ -22,7 +22,7 @@ layui.use(['element', 'table', 'laydate', 'form'], function () {
'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
},*/
where: {
type: '1',content: ''
content: ''
},
cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
cols: [[{
-58
View File
@@ -1,58 +0,0 @@
const client = new OSS({
// yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
region: "oss-cn-hangzhou",
// 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
accessKeyId: "LTAI5tE7wuNkeT9jZ42bQnyr",
accessKeySecret: "NnutvWhKl4HbQFSad3HosYbCkEkbjN",
// 填写存储空间名称。
bucket: "ltcloudfile",
endpoint: "https://oss-cn-hangzhou.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 = {
};
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);
});
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More