Browse Source

fix:优化代码2

dist.1.3.0
pref_mail@163.com 4 months ago
parent
commit
ddd0ff2248
  1. 31
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java
  2. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/enums/CostTypeEnums.java
  3. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java
  4. 19
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java

31
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataPriceController.java

@ -23,39 +23,19 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.WriteTable;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.excel.price.BasicdataPriceCategoryBasicExcel;
import com.logpm.basicdata.excel.price.BasicdataPriceCategoryDispatchExcel;
import com.logpm.basicdata.excel.price.BasicdataPriceCategoryWarehouseExcel;
import com.logpm.basicdata.excel.price.BasicdataPriceExcel;
import com.logpm.basicdata.excel.price.BasicdataPriceFullVehicleExcel;
import com.logpm.basicdata.excel.price.BasicdataPriceGeneralExcel;
import com.logpm.basicdata.excel.price.*;
import com.logpm.basicdata.service.IBasicdataPriceService;
import com.logpm.basicdata.vo.BasicdatPriceApiVO;
import com.logpm.basicdata.vo.BasicdataPriceBasicUpdateVO;
import com.logpm.basicdata.vo.BasicdataPricePageVO;
import com.logpm.basicdata.vo.PriceClientVO;
import com.logpm.basicdata.vo.PriceVO;
import com.logpm.basicdata.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.codec.Charsets;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
@ -63,6 +43,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Map;
@ -184,8 +165,8 @@ public class BasicdataPriceController extends BladeController {
try {
String fileName = "基础价格表" + DateUtil.today();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build();
WriteTable table1 = EasyExcel.writerTable(0).head(BasicdataPriceExcel.class).build();

3
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/enums/CostTypeEnums.java

@ -10,6 +10,9 @@ import org.springblade.common.model.IDict;
*/
public enum CostTypeEnums implements IDict<Integer> {
/**
* 普通费
*/
NOMAL(1, "普通费"),
ADD(2, "附加费"),
;

5
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java

@ -57,6 +57,7 @@ import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.constant.basiccode.BasicCodeShowConstant;
import org.springblade.common.constant.basiccode.BasicCodeTypeConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.model.dto.NameDTO;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.exception.ServiceException;
@ -690,6 +691,8 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
case "三方中转":
business.setMold("4");
break;
default:
throw new CustomerException("未知的服务类型");
}
} else {
@ -718,6 +721,8 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
case "三方中转":
i.setMold("4");
break;
default:
throw new CustomerException("未知的服务类型");
}
} else {

19
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java

@ -45,13 +45,11 @@ import com.logpm.basicdata.vo.BasicdataWarehouseVO;
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.codec.Charsets;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.entity.User;
import org.springblade.system.feign.IUserClient;
import org.springframework.stereotype.Service;
@ -60,6 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -109,8 +108,8 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
try {
String fileName = "货区数据" + DateUtil.time();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
// 构造各个sheet页相关信息
List<GoodsAreaSheetInfoBean> goodsAreaSheetInfoBeans = new LinkedList<>();
@ -363,8 +362,8 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
try {
String fileName = "仓库数据" + DateUtil.time();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
// 构造各个sheet页相关信息
List<GoodsAreaSheetInfoBean> goodsAreaSheetInfoBeans = new LinkedList<>();
@ -415,8 +414,8 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
try {
String fileName = "仓库数据" + DateUtil.time();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
// 构造各个sheet页相关信息
List<GoodsAreaSheetInfoBean> goodsAreaSheetInfoBeans = new LinkedList<>();
@ -461,8 +460,8 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
try {
String fileName = "仓库数据" + DateUtil.time();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, Charsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name());
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
// 构造各个sheet页相关信息
List<GoodsAreaSheetInfoBean> goodsAreaSheetInfoBeans = new LinkedList<>();

Loading…
Cancel
Save