parent
aa41b9197e
commit
71b0b145ef
@ -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= |
||||
|
@ -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); |
||||
} |
||||
} |
||||
} |
@ -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<String> fileNames = new ArrayList<String>(); |
||||
if (multipartResolver.isMultipart(request)) { |
||||
// 转换成多部分request
|
||||
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; |
||||
Iterator<String> 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); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,7 @@ |
||||
wxH5AppId=wxa075e8509802f826 |
||||
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5 |
||||
|
||||
wxAppId=wx8d49e2f83025229d |
||||
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df |
||||
|
||||
fileUrl=/home/project/hsg/filesystem |
Loading…
Reference in new issue