erzhongxmu 2023-12-27 20:11:49 +08:00
parent 72366595d9
commit 2461ae983c
1 changed files with 2 additions and 34 deletions

View File

@ -63,17 +63,12 @@ public class wmBaseController extends BaseController {
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(wmBaseController.class); private static final Logger logger = Logger.getLogger(wmBaseController.class);
// @Autowired
// private WvGiServiceI wvGiService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private SmsSendTask smsSendTask; private SmsSendTask smsSendTask;
@Autowired @Autowired
private CostTask costTask; private CostTask costTask;
// @Autowired
// private Validator validator;
/** /**
* / * /
@ -87,22 +82,18 @@ public class wmBaseController extends BaseController {
public void getbarcodeImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception { public void getbarcodeImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
request.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8");
String flag = request.getParameter("down");//是否下载否则展示图片 String flag = request.getParameter("down");//是否下载否则展示图片
String qrvalue = request.getParameter("qrvalue"); String qrvalue = request.getParameter("qrvalue");
String dbpath = qrvalue + ".jpg"; String dbpath = qrvalue + ".jpg";
String localPath = ResourceUtil.getConfigByName("webUploadpath"); String localPath = ResourceUtil.getConfigByName("webUploadpath");
try { try {
String imgurl = localPath + File.separator + dbpath; String imgurl = localPath + File.separator + dbpath;
// QRcodeUtil.encode(qrvalue,imgurl);
BarcodeUtil.generateFile(qrvalue, imgurl); BarcodeUtil.generateFile(qrvalue, imgurl);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
if ("1".equals(flag)) { if ("1".equals(flag)) {
response.setContentType("application/x-msdownload;charset=utf-8"); response.setContentType("application/x-msdownload;charset=utf-8");
String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1); String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
String userAgent = request.getHeader("user-agent").toLowerCase(); String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko")) { if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
@ -110,11 +101,9 @@ public class wmBaseController extends BaseController {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1"); fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
} }
response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setHeader("Content-disposition", "attachment; filename=" + fileName);
} else { } else {
response.setContentType("image/jpeg;charset=utf-8"); response.setContentType("image/jpeg;charset=utf-8");
} }
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream = null; OutputStream outputStream = null;
try { try {
@ -152,21 +141,18 @@ public class wmBaseController extends BaseController {
public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception { public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
request.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8");
String flag = request.getParameter("down");//是否下载否则展示图片 String flag = request.getParameter("down");//是否下载否则展示图片
String qrvalue = request.getParameter("qrvalue"); String qrvalue = request.getParameter("qrvalue");
String dbpath = qrvalue + ".jpg"; String dbpath = qrvalue + ".jpg";
String localPath = ResourceUtil.getConfigByName("webUploadpath"); String localPath = ResourceUtil.getConfigByName("webUploadpath");
try { try {
String imgurl = localPath + File.separator + dbpath; String imgurl = localPath + File.separator + dbpath;
QRcodeUtil.encode(qrvalue, imgurl); QRcodeUtil.encode(qrvalue, imgurl);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
if ("1".equals(flag)) { if ("1".equals(flag)) {
response.setContentType("application/x-msdownload;charset=utf-8"); response.setContentType("application/x-msdownload;charset=utf-8");
String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1); String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
String userAgent = request.getHeader("user-agent").toLowerCase(); String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko")) { if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
@ -174,11 +160,9 @@ public class wmBaseController extends BaseController {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1"); fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
} }
response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setHeader("Content-disposition", "attachment; filename=" + fileName);
} else { } else {
response.setContentType("image/jpeg;charset=utf-8"); response.setContentType("image/jpeg;charset=utf-8");
} }
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream = null; OutputStream outputStream = null;
try { try {
@ -206,17 +190,11 @@ public class wmBaseController extends BaseController {
@RequestMapping(value = "geterpim", method = RequestMethod.GET) @RequestMapping(value = "geterpim", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> listim() { public ResponseEntity<?> listim() {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WmToUpGoodsErpEntity where 1 = 1 "; String hql = " from WmToUpGoodsErpEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql); List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql);
D0.setOK(true); D0.setOK(true);
D0.setObj(listerp); D0.setObj(listerp);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@ -224,17 +202,11 @@ public class wmBaseController extends BaseController {
@RequestMapping(value = "geterpom", method = RequestMethod.GET) @RequestMapping(value = "geterpom", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> listom() { public ResponseEntity<?> listom() {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WmToDownGoodsErpEntity where 1 = 1 "; String hql = " from WmToDownGoodsErpEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql); List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql);
D0.setOK(true); D0.setOK(true);
D0.setObj(listerp); D0.setObj(listerp);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@ -242,8 +214,6 @@ public class wmBaseController extends BaseController {
@RequestMapping(value = "runtask", method = RequestMethod.GET) @RequestMapping(value = "runtask", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> runtask() { public ResponseEntity<?> runtask() {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
smsSendTask.run(); smsSendTask.run();
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
@ -253,8 +223,6 @@ public class wmBaseController extends BaseController {
@RequestMapping(value = "runtaskone", method = RequestMethod.GET) @RequestMapping(value = "runtaskone", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> runtaskone() { public ResponseEntity<?> runtaskone() {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
costTask.run(); costTask.run();
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);