| @@ -44,12 +44,14 @@ public class WxBillDailyController extends BaseController | |||||
| public ResultData add(@RequestBody WxBillDaily wxBillDaily) { | public ResultData add(@RequestBody WxBillDaily wxBillDaily) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::add"); | logger.debug("[" + getIpAddr() + "] WxBillDailyController::add"); | ||||
| wxBillDaily.setTenantId(getTenantId()); | wxBillDaily.setTenantId(getTenantId()); | ||||
| wxBillDaily.setUserId(getUser().getId()); | |||||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | return wxBillDailyService.saveOrUpdate(wxBillDaily); | ||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | ||||
| wxBillDaily.setUserId(getUser().getId()); | |||||
| return wxBillDailyService.saveOrUpdate(wxBillDaily); | return wxBillDailyService.saveOrUpdate(wxBillDaily); | ||||
| } | } | ||||
| @@ -44,12 +44,14 @@ public class WxBillOtherController extends BaseController | |||||
| public ResultData add(@RequestBody WxBillOther wxBillOther) { | public ResultData add(@RequestBody WxBillOther wxBillOther) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::add"); | logger.debug("[" + getIpAddr() + "] WxBillOtherController::add"); | ||||
| wxBillOther.setTenantId(getTenantId()); | wxBillOther.setTenantId(getTenantId()); | ||||
| wxBillOther.setUserId(getUser().getId()); | |||||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | return wxBillOtherService.saveOrUpdate(wxBillOther); | ||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | public ResultData update(@RequestBody WxBillOther wxBillOther) { | ||||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | ||||
| wxBillOther.setUserId(getUser().getId()); | |||||
| return wxBillOtherService.saveOrUpdate(wxBillOther); | return wxBillOtherService.saveOrUpdate(wxBillOther); | ||||
| } | } | ||||
| @@ -1,5 +1,10 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | |||||
| import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; | |||||
| import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; | |||||
| import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| @@ -8,14 +13,19 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.CUserBaseInfoT; | |||||
| import com.iformall.enums.EnumAssignTagsTrigger; | import com.iformall.enums.EnumAssignTagsTrigger; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.impl.WxCUserBasicInfoServiceImpl; | |||||
| import com.iformall.shiro.UserSession; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.apache.shiro.session.Session; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -39,6 +49,8 @@ import static com.iformall.domain.po.WxCouponOrder.Field.CreateDate_DESC; | |||||
| public class WxCUserBasicInfoController extends BaseController { | public class WxCUserBasicInfoController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private String importMemPrev = "importmem/"; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @@ -55,7 +67,10 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @Autowired | @Autowired | ||||
| WxLevelConfigService wxLevelConfigService; | |||||
| private WxLevelConfigService wxLevelConfigService; | |||||
| @Autowired | |||||
| private WxTagsService wxTagsService; | |||||
| @Autowired | @Autowired | ||||
| StringRedisTemplate stringRedisTemplate; | StringRedisTemplate stringRedisTemplate; | ||||
| @@ -79,7 +94,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| if (info.getTagId() != null) { | if (info.getTagId() != null) { | ||||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | ||||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||||
| if (uTag != null && StringUtils.isNotBlank(uTag.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | ||||
| info.setTagsList(wxCUserTagsService.findTagList(getTenantId(), ids)); | info.setTagsList(wxCUserTagsService.findTagList(getTenantId(), ids)); | ||||
| } | } | ||||
| @@ -222,11 +237,23 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", page); | return new ResultData(Result.SUCCESS, "查询成功", page); | ||||
| } | } | ||||
| @RequestMapping("/exportData") | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response) { | |||||
| @ApiOperation("会员记录导出") | |||||
| @GetMapping("/exportData") | |||||
| public void exportData(@ModelAttribute WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::exportData"); | logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::exportData"); | ||||
| if(basicInfo == null) { | |||||
| basicInfo = new WxCUserBasicInfo(); | |||||
| } else { | |||||
| if (StringUtils.isBlank(basicInfo.getPhone())) { | |||||
| basicInfo.setPhone(null); | |||||
| } | |||||
| if (StringUtils.isBlank(basicInfo.getName())) { | |||||
| basicInfo.setName(null); | |||||
| } | |||||
| } | |||||
| wxCUserBasicInfoService.exportData(request, response, getTenantId()); | |||||
| basicInfo.setTenantId(getTenantId()); | |||||
| wxCUserBasicInfoService.exportData(basicInfo, request, response); | |||||
| } | } | ||||
| @@ -238,31 +265,106 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { | |||||
| @Override | |||||
| public Object importHandler(CUserBaseInfoT obj, String name, Object value) { | |||||
| if (value == null) { | |||||
| value = ""; | |||||
| } | |||||
| System.out.println(name + " + " + value.toString()); | |||||
| return super.importHandler(obj, name, value); | |||||
| } | |||||
| } | |||||
| @RequestMapping("/importTemplate") | @RequestMapping("/importTemplate") | ||||
| public ResultData importTemplate(@RequestParam("file") MultipartFile file) { | public ResultData importTemplate(@RequestParam("file") MultipartFile file) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::importTemplate"); | logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::importTemplate"); | ||||
| if (file.isEmpty()) { | if (file.isEmpty()) { | ||||
| throw new MallinkException(500, "上传文件不能为空"); | |||||
| throw new MallinkException(Result.ERROR, "上传文件不能为空"); | |||||
| } | } | ||||
| //得到当前用户ID | //得到当前用户ID | ||||
| String userId = getUser().getId().toString(); | |||||
| final MallUserInfo user = getUser(); | |||||
| String userId = "" + user.getId(); | |||||
| String importKey = importMemPrev + userId; | |||||
| //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 | //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 | ||||
| Boolean allCount = stringRedisTemplate.opsForHash().hasKey(userId, "allCount"); | |||||
| Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); | |||||
| if (allCount) { | if (allCount) { | ||||
| return new ResultData(Result.SUCCESS, "模板正在导入"); | return new ResultData(Result.SUCCESS, "模板正在导入"); | ||||
| } | } | ||||
| stringRedisTemplate.opsForHash().putIfAbsent(userId, "allCount", 0 + ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(userId, "allSuccessCount", 0 + ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(userId, "successCount", ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(userId, "failCount", ""); | |||||
| wxCUserBasicInfoService.importTemplate(file, getTenantId(), userId); | |||||
| stringRedisTemplate.expire(userId,30,TimeUnit.MINUTES); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", 0 + ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", ""); | |||||
| stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); | |||||
| ImportParams params = new ImportParams(); | |||||
| // 需要验证 | |||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||||
| IExcelDataHandler<CUserBaseInfoT> handler = new UserExcelHandler(); | |||||
| handler.setNeedHandlerFields(new String[] { "手机号" }); | |||||
| params.setNeedVerify(true); | |||||
| ExcelImportResult<CUserBaseInfoT> datalist = null; | |||||
| try { | |||||
| datalist = ExcelImportUtil.importExcelMore(file.getInputStream(), CUserBaseInfoT.class, params); | |||||
| } catch (Exception e) { | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allCount", "1"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "processCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "failCount", "1"); | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.MEM_IMPORT_ERR); | |||||
| } | |||||
| if(datalist == null) { | |||||
| logger.error("导入模板失败: 模板数据解析失败"); | |||||
| return new ResultData(ErrorCode.MEM_IMPORT_ERR); | |||||
| } | |||||
| List<CUserBaseInfoT> successList = datalist.getList(); | |||||
| List<CUserBaseInfoT> failList = datalist.getFailList(); | |||||
| int total = successList.size() + failList.size(); | |||||
| int all_success = successList.size(); | |||||
| int all_fail = failList.size(); | |||||
| //添加到redis里 | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + total); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "" + all_success); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "processCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "failCount", "" + all_fail); | |||||
| logger.info("验证通过的数量: " + successList.size()); | |||||
| logger.info("验证未通过的数量: " + failList.size()); | |||||
| WxTags wxTagsQ = new WxTags(); | |||||
| List<WxTags> tagList = wxTagsService.findList(wxTagsQ); | |||||
| final String tenantId = getTenantId(); | |||||
| try { | |||||
| successList.parallelStream().forEach(uBase -> { | |||||
| // 异步无法获取到原有的session,所以再注入一下session | |||||
| Session session = SecurityUtils.getSubject().getSession(); | |||||
| session.setAttribute(UserSession.userInfo, user); | |||||
| session.setAttribute(UserSession.userId, user.getId()); | |||||
| session.setAttribute(UserSession.tenantId, tenantId); | |||||
| wxCUserBasicInfoService.importOneMem(tenantId, importKey, tagList, uBase); | |||||
| }); | |||||
| } catch (Exception e) { | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + all_fail); | |||||
| e.printStackTrace(); | |||||
| logger.error("导入模板失败:"+e.getMessage()); | |||||
| } | |||||
| stringRedisTemplate.expire(importKey,30,TimeUnit.MINUTES); | |||||
| return new ResultData(Result.SUCCESS, "模板正在导入"); | return new ResultData(Result.SUCCESS, "模板正在导入"); | ||||
| } | } | ||||
| @GetMapping("/queryTemplateCount") | @GetMapping("/queryTemplateCount") | ||||
| public ResultData queryTemplateCount() { | public ResultData queryTemplateCount() { | ||||
| String importKey = "import-" + getUser().getId(); | |||||
| String importKey = importMemPrev + getUser().getId(); | |||||
| Map entries = stringRedisTemplate.opsForHash().entries(importKey); | Map entries = stringRedisTemplate.opsForHash().entries(importKey); | ||||
| logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1"); | logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1"); | ||||
| if (entries.size() < 4) { | if (entries.size() < 4) { | ||||
| @@ -271,7 +373,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| String allCount = entries.get("allCount").toString(); | String allCount = entries.get("allCount").toString(); | ||||
| String allSuccessCount = entries.get("allSuccessCount").toString(); | String allSuccessCount = entries.get("allSuccessCount").toString(); | ||||
| String successCount = entries.get("successCount").toString(); | |||||
| String processCount = entries.get("processCount").toString(); | |||||
| String failCount = entries.get("failCount").toString(); | String failCount = entries.get("failCount").toString(); | ||||
| if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); | if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); | ||||
| @@ -279,16 +381,16 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| //完全失败 | //完全失败 | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "allCount"); | stringRedisTemplate.opsForHash().delete(importKey, "allCount"); | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); | stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "successCount"); | |||||
| stringRedisTemplate.opsForHash().delete(importKey, "processCount"); | |||||
| stringRedisTemplate.opsForHash().delete(importKey, "failCount"); | stringRedisTemplate.opsForHash().delete(importKey, "failCount"); | ||||
| return new ResultData(ErrorCode.MEM_IMPORT_ERR); | return new ResultData(ErrorCode.MEM_IMPORT_ERR); | ||||
| } | } | ||||
| //导入完成 | //导入完成 | ||||
| if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(successCount)) { | |||||
| if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(processCount)) { | |||||
| ResultData ok = new ResultData(Result.SUCCESS, "ok", entries); | ResultData ok = new ResultData(Result.SUCCESS, "ok", entries); | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "allCount"); | stringRedisTemplate.opsForHash().delete(importKey, "allCount"); | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); | stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); | ||||
| stringRedisTemplate.opsForHash().delete(importKey, "successCount"); | |||||
| stringRedisTemplate.opsForHash().delete(importKey, "processCount"); | |||||
| stringRedisTemplate.opsForHash().delete(importKey, "failCount"); | stringRedisTemplate.opsForHash().delete(importKey, "failCount"); | ||||
| return ok; | return ok; | ||||
| } | } | ||||
| @@ -59,7 +59,12 @@ public class WxCardPayController extends BaseController { | |||||
| public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | ||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("cardPay/cardOrderList: " + ipStr); | logger.info("cardPay/cardOrderList: " + ipStr); | ||||
| if (wxCardVo == null) wxCardVo = new WxCardVo(); | |||||
| if (wxCardVo == null) {wxCardVo = new WxCardVo();} | |||||
| else { | |||||
| if(StringUtils.isBlank(wxCardVo.getOuPhone())) { | |||||
| wxCardVo.setOuPhone(null); | |||||
| } | |||||
| } | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCardVo.setTenantId(user.getTenantId()); | wxCardVo.setTenantId(user.getTenantId()); | ||||
| if(StringUtils.isNotBlank(wxCardVo.getStatusStr())) { | if(StringUtils.isNotBlank(wxCardVo.getStatusStr())) { | ||||
| @@ -96,7 +96,7 @@ public class WxMerchantController extends BaseController { | |||||
| public ResultData addMerchant(@RequestBody WxMerchant wxMerchant) { | public ResultData addMerchant(@RequestBody WxMerchant wxMerchant) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | ||||
| wxMerchant.setTenantId(getTenantId()); | wxMerchant.setTenantId(getTenantId()); | ||||
| return wxMerchantService.addMerchant(wxMerchant); | |||||
| return wxMerchantService.addMerchant(wxMerchant, getUser().getId()); | |||||
| } | } | ||||
| @ApiOperation("更新商户接口") | @ApiOperation("更新商户接口") | ||||
| @@ -45,14 +45,14 @@ public class WxPropertyContractController extends BaseController | |||||
| public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData add(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::add"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | public ResultData update(@RequestBody WxPropertyContract wxPropertyContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | logger.debug("[" + getIpAddr() + "] WxPropertyContractController::update"); | ||||
| wxPropertyContract.setTenantId(getTenantId()); | wxPropertyContract.setTenantId(getTenantId()); | ||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract); | |||||
| return wxPropertyContractService.saveOrUpdate(wxPropertyContract, getUser().getId()); | |||||
| } | } | ||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @@ -44,28 +44,28 @@ public class WxRentContractController extends BaseController { | |||||
| public ResultData add(@RequestBody WxRentContract wxRentContract) { | public ResultData add(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| return wxRentContractService.save(wxRentContract); | |||||
| return wxRentContractService.save(wxRentContract, getUser().getId()); | |||||
| } | } | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | public ResultData update(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| return wxRentContractService.update(wxRentContract); | |||||
| return wxRentContractService.update(wxRentContract, getUser().getId()); | |||||
| } | } | ||||
| @PostMapping("updateMoney") | @PostMapping("updateMoney") | ||||
| public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| return wxRentContractService.update(wxRentContract); | |||||
| return wxRentContractService.update(wxRentContract, getUser().getId()); | |||||
| } | } | ||||
| @PostMapping("updateFile") | @PostMapping("updateFile") | ||||
| public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); | ||||
| wxRentContract.setTenantId(getTenantId()); | wxRentContract.setTenantId(getTenantId()); | ||||
| return wxRentContractService.updateFile(wxRentContract); | |||||
| return wxRentContractService.updateFile(wxRentContract, getUser().getId()); | |||||
| } | } | ||||
| @@ -130,7 +130,7 @@ public class WxRentContractController extends BaseController { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData updateRentContractStatus(Long id) { | public ResultData updateRentContractStatus(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | logger.debug("[" + getIpAddr() + "] WxRentContractController::updateRentContractStatus"); | ||||
| return wxRentContractService.updateRentContractStatus(id); | |||||
| return wxRentContractService.updateRentContractStatus(id, getUser().getId()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.interceptor; | package com.iformall.interceptor; | ||||
| import com.iformall.utils.UrlCheck; | |||||
| import javax.servlet.*; | import javax.servlet.*; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| @@ -17,13 +19,8 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||||
| ServletRequest requestWrapper = null; | ServletRequest requestWrapper = null; | ||||
| if (request instanceof HttpServletRequest) { | if (request instanceof HttpServletRequest) { | ||||
| String url = ((HttpServletRequest) request).getRequestURI(); | String url = ((HttpServletRequest) request).getRequestURI(); | ||||
| if (!url.contains("awsFileUpload") | |||||
| && !url.contains("cimgUpload") | |||||
| && !url.contains("ueditor/exec") | |||||
| && !url.contains("/wxCUserBasicInfo/importTemplate")) { | |||||
| if (!UrlCheck.checkUrl(url)) { | |||||
| requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request); | ||||
| } else { | |||||
| requestWrapper = null; | |||||
| } | } | ||||
| } | } | ||||
| if (null == requestWrapper) { | if (null == requestWrapper) { | ||||
| @@ -34,6 +31,7 @@ public class HttpServletRequestWrapperFilter implements Filter { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void destroy() { | public void destroy() { | ||||
| @@ -4,6 +4,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.utils.HashUtil; | import com.iformall.utils.HashUtil; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import com.iformall.utils.UrlCheck; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.data.redis.core.RedisTemplate; | import org.springframework.data.redis.core.RedisTemplate; | ||||
| @@ -43,11 +44,7 @@ public class RequestInterceptor extends HandlerInterceptorAdapter { | |||||
| String ipaddress = IPUtil.getIpAddr(request); | String ipaddress = IPUtil.getIpAddr(request); | ||||
| String url = request.getRequestURL().toString(); | String url = request.getRequestURL().toString(); | ||||
| if(url.contains("pvlog") | |||||
| || url.contains("awsFileUpload") | |||||
| || url.contains("cimgUpload") | |||||
| || url.contains("ueditor/exec") | |||||
| || url.contains("/wxCUserBasicInfo/importTemplate")) { | |||||
| if (UrlCheck.checkUrl(url)) { | |||||
| // pvlog不检查幂等 | // pvlog不检查幂等 | ||||
| // awsFileUpload不检查幂等 | // awsFileUpload不检查幂等 | ||||
| // ueditor 不检查幂等 | // ueditor 不检查幂等 | ||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.utils; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class UrlCheck { | |||||
| public static boolean checkUrl(String url) { | |||||
| return url.contains("awsFileUpload") | |||||
| || url.contains("cimgUpload") | |||||
| || url.contains("ueditor/exec") | |||||
| || url.contains("/wxCUserBasicInfo/importTemplate") | |||||
| || url.contains("wxMsgCallback") | |||||
| || url.contains("notify") | |||||
| || url.contains("pvlog"); | |||||
| } | |||||
| } | |||||
| @@ -10,7 +10,6 @@ import com.iformall.enums.EnumCampaignStatus; | |||||
| import com.iformall.enums.EnumCouponChannelType; | import com.iformall.enums.EnumCouponChannelType; | ||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| import com.iformall.service.WxCouponChannelService; | import com.iformall.service.WxCouponChannelService; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -38,8 +37,6 @@ public class WxCampaignController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCampaignService wxCampaignService; | private WxCampaignService wxCampaignService; | ||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| private WxCouponChannelService wxCouponChannelService; | private WxCouponChannelService wxCouponChannelService; | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @@ -53,7 +50,7 @@ public class WxCampaignController extends BaseController { | |||||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCampaign.setTenantId(getTenantId()); | wxCampaign.setTenantId(getTenantId()); | ||||
| wxCampaign.setSortColumns(SortNum_ASC, CreateTime_ASC); | wxCampaign.setSortColumns(SortNum_ASC, CreateTime_ASC); | ||||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | |||||
| final PageInfo<WxCampaign> page = wxCampaignService.clistAsPage(wxCampaign, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.service.WxMerchantService; | |||||
| import com.iformall.utils.HashUtil; | import com.iformall.utils.HashUtil; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -34,9 +35,13 @@ public class WxMerchantController extends BaseController { | |||||
| if(merchantCode == null) { | if(merchantCode == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| String codeMD5 = HashUtil.DecodeByMD5(merchantCode); | |||||
| if(StringUtils.isBlank(codeMD5)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| HashMap<String, String> params = new HashMap<String, String>(); | HashMap<String, String> params = new HashMap<String, String>(); | ||||
| params.put("tenantId", getTenantId()); | params.put("tenantId", getTenantId()); | ||||
| params.put("merchantCode", HashUtil.DecodeByMD5(merchantCode)); | |||||
| params.put("merchantCode", codeMD5); | |||||
| WxMerchantVo wxMerchant = wxMerchantService.getMerchantInfo(params); | WxMerchantVo wxMerchant = wxMerchantService.getMerchantInfo(params); | ||||
| return new ResultData(wxMerchant); | return new ResultData(wxMerchant); | ||||
| } | } | ||||
| @@ -253,7 +253,7 @@ public enum ErrorCode{ | |||||
| /** | /** | ||||
| * 会员 | * 会员 | ||||
| */ | */ | ||||
| MEM_IMPORT_ERR(13000, "模板导入失败,请尝试重新导入"), | |||||
| MEM_IMPORT_ERR(13000, "模板导入失败,请检查数据,尝试重新导入"), | |||||
| MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"), | MEM_SCORE_NOT_ENOUGH(13001, "成长值不够扣减值"), | ||||
| /** | /** | ||||
| @@ -4,6 +4,7 @@ package com.iformall.enums; | |||||
| * Created by Stormeye on 2018/08/09. | * Created by Stormeye on 2018/08/09. | ||||
| */ | */ | ||||
| public enum EnumMsgSendStatus { | public enum EnumMsgSendStatus { | ||||
| MSG_SENDING(2, "发送中"), | |||||
| MSG_SEND_SUCCESS(1,"发送成功"), | MSG_SEND_SUCCESS(1,"发送成功"), | ||||
| MSG_SEND_FAIL(0,"发送失败") | MSG_SEND_FAIL(0,"发送失败") | ||||
| ; | ; | ||||
| @@ -9,6 +9,8 @@ public interface WxCampaignMapper extends CommonMapper<WxCampaign, Long> { | |||||
| List<WxCampaign> findList(WxCampaign wxCampaign); | List<WxCampaign> findList(WxCampaign wxCampaign); | ||||
| List<WxCampaign> findCList(WxCampaign wxCampaign); | |||||
| int getMaxSortNum(String tenantId); | int getMaxSortNum(String tenantId); | ||||
| @@ -1,10 +1,10 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| import com.iformall.domain.po.WxTags; | |||||
| import com.iformall.domain.vo.CUserBaseInfoT; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -99,11 +99,11 @@ public interface WxCUserBasicInfoService { | |||||
| long findCountByScore(WxCUserBasicInfoDto dto); | long findCountByScore(WxCUserBasicInfoDto dto); | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | |||||
| void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response); | |||||
| void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); | void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); | ||||
| ResultData importTemplate(MultipartFile file, String tenantId, String userId); | |||||
| void importOneMem(String tenantId, String importKey, List<WxTags> tagList, CUserBaseInfoT uBase); | |||||
| long findCount(WxCUserBasicInfoDto dto); | long findCount(WxCUserBasicInfoDto dto); | ||||
| @@ -8,15 +8,23 @@ import javax.servlet.http.HttpServletResponse; | |||||
| public interface WxCampaignService { | public interface WxCampaignService { | ||||
| /** | |||||
| /** | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | |||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize); | PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCampaign> clistAsPage(WxCampaign record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -65,7 +65,7 @@ public interface WxMerchantService { | |||||
| void disable(Long id); | void disable(Long id); | ||||
| ResultData addMerchant(WxMerchant wxMerchant); | |||||
| ResultData addMerchant(WxMerchant wxMerchant, Long userId); | |||||
| ResultData updateMerchant(WxMerchant wxMerchant); | ResultData updateMerchant(WxMerchant wxMerchant); | ||||
| @@ -35,7 +35,7 @@ public interface WxPropertyContractService { | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| ResultData saveOrUpdate(WxPropertyContract record); | |||||
| ResultData saveOrUpdate(WxPropertyContract record, Long userId); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -34,10 +34,11 @@ public interface WxRentContractService { | |||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param id | |||||
| */ | */ | ||||
| ResultData save(WxRentContract record); | |||||
| ResultData save(WxRentContract record, Long userId); | |||||
| ResultData update(WxRentContract record); | |||||
| ResultData update(WxRentContract record, Long userId); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -59,9 +60,9 @@ public interface WxRentContractService { | |||||
| void exportContract(HttpServletRequest request, HttpServletResponse response, String tenantId, Long id); | void exportContract(HttpServletRequest request, HttpServletResponse response, String tenantId, Long id); | ||||
| ResultData updateFile(WxRentContract wxRentContract); | |||||
| ResultData updateFile(WxRentContract wxRentContract, Long userId); | |||||
| ResultData updateRentContractStatus(Long id); | |||||
| ResultData updateRentContractStatus(Long id, Long userId); | |||||
| void updateApplyStatus(WxRentContract wxRentContract); | void updateApplyStatus(WxRentContract wxRentContract); | ||||
| @@ -6,7 +6,6 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillDaily; | import com.iformall.domain.po.WxBillDaily; | ||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.enums.EnumBillDailyStatus; | import com.iformall.enums.EnumBillDailyStatus; | ||||
| @@ -16,7 +15,6 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxBillDailyMapper; | import com.iformall.mapper.WxBillDailyMapper; | ||||
| import com.iformall.mapper.WxShopMapper; | import com.iformall.mapper.WxShopMapper; | ||||
| import com.iformall.service.WxBillDailyService; | import com.iformall.service.WxBillDailyService; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -117,7 +115,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(),"实收金额不能大于实际应收金额"); | return new ResultData(ErrorCode.BILL_PAY_ERROR.getCode(),"实收金额不能大于实际应收金额"); | ||||
| } | } | ||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| logger.info("新增日常账单"); | logger.info("新增日常账单"); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -126,7 +123,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| record.setStatus(record.getReceiveDate().after(date)?EnumBillDailyStatus.WAIT_PAY.getCode():EnumBillDailyStatus.NOT_PAID.getCode()); | record.setStatus(record.getReceiveDate().after(date)?EnumBillDailyStatus.WAIT_PAY.getCode():EnumBillDailyStatus.NOT_PAID.getCode()); | ||||
| record.setCreatetime(date); | record.setCreatetime(date); | ||||
| record.setUpdatetime(date); | record.setUpdatetime(date); | ||||
| record.setUserId(user.getId()); | |||||
| record.setExpiredDay(0L); | record.setExpiredDay(0L); | ||||
| record.setOwe(record.getReceivePay()-record.getPay()); | record.setOwe(record.getReceivePay()-record.getPay()); | ||||
| record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| @@ -149,7 +145,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||||
| wxBillDaily.setOwe(record.getReceivePay()-record.getPay()); | wxBillDaily.setOwe(record.getReceivePay()-record.getPay()); | ||||
| wxBillDaily.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillDaily.getStatus()); | wxBillDaily.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillDaily.getStatus()); | ||||
| wxBillDaily.setUpdatetime(new Date()); | wxBillDaily.setUpdatetime(new Date()); | ||||
| wxBillDaily.setUserId(user.getId()); | |||||
| try { | try { | ||||
| wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | wxBillDailyMapper.updateByPrimaryKeySelective(wxBillDaily); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -6,7 +6,6 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxBillOther; | import com.iformall.domain.po.WxBillOther; | ||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.enums.EnumBillDailyStatus; | import com.iformall.enums.EnumBillDailyStatus; | ||||
| @@ -16,7 +15,6 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxBillOtherMapper; | import com.iformall.mapper.WxBillOtherMapper; | ||||
| import com.iformall.mapper.WxShopMapper; | import com.iformall.mapper.WxShopMapper; | ||||
| import com.iformall.service.WxBillOtherService; | import com.iformall.service.WxBillOtherService; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -116,7 +114,6 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||||
| if(pay>receivepay){ | if(pay>receivepay){ | ||||
| return new ResultData(ErrorCode.BILL_PAY_ERROR,"实收金额不能大于实际应收金额"); | return new ResultData(ErrorCode.BILL_PAY_ERROR,"实收金额不能大于实际应收金额"); | ||||
| } | } | ||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| logger.info("新增其他账单"); | logger.info("新增其他账单"); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -125,7 +122,6 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||||
| record.setStatus(record.getReceiveDate().after(date)?EnumBillDailyStatus.WAIT_PAY.getCode():EnumBillDailyStatus.NOT_PAID.getCode()); | record.setStatus(record.getReceiveDate().after(date)?EnumBillDailyStatus.WAIT_PAY.getCode():EnumBillDailyStatus.NOT_PAID.getCode()); | ||||
| record.setCreatetime(date); | record.setCreatetime(date); | ||||
| record.setUpdatetime(date); | record.setUpdatetime(date); | ||||
| record.setUserId(user.getId()); | |||||
| record.setExpiredDay(0L); | record.setExpiredDay(0L); | ||||
| record.setOwe(record.getReceivePay()-record.getPay()); | record.setOwe(record.getReceivePay()-record.getPay()); | ||||
| record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | record.setIsDel(EnumDelStatus.NOT_DEL.getCode()); | ||||
| @@ -148,7 +144,6 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||||
| wxBillOther.setOwe(record.getReceivePay()-record.getPay()); | wxBillOther.setOwe(record.getReceivePay()-record.getPay()); | ||||
| wxBillOther.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOther.getStatus()); | wxBillOther.setStatus(record.getPay().equals(record.getReceivePay()) ? EnumBillDailyStatus.PAID.getCode() : wxBillOther.getStatus()); | ||||
| wxBillOther.setUpdatetime(new Date()); | wxBillOther.setUpdatetime(new Date()); | ||||
| wxBillOther.setUserId(user.getId()); | |||||
| try { | try { | ||||
| wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | wxBillOtherMapper.updateByPrimaryKeySelective(wxBillOther); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -1,19 +1,12 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import cn.afterturn.easypoi.excel.ExcelImportUtil; | |||||
| import cn.afterturn.easypoi.excel.entity.ImportParams; | |||||
| import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; | |||||
| import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; | |||||
| import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.WxCUser; | import com.iformall.domain.po.WxCUser; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
| import com.iformall.domain.po.WxCUserTags; | |||||
| import com.iformall.domain.po.WxTags; | import com.iformall.domain.po.WxTags; | ||||
| import com.iformall.domain.vo.CUserBaseInfoT; | import com.iformall.domain.vo.CUserBaseInfoT; | ||||
| import com.iformall.domain.vo.CUserBaseVo; | import com.iformall.domain.vo.CUserBaseVo; | ||||
| @@ -39,9 +32,7 @@ import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.redis.core.StringRedisTemplate; | import org.springframework.data.redis.core.StringRedisTemplate; | ||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.web.multipart.MultipartFile; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -153,10 +144,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||||
| WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | |||||
| basicInfoQ.setTenantId(tenantId); | |||||
| List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfoQ); | |||||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||||
| XSSFWorkbook workbook; | XSSFWorkbook workbook; | ||||
| String filepath = Constant.fileDirectory; | String filepath = Constant.fileDirectory; | ||||
| @@ -500,163 +489,126 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| return userBase; | return userBase; | ||||
| } | } | ||||
| private class UserExcelHandler extends ExcelDataHandlerDefaultImpl<CUserBaseInfoT> { | |||||
| @Override | |||||
| public Object importHandler(CUserBaseInfoT obj, String name, Object value) { | |||||
| if (value == null) { | |||||
| value = ""; | |||||
| } | |||||
| System.out.println(name + " + " + value.toString()); | |||||
| return super.importHandler(obj, name, value); | |||||
| } | |||||
| } | |||||
| @Async | |||||
| @Override | @Override | ||||
| public ResultData importTemplate(MultipartFile file, String tenantId, String userId) { | |||||
| public void importOneMem(String tenantId, String importKey, List<WxTags> tagList, CUserBaseInfoT uBase) { | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| String importKey = "import-" + userId; | |||||
| //默认添加到redis里 | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allCount", ""); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "successCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "failCount", "0"); | |||||
| ImportParams params = new ImportParams(); | |||||
| // 需要验证 | |||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值"}); | |||||
| params.setNeedVerify(true); | |||||
| try { | |||||
| ExcelImportResult<CUserBaseInfoT> datalist = ExcelImportUtil.importExcelMore(file.getInputStream(), CUserBaseInfoT.class, params); | |||||
| List<CUserBaseInfoT> successList = datalist.getList(); | |||||
| List<CUserBaseInfoT> failList = datalist.getFailList(); | |||||
| logger.info("验证通过的数量: " + successList.size()); | |||||
| logger.info("验证未通过的数量: " + failList.size()); | |||||
| successList.parallelStream().forEach(uBase->{ | |||||
| if (StringUtils.isBlank(uBase.getPhone())) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||||
| logger.error("手机号为空", uBase.toString()); | |||||
| return; | |||||
| } | |||||
| WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId); | |||||
| if (userBase == null) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||||
| logger.error("userBase为null", uBase.toString()); | |||||
| return; | |||||
| } | |||||
| if (StringUtils.isBlank(uBase.getPhone())) { | |||||
| logger.error("手机号为空", uBase.toString()); | |||||
| return; | |||||
| } | |||||
| WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId); | |||||
| if (userBase == null) { | |||||
| return; | |||||
| } | |||||
| WxCUserBasicInfo oldUserBase = null; | |||||
| WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); | |||||
| userBaseQ.setTenantId(tenantId); | |||||
| userBaseQ.setPhone(userBase.getPhone()); | |||||
| List<WxCUserBasicInfo> userBList = wxCUserBasicInfoMapper.select(userBaseQ); | |||||
| if (userBList.size() > 0) { | |||||
| oldUserBase = userBList.get(0); | |||||
| } | |||||
| WxCUserBasicInfo oldUserBase = null; | |||||
| WxCUserBasicInfo userBaseQ = new WxCUserBasicInfo(); | |||||
| userBaseQ.setTenantId(tenantId); | |||||
| userBaseQ.setPhone(userBase.getPhone()); | |||||
| List<WxCUserBasicInfo> userBList = wxCUserBasicInfoMapper.select(userBaseQ); | |||||
| if (userBList.size() > 0) { | |||||
| oldUserBase = userBList.get(0); | |||||
| } | |||||
| if (oldUserBase != null) { | |||||
| oldUserBase.setName(userBase.getName()); | |||||
| oldUserBase.setSex(userBase.getSex()); | |||||
| oldUserBase.setNickName(userBase.getNickName()); | |||||
| oldUserBase.setEducation(userBase.getEducation()); | |||||
| oldUserBase.setBirthdate(userBase.getBirthdate()); | |||||
| oldUserBase.setAddress(userBase.getAddress()); | |||||
| oldUserBase.setUpdateDate(new Date()); | |||||
| oldUserBase.setCreateDate(userBase.getCreateDate()); | |||||
| } else { | |||||
| userBase.setId(idWorker.nextId()); | |||||
| } | |||||
| if (oldUserBase != null) { | |||||
| oldUserBase.setName(userBase.getName()); | |||||
| oldUserBase.setSex(userBase.getSex()); | |||||
| oldUserBase.setNickName(userBase.getNickName()); | |||||
| oldUserBase.setEducation(userBase.getEducation()); | |||||
| oldUserBase.setBirthdate(userBase.getBirthdate()); | |||||
| oldUserBase.setAddress(userBase.getAddress()); | |||||
| oldUserBase.setUpdateDate(new Date()); | |||||
| oldUserBase.setCreateDate(userBase.getCreateDate()); | |||||
| } else { | |||||
| // check c_user 是否存在 | |||||
| WxCUser cUserQ = new WxCUser(); | |||||
| cUserQ.setTenantId(tenantId); | |||||
| cUserQ.setPhone(userBase.getPhone()); | |||||
| List<WxCUser> cUsers = wxCUserMapper.findList(cUserQ); | |||||
| if (cUsers.size() > 0) { | |||||
| WxCUser wUser = cUsers.get(0); | |||||
| if (wUser != null) { | |||||
| userBase.setId(wUser.getId()); | |||||
| userBase.setNickName(wUser.getNickName()); | |||||
| // update 昵称 | |||||
| { | |||||
| // check c_user 是否存在 | |||||
| WxCUser cUserQ = new WxCUser(); | |||||
| cUserQ.setTenantId(tenantId); | |||||
| cUserQ.setPhone(userBase.getPhone()); | |||||
| List<WxCUser> userList = wxCUserMapper.select(cUserQ); | |||||
| if (userList.size() > 0) { | |||||
| WxCUser user = userList.get(0); | |||||
| if (user != null) { | |||||
| if (oldUserBase != null) { | |||||
| if(oldUserBase != null) { | |||||
| oldUserBase.setNickName(user.getNickName()); | |||||
| } | } | ||||
| userBase.setId(user.getId()); | |||||
| userBase.setNickName(user.getNickName()); | |||||
| } else { | } else { | ||||
| userBase.setId(idWorker.nextId()); | |||||
| userBase.setNickName(user.getNickName()); | |||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } | |||||
| // update 昵称 | |||||
| if (oldUserBase != null) { | |||||
| WxCUser cUserQ = new WxCUser(); | |||||
| cUserQ.setTenantId(tenantId); | |||||
| cUserQ.setPhone(userBase.getPhone()); | |||||
| List<WxCUser> userList = wxCUserMapper.select(cUserQ); | |||||
| if (userList.size() > 0) { | |||||
| WxCUser user = userList.get(0); | |||||
| if (user != null) { | |||||
| if (oldUserBase != null) { | |||||
| oldUserBase.setNickName(user.getNickName()); | |||||
| } else { | |||||
| userBase.setNickName(user.getNickName()); | |||||
| } | |||||
| if (oldUserBase != null) { | |||||
| logger.info("update user base: " + oldUserBase.getId()); | |||||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(oldUserBase); | |||||
| } else { | |||||
| logger.info("insert user base: " + userBase.getId()); | |||||
| try { | |||||
| wxCUserBasicInfoMapper.insertSelective(userBase); | |||||
| } catch (Exception e) { | |||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||||
| logger.error(e.getMessage()); | |||||
| return; | |||||
| } | |||||
| } | |||||
| // update tags | |||||
| try { | |||||
| if (StringUtils.isNotBlank(userBase.getTagNames())) { | |||||
| // get tag ids | |||||
| String tagNames = userBase.getTagNames(); | |||||
| List<Long> tagIdList = new ArrayList<>(); | |||||
| for (String tagName : tagNames.split("/")) { | |||||
| for(WxTags tag: tagList) { | |||||
| if(tagName.equals(tag.getName())) { | |||||
| tagIdList.add(Long.valueOf(tag.getId())); | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (oldUserBase != null) { | |||||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(oldUserBase); | |||||
| } else { | |||||
| wxCUserBasicInfoMapper.insertSelective(userBase); | |||||
| if (oldUserBase != null){ | |||||
| wxCUserTagsService.assignTags(tagIdList,oldUserBase); | |||||
| }else{ | |||||
| wxCUserTagsService.assignTags(tagIdList,userBase); | |||||
| } | } | ||||
| // update tags | |||||
| if (StringUtils.isNotBlank(userBase.getTagNames())) { | |||||
| // get tag ids | |||||
| String tagNames = userBase.getTagNames(); | |||||
| List<Long> tagIdList = new ArrayList<>(); | |||||
| for (String tagName : tagNames.split("/")) { | |||||
| List<WxTags> wxTagsList = wxTagsMapper.getByName(tagName); | |||||
| if (wxTagsList.size()==1) { | |||||
| WxTags wxTags = wxTagsList.get(0); | |||||
| tagIdList.add(Long.valueOf(wxTags.getId())); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (oldUserBase != null){ | |||||
| wxCUserTagsService.assignTags(tagIdList,oldUserBase); | |||||
| }else{ | |||||
| wxCUserTagsService.assignTags(tagIdList,userBase); | |||||
| } | |||||
| } | |||||
| //触发自动打标签 | |||||
| if (oldUserBase != null) { | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT,oldUserBase); | |||||
| } | |||||
| else{ | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT,userBase); | |||||
| } | |||||
| //触发自动打标签 | |||||
| // 成长值 | |||||
| if (StringUtils.isNotBlank(uBase.getPoins())) { | |||||
| if (oldUserBase != null) { | if (oldUserBase != null) { | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT,oldUserBase); | |||||
| } | |||||
| else{ | |||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT,userBase); | |||||
| } | |||||
| // 成长值 | |||||
| if (StringUtils.isNotBlank(uBase.getPoins())) { | |||||
| if (oldUserBase != null) { | |||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, oldUserBase, uBase.getPoins()); | |||||
| } else { | |||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, userBase, uBase.getPoins()); | |||||
| } | |||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, oldUserBase, uBase.getPoins()); | |||||
| } else { | |||||
| wxScoreRulesService.addScore2(EnumScoreType.MEM_IMPORT, userBase, uBase.getPoins()); | |||||
| } | } | ||||
| //记数 | |||||
| stringRedisTemplate.opsForHash().increment(userId,"successCount",1); | |||||
| }); | |||||
| } | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| stringRedisTemplate.opsForHash().put(importKey, "allCount", "1"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "successCount", "0"); | |||||
| stringRedisTemplate.opsForHash().put(importKey, "failCount", "1"); | |||||
| e.printStackTrace(); | |||||
| logger.error("导入模板失败:"+e.getMessage()); | |||||
| logger.error(e.getMessage()); | |||||
| logger.error("打标签+成长值失败--继续导入"); | |||||
| } | } | ||||
| return new ResultData(); | |||||
| //记数 | |||||
| stringRedisTemplate.opsForHash().increment(importKey,"processCount",1); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -56,6 +56,11 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCampaign> clistAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCampaignMapper.findCList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCampaign getById(Long id) { | public WxCampaign getById(Long id) { | ||||
| WxCampaign wxCampaign = wxCampaignMapper.selectByPrimaryKey(id); | WxCampaign wxCampaign = wxCampaignMapper.selectByPrimaryKey(id); | ||||
| @@ -116,18 +116,22 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| if(record.getType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | if(record.getType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | ||||
| record.getType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | record.getType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | ||||
| Integer subsidyType = record.getSubsidyType(); | Integer subsidyType = record.getSubsidyType(); | ||||
| Integer subsidyNum = record.getSubsidyNum(); | |||||
| if(subsidyType == null) { | if(subsidyType == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴类型"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴类型"); | ||||
| } | } | ||||
| if(subsidyNum == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴金额"); | |||||
| } | |||||
| if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { | if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { | ||||
| // 微信 立减 | // 微信 立减 | ||||
| if(record.getSubsidyNum() > record.getSalePrice()) { | |||||
| if(subsidyNum > record.getSalePrice()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | ||||
| } | } | ||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { | } else if(subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { | ||||
| // 线下补贴 | // 线下补贴 | ||||
| int subsidy_num = record.getPrice() - record.getSalePrice(); | int subsidy_num = record.getPrice() - record.getSalePrice(); | ||||
| if(record.getSubsidyNum() > subsidy_num) { | |||||
| if(subsidyNum > subsidy_num) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | ||||
| } | } | ||||
| } else if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { | } else if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { | ||||
| @@ -14,7 +14,6 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -220,6 +219,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxMerchantShopMapper.updateByPrimaryKeySelective(wxMerchantShop); | wxMerchantShopMapper.updateByPrimaryKeySelective(wxMerchantShop); | ||||
| //更新商铺状态 | //更新商铺状态 | ||||
| WxShop wxShop = new WxShop(); | WxShop wxShop = new WxShop(); | ||||
| wxShop.setTenantId(wxMerchant.getTenantId()); | |||||
| wxShop.setId(wxMerchantShop.getShopId()); | wxShop.setId(wxMerchantShop.getShopId()); | ||||
| wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); | wxShop.setStatus(EnumShopStatus.NOT_RENT.getCode()); | ||||
| wxShopMapper.updateByPrimaryKeySelective(wxShop); | wxShopMapper.updateByPrimaryKeySelective(wxShop); | ||||
| @@ -234,12 +234,14 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| //作废卡券 | //作废卡券 | ||||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | ||||
| wxCouponMerchant.setTenantId(wxMerchant.getTenantId()); | |||||
| wxCouponMerchant.setMerchantId(wxMerchant.getId()); | wxCouponMerchant.setMerchantId(wxMerchant.getId()); | ||||
| wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | ||||
| List<WxCouponMerchant> wxCouponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | List<WxCouponMerchant> wxCouponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant); | ||||
| List<Long> couponIds = wxCouponMerchantList.stream().map(cm->cm.getProductId()).collect(Collectors.toList()); | List<Long> couponIds = wxCouponMerchantList.stream().map(cm->cm.getProductId()).collect(Collectors.toList()); | ||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| couponIds.parallelStream().filter(cid->!isCouponMerchantValid(cid)).forEach(cid->{ | |||||
| couponIds.stream().filter(cid->!isCouponMerchantValid(cid)).forEach(cid->{ | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setId(cid); | wxCoupon.setId(cid); | ||||
| wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); | wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); | ||||
| wxCouponService.saveOrUpdate(wxCoupon); | wxCouponService.saveOrUpdate(wxCoupon); | ||||
| @@ -248,7 +250,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData addMerchant(WxMerchant wxMerchant) { | |||||
| public ResultData addMerchant(WxMerchant wxMerchant, Long userId) { | |||||
| try { | try { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -309,9 +311,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); | wxRentContract.setStatus(EnumRentContractStatus.SIGNED_RENT_UNPAID.getCode()); | ||||
| wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | wxRentContractMapper.updateByPrimaryKeySelective(wxRentContract); | ||||
| //创建账单 | //创建账单 | ||||
| buildRent(wxMerchant); | |||||
| buildRent(wxMerchant, userId); | |||||
| //创建押金 | //创建押金 | ||||
| buildDeposit(wxMerchant); | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | return new ResultData(Result.SUCCESS, "商户创建成功", merchantId); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -507,8 +509,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildDeposit(WxMerchant wxMerchant) { | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| public void buildDeposit(WxMerchant wxMerchant, Long userId) { | |||||
| WxRentContract wxRentContract = new WxRentContract(); | WxRentContract wxRentContract = new WxRentContract(); | ||||
| wxRentContract.setMerchantId(wxMerchant.getId()); | wxRentContract.setMerchantId(wxMerchant.getId()); | ||||
| List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | ||||
| @@ -555,7 +556,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | ||||
| wxBillDeposit.setIsDel(0); | wxBillDeposit.setIsDel(0); | ||||
| wxBillDeposit.setMerchantId(wxMerchant.getId()); | wxBillDeposit.setMerchantId(wxMerchant.getId()); | ||||
| wxBillDeposit.setUserId(user.getId()); | |||||
| wxBillDeposit.setUserId(userId); | |||||
| wxBillDeposit.setShopId(wxRentContract.getShopId()); | wxBillDeposit.setShopId(wxRentContract.getShopId()); | ||||
| wxBillDeposit.setCreatetime(date); | wxBillDeposit.setCreatetime(date); | ||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| @@ -569,10 +570,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildRent(WxMerchant wxMerchant) { | |||||
| public void buildRent(WxMerchant wxMerchant, Long userId) { | |||||
| //获取用户 | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| WxRentContract wxRentContract = new WxRentContract(); | WxRentContract wxRentContract = new WxRentContract(); | ||||
| wxRentContract.setMerchantId(wxMerchant.getId()); | wxRentContract.setMerchantId(wxMerchant.getId()); | ||||
| //根据商户ID找出合同 | //根据商户ID找出合同 | ||||
| @@ -653,7 +652,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| wxBillRent.setTenantId(wxRentContract.getTenantId()); | wxBillRent.setTenantId(wxRentContract.getTenantId()); | ||||
| wxBillRent.setIsDel(0); | wxBillRent.setIsDel(0); | ||||
| wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | wxBillRent.setMerchantId(wxRentContract.getMerchantId()); | ||||
| wxBillRent.setUserId(user.getId()); | |||||
| wxBillRent.setUserId(userId); | |||||
| wxBillRent.setShopId(wxRentContract.getShopId()); | wxBillRent.setShopId(wxRentContract.getShopId()); | ||||
| wxBillRent.setCreatetime(date); | wxBillRent.setCreatetime(date); | ||||
| wxBillRent.setUpdatetime(date); | wxBillRent.setUpdatetime(date); | ||||
| @@ -83,7 +83,11 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||||
| if(callback!=null){//有更新,无插入 | if(callback!=null){//有更新,无插入 | ||||
| callback.setSign(param.get("sign")); | callback.setSign(param.get("sign")); | ||||
| callback.setTenantId(tenantId); | callback.setTenantId(tenantId); | ||||
| callback.setStatus(wxMsgCallback.getStatus()); | |||||
| if (!wxMsgCallback.getStatus().equals(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode())) { | |||||
| callback.setStatus(EnumMsgSendStatus.MSG_SEND_FAIL.getCode()); | |||||
| } else { | |||||
| callback.setStatus(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode()); | |||||
| } | |||||
| callback.setStatusMsg(wxMsgCallback.getStatusMsg()); | callback.setStatusMsg(wxMsgCallback.getStatusMsg()); | ||||
| callback.setBegintime(wxMsgCallback.getBegintime()); | callback.setBegintime(wxMsgCallback.getBegintime()); | ||||
| callback.setEndtime(wxMsgCallback.getEndtime()); | callback.setEndtime(wxMsgCallback.getEndtime()); | ||||
| @@ -262,7 +262,8 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| wxMsgCallback.setTenantId(wxmsg.getTenantId()); | wxMsgCallback.setTenantId(wxmsg.getTenantId()); | ||||
| wxMsgCallback.setBatchNo(batchNo); | wxMsgCallback.setBatchNo(batchNo); | ||||
| wxMsgCallback.setMsgId(wxmsg.getId()); | wxMsgCallback.setMsgId(wxmsg.getId()); | ||||
| wxMsgCallback.setStatus(EnumMsgSendStatus.MSG_SEND_FAIL.getCode()); | |||||
| wxMsgCallback.setStatus(EnumMsgSendStatus.MSG_SENDING.getCode()); | |||||
| wxMsgCallback.setStatusMsg(EnumMsgSendStatus.MSG_SENDING.getMessage()); | |||||
| wxMsgCallback.setCreatetime(new Date()); | wxMsgCallback.setCreatetime(new Date()); | ||||
| wxMsgCallbackMapper.insertSelective(wxMsgCallback); | wxMsgCallbackMapper.insertSelective(wxMsgCallback); | ||||
| } | } | ||||
| @@ -15,7 +15,6 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxPropertyContractService; | import com.iformall.service.WxPropertyContractService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -100,7 +99,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData saveOrUpdate(WxPropertyContract record) { | |||||
| public ResultData saveOrUpdate(WxPropertyContract record, Long userId) { | |||||
| if (null == record.getShopId()) { | if (null == record.getShopId()) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "shopId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "shopId不能为空"); | ||||
| @@ -188,9 +187,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //物业账单 | //物业账单 | ||||
| buildProperty(wxMerchant); | |||||
| buildProperty(wxMerchant, userId); | |||||
| //物业押金账单 | //物业押金账单 | ||||
| buildDeposit(wxMerchant); | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | } | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -231,8 +230,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildDeposit(WxMerchant wxMerchant) { | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| public void buildDeposit(WxMerchant wxMerchant, Long userId) { | |||||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | WxPropertyContract wxPropertyContract = new WxPropertyContract(); | ||||
| wxPropertyContract.setMerchantId(wxMerchant.getId()); | wxPropertyContract.setMerchantId(wxMerchant.getId()); | ||||
| List<WxPropertyContract> list = wxPropertyContractMapper.findList(wxPropertyContract); | List<WxPropertyContract> list = wxPropertyContractMapper.findList(wxPropertyContract); | ||||
| @@ -276,7 +274,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | ||||
| wxBillDeposit.setIsDel(0); | wxBillDeposit.setIsDel(0); | ||||
| wxBillDeposit.setMerchantId(wxMerchant.getId()); | wxBillDeposit.setMerchantId(wxMerchant.getId()); | ||||
| wxBillDeposit.setUserId(user.getId()); | |||||
| wxBillDeposit.setUserId(userId); | |||||
| wxBillDeposit.setShopId(wxPropertyContract.getShopId()); | wxBillDeposit.setShopId(wxPropertyContract.getShopId()); | ||||
| wxBillDeposit.setCreatetime(date); | wxBillDeposit.setCreatetime(date); | ||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| @@ -291,9 +289,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildProperty(WxMerchant wxMerchant) { | |||||
| //获取用户 | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| public void buildProperty(WxMerchant wxMerchant, Long userId) { | |||||
| //根据商户ID找出合同 | //根据商户ID找出合同 | ||||
| WxPropertyContract wxPropertyContract = new WxPropertyContract(); | WxPropertyContract wxPropertyContract = new WxPropertyContract(); | ||||
| wxPropertyContract.setMerchantId(wxMerchant.getId()); | wxPropertyContract.setMerchantId(wxMerchant.getId()); | ||||
| @@ -371,7 +367,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| wxBillProperty.setTenantId(wxMerchant.getTenantId()); | wxBillProperty.setTenantId(wxMerchant.getTenantId()); | ||||
| wxBillProperty.setIsDel(0); | wxBillProperty.setIsDel(0); | ||||
| wxBillProperty.setMerchantId(wxMerchant.getId()); | wxBillProperty.setMerchantId(wxMerchant.getId()); | ||||
| wxBillProperty.setUserId(user.getId()); | |||||
| wxBillProperty.setUserId(userId); | |||||
| wxBillProperty.setShopId(wxPropertyContract.getShopId()); | wxBillProperty.setShopId(wxPropertyContract.getShopId()); | ||||
| wxBillProperty.setCreatetime(date); | wxBillProperty.setCreatetime(date); | ||||
| wxBillProperty.setUpdatetime(date); | wxBillProperty.setUpdatetime(date); | ||||
| @@ -18,7 +18,6 @@ import com.iformall.utils.DateUtils; | |||||
| import org.apache.commons.io.FileUtils; | import org.apache.commons.io.FileUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.poi.xwpf.usermodel.XWPFDocument; | import org.apache.poi.xwpf.usermodel.XWPFDocument; | ||||
| import org.apache.shiro.SecurityUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -118,7 +117,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData save(WxRentContract record) { | |||||
| public ResultData save(WxRentContract record, Long userId) { | |||||
| //保存租赁合同信息 | //保存租赁合同信息 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -178,9 +177,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //租金 | //租金 | ||||
| buildRent(wxMerchant); | |||||
| buildRent(wxMerchant, userId); | |||||
| //押金 | //押金 | ||||
| buildDeposit(wxMerchant); | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | } | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -192,11 +191,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData update(WxRentContract record) { | |||||
| return getResultDataForUpdate(record); | |||||
| public ResultData update(WxRentContract record, Long userId) { | |||||
| return getResultDataForUpdate(record, userId); | |||||
| } | } | ||||
| public ResultData getResultDataForUpdate(WxRentContract record) { | |||||
| public ResultData getResultDataForUpdate(WxRentContract record, Long userId) { | |||||
| //更新租赁合同信息 | //更新租赁合同信息 | ||||
| WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); | WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(record.getId()); | ||||
| if (wxRentContract == null) { | if (wxRentContract == null) { | ||||
| @@ -254,9 +253,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //租金 | //租金 | ||||
| buildRent(wxMerchant); | |||||
| buildRent(wxMerchant, userId); | |||||
| //押金 | //押金 | ||||
| buildDeposit(wxMerchant); | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | } | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -268,8 +267,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildDeposit(WxMerchant wxMerchant) { | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| public void buildDeposit(WxMerchant wxMerchant, Long userId) { | |||||
| WxRentContract wxRentContract = new WxRentContract(); | WxRentContract wxRentContract = new WxRentContract(); | ||||
| wxRentContract.setMerchantId(wxMerchant.getId()); | wxRentContract.setMerchantId(wxMerchant.getId()); | ||||
| List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | List<WxRentContract> list = wxRentContractMapper.findList(wxRentContract); | ||||
| @@ -318,7 +316,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | wxBillDeposit.setTenantId(wxMerchant.getTenantId()); | ||||
| wxBillDeposit.setIsDel(0); | wxBillDeposit.setIsDel(0); | ||||
| wxBillDeposit.setMerchantId(wxMerchant.getId()); | wxBillDeposit.setMerchantId(wxMerchant.getId()); | ||||
| wxBillDeposit.setUserId(user.getId()); | |||||
| wxBillDeposit.setUserId(userId); | |||||
| wxBillDeposit.setShopId(wxRentContract.getShopId()); | wxBillDeposit.setShopId(wxRentContract.getShopId()); | ||||
| wxBillDeposit.setCreatetime(date); | wxBillDeposit.setCreatetime(date); | ||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| @@ -334,10 +332,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void buildRent(WxMerchant wxMerchant) { | |||||
| //获取用户 | |||||
| MallUserInfo user = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute("userSession"); | |||||
| public void buildRent(WxMerchant wxMerchant, Long userId) { | |||||
| //根据商户ID找出合同 | //根据商户ID找出合同 | ||||
| WxRentContract wxRentContract = new WxRentContract(); | WxRentContract wxRentContract = new WxRentContract(); | ||||
| @@ -419,7 +414,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxBillRent.setTenantId(wxMerchant.getTenantId()); | wxBillRent.setTenantId(wxMerchant.getTenantId()); | ||||
| wxBillRent.setIsDel(0); | wxBillRent.setIsDel(0); | ||||
| wxBillRent.setMerchantId(wxMerchant.getId()); | wxBillRent.setMerchantId(wxMerchant.getId()); | ||||
| wxBillRent.setUserId(user.getId()); | |||||
| wxBillRent.setUserId(userId); | |||||
| wxBillRent.setShopId(wxRentContract.getShopId()); | wxBillRent.setShopId(wxRentContract.getShopId()); | ||||
| wxBillRent.setCreatetime(date); | wxBillRent.setCreatetime(date); | ||||
| wxBillRent.setUpdatetime(date); | wxBillRent.setUpdatetime(date); | ||||
| @@ -714,12 +709,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateFile(WxRentContract record) { | |||||
| return getResultDataForUpdate(record); | |||||
| public ResultData updateFile(WxRentContract record, Long userId) { | |||||
| return getResultDataForUpdate(record, userId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateRentContractStatus(Long id) { | |||||
| public ResultData updateRentContractStatus(Long id, Long userId) { | |||||
| if(id == null) { | if(id == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| } | } | ||||
| @@ -744,9 +739,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| wxMerchant.setId(record.getMerchantId()); | wxMerchant.setId(record.getMerchantId()); | ||||
| wxMerchant.setTenantId(record.getTenantId()); | wxMerchant.setTenantId(record.getTenantId()); | ||||
| //租金 | //租金 | ||||
| buildRent(wxMerchant); | |||||
| buildRent(wxMerchant, userId); | |||||
| //押金 | //押金 | ||||
| buildDeposit(wxMerchant); | |||||
| buildDeposit(wxMerchant, userId); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| @@ -91,7 +91,7 @@ public class HashUtil { | |||||
| } | } | ||||
| try { | try { | ||||
| String enc = hash("md5", str); | String enc = hash("md5", str); | ||||
| enc = new String(Base64.getUrlEncoder().encode(enc.getBytes("utf-8"))); | |||||
| enc = new String(Base64.getUrlEncoder().encode(enc.getBytes("utf-8")), "utf-8"); | |||||
| return enc; | return enc; | ||||
| } catch (UnsupportedEncodingException e) { | } catch (UnsupportedEncodingException e) { | ||||
| return null; | return null; | ||||
| @@ -102,7 +102,13 @@ public class HashUtil { | |||||
| if (str == null) { | if (str == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| String dec = new String(Base64.getUrlDecoder().decode(str)); | |||||
| return dec; | |||||
| try { | |||||
| String dec = new String(Base64.getUrlDecoder().decode(str), "utf-8"); | |||||
| return dec; | |||||
| } catch (Exception e) { | |||||
| System.out.println(str); | |||||
| System.out.println(e.getMessage()); | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -29,6 +29,15 @@ | |||||
| `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html` | `mechant_id`,`sort_num`,`status`,`create_time`,`update_time`,`html` | ||||
| </sql> | </sql> | ||||
| <sql id="allCHeadColumns"> | |||||
| `id`,`tenant_id`,`cover_img`,`title`,`type`,`sort_num` | |||||
| </sql> | |||||
| <sql id="allAHeadColumns"> | |||||
| `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`use_price`,`discount_price`,`detail`,`valid_start_date`,`valid_end_date`,`img_detail`,`type`,`coupon_ids`, | |||||
| `mechant_id`,`sort_num`,`status`,`create_time`,`update_time` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| @@ -131,10 +140,15 @@ | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns" /> from wx_campaign | |||||
| select <include refid="allAHeadColumns" /> from wx_campaign | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findCList" parameterType="com.iformall.domain.po.WxCampaign" resultMap="BaseResultMap"> | |||||
| select <include refid="allCHeadColumns" /> from wx_campaign | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | <select id="getMaxSortNum" parameterType="java.lang.String" resultType="java.lang.Integer"> | ||||
| select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | select max(sort_num) from wx_campaign where `tenant_id` = #{tenantId} | ||||
| </select> | </select> | ||||
| @@ -38,9 +38,9 @@ | |||||
| <if test=" null != batchNo "> | <if test=" null != batchNo "> | ||||
| and `batch_no` like concat('%', #{batchNo},'%') | and `batch_no` like concat('%', #{batchNo},'%') | ||||
| </if> | |||||
| <if test=" null != phone "> | |||||
| </if> | |||||
| <if test=" null != phone and phone!=''"> | |||||
| and `phone` like concat('%', #{phone},'%') | and `phone` like concat('%', #{phone},'%') | ||||
| </if> | </if> | ||||