From 71b0b145ef025e6d39dd8807fecc5773ce1edaea Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 27 Jun 2023 09:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=9D=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/dev/config.properties | 4 +- .../com/cweb/controller/BsMsgController.java | 7 +- .../HighMerchantStoreController.java | 3 - .../business/OrderStatisticController.java | 44 +++++++++ .../java/com/hai/dao/HighOrderMapperExt.java | 8 ++ .../com/hai/service/HighOrderService.java | 11 +++ .../service/impl/HighOrderServiceImpl.java | 5 ++ .../main/java/com/v1/config/AuthConfig.java | 1 + v1/src/main/java/com/v1/config/SysConfig.java | 10 +++ .../business/FileUploadController.java | 89 +++++++++++++++++++ v1/src/main/resources/dev/config.properties | 2 + v1/src/main/resources/pre/config.properties | 7 ++ v1/src/main/resources/prod/config.properties | 2 + 13 files changed, 182 insertions(+), 11 deletions(-) create mode 100644 hai-order/src/main/java/com/web/controller/business/OrderStatisticController.java create mode 100644 v1/src/main/java/com/v1/controller/business/FileUploadController.java diff --git a/hai-bweb/src/main/resources/dev/config.properties b/hai-bweb/src/main/resources/dev/config.properties index 25674f3d..da0992f7 100644 --- a/hai-bweb/src/main/resources/dev/config.properties +++ b/hai-bweb/src/main/resources/dev/config.properties @@ -1,5 +1,5 @@ -#fileUrl=/home/project/hsg/filesystem -fileUrl=/Volumes/work/code/filesystem/ +fileUrl=/home/project/hsg/filesystem +#fileUrl=/Volumes/work/code/filesystem/ cmsPath=/home/project/hsg/filesystem/cmsPath agentQrCode=/home/project/hsg/filesystem/agentQrCode agentQrCodeWxUrl=https://hsgcs.dctpay.com/wx/?action=ic&id= diff --git a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java index a00c49f5..bd003bc5 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java @@ -1,17 +1,12 @@ package com.cweb.controller; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.hai.common.exception.ErrorCode; -import com.hai.common.exception.ErrorHelp; -import com.hai.common.exception.SysCode; + import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.BsMsg; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; -import com.hai.model.UserInfoModel; import com.hai.service.BsMsgService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java b/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java index ff253b36..7a64af88 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighMerchantStoreController.java @@ -41,9 +41,6 @@ public class HighMerchantStoreController { private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); - @Autowired - private UserCenter userCenter; - @Resource private HighCouponService highCouponService; diff --git a/hai-order/src/main/java/com/web/controller/business/OrderStatisticController.java b/hai-order/src/main/java/com/web/controller/business/OrderStatisticController.java new file mode 100644 index 00000000..a93adc89 --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderStatisticController.java @@ -0,0 +1,44 @@ +package com.web.controller.business; + +import com.alibaba.excel.EasyExcel; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.model.HighOrderModel; +import com.hai.model.ResponseData; +import com.hai.service.HighOrderService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.util.List; + +@Controller +@RequestMapping(value = "orderStatistic") +@Api(value = "订单统计业务") +public class OrderStatisticController { + + private static Logger log = LoggerFactory.getLogger(OrderStatisticController.class); + + @Resource + private HighOrderService highOrderService; + + @RequestMapping(value = "/hltCardNoTopUpStatistic", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "汇联通工会卡充值统计") + public ResponseData hltCardNoTopUpStatistic() { + try { + + return ResponseMsgUtil.success(highOrderService.hltCardNoTopUpStatistic()); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 62e6e8b2..b9f1e5b6 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1277,4 +1277,12 @@ public interface HighOrderMapperExt { @Result(column="ext_6", property="ext6", jdbcType=JdbcType.VARCHAR) }) List phoneErrorOrder(); + + @Select({ + "" + }) + Map HltCardNoTopUpStatistic(); + } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index 04aa214e..710db95b 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -457,6 +457,17 @@ public interface HighOrderService { */ Map countGasOrder(Map param) throws Exception; + + /** + * @Author Sum1Dream + * @Name HltCardNoTopUpStatistic + * @Description // 获取工会卡充值统计 + * @Date 17:40 2023/6/26 + * @Param [param] + * @Return java.util.Map + */ + Map hltCardNoTopUpStatistic(); + /** * 查询加油站订单列表 * @param orderNo diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 1f9b64db..de35a706 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1350,6 +1350,11 @@ public class HighOrderServiceImpl implements HighOrderService { return highOrderMapperExt.countGasStoreOrder(param); } + @Override + public Map hltCardNoTopUpStatistic() { + return highOrderMapperExt.HltCardNoTopUpStatistic(); + } + @Override public GasOrderModel getGasOrderDetail(String orderNo) { Map param = new HashMap<>(); diff --git a/v1/src/main/java/com/v1/config/AuthConfig.java b/v1/src/main/java/com/v1/config/AuthConfig.java index c38c8b84..7c9d0ebc 100644 --- a/v1/src/main/java/com/v1/config/AuthConfig.java +++ b/v1/src/main/java/com/v1/config/AuthConfig.java @@ -96,6 +96,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/selfOilStation/*") .excludePathPatterns("/order/*") .excludePathPatterns("/wxMsg/*") + .excludePathPatterns("/fileUpload/*") .excludePathPatterns("/orderRebate/*") .excludePathPatterns("/refuelOnline/*") ; diff --git a/v1/src/main/java/com/v1/config/SysConfig.java b/v1/src/main/java/com/v1/config/SysConfig.java index 9d56cf9a..2b6c3e8f 100644 --- a/v1/src/main/java/com/v1/config/SysConfig.java +++ b/v1/src/main/java/com/v1/config/SysConfig.java @@ -15,6 +15,8 @@ public class SysConfig { private String wxAppId; private String wxAppSecret; + private String fileUrl; + public String getWxH5AppId() { return wxH5AppId; } @@ -46,4 +48,12 @@ public class SysConfig { public void setWxAppSecret(String wxAppSecret) { this.wxAppSecret = wxAppSecret; } + + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } } diff --git a/v1/src/main/java/com/v1/controller/business/FileUploadController.java b/v1/src/main/java/com/v1/controller/business/FileUploadController.java new file mode 100644 index 00000000..36b21271 --- /dev/null +++ b/v1/src/main/java/com/v1/controller/business/FileUploadController.java @@ -0,0 +1,89 @@ +package com.v1.controller.business; + +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonConfig; +import com.hai.model.ResponseData; +import com.hai.service.FileUploadService; +import com.v1.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.multipart.commons.CommonsMultipartResolver; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.util.*; + +@RestController +@RequestMapping(value="/fileUpload") +@Api(value="文件上传") +public class FileUploadController { + + private static Logger log = LoggerFactory.getLogger(FileUploadController.class); + + @Resource + private FileUploadService fileUploadService; + + @RequestMapping(value="/uploadfile",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "文件上传") + public ResponseData uploadFile(@RequestParam(value = "files" , required = false) MultipartFile files, + HttpServletRequest request, + HttpServletResponse response) throws Exception { + try { + response.setHeader("Access-Control-Allow-Origin", "*"); + CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver( + request.getSession().getServletContext()); + // 判断 request 是否有文件上传,即多部分请求 + List fileNames = new ArrayList(); + if (multipartResolver.isMultipart(request)) { + // 转换成多部分request + MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; + Iterator iterator = multiRequest.getFileNames(); + + while (iterator.hasNext()) { + MultipartFile file = multiRequest.getFile(iterator.next()); + if (file != null) { + FileOutputStream out = null; + try { + String fileType = file.getOriginalFilename() + .substring(file.getOriginalFilename().lastIndexOf(".") + 1); + String fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(".")) + System.currentTimeMillis() + "." + fileType; + String childPath = DateUtil.date2String(new Date(), "yyyyMM"); + String destDirName = SysConst.getSysConfig().getFileUrl() + File.separator + childPath; + File dir = new File(destDirName); + if (!dir.exists()) { + dir.mkdirs(); + } + out = new FileOutputStream(destDirName + File.separator + fileName); + out.write(file.getBytes()); + out.flush(); + fileNames.add(childPath + "/" + fileName); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + if (out != null) { + out.close(); + } + } + } + } + } + return ResponseMsgUtil.success(fileNames); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + + } + +} diff --git a/v1/src/main/resources/dev/config.properties b/v1/src/main/resources/dev/config.properties index 39cffecb..9d60798d 100644 --- a/v1/src/main/resources/dev/config.properties +++ b/v1/src/main/resources/dev/config.properties @@ -3,3 +3,5 @@ wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 wxAppId=wx8d49e2f83025229d wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +fileUrl=/home/project/hsg/filesystem diff --git a/v1/src/main/resources/pre/config.properties b/v1/src/main/resources/pre/config.properties index e69de29b..9d60798d 100644 --- a/v1/src/main/resources/pre/config.properties +++ b/v1/src/main/resources/pre/config.properties @@ -0,0 +1,7 @@ +wxH5AppId=wxa075e8509802f826 +wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +wxAppId=wx8d49e2f83025229d +wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +fileUrl=/home/project/hsg/filesystem diff --git a/v1/src/main/resources/prod/config.properties b/v1/src/main/resources/prod/config.properties index 39cffecb..9d60798d 100644 --- a/v1/src/main/resources/prod/config.properties +++ b/v1/src/main/resources/prod/config.properties @@ -3,3 +3,5 @@ wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 wxAppId=wx8d49e2f83025229d wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df + +fileUrl=/home/project/hsg/filesystem