develop # Conflicts: # mallinkAdmin/src/main/java/com/iformall/controller/WxBillAllController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxBusinessController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxCUserDataController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxOrderController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxPayOrderController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxScoreRulesController.java # mallinkAdmin/src/main/java/com/iformall/controller/WxTagsController.java # mallinkService/src/main/java/com/iformall/common/ErrorCode.java # mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java # mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.javarelease_toaliyun_real
| @@ -22,13 +22,21 @@ import tk.mybatis.spring.annotation.MapperScan; | |||
| @EnableRocketMQ | |||
| public class UserApplication { | |||
| @Value("${fm.exception}") | |||
| private boolean fmException; | |||
| @Value("${fm.exception}") | |||
| private boolean fmException; | |||
| @Bean | |||
| public boolean isFmException() { | |||
| return fmException; | |||
| } | |||
| @Value("${fm.open}") | |||
| private boolean fmOpen; | |||
| @Bean | |||
| public boolean isFmException() { | |||
| return fmException; | |||
| } | |||
| @Bean | |||
| public boolean isFmOpen() { | |||
| return fmOpen; | |||
| } | |||
| public static void main(String[] args) { | |||
| SpringApplication.run(UserApplication.class, args); | |||
| @@ -101,9 +101,13 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/bHidLogin/**", "anon"); | |||
| filterChainDefinitionMap.put("/sendLoginPhoneCode/**", "anon"); | |||
| filterChainDefinitionMap.put("/doLoginByPhone/**", "anon"); | |||
| filterChainDefinitionMap.put("/wechat/login", "anon"); // 微信第三方登录callback | |||
| filterChainDefinitionMap.put("/wechat/callback", "anon"); // 微信第三方登录callback | |||
| filterChainDefinitionMap.put("/wechat/weChatUserLogin", "anon"); // 微信第三方登录绑定 | |||
| filterChainDefinitionMap.put("/wechat/login", "anon"); // 微信第三方登录callback | |||
| filterChainDefinitionMap.put("/wechat/callback", "anon"); // 微信网页登录回调 | |||
| filterChainDefinitionMap.put("/wechat/weChatUserLogin", "anon"); // 微信第三方登录 | |||
| // 验证码 | |||
| filterChainDefinitionMap.put("/captcha.jpg", "anon"); | |||
| // 官网 | |||
| filterChainDefinitionMap.put("/wxMallApply/add", "anon"); | |||
| // callback | |||
| filterChainDefinitionMap.put("/wxPay/notify/**", "anon"); // 支付回调 | |||
| filterChainDefinitionMap.put("/wxPayBill/notify/**", "anon"); | |||
| @@ -111,7 +115,6 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/user/sendvalidationcode", "anon"); | |||
| filterChainDefinitionMap.put("/user/updatepwd", "anon"); | |||
| filterChainDefinitionMap.put("/carCallback/**", "anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/add", "anon"); | |||
| filterChainDefinitionMap.put("/wxMallApply/sendvalidationcode", "anon"); | |||
| // static files | |||
| @@ -119,8 +122,7 @@ public class ShiroConfig { | |||
| filterChainDefinitionMap.put("/js/**", "anon"); | |||
| filterChainDefinitionMap.put("/img/**", "anon"); | |||
| filterChainDefinitionMap.put("/font-awesome/**", "anon"); | |||
| // 验证码 | |||
| filterChainDefinitionMap.put("/captcha.jpg", "anon"); | |||
| //<!-- 过滤链定义,从上向下顺序执行,一般将 /**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了; | |||
| //<!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问--> | |||
| //自定义加载权限资源关系 | |||
| @@ -10,12 +10,7 @@ import com.iformall.domain.po.WxTags; | |||
| import com.iformall.domain.vo.CUserBaseInfoT; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxTagsService; | |||
| import com.iformall.shiro.UserSession; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.session.Session; | |||
| import org.apache.shiro.session.UnknownSessionException; | |||
| import org.apache.shiro.subject.Subject; | |||
| import org.apache.shiro.util.ThreadContext; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -66,7 +61,7 @@ public class AsyncTask { | |||
| public void importExcelData(File file, MallUserInfo user, String importKey, String tenantId) { | |||
| ImportParams params = new ImportParams(); | |||
| // 需要验证 | |||
| params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||
| params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日","积分", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||
| IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler(); | |||
| handler.setNeedHandlerFields(new String[] { "手机号" }); | |||
| params.setNeedVerify(true); | |||
| @@ -111,7 +106,7 @@ public class AsyncTask { | |||
| try { | |||
| successList.parallelStream().forEach(uBase -> { | |||
| try { | |||
| wxCUserBasicInfoService.importOneMem(tenantId, importKey, tagList, uBase); | |||
| wxCUserBasicInfoService.importOneMem(tenantId, importKey, tagList, uBase,user); | |||
| } catch (UnknownSessionException ue) { | |||
| logger.error("session :"+ue.getMessage()); | |||
| } | |||
| @@ -148,6 +148,7 @@ public class MallUserInfoController extends BaseController { | |||
| @SystemControllerLog(description = "用户管理-修改用户") | |||
| public ResultData updateUser(@RequestBody MallUserInfo userInfo) { | |||
| logger.debug("[" + getIpAddr() + "] MallUserInfoController::updateUser"); | |||
| boolean bChangedPhone = false; | |||
| MallUserInfo currentUser = getUser(); | |||
| // 只有超管和自己能更新信息 | |||
| if (!(currentUser.getId().equals(userInfo.getId()) || | |||
| @@ -164,6 +165,7 @@ public class MallUserInfoController extends BaseController { | |||
| if(checkUniquePhone(userInfo.getPhone()) > 0){ | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||
| } | |||
| bChangedPhone = true; | |||
| } | |||
| userInfo.setTenantId(getTenantId()); | |||
| @@ -183,20 +185,20 @@ public class MallUserInfoController extends BaseController { | |||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode()) && | |||
| currentUser.getId().equals(userInfo.getId())) { | |||
| // 超管 | |||
| boolean bModify = false; | |||
| MallUserInfo adminUser = new MallUserInfo(); | |||
| adminUser.setFlowPermission(userInfo.getFlowPermission()); | |||
| adminUser.setEmail(userInfo.getEmail()); | |||
| adminUser.setId(userInfo.getId()); | |||
| if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | |||
| adminUser.setPassword(userInfo.getPassword()); | |||
| bModify = true; | |||
| } | |||
| if (StringUtils.isNotBlank(userInfo.getUsername())) { | |||
| adminUser.setUsername(userInfo.getUsername()); | |||
| if (StringUtils.isNotBlank(userInfo.getNickName())) { | |||
| adminUser.setNickName(userInfo.getNickName()); | |||
| } | |||
| if (bModify) { | |||
| userInfoService.saveOrUpdate(adminUser); | |||
| if (StringUtils.isNotBlank(userInfo.getPhone())) { | |||
| adminUser.setPhone(userInfo.getPhone()); | |||
| } | |||
| userInfoService.saveOrUpdate(adminUser); | |||
| } else { | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| if (userInfo.getRoleId() != null) { | |||
| @@ -207,6 +209,10 @@ public class MallUserInfoController extends BaseController { | |||
| userRoleService.saveOrUpdate(r); | |||
| } | |||
| } | |||
| if(bChangedPhone) { | |||
| // 手机号修改,清除bopen_id, 清除web_open_id | |||
| userInfoService.cleanAllOpenId(userInfo); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -257,15 +263,11 @@ public class MallUserInfoController extends BaseController { | |||
| } | |||
| private int checkUniqueName(String userName) { | |||
| MallUserInfo userQ = new MallUserInfo(); | |||
| userQ.setUsername(userName); | |||
| return userInfoService.cntUserList(userQ); | |||
| return userInfoService.cntByUserName(userName); | |||
| } | |||
| private int checkUniquePhone(String phone) { | |||
| MallUserInfo userQ = new MallUserInfo(); | |||
| userQ.setPhone(phone); | |||
| return userInfoService.cntUserList(userQ); | |||
| return userInfoService.cntByUserPhone(phone); | |||
| } | |||
| @@ -28,9 +28,7 @@ import java.io.BufferedInputStream; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.net.URL; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| import java.util.*; | |||
| @RestController | |||
| @RequestMapping(value = "upload") | |||
| @@ -44,66 +42,6 @@ public class UploadController extends BaseController { | |||
| private AmazonS3 s3 = null; | |||
| /* | |||
| @Value("${fileUpload.path}") | |||
| private String filePath; | |||
| @Value("${fileUpload.server}") | |||
| private String server; | |||
| @PostMapping(value = "/fileUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传文件") | |||
| public ResultData fileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| ResultData data = new ResultData(); | |||
| FileOutputStream fos = null; | |||
| BufferedInputStream fs = null; | |||
| try { | |||
| File targetFile = new File(filePath); | |||
| if (!targetFile.exists()) { | |||
| targetFile.mkdirs(); | |||
| } | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||
| fileName = fileName + multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| fos = new FileOutputStream(new File(filePath + File.separator + fileName)); | |||
| fs = (BufferedInputStream) multiReq.getInputStream(); | |||
| byte[] buffer = new byte[1024]; | |||
| int len = 0; | |||
| while ((len = fs.read(buffer)) != -1) { | |||
| fos.write(buffer, 0, len); | |||
| } | |||
| fos.close(); | |||
| fs.close(); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("url", server + "/" + fileName); | |||
| data.data = map; | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| data.code = ResultData.ERROR; | |||
| data.message = "上传失败"; | |||
| } finally { | |||
| if (fos != null) { | |||
| try { | |||
| fos.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if (fs != null) { | |||
| try { | |||
| fs.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| return data; | |||
| } | |||
| */ | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| @@ -193,6 +131,61 @@ public class UploadController extends BaseController { | |||
| return data; | |||
| } | |||
| /** | |||
| * 多文件上传 | |||
| * | |||
| * @param files | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/awsFilesUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("多文件上传") | |||
| public ResultData awsFilesUpload(@RequestParam("files") MultipartFile[] files) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::awsFilesUpload"); | |||
| if(files.length > 0){ | |||
| ResultData data = new ResultData(); | |||
| List<Map<String,String>> dataList = new ArrayList<Map<String,String>>(); | |||
| for(MultipartFile multipartFile: files) { | |||
| Map<String, String> map = new HashMap<>(); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multipartFile.getContentType()); | |||
| metadata.setContentLength(multipartFile.getSize()); | |||
| FileOutputStream fos = null; | |||
| BufferedInputStream fs = null; | |||
| map.put("key", multipartFile.getOriginalFilename()); | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multipartFile.getOriginalFilename().lastIndexOf('.'); | |||
| if (dot >= 0) { | |||
| fileName = getTenantId() + "/" + fileName + multipartFile.getOriginalFilename().substring(dot, multipartFile.getOriginalFilename().length()); | |||
| } else { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| if(data1.code == ResultData.SUCCESS) { | |||
| Map _data = (Map)data1.data; | |||
| map.put("url", (String) _data.get("url")); | |||
| dataList.add(map); | |||
| } else { | |||
| // 部分成功 | |||
| data.code = ResultData.SUCCESS; | |||
| data.data = dataList; | |||
| return data; | |||
| } | |||
| } | |||
| data.code = ResultData.SUCCESS; | |||
| data.data = dataList; | |||
| return data; | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * C端上传图片文件 | |||
| * | |||
| @@ -1,14 +1,22 @@ | |||
| package com.iformall.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.enums.EnumAppType; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.MaUtil; | |||
| import com.iformall.utils.QRCodeUtils; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -17,6 +25,11 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -24,9 +37,15 @@ import java.util.Map; | |||
| public class WxAppinfoController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private boolean isFmOpen; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private FmOpenService openService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -74,24 +93,11 @@ public class WxAppinfoController extends BaseController { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); | |||
| } | |||
| @ApiOperation("C端更新AccessToken, 无限制二维码生成需要更新token") | |||
| @GetMapping("/accessTokenUpdate") | |||
| public ResultData ctokenUpdate() { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::ctokenUpdate"); | |||
| try { | |||
| wxAppinfoService.ctokenUpdate(getTenantId()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation(value = "下载二维码", notes = "参数{\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") | |||
| @ApiOperation(value = "下载二维码", notes = "参数{\"name\":\"String\",\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") | |||
| @PostMapping("/downQrCode") | |||
| public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) { | |||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::downQrCode"); | |||
| String name = (String) params.get("name"); | |||
| String pageUrl = (String) params.get("pageUrl"); | |||
| String sceneParam = (String) params.get("sceneParam"); | |||
| int type = 0; | |||
| @@ -113,9 +119,10 @@ public class WxAppinfoController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "pageUrl不能为空"); | |||
| } | |||
| try { | |||
| wxAppinfoService.exportQrcode(request, response, | |||
| exportQrcode(request, response, | |||
| getTenantId(), type, pageUrl, sceneParam, | |||
| withText, text1, text2); | |||
| withText, text1, text2, | |||
| name); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| @@ -123,5 +130,117 @@ public class WxAppinfoController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| private void exportQrcode(HttpServletRequest request, HttpServletResponse response, | |||
| String tenantId, int type, String pageUrl, String sceneParam, | |||
| int withText, String text1, String text2, | |||
| String name) { | |||
| // type 0 有限二维码, 1 无限制二维码 | |||
| // withText 0 不带字 1. 带下面的字,2 带下面的两行字 | |||
| WxAppinfo appinfo = wxAppinfoService.getCAppInfo(tenantId); | |||
| boolean autoColor = false; | |||
| boolean isHyaline = true; | |||
| WxMaCodeLineColor color = new WxMaCodeLineColor("0", "0", "0"); | |||
| WxMaService wxMaService; | |||
| if(isFmOpen) { | |||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appinfo.getAppId()); | |||
| } else { | |||
| wxMaService = MaUtil.getWeappService(appinfo); | |||
| } | |||
| String pathStr = ""; | |||
| if (StringUtils.isNotBlank(sceneParam)) { | |||
| pathStr = pageUrl + "?scene="+sceneParam; | |||
| } else { | |||
| pathStr = pageUrl; | |||
| } | |||
| String filepath = Constant.fileDirectory; | |||
| String fileName = name + ".png"; | |||
| String destPath1 = filepath + "1_" + fileName; | |||
| String destPath = filepath + fileName; | |||
| File dest = new File(destPath); | |||
| File pDest = dest.getParentFile(); | |||
| if (!pDest.exists()) { | |||
| pDest.mkdirs(); | |||
| } | |||
| try { | |||
| if(type == 0) { | |||
| final File codeFile = wxMaService.getQrcodeService().createQrcode(pathStr, QRCodeUtils.QR_WIDTH); | |||
| if (withText == 1) { | |||
| File dest1 = new File(destPath1); | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||
| QRCodeUtils.graphicsGeneration(dest1, dest, text1); | |||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||
| } else if (withText == 2) { | |||
| File dest1 = new File(destPath1); | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||
| QRCodeUtils.graphicsGeneration2(dest1, dest, text1, text2); | |||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||
| } else { | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest); | |||
| } | |||
| org.apache.commons.io.FileUtils.forceDelete(codeFile); | |||
| } else { | |||
| final File codeFile = wxMaService.getQrcodeService().createWxaCodeUnlimit(sceneParam, pageUrl, QRCodeUtils.QR_WIDTH, autoColor, color, isHyaline); | |||
| if (withText == 1) { | |||
| File dest1 = new File(destPath1); | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||
| QRCodeUtils.graphicsGeneration(dest1, dest, text1); | |||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||
| } else if (withText == 2) { | |||
| File dest1 = new File(destPath1); | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest1); | |||
| QRCodeUtils.graphicsGeneration2(dest1, dest, text1, text2); | |||
| org.apache.commons.io.FileUtils.forceDelete(dest1); | |||
| } else { | |||
| org.apache.commons.io.FileUtils.copyFile(codeFile, dest); | |||
| } | |||
| org.apache.commons.io.FileUtils.forceDelete(codeFile); | |||
| } | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| try { | |||
| downFile(destPath, fileName, response, request); | |||
| org.apache.commons.io.FileUtils.forceDelete(dest); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { | |||
| try { | |||
| response.reset(); | |||
| response.setContentType("bin"); | |||
| String agent = req.getHeader("user-agent"); | |||
| if (agent.contains("Firefox")) { | |||
| response.setHeader("Content-disposition", | |||
| "attachment; filename=" | |||
| + new String(filename.getBytes("GB2312"),"ISO-8859-1")); | |||
| } else { | |||
| response.setHeader("Content-disposition", | |||
| "attachment; filename=" | |||
| + java.net.URLEncoder.encode(filename,"UTF-8")); | |||
| } | |||
| // 循环取出流中的数据 | |||
| byte[] b = new byte[1024]; | |||
| int len; | |||
| InputStream inStream = new FileInputStream(filePath); | |||
| while ((len = inStream.read(b)) > 0) | |||
| response.getOutputStream().write(b, 0, len); | |||
| inStream.close(); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillAction; | |||
| import com.iformall.service.WxBillActionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @Api(description = "账单操作记录") | |||
| @RestController | |||
| @RequestMapping("wxBillAction") | |||
| public class WxBillActionController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBillActionService wxBillActionService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "账单操作记录-列表") | |||
| public ResultData list(@ModelAttribute WxBillAction wxBillAction, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillActionController::list"); | |||
| if (null == wxBillAction) { | |||
| wxBillAction = new WxBillAction(); | |||
| } | |||
| wxBillAction.setTenantId(getTenantId()); | |||
| wxBillAction.setSortColumns(WxBillAction.Field.Id_DESC); | |||
| PageInfo<WxBillAction> result = wxBillActionService.listAsPage(wxBillAction, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| } | |||
| @@ -2,10 +2,12 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.service.WxBillAllService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| @@ -70,4 +73,37 @@ public class WxBillAllController extends BaseController { | |||
| } | |||
| /** | |||
| * 欠缴商户列表 | |||
| * @param wxBillAll | |||
| * @param pageNum | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| @GetMapping("oweMerchantlist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "费用收缴数据-欠缴商户列表") | |||
| public ResultData oweMerchantlist(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::oweMerchantlist"); | |||
| if (null == wxBillAll) { | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| wxBillAll.setTenantId(getTenantId()); | |||
| Map<String, Object> result = wxBillAllService.getOweBillAsPage(wxBillAll, pageNum, pageSize); | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("导出欠缴商户列表") | |||
| @GetMapping("/exportOweMerchantlist") | |||
| @SystemControllerLog(description = "费用收缴数据-欠缴商户列表-导出") | |||
| public void exportOweMerchantlist(@ModelAttribute WxBillAll wxBillAll, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::exportOweMerchantlist"); | |||
| if (null == wxBillAll){ | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| wxBillAll.setTenantId(getTenantId()); | |||
| wxBillAllService.exportOweMerchant(wxBillAll, request, response); | |||
| } | |||
| } | |||
| @@ -47,7 +47,7 @@ public class WxBillDailyController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::add"); | |||
| wxBillDaily.setTenantId(getTenantId()); | |||
| wxBillDaily.setUserId(getUser().getId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillDailyController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | |||
| wxBillDaily.setUserId(getUser().getId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -46,7 +46,7 @@ public class WxBillDepositController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::add"); | |||
| wxBillDeposit.setTenantId(getTenantId()); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxBillDepositController extends BaseController { | |||
| @SystemControllerLog(description = "租赁押金-更新") | |||
| public ResultData update(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::update"); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit); | |||
| return wxBillDepositService.saveOrUpdate(wxBillDeposit, getUser()); | |||
| } | |||
| @@ -87,7 +87,7 @@ public class WxBillDepositController extends BaseController { | |||
| @SystemControllerLog(description = "租赁押金-退回押金") | |||
| public ResultData returnDeposit(@RequestBody WxBillDeposit wxBillDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDepositController::returnDeposit"); | |||
| return wxBillDepositService.returnDeposit(wxBillDeposit); | |||
| return wxBillDepositService.returnDeposit(wxBillDeposit, getUser()); | |||
| } | |||
| @@ -47,7 +47,7 @@ public class WxBillOtherController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::add"); | |||
| wxBillOther.setTenantId(getTenantId()); | |||
| wxBillOther.setUserId(getUser().getId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillOtherController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | |||
| wxBillOther.setUserId(getUser().getId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -75,6 +75,11 @@ public class WxBillOtherController extends BaseController { | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillOtherService.getById(id)); | |||
| } | |||
| /** | |||
| * 结单 | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @GetMapping("/updatePaid") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "其它账单-支付更新") | |||
| @@ -47,7 +47,7 @@ public class WxBillOtherDepositController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::add"); | |||
| wxBillOtherDeposit.setTenantId(getTenantId()); | |||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @@ -55,7 +55,7 @@ public class WxBillOtherDepositController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::update"); | |||
| wxBillOtherDeposit.setUserId(getUser().getId()); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -47,7 +47,7 @@ public class WxBillPropertyController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::add"); | |||
| wxBillProperty.setTenantId(getTenantId()); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,7 +55,7 @@ public class WxBillPropertyController extends BaseController { | |||
| @SystemControllerLog(description = "物业账单-更新") | |||
| public ResultData update(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::update"); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty); | |||
| wxBillPropertyService.saveOrUpdate(wxBillProperty, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -103,4 +103,13 @@ public class WxBillPropertyController extends BaseController { | |||
| final PageInfo<Map<String, Object>> page = wxBillPropertyService.findByPropertyContractId(propertyContractId, getTenantId(), pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("updateLatePayStatus") | |||
| @SystemControllerLog(description = "租赁账单-滞纳金结单") | |||
| public ResultData updateLatePayStatus(@RequestBody WxBillProperty wxBillProperty) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyController::updateLatePayStatus"); | |||
| return wxBillPropertyService.updateLatePayStatus(wxBillProperty); | |||
| } | |||
| } | |||
| @@ -4,7 +4,6 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillOtherDeposit; | |||
| import com.iformall.domain.po.WxBillPropertyDeposit; | |||
| import com.iformall.service.WxBillPropertyDepositService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -47,7 +46,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::add"); | |||
| wxBillPropertyDeposit.setTenantId(getTenantId()); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); | |||
| return new ResultData(); | |||
| } | |||
| @@ -55,7 +54,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| @SystemControllerLog(description = "物业押金账单-更新") | |||
| public ResultData update(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::update"); | |||
| return wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit); | |||
| return wxBillPropertyDepositService.saveOrUpdate(wxBillPropertyDeposit, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -87,7 +86,7 @@ public class WxBillPropertyDepositController extends BaseController { | |||
| @SystemControllerLog(description = "物业押金账单-退回押金") | |||
| public ResultData returnDeposit(@RequestBody WxBillPropertyDeposit wxBillPropertyDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillPropertyDepositController::returnDeposit"); | |||
| return wxBillPropertyDepositService.returnDeposit(wxBillPropertyDeposit); | |||
| return wxBillPropertyDepositService.returnDeposit(wxBillPropertyDeposit, getUser()); | |||
| } | |||
| @@ -47,14 +47,14 @@ public class WxBillRentController extends BaseController { | |||
| public ResultData add(@RequestBody WxBillRent wxBillRent) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::add"); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); | |||
| } | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "租赁押金账单-更新") | |||
| public ResultData update(@RequestBody WxBillRent wxBillRent) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::update"); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return wxBillRentService.saveOrUpdate(wxBillRent, getUser()); | |||
| } | |||
| @GetMapping("/del") | |||
| @@ -110,4 +110,12 @@ public class WxBillRentController extends BaseController { | |||
| return wxBillRentService.updateRevenue(wxBillRent); | |||
| } | |||
| @PostMapping("updateLatePayStatus") | |||
| @SystemControllerLog(description = "租赁账单-滞纳金结单") | |||
| public ResultData updateLatePayStatus(@RequestBody WxBillRent wxBillRent) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillRentController::updateLatePayStatus"); | |||
| return wxBillRentService.updateLatePayStatus(wxBillRent); | |||
| } | |||
| } | |||
| @@ -5,7 +5,9 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBusiness; | |||
| import com.iformall.domain.po.WxSubBusiness; | |||
| import com.iformall.service.WxBusinessService; | |||
| import com.iformall.service.WxSubBusinessService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -27,6 +29,9 @@ public class WxBusinessController extends BaseController { | |||
| @Autowired | |||
| private WxBusinessService wxBusinessService; | |||
| @Autowired | |||
| private WxSubBusinessService wxSubBusinessService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -40,63 +45,22 @@ public class WxBusinessController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("成长值业态列表接口") | |||
| @GetMapping("busListForScore") | |||
| @SystemControllerLog(description = "成长值-业态-列表") | |||
| public ResultData getList() { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||
| WxBusiness wxBusiness = new WxBusiness(); | |||
| final List<WxBusiness> busList = wxBusinessService.getList(wxBusiness); | |||
| // 业态 全部 不返回 | |||
| List<WxBusiness> busList2 = busList.stream().filter(b -> !b.getId().equals(0L)).collect(Collectors.toList()); | |||
| return new ResultData(busList2); | |||
| } | |||
| @ApiOperation("业态全列表接口") | |||
| @GetMapping("allist") | |||
| @GetMapping("listAll") | |||
| @SystemControllerLog(description = "业态-全列表") | |||
| public ResultData getAllList() { | |||
| public ResultData listAll() { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||
| WxBusiness wxBusiness = new WxBusiness(); | |||
| final List<WxBusiness> busList = wxBusinessService.getList(wxBusiness); | |||
| final List<WxBusiness> busList = wxBusinessService.findListAll(); | |||
| return new ResultData(busList); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "业态-新增") | |||
| public ResultData add(@RequestBody WxBusiness wxBusiness) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::add"); | |||
| //Assert.notNull(wxBusiness.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "业态-更新") | |||
| public ResultData update(@RequestBody WxBusiness wxBusiness) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::update"); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "业态-删除") | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::delete"); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "业态-查询") | |||
| public ResultData findById(Integer id) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBusinessService.getById(id)); | |||
| @ApiOperation("子业态表接口") | |||
| @GetMapping("listSub") | |||
| @SystemControllerLog(description = "子业态") | |||
| public ResultData listSub(@ModelAttribute WxSubBusiness wxSubBusiness) { | |||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | |||
| final List<WxSubBusiness> busList = wxSubBusinessService.findList(wxSubBusiness); | |||
| return new ResultData(busList); | |||
| } | |||
| } | |||
| @@ -8,6 +8,8 @@ import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoFilterDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -38,6 +40,7 @@ import java.util.concurrent.TimeUnit; | |||
| import java.util.stream.Collectors; | |||
| import static com.iformall.domain.po.WxCouponOrder.Field.CreateDate_DESC; | |||
| import static com.iformall.ueditor.define.AppInfo.info; | |||
| @RestController | |||
| @RequestMapping("wxCUserBasicInfo") | |||
| @@ -151,7 +154,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| WxCUserBasicInfo baseInfoQ = new WxCUserBasicInfo(); | |||
| baseInfoQ.setPhone(phone); | |||
| baseInfoQ.setTenantId(tenantId); | |||
| return wxCUserBasicInfoService.cntUserList(baseInfoQ); | |||
| return wxCUserBasicInfoService.countUser(baseInfoQ); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @@ -452,4 +455,42 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserBasicInfoService.exportCarPayData(record, request, response); | |||
| } | |||
| @ApiOperation("根据手机号查询接口") | |||
| @GetMapping("/findByPhone") | |||
| @ApiImplicitParam(name = "phone", value = "phone", dataType = "String", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "根据手机号查询接口") | |||
| public ResultData findByPhone(String phone) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::findByPhone"); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoService.findByPhone(getTenantId(),phone); | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| if (wxCUserBasicInfoList != null && wxCUserBasicInfoList.size() > 0) { | |||
| wxCUserBasicInfo = wxCUserBasicInfoList.get(0); | |||
| } | |||
| return new ResultData(wxCUserBasicInfo); | |||
| } | |||
| @ApiOperation("获取会员过滤器") | |||
| @GetMapping("/listFilter") | |||
| public ResultData listFilter() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::listFilter"); | |||
| return new ResultData(wxCUserBasicInfoService.listFilters(getTenantId())); | |||
| } | |||
| @ApiOperation("获取会员过滤器") | |||
| @PostMapping("/countByFilter") | |||
| public ResultData countByFilter(@RequestBody List<WxCUserBasicInfoFilterDto> filterList) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::listFilter"); | |||
| return new ResultData(wxCUserBasicInfoService.countByFilter(getTenantId(),filterList)); | |||
| } | |||
| @ApiOperation("获取会员过滤器") | |||
| @PostMapping("/listByFilter") | |||
| public ResultData listByFilter(@RequestParam List<WxCUserBasicInfoFilterDto> filterList) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::listFilter"); | |||
| return new ResultData(wxCUserBasicInfoService.listByFilter(getTenantId(),filterList)); | |||
| } | |||
| } | |||
| @@ -11,6 +11,7 @@ import java.util.List; | |||
| import java.util.Map; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -224,7 +225,11 @@ public class WxCUserDataController extends BaseController { | |||
| Date endTime = c.getTime();//明天0点 | |||
| c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 | |||
| Date startTime = c.getTime(); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 | |||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.setTenantId(tenantId); | |||
| wxCouponOrder.setStartTime(startTime); | |||
| wxCouponOrder.setEndTime(endTime); | |||
| int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder);//月消费金额 | |||
| c.clear(); | |||
| c.setTime(endTime); | |||
| Date eTime = c.getTime(); | |||
| @@ -1,16 +1,18 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxCouponCar; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.domain.vo.WxCouponCarVo; | |||
| import com.iformall.enums.EnumCarVendor; | |||
| import com.iformall.enums.EnumCouponStatus; | |||
| import com.iformall.enums.EnumETCPCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.ETCPUtil; | |||
| import com.iformall.utils.TJDCarUtil; | |||
| @@ -148,7 +150,13 @@ public class WxCarController extends BaseController { | |||
| // 1期只有一个虚拟商户,可以写在商场配置里 | |||
| businessId = objParams.getString("businessId"); | |||
| } | |||
| String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| if (ret == null) { | |||
| logger.error("quanTemplate failed, 优免券模板未发现"); | |||
| return new ResultData(ErrorCode.ETCP_CMD_FAIL.getCode(), "获取优免券模板异常"); | |||
| @@ -300,6 +308,7 @@ public class WxCarController extends BaseController { | |||
| String version = objParams.getString("version"); | |||
| if (park.getParkingId() == null) { | |||
| // those code is not supported | |||
| /* | |||
| String lat = objParams.getString("lat"); | |||
| String lon = objParams.getString("lon"); | |||
| String radius = objParams.getString("radius"); | |||
| @@ -323,10 +332,18 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| } | |||
| */ | |||
| } | |||
| if (park.getParkingId() != null) { | |||
| String ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| String ret = ""; | |||
| try { | |||
| ret = etcp.parkingStatus(url, merchantNo, merchantKey, version, park.getParkingId()); | |||
| } catch (MallinkException e) { | |||
| logger.error("ETCP failed: " + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == EnumETCPCode.SUCCESS.getCode()) { | |||
| if (retObj.get("data") != null) { | |||
| @@ -36,9 +36,12 @@ public class WxChartDataController extends BaseController { | |||
| }) | |||
| @SystemControllerLog(description = "报表-图表") | |||
| public ResultData queryData(@RequestParam Map<String, String> params) { | |||
| logger.debug("[" + getIpAddr() + "] WxChartDataController::queryData"); | |||
| String chart = params.get("chart"); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); | |||
| params.put("tenantId",super.getTenantId()); | |||
| return wxChartDataService.queryData(params); | |||
| ResultData data = wxChartDataService.queryData(params); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart + " end"); | |||
| return data; | |||
| } | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setStatus(null); | |||
| } | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.UpdateDate_DESC); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -140,6 +140,9 @@ public class WxCouponController extends BaseController { | |||
| if(coupon.getSumSubsidy() == null){ | |||
| coupon.setSumSubsidy(0); | |||
| } | |||
| if(coupon.getSumSubsidy() == null){ | |||
| coupon.setSumSubsidy(0); | |||
| } | |||
| } | |||
| return new ResultData(pageInfo); | |||
| } | |||
| @@ -69,12 +69,8 @@ public class WxCouponInjectController extends BaseController { | |||
| @SystemControllerLog(description = "精准投放-更新") | |||
| public ResultData update(@RequestBody WxCouponInject couponInject) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::update"); | |||
| String[] arys = couponInject.getTags().split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| couponInject.setTags(JSON.toJSONString(arys)); | |||
| couponInject.setTags(JSON.toJSONString(couponInject.getFilterList())); | |||
| wxCouponInjectService.saveOrUpdate(couponInject); | |||
| return new ResultData(); | |||
| } | |||
| @@ -97,11 +93,6 @@ public class WxCouponInjectController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponInjectController::findById"); | |||
| WxCouponInject couponInject = wxCouponInjectService.getById(id); | |||
| if (couponInject != null) { | |||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||
| if (!tagids.isEmpty()) { | |||
| couponInject.setTagsList(wxCUserTagsService.findTagList(getTenantId(), tagids)); | |||
| } | |||
| couponInject.setMsgModel(wxMsgModelService.getById(couponInject.getModelId())); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", couponInject); | |||
| @@ -101,14 +101,14 @@ public class WxCouponOrderController extends BaseController { | |||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| try { | |||
| wxCouponOrder.setStartDate( sdf.parse(startDate)); | |||
| wxCouponOrder.setStartTime( sdf.parse(startDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setStartDate(null); | |||
| wxCouponOrder.setStartTime(null); | |||
| } | |||
| try { | |||
| wxCouponOrder.setEndDate( sdf.parse(endDate)); | |||
| wxCouponOrder.setEndTime( sdf.parse(endDate)); | |||
| } catch (Exception e) { | |||
| wxCouponOrder.setEndDate(null); | |||
| wxCouponOrder.setEndTime(null); | |||
| } | |||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | |||
| wxCouponOrderService.exportData(request, response, wxCouponOrder); | |||
| @@ -0,0 +1,76 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCreditHistory") | |||
| public class WxCreditHistoryController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxCreditHistoryService wxCreditHistoryService; | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||
| final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据商户ID和消费金额获取所增加积分 取data里credit的值") | |||
| @GetMapping("findByMerchantIdAndSpend") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="spend",value="消费金额",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | |||
| return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,getTenantId())); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | |||
| wxCreditHistory.setTenantId(getTenantId()); | |||
| wxCreditHistory.setOperatorId(getUser().getId()); | |||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | |||
| return new ResultData(Result.SUCCESS,"操作成功",credit); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findById"); | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCreditHistoryService.getById(id)); | |||
| } | |||
| /** | |||
| * 根据A端设置的【每自然年末扣除前N年用户积分】规则,扣减用户积分 | |||
| * @return | |||
| */ | |||
| public ResultData clearCreditByYear(){ | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear"); | |||
| wxCreditHistoryService.clearCreditByYear(); | |||
| return new ResultData(Result.SUCCESS); | |||
| } | |||
| } | |||
| @@ -2,18 +2,13 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserTags; | |||
| import com.iformall.domain.po.WxFlowRecord; | |||
| import com.iformall.domain.po.WxMsgRecord; | |||
| import com.iformall.enums.EnumFlowRecordStatus; | |||
| import com.iformall.enums.EnumMsgRecordStatus; | |||
| import com.iformall.service.WxFlowService; | |||
| import com.iformall.service.WxMsgRecordService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.flowable.engine.RuntimeService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -86,6 +81,23 @@ public class WxFlowAbleController extends BaseController { | |||
| return new ResultData(wxFlowService.listAsPage(record,pageNum,pageSize)); | |||
| } | |||
| /** | |||
| * 我的审批列表 | |||
| */ | |||
| @ApiOperation("我的审批列表") | |||
| @GetMapping(value = "/myHandleList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "工作流-我的审批列表") | |||
| public ResultData myHandleList(@ModelAttribute WxFlowRecord record, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::myHandelList"); | |||
| record.setUserId(super.getUser().getId()); | |||
| record.setStatus(EnumFlowRecordStatus.NEW.getCode()); | |||
| return new ResultData(wxFlowService.myHandelList(record,pageNum,pageSize)); | |||
| } | |||
| /** | |||
| * 审批历史 | |||
| @@ -131,7 +143,7 @@ public class WxFlowAbleController extends BaseController { | |||
| @PostMapping(value = "reject") | |||
| @SystemControllerLog(description = "工作流-驳回") | |||
| public ResultData reject(@RequestBody Map<String, Object> params) { | |||
| return wxFlowService.reject(params,super.getUser().getId(),super.getUser().getName(),super.getTenantId()); | |||
| return wxFlowService.reject(params,super.getUser().getId(),super.getUser().getName(),super.getUser().getPhone(),super.getTenantId()); | |||
| } | |||
| @@ -7,11 +7,14 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxLevelConfig; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxProfitSharingReceiverService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.beanutils.BeanUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -154,4 +157,22 @@ public class WxMerchantController extends BaseController { | |||
| return wxMerchantService.updateMerchantLevel(wxMerchant); | |||
| } | |||
| @ApiOperation("查询当前租户下商户名称列表") | |||
| @GetMapping("/name_list") | |||
| @SystemControllerLog(description = "查询当前租户下商户名称列表") | |||
| public ResultData nameList() { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::name_list"); | |||
| return new ResultData(wxMerchantService.findList(getTenantId())); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findMerchantById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| @SystemControllerLog(description = "商户-查询") | |||
| public ResultData findMerchantById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::findMerchantById"); | |||
| WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(id); | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| } | |||
| @@ -1,27 +1,32 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoFilterListDto; | |||
| import com.iformall.domain.po.PushLimit; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMsg; | |||
| import com.iformall.domain.po.msg.WxMsg; | |||
| import com.iformall.domain.po.WxMsgConfig; | |||
| import com.iformall.enums.EnumMsgSend; | |||
| import com.iformall.enums.EnumMsgStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxMsgConfigMapper; | |||
| import com.iformall.service.PushLimitService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxMsgService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.netty.util.internal.StringUtil; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -31,6 +36,7 @@ import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| /** | |||
| * @author gongbiao | |||
| @@ -40,17 +46,9 @@ import java.util.*; | |||
| public class WxMsgController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgService wxMsgService; | |||
| @Autowired | |||
| WxMsgConfigMapper wxMsgConfigMapper; | |||
| @Autowired | |||
| WxCUserTagsService wxCUserTagsService; | |||
| @Autowired | |||
| PushLimitService pushLimitService; | |||
| private WxMsgService wxMsgService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -73,99 +71,10 @@ public class WxMsgController extends BaseController { | |||
| @SystemControllerLog(description = "标签短信-新增") | |||
| public ResultData add(@RequestBody WxMsg wxMsg) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::add"); | |||
| //不是草稿检验疲劳度 | |||
| if (!wxMsg.getStatus().equals(EnumMsgStatus.MSG_STATUS_DRAFT.getCode())) { | |||
| if (wxMsg.getIsright().equals(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode())) { | |||
| try { | |||
| pushLimitService.checkSendTime(getTenantId()); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } | |||
| } else { | |||
| PushLimit pushLimit = pushLimitService.getPushLimit(getTenantId()); | |||
| String sendtime = wxMsg.getSendtime(); | |||
| Date date = DateUtils.stringToDate(sendtime, "yyyy-MM-dd HH:mm:ss"); | |||
| boolean isInDate = DateUtils.isInDate(date, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); | |||
| if (!isInDate) { | |||
| return new ResultData(ErrorCode.PUSH_LIMIT_NOT_INRANG); | |||
| } | |||
| } | |||
| if(wxMsg.getId()!=null){ | |||
| //如果不是草稿必然之前状态是草稿,删除 | |||
| wxMsgService.deleteById(wxMsg.getId()); | |||
| wxMsg.setId(null); | |||
| } | |||
| } | |||
| wxMsg.setTenantId(getTenantId()); | |||
| //1、手机多条以逗号分隔,直接通过实体得到wxmsg.getphones | |||
| //2、通过标签 | |||
| String phones = wxMsg.getPhones(); | |||
| String label = wxMsg.getLabel(); | |||
| if (!phones.equals("") && !label.equals("")) {//两种方式只能选其一 | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if (phones.equals("")) {//没有手工输入手机号时解析标签,有,继续流转 | |||
| phones = parselabel(wxMsg.getTenantId(), wxMsg); | |||
| if (phones.equals("")) {//解析之后手机号依然不存在时返回 | |||
| return new ResultData(ErrorCode.MSG_NO_VALID_PHONE); | |||
| } | |||
| } | |||
| //保证手机号惟一 | |||
| String[] phoneSplit = phones.split(","); | |||
| Set<String> phoneSet = new HashSet<>(); | |||
| for (String phone : phoneSplit) { | |||
| phoneSet.add(phone); | |||
| } | |||
| wxMsg.setExpectSendNumber(phoneSet.size());//预计发送数量 | |||
| StringBuffer sb = new StringBuffer(); | |||
| for (String phone : phoneSet) { | |||
| sb.append(phone).append(","); | |||
| } | |||
| wxMsg.setPhones(sb.deleteCharAt(sb.length() - 1).toString()); | |||
| //从短信配置中查询密钥 bid 等信息 | |||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | |||
| wxMsgConfig.setTenantId(wxMsg.getTenantId()); | |||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | |||
| if (wxMsgConfigs.size() == 0) return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND, "您还未接入短信运营商,请联系平台管理员"); | |||
| wxMsgConfig = wxMsgConfigs.get(0); | |||
| if (wxMsgConfig.getRemains() == 0) { | |||
| logger.info("短信数量为0"); | |||
| return new ResultData(ErrorCode.MSG_SUM_ZERO); | |||
| } | |||
| if (wxMsgConfig.getRemains() < wxMsg.getExpectSendNumber()) { | |||
| logger.info("短信数量不足"); | |||
| return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT); | |||
| } | |||
| wxMsgService.saveOrUpdate(wxMsg, wxMsgConfig); | |||
| return new ResultData(); | |||
| return wxMsgService.add(wxMsg); | |||
| } | |||
| private String parselabel(String tenantId, WxMsg wxmsg) { | |||
| String label = wxmsg.getLabel(); | |||
| String[] arys = label.split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| List<WxCUserBasicInfo> list = wxCUserTagsService.findByTag(tenantId, tagids); | |||
| StringBuilder sb = new StringBuilder(); | |||
| if (list.size() > 0) { | |||
| for (WxCUserBasicInfo cUserInfo : list) { | |||
| sb.append(cUserInfo.getPhone()).append(","); | |||
| } | |||
| return sb.toString(); | |||
| } | |||
| return ""; | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @@ -184,15 +93,6 @@ public class WxMsgController extends BaseController { | |||
| public ResultData findById(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgController::findById"); | |||
| WxMsg wxMsg = wxMsgService.getById(id); | |||
| String label = wxMsg.getLabel(); | |||
| if (label != null && !label.isEmpty()) { | |||
| String[] arys = label.split(","); | |||
| List<Long> tagids = new ArrayList<>(); | |||
| for (int i = 0; i < arys.length; i++) { | |||
| tagids.add(Long.parseLong(arys[i])); | |||
| } | |||
| wxMsg.setTagsList(wxCUserTagsService.findTagList(getTenantId(), tagids)); | |||
| } | |||
| return new ResultData(wxMsg); | |||
| } | |||
| @@ -2,20 +2,21 @@ package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.msg.MailMsg; | |||
| import com.iformall.domain.po.msg.SmartAppMsg; | |||
| import com.iformall.domain.po.msg.WxMsg; | |||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxMsgMapper; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.MsgSendService; | |||
| import com.iformall.service.WxMsgRecordService; | |||
| import com.iformall.service.impl.SendCallBackSmsServiceImpl; | |||
| import com.iformall.service.msg.impl.SendCallBackSmsServiceImpl; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.JsonUtil; | |||
| import io.swagger.annotations.Api; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @@ -37,26 +38,26 @@ public class WxMsgRecordController extends BaseController { | |||
| @GetMapping(value = "/test") | |||
| public ResultData test(Long id) throws Exception{ | |||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd HH:00:00"); | |||
| WxMsg wxMsg = new WxMsg(); | |||
| wxMsg.setIsright(0); | |||
| wxMsg.setSendtime(systemTime); | |||
| wxMsg.setId(id); | |||
| List<WxMsg> list = wxMsgMapper.findList(wxMsg); | |||
| logger.info("将要发送的短信列表:" + JSONArray.toJSONString(list)); | |||
| for (WxMsg msg : list) { | |||
| //sendmsg(msg); | |||
| msg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| msg.setReceiver(msg.getPhones()); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),null); | |||
| } | |||
| // String systemTime = DateUtils.getSystemTime("yyyy-MM-dd HH:00:00"); | |||
| // WxMsg wxMsg = new WxMsg(); | |||
| // wxMsg.setIsright(0); | |||
| // wxMsg.setSendtime(systemTime); | |||
| // wxMsg.setId(id); | |||
| // List<WxMsg> list = wxMsgMapper.findList(wxMsg); | |||
| // logger.info("将要发送的短信列表:" + JSONArray.toJSONString(list)); | |||
| // for (WxMsg msg : list) { | |||
| // //sendmsg(msg); | |||
| // msg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| // msg.setReceiver(msg.getPhones()); | |||
| // mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),null); | |||
| // } | |||
| // String s = "{\"tenantId\":\"456\",\"uuid\":\"0a410e4e-c0ef-461e-bea8-7bd222e7c7b7\",\"delayTimeLevel\":0,\"id\":270060355273621504,\"modelId\":220401934081720320,\"msg\":\"狂欢双十一:更多礼品等你来领取\",\"sendtime\":\"2019-03-25 16:00:00\",\"createtime\":\"2019-03-25 15:30:16\",\"expectSendNumber\":1,\"phones\":\"18601973448\",\"signature\":\"富茂科技\",\"isright\":0,\"name\":\"狂欢双十一\",\"excelpath\":\"\",\"label\":\"\",\"status\":0,\"way\":1}"; | |||
| // WxMsg wxMsg = (WxMsg) JsonUtil.readValue(s,WxMsg.class); | |||
| // wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| // wxMsg.setReceiver("18601973448"); | |||
| // wxMsg.setTenantId("456"); | |||
| // msgSendService.send(wxMsg); | |||
| String s = "{\"msg\": \"新手妈妈不要怕,金宝贝帮您带孩子,音乐美术还有游戏,孩子玩着玩着就长大了\", \"way\": 2, \"name\": \"亲子活动\", \"uuid\": \"0a4ae632-9522-4a8f-bb0d-b22620ac79c3\", \"label\": \"\", \"domain\": 0, \"phones\": \"18601973448\", \"status\": 1, \"isright\": 1, \"modelId\": 204500584231862272, \"msgType\": 2, \"receiver\": \"18601973448\", \"sendtime\": \"2019-04-17 18:29:08\", \"tenantId\": \"456\", \"signature\": \"富茂科技\", \"errorNumber\": 0, \"wxMsgConfig\": {\"id\": 1, \"bid\": \"465565\", \"appid\": \"wx9ff823abeef23b94\", \"total\": 100000, \"secret\": \"7305150347587283553aa8898e7dbf20\", \"account\": \"15626593768\", \"remains\": 62667, \"recharge\": 0, \"tenantId\": \"456\", \"notifyurl\": \"http://202.165.179.86:9000/wxMsgCallback/receivemsg/456\", \"publickey\": \"MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvh8j/zagfxQdnSh5OIic\\r\\nMzN+MuRuWQJPjgu4Gza4+gX3j5Ln2xNDBOTjpwyuLBjh/JcBd1cGO3lAaKCwcaix\\r\\nsmhTq56wVXXUMgDiAChu4ud8FSvRc8G8tdZAirKVAIi3NW+/pYgpWBs/0wnF8hz4\\r\\n8no4pyJHl9Jc1LH3VNIMz8vqzKUPc4ack4pFUXlcNj6C+sBlaurmI4/vwLqNxBGs\\r\\n7/zyM7dv6oy3DSU/Y1qBArM1YPjfL2dNun8rmtPgJvlPwXqA7uoHPwQ2Ym3aUn59\\r\\npkS7QI6IE8uuqNkfSte8BXLd2nIqPLFxLYLDmdll7eoyRblHcHqAYSj8stK6StC7\\r\\nDNryNKEjTEwbgf9trUI0uvF1pfgTy2gpclnY69FtD/m0+FvLyorMq+nmBqYMjka5\\r\\nK0txDQJPOa7gsi//uXd/cJW2SAXY9MSO1AfMi8Xq/YKRQzN9FW5iapskXFHca7uX\\r\\ng5NhH7flr6DW+QInFlpoN6WIEAuDF1aj4O49Ikm3WxwhTqnvEkdSCfivpYQkp9Sh\\r\\n4kQ/SQdxuT7VX+Nz6k+uMx2z4cySk33bHi0KoHbA9QFGg/54Qd0+eU4qZnd4mrgh\\r\\nhH7/QQhL7Z9eF1U5UPrsHq2Vq3rEnN+tYQ26AuKeU8vzTxBrC/SxC6C/SMFt3f/Y\\r\\nnuFh1UnNJZleZwyQt+ZdGO0CAwEAAQ==\", \"modelnotifyurl\": \"http://202.165.179.86:9000/wxMsgCallback/receivemodel/456\", \"reminderstatus\": 0, \"verifynotifyurl\": \"http://202.165.179.86:9000/wxMsgCallback/receiveverifymodel/456\"}, \"couponInject\": {\"id\": 278440211602472960, \"name\": \"END\", \"tags\": \"[{\\\"name\\\":\\\"一天以上+普通会员+男\\\",\\\"tagList\\\":[{\\\"id\\\":1011,\\\"typeId\\\":50},{\\\"id\\\":0,\\\"typeId\\\":51},{\\\"id\\\":1}]},{\\\"name\\\":\\\"一月以上+男\\\",\\\"tagList\\\":[{\\\"id\\\":1009,\\\"typeId\\\":50},{\\\"id\\\":1}]}]\", \"status\": 2, \"mUserId\": 204398756307664896, \"modelId\": 204500584231862272, \"muserId\": 204398756307664896, \"couponId\": 275856462247362560, \"sendTime\": \"2019-04-17 18:28:49\", \"sendType\": 0, \"tenantId\": \"456\", \"couponName\": \"礼品券大礼5\", \"filterList\": [{\"name\": \"一天以上+普通会员+男\", \"tagList\": [{\"id\": 1011, \"typeId\": 50}, {\"id\": 0, \"typeId\": 51}, {\"id\": 1}]}, {\"name\": \"一月以上+男\", \"tagList\": [{\"id\": 1009, \"typeId\": 50}, {\"id\": 1}]}], \"sendAmount\": 40}, \"successNumber\": 0, \"delayTimeLevel\": 0, \"expectSendNumber\": 40}"; | |||
| WxMsg wxMsg = (WxMsg) JsonUtil.readValue(s,WxMsg.class); | |||
| wxMsg.setMsgType(EnumMsgRecordType.SMS_CALLBACK.getCode()); | |||
| wxMsg.setReceiver("18601973448"); | |||
| wxMsg.setTenantId("456"); | |||
| msgSendService.send(wxMsg); | |||
| return new ResultData(); | |||
| } | |||
| @@ -1,22 +1,31 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.domain.vo.WxOrderQueryVo; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.vo.WxOrderQueryVo; | |||
| import com.iformall.enums.EnumCouponChannelStatus; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxCUserService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxOrderService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -24,9 +33,15 @@ import java.util.Map; | |||
| public class WxOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -112,5 +127,111 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(data); | |||
| } | |||
| @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") | |||
| @PostMapping("save") | |||
| public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("OrderSave: " + paramMap.toString()); | |||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| String couponChannelIdStr = paramMap.get("couponChannelId"); | |||
| String couponIdStr = paramMap.get("couponId"); | |||
| String pressStr = paramMap.get("press"); | |||
| String orderGroupIdStr = paramMap.get("orderGroupId"); | |||
| String formId = paramMap.get("formId"); | |||
| //被操作人的ID | |||
| String userIdStr = paramMap.get("userId"); | |||
| Long userId = 0L; | |||
| if (StringUtils.isNotBlank(userIdStr)) { | |||
| userId = Long.valueOf(userIdStr); | |||
| } | |||
| WxCUser wxCUser = wxCUserService.getById(userId); | |||
| if (wxCUser == null) { | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||
| } | |||
| if (StringUtils.isBlank(couponChannelIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); | |||
| } | |||
| Long couponChannelId = 0L, couponId = 0L, orderGroupId = null; | |||
| boolean isPress = false; | |||
| if (StringUtils.isNotBlank(couponChannelIdStr)) { | |||
| try { | |||
| couponChannelId = Long.valueOf(couponChannelIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("couponChannelId convert error, " + couponChannelIdStr + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponChannelId: " + couponChannelIdStr + ", e:" + e.getMessage()); | |||
| } | |||
| WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId); | |||
| if (wxCouponChannel == null) { | |||
| logger.error("couponChannelId convert error, " + couponChannelIdStr); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| if (wxCouponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { | |||
| Date now = new Date(); | |||
| if (wxCouponChannel.getBeginTime().getTime() > now.getTime()) { | |||
| logger.error("此券活动未开始:" + couponChannelIdStr); | |||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_NOT_STARTED); | |||
| } | |||
| if (wxCouponChannel.getEndTime().getTime() < now.getTime()) { | |||
| logger.error("此券活动已结束:" + couponChannelIdStr); | |||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_END); | |||
| } | |||
| } | |||
| if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { | |||
| logger.error("此券已下架:" + couponChannelIdStr); | |||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); | |||
| } | |||
| if (StringUtils.isBlank(couponIdStr)) { | |||
| couponId = wxCouponChannel.getCouponId(); | |||
| } | |||
| } | |||
| if (couponId <= 0 && !StringUtils.isBlank(couponIdStr)) { | |||
| try { | |||
| couponId = Long.valueOf(couponIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("couponId convert error, " + couponIdStr + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); | |||
| } | |||
| } | |||
| if (couponId <= 0) { | |||
| logger.error("couponChannelId或者couponId不能为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId或者couponId不能为空"); | |||
| } | |||
| if(pressStr != null) { | |||
| try{ | |||
| isPress = Boolean.valueOf(pressStr); | |||
| } catch (Exception e) { | |||
| logger.error("press转换失败"); | |||
| } | |||
| } | |||
| if (orderGroupIdStr != null) { | |||
| try { | |||
| orderGroupId = Long.valueOf(orderGroupIdStr); | |||
| } catch (Exception e) { | |||
| logger.error("orderGroupId转换失败"); | |||
| } | |||
| } | |||
| //用于标记当前操作人为A端用户 | |||
| wxCUser.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| wxCUser.setOperatorId(getUser().getId()); | |||
| try { | |||
| WxOrder order = wxOrderService.saveCouponOrder(wxCUser, couponChannelId, couponId, isPress, orderGroupId, formId); | |||
| return new ResultData(order); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.ORDER_IS_FAIL, e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,22 +1,26 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxProfitSharingOrderService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxOrder; | |||
| import com.iformall.domain.po.WxPayOrder; | |||
| import com.iformall.enums.EnumPayStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxOrderService; | |||
| import com.iformall.service.WxPayOrderService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxPayOrder") | |||
| @@ -24,14 +28,10 @@ public class WxPayOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @Autowired | |||
| private WxProfitSharingOrderService xProfitSharingOrderService; | |||
| private WxOrderService wxOrderService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| private WxPayOrderService wxPayOrderService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -84,4 +84,70 @@ public class WxPayOrderController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxPayOrderController::findById"); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxPayOrderService.getById(id)); | |||
| } | |||
| @ApiOperation(value = "更新支付订单状态", notes = "{\"payOrderId\":\"string\",\"orderId\":\"string\",\"status\":integer,\"reason\":\"string\"}") | |||
| @PostMapping("/updatePayOrder") | |||
| public ResultData updatePayOrder(@RequestBody Map<String, Object> paramMap) { | |||
| logger.info("/api/pay/updatePayOrder" + paramMap.toString()); | |||
| String payOrderIdStr = (String) paramMap.get("payOrderId"); | |||
| String orderIdStr = (String) paramMap.get("orderId"); | |||
| String reasonStr = (String) paramMap.get("reason"); | |||
| Integer status = (Integer) paramMap.get("status"); | |||
| if (StringUtils.isBlank(orderIdStr)) { | |||
| logger.info("orderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| } | |||
| Long payOrderId = 0L, orderId = 0L; | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||
| } | |||
| if (!StringUtils.isBlank(payOrderIdStr)) { | |||
| try { | |||
| payOrderId = Long.valueOf(payOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "payOrderId参数不正确"); | |||
| } | |||
| } | |||
| WxPayOrder payOrder = new WxPayOrder(); | |||
| payOrder.setId(payOrderId); | |||
| payOrder.setOrderId(orderId); | |||
| payOrder.setPayOrderStatus(status); | |||
| payOrder.setFailReason(reasonStr); | |||
| WxOrder order = null; | |||
| try { | |||
| if(status.equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()) && !payOrderIdStr.equals("0")) { | |||
| // 前端提示支付成功, 不作为支付成功标志,只检查支付订单状态 | |||
| // 有价券不走update, callback更新 | |||
| payOrder = wxPayOrderService.getById(payOrderId); | |||
| if(payOrder.getPayOrderStatus().equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())) { | |||
| order = wxOrderService.getById(orderId); | |||
| return new ResultData(Result.SUCCESS, "支付状态更新成功", order); | |||
| } else { | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付未状态,请等待!!"); | |||
| } | |||
| } else { | |||
| // 1. 免费券,status = 1,成功 | |||
| // 2. 有价券,status = 2,取消支付 | |||
| if(status.equals(EnumPayStatus.PAY_STATUS_SUCCESS.getCode())) { | |||
| wxPayOrderService.handlePayOrderStatusUpdate(payOrder, 1); | |||
| } else if (status.equals(EnumPayStatus.PAY_STATUS_FAIL.getCode())) { | |||
| wxPayOrderService.handlePayOrderStatusUpdate(payOrder, 2); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS, "支付状态更新成功"); | |||
| } catch (MallinkException e) { | |||
| logger.error("支付状态更新失败2: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,14 +1,18 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBillRent; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.po.WxRentContract; | |||
| import com.iformall.service.WxBillRentService; | |||
| import com.iformall.service.WxPayAccountBillService; | |||
| import com.iformall.service.WxRentContractService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| /** | |||
| @@ -31,6 +36,9 @@ public class WxRentContractController extends BaseController { | |||
| @Autowired | |||
| private WxBillRentService wxBillRentService; | |||
| @Autowired | |||
| private WxPayAccountBillService payAccountBillService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @@ -156,4 +164,44 @@ public class WxRentContractController extends BaseController { | |||
| return wxRentContractService.updateRentContractStatus(id); | |||
| } | |||
| @GetMapping("getPayAccountInfo") | |||
| @SystemControllerLog(description = "租赁合同-获取甲方账户") | |||
| public ResultData getPayAccountInfo() { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | |||
| String tenantId = getTenantId(); | |||
| WxPayAccountBill payAccountBill = payAccountBillService.getByTenantId(tenantId); | |||
| Map<String, String> map = new HashMap<>(); | |||
| if(StringUtils.isNotBlank(payAccountBill.getBankAccountName()) && StringUtils.isNotBlank(payAccountBill.getBankCardId())) { | |||
| map.put("bankAccountName", payAccountBill.getBankAccountName()); | |||
| map.put("bankCardId", payAccountBill.getBankCardId()); | |||
| } | |||
| return new ResultData(map); | |||
| } | |||
| @PostMapping("savePayAccountInfo") | |||
| @SystemControllerLog(description = "租赁合同-保存甲方账户") | |||
| public ResultData savePayAccountInfo(@RequestBody WxPayAccountBill payAccountBill) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | |||
| if(StringUtils.isBlank(payAccountBill.getBankAccountName())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "甲方银行账户名未填写"); | |||
| } | |||
| if(StringUtils.isBlank(payAccountBill.getBankCardId())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "甲方银行账户卡号未填写"); | |||
| } | |||
| String tenantId = getTenantId(); | |||
| WxPayAccountBill payAccountBillNew = payAccountBillService.getByTenantId(tenantId); | |||
| payAccountBillNew.setBankAccountName(payAccountBill.getBankAccountName()); | |||
| payAccountBillNew.setBankCardId(payAccountBill.getBankCardId()); | |||
| payAccountBillService.saveOrUpdate(payAccountBillNew); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/getMerchants") | |||
| @SystemControllerLog(description = "租赁合同-获取已签约租赁合同且未有物业的商户") | |||
| public ResultData getMerchants(@ModelAttribute WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::getMerchants"); | |||
| wxRentContract.setTenantId(getTenantId()); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.getMerchants(wxRentContract)); | |||
| } | |||
| } | |||
| @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxScoreRules") | |||
| @Api(description = "成长值规则相关接口") | |||
| @Api(description = "成长值积分规则相关接口") | |||
| public class WxScoreRulesController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @@ -35,11 +35,20 @@ public class WxScoreRulesController extends BaseController { | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "成长值-配置-新增") | |||
| @SystemControllerLog(description = "成长值-积分-配置-新增") | |||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | |||
| wxScoreRules.setTenantId(getTenantId()); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("积分配置") | |||
| @GetMapping("/credit_rules") | |||
| @SystemControllerLog(description = "积分-配置") | |||
| public ResultData creditRulesList() { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantId()); | |||
| return new ResultData(scoreRules); | |||
| } | |||
| } | |||
| @@ -4,13 +4,11 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxShop; | |||
| import com.iformall.service.WxShopService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -72,8 +70,8 @@ public class WxShopController extends BaseController { | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::delete"); | |||
| wxShopService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| Integer isAdmin = getUser().getIsAdmin(); | |||
| return wxShopService.deleteById(id, isAdmin); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @@ -146,7 +144,17 @@ public class WxShopController extends BaseController { | |||
| wxShopService.exportShop(wxShop, request, response); | |||
| } | |||
| @ApiOperation("导出未出租店铺") | |||
| @GetMapping("/exportNotRentShop") | |||
| @SystemControllerLog(description = "商铺出租数据-未出租商铺列表-导出") | |||
| public void exportNotRentShop(@ModelAttribute WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { | |||
| logger.debug("[" + getIpAddr() + "] WxShopController::exportNotRentShop"); | |||
| if (null == wxShop){ | |||
| wxShop = new WxShop(); | |||
| } | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShop.setSortColumns(WxShop.Field.Id_DESC); | |||
| wxShopService.exportNotRentShop(wxShop, request, response); | |||
| } | |||
| } | |||
| @@ -37,11 +37,6 @@ public class WxTagsController extends BaseController { | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxTagsGroupService wxTagsGroupService; | |||
| @Autowired | |||
| private WxTagsTypeService wxTagsTypeService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| @@ -50,42 +45,7 @@ public class WxTagsController extends BaseController { | |||
| @ApiOperation("标签弹窗接口") | |||
| public ResultData getAllList() { | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::getAllList"); | |||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||
| for(WxTagsGroup tg:groups) { | |||
| WxTagsGroupVo tgvo =new WxTagsGroupVo(); | |||
| tgvo.setId(tg.getId()); | |||
| tgvo.setName(tg.getName()); | |||
| WxTagsType type = new WxTagsType(); | |||
| type.setGroupId(tg.getId()); | |||
| List<WxTagsTypeVo> typeVos =new ArrayList<>(); | |||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||
| for(WxTagsType tt:types) { | |||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||
| ttvo.setId(tt.getId()); | |||
| ttvo.setName(tt.getName()); | |||
| ttvo.setFlag(tt.getFlag()); | |||
| ttvo.setGroupId(tg.getId()); | |||
| ttvo.setGroupName(tg.getName()); | |||
| WxTags t = new WxTags(); | |||
| t.setTypeId(tt.getId()); | |||
| ttvo.setTags(wxTagsService.findList(t)); | |||
| typeVos.add(ttvo); | |||
| } | |||
| tgvo.setTypes(typeVos); | |||
| groupVos.add(tgvo); | |||
| } | |||
| return new ResultData(groupVos); | |||
| } | |||
| @ApiOperation("查询微信用户人群") | |||
| @GetMapping("findCUserCountByTag") | |||
| @SystemControllerLog(description = "会员管理-查询微信用户人群") | |||
| public Result findCUserCountByTag(Long[] tagIds) { | |||
| logger.debug("[" + getIpAddr() + "] WxTagsController::findCUserCountByTag"); | |||
| return new ResultData(wxCUserTagsService.findTagListFromCUser(getTenantId(), Arrays.asList(tagIds))); | |||
| return new ResultData(wxTagsService.listAllVo()); | |||
| } | |||
| @ApiOperation("查询会员用户人群") | |||
| @@ -0,0 +1,62 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumWxTopicStatus; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| @RestController | |||
| @RequestMapping("topic") | |||
| @Api(description = "专题相关接口") | |||
| public class WxTopicController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxTopicService wxTopicService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(WxTopic wxTopic, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxTopicController::list"); | |||
| String tenantId = getTenantId(); | |||
| wxTopic.setTenantId(tenantId); | |||
| PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); | |||
| //设置正在上架的专题 | |||
| Date now = new Date(); | |||
| page.getList().stream().forEach(cc->{ | |||
| if (cc.getStatus().equals(EnumWxTopicStatus.VAILD.getCode()) && cc.getEndTime()!=null && cc.getBeginTime()!=null && now.getTime() >= cc.getBeginTime().getTime() && now.getTime() <= cc.getEndTime().getTime()) { | |||
| cc.setIsOnline(1); | |||
| } | |||
| }); | |||
| return new ResultData(page); | |||
| } | |||
| @GetMapping("findById") | |||
| public ResultData findById(WxTopic wxTopic) { | |||
| logger.debug("[" + getIpAddr() + "] WxTopicController::findById"); | |||
| String tenantId = getTenantId(); | |||
| wxTopic.setTenantId(tenantId); | |||
| WxTopic queryTopic = wxTopicService.findById(wxTopic); | |||
| return new ResultData(queryTopic); | |||
| } | |||
| @PostMapping("saveOrUpdate") | |||
| public ResultData saveOrUpdate(@RequestBody WxTopic wxTopic) { | |||
| logger.debug("[" + getIpAddr() + "] WxTopicController::saveOrUpdate"); | |||
| wxTopic.setTenantId(super.getTenantId()); | |||
| return wxTopicService.saveOrUpdate(wxTopic); | |||
| } | |||
| } | |||
| @@ -134,7 +134,7 @@ public class WxUserStructureController extends BaseController { | |||
| WxLevelConfig other = new WxLevelConfig(); | |||
| //没有等级的会员 | |||
| other.setLevel("无"); | |||
| other.setLevel(WxLevelConfigService.DEFAULT_LEVEL); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| other.setCount(wxCUserBasicInfoService.findCount(dto) | |||
| - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); | |||
| @@ -3,10 +3,9 @@ package com.iformall.interceptor; | |||
| import javax.servlet.ReadListener; | |||
| import javax.servlet.ServletInputStream; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletRequestWrapper; | |||
| import java.io.*; | |||
| public class BodyReaderHttpServletRequestWrapper extends HttpServletRequestWrapper { | |||
| public class BodyReaderHttpServletRequestWrapper extends XssHttpServletRequestWrapper { | |||
| private final String body; | |||
| public BodyReaderHttpServletRequestWrapper(HttpServletRequest request) throws IOException { | |||
| @@ -1,12 +1,20 @@ | |||
| package com.iformall.interceptor; | |||
| import com.iformall.utils.UrlCheck; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import javax.servlet.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.IOException; | |||
| import java.util.Arrays; | |||
| public class HttpServletRequestWrapperFilter implements Filter { | |||
| private static final Logger logger = LoggerFactory.getLogger(HttpServletRequestWrapperFilter.class); | |||
| // 多个跨域域名设置 | |||
| // public static final String[] ALLOW_DOMAIN = {"https://admin.malls.iformall.com"}; | |||
| @Override | |||
| public void init(FilterConfig filterConfig) throws ServletException { | |||
| @@ -17,6 +25,31 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||
| throws IOException, ServletException { | |||
| ServletRequest requestWrapper = null; | |||
| /* // 跨域访问 | |||
| HttpServletRequest req = (HttpServletRequest) request; | |||
| HttpServletResponse res = (HttpServletResponse) response; | |||
| String originHeader = req.getHeader("Origin"); | |||
| if (Arrays.asList(ALLOW_DOMAIN).contains(originHeader)) { | |||
| //通过在响应 header 中设置 ‘*’ 来允许来自所有域的跨域请求访问。 | |||
| res.setHeader("Access-Control-Allow-Origin", originHeader); | |||
| //通过对 Credentials 参数的设置,就可以保持跨域 Ajax 时的 Cookie | |||
| //设置了Allow-Credentials,Allow-Origin就不能为*,需要指明具体的url域 | |||
| res.setHeader("Access-Control-Allow-Credentials", "true"); | |||
| //请求方式 | |||
| res.setHeader("Access-Control-Allow-Methods", "*"); | |||
| //(预检请求)的返回结果(即 Access-Control-Allow-Methods 和Access-Control-Allow-Headers 提供的信息) 可以被缓存多久 | |||
| res.setHeader("Access-Control-Max-Age", "86400"); | |||
| //首部字段用于预检请求的响应。其指明了实际请求中允许携带的首部字段 | |||
| //res.setHeader("Access-Control-Allow-Headers", "*"); | |||
| res.setHeader("Access-Control-Allow-Headers", | |||
| "Timestamp,Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token,Access-Control-Allow-Headers"); | |||
| } | |||
| */ | |||
| //sql,xss过滤 | |||
| XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper((HttpServletRequest)request); | |||
| if (request instanceof HttpServletRequest) { | |||
| String url = ((HttpServletRequest) request).getRequestURI(); | |||
| if (!UrlCheck.checkUrl(url)) { | |||
| @@ -24,7 +57,7 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||
| } | |||
| } | |||
| if (null == requestWrapper) { | |||
| chain.doFilter(request, response); | |||
| chain.doFilter(xssHttpServletRequestWrapper, response); | |||
| } else { | |||
| chain.doFilter(requestWrapper, response); | |||
| } | |||
| @@ -83,7 +83,7 @@ public class RequestInterceptor extends HandlerInterceptorAdapter { | |||
| sb.append(resultBody); | |||
| String key = "request-" + HashUtil.md5(sb.toString()); | |||
| String key = "request:A:" + HashUtil.md5(sb.toString()); | |||
| Boolean isAbsent = redisTemplate.<Boolean>execute(new RedisCallback<Boolean>() { | |||
| @Override | |||
| public Boolean doInRedis(RedisConnection connection) throws DataAccessException { | |||
| @@ -0,0 +1,122 @@ | |||
| package com.iformall.interceptor; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.util.StringUtils; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletRequestWrapper; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| /** | |||
| * 防止sql注入,xss攻击 | |||
| * 前端可以对输入信息做预处理,后端也可以做处理。 | |||
| */ | |||
| public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { | |||
| private final Logger log = LoggerFactory.getLogger(getClass()); | |||
| private static String key = "and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|;|or|-|+"; | |||
| private static Set<String> notAllowedKeyWords = new HashSet<String>(0); | |||
| private static String replacedString="INVALID"; | |||
| static { | |||
| String keyStr[] = key.split("\\|"); | |||
| for (String str : keyStr) { | |||
| notAllowedKeyWords.add(str); | |||
| } | |||
| } | |||
| private String currentUrl; | |||
| public XssHttpServletRequestWrapper(HttpServletRequest servletRequest) { | |||
| super(servletRequest); | |||
| currentUrl = servletRequest.getRequestURI(); | |||
| } | |||
| /**覆盖getParameter方法,将参数名和参数值都做xss过滤。 | |||
| * 如果需要获得原始的值,则通过super.getParameterValues(name)来获取 | |||
| * getParameterNames,getParameterValues和getParameterMap也可能需要覆盖 | |||
| */ | |||
| @Override | |||
| public String getParameter(String parameter) { | |||
| String value = super.getParameter(parameter); | |||
| if (value == null) { | |||
| return null; | |||
| } | |||
| return cleanXSS(value); | |||
| } | |||
| @Override | |||
| public String[] getParameterValues(String parameter) { | |||
| String[] values = super.getParameterValues(parameter); | |||
| if (values == null) { | |||
| return null; | |||
| } | |||
| int count = values.length; | |||
| String[] encodedValues = new String[count]; | |||
| for (int i = 0; i < count; i++) { | |||
| encodedValues[i] = cleanXSS(values[i]); | |||
| } | |||
| return encodedValues; | |||
| } | |||
| @Override | |||
| public Map<String, String[]> getParameterMap(){ | |||
| Map<String, String[]> values=super.getParameterMap(); | |||
| if (values == null) { | |||
| return null; | |||
| } | |||
| Map<String, String[]> result=new HashMap<>(); | |||
| for(String key:values.keySet()){ | |||
| String encodedKey=cleanXSS(key); | |||
| int count=values.get(key).length; | |||
| String[] encodedValues = new String[count]; | |||
| for (int i = 0; i < count; i++){ | |||
| encodedValues[i]=cleanXSS(values.get(key)[i]); | |||
| } | |||
| result.put(encodedKey,encodedValues); | |||
| } | |||
| return result; | |||
| } | |||
| /** | |||
| * 覆盖getHeader方法,将参数名和参数值都做xss过滤。 | |||
| * 如果需要获得原始的值,则通过super.getHeaders(name)来获取 | |||
| * getHeaderNames 也可能需要覆盖 | |||
| */ | |||
| @Override | |||
| public String getHeader(String name) { | |||
| String value = super.getHeader(name); | |||
| if (value == null) { | |||
| return null; | |||
| } | |||
| return cleanXSS(value); | |||
| } | |||
| private String cleanXSS(String valueP) { | |||
| // You'll need to remove the spaces from the html entities below | |||
| String value = valueP.replaceAll("<", "<").replaceAll(">", ">"); | |||
| value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;"); | |||
| value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;"); | |||
| value = value.replaceAll("'", "& #39;"); | |||
| value = value.replaceAll("eval\\((.*)\\)", ""); | |||
| value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\""); | |||
| value = value.replaceAll("script", ""); | |||
| value = cleanSqlKeyWords(value); | |||
| return value; | |||
| } | |||
| private String cleanSqlKeyWords(String value) { | |||
| String paramValue = value; | |||
| for (String keyword : notAllowedKeyWords) { | |||
| if (paramValue.length() > keyword.length() + 4 | |||
| && (paramValue.contains(" "+keyword)||paramValue.contains(keyword+" ")||paramValue.contains(" "+keyword+" "))) { | |||
| paramValue = StringUtils.replace(paramValue, keyword, replacedString); | |||
| log.error(this.currentUrl + "已被过滤,因为参数中包含不允许sql的关键词(" + keyword | |||
| + ")"+";参数:"+value+";过滤后的参数:"+paramValue); | |||
| } | |||
| } | |||
| return paramValue; | |||
| } | |||
| } | |||
| @@ -36,6 +36,9 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_business".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_sub_business".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_coupon_type".equals(tableName)) { | |||
| return true; | |||
| } | |||
| @@ -76,6 +79,8 @@ public class TenantInfoImpl implements TenantInfo { | |||
| public boolean doMappedStatementFIlter(MappedStatement ms) { | |||
| if ("com.iformall.mapper.MallUserInfoMapper.selectByUserName".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.MallUserInfoMapper.cntByUserName".equals(ms.getId())) | |||
| return true; | |||
| if ("com.iformall.mapper.WxCouponActionLogMapper.getCountByUserAndCoupon".equals(ms.getId())) | |||
| return true; | |||
| return false; | |||
| @@ -7,9 +7,12 @@ public class UrlCheck { | |||
| public static boolean checkUrl(String url) { | |||
| return url.contains("awsFileUpload") | |||
| || url.contains("awsFilesUpload") | |||
| || url.contains("cimgUpload") | |||
| || url.contains("ueditor/exec") | |||
| || url.contains("/wxCUserBasicInfo/importTemplate") | |||
| || url.contains("/wxCUserBasicInfo/countByFilter") | |||
| || url.contains("/wxCUserBasicInfo/listByFilter") | |||
| || url.contains("wxMsgCallback") | |||
| || url.contains("notify") | |||
| || url.contains("pvlog"); | |||
| @@ -22,7 +22,7 @@ spring: | |||
| poolPreparedStatements: true | |||
| maxOpenPreparedStatements: 20 | |||
| connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" | |||
| #jackson: | |||
| #jackson: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| @@ -85,6 +85,25 @@ wechat: | |||
| appId: "wxe31beafbfd8295ba" | |||
| secret: "c689fabf3c4c9f5b6424ff2a36a26727" | |||
| url: "https://mall.youlane.cn" | |||
| open: | |||
| componentAppId: "wx897e4673286c915d" | |||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||
| componentToken: "formall2018" | |||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6379 | |||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 500 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| jasypt: | |||
| encryptor: | |||
| @@ -92,6 +111,8 @@ jasypt: | |||
| fm: | |||
| exception: false | |||
| deploy: 1 | |||
| open: true | |||
| ueditor: | |||
| config: config.json | |||
| @@ -44,13 +44,13 @@ spring: | |||
| password: ENC(APQMO9XQRzMKd0eap+oSSOYH9MQe/r5K0YFF9A9mizU=) # 授权密码 | |||
| properties: | |||
| mail: | |||
| smtp: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| smtp: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -73,9 +73,30 @@ wechat: | |||
| appId: "wx9cc4ca09eb20fe03" | |||
| secret: "af1d7f7a1268022a73cb4ce0b9cf0985" | |||
| url: "https://admin.malls.iformall.com" | |||
| open: | |||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 100 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: true | |||
| deploy: 3 | |||
| open: true | |||
| ueditor: | |||
| config: config.json | |||
| @@ -73,9 +73,30 @@ wechat: | |||
| appId: "wx091907dd0bfd3f6b" | |||
| secret: "2a2ca10738998b9ef92c1fe8a4d366a6" | |||
| url: "https://admintest.malls.iformall.com" | |||
| open: | |||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 100 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: true | |||
| deploy: 2 | |||
| open: true | |||
| ueditor: | |||
| config: config.json | |||
| @@ -0,0 +1,19 @@ | |||
| ALTER TABLE `wx_c_user` | |||
| ADD COLUMN `open_app_id` VARCHAR(18) NULL AFTER `update_date`, | |||
| ADD COLUMN `mp_open_id` VARCHAR(28) NULL AFTER `open_app_id`, | |||
| ADD COLUMN `mp_app_id` VARCHAR(18) NULL AFTER `mp_open_id`, | |||
| ADD COLUMN `mp_subscribe` TINYINT(2) NULL AFTER `mp_app_id`, | |||
| ADD COLUMN `mp_subscribe_time` datetime NULL AFTER `mp_subscribe`, | |||
| ADD COLUMN `mp_subscribe_scene` VARCHAR(20) NULL AFTER `mp_subscribe_time`, | |||
| ADD COLUMN `subs_open_id` VARCHAR(28) NULL AFTER `mp_subscribe_scene`, | |||
| ADD COLUMN `subs_app_id` VARCHAR(18) NULL AFTER `subs_open_id`, | |||
| ADD COLUMN `subs_subscribe` TINYINT(2) NULL AFTER `subs_app_id`, | |||
| ADD COLUMN `subs_subscribe_time` datetime NULL AFTER `subs_subscribe`, | |||
| ADD COLUMN `subs_subscribe_scene` VARCHAR(20) NULL AFTER `subs_subscribe_time`, | |||
| CHANGE COLUMN `open_id` `open_id` VARCHAR(28) NOT NULL COMMENT '微信openId' , | |||
| CHANGE COLUMN `union_id` `union_id` VARCHAR(29) NULL DEFAULT NULL COMMENT '微信unionId' , | |||
| CHANGE COLUMN `phone` `phone` VARCHAR(20) NULL DEFAULT NULL COMMENT '用户绑定的手机号' , | |||
| CHANGE COLUMN `register_ip` `register_ip` VARCHAR(20) NULL DEFAULT NULL COMMENT '用户注册IP' , | |||
| CHANGE COLUMN `app_id` `app_id` VARCHAR(20) NULL DEFAULT NULL COMMENT '小程序的appId' , | |||
| CHANGE COLUMN `latitude` `latitude` DECIMAL(10,5) NULL DEFAULT NULL COMMENT '维度' , | |||
| CHANGE COLUMN `longitude` `longitude` DECIMAL(10,5) NULL DEFAULT NULL COMMENT '经度' ; | |||
| @@ -0,0 +1,3 @@ | |||
| ALTER TABLE `wx_pay_account_bill` | |||
| ADD COLUMN `bank_account_name` VARCHAR(50) NULL COMMENT '银行账户名' AFTER `rate`, | |||
| ADD COLUMN `bank_card_id` VARCHAR(50) NULL COMMENT '银行卡号' AFTER `bank_account_name`; | |||
| @@ -0,0 +1,22 @@ | |||
| ALTER TABLE `wx_bill_rent` | |||
| ADD COLUMN `apply_status` SMALLINT(1) DEFAULT 1 COMMENT '审核状态0未审核1审核中2审核完成3驳回4合同作废5撤回' AFTER `is_preview`; | |||
| ALTER TABLE `wx_bill_property` | |||
| ADD COLUMN `apply_status` SMALLINT(1) DEFAULT 1 COMMENT '审核状态0未审核1审核中2审核完成3驳回4合同作废5撤回' AFTER `is_preview`; | |||
| ALTER TABLE `wx_bill_daily` | |||
| ADD COLUMN `apply_status` SMALLINT(1) DEFAULT 1 COMMENT '审核状态0未审核1审核中2审核完成3驳回4合同作废5撤回'; | |||
| ALTER TABLE `wx_bill_other` | |||
| ADD COLUMN `apply_status` SMALLINT(1) DEFAULT 1 COMMENT '审核状态0未审核1审核中2审核完成3驳回4合同作废5撤回'; | |||
| alter table wx_msg_model modify column content text; | |||
| ALTER TABLE `wx_shop` | |||
| ADD COLUMN `email` varchar(100) DEFAULT NULL COMMENT '邮箱'; | |||
| ALTER TABLE `mall_user_info` | |||
| ADD COLUMN `email` varchar(100) DEFAULT NULL COMMENT '邮箱'; | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `email` varchar(100) DEFAULT NULL COMMENT '邮箱'; | |||
| @@ -0,0 +1,3 @@ | |||
| ALTER TABLE `wx_mall` | |||
| ADD COLUMN `weapp_share_title` VARCHAR (20) NULL COMMENT '分享标题' AFTER `img_qrcode_wemp`, | |||
| ADD COLUMN `weapp_share_cover_img` VARCHAR (100) NULL COMMENT '分享封面图片' AFTER `weapp_share_title`; | |||
| @@ -0,0 +1,19 @@ | |||
| ALTER TABLE `wx_rent_contract` | |||
| ADD COLUMN `file_names` JSON NULL COMMENT '合同支持多文件' AFTER `fix_end_date`; | |||
| update wx_rent_contract set file_names=CONCAT('[{\"filename\":\"',`filename`,'\",\"filepath\":\"',`filepath`,'\"}]') | |||
| where filename is not null or LENGTH(`filename`) >0; | |||
| update wx_rent_contract set file_names=CONCAT('[]') where filename is null or LENGTH(`filename`)=0 ; | |||
| ALTER TABLE `wx_property_contract` | |||
| ADD COLUMN `file_names` JSON NULL COMMENT '合同支持多文件'; | |||
| update wx_property_contract set file_names=CONCAT('[{\"filename\":\"',`filename`,'\",\"filepath\":\"',`filepath`,'\"}]') | |||
| where filename is not null or LENGTH(`filename`) >0; | |||
| update wx_property_contract set file_names=CONCAT('[]') where filename is null or LENGTH(`filename`)=0 ; | |||
| @@ -0,0 +1,17 @@ | |||
| ALTER TABLE `wx_rent_contract` | |||
| ADD COLUMN `rent_info` JSON NULL COMMENT '商铺信息'; | |||
| ALTER TABLE `wx_property_contract` | |||
| ADD COLUMN `rent_info` JSON NULL COMMENT '商铺信息'; | |||
| ALTER TABLE `wx_bill_rent` | |||
| ADD COLUMN `shop_info` JSON NULL COMMENT '商铺信息'; | |||
| ALTER TABLE `wx_bill_rent_deposit` | |||
| ADD COLUMN `shop_info` JSON NULL COMMENT '商铺信息'; | |||
| ALTER TABLE `wx_bill_property` | |||
| ADD COLUMN `shop_info` JSON NULL COMMENT '商铺信息'; | |||
| ALTER TABLE `wx_bill_property_deposit` | |||
| ADD COLUMN `shop_info` JSON NULL COMMENT '商铺信息'; | |||
| @@ -0,0 +1,18 @@ | |||
| DROP TABLE IF EXISTS `wx_credit_history`; | |||
| CREATE TABLE `wx_credit_history` ( | |||
| `id` bigint(64) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(50) NOT NULL COMMENT '租户ID', | |||
| `c_user_id` bigint(64) NOT NULL COMMENT '用户ID', | |||
| `credit_amount` int(11) NOT NULL COMMENT '总积分', | |||
| `credit_num` int(11) NOT NULL COMMENT '每笔积分明细', | |||
| `credit_type` tinyint(2) NOT NULL COMMENT '积分类型(操作说明)', | |||
| `create_date` datetime(0) NOT NULL COMMENT '创建日期', | |||
| `receipt_url` varchar(256) NULL DEFAULT NULL COMMENT '小票URL', | |||
| `operator_type` tinyint(2) NOT NULL COMMENT '操作人类型', | |||
| `operator_id` bigint(64) NOT NULL COMMENT '操作人ID', | |||
| `merchant_id` bigint(11) NULL DEFAULT NULL COMMENT '商户ID', | |||
| `coupon_id` bigint(64) NULL DEFAULT NULL COMMENT '券ID(积分兑换券时生成)', | |||
| `business_id` bigint(64) NULL DEFAULT NULL COMMENT '业态ID(计算新增积分时使用)', | |||
| `spend` int(11) NULL DEFAULT NULL COMMENT '花费', | |||
| PRIMARY KEY (`id`) USING BTREE | |||
| ) ENGINE = InnoDB ROW_FORMAT = Dynamic COMMENT='积分记录'; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_shop` | |||
| ADD COLUMN `is_del` smallint(2) DEFAULT 0 COMMENT '是否删除1是0否'; | |||
| @@ -0,0 +1,14 @@ | |||
| DROP TABLE IF EXISTS `wx_bill_action` ; | |||
| CREATE TABLE `wx_bill_action` ( | |||
| `id` bigint(64) NOT NULL COMMENT 'ID', | |||
| `tenant_id` varchar(50) NOT NULL COMMENT '租户Id', | |||
| `user_id` bigint(64) NOT NULL COMMENT '用户ID', | |||
| `user_name` varchar(100) NOT NULL COMMENT '用户名', | |||
| `phone` varchar(20) NOT NULL COMMENT '手机号', | |||
| `action` smallint(2) NOT NULL COMMENT '动作', | |||
| `details` varchar(200) NOT NULL COMMENT '明细', | |||
| `createtime` datetime NOT NULL COMMENT '创建时间', | |||
| `updatetime` datetime NOT NULL COMMENT '更新时间', | |||
| PRIMARY KEY (`id`), | |||
| INDEX `id_index` USING BTREE (`id`) comment '' | |||
| ) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='账单操作记录' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_order` | |||
| ADD COLUMN `form_id` VARCHAR(64) NULL COMMENT 'formId' AFTER `order_group_id`; | |||
| @@ -0,0 +1,21 @@ | |||
| -- ---------------------------- | |||
| -- Table structure for `wx_sub_business` | |||
| -- ---------------------------- | |||
| DROP TABLE IF EXISTS `wx_sub_business`; | |||
| CREATE TABLE `wx_sub_business` ( | |||
| `id` int(11) NOT NULL, | |||
| `title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, | |||
| `business_id` int(11) NOT NULL, | |||
| `business_title` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, | |||
| `create_date` datetime DEFAULT CURRENT_TIMESTAMP, | |||
| `update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |||
| -- ---------------------------- | |||
| -- Records of `wx_sub_business` | |||
| -- ---------------------------- | |||
| BEGIN; | |||
| INSERT INTO `wx_sub_business` VALUES ('1', '西餐', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('2', '日本料理', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('3', '韩国料理', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('4', '东南亚菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('5', '自助餐', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('6', '火锅', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('7', '特色菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('8', '私房菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('9', '素食', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('10', '烧烤', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('11', '小吃快餐', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('12', '川菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('13', '湘菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('14', '鲁菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('15', '粤菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('16', '湖北菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('17', '云贵菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('18', '东北菜', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('19', '面包店', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('20', '咖啡厅', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('21', '饮品店', '1', '餐饮', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('22', '男装', '3', '服饰', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('23', '女装', '3', '服饰', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('24', '童装', '3', '服饰', '2019-04-09 17:09:07', '2019-04-09 17:09:07'), ('25', '鞋帽', '3', '服饰', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('26', '配饰', '3', '服饰', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('27', '内衣', '3', '服饰', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('28', '亲子摄影', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('29', '亲子游乐', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('30', '幼儿教育', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('31', '孕产护理', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('32', '童车童床', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('33', '玩具', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('34', '喂养用品', '4', '亲子', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('35', '面部护肤', '7', '美妆', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('36', '香水彩妆', '7', '美妆', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('37', '男士护肤', '7', '美妆', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('38', '营养保健', '7', '美妆', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('39', '黄金', '8', '珠宝', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('40', '钻石', '8', '珠宝', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('41', '时尚饰品', '8', '珠宝', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('42', '翡翠玉石', '8', '珠宝', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('43', '钟表', '8', '珠宝', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('44', 'KTV', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('45', '轰趴馆', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('46', 'DIY手工', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('47', '文化艺术', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('48', '游艺娱乐', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('49', '桌游', '2', '娱乐', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('50', '运动健身', '9', '服务', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('51', '婚纱摄影', '9', '服务', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('52', '美容美发', '9', '服务', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('53', '学习培训', '9', '服务', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('54', '家具', '10', '家居', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('55', '家饰', '10', '家居', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('56', '家纺', '10', '家居', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('57', '生活用品', '10', '家居', '2019-04-09 17:09:08', '2019-04-09 17:09:08'), ('58', '厨具', '10', '家居', '2019-04-09 17:09:08', '2019-04-09 17:09:08'); | |||
| COMMIT; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_coupon_send` | |||
| ADD COLUMN `send_sms` smallint(2) default 0 COMMENT '是否发送短信1是0否'; | |||
| @@ -0,0 +1,6 @@ | |||
| ALTER TABLE `wx_coupon` | |||
| ADD COLUMN `sub_business` INT(11) NULL DEFAULT NULL AFTER `business`; | |||
| ALTER TABLE `wx_coupon_channel` | |||
| ADD COLUMN `sub_business` INT(11) NULL DEFAULT NULL AFTER `business`; | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `sub_business_id` INT(11) NULL DEFAULT NULL AFTER `business_id`; | |||
| @@ -0,0 +1,4 @@ | |||
| ALTER TABLE `wx_c_user` | |||
| CHANGE COLUMN `mp_subscribe_scene` `mp_subscribe_scene` VARCHAR(30) NULL, | |||
| CHANGE COLUMN `subs_subscribe_scene` `subs_subscribe_scene` VARCHAR(30) NULL, | |||
| CHANGE COLUMN `open_id` `open_id` VARCHAR(28) NULL COMMENT '微信openId'; | |||
| @@ -0,0 +1,14 @@ | |||
| ALTER TABLE `wx_bill_rent` | |||
| ADD COLUMN `pay_way` smallint (2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_rent_deposit` | |||
| ADD COLUMN `pay_way` smallint(2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_property` | |||
| ADD COLUMN `pay_way` smallint(2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_property_deposit` | |||
| ADD COLUMN `pay_way` smallint (2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_other` | |||
| ADD COLUMN `pay_way` smallint(2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_other_deposit` | |||
| ADD COLUMN `pay_way` smallint(2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| ALTER TABLE `wx_bill_daily` | |||
| ADD COLUMN `pay_way` smallint(2) NULL DEFAULT NULL COMMENT '支付方式1现金2支付宝3微信4银行卡转账-1其他'; | |||
| @@ -0,0 +1,48 @@ | |||
| UPDATE `wx_tags` SET `name` = '餐饮' WHERE (`id` = '68'); | |||
| UPDATE `wx_tags` SET `name` = '娱乐' WHERE (`id` = '69'); | |||
| UPDATE `wx_tags` SET `name` = '服饰' WHERE (`id` = '70'); | |||
| UPDATE `wx_tags` SET `name` = '亲子' WHERE (`id` = '71'); | |||
| UPDATE `wx_tags` SET `name` = '超市' WHERE (`id` = '72'); | |||
| UPDATE `wx_tags` SET `name` = '美妆' WHERE (`id` = '73'); | |||
| UPDATE `wx_tags` SET `name` = '珠宝' WHERE (`id` = '74'); | |||
| UPDATE `wx_tags` SET `name` = '服务' WHERE (`id` = '75'); | |||
| UPDATE `wx_tags` SET `name` = '家居' WHERE (`id` = '76'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('129', '火锅', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('130', '特色菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('131', '私房菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('132', '素食', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('133', '烧烤', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('134', '小吃快餐', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('135', '川菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('136', '湘菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('137', '鲁菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('138', '粤菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('139', '湖北菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('140', '云贵菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('141', '东北菜', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('142', '面包店', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('143', '咖啡厅', '3', '消费偏好', '17', '饮食偏好'); | |||
| INSERT INTO `wx_tags` (`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES ('144', '饮品店', '3', '消费偏好', '17', '饮食偏好'); | |||
| UPDATE `wx_tags` SET `name` = '西餐' WHERE (`id` = '92'); | |||
| UPDATE `wx_tags` SET `name` = '日本料理' WHERE (`id` = '93'); | |||
| UPDATE `wx_tags` SET `name` = '韩国料理' WHERE (`id` = '94'); | |||
| UPDATE `wx_tags` SET `name` = '东南亚菜' WHERE (`id` = '95'); | |||
| UPDATE `wx_tags` SET `name` = '自助餐' WHERE (`id` = '96'); | |||
| update wx_c_user_tags set tags = replace(tags, '92', '132') where JSON_CONTAINS(tags, '[92]'); | |||
| update wx_c_user_tags set tags = replace(tags, '93', '134') where JSON_CONTAINS(tags, '[92]'); | |||
| update wx_c_user_tags set tags = replace(tags, '96', '129') where JSON_CONTAINS(tags, '[92]'); | |||
| update wx_c_user_tags set tags = replace(tags, '94', '92') where JSON_CONTAINS(tags, '[92]'); | |||
| update wx_c_user_tags set tags = replace(tags, '95', '93') where JSON_CONTAINS(tags, '[92]'); | |||
| UPDATE `wx_question` SET `content` = '{\"flag\":\"multi\",\"title\":\"请问您喜欢哪种口味的食物?\",\"answers\":[{\"id\":\"92\",\"name\":\"西餐\"},{\"id\":\"93\",\"name\":\"日本料理\"},{\"id\":\"94\",\"name\":\"韩国料理\"},{\"id\":\"95\",\"name\":\"东南亚菜\"},{\"id\":\"96\",\"name\":\"自助餐\"},{\"id\":\"129\",\"name\":\"火锅\"},{\"id\":\"130\",\"name\":\"特色菜\"},{\"id\":\"131\",\"name\":\"私房菜\"},{\"id\":\"132\",\"name\":\"素食\"},{\"id\":\"133\",\"name\":\"烧烤\"},{\"id\":\"134\",\"name\":\"小吃快餐\"},{\"id\":\"135\",\"name\":\"川菜\"},{\"id\":\"136\",\"name\":\"湘菜\"},{\"id\":\"137\",\"name\":\"鲁菜\"},{\"id\":\"138\",\"name\":\"粤菜\"},{\"id\":\"139\",\"name\":\"湖北菜\"},{\"id\":\"140\",\"name\":\"云贵菜\"},{\"id\":\"141\",\"name\":\"东北菜\"},{\"id\":\"142\",\"name\":\"面包店\"},{\"id\":\"143\",\"name\":\"咖啡厅\"},{\"id\":\"144\",\"name\":\"饮品店\"}]}' | |||
| WHERE content -> '$.title' = '请问您喜欢哪种口味的食物?'; | |||
| update wx_question_log set answer = replace(answer, '92', '132') where JSON_CONTAINS(answer, '[92]'); | |||
| update wx_question_log set answer = replace(answer, '93', '134') where JSON_CONTAINS(answer, '[93]'); | |||
| update wx_question_log set answer = replace(answer, '96', '129') where JSON_CONTAINS(answer, '[96]'); | |||
| update wx_question_log set answer = replace(answer, '94', '92') where JSON_CONTAINS(answer, '[94]'); | |||
| update wx_question_log set answer = replace(answer, '95', '93') where JSON_CONTAINS(answer, '[95]'); | |||
| @@ -0,0 +1,5 @@ | |||
| alter table wx_bill_rent | |||
| add column `late_pay_status` smallint(2) default 2 COMMENT '滞纳金状态(使用账单的状态)'; | |||
| alter table wx_bill_property | |||
| add column `late_pay_status` smallint(2) default 2 COMMENT '滞纳金状态(使用账单的状态)'; | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_bill_action | |||
| add column `bill_id` bigint(64) default null COMMENT '账单ID'; | |||
| @@ -0,0 +1,5 @@ | |||
| alter table wx_merchant | |||
| add column `title` varchar(255) default '' COMMENT '副标题', | |||
| add column `cover_picture` json default null COMMENT '封面图'; | |||
| update wx_merchant set cover_picture=json_array(img_url); | |||
| @@ -0,0 +1 @@ | |||
| insert into `mall_permission` ( `sort`, `id`, `available`, `resource_type`, `name`) values ( '9', '9', 'Y', '0', '智能硬件'); | |||
| @@ -0,0 +1,3 @@ | |||
| alter table `wx_msg_record` modify column status_message text; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_msg` | |||
| ADD COLUMN `tags` JSON NULL DEFAULT NULL AFTER `label`; | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_merchant | |||
| add column `bill_setting` int(10) default 3 COMMENT '待缴提醒'; | |||
| @@ -0,0 +1,5 @@ | |||
| ALTER TABLE `wx_flow_record` | |||
| ADD COLUMN `start_date` DATETIME COMMENT '发起时间'; | |||
| @@ -0,0 +1,6 @@ | |||
| update wx_flow_record f set f.start_date = | |||
| FROM_UNIXTIME((select text_ from ACT_HI_VARINST where name_='startTime' and PROC_INST_ID_ = f.`process_instance_id`)/1000,'%Y-%m-%d %H:%i:%S') | |||
| where f.start_date is null | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_bill_daily | |||
| add column `price_detail` json default null COMMENT '费用明细'; | |||
| @@ -0,0 +1,7 @@ | |||
| update wx_bill_rent set pay_way=-1; | |||
| update wx_bill_rent_deposit set pay_way=-1; | |||
| update wx_bill_property set pay_way=-1; | |||
| update wx_bill_property_deposit set pay_way=-1; | |||
| update wx_bill_daily set pay_way=-1; | |||
| update wx_bill_other set pay_way=-1; | |||
| update wx_bill_other_deposit set pay_way=-1; | |||
| @@ -0,0 +1,8 @@ | |||
| INSERT INTO `wx_msg_model` (`id`, `tenant_id`, `name`, `signature`, `content`, `createtime`, `status`, `model_id`) | |||
| VALUES | |||
| (205925981009271111, '789', '审批通过通知', '富茂', '<html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" /><meta name=\"renderer\" content=\"webkit\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"><title>富茂审批邮件</title><title></title><script> document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + \'px\';</script></head><body><div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\"><header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\"><img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/></header><div style=\"background:#fff;padding:0 0 40px 0;box-sizing: border-box;\"><div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">审批通过通知</div><div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding-left: 55px;padding: 36px 55px;\">编号<span>{contract}</span>的合同已经审批通过,请登录<a href=\"{page}\">{page}</a>跟进后续工作</div></div></div></body></html>', '2018-09-29 16:03:11', 1, 1), | |||
| (205925981009271112, '789', '待缴账单通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background: #fff;padding-bottom: 40px;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding-top: 56px;padding-left: 55px;\">待缴账单通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding:36px 55px 0;\">您当前的待缴账单为<span style=\"font-weight:400;color:rgba(200,89,98,1);margin:0 10px;\">{price}</span>元,截止日期为<span>{date}</span>请登录<span>您的商户端</span>小程序查看账单并缴费</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">租金账单</span>\n <div style=\"margin: 0 5%;width:90%;overflow: hidden;\">\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单类型</div>\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单金额(元)</div>\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">缴费时间</div>\n </div>\n {billList}\n </div>\n </div>\n <div style=\"background: #fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold; font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;margin-left: 55px;padding-top: 56px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系商管负责人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 2), | |||
| (205925981009271113, '789', '审批通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <script> document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + \'px\';</script>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;padding:0 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding:56px 55px 0;\">审批通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px;\"><span>{userName}</span>同意编号<span>{contract}</span>的合同审批,已呈送<span>{toUserName},</span>请登录<a href=\"{page}\">{page}</a>查看审批进度</div>\n </div>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 3), | |||
| (205925981009271114, '789', '欠缴账单通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background: #fff;padding-bottom: 40px;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">欠缴账单通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px 0;\">您当前的欠缴账单为<span style=\"font-weight:400;color:rgba(200,89,98,1);margin:0 10px;\">{price}</span>元,截止日期为<span>{date}</span>请登录<span>您的商户端</span>小程序查看账单并缴费</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">租金账单</span>\n <div style=\"margin: 0 5%;width:90%;overflow: hidden;font-size:14px;\">\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单类型</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单金额(元)</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">缴费时间</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">逾期天数</div>\n </div>\n {billList}\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold; font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;margin-left: 55px;padding-top: 56px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系商管负责人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 4), | |||
| (205925981009271115, '789', '待办通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">待办通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px 40px;\"><span>{name}</span><span>提交了一个合同待您审批,电脑登录</span><a href=\"{page}\" target=\"_blank\">{page}</a>查看您的待办</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <div style=\"float: left;font-size:18px;width:cale(20%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">申请时间:</div>\n <div style=\"float: left;font-size:18px;width:cale(80%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{applyTime}</div>\n </div>\n <div style=\"overflow: hidden;\">\n <div style=\"float: left;font-size:18px;width:cale(20%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">申请进度:</div>\n <div style=\"float: left;width:cale(80%-55px);margin-left: 55px;\">\n \n {taskList}\n </div>\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;padding: 56px 55px 0;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系申请人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 5), | |||
| (205925981009271116, '789', '驳回通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">审批通过通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding:36px 55px 40px;\">编号<span>{contract}</span>的合同合同审批被驳回,请登录<a href=\"{page}\">{page}</a>查看审批明细</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block;float: left; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">驳回人:</span>\n <span style=\"display: block;float: left; width:calc(100% - 240px);font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{name}</span>\n </div>\n <div style=\"overflow: hidden;\">\n <span style=\"display: block;float: left; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">驳回原因:</span>\n <span style=\"display: block;float: left;width:calc(100% - 240px); font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{remark}</span>\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;margin-top: 26px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系驳回人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 6); | |||
| @@ -0,0 +1,2 @@ | |||
| alter table wx_c_user add credit int(11); | |||
| alter table wx_c_user_basic_info add credit int(11); | |||
| @@ -0,0 +1,3 @@ | |||
| alter table wx_merchant add is_admin smallint(2); | |||
| alter table wx_coupon add credit_price int(11); | |||
| alter table wx_coupon add credit_refund smallint(2); | |||
| @@ -0,0 +1,96 @@ | |||
| DELIMITER $$ | |||
| DROP PROCEDURE IF EXISTS `contract_update`$$ | |||
| CREATE PROCEDURE `contract_update`() | |||
| LANGUAGE SQL | |||
| NOT DETERMINISTIC | |||
| CONTAINS SQL | |||
| SQL SECURITY DEFINER | |||
| COMMENT '' | |||
| begin | |||
| #定义一个循环结束的标记 | |||
| declare done int default false; | |||
| #定义一个循环总条数 | |||
| declare total int; | |||
| #定义一个循环开始值 | |||
| declare i int; | |||
| #定义商铺相关字段 | |||
| declare _shop_id bigint(64); | |||
| declare _shop_number varchar(100); | |||
| declare _build_area varchar(100); | |||
| declare _operation_area varchar(100); | |||
| declare _floor varchar(100); | |||
| declare _img_url varchar(1024); | |||
| declare _addr varchar(100); | |||
| declare _type smallint(2); | |||
| declare _status smallint(2); | |||
| declare _manager varchar(100); | |||
| declare _manager_phone varchar(100); | |||
| declare _building varchar(100); | |||
| #租赁合同相关信息 | |||
| declare _rent_id bigint(64); | |||
| declare _rent_area varchar(100); | |||
| declare _adjust_ratio json; | |||
| declare _price decimal(10,2); | |||
| declare _deposit decimal(10,2); | |||
| declare _adjust_ratio_new json; | |||
| declare _adjust_ratio_value decimal(10,2); | |||
| declare rent_cursor cursor for select id,shop_id from wx_rent_contract where rent_shop_type=1; | |||
| declare rent_total_cursor cursor for select count(*) total from wx_rent_contract where rent_shop_type=1; | |||
| declare continue handler for not found set done = true; | |||
| set i=1; | |||
| open rent_cursor; | |||
| open rent_total_cursor; | |||
| fetch rent_cursor into _rent_id,_shop_id; | |||
| fetch rent_total_cursor into total; | |||
| repeat | |||
| if not done then | |||
| #查询商铺信息 | |||
| select s.shop_number,s.build_area,s.img_url,s.operation_area,s.status,b.building_name,f.floor_name, | |||
| s.manager,s.manager_phone,type,s.addr | |||
| into _shop_number,_build_area,_img_url,_operation_area,_status,_building,_floor,_manager,_manager_phone,_type,_addr | |||
| from wx_shop s left join wx_mall_building b on s.building=b.id left join wx_mall_floor f on s.floor=f.id | |||
| where s.id=_shop_id; | |||
| #查询合同信息 | |||
| select rent_area,adjust_ratio,truncate(price/100,2),truncate(deposit/100,2) into _rent_area,_adjust_ratio,_price,_deposit | |||
| from wx_rent_contract where id=_rent_id; | |||
| #解析年调整比例 | |||
| set @j=0; | |||
| set _adjust_ratio_new = json_array(); | |||
| while (select json_length(_adjust_ratio))>0 and @j<>(select json_length(_adjust_ratio)) do | |||
| set @ratio_index=concat("$[",@j,"]"); | |||
| select truncate(json_extract(_adjust_ratio,@ratio_index)/100,2) into _adjust_ratio_value; | |||
| select json_array_insert(_adjust_ratio_new,@ratio_index,_adjust_ratio_value) into _adjust_ratio_new; | |||
| set @j=@j+1; | |||
| end while; | |||
| #更新租赁合同信息 | |||
| update wx_rent_contract set rent_info=json_array(JSON_OBJECT('shopId',_shop_id,'id',_shop_id,'shopNumber',_shop_number, | |||
| 'price',_price,'deposit',_deposit,'adjustRatio',_adjust_ratio_new,'addr',_addr,'buildArea',_build_area,'imgUrl',_img_url, | |||
| 'operationArea',_operation_area,'building',_building,'floor',_floor,'manager',_manager,'managerPhone',_manager_phone, | |||
| 'type',_type,'status',_status,'rentArea',_rent_area)) | |||
| where id=_rent_id; | |||
| #更新物业信息 | |||
| update wx_property_contract set rent_info=json_array(JSON_OBJECT('shopId',_shop_id,'id',_shop_id,'shopNumber',_shop_number, | |||
| 'price',_price,'deposit',_deposit,'adjustRatio',_adjust_ratio_new,'addr',_addr,'buildArea',_build_area,'imgUrl',_img_url, | |||
| 'operationArea',_operation_area,'building',_building,'floor',_floor,'manager',_manager,'managerPhone',_manager_phone, | |||
| 'type',_type,'status',_status,'rentArea',_rent_area)) | |||
| where rent_contract_id=_rent_id; | |||
| fetch rent_cursor into _rent_id,_shop_id; | |||
| end if; | |||
| IF i<>total then | |||
| set done =false; | |||
| set i=i+1; | |||
| else | |||
| set done = true; | |||
| end if; | |||
| until done | |||
| end repeat; | |||
| close rent_cursor; | |||
| close rent_total_cursor; | |||
| end $$ | |||
| DELIMITER ; | |||
| ### call contract_update(); | |||
| @@ -0,0 +1,28 @@ | |||
| DROP TABLE IF EXISTS `wx_topic` ; | |||
| CREATE TABLE `wx_topic` ( | |||
| `id` bigint(64) NOT NULL COMMENT 'id', | |||
| `tenant_id` varchar(50) DEFAULT NULL COMMENT '租户id', | |||
| `name` varchar(300) NOT NULL DEFAULT '' COMMENT '名称', | |||
| `title` varchar(500) DEFAULT '0' COMMENT '标题', | |||
| `cover` varchar(300) DEFAULT '0' COMMENT '封面', | |||
| `advert` varchar(300) DEFAULT '0' COMMENT '广告图', | |||
| `begin_time` datetime DEFAULT NULL COMMENT '开始时间', | |||
| `end_time` datetime DEFAULT NULL COMMENT '结束时间', | |||
| `content` text COMMENT '内容', | |||
| `status` tinyint(1) DEFAULT '1' COMMENT '状态1生效2失效3作废', | |||
| `bg_color` varchar(300) DEFAULT NULL COMMENT '背景颜色', | |||
| `createtime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |||
| `updatetime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='专题表'; | |||
| INSERT INTO `wx_msg_model` (`id`, `tenant_id`, `name`, `signature`, `content`, `createtime`, `status`, `model_id`) | |||
| VALUES | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '审批通过通知', '富茂', '<html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" /><meta name=\"renderer\" content=\"webkit\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"><title>富茂审批邮件</title><title></title><script> document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + \'px\';</script></head><body><div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\"><header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\"><img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/></header><div style=\"background:#fff;padding:0 0 40px 0;box-sizing: border-box;\"><div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">审批通过通知</div><div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding-left: 55px;padding: 36px 55px;\">编号<span>{contract}</span>的{bustype}已经审批通过,请登录<a href=\"{page}\">{page}</a>跟进后续工作</div></div></div></body></html>', '2018-09-29 16:03:11', 1, 1), | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '待缴账单通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background: #fff;padding-bottom: 40px;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding-top: 56px;padding-left: 55px;\">待缴账单通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding:36px 55px 0;\">您当前的待缴账单为<span style=\"font-weight:400;color:rgba(200,89,98,1);margin:0 10px;\">{price}</span>元,截止日期为<span>{date}</span>请登录<span>您的商户端</span>小程序查看账单并缴费</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">租金账单</span>\n <div style=\"margin: 0 5%;width:90%;overflow: hidden;\">\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单类型</div>\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单金额(元)</div>\n <div style=\"width: 33.3%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">缴费时间</div>\n </div>\n {billList}\n </div>\n </div>\n <div style=\"background: #fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold; font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;margin-left: 55px;padding-top: 56px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系商管负责人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 2), | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '审批通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <script> document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + \'px\';</script>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;padding:0 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding:56px 55px 0;\">审批通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px;\"><span>{userName}</span>同意编号<span>{contract}</span>的{bustype}审批,已呈送<span>{toUserName},</span>请登录<a href=\"{page}\">{page}</a>查看审批进度</div>\n </div>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 3), | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '欠缴账单通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background: #fff;padding-bottom: 40px;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">欠缴账单通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px 0;\">您当前的欠缴账单为<span style=\"font-weight:400;color:rgba(200,89,98,1);margin:0 10px;\">{price}</span>元,截止日期为<span>{date}</span>请登录<span>您的商户端</span>小程序查看账单并缴费</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">租金账单</span>\n <div style=\"margin: 0 5%;width:90%;overflow: hidden;font-size:14px;\">\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单类型</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">账单金额(元)</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">缴费时间</div>\n <div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">逾期天数</div>\n </div>\n {billList}\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold; font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;margin-left: 55px;padding-top: 56px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系商管负责人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 4), | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '待办通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">待办通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding: 36px 55px 40px;\"><span>{name}</span><span>提交了一个{bustype}待您审批,电脑登录</span><a href=\"{page}\" target=\"_blank\">{page}</a>查看您的待办</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <div style=\"float: left;font-size:18px;width:cale(20%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">申请时间:</div>\n <div style=\"float: left;font-size:18px;width:cale(80%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{applyTime}</div>\n </div>\n <div style=\"overflow: hidden;\">\n <div style=\"float: left;font-size:18px;width:cale(20%-55px);font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">申请进度:</div>\n <div style=\"float: left;width:cale(80%-55px);margin-left: 55px;\">\n \n {taskList}\n </div>\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 26px;padding: 56px 55px 0;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系申请人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 5), | |||
| ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)), '789', '驳回通知', '富茂', '<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n <meta name=\"renderer\" content=\"webkit\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <title>富茂审批邮件</title>\n <title></title>\n <style>\n *{\n margin: 0;\n padding: 0;\n }\n </style>\n</head>\n\n<body>\n <div id=\"box\" style=\"padding:80px 20%;background:#E9E7E7;min-height:100vh;\">\n <header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\">\n <img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n </header>\n <content>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;\">审批通过通知</div>\n <div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);padding:36px 55px 40px;\">编号<span>{contract}</span>的{bustype}审批被驳回,请登录<a href=\"{page}\">{page}</a>查看审批明细</div>\n </div>\n <div style=\"height: auto;width: 100%;line-height: 40px; background: rgba(245,245,245,1);padding: 30px 0;\">\n <div style=\"overflow: hidden;\">\n <span style=\"display: block;float: left; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">驳回人:</span>\n <span style=\"display: block;float: left; width:calc(100% - 240px);font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{name}</span>\n </div>\n <div style=\"overflow: hidden;\">\n <span style=\"display: block;float: left; font-size:18px;width:80px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">驳回原因:</span>\n <span style=\"display: block;float: left;width:calc(100% - 240px); font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;\">{remark}</span>\n </div>\n </div>\n <div style=\"background:#fff;\">\n <div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;padding: 56px 55px 0;margin-top: 26px;\">遇到问题?</div>\n <div style=\"overflow: hidden;line-height: 60px;padding-bottom: 40px;\">\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(153,153,153,1);margin-left: 55px;\">请联系驳回人:</span>\n <span style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 25px;\"><span>{linkName}</span><span style=\"margin-left: 16px; font-family:MicrosoftYaHei;font-weight:400;color:rgba(64,103,139,1);\">{linkPhone}</span></span>\n </div>\n </div>\n </content>\n </div>\n</body>\n\n</html>', '2018-09-29 16:03:11', 1, 6); | |||
| @@ -0,0 +1 @@ | |||
| alter table wx_credit_history add change_purpose varchar(255) | |||
| @@ -0,0 +1,45 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef"> | |||
| <process id="end_bill_flow" name="endBillflow" isExecutable="true"> | |||
| <documentation>账单审批流程</documentation> | |||
| <startEvent id="startEvent1"></startEvent> | |||
| <userTask id="firstTaskUser" name="初审" flowable:candidateUsers="${firstTaskUser}"> | |||
| <documentation>初审</documentation> | |||
| </userTask> | |||
| <endEvent id="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"></endEvent> | |||
| <sequenceFlow id="sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9" sourceRef="startEvent1" targetRef="firstTaskUser"></sequenceFlow> | |||
| <sequenceFlow id="sid-C4925653-8894-42FF-81F4-412B3D11A3C9" sourceRef="firstTaskUser" targetRef="secondTaskUser"></sequenceFlow> | |||
| <sequenceFlow id="sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C" sourceRef="secondTaskUser" targetRef="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"></sequenceFlow> | |||
| <userTask id="secondTaskUser" name="复审" flowable:candidateUsers="${secondTaskUser}"> | |||
| <documentation>复审</documentation> | |||
| </userTask> | |||
| </process> | |||
| <bpmndi:BPMNDiagram id="BPMNDiagram_end_bill_flow"> | |||
| <bpmndi:BPMNPlane bpmnElement="end_bill_flow" id="BPMNPlane_end_bill_flow"> | |||
| <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1"> | |||
| <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="157.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="firstTaskUser" id="BPMNShape_firstTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="285.0" y="132.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F" id="BPMNShape_sid-9692A856-E39A-4B8C-95C2-7C04A3646D6F"> | |||
| <omgdc:Bounds height="28.0" width="28.0" x="835.0" y="158.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNShape bpmnElement="secondTaskUser" id="BPMNShape_secondTask"> | |||
| <omgdc:Bounds height="80.0" width="100.0" x="554.0" y="132.0"></omgdc:Bounds> | |||
| </bpmndi:BPMNShape> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-C4925653-8894-42FF-81F4-412B3D11A3C9" id="BPMNEdge_sid-C4925653-8894-42FF-81F4-412B3D11A3C9"> | |||
| <omgdi:waypoint x="384.94999999987203" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="553.9999999998877" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C" id="BPMNEdge_sid-9FCAF465-99E7-4EFE-BEEA-7D59481E684C"> | |||
| <omgdi:waypoint x="653.9499999999999" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="835.0" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| <bpmndi:BPMNEdge bpmnElement="sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9" id="BPMNEdge_sid-AA24EF6A-4416-4FAF-9FF5-E15E46D87BD9"> | |||
| <omgdi:waypoint x="129.9499996223143" y="172.0"></omgdi:waypoint> | |||
| <omgdi:waypoint x="284.9999999998994" y="172.0"></omgdi:waypoint> | |||
| </bpmndi:BPMNEdge> | |||
| </bpmndi:BPMNPlane> | |||
| </bpmndi:BPMNDiagram> | |||
| </definitions> | |||
| @@ -21,11 +21,19 @@ public class BApplication { | |||
| @Value("${fm.exception}") | |||
| private boolean fmException; | |||
| @Value("${fm.open}") | |||
| private boolean fmOpen; | |||
| @Bean | |||
| public boolean isFmException() { | |||
| return fmException; | |||
| } | |||
| @Bean | |||
| public boolean isFmOpen() { | |||
| return fmOpen; | |||
| } | |||
| public static void main(String[] args) { | |||
| SpringApplication.run(BApplication.class, args); | |||
| @@ -0,0 +1,52 @@ | |||
| package com.iformall.config; | |||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||
| import org.springframework.stereotype.Component; | |||
| /** | |||
| * @author Stormeye | |||
| */ | |||
| @Component | |||
| @ConfigurationProperties(prefix = "aws") | |||
| public class AwsProperty { | |||
| // AWS ACCESS KEY | |||
| private String access; | |||
| private String secret; | |||
| private String clientRegion; | |||
| private String bucketName; | |||
| public String getAccess() { | |||
| return access; | |||
| } | |||
| public void setAccess(String access) { | |||
| this.access = access; | |||
| } | |||
| public String getSecret() { | |||
| return secret; | |||
| } | |||
| public void setSecret(String secret) { | |||
| this.secret = secret; | |||
| } | |||
| public String getClientRegion() { | |||
| return clientRegion; | |||
| } | |||
| public void setClientRegion(String clientRegion) { | |||
| this.clientRegion = clientRegion; | |||
| } | |||
| public String getBucketName() { | |||
| return bucketName; | |||
| } | |||
| public void setBucketName(String bucketName) { | |||
| this.bucketName = bucketName; | |||
| } | |||
| } | |||
| @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxMerchantBUserService; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.IPUtil; | |||
| import com.iformall.utils.MaUtil; | |||
| @@ -26,12 +27,17 @@ import javax.servlet.http.HttpServletRequest; | |||
| @RestController | |||
| public class BaseController { | |||
| @Autowired | |||
| private boolean isFmOpen; | |||
| @Autowired | |||
| private WxMerchantBUserService wxMerchantBUserService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private FmOpenService openService; | |||
| @InitBinder | |||
| public void InitBinder(WebDataBinder dataBinder) { | |||
| dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | |||
| @@ -79,14 +85,21 @@ public class BaseController { | |||
| } | |||
| public WxMaService getWeappService(String appId) { | |||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| if(isFmOpen) { | |||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||
| } else { | |||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| } | |||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| if(!isFmOpen) { | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| return null; | |||
| } | |||
| public String getIpAddr() { | |||
| @@ -0,0 +1,209 @@ | |||
| package com.iformall.controller; | |||
| import com.amazonaws.AmazonClientException; | |||
| import com.amazonaws.AmazonServiceException; | |||
| import com.amazonaws.auth.AWSCredentials; | |||
| import com.amazonaws.auth.AWSCredentialsProvider; | |||
| import com.amazonaws.auth.BasicAWSCredentials; | |||
| import com.amazonaws.services.s3.AmazonS3; | |||
| import com.amazonaws.services.s3.AmazonS3ClientBuilder; | |||
| import com.amazonaws.services.s3.model.CannedAccessControlList; | |||
| import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import java.io.*; | |||
| import java.net.URL; | |||
| import java.util.*; | |||
| @RestController | |||
| @RequestMapping(value = "/api/upload") | |||
| @Api(description = "文件上传接口") | |||
| public class UploadController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| private AmazonS3 s3 = null; | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| if (s3 == null) { | |||
| s3 = AmazonS3ClientBuilder.standard() | |||
| .withRegion(awsProperty.getClientRegion()) | |||
| .withCredentials(new AWSCredentialsProvider() { | |||
| @Override | |||
| public AWSCredentials getCredentials() { | |||
| return new BasicAWSCredentials(awsProperty.getAccess(), awsProperty.getSecret()); | |||
| } | |||
| @Override | |||
| public void refresh() { | |||
| } | |||
| }) | |||
| .build(); | |||
| } | |||
| s3.putObject( | |||
| new PutObjectRequest(awsProperty.getBucketName(), fileName, multiReq.getInputStream(), metadata) | |||
| .withCannedAcl(CannedAccessControlList.PublicRead)); | |||
| URL url = s3.getUrl(awsProperty.getBucketName(), fileName); | |||
| logger.info(url.toString()); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("url", url.toString()); | |||
| data.data = map; | |||
| } catch (AmazonServiceException ase) { | |||
| data.code = ResultData.ERROR; | |||
| logger.warn("Caught an AmazonServiceException, which " + | |||
| "means your request made it " + | |||
| "to Amazon S3, but was rejected with an error response" + | |||
| " for some reason."); | |||
| logger.warn(ase.getMessage()); | |||
| data.code = ResultData.ERROR; | |||
| data.message = "上传失败"; | |||
| } catch (AmazonClientException ace) { | |||
| data.code = ResultData.ERROR; | |||
| logger.warn("Caught an AmazonClientException, which " + | |||
| "means the client encountered " + | |||
| "an internal error while trying to " + | |||
| "communicate with S3, " + | |||
| "such as not being able to access the network."); | |||
| logger.warn("Error Message: " + ace.getMessage()); | |||
| data.code = ResultData.ERROR; | |||
| data.message = "上传失败"; | |||
| } catch (IOException ioe) { | |||
| data.code = ResultData.ERROR; | |||
| logger.warn("Caught an IOException: " + ioe.getMessage()); | |||
| data.code = ResultData.ERROR; | |||
| data.message = "上传失败"; | |||
| } | |||
| return data; | |||
| } | |||
| /** | |||
| * 上传文件 | |||
| * | |||
| * @param | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/awsFileUpload") | |||
| @ApiOperation("上传文件") | |||
| public ResultData awsfileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::awsfileUpload"); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multiReq.getContentType()); | |||
| metadata.setContentLength(multiReq.getSize()); | |||
| FileOutputStream fos = null; | |||
| BufferedInputStream fs = null; | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||
| if (dot >= 0) { | |||
| fileName = getTenantId() + "/" + fileName + multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| } else { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| return data; | |||
| } | |||
| /** | |||
| * 多文件上传 | |||
| * | |||
| * @param files | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/awsFilesUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("多文件上传") | |||
| public ResultData awsFilesUpload(@RequestParam("files") MultipartFile[] files) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::awsFilesUpload"); | |||
| if (files.length > 0) { | |||
| ResultData data = new ResultData(); | |||
| List<Map<String, String>> dataList = new ArrayList<Map<String, String>>(); | |||
| for (MultipartFile multipartFile : files) { | |||
| Map<String, String> map = new HashMap<>(); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multipartFile.getContentType()); | |||
| metadata.setContentLength(multipartFile.getSize()); | |||
| FileOutputStream fos = null; | |||
| BufferedInputStream fs = null; | |||
| map.put("key", multipartFile.getOriginalFilename()); | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multipartFile.getOriginalFilename().lastIndexOf('.'); | |||
| if (dot >= 0) { | |||
| fileName = getTenantId() + "/" + fileName + multipartFile.getOriginalFilename().substring(dot, multipartFile.getOriginalFilename().length()); | |||
| } else { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| if (data1.code == ResultData.SUCCESS) { | |||
| Map _data = (Map) data1.data; | |||
| map.put("url", (String) _data.get("url")); | |||
| dataList.add(map); | |||
| } else { | |||
| // 部分成功 | |||
| data.code = ResultData.SUCCESS; | |||
| data.data = dataList; | |||
| return data; | |||
| } | |||
| } | |||
| data.code = ResultData.SUCCESS; | |||
| data.data = dataList; | |||
| return data; | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * C端上传图片文件 | |||
| * | |||
| * @param multiReq | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/cimgUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("C端上传图片文件") | |||
| public ResultData cimgUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::cimgUpload"); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multiReq.getContentType()); | |||
| metadata.setContentLength(multiReq.getSize()); | |||
| String fileName = multiReq.getOriginalFilename(); | |||
| fileName = "cimg/" + fileName; | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| return data; | |||
| } | |||
| } | |||
| @@ -7,12 +7,10 @@ import com.iformall.common.IdWorker; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxCUserFromBDto; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCUserFromB; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -55,6 +53,9 @@ public class WxCUserController extends BaseController { | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxCreditHistoryService wxCreditHistoryService; | |||
| /** | |||
| * 会员更新信息 | |||
| @@ -115,6 +116,8 @@ public class WxCUserController extends BaseController { | |||
| wxCUserBasicInfo.setUpdateDate(new Date()); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||
| //增加积分 | |||
| addCredit(wxCUserBasicInfo,EnumScoreType.COMPLETE_INFO); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||
| //新增来自B端的会员关联数据 | |||
| wxCUserFromB = new WxCUserFromB(); | |||
| @@ -174,6 +177,8 @@ public class WxCUserController extends BaseController { | |||
| wxCUserBasicInfo.setPhone(wxCUser.getPhone()); | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||
| //增加积分 | |||
| addCredit(wxCUserBasicInfo,EnumScoreType.COMPLETE_INFO); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||
| //更新B端来源会员 | |||
| wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||
| @@ -182,6 +187,17 @@ public class WxCUserController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType) { | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); | |||
| wxCreditHistory.setTenantId(getTenantId()); | |||
| wxCreditHistory.setCreateDate(new Date()); | |||
| wxCreditHistory.setCreditType(enumScoreType.getCode()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | |||
| wxCreditHistory.setOperatorId(wxCUserBasicInfo.getId()); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | |||
| } | |||
| /** | |||
| * 会员信息 | |||
| @@ -0,0 +1,95 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCreditHistoryService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("/api/credit") | |||
| @Api(description = "积分相关接口") | |||
| @Slf4j | |||
| public class WxCreditHistoryController extends BaseController { | |||
| @Autowired | |||
| private WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @ApiOperation("根据商户ID和消费金额获取所增加积分 取data里credit的值, 服务台会查询一般商户的信息,普通商户只会调用自己的id") | |||
| @GetMapping("/findByMerchantIdAndSpend") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="spend",value="消费金额",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr) { | |||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | |||
| return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,getTenantId())); | |||
| } | |||
| @ApiOperation("根据手机号查询接口") | |||
| @GetMapping("/findByPhone") | |||
| @ApiImplicitParam(name = "phone", value = "phone", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findByPhone(String phone) { | |||
| log.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::findByPhone"); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoService.findByPhone(getTenantId(),phone); | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| if (wxCUserBasicInfoList != null && wxCUserBasicInfoList.size() > 0) { | |||
| wxCUserBasicInfo = wxCUserBasicInfoList.get(0); | |||
| } | |||
| return new ResultData(wxCUserBasicInfo); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("/add") | |||
| public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) { | |||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::add"); | |||
| wxCreditHistory.setTenantId(getTenantId()); | |||
| wxCreditHistory.setOperatorId(getUser().getId()); | |||
| wxCreditHistory.setMerchantId(getUser().getMerchantId()); | |||
| //B端操作用户 | |||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | |||
| return new ResultData(Result.SUCCESS,"操作成功",credit); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||
| log.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||
| WxMerchantBUser bUser = getUser(); | |||
| WxMerchant merchant = wxMerchantService.getById(wxCreditHistory.getMerchantId()); | |||
| if (merchant != null && merchant.getIsAdmin() == 1) { | |||
| wxCreditHistory.setOperatorId(bUser.getId()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||
| wxCreditHistory.setMerchantId(null); | |||
| } | |||
| final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| } | |||
| @@ -41,6 +41,9 @@ import java.util.Map; | |||
| public class WxInfoController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private boolean isFmOpen; | |||
| @Autowired | |||
| WxAppinfoService wxAppinfoService; | |||
| @@ -115,28 +118,14 @@ public class WxInfoController extends BaseController { | |||
| private Map<String,String> getOpenIdInfo(String appId, String code) { | |||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||
| WxMaService wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| wxAppinfo.setAccessToken(accessToken); | |||
| wxAppinfo.setLastTokenTime(new Date()); | |||
| wxAppinfo.setExpiresIn(7200); | |||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| WxMaService wxMaService = null; | |||
| if(isFmOpen) { | |||
| wxMaService = getWeappService(appId); | |||
| } else { | |||
| // 检查token是否已过期, 小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| wxAppinfo.setAccessToken(accessToken); | |||
| @@ -148,7 +137,26 @@ public class WxInfoController extends BaseController { | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| } else { | |||
| // 检查token是否已过期, 小时就重新获取 | |||
| Date curDate = new Date(); | |||
| if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.H_EXPIRE) { | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| wxAppinfo.setAccessToken(accessToken); | |||
| wxAppinfo.setLastTokenTime(new Date()); | |||
| wxAppinfo.setExpiresIn(7200); | |||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| } | |||
| } | |||
| } | |||
| @@ -4,7 +4,9 @@ package com.iformall.controller; | |||
| import com.iformall.annotation.AuthIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.enums.EnumMerchantBUserStatus; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.service.*; | |||
| @@ -24,7 +26,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -81,6 +82,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| resultMap.put("service_phone", mall.getServicePhone()); | |||
| resultMap.put("tenant_id",merchant.getTenantId()); | |||
| resultMap.put("merchant_id",merchant.getId()); | |||
| resultMap.put("is_admin",merchant.getIsAdmin()); | |||
| String mid = null; | |||
| try { | |||
| mid = String.valueOf(merchant.getId()); | |||
| @@ -167,8 +169,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| } | |||
| // check password | |||
| if (user1.getUserPwd().equalsIgnoreCase(password)) { | |||
| user1.createToken(currentDate); | |||
| token = user1.getToken(); | |||
| token = user1.createToken(currentDate); | |||
| resultMap.put("token", token); | |||
| resultMap.put("bUserId",user1.getId()); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, user1.getId()); | |||
| @@ -0,0 +1,29 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.service.WxMerchantService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @RequestMapping("/api/merchant") | |||
| @Api(description = "商户相关接口") | |||
| @Slf4j | |||
| public class WxMerchantController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @ApiOperation("查询当前租户下商户名称列表") | |||
| @GetMapping("/name_list") | |||
| public ResultData nameList() { | |||
| log.debug("[" + getIpAddr() + "] WxMerchantController::name_list"); | |||
| return new ResultData(wxMerchantService.findList(getTenantId())); | |||
| } | |||
| } | |||
| @@ -3,10 +3,9 @@ package com.iformall.interceptor; | |||
| import javax.servlet.ReadListener; | |||
| import javax.servlet.ServletInputStream; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletRequestWrapper; | |||
| import java.io.*; | |||
| public class BodyReaderHttpServletRequestWrapper extends HttpServletRequestWrapper { | |||
| public class BodyReaderHttpServletRequestWrapper extends XssHttpServletRequestWrapper { | |||
| private final String body; | |||
| public BodyReaderHttpServletRequestWrapper(HttpServletRequest request) throws IOException { | |||
| @@ -1,10 +1,18 @@ | |||
| package com.iformall.interceptor; | |||
| import com.iformall.utils.UrlCheck; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import javax.servlet.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.io.IOException; | |||
| public class HttpServletRequestWrapperFilter implements Filter { | |||
| private static final Logger logger = LoggerFactory.getLogger(HttpServletRequestWrapperFilter.class); | |||
| // 多个跨域域名设置 | |||
| // public static final String[] ALLOW_DOMAIN = {"https://admin.malls.iformall.com"}; | |||
| @Override | |||
| public void init(FilterConfig filterConfig) throws ServletException { | |||
| @@ -15,11 +23,41 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||
| throws IOException, ServletException { | |||
| ServletRequest requestWrapper = null; | |||
| /* // 跨域访问 | |||
| HttpServletRequest req = (HttpServletRequest) request; | |||
| HttpServletResponse res = (HttpServletResponse) response; | |||
| String originHeader = req.getHeader("Origin"); | |||
| if (Arrays.asList(ALLOW_DOMAIN).contains(originHeader)) { | |||
| //通过在响应 header 中设置 ‘*’ 来允许来自所有域的跨域请求访问。 | |||
| res.setHeader("Access-Control-Allow-Origin", originHeader); | |||
| //通过对 Credentials 参数的设置,就可以保持跨域 Ajax 时的 Cookie | |||
| //设置了Allow-Credentials,Allow-Origin就不能为*,需要指明具体的url域 | |||
| res.setHeader("Access-Control-Allow-Credentials", "true"); | |||
| //请求方式 | |||
| res.setHeader("Access-Control-Allow-Methods", "*"); | |||
| //(预检请求)的返回结果(即 Access-Control-Allow-Methods 和Access-Control-Allow-Headers 提供的信息) 可以被缓存多久 | |||
| res.setHeader("Access-Control-Max-Age", "86400"); | |||
| //首部字段用于预检请求的响应。其指明了实际请求中允许携带的首部字段 | |||
| //res.setHeader("Access-Control-Allow-Headers", "*"); | |||
| res.setHeader("Access-Control-Allow-Headers", | |||
| "Timestamp,Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token,Access-Control-Allow-Headers"); | |||
| } | |||
| */ | |||
| //sql,xss过滤 | |||
| XssHttpServletRequestWrapper xssHttpServletRequestWrapper = new XssHttpServletRequestWrapper((HttpServletRequest)request); | |||
| if (request instanceof HttpServletRequest) { | |||
| requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | |||
| String url = ((HttpServletRequest) request).getRequestURI(); | |||
| if (!UrlCheck.checkUrl(url)) { | |||
| requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | |||
| } | |||
| } | |||
| if (null == requestWrapper) { | |||
| chain.doFilter(request, response); | |||
| chain.doFilter(xssHttpServletRequestWrapper, response); | |||
| } else { | |||
| chain.doFilter(requestWrapper, response); | |||
| } | |||
| @@ -75,7 +75,7 @@ public class RequestInterceptor extends HandlerInterceptorAdapter { | |||
| sb.append(resultBody); | |||
| String key = "request-" + HashUtil.md5(sb.toString()); | |||
| String key = "request:B:" + HashUtil.md5(sb.toString()); | |||
| Boolean isAbsent = redisTemplate.<Boolean>execute(new RedisCallback<Boolean>() { | |||
| @Override | |||
| public Boolean doInRedis(RedisConnection connection) throws DataAccessException { | |||
| @@ -0,0 +1,122 @@ | |||
| package com.iformall.interceptor; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.util.StringUtils; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletRequestWrapper; | |||
| import java.util.HashMap; | |||
| import java.util.HashSet; | |||
| import java.util.Map; | |||
| import java.util.Set; | |||
| /** | |||
| * 防止sql注入,xss攻击 | |||
| * 前端可以对输入信息做预处理,后端也可以做处理。 | |||
| */ | |||
| public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { | |||
| private final Logger log = LoggerFactory.getLogger(getClass()); | |||
| private static String key = "and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|;|or|-|+"; | |||
| private static Set<String> notAllowedKeyWords = new HashSet<String>(0); | |||
| private static String replacedString="INVALID"; | |||
| static { | |||
| String keyStr[] = key.split("\\|"); | |||
| for (String str : keyStr) { | |||
| notAllowedKeyWords.add(str); | |||
| } | |||
| } | |||
| private String currentUrl; | |||
| public XssHttpServletRequestWrapper(HttpServletRequest servletRequest) { | |||
| super(servletRequest); | |||
| currentUrl = servletRequest.getRequestURI(); | |||
| } | |||
| /**覆盖getParameter方法,将参数名和参数值都做xss过滤。 | |||
| * 如果需要获得原始的值,则通过super.getParameterValues(name)来获取 | |||
| * getParameterNames,getParameterValues和getParameterMap也可能需要覆盖 | |||
| */ | |||
| @Override | |||
| public String getParameter(String parameter) { | |||
| String value = super.getParameter(parameter); | |||
| if (value == null) { | |||
| return null; | |||
| } | |||
| return cleanXSS(value); | |||
| } | |||
| @Override | |||
| public String[] getParameterValues(String parameter) { | |||
| String[] values = super.getParameterValues(parameter); | |||
| if (values == null) { | |||
| return null; | |||
| } | |||
| int count = values.length; | |||
| String[] encodedValues = new String[count]; | |||
| for (int i = 0; i < count; i++) { | |||
| encodedValues[i] = cleanXSS(values[i]); | |||
| } | |||
| return encodedValues; | |||
| } | |||
| @Override | |||
| public Map<String, String[]> getParameterMap(){ | |||
| Map<String, String[]> values=super.getParameterMap(); | |||
| if (values == null) { | |||
| return null; | |||
| } | |||
| Map<String, String[]> result=new HashMap<>(); | |||
| for(String key:values.keySet()){ | |||
| String encodedKey=cleanXSS(key); | |||
| int count=values.get(key).length; | |||
| String[] encodedValues = new String[count]; | |||
| for (int i = 0; i < count; i++){ | |||
| encodedValues[i]=cleanXSS(values.get(key)[i]); | |||
| } | |||
| result.put(encodedKey,encodedValues); | |||
| } | |||
| return result; | |||
| } | |||
| /** | |||
| * 覆盖getHeader方法,将参数名和参数值都做xss过滤。 | |||
| * 如果需要获得原始的值,则通过super.getHeaders(name)来获取 | |||
| * getHeaderNames 也可能需要覆盖 | |||
| */ | |||
| @Override | |||
| public String getHeader(String name) { | |||
| String value = super.getHeader(name); | |||
| if (value == null) { | |||
| return null; | |||
| } | |||
| return cleanXSS(value); | |||
| } | |||
| private String cleanXSS(String valueP) { | |||
| // You'll need to remove the spaces from the html entities below | |||
| String value = valueP.replaceAll("<", "<").replaceAll(">", ">"); | |||
| value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;"); | |||
| value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;"); | |||
| value = value.replaceAll("'", "& #39;"); | |||
| value = value.replaceAll("eval\\((.*)\\)", ""); | |||
| value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\""); | |||
| value = value.replaceAll("script", ""); | |||
| value = cleanSqlKeyWords(value); | |||
| return value; | |||
| } | |||
| private String cleanSqlKeyWords(String value) { | |||
| String paramValue = value; | |||
| for (String keyword : notAllowedKeyWords) { | |||
| if (paramValue.length() > keyword.length() + 4 | |||
| && (paramValue.contains(" "+keyword)||paramValue.contains(keyword+" ")||paramValue.contains(" "+keyword+" "))) { | |||
| paramValue = StringUtils.replace(paramValue, keyword, replacedString); | |||
| log.error(this.currentUrl + "已被过滤,因为参数中包含不允许sql的关键词(" + keyword | |||
| + ")"+";参数:"+value+";过滤后的参数:"+paramValue); | |||
| } | |||
| } | |||
| return paramValue; | |||
| } | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| package com.iformall.utils; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public class UrlCheck { | |||
| public static boolean checkUrl(String url) { | |||
| return url.contains("awsFileUpload") | |||
| || url.contains("awsFilesUpload"); | |||
| } | |||
| } | |||
| @@ -23,7 +23,6 @@ spring: | |||
| maxOpenPreparedStatements: 20 | |||
| #jackson: | |||
| #date-format: yyyy-MM-dd HH:mm:ss | |||
| # REDIS | |||
| redis: | |||
| host: 202.165.179.86 | |||
| @@ -63,8 +62,31 @@ jasypt: | |||
| encryptor: | |||
| password: oRqdnDbK5pj3eMmB | |||
| wechat: | |||
| open: | |||
| componentAppId: "wx897e4673286c915d" | |||
| componentSecret: "cdfdfda65c45689beb6766c4c427eed2" | |||
| componentToken: "formall2018" | |||
| componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" | |||
| redis: | |||
| host: 202.165.179.86 | |||
| port: 6379 | |||
| password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 500 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: false | |||
| deploy: 1 | |||
| open: true | |||
| logging: | |||
| level: | |||
| @@ -65,8 +65,31 @@ aws: | |||
| access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) | |||
| secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) | |||
| wechat: | |||
| open: | |||
| componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) | |||
| componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) | |||
| componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) | |||
| componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 100 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: true | |||
| deploy: 3 | |||
| open: true | |||
| logging: | |||
| level: | |||
| @@ -65,8 +65,31 @@ aws: | |||
| access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) | |||
| secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) | |||
| wechat: | |||
| open: | |||
| componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) | |||
| componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) | |||
| componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) | |||
| componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) | |||
| redis: | |||
| host: 127.0.0.1 | |||
| port: 6379 | |||
| password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 2 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| max-active: 100 | |||
| max-idle: 100 | |||
| max-wait: -1 | |||
| min-idle: 10 | |||
| fm: | |||
| exception: true | |||
| deploy: 2 | |||
| open: true | |||
| logging: | |||
| level: | |||
| @@ -21,11 +21,19 @@ public class CApplication { | |||
| @Value("${fm.exception}") | |||
| private boolean fmException; | |||
| @Value("${fm.open}") | |||
| private boolean fmOpen; | |||
| @Bean | |||
| public boolean isFmException() { | |||
| return fmException; | |||
| } | |||
| @Bean | |||
| public boolean isFmOpen() { | |||
| return fmOpen; | |||
| } | |||
| public static void main(String[] args) { | |||
| SpringApplication.run(CApplication.class, args); | |||
| @@ -0,0 +1,52 @@ | |||
| package com.iformall.config; | |||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||
| import org.springframework.stereotype.Component; | |||
| /** | |||
| * @author Stormeye | |||
| */ | |||
| @Component | |||
| @ConfigurationProperties(prefix = "aws") | |||
| public class AwsProperty { | |||
| // AWS ACCESS KEY | |||
| private String access; | |||
| private String secret; | |||
| private String clientRegion; | |||
| private String bucketName; | |||
| public String getAccess() { | |||
| return access; | |||
| } | |||
| public void setAccess(String access) { | |||
| this.access = access; | |||
| } | |||
| public String getSecret() { | |||
| return secret; | |||
| } | |||
| public void setSecret(String secret) { | |||
| this.secret = secret; | |||
| } | |||
| public String getClientRegion() { | |||
| return clientRegion; | |||
| } | |||
| public void setClientRegion(String clientRegion) { | |||
| this.clientRegion = clientRegion; | |||
| } | |||
| public String getBucketName() { | |||
| return bucketName; | |||
| } | |||
| public void setBucketName(String bucketName) { | |||
| this.bucketName = bucketName; | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxCUserService; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.IPUtil; | |||
| import com.iformall.utils.MaUtil; | |||
| @@ -29,12 +30,18 @@ import java.util.List; | |||
| @RestController | |||
| public class BaseController { | |||
| @Autowired | |||
| private boolean isFmOpen; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| @Autowired | |||
| private FmOpenService openService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @@ -88,17 +95,25 @@ public class BaseController { | |||
| } | |||
| public WxMaService getWeappService(String appId) { | |||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||
| if (appinfo == null) { | |||
| return null; | |||
| if(isFmOpen) { | |||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||
| } else { | |||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||
| if (appinfo == null) { | |||
| return null; | |||
| } | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| if(!isFmOpen) { | |||
| WxMaService service = MaUtil.getWeappService(appinfo); | |||
| return service; | |||
| } | |||
| return null; | |||
| } | |||
| @@ -125,6 +140,10 @@ public class BaseController { | |||
| if (basicInfo.getPoins() == null) { | |||
| basicInfo.setPoins(user.getScore()); | |||
| } | |||
| // 积分 | |||
| if (basicInfo.getCredit() == null) { | |||
| basicInfo.setCredit(user.getCredit()); | |||
| } | |||
| wxCUserBasicInfoService.updateObj(basicInfo, user.getId()); | |||
| } else { | |||
| Date cur = new Date(); | |||
| @@ -137,6 +156,7 @@ public class BaseController { | |||
| basicInfo.setPoins(user.getScore()); | |||
| basicInfo.setCreateDate(cur); | |||
| basicInfo.setUpdateDate(cur); | |||
| basicInfo.setCredit(user.getCredit()); | |||
| wxCUserBasicInfoService.save(basicInfo); | |||
| } | |||
| } | |||