Sfoglia il codice sorgente

fix

release_toaliyun_real
xiaohanzi 5 anni fa
parent
commit
8ba476c28c
75 ha cambiato i file con 3039 aggiunte e 496 eliminazioni
  1. +2
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java
  2. +49
    -52
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
  3. +17
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java
  4. +28
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
  5. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserCarController.java
  6. +43
    -16
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java
  7. +63
    -0
      mallinkAdmin/src/main/resources/db/migration/V202012230001__wx_credit_clear.sql
  8. +199
    -0
      mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql
  9. +7
    -0
      mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql
  10. +1499
    -0
      mallinkAdmin/src/main/resources/db/migration/V202012290002__wx_c_user_basic_child.sql
  11. +8
    -0
      mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql
  12. +173
    -83
      mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java
  13. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java
  14. +4
    -0
      mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  15. +47
    -72
      mallinkCApi/src/main/java/com/iformall/controller/BaseController.java
  16. +39
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  17. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java
  18. +0
    -5
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  19. +1
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java
  20. +11
    -28
      mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java
  21. +97
    -93
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  22. +2
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java
  23. +1
    -1
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  24. +8
    -2
      mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java
  25. +48
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicChild.java
  26. +22
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java
  27. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserCar.java
  28. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponActionLog.java
  29. +7
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java
  30. +7
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxGame.java
  31. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java
  32. +4
    -1
      mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java
  33. +2
    -1
      mallinkService/src/main/java/com/iformall/domain/vo/WxCreditHistoryVo.java
  34. +3
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java
  35. +7
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumTag.java
  36. +2
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumTagType.java
  37. +15
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java
  38. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java
  39. +6
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java
  40. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java
  41. +18
    -0
      mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java
  42. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java
  43. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java
  44. +6
    -0
      mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java
  45. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxActivityJoinServiceImpl.java
  46. +55
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java
  47. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  48. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserCarServiceImpl.java
  49. +4
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java
  50. +102
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java
  51. +4
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  52. +11
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java
  53. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java
  54. +3
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  55. +13
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java
  56. +53
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
  57. +26
    -7
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  58. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java
  59. +23
    -15
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  60. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java
  61. +5
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java
  62. +19
    -22
      mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java
  63. +1
    -0
      mallinkService/src/main/java/com/iformall/service/park/impl/util/ParkHelper.java
  64. +30
    -0
      mallinkService/src/main/java/com/iformall/utils/DateUtils.java
  65. +40
    -1
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  66. +40
    -34
      mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml
  67. +2
    -1
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml
  68. +31
    -0
      mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml
  69. +19
    -1
      mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml
  70. +4
    -1
      mallinkService/src/main/resources/mapper/WxGameMapper.xml
  71. +1
    -1
      mallinkService/src/main/resources/mapper/WxMallMapper.xml
  72. +1
    -1
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml
  73. +68
    -0
      mallinkService/src/main/resources/mapper/wxCUserBasicChildMapper.xml
  74. +5
    -0
      mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java
  75. +6
    -1
      mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java

+ 2
- 0
mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java Vedi File

@@ -62,6 +62,7 @@ public class BaseController {

/**
* 返回租户信息
* 集团版帐号tenantId为空,parentTenantId为集团tenantId
* @return
*/
public TenantEntity getTenantInfo(){
@@ -76,6 +77,7 @@ public class BaseController {

/**
* 处理集团新增修改所需租户信息(广场独立修改,集团修改全部)
* 处理集团版 tenantId为空,parentTenantId为集团tenantId
* ifParentUpdateTenantInfo
*/
public TenantEntity ifParentUpdateTenantInfo() {


+ 49
- 52
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java Vedi File

@@ -149,10 +149,10 @@ public class WxProjectConfigController extends BaseController {
if(wxMall.getId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
TenantEntity TenantEntity = new TenantEntity(){{
setTenantId(wxMall.getId().toString());
}};
WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity);
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxMall.getId().toString());
WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity);
if(parentWxMall == null || parentWxMall.getSaleType() != 100
|| !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())
|| StringUtils.isNotBlank(parentWxMall.getParentTenantId())){
@@ -558,74 +558,72 @@ public class WxProjectConfigController extends BaseController {
map.put("wxMall",wxMall);
List<WxMall> subWxMall = wxMallService.getSubByParentTenantId(wxMall.getTenantId());
map.put("subWxMall",subWxMall);
WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig(){{
setTenantId(wxMall.getTenantId());
}};
WxCouponSendConfig wxCouponSendConfig = new WxCouponSendConfig();
wxCouponSendConfig.setTenantId(wxMall.getTenantId());
List<WxCouponSendConfig> wxCouponSendConfigList = wxCouponSendConfigService.findList(wxCouponSendConfig);
map.put("wxCouponSendConfigList",wxCouponSendConfigList);
WxScoreRules wxScoreRules = new WxScoreRules(){{
setTenantId(wxMall.getTenantId());
}};
WxScoreRules wxScoreRules = new WxScoreRules();
wxScoreRules.setTenantId(wxMall.getTenantId());
List<WxScoreRules> wxScoreRulesList = wxScoreRulesService.findList(wxScoreRules);
map.put("wxScoreRulesList",wxScoreRulesList);
WxTemplateMsg wxTemplateMsg = new WxTemplateMsg(){{
setTenantId(wxMall.getTenantId());
}};
WxTemplateMsg wxTemplateMsg = new WxTemplateMsg();
wxTemplateMsg.setTenantId(wxMall.getTenantId());
List<WxTemplateMsg> wxTemplateMsgList = wxTemplateMsgService.findList(wxTemplateMsg);
map.put("wxTemplateMsgList",wxTemplateMsgList);
WxQuestion wxQuestion = new WxQuestion(){{
setTenantId(wxMall.getTenantId());
}};
WxQuestion wxQuestion = new WxQuestion();
wxQuestion.setTenantId(wxMall.getTenantId());
List<WxQuestion> wxQuestionList = wxQuestionService.findList(wxQuestion);
map.put("wxQuestionList",wxQuestionList);
WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel(){{
setTenantId(wxMall.getTenantId());
}};
WxMsgValidationcodeModel wxMsgValidationcodeModel = new WxMsgValidationcodeModel();
wxMsgValidationcodeModel.setTenantId(wxMall.getTenantId());
List<WxMsgValidationcodeModel> wxMsgValidationcodeModelList = wxMsgValidationcodeModelService.findList(wxMsgValidationcodeModel);
map.put("wxMsgValidationcodeModelList",wxMsgValidationcodeModelList);
WxFlowConfig wxFlowConfig = new WxFlowConfig(){{
setTenantId(wxMall.getTenantId());
}};
WxFlowConfig wxFlowConfig = new WxFlowConfig();
wxFlowConfig.setTenantId(wxMall.getTenantId());
List<WxFlowConfig> wxFlowConfigList = wxFlowConfigService.findList(wxFlowConfig);
map.put("wxFlowConfigList",wxFlowConfigList);
TenantEntity tenantEntity = new TenantEntity() {{
setTenantId(wxMall.getTenantId());
}};
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxMall.getTenantId());
ResultData wxMallBuildingFloorList = wxMallBuildingService.getBuildingFloorList(tenantEntity);
map.put("wxMallBuildingFloorList",wxMallBuildingFloorList.data);
WxPayAccount wxPayAccount = wxPayAccountService.getByTenantId(wxMall.getTenantId());
map.put("wxPayAccount",wxPayAccount);
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxMall.getTenantId());
map.put("wxPayAccountBill",wxPayAccountBill);
WxAppinfo wxAppinfo = new WxAppinfo() {{
setTenantId(wxMall.getTenantId());
}};
WxAppinfo wxAppinfo = new WxAppinfo();
wxAppinfo.setTenantId(wxMall.getTenantId());
List<WxAppinfo> wxAppinfoList = wxAppinfoService.getList(wxAppinfo);
map.put("wxAppinfoList",wxAppinfoList);
MallUserInfo mallUserInfo = new MallUserInfo() {{
setTenantId(wxMall.getTenantId());
setIsAdmin(1);
}};
MallUserInfo mallUserInfo = new MallUserInfo();
mallUserInfo.setTenantId(wxMall.getTenantId());
mallUserInfo. setIsAdmin(1);
List<MallUserInfo> mallUserInfoList = mallUserInfoService.findList(mallUserInfo);
map.put("mallUserInfoList",mallUserInfoList);
WxMsgConfig wxMsgConfig = new WxMsgConfig() {{
setTenantId(wxMall.getTenantId());
}};
WxMsgConfig wxMsgConfig = new WxMsgConfig();
wxMsgConfig.setTenantId(wxMall.getTenantId());
WxMsgConfig wxMsgConfigObject = wxMsgConfigService.findObject(wxMsgConfig);
map.put("wxMsgConfig",wxMsgConfigObject);
WxPark wxPark = new WxPark(){{
setTenantId(wxMall.getTenantId());
}};
WxPark wxPark = new WxPark();
wxPark.setTenantId(wxMall.getTenantId());
WxPark wxParkObj = wxParkService.getByObj(wxPark);
map.put("wxPark",wxParkObj);
WxWiWideInfo wxWiWideInfo = new WxWiWideInfo(){{
setTenantId(wxMall.getTenantId());
}};
WxWiWideInfo wxWiWideInfo = new WxWiWideInfo();
wxWiWideInfo.setTenantId(wxMall.getTenantId());
WxWiWideInfo wxWiWideInfoObject = wxWiWideInfoService.findObject(wxWiWideInfo);
map.put("wxWiWideInfo",wxWiWideInfoObject);
WxWeappInfo wxWeappInfo = new WxWeappInfo(){{
setTenantId(wxMall.getTenantId());
}};
WxWeappInfo wxWeappInfo = new WxWeappInfo();
wxWeappInfo.setTenantId(wxMall.getTenantId());
List<WxWeappInfo> wxAuthorizerInfoList = wxAuthorizerInfoService.getList(wxWeappInfo);
map.put("wxAuthorizerInfoList",wxAuthorizerInfoList);

@@ -652,10 +650,9 @@ public class WxProjectConfigController extends BaseController {
// if(subTenantIds == null || subTenantIds.length == 0){
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
// }
TenantEntity TenantEntity = new TenantEntity(){{
setTenantId(tenantId);
}};
WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity);
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(tenantId);
WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity);
if(parentWxMall == null || parentWxMall.getSaleType() != 100
|| !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())
|| StringUtils.isNotBlank(parentWxMall.getParentTenantId())){
@@ -689,10 +686,10 @@ public class WxProjectConfigController extends BaseController {
}else{
subTenantIdStrs = StringUtils.join(subTenantIds, ',');
}
TenantEntity TenantEntity = new TenantEntity(){{
setTenantId(tenantId);
}};
WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity);
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(tenantId);
WxMall parentWxMall = wxMallService.getByTenantInfo(tenantEntity);
if(parentWxMall == null || parentWxMall.getSaleType() != 100
|| !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())
|| StringUtils.isNotBlank(parentWxMall.getParentTenantId())){


+ 17
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxGameController.java Vedi File

@@ -3,6 +3,7 @@ package com.iformall.controller.market;
import com.alibaba.fastjson.JSONArray;
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.controller.base.BaseController;
@@ -54,6 +55,14 @@ public class WxGameController extends BaseController {
if (StringUtils.isBlank(wxGame.getCouponIds())) {
wxGame.setCouponIds(JSONArray.toJSONString(new String[0]));
}
if(wxGame.getPlayCreditLimit() != null && wxGame.getPlayCreditLimit() >= 0){
if(wxGame.getPlayCredit() == null || wxGame.getPlayCredit() <= 0){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"游戏消耗积分不能为空或为0");
}
if(wxGame.getPlayLimit() == null || wxGame.getPlayLimit() == 0){
wxGame.setPlayLimit(-1);
}
}
wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode());
wxGame.updateTenantInfo(getTenantInfo());
wxGameService.saveOrUpdate(wxGame);
@@ -68,6 +77,14 @@ public class WxGameController extends BaseController {
if (StringUtils.isBlank(wxGame.getCouponIds())) {
wxGame.setCouponIds(JSONArray.toJSONString(new String[0]));
}
if(wxGame.getPlayCreditLimit() != null && wxGame.getPlayCreditLimit() >= 0){
if(wxGame.getPlayCredit() == null || wxGame.getPlayCredit() <= 0){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"游戏消耗积分不能为空或为0");
}
if(wxGame.getPlayLimit() == null || wxGame.getPlayLimit() == 0){
wxGame.setPlayLimit(-1);
}
}
wxGame.updateTenantInfo(getTenantInfo());
wxGameService.saveOrUpdate(wxGame);
return new ResultData();


+ 28
- 0
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java Vedi File

@@ -56,6 +56,9 @@ public class WxCUserBasicInfoController extends BaseController {
@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@Autowired
private WxCUserBasicChildService wxCUserBasicChildService;

@Autowired
private WxCUserTagsService wxCUserTagsService;

@@ -86,6 +89,9 @@ public class WxCUserBasicInfoController extends BaseController {
@Autowired
private WxMerchantMapper wxMerchantMapper;

@Autowired
private WxCreditHistoryService wxCreditHistoryService;

private void setUserInfoLevel(WxCUserBasicInfo info) {

if (info.getPoins() == null || info.getPoins() == 0) {
@@ -101,6 +107,14 @@ public class WxCUserBasicInfoController extends BaseController {
}
}

private void setUserChildren(WxCUserBasicInfo info) {
WxCUserBasicChild uChild = new WxCUserBasicChild();
uChild.setTenantId(info.getFinalTenantId());
uChild.setCUserId(info.getId());
info.setChildrenList(wxCUserBasicChildService.findList(uChild));

}

private void setUserInfoTag(WxCUserBasicInfo info) {

if (info.getTagId() != null) {
@@ -129,6 +143,16 @@ public class WxCUserBasicInfoController extends BaseController {
info.setCarCount(wxCUserCarService.countUserCar(wxCUserCar));
}

private void setCreditSumDate(WxCUserBasicInfo info){
WxCreditHistory wxCreditHistory = new WxCreditHistory();
wxCreditHistory.setTenantId(info.getFinalTenantId());
wxCreditHistory.setCUserId(info.getId());
wxCreditHistory.setStartTime(info.getCreditStartTime());
wxCreditHistory.setEndTime(info.getCreditEndTime());
info.setAddCredit(wxCreditHistoryService.getAddCreditSummary(wxCreditHistory));
info.setLesCredit(wxCreditHistoryService.getLesCreditSummary(wxCreditHistory));
}

@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@@ -155,6 +179,9 @@ public class WxCUserBasicInfoController extends BaseController {
for (WxCUserBasicInfo info : page.getList()) {
// setUserInfoLevel(info);
setUserInfoCarCount(info);
info.setCreditStartTime(wxCUserBasicInfo.getCreditStartTime());
info.setCreditEndTime(wxCUserBasicInfo.getCreditEndTime());
setCreditSumDate(info);
}
}
return new ResultData(page);
@@ -231,6 +258,7 @@ public class WxCUserBasicInfoController extends BaseController {
setUserInfoTag(info);
setUserInfoLevel(info);
setUserInfoCar(info);
setUserChildren(info);
return new ResultData(info);
}



+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserCarController.java Vedi File

@@ -32,6 +32,7 @@ public class WxCUserCarController extends BaseController {
public ResultData list(@ModelAttribute WxCUserCar wxCUserCar, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxCUserCarController::list");
if (null == wxCUserCar) wxCUserCar = new WxCUserCar();
wxCUserCar.updateTenantInfo(getTenantInfo());
final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCar, pageNum, pageSize);
return new ResultData(page);
}


+ 43
- 16
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java Vedi File

@@ -2,16 +2,22 @@ package com.iformall.controller.mem;

import com.github.pagehelper.PageInfo;
import com.iformall.annotation.SystemControllerLog;
import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.po.WxCreditHistory;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCreditHistoryVo;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.enums.EnumScoreType;
import com.iformall.enums.EnumUserType;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCreditHistoryService;
import com.iformall.service.WxMerchantService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -32,7 +38,10 @@ public class WxCreditHistoryController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxCreditHistoryService wxCreditHistoryService;
WxCreditHistoryService wxCreditHistoryService;

@Autowired
private WxMerchantService wxMerchantService;

@ApiOperation("分页列表接口")
@GetMapping("list")
@@ -79,10 +88,25 @@ public class WxCreditHistoryController extends BaseController {
public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) {
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add");
MallUserInfo user = getUser();
//wxCreditHistory.updateTenantInfo(user);
wxCreditHistory.setTenantId(user.getFinalTenantId());
wxCreditHistory.setFinalTenantId(user.getFinalTenantId());
wxCreditHistory.setOperatorId(user.getId());

wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode());
String desc = "";
if(wxCreditHistory.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())){
WxMerchant byId = wxMerchantService.getById(wxCreditHistory.getMerchantId());
desc = "管理端手动积分:消费商户["+byId.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]";
}else if(wxCreditHistory.getCreditType().equals(EnumScoreType.REDUCE_CREDIT.getCode())){
desc = "管理端手动扣减积分";
if(StringUtils.isNotBlank(wxCreditHistory.getChangePurpose())){
desc = desc + "["+wxCreditHistory.getChangePurpose()+"]";
}
}else{
desc = "管理端("+user.getUsername()+")操作未知积分来源";
}
wxCreditHistory.setChangePurpose(desc);
try {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ;
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
@@ -116,13 +140,6 @@ public class WxCreditHistoryController extends BaseController {
@GetMapping("exportData")
@SystemControllerLog(description = "积分历史-导出数据")
public void exportData(@ModelAttribute WxCreditHistory wxCreditHistory, HttpServletRequest request, HttpServletResponse response) {
// wxCreditHistory.updateTenantInfo(getTenantInfo());
// TenantEntity tenantEntity = ifParentUpdateTenantInfo();
// if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){
// wxCreditHistory.setTenantId(tenantEntity.getParentTenantId());
// }else{
// wxCreditHistory.setTenantId(tenantEntity.getTenantId());
// }
wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId());
wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId());
wxCreditHistoryService.exportData(request, response, wxCreditHistory);
@@ -133,17 +150,27 @@ public class WxCreditHistoryController extends BaseController {
@SystemControllerLog(description = "积分历史-积分统计概览")
public ResultData getCreditSummary(@ModelAttribute WxCreditHistory wxCreditHistory) {
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::getCreditSummary");
// wxCreditHistory.updateTenantInfo(getTenantInfo());
// TenantEntity tenantEntity = ifParentUpdateTenantInfo();
// if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){
// wxCreditHistory.setTenantId(tenantEntity.getParentTenantId());
// }else{
// wxCreditHistory.setTenantId(tenantEntity.getTenantId());
// }
TenantEntity tenantInfo = getTenantInfo();
wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId());
wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCreditHistoryService.getCreditSummary(wxCreditHistory);
}


@ApiOperation("积分清零计划")
@PostMapping("clearCreditByYear")
@SystemControllerLog(description = "积分清零计划")
@TenantIgnore
public ResultData clearCreditByYear(@RequestBody WxCreditHistory wxCreditHistory) {
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::clearCreditByYear");
if(wxCreditHistory == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ;
}
if(StringUtils.isBlank(wxCreditHistory.getFinalTenantId())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ;
}
wxCreditHistoryService.clearCreditByYear(wxCreditHistory);
return new ResultData(Result.SUCCESS);
}

}

+ 63
- 0
mallinkAdmin/src/main/resources/db/migration/V202012230001__wx_credit_clear.sql Vedi File

@@ -0,0 +1,63 @@
CREATE DEFINER=`root`@`%` PROCEDURE `user_credit_clear`(IN `cutOffDate` VARCHAR(50),IN `finalTableIndex` VARCHAR(50))
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET done = -1;
select concat(finalTableIndex,'_',date_format(now(),'%Y%m%d%H%i')) into @tableSuffix;
#START TRANSACTION;
set @backUpSql1_0 = concat('CREATE TABLE `wx_credit_clear_md',@tableSuffix,'` ('
,'`id` bigint(20) NOT NULL,'
,'`user_id` bigint(20) DEFAULT NULL,'
,'`final_tenant_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,'
,'`credit` int(11) DEFAULT NULL COMMENT \'用户当前总积分\','
,'`sum_credit` int(11) DEFAULT NULL COMMENT \'用户当前清零截止时间后总积分\','
,'`credit_amount` int(11) DEFAULT NULL COMMENT \'用户清零扣减积分\','
,'`cut_off_date` datetime(0) DEFAULT NULL COMMENT \'清零截止时间\','
,'PRIMARY KEY (`id`) USING BTREE'
,') ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;');
PREPARE back_up_sql1_0 FROM @backUpSql1_0;
EXECUTE back_up_sql1_0;
DEALLOCATE PREPARE back_up_sql1_0;
INSERT into zz_process_log VALUES(NOW(),'user_credit_clear()','创建积分清零数据处理备份表',@backUpSql1_0);
set @backUpSql1_1 = concat('insert into `wx_credit_clear_md',@tableSuffix,'`'
,'(`id`, `user_id`, `final_tenant_id`, `credit`, `sum_credit`, `credit_amount`, `cut_off_date`)'
,' select (select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) id,wcubi.id user_id,wcubi.final_tenant_id,wcubi.credit,ifnull(wch.sum_credit,0) sum_credit,(ifnull(wch.sum_credit,0)-wcubi.credit) credit_amount,\'',cutOffDate,'\''
,' from wx_c_user_basic_info',finalTableIndex,' wcubi'
,' left join (select c_user_id,sum(credit_num) sum_credit from wx_credit_history',finalTableIndex,' where credit_num > 0 and create_date >= \'',cutOffDate,'\' group by c_user_id) wch on wch.c_user_id = wcubi.id'
,' where wcubi.credit > ifnull(wch.sum_credit,0);');
PREPARE back_up_sql1_1 FROM @backUpSql1_1;
EXECUTE back_up_sql1_1;
DEALLOCATE PREPARE back_up_sql1_1;
INSERT into zz_process_log VALUES(NOW(),'user_credit_clear()','添加积分清零数据处理',@backUpSql1_1);
set @backUpSql1_2 = concat('insert into `wx_credit_history',finalTableIndex,'`'
,'(`id`, `tenant_id`, `c_user_id`, `credit_amount`, `credit_num`, `credit_type`, `create_date`, `operator_type`, `operator_id`) '
,'select id,final_tenant_id,user_id,sum_credit,credit_amount,14,now(),4,0'
,' from `wx_credit_clear_md',@tableSuffix,'`;');
PREPARE back_up_sql1_2 FROM @backUpSql1_2;
EXECUTE back_up_sql1_2;
DEALLOCATE PREPARE back_up_sql1_2;
INSERT into zz_process_log VALUES(NOW(),'user_credit_clear()','添加积分历史',@backUpSql1_2);
set @backUpSql1_3 = concat('update wx_c_user_basic_info',finalTableIndex,' wcubi '
,'left join `wx_credit_clear_md',@tableSuffix,'` wccm on wcubi.id = wccm.user_id'
,' set wcubi.credit = (wcubi.credit + wccm.credit_amount), wcubi.update_date = now()'
,' where wccm.id is not null;');
PREPARE back_up_sql1_3 FROM @backUpSql1_3;
EXECUTE back_up_sql1_3;
DEALLOCATE PREPARE back_up_sql1_3;
INSERT into zz_process_log VALUES(NOW(),'user_credit_clear()','修改用户积分',@backUpSql1_3);
#IF done = -1 THEN
# ROLLBACK;
# ELSE
# COMMIT;
# END IF;
END

+ 199
- 0
mallinkAdmin/src/main/resources/db/migration/V202012280001__wx_coupon_action_log.sql Vedi File

@@ -0,0 +1,199 @@
ALTER TABLE `wx_coupon_action_log_0` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_1` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_2` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_3` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_4` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_5` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_6` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_7` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_8` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_9` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_10` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_11` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_12` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_13` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_14` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_15` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_16` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_17` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_18` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_19` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_20` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_21` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_22` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_23` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_24` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_25` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_26` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_27` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_28` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_29` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_30` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_31` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_32` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_33` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_34` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_35` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_36` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_37` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_38` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_39` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_40` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_41` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_42` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_43` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_44` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_45` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_46` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_47` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_48` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_49` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_50` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_51` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_52` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_53` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_54` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_55` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_56` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_57` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_58` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_59` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_60` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_61` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_62` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_63` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_64` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_65` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_66` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_67` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_68` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_69` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_70` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_71` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_72` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_73` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_74` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_75` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_76` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_77` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_78` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_79` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_80` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_81` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_82` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_83` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_84` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_85` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_86` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_87` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_88` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_89` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_90` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_91` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_92` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_93` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_94` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_95` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_96` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_97` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_98` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

ALTER TABLE `wx_coupon_action_log_99` ADD COLUMN `operator_id` bigint(20) AFTER `create_time_md`;

+ 7
- 0
mallinkAdmin/src/main/resources/db/migration/V202012290001__wx_game.sql Vedi File

@@ -0,0 +1,7 @@
ALTER TABLE `wx_game`
ADD COLUMN `play_credit_limit` int(11) NOT NULL DEFAULT -1 AFTER `award_limit`,
ADD COLUMN `play_credit` int(11) AFTER `play_credit_limit`;


ALTER TABLE `wx_game_action_log`
ADD COLUMN `type` int(11) NOT NULL DEFAULT 0 AFTER `create_time`;

+ 1499
- 0
mallinkAdmin/src/main/resources/db/migration/V202012290002__wx_c_user_basic_child.sql
File diff soppresso perché troppo grande
Vedi File


+ 8
- 0
mallinkAdmin/src/main/resources/db/migration/V202012300001__wx_tag.sql Vedi File

@@ -0,0 +1,8 @@
INSERT INTO `wx_tags_type`(`id`, `name`, `group_id`, `group_name`, `flag`) VALUES (29, '子女', 2, '生活属性', 0);

INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (166, '婴儿', 2, '生活属性', 29, '子女');
INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (167, '幼儿', 2, '生活属性', 29, '子女');
INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (168, '学龄前', 2, '生活属性', 29, '子女');
INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (169, '学龄初', 2, '生活属性', 29, '子女');
INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (170, '学龄中', 2, '生活属性', 29, '子女');
INSERT INTO `wx_tags`(`id`, `name`, `group_id`, `group_name`, `type_id`, `type_name`) VALUES (171, '学龄晚', 2, '生活属性', 29, '子女');

+ 173
- 83
mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java Vedi File

@@ -13,6 +13,7 @@ import com.iformall.enums.EnumAssignTagsTrigger;
import com.iformall.enums.EnumScoreType;
import com.iformall.enums.EnumUserType;
import com.iformall.service.*;
import com.iformall.utils.Constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -23,6 +24,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@@ -35,7 +37,6 @@ import java.util.List;
public class WxCUserController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());


@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;

@@ -48,6 +49,9 @@ public class WxCUserController extends BaseController {
@Autowired
private WxMerchantBUserService wxMerchantBUserService;

@Autowired
private WxMerchantService wxMerchantService;

@Autowired
private WxCUserFromBService wxCUserFromBService;

@@ -57,7 +61,6 @@ public class WxCUserController extends BaseController {
@Autowired
private WxCreditHistoryService wxCreditHistoryService;


/**
* 会员更新信息
*
@@ -76,70 +79,147 @@ public class WxCUserController extends BaseController {
if (StringUtils.isEmpty(wxCUserFromBDto.getAppId())) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端appId不能为空");
}
if (wxCUserFromBDto.getUserId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空");
if (StringUtils.isEmpty(wxCUserFromBDto.getPhone())) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "C端手机号不能为空");
}
// if (wxCUserFromBDto.getUserId() == null) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "bUserId不能为空");
// }
//根据bUserId查询B端用户是否存在
WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId());
// WxMerchantBUser bUser = wxMerchantBUserService.getById(wxCUserFromBDto.getUserId());
WxMerchantBUser bUser = getLoginBUser();
if (bUser == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "B端用户不存在");
}
WxMerchant wxMerchant = wxMerchantService.getById(bUser.getMerchantId());
if (wxMerchant == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "商户不存在");
}
final IdWorker idWorker = IdWorker.get();

WxCUserFromB wxCUserFromB = wxCUserFromBService.getByOpenidAndAppId(wxCUserFromBDto);
//查询C端微信信息
WxCUser wxCUser = new WxCUser();
wxCUser.setAppId(wxCUserFromBDto.getAppId());
wxCUser.setOpenId(wxCUserFromBDto.getOpenid());
wxCUser = wxCUserService.getByOpenId(wxCUser);
if (wxCUserFromB == null) {
//TODO phone可能为空
String phone = wxCUser.getPhone();

WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.findInfoByPhone(bUser, phone);
//查询会员信息
//List<WxCUserBasicInfo> byPhone = wxCUserBasicInfoService.findByPhone(bUser, phone);
//存在会员信息
if (wxCUserBasicInfo != null) {
//更新会员信息
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) {
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());

boolean isAddCredit = false;
WxCUserBasicInfo wxCUserBasicInfo = null;

if(wxCUserFromB != null){
wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId());
if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxCUser.getTenantId());
tenantEntity.setParentTenantId(wxCUser.getParentTenantId());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, wxCUserFromBDto.getPhone());
if(infoByPhone != null){
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在");
}
if (wxCUserFromBDto != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
wxCUser.setPhone(wxCUserFromBDto.getPhone());
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone());
}
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) {
if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){
isAddCredit = true;
}
if (wxCUserFromBDto.getSex() != null) {
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex());
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());
}
if (wxCUserFromBDto.getBirthdate() != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
}
if (wxCUserFromBDto.getSex() != null) {
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex());
}
if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());
}
wxCUserBasicInfoService.update(wxCUserBasicInfo);

}else{
wxCUserFromB = new WxCUserFromB();
if(wxCUser != null){
if(wxCUser.getUserId() != null){
wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUser.getUserId(),wxCUser.getFinalTenantId());
if (!wxCUserBasicInfo.getPhone().equals(wxCUserFromBDto.getPhone())){
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxCUser.getTenantId());
tenantEntity.setParentTenantId(wxCUser.getParentTenantId());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, wxCUserFromBDto.getPhone());
if(infoByPhone != null){
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在");
}
wxCUser.setPhone(wxCUserFromBDto.getPhone());
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone());
}
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) {
if(StringUtils.isEmpty(wxCUserBasicInfo.getName())){
isAddCredit = true;
}
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());
}
if (wxCUserFromBDto.getBirthdate() != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
}
if (wxCUserFromBDto.getSex() != null) {
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex());
}
if (StringUtils.isNotEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());
}
wxCUserBasicInfoService.update(wxCUserBasicInfo);

}else{
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(wxCUser.getTenantId());
tenantEntity.setParentTenantId(wxCUser.getParentTenantId());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, wxCUserFromBDto.getPhone());
if(infoByPhone != null){
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在");
}
isAddCredit = true;
wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setId(idWorker.nextId());
wxCUserBasicInfo.setTenantId("," + wxCUser.getTenantId() + ",");
wxCUserBasicInfo.setFinalTenantId(wxCUser.getFinalTenantId());
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone());
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) {
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());
}
if (wxCUserFromBDto.getBirthdate() != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
}
if (wxCUserFromBDto.getSex() != null) {
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex());
}
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());
}
wxCUserBasicInfo.setLoginCount(1);
wxCUserBasicInfo.setActiveTime(new Date());
wxCUserBasicInfo.setCreateDate(new Date());
wxCUserBasicInfo.setUpdateDate(new Date());
wxCUserBasicInfoService.save(wxCUserBasicInfo);

}
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());
}else{
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(bUser.getTenantId());
tenantEntity.setParentTenantId(bUser.getParentTenantId());
WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, wxCUserFromBDto.getPhone());
if(infoByPhone != null){
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND,"手机号已存在");
}
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setUpdateDate(new Date());
wxCUserBasicInfoService.update(wxCUserBasicInfo);
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo);
//增加积分
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB);
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser);
//新增来自B端的会员关联数据
wxCUserFromB = new WxCUserFromB();
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId());
wxCUserFromB.setCUserId(wxCUserBasicInfo.getId());
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid());
wxCUserFromB.setMerchantId(bUser.getMerchantId());
wxCUserFromB.updateTenantInfo(bUser);
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId());
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo));
wxCUserFromBService.saveOrUpdate(wxCUserFromB);
} else {
//新增来自B端的会员
long cUserId = idWorker.nextId();
isAddCredit = true;
wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setId(cUserId);
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) {
wxCUserBasicInfo.setId(idWorker.nextId());
wxCUserBasicInfo.setTenantId("," + bUser.getTenantId() + ",");
wxCUserBasicInfo.setFinalTenantId(bUser.getFinalTenantId());
wxCUserBasicInfo.setPhone(wxCUserFromBDto.getPhone());
if (StringUtils.isNotEmpty(wxCUserFromBDto.getName())) {
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());
}
if (wxCUserFromBDto != null) {
if (wxCUserFromBDto.getBirthdate() != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
}
if (wxCUserFromBDto.getSex() != null) {
@@ -148,57 +228,57 @@ public class WxCUserController extends BaseController {
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());
}
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setLoginCount(1);
wxCUserBasicInfo.setActiveTime(new Date());
wxCUserBasicInfo.setCreateDate(new Date());
wxCUserBasicInfo.setUpdateDate(new Date());
wxCUserBasicInfoService.save(wxCUserBasicInfo);
//新增来自B端的会员关联数据
wxCUserFromB = new WxCUserFromB();
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId());
wxCUserFromB.setCUserId(cUserId);
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid());
wxCUserFromB.setMerchantId(bUser.getMerchantId());
wxCUserFromB.updateTenantInfo(bUser);
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId());
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo));
wxCUserFromBService.saveOrUpdate(wxCUserFromB);
}
} else {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),bUser.getFinalTenantId());
if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) {
wxCUserBasicInfo.setName(wxCUserFromBDto.getName());
}
if (wxCUserFromBDto != null) {
wxCUserBasicInfo.setBirthdate(wxCUserFromBDto.getBirthdate());
}
if (wxCUserFromBDto.getSex() != null) {
wxCUserBasicInfo.setSex(wxCUserFromBDto.getSex());
}
if (!StringUtils.isEmpty(wxCUserFromBDto.getAddress())) {
wxCUserBasicInfo.setAddress(wxCUserFromBDto.getAddress());

wxCUser = new WxCUser();
wxCUser.setTenantId(bUser.getTenantId());
wxCUser.setParentTenantId(bUser.getParentTenantId());
wxCUser.setAppId(wxCUserFromBDto.getAppId());
wxCUser.setOpenId(wxCUserFromBDto.getOpenid());
wxCUser.setPhone(wxCUserBasicInfo.getPhone());
wxCUser.setLoginCount(1);
wxCUser.setUserId(wxCUserBasicInfo.getId());

}
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfoService.update(wxCUserBasicInfo);

}

wxCUserService.saveOrUpdate(wxCUser);
if(isAddCredit){
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo);
//增加积分
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB);
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser);
//更新B端来源会员
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo));
wxCUserFromBService.saveOrUpdate(wxCUserFromB);
addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, bUser,wxMerchant);
}
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo,bUser);
wxCUserFromB.setBUserId(wxCUserFromBDto.getUserId());
wxCUserFromB.setCUserId(wxCUserBasicInfo.getId());
wxCUserFromB.setOpenid(wxCUserFromBDto.getOpenid());
wxCUserFromB.setMerchantId(bUser.getMerchantId());
wxCUserFromB.updateTenantInfo(bUser);
wxCUserFromB.setAppId(wxCUserFromBDto.getAppId());
//更新B端来源会员
wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo));
wxCUserFromBService.saveOrUpdate(wxCUserFromB);

return new ResultData();
}

private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId, TenantEntity tenantEntity) {
private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, WxMerchantBUser bUser,WxMerchant wxMerchant) {
WxCreditHistory wxCreditHistory = new WxCreditHistory();
wxCreditHistory.setCUserId(wxCUserBasicInfo.getId());
wxCreditHistory.setMerchantId(wxMerchant.getId());
// wxCreditHistory.updateTenantInfo(tenantEntity);
wxCreditHistory.setTenantId(tenantEntity.getFinalTenantId());
wxCreditHistory.setFinalTenantId(getTenantInfo().getFinalTenantId());
wxCreditHistory.setTenantId(wxCUserBasicInfo.getFinalTenantId());
wxCreditHistory.setFinalTenantId(wxCUserBasicInfo.getFinalTenantId());
wxCreditHistory.setCreateDate(new Date());
wxCreditHistory.setCreditType(enumScoreType.getCode());
wxCreditHistory.setChangePurpose("商户端["+wxMerchant.getName()+"]操作完善个人信息");
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode());
wxCreditHistory.setOperatorId(userId);
wxCreditHistory.setOperatorId(bUser.getId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
}

@@ -228,6 +308,16 @@ public class WxCUserController extends BaseController {
if(wxCUserFromB!=null){
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCUserFromB.getCUserId(),wxCUserFromB.getFinalTenantId());
return new ResultData(wxCUserBasicInfo);
}else{
WxCUser wxCUser = new WxCUser();
wxCUser.updateTenantInfo(getTenantInfo());
wxCUser.setAppId(wxCUserFromBDto.getAppId());
wxCUser.setOpenId(wxCUserFromBDto.getOpenid());
WxCUser byOpenId = wxCUserService.getByOpenId(wxCUser);
if(byOpenId != null && byOpenId.getUserId() != null){
WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(byOpenId.getUserId(), byOpenId.getFinalTenantId());
return new ResultData(byId);
}
}
return new ResultData(Result.SUCCESS,"查询成功",null);
}


+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java Vedi File

@@ -102,7 +102,7 @@ public class WxCouponSendController extends BaseController {
wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode());
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode());
try {
wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT);
wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT,getLoginBUser().getId());
} catch (MallinkException e) {
logger.error("注券异常: ", e);
return new ResultData(e.getErrorCode(), e.getMessage());


+ 4
- 0
mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Vedi File

@@ -111,13 +111,17 @@ public class WxCreditHistoryController extends BaseController {
//消费积分:取当前人的商户ID
if (wxCreditHistory.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) {
wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId());
wxCreditHistory.setChangePurpose("商户端手动扣减积分["+wxCreditHistory.getChangePurpose()+"]");
} else {
//新增积分:
//如果为商管商户 则消费商户按前端传入的进行记录
if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) {
wxCreditHistory.setMerchantId(wxCreditHistory.getMerchantId());
WxMerchant byId = wxMerchantService.getById(wxCreditHistory.getMerchantId());
wxCreditHistory.setChangePurpose("商户端手动积分:消费商户["+byId.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]");
} else {
wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId());
wxCreditHistory.setChangePurpose("商户端手动积分:消费商户["+merchant.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]");
}
}
//B端操作用户


+ 47
- 72
mallinkCApi/src/main/java/com/iformall/controller/BaseController.java Vedi File

@@ -5,7 +5,6 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.base.BaseCUserEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumAppPlat;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxCUserBasicInfo;
@@ -13,8 +12,6 @@ import com.iformall.exception.MallinkException;
import com.iformall.service.CUserTokenService;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserService;
import com.iformall.service.cuser.CUserServiceFactory;
import com.iformall.service.wechat.FmOpenService;
import com.iformall.utils.Constant;
import com.iformall.utils.IPUtil;
@@ -22,10 +19,11 @@ import com.iformall.utils.MaUtil;
import com.iformall.utils.RedisCacheUtils;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RestController;
@@ -37,15 +35,14 @@ import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

@RestController
public class BaseController {
@Autowired
private boolean isFmOpen;
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxCUserService wxCUserService;
private boolean isFmOpen;

@Autowired
private WxAppinfoService wxAppinfoService;
@@ -104,17 +101,10 @@ public class BaseController {

public String getFinalTenantId() {
TenantEntity tenantEntity = getTenantInfo();
String tenantId = tenantEntity.getTenantId();
return tenantEntity.getFinalTenantId();
}
// public Long getUserId() {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// Long cUserId = (Long) request.getAttribute(Constant.LOGIN_USER_KEY);
// return cUserId;
// }

public Long getMemberId() throws Exception {
public Long getMemberId() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
Long memberId = (Long) request.getAttribute(Constant.LOGIN_MEMBER_KEY);
if(memberId == null){
@@ -130,8 +120,7 @@ public class BaseController {
public WxCUser getWxCUser() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
BaseCUserEntity baseuser = (BaseCUserEntity) request.getAttribute(Constant.REQUEST_C_USER_KEY);
// Long cUserId = getUserId();
// WxCUser user = wxCUserService.getById(cUserId);

if (baseuser == null) {
throw new MallinkException(ErrorCode.USER_IS_EMPTY);
}
@@ -190,14 +179,6 @@ public class BaseController {
String shortKey = "webapp:short:member:"+memberId;
RedisCacheUtils.removeCache(cuserBasicInfoTemplate, shortKey);
}
// public WxCUserBasicInfo getMember() throws Exception {
// Long memberId = getMemberId();
// WxCUserBasicInfo member = wxCUserBasicInfoService.getById(memberId);
// if (member == null) {
// throw new MallinkException(ErrorCode.USER_IS_EMPTY);
// }
// return member;
// }

public WxAppinfo getAppInfo(String appId) {
return wxAppinfoService.getByAppId(appId);
@@ -236,62 +217,56 @@ public class BaseController {
byId = wxCUserBasicInfoService.getById(userId,getFinalTenantId());
}

// List<WxCUserBasicInfo> list = wxCUserBasicInfoService.findByPhone(tenantEntity, phone);
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, userPhone);

if (basicInfo != null) {
if(byId != null && !byId.getPhone().equals(basicInfo.getPhone())){
return Long.valueOf(-1);
if (byId != null) {
if (!byId.getId().equals(basicInfo.getId())) {
//数据库存在此手机号的会员,并且当前微信存在另一手机号会员
logger.error("会员" + userId + "更换手机号时,当前手机号会员表已存在:" + userPhone);
return Long.valueOf(-1);
}
}
if(!basicInfo.getTenantId().contains(","+tenantEntity.getTenantId()+",")){
basicInfo.setTenantId(basicInfo.getTenantId()+tenantEntity.getTenantId()+",");
wxCUserBasicInfoService.update(basicInfo);
if (!basicInfo.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) {
basicInfo.setTenantId(basicInfo.getTenantId() + tenantEntity.getTenantId() + ",");
}
// WxCUserBasicInfo basicInfo = list.get(0);
// 微信名称,统一成微信昵称
// if (!Objects.equals(basicInfo.getNickName(), user.getNickName())) {
// basicInfo.setNickName(user.getNickName());
// }
// // 性别
// if (basicInfo.getSex() == null) {
// basicInfo.setSex(user.getGender());
// }
// // 成长值
// if (Objects.nonNull(user.getScore())) {
// basicInfo.setPoins(user.getScore());
// }
// // 积分
// if (Objects.nonNull(user.getCredit())) {
// basicInfo.setCredit(user.getCredit());
// }
//wxCUserBasicInfoService.updateObj(basicInfo, user);
return basicInfo.getId();
} else if(byId != null){
byId.setPhone(userPhone);
byId.setNickName(userName);
byId.setAvatarUrl(avatarUrl);
byId.setSex(sex);
wxCUserBasicInfoService.update(byId);
removeCacheMember(byId.getId());
return byId.getId();
}else{
Date cur = new Date();
basicInfo = new WxCUserBasicInfo();
final IdWorker idWorker = IdWorker.get();
basicInfo.setId(idWorker.nextId());
basicInfo.setTenantId(","+tenantEntity.getTenantId()+",");
basicInfo.undateFinalTenantId(tenantEntity);
basicInfo.setPhone(userPhone);
basicInfo.setNickName(userName);
basicInfo.setAvatarUrl(avatarUrl);
basicInfo.setSex(sex);
basicInfo.setLoginCount(1);
basicInfo.setActiveTime(cur);
basicInfo.setCreateDate(cur);
basicInfo.setUpdateDate(cur);
wxCUserBasicInfoService.save(basicInfo);
wxCUserBasicInfoService.update(basicInfo);
removeCacheMember(basicInfo.getId());
return basicInfo.getId();
} else {
if (byId != null) {
if (!byId.getTenantId().contains("," + tenantEntity.getTenantId() + ",")) {
byId.setTenantId(byId.getTenantId() + tenantEntity.getTenantId() + ",");
}
byId.setPhone(userPhone);
byId.setNickName(userName);
byId.setAvatarUrl(avatarUrl);
byId.setSex(sex);
wxCUserBasicInfoService.update(byId);
removeCacheMember(basicInfo.getId());
return byId.getId();
} else {
Date cur = new Date();
basicInfo = new WxCUserBasicInfo();
final IdWorker idWorker = IdWorker.get();
basicInfo.setId(idWorker.nextId());
basicInfo.setTenantId("," + tenantEntity.getTenantId() + ",");
basicInfo.setFinalTenantId(tenantEntity.getFinalTenantId());
basicInfo.setPhone(userPhone);
basicInfo.setNickName(userName);
basicInfo.setAvatarUrl(avatarUrl);
basicInfo.setSex(sex);
basicInfo.setLoginCount(1);
basicInfo.setActiveTime(cur);
basicInfo.setCreateDate(cur);
basicInfo.setUpdateDate(cur);
wxCUserBasicInfoService.save(basicInfo);
removeCacheMember(basicInfo.getId());
return basicInfo.getId();
}
}
}



+ 39
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Vedi File

@@ -4,9 +4,14 @@ 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.MallUserInfo;
import com.iformall.domain.po.WxCUser;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.WxCreditHistory;
import com.iformall.enums.EnumScoreType;
import com.iformall.enums.EnumUserType;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCreditHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -53,4 +58,38 @@ public class WxCreditHistoryController extends BaseController{
final PageInfo<WxCreditHistory> page = wxCreditHistoryService.listAsPage(wxCreditHistory, pageNum, pageSize);
return new ResultData(page);
}

@ApiOperation("新增接口")
@PostMapping("add")
public ResultData add(@RequestBody WxCreditHistory wxCreditHistory) {
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::add");
WxCUser wxCUser = getWxCUser();
if(wxCUser.getUserId() == null){
return new ResultData(ErrorCode.PHONE_NOT_FOUND,"用户未授权手机号");
}

wxCreditHistory.setTenantId(wxCUser.getFinalTenantId());
wxCreditHistory.setCUserId(wxCUser.getId());
wxCreditHistory.setOperatorId(wxCUser.getId());
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode());

if(wxCreditHistory.getCreditType().equals(EnumScoreType.GAME_ADD_CREDIT.getCode())){
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage());
}else if(wxCreditHistory.getCreditType().equals(EnumScoreType.GAME_LES_CREDIT.getCode())){
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_LES_CREDIT.getMessage());
}else{
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"未知操作");
}

try {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ;
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
removeCacheCUser();
return new ResultData(Result.SUCCESS, "操作成功", credit);
} catch (MallinkException e) {
logger.error(e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
}
}

}

+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCuserFloatingLayerController.java Vedi File

@@ -28,7 +28,7 @@ public class WxCuserFloatingLayerController extends BaseController {
@Autowired
WxCuserFloatingLayerService wxCuserFloatingLayerService;

@AuthIgnore
// @AuthIgnore
@ApiOperation("获取浮层")
@GetMapping("/getFloatingLayer")
@ApiImplicitParams({


+ 0
- 5
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java Vedi File

@@ -1,15 +1,11 @@
package com.iformall.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumGameStatus;
import com.iformall.service.WxCouponOrderService;
import com.iformall.service.WxGameService;
import com.iformall.service.WxGameTemplateService;
import com.iformall.service.WxOrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -18,7 +14,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController


+ 1
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxPressOrderController.java Vedi File

@@ -68,7 +68,7 @@ public class WxPressOrderController extends BaseController {

@ApiOperation(value = "参与砍价", notes = "{\"orderId\":\"String\"}")
@PostMapping("pressOrderJoin")
@Transactional
@Transactional(rollbackFor = {Exception.class})
public ResultData pressOrderJoin(@RequestBody Map<String, String> paramMap) {
Date curDate = new Date();
String orderIdStr = paramMap.get("orderId");


+ 11
- 28
mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java Vedi File

@@ -549,11 +549,6 @@ public class WxUserGrantController extends BaseController {
if (user != null) {
logger.debug(user.toString());

boolean bFirstNickName = false;
if(StringUtils.isNoneEmpty(user.getNickName())) {
bFirstNickName = true;
}

WxMaService wxMaService = getWeappService(user.getAppId());

String session_key = user.getSessionKey();
@@ -592,13 +587,6 @@ public class WxUserGrantController extends BaseController {

removeCacheCUser();

if(bFirstNickName) {
// 首次获取昵称
// 成长值
wxScoreRulesService.addScore(getTenantInfo(),EnumScoreType.WECHAT_PERSION, user);
//增加积分
wxCUserService.addCredit(user, EnumScoreType.WECHAT_PERSION);
}
resultMap.put("openId", user.getOpenId());
resultMap.put("unionId", user.getUnionId());
resultMap.put("msg", "获取用户信息成功!");
@@ -624,9 +612,9 @@ public class WxUserGrantController extends BaseController {
@PostMapping("/getUserPhone")
@ApiOperation(value = "授权后获取用户的手机号", notes = "{\"encryptedData\":\"string\",\"iv\":\"string\"}")
public ResultData getUserPhone(@RequestBody Map<String, String> map) {
logger.debug(map.toString());
logger.info(map.toString());
TenantEntity tenantEntity = getTenantInfo();
Map resultMap = new HashMap();
String encryptedData = map.get("encryptedData");
String iv = map.get("iv");

@@ -638,6 +626,8 @@ public class WxUserGrantController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "iv 不能为空");
}

Map resultMap = new HashMap();

WxCUser user = getWxCUser();

if (user == null) {
@@ -645,7 +635,7 @@ public class WxUserGrantController extends BaseController {
}

boolean isFirstPhone = false;
if(StringUtils.isBlank(user.getPhone())) {
if(user.getUserId() == null) {
isFirstPhone = true;
}

@@ -660,18 +650,6 @@ public class WxUserGrantController extends BaseController {
user.setPhone(phoneNoInfo.getPhoneNumber());
user.setPurePhone(phoneNoInfo.getPurePhoneNumber());
user.setCountryCode(phoneNoInfo.getCountryCode());
if (isFirstPhone) {
//检查是否存在会员信息 如果有 赋值积分
// WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.findInfoByPhone(tenantEntity, user.getPhone());
// if (basicInfo != null ) {
// int credit = user.getCredit() == null ? 0 : user.getCredit();
// int score = user.getScore() == null ? 0 : user.getScore();
// int memScore = basicInfo.getPoins() == null ? 0 : basicInfo.getPoins();
// int memCredit = basicInfo.getCredit() == null ? 0 : basicInfo.getCredit();
// user.setCredit(memCredit + credit);
// user.setScore(memScore + score);
// }
}

if (!user.getPhone().contains("*")) { // 用户手机非加密
String phone = user.getPhone();
@@ -685,6 +663,8 @@ public class WxUserGrantController extends BaseController {
return new ResultData(ErrorCode.USER_PHONE_IS_FOUND);
}
user.setUserId(userBasicId);
}else{
return new ResultData(ErrorCode.PHONE_DECODE_ERR, resultMap);
}
wxCUserService.saveOrUpdate(user);
wxCUserService.delForUserIdOnly(user.getId(),user.getUserId(),user.getTenantId());
@@ -889,7 +869,7 @@ public class WxUserGrantController extends BaseController {
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}
userCar.updateTenantInfo(getTenantInfo());
userCar.setCUserId(memberId);
List<WxCUserCar> list = wxCUserCarService.getList(userCar);
return new ResultData(Result.SUCCESS, "获取查询成功", list);
@@ -976,10 +956,13 @@ public class WxUserGrantController extends BaseController {
wxCreditHistory.setFinalTenantId(tenantEntity.getFinalTenantId());
wxCreditHistory.setCreateDate(new Date());
wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.COMPLETE_INFO.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode());
wxCreditHistory.setOperatorId(memberId);
wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, record,tenantEntity);

removeCacheCUser();
}
return new ResultData();
}


+ 97
- 93
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Vedi File

@@ -58,6 +58,7 @@ public class PosServiceImpl implements PosService {
private final WxCouponOrderMapper couponOrderMapper;
private final WxCouponMerchantMapper couponMerchantMapper;
private final WxCouponMapper couponMapper;
private final WxMerchantMapper merchantMapper;


/**
@@ -1357,12 +1358,12 @@ public class PosServiceImpl implements PosService {
logger.info("核销已完成: " + couponOrderCVo.getId());
}

private int posAddCredit(WxCouponOrderCVo couponOrderCVo, WxCoupon coupon, Long merchantId, Long buUserId) {
private int posAddCredit(WxCouponOrderCVo couponOrderCVo, WxCoupon coupon, WxMerchantBUser merchantBUser, WxMerchant wxMerchant) {
try {
//-------此处为【现金支付】记录增加积分操作-------
WxCreditHistory creditHistory = new WxCreditHistory();
creditHistory.setOperatorType(EnumUserType.BUSER.getCode());
creditHistory.setOperatorId(buUserId);
creditHistory.setOperatorId(merchantBUser.getId());
creditHistory.setCUserId(couponOrderCVo.getcUserId());
creditHistory.setCreateDate(new Date());
// creditHistory.updateTenantInfo(couponOrderCVo);
@@ -1373,7 +1374,8 @@ public class PosServiceImpl implements PosService {
creditHistory.setBusinessId(coupon.getBusiness());
creditHistory.setSpend(couponOrderCVo.getCouponPrice());
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(merchantId);
creditHistory.setMerchantId(wxMerchant.getId());
creditHistory.setChangePurpose("pos消费:消费商户["+wxMerchant.getName()+"] 卷名称["+coupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory);
if (creditHistory.getCreditNum() != null) {
return creditHistory.getCreditNum();
@@ -1386,12 +1388,12 @@ public class PosServiceImpl implements PosService {
return 0;
}

private int posAddCreditForPay(WxMerchant merchant, Long buUserId, Long memId, Integer payment) {
private int posAddCreditForPay(WxMerchant merchant,WxMerchantBUser buUser, Long memId, Integer payment) {
try {
//-------此处为【现金支付】记录增加积分操作-------
WxCreditHistory creditHistory = new WxCreditHistory();
creditHistory.setOperatorType(EnumUserType.BUSER.getCode());
creditHistory.setOperatorId(buUserId);
creditHistory.setOperatorId(buUser.getId());
creditHistory.setCUserId(memId);
creditHistory.setCreateDate(new Date());
// creditHistory.updateTenantInfo(merchant);
@@ -1402,6 +1404,7 @@ public class PosServiceImpl implements PosService {
creditHistory.setSpend(payment);
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(merchant.getId());
creditHistory.setChangePurpose("pos消费:消费商户["+merchant.getName()+"] 消费金额["+creditHistory.getSpendStr()+"元]");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory);
if (creditHistory.getCreditNum() != null) {
return creditHistory.getCreditNum();
@@ -1414,92 +1417,92 @@ public class PosServiceImpl implements PosService {
return 0;
}

/**
* 核销回退
* @param couponOrderCVo
* @param buUserId
* @param posOrderId
*/
private void cancelVerify(WxCouponOrderCVo couponOrderCVo, Long buUserId, Long posOrderId) {
// 1. 积分历史回退
try {
WxCreditHistory creditHistory = new WxCreditHistory();
creditHistory.setOperatorType(EnumUserType.BUSER.getCode());
creditHistory.setOperatorId(buUserId);
creditHistory.setCUserId(couponOrderCVo.getcUserId());
// creditHistory.updateTenantInfo(couponOrderCVo);
creditHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId());
creditHistory.setTenantId(couponOrderCVo.getFinalTenantId());
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setCouponId(couponOrderCVo.getCouponId());
int num = creditHistoryService.cancelCredit(creditHistory);
if (num <= 1) {
logger.warn("核销积分历史回退: " + creditHistory.toString());
}
} catch (Exception e) {
String errMessage = "核销积分历史回退:" + e.getMessage();
logger.error(errMessage);
throw new MallinkException(500, errMessage);
}
// 2. 成长值历史回退
try {
WxScoreHistory scoreHistory = new WxScoreHistory();
// scoreHistory.updateTenantInfo(couponOrderCVo);
scoreHistory.setTenantId(couponOrderCVo.getFinalTenantId());
scoreHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId());
scoreHistory.setScoreType(EnumScoreType.CONSUMPTION.getCode());
scoreHistory.setCUserId(couponOrderCVo.getcUserId());
scoreHistory.setOrderId(couponOrderCVo.getOrderId());
int num = scoreRulesService.cancelScore(scoreHistory);
if (num <= 1) {
logger.warn("核销成长值历史回退: " + scoreHistory.toString());
}
} catch (Exception e) {
String errMessage = "核销成长值历史回退:" + e.getMessage();
logger.error(errMessage);
throw new MallinkException(500, errMessage);
}
// 3. update posOrderId
PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify();
posCouponOrderVerify.updateTenantInfo(couponOrderCVo);
posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId());
posCouponOrderVerify.setPosOrderId(posOrderId);
posCouponOrderVerify.setState(EnumEnableType.Enable.getCode());
List<PosCouponOrderVerify> posCouponOrderVerifyList = posCouponOrderVerifyService.getList(posCouponOrderVerify);
if (posCouponOrderVerifyList.size() == 1) {
posCouponOrderVerify = posCouponOrderVerifyList.get(0);
if (posCouponOrderVerify != null) {
try {
posCouponOrderVerifyService.deleteById(posCouponOrderVerify.getId());
} catch(Exception e){
logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
}
}
} else {
logger.error(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL.getMessage() + ": " + posOrderId);
throw new MallinkException(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL);
}
// 4. update couponOrder
int num = 0;
try {
WxCouponOrder couponOrder = new WxCouponOrder();
couponOrder.setId(couponOrderCVo.getId());
couponOrder.updateTenantInfo(couponOrderCVo);
couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode());
couponOrder.setUpdateDate(new Date());
num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder);
} catch (Exception e) {
logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
}
if (num != 1) {
logger.error("核销异常:updatete num " + num);
throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num);
}
logger.info("核销已取消: " + couponOrderCVo.getId());
}
// /**
// * 核销回退
// * @param couponOrderCVo
// * @param buUserId
// * @param posOrderId
// */
// private void cancelVerify(WxCouponOrderCVo couponOrderCVo, Long buUserId, Long posOrderId) {
// // 1. 积分历史回退
// try {
// WxCreditHistory creditHistory = new WxCreditHistory();
// creditHistory.setOperatorType(EnumUserType.BUSER.getCode());
// creditHistory.setOperatorId(buUserId);
// creditHistory.setCUserId(couponOrderCVo.getcUserId());
//// creditHistory.updateTenantInfo(couponOrderCVo);
// creditHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId());
// creditHistory.setTenantId(couponOrderCVo.getFinalTenantId());
// creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
// creditHistory.setCouponId(couponOrderCVo.getCouponId());
// int num = creditHistoryService.cancelCredit(creditHistory);
// if (num <= 1) {
// logger.warn("核销积分历史回退: " + creditHistory.toString());
// }
// } catch (Exception e) {
// String errMessage = "核销积分历史回退:" + e.getMessage();
// logger.error(errMessage);
// throw new MallinkException(500, errMessage);
// }
// // 2. 成长值历史回退
// try {
// WxScoreHistory scoreHistory = new WxScoreHistory();
//// scoreHistory.updateTenantInfo(couponOrderCVo);
// scoreHistory.setTenantId(couponOrderCVo.getFinalTenantId());
// scoreHistory.setFinalTenantId(couponOrderCVo.getFinalTenantId());
// scoreHistory.setScoreType(EnumScoreType.CONSUMPTION.getCode());
// scoreHistory.setCUserId(couponOrderCVo.getcUserId());
// scoreHistory.setOrderId(couponOrderCVo.getOrderId());
// int num = scoreRulesService.cancelScore(scoreHistory);
// if (num <= 1) {
// logger.warn("核销成长值历史回退: " + scoreHistory.toString());
// }
// } catch (Exception e) {
// String errMessage = "核销成长值历史回退:" + e.getMessage();
// logger.error(errMessage);
// throw new MallinkException(500, errMessage);
// }
//
// // 3. update posOrderId
// PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify();
// posCouponOrderVerify.updateTenantInfo(couponOrderCVo);
// posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId());
// posCouponOrderVerify.setPosOrderId(posOrderId);
// posCouponOrderVerify.setState(EnumEnableType.Enable.getCode());
// List<PosCouponOrderVerify> posCouponOrderVerifyList = posCouponOrderVerifyService.getList(posCouponOrderVerify);
// if (posCouponOrderVerifyList.size() == 1) {
// posCouponOrderVerify = posCouponOrderVerifyList.get(0);
// if (posCouponOrderVerify != null) {
// try {
// posCouponOrderVerifyService.deleteById(posCouponOrderVerify.getId());
// } catch(Exception e){
// logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage());
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
// }
// }
// } else {
// logger.error(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL.getMessage() + ": " + posOrderId);
// throw new MallinkException(ErrorCode.VERIFY_POS_ORDER_NOT_EQUAL);
// }
// // 4. update couponOrder
// int num = 0;
// try {
// WxCouponOrder couponOrder = new WxCouponOrder();
// couponOrder.setId(couponOrderCVo.getId());
// couponOrder.updateTenantInfo(couponOrderCVo);
// couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode());
// couponOrder.setUpdateDate(new Date());
// num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder);
// } catch (Exception e) {
// logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage());
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage());
// }
// if (num != 1) {
// logger.error("核销异常:updatete num " + num);
// throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num);
// }
// logger.info("核销已取消: " + couponOrderCVo.getId());
// }

@Override
@Transactional(rollbackFor = Exception.class)
@@ -2201,7 +2204,8 @@ public class PosServiceImpl implements PosService {

// 4. 积分
try {
int credit = posAddCredit(couponOrderCVo, wxCoupon, merchantBUser.getMerchantId(), merchantBUser.getId());
WxMerchant wxMerchant = merchantMapper.selectById(merchantBUser.getMerchantId());
int credit = posAddCredit(couponOrderCVo, wxCoupon, merchantBUser, wxMerchant);
scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + credit);
} catch (Exception e) {
logger.error("交易核销积分异常:" + e.getMessage());
@@ -2359,7 +2363,7 @@ public class PosServiceImpl implements PosService {

// 4. 积分
try {
int credit = posAddCreditForPay(merchant, buUser.getId(), memId, neuPaymentAmount);
int credit = posAddCreditForPay(merchant, buUser, memId, neuPaymentAmount);
scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + credit);
} catch (Exception e) {
logger.error("交易核销积分异常:" + e.getMessage());


+ 2
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java Vedi File

@@ -192,7 +192,7 @@ public class CouponSendSchedule {
// 发放免费券
try {
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs,cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND);
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),0L);
} catch (Exception e) {
logger.error("定时发券:发券失败 levelId=" + l.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage());
continue;
@@ -322,7 +322,7 @@ public class CouponSendSchedule {
// 发放生日券
try {
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(),cs, cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND);
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(), 0L);
couponSendedUsers.add(cu);
} catch (Exception e) {
logger.error("定时发券:发券失败 levelId=" + cu.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage());


+ 1
- 1
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Vedi File

@@ -137,7 +137,7 @@ public enum ErrorCode{
PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"),

COUPON_ONLY_FOR_NEW_MEMBER(2044, "您已经参加过新会员活动"),
COUPON_ALREADY_IN_NEW_MEMBER(2045, "您正在参加别的新会员活动"),
COUPON_ALREADY_IN_NEW_MEMBER(2045, "您已经不是新用户"),
COUPON_VALID_NOT_SUPPORTED(2046, "券类型不支持"),
/**
* 车流 2040


+ 8
- 2
mallinkService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java Vedi File

@@ -47,8 +47,7 @@ public class BaseMyBatisConfiguration {
wxCouponrSharding.setCount(100);
wxCouponrSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponrSharding);

ShardingSphere wxCouponrMerchantSharding = new ShardingSphere();
wxCouponrMerchantSharding.setColumn("tenant_id");
wxCouponrMerchantSharding.setTableName("wx_coupon_merchant");
@@ -76,6 +75,13 @@ public class BaseMyBatisConfiguration {
basicInfoSharding.setCount(100);
basicInfoSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(basicInfoSharding);

ShardingSphere wxbasicChildSharding = new ShardingSphere();
wxbasicChildSharding.setColumn("tenant_id");
wxbasicChildSharding.setTableName("wx_c_user_basic_child");
wxbasicChildSharding.setCount(100);
wxbasicChildSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxbasicChildSharding);
ShardingSphere wxOrderSharding = new ShardingSphere();
wxOrderSharding.setColumn("tenant_id");


+ 48
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicChild.java Vedi File

@@ -0,0 +1,48 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.BaseTenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;

@TableName(value = "wx_c_user_basic_child")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class WxCUserBasicChild extends BaseTenantEntity {

protected Long id;

private Long cUserId;

@io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name")
private String name;

@io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex")
private Integer sex;

@io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName")
private String nickName;

@io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate")
private Date birthdate;

@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;

@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;

@io.swagger.annotations.ApiModelProperty(value="备注",name="remark")
private String remark;

@TableField(exist = false)
private Date startTime;

@TableField(exist = false)
private Date endTime;

}

+ 22
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java Vedi File

@@ -106,6 +106,16 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@io.swagger.annotations.ApiModelProperty(value="积分",name="credit")
private Integer credit;

@Excel(name="扣减总积分",width = 20, orderNum = "12")
@io.swagger.annotations.ApiModelProperty(value="扣减积分",name="lesCredit")
@TableField(exist = false)
private Integer lesCredit;

@Excel(name="增长总积分",width = 20, orderNum = "12")
@io.swagger.annotations.ApiModelProperty(value="增加积分",name="addCredit")
@TableField(exist = false)
private Integer addCredit;

@io.swagger.annotations.ApiModelProperty(value="活动记录",name="actRecord")
private Integer actRecord;

@@ -117,6 +127,9 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
private String tagNames;


@TableField(exist = false)
private List<WxCUserBasicChild> childrenList;

@TableField(exist = false)
private String tagIds;

@@ -129,11 +142,20 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@TableField(exist = false)
private Integer carCount;

@TableField(exist = false)
private String carNumber;

@TableField(exist = false)
private Date startTime;

@TableField(exist = false)
private Date endTime;

@TableField(exist = false)
private Date creditStartTime;

@TableField(exist = false)
private Date creditEndTime;
@TableField(exist = false)
private Integer begin;


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCUserCar.java Vedi File

@@ -1,5 +1,6 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.BaseTenantEntity;
import com.iformall.domain.po.base.TenantEntity;
@@ -18,6 +19,10 @@ public class WxCUserCar extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId")
private Long cUserId;

@TableField(exist = false)
private String userPhone;

@io.swagger.annotations.ApiModelProperty(value="车牌号",name="carNumber")
private String carNumber;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponActionLog.java Vedi File

@@ -2,6 +2,7 @@ package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -36,4 +37,8 @@ public class WxCouponActionLog extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="月日",name="createTimeMd")
private String createTimeMd;

@JsonIgnore
@io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId")
private Long operatorId;

}

+ 7
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java Vedi File

@@ -7,6 +7,7 @@ import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@@ -78,4 +79,10 @@ public class WxCreditHistory extends BaseTenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "标签", name = "tags")
private List<Long> tags;

public String getSpendStr() {
if(getSpend()!=null) {
spendStr = new BigDecimal(getSpend()).divide(new BigDecimal(100)).toString();
}
return spendStr;
}
}

+ 7
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxGame.java Vedi File

@@ -34,9 +34,15 @@ public class WxGame extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "触发条件(-1:不受限制,1:登录触发, 2:主页固定入口,3:购买触发,4:核销触发,5:公众号链接触发,6:二维码触发)", name = "triggleAction")
private Integer triggleAction;

@io.swagger.annotations.ApiModelProperty(value = "限玩次数(0:不受限制,n:限玩次数)", name = "playLimit")
@io.swagger.annotations.ApiModelProperty(value = "限玩免费次数(-1:不能免费玩,0:不受限制,n:限玩次数)", name = "playLimit")
private Integer playLimit;

@io.swagger.annotations.ApiModelProperty(value = "限玩积分次数(-1:不能积分玩法,0:不受限制,n:限玩次数)", name = "playCreditLimit")
private Integer playCreditLimit;

@io.swagger.annotations.ApiModelProperty(value = "积分玩法消耗积分", name = "playCredit")
private Integer playCredit;

@io.swagger.annotations.ApiModelProperty(value = "限奖次数(0:不受限制,n:限奖次数)", name = "awardLimit")
private Integer awardLimit;



+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxGameActionLog.java Vedi File

@@ -33,5 +33,8 @@ public class WxGameActionLog extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="",name="createTime")
private Date createTime;

@io.swagger.annotations.ApiModelProperty(value = "", name = "type")
private Integer type;


}

+ 4
- 1
mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java Vedi File

@@ -26,7 +26,10 @@ public class BaseTenantEntity extends BaseEntity {
protected String finalTenantId;

public String getFinalTenantId() {
return finalTenantId;
if (!StringUtils.isBlank(parentTenantId)) {
return parentTenantId;
}
return tenantId;
}

public void setFinalTenantId(String finalTenantId) {


+ 2
- 1
mallinkService/src/main/java/com/iformall/domain/vo/WxCreditHistoryVo.java Vedi File

@@ -45,7 +45,7 @@ public class WxCreditHistoryVo extends BaseTenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "操作人类型", name = "operator")
private Integer operatorType;

@Excel(name = "操作说明", width = 20, orderNum = "9", replace = {"每日登录_1", "消费_2", "绑车牌_3", "连接WIFI_4", "微信用户昵称授权_5", "微信用户手机授权_6", "完善个人信息_7", "会员导入_8", "会员成长值扣减_9", "新增积分_10", "积分兑换_11", "消费积分_12", "活动报名_13"})
@Excel(name = "操作说明", width = 20, orderNum = "9", replace = {"每日登录_1", "消费_2", "绑车牌_3", "连接WIFI_4", "微信用户昵称授权_5", "微信用户手机授权_6", "完善个人信息_7", "会员导入_8", "会员成长值扣减_9", "新增积分_10", "积分兑换_11", "消费积分_12", "活动报名_13", "积分清零计划_14", "游戏消耗积分_15", "游戏奖励积分_16"})
@io.swagger.annotations.ApiModelProperty(value = "积分类型", name = "creditType")
private Integer creditType;

@@ -73,6 +73,7 @@ public class WxCreditHistoryVo extends BaseTenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "小票号", name = "ticketNumber")
private String ticketNumber;

@Excel(name = "说明", width = 20, orderNum = "11")
@io.swagger.annotations.ApiModelProperty(value = "兑换用途", name = "changePurpose")
private String changePurpose;



+ 3
- 1
mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java Vedi File

@@ -18,7 +18,9 @@ public enum EnumScoreType {
CHANGE_CREDIT(11, "积分兑换"),
REDUCE_CREDIT(12, "消费积分"),
ACTIVITY_JOIN(13, "活动报名"),
CLEAN_CREDIT(14, "积分清零计划"),;
CLEAN_CREDIT(14, "积分清零计划"),
GAME_LES_CREDIT(15, "游戏消耗积分"),
GAME_ADD_CREDIT(16, "游戏奖励积分"),;

public static EnumScoreType getEnum(Integer code) {
for (EnumScoreType value : values()) {


+ 7
- 0
mallinkService/src/main/java/com/iformall/enums/EnumTag.java Vedi File

@@ -204,6 +204,13 @@ public enum EnumTag {
ID_164(164L, EnumTagType.ID_28, "鞋尺码"),
ID_165(165L, EnumTagType.ID_28, "鞋尺码"),

ID_166(166L, EnumTagType.ID_29, "婴儿"),
ID_167(167L, EnumTagType.ID_29, "幼儿"),
ID_168(168L, EnumTagType.ID_29, "学龄前"),
ID_169(169L, EnumTagType.ID_29, "学龄初"),
ID_170(170L, EnumTagType.ID_29, "学龄中"),
ID_171(171L, EnumTagType.ID_29, "学龄晚"),

ID_1000(1000L, EnumTagType.ID_50,"一天以内"),
ID_1001(1001L, EnumTagType.ID_50,"一周以内"),
ID_1002(1002L, EnumTagType.ID_50,"一月以内"),


+ 2
- 0
mallinkService/src/main/java/com/iformall/enums/EnumTagType.java Vedi File

@@ -35,6 +35,8 @@ public enum EnumTagType {
ID_27(27L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_1, "服饰尺码"),
ID_28(28L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_1, "鞋尺码"),

ID_29(29L, EnumTagTypeFlag.FLAG_NORMAL, EnumTagGroup.ID_2, "子女"),

ID_0(0L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员手机"),
ID_50(50L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员会龄"),
ID_51(51L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员等级"),


+ 15
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicChildMapper.java Vedi File

@@ -0,0 +1,15 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCUserBasicChild;
import com.iformall.domain.po.WxCreditHistory;

import java.util.List;

public interface WxCUserBasicChildMapper extends CommonMapper<WxCUserBasicChild, Long>{

List<WxCUserBasicChild> findList(WxCUserBasicChild record);

int updDelById(WxCUserBasicChild record);

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java Vedi File

@@ -17,4 +17,6 @@ public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> {
long queryCarCount(Map<String,Object> carParams);

List<Map<String, Object>> queryCarCountHistory(HashMap<String,Object> params);

List<WxCUserCar> findList1(WxCUserCar record);
}

+ 6
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCreditHistoryMapper.java Vedi File

@@ -32,4 +32,10 @@ public interface WxCreditHistoryMapper extends CommonMapper<WxCreditHistory, Lon
long getPeopleCount(WxCreditHistory wxCreditHistory);
int deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);

void userCreditClear(@Param("cutOffDate")String cutOffDate,@Param("finalTableIndex")String finalTableIndex);

Integer getAddCreditSummary(WxCreditHistory wxCreditHistory);

Integer getLesCreditSummary(WxCreditHistory wxCreditHistory);
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxGameActionLogMapper.java Vedi File

@@ -10,4 +10,6 @@ public interface WxGameActionLogMapper extends CommonMapper<WxGameActionLog, Str
List<WxGameActionLog> findList(WxGameActionLog wxGameActionLog);
int getPlayCount(WxGameActionLog wxGameActionLog);
int getAwardCount(WxGameActionLog wxGameActionLog);

int getPlayCreditCount(WxGameActionLog wxGameActionLog);
}

+ 18
- 0
mallinkService/src/main/java/com/iformall/service/WxCUserBasicChildService.java Vedi File

@@ -0,0 +1,18 @@
package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
import java.util.List;

public interface WxCUserBasicChildService {

PageInfo<WxCUserBasicChild> listAsPage(WxCUserBasicChild record, Integer pageIndex, Integer pageSize);

List<WxCUserBasicChild> findList(WxCUserBasicChild record);

WxCUserBasicChild saveOrUpdate(WxCUserBasicChild record);

int updDelById(WxCUserBasicChild record);

}


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java Vedi File

@@ -42,7 +42,7 @@ public interface WxCouponActionLogService {
void deleteById(Long id,String tenantId);


void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId);
void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId,Long bUserId);


int getCountByChannelId(TenantEntity tenantEntity, int channelType, Long channelId);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java Vedi File

@@ -96,7 +96,7 @@ public interface WxCouponSendService {
*
* @param wxCouponSend
*/
void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay) ;
void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay,Long bUserId) ;


}

+ 6
- 0
mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java Vedi File

@@ -8,6 +8,7 @@ import com.iformall.domain.vo.WxCreditHistoryVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Map;

public interface WxCreditHistoryService {
@@ -72,8 +73,13 @@ public interface WxCreditHistoryService {
void clearCreditByYear();

void clearCreditByYear(WxCreditHistory wxCreditHistory);

void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory);

ResultData getCreditSummary(WxCreditHistory wxCreditHistory);

Integer getAddCreditSummary(WxCreditHistory wxCreditHistory);

Integer getLesCreditSummary(WxCreditHistory wxCreditHistory);
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxActivityJoinServiceImpl.java Vedi File

@@ -187,6 +187,7 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService {
wxCreditHistory.setCUserId(wxActivityJoin.getUserId());
wxCreditHistory.setCreditNum(credit);
wxCreditHistory.setCreditType(EnumScoreType.ACTIVITY_JOIN.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.ACTIVITY_JOIN.getMessage()+"["+wxActivity.getTitle()+"]");
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(wxActivityJoin.getUserId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory);


+ 55
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicChildServiceImpl.java Vedi File

@@ -0,0 +1,55 @@
package com.iformall.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.*;
import com.iformall.mapper.WxCUserBasicChildMapper;
import com.iformall.service.*;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;

@Service
@Slf4j
public class WxCUserBasicChildServiceImpl implements WxCUserBasicChildService {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxCUserBasicChildMapper wxCUserBasicChildMapper;

@Override
public PageInfo<WxCUserBasicChild> listAsPage(WxCUserBasicChild record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicChildMapper.findList(record));
}

@Override
public List<WxCUserBasicChild> findList(WxCUserBasicChild record) {
return wxCUserBasicChildMapper.findList(record);
}

@Override
public WxCUserBasicChild saveOrUpdate(WxCUserBasicChild record) {
Date curr = new Date();
if (record.getId() == null) {
final IdWorker idWorker = IdWorker.get();
record.setId(idWorker.nextId());
record.setCreateDate(curr);
record.setUpdateDate(curr);
wxCUserBasicChildMapper.insert(record);
} else {
record.setUpdateDate(curr);
wxCUserBasicChildMapper.updateById(record);
}
return record;
}

@Override
public int updDelById(WxCUserBasicChild record) {
return wxCUserBasicChildMapper.updDelById(record);
}
}

+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Vedi File

@@ -1101,6 +1101,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
wxCreditHistory.setOperatorType(EnumUserType.MALLUSER.getCode());
}
wxCreditHistory.setCreditType(EnumScoreType.MEM_IMPORT.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.MEM_IMPORT.getMessage());
if (oldUserBase != null) {
wxCreditHistory.setCUserId(oldUserBase.getId());
} else {


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCUserCarServiceImpl.java Vedi File

@@ -26,7 +26,7 @@ public class WxCUserCarServiceImpl implements WxCUserCarService {

@Override
public PageInfo<WxCUserCar> listAsPage(WxCUserCar record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarMapper.findList(record));
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserCarMapper.findList1(record));
}

@Override


+ 4
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java Vedi File

@@ -346,12 +346,13 @@ public class WxCUserServiceImpl implements WxCUserService {
wxCreditHistory.setFinalTenantId(user.getFinalTenantId());
wxCreditHistory.setCreateDate(new Date());
wxCreditHistory.setCreditType(enumScoreType.getCode());
wxCreditHistory.setChangePurpose(enumScoreType.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(user.getUserId());
wxCreditHistory.setCreditNum(user.getCredit());
wxCreditHistory.setCreditAmount(user.getCredit());
// wxCreditHistory.setCreditNum(user.getCredit());
// wxCreditHistory.setCreditAmount(user.getCredit());
WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
user.setCredit(record.getCreditAmount());
// user.setCredit(record.getCreditAmount());
return record.getCreditAmount();
}



+ 102
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCUserTagsServiceImpl.java Vedi File

@@ -13,6 +13,7 @@ import com.iformall.enums.*;
import com.iformall.mapper.*;
import com.iformall.service.WxCUserTagsService;
import com.iformall.service.WxTagsService;
import com.iformall.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +33,9 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
@Autowired
WxCUserBasicInfoMapper wxCUserBasicInfoMapper;

@Autowired
WxCUserBasicChildMapper wxCUserBasicChildMapper;

@Autowired
WxCouponOrderMapper wxCouponOrderMapper;

@@ -161,6 +165,54 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
return wxTagsMapper.findList(wxTags);
}

//按type 替换
private List<WxTags> assign(WxCUserBasicInfo user, List<EnumTag> enumTags, EnumTagType type){

if(user == null){
return null;
}
WxCUserTags record = new WxCUserTags();
record.setUserId(user.getId());
record.setTenantId(user.getFinalTenantId());
List<WxCUserTags> cUserTagsList = wxCUserTagsMapper.findList(record);
List<Long> tagIdList;
if(cUserTagsList != null && cUserTagsList.size() > 0){
record.setId(cUserTagsList.get(0).getId());
record.setTags(cUserTagsList.get(0).getTags());
}
String tags = record.getTags();
if (tags == null){
tagIdList = new ArrayList<Long>();
}else{
tagIdList = JSON.parseArray(tags, Long.class);
}

Iterator<Long> it = tagIdList.iterator();
while(it.hasNext()){
Long id = it.next();
if(null != id && null != EnumTag.getEnum(id) && EnumTag.getEnum(id).getType().equals(type)){
it.remove();
}
}

if(enumTags != null && enumTags.size() > 0){
for (EnumTag enumTag:enumTags) {
tagIdList.add(enumTag.getCode());
}
}

record.setTags(JSON.toJSONString(tagIdList));
saveOrUpdate(record);

if (user.getTagId() == null || !user.getTagId().equals(record.getId())) {
user.setTagId(record.getId());
wxCUserBasicInfoMapper.updateById(user);
}
WxTags wxTags = new WxTags();
wxTags.setIds(tagIdList);
return wxTagsMapper.findList(wxTags);
}

//去标
private List<WxTags> resign(WxCUserBasicInfo user, EnumTag tag){
if (tag == null || user == null)
@@ -593,6 +645,53 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
return resList;
}

private List<WxTags> assignTypeId29(WxCUserBasicInfo user) {
List<WxTags> resList = null;
WxCUserBasicChild uChild = new WxCUserBasicChild();
uChild.setTenantId(user.getFinalTenantId());
uChild.setCUserId(user.getId());
List<WxCUserBasicChild> list = wxCUserBasicChildMapper.findList(uChild);
if(list != null && list.size() > 0){
List<EnumTag> tags = new ArrayList<>();
for (WxCUserBasicChild child:list) {
if(child.getBirthdate() != null){
if (new Date().after(child.getBirthdate())) {
int age = DateUtils.getAge(child.getBirthdate());
if(age < 1){
if(!tags.contains(EnumTag.ID_166)){
tags.add(EnumTag.ID_166);
}
}else if(age >= 1 && age < 3){
if(!tags.contains(EnumTag.ID_167)){
tags.add(EnumTag.ID_167);
}
}else if(age >= 3 && age < 6){
if(!tags.contains(EnumTag.ID_168)){
tags.add(EnumTag.ID_168);
}
}else if(age >= 6 && age < 12){
if(!tags.contains(EnumTag.ID_169)){
tags.add(EnumTag.ID_169);
}
}else if(age >= 12 && age < 15){
if(!tags.contains(EnumTag.ID_170)){
tags.add(EnumTag.ID_170);
}
}else if(age >= 15 && age < 18){
if(!tags.contains(EnumTag.ID_171)){
tags.add(EnumTag.ID_171);
}
}
}
}
}
resList = assign(user,tags,EnumTagType.ID_29);
}else{
resList = assign(user,null,EnumTagType.ID_29);
}
return resList;
}

//打标接口
@Override
public List<WxTags> assignTags(List<Long> tagIdList, WxCUserBasicInfo user) {
@@ -638,6 +737,7 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
//学历
resList = assignTypeId6(user, param.getEducation());
}
resList = assignTypeId29(user);
}
}
break;
@@ -730,6 +830,8 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService {
//学历
resList = assignTypeId6(user, user.getEducation());
}

resList = assignTypeId29(user);
//消费类别
resList = assignTypeId14(user,tenantEntity);


+ 4
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Vedi File

@@ -310,6 +310,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
creditHistory.setSpend(real_payment);
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(record.getMerchantId());
WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
wxCreditHistoryService.saveOrUpdate(creditHistory);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
@@ -931,6 +933,8 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
creditHistory.setSpend(record.getRealPayment());
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(record.getMerchantId());
// WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("pos卡消费:消费商户["+merchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory);
if (creditHistory != null) {
scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + creditHistory.getCreditNum());


+ 11
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java Vedi File

@@ -56,17 +56,18 @@ public class WxCouponActionLogServiceImpl implements WxCouponActionLogService {
}

@Override
public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId) {
public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId,Long bUserId) {
Date curDate = new Date();
WxCouponActionLog actionLog = new WxCouponActionLog() {{
updateTenantInfo(tenantEntity);
setCouponId(couponId);
setChannelId(channelId);
setCouponOrderId(coupon_order_id);
setChannelType(channelType);
setCreateTime(curDate);
setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate));
}};
WxCouponActionLog actionLog = new WxCouponActionLog();
actionLog.updateTenantInfo(tenantEntity);
actionLog.setCouponId(couponId);
actionLog.setChannelId(channelId);
actionLog.setCouponOrderId(coupon_order_id);
actionLog.setChannelType(channelType);
actionLog.setCreateTime(curDate);
actionLog.setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate));
actionLog.setOperatorId(bUserId);

saveOrUpdate(actionLog);
}



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java Vedi File

@@ -276,7 +276,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
try {
couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(),wxCoupon, wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND);
if (couponOrder != null) {
wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId);
wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId,0L);
}
} catch (MallinkException e) {
logger.error(e.getMessage());


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Vedi File

@@ -465,6 +465,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(bUser.getMerchantId());
creditHistory.setBuserId(bUser.getBuserId());
WxMerchant wxMerchant = wxMerchantMapper.selectById(bUser.getMerchantId());
creditHistory.setChangePurpose("商户核销增加积分:商户名称["+wxMerchant.getName()+"] 券名称["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
wxCreditHistoryService.saveOrUpdate(creditHistory);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
@@ -495,6 +497,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
creditHistory.setCouponId(wxCoupon.getId());
creditHistory.setBusinessId(wxCoupon.getBusiness());
creditHistory.setSpend(couponOrder.getCouponPrice());
creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
wxCreditHistoryService.saveOrUpdate(creditHistory);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());


+ 13
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java Vedi File

@@ -72,21 +72,21 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
@Override
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) {
PageInfo<WxCouponSendVo> pageInfo;
/**
* 设置商户购买券数
* 前端排序:时间、商户总库存、商户已发数、商户剩余
*/
/**
* 设置商户购买券数
* 前端排序:时间、商户总库存、商户已发数、商户剩余
*/
if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) {
String sortStr = null;
if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) ||
if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_REMAIN)) {
sortStr = record.getSortColumn() + " " + record.getSortOrder();
} else if (Objects.equals(record.getSortColumn(), "createDate")) {
sortStr = "create_date" + " " + record.getSortOrder();
}
record.setSortColumn(null);
record.setSortCol(sortStr);
record.setSortColumn(null);
record.setSortCol(sortStr);
pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoByValidType(record));
for (WxCouponSendVo cs : pageInfo.getList()) {
JSONObject jo = JSONObject.parseObject(cs.getConditions());
@@ -375,7 +375,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
if (couponOrder != null) {
bRet = true;

wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId());
wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId(),0L);

// 发送消息
if (couponOrder != null) {
@@ -430,8 +430,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ);
appName = appList.get(0).getName();
}else {
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw);
appName = appInfo.getName();
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw);
appName = appInfo.getName();
}
Map<String, String> msgReplaceMap = new HashMap();
msgReplaceMap.put("title", title);
@@ -628,7 +628,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay) {
public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay,Long bUserId) {

WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,wxCouponSend.getFinalTenantId());
if (Objects.isNull(wxCUserBasicInfo)) {
@@ -643,7 +643,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
// 发放免费券
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,cs, cs.getCouponId(), cs,payWay);
if (couponOrder != null) {
wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),bUserId);
sendMsgForSendCoupon(couponOrder, cs, couponOrder, wxCUserBasicInfo);
} else {
logger.warn("handSel couponOrder is null");


+ 53
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java Vedi File

@@ -17,6 +17,7 @@ import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.ExcelService;
import com.iformall.service.WxCreditHistoryService;
import com.iformall.service.WxMallService;
import com.iformall.service.WxScoreRulesService;
import com.iformall.utils.CreditUtil;
import com.iformall.utils.RedisLock;
@@ -26,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -33,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -43,8 +46,11 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

@Autowired
WxCreditHistoryMapper wxCreditHistoryMapper;

@@ -54,6 +60,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
@Autowired
WxCUserBasicInfoMapper wxCUserBasicInfoMapper;

@Autowired
WxProjectConfigMapper wxProjectConfigMapper;

@Autowired
WxMerchantBUserMapper wxMerchantBUserMapper;

@@ -78,6 +87,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
@Autowired
WxLevelConfigMapper wxLevelConfigMapper;

@Autowired
private WxMallService wxMallService;

@Override
public void clearCreditByYear() {
WxScoreRules wxScoreRules = new WxScoreRules();
@@ -87,6 +99,20 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {

}

/**
* @param
*/
@Override
public void clearCreditByYear(WxCreditHistory wxCreditHistory) {
if(wxCreditHistory.getEndTime() == null){
wxCreditHistory.setEndTime(new Date());
}
String tableSuffix = "_" + Integer.parseInt(wxCreditHistory.getFinalTenantId())%100;

wxCreditHistoryMapper.userCreditClear(dateFormat.format(wxCreditHistory.getEndTime()),tableSuffix);

}

@Override
public void exportData(HttpServletRequest request, HttpServletResponse response, WxCreditHistory wxCreditHistory) {
List<WxCreditHistoryVo> wxCreditHistoryVoList = wxCreditHistoryMapper.findListMore(wxCreditHistory);
@@ -108,6 +134,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return new ResultData(result);
}

@Override
public Integer getAddCreditSummary(WxCreditHistory wxCreditHistory) {
return wxCreditHistoryMapper.getAddCreditSummary(wxCreditHistory);
}

@Override
public Integer getLesCreditSummary(WxCreditHistory wxCreditHistory) {
return wxCreditHistoryMapper.getLesCreditSummary(wxCreditHistory);
}

@Override
public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record));
@@ -212,13 +248,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue());
}
int currentCreditAmount = 0;
//获取当前用户总积分规则:优先获取wxCUser中数据 若不存在 再获取wxCUserBasicInfo表中数据
//获取当前用户总积分规则:
if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) {
currentCreditAmount = wxCUserBasicInfo.getCredit();
}
if (record.getCreditAmount() == null) {
record.setCreditAmount(currentCreditAmount);
}
record.setCreditAmount(currentCreditAmount);

int creditChangeNumOrigin = creditIncrement(record);
int creditChangeNum = creditChangeNumOrigin ;
@@ -350,9 +384,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) {
return bindCarAddCredit(record);
}
if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) {
return personAddCredit(record);
}
// if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) {
// return personAddCredit(record);
// }
if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) {
return phoneAddCredit(record);
}
@@ -377,6 +411,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
if (record.getCreditType() == EnumScoreType.ACTIVITY_JOIN.getCode()) {
return reduceCredit(record);
}
if (record.getCreditType() == EnumScoreType.GAME_LES_CREDIT.getCode()) {
return reduceCredit(record);
}
if (record.getCreditType() == EnumScoreType.GAME_ADD_CREDIT.getCode()) {
return record.getCreditNum();
}

return 0;
}
@@ -407,12 +447,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE);
}

private int personAddCredit(WxCreditHistory record) {
// 1. 获取score rules
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
// 2. 增长的积分
return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE);
}
// private int personAddCredit(WxCreditHistory record) {
// // 1. 获取score rules
// WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
// // 2. 增长的积分
// return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE);
// }

private int phoneAddCredit(WxCreditHistory record) {
// 1. 获取score rules


+ 26
- 7
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Vedi File

@@ -155,18 +155,35 @@ public class WxGameServiceImpl implements WxGameService {
wxGameActionLog.setGameId(gameId);

int playLimit = wxGame.getPlayLimit();
int playCreditLimit = wxGame.getPlayCreditLimit();
int playCredit = wxGame.getPlayCredit();
int AwardLimit = wxGame.getAwardLimit();
int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog);
int playCreditCount = wxGameActionLogMapper.getPlayCreditCount(wxGameActionLog);
int AwardCount = wxGameActionLogMapper.getAwardCount(wxGameActionLog);

boolean playAble = !(( playLimit != 0 && playCount >= playLimit)
|| (AwardLimit != 0 && AwardCount >= AwardLimit));
// boolean playAble = !(( playLimit != 0 && playCount >= playLimit)
// || (AwardLimit != 0 && AwardCount >= AwardLimit));

Map<String,Object> map = new HashMap();
map.put("playLimit",playLimit);
map.put("AwardLimit",AwardLimit);
map.put("playCount",playCount);
map.put("AwardCount",AwardCount);
map.put("playLimit",playLimit);//免费次数限制(为0是不限制次数,为-1是不能玩)
map.put("playCreditLimit",playCreditLimit);//消耗积分次数限制(为0是不限制次数,为-1是不能玩)
map.put("playCredit",playCredit);//消耗积分数量
map.put("AwardLimit",AwardLimit);//中奖次数限制(为0是不限制次数)
map.put("playCount",playCount);//当前玩的免费次数
map.put("playCreditCount",playCreditCount);//当前玩的消耗积分次数
map.put("AwardCount",AwardCount);//当前中奖次数

boolean playAble = true;
if(AwardLimit != 0 && AwardCount >= AwardLimit){//中奖次数没了,不能完了
playAble = false;
}
if((playLimit > 0 && playCount >= playLimit) || playLimit < 0){//免费不能玩了
if((playCreditLimit > 0 && playCreditCount >= playCreditLimit) || playCreditLimit < 0){//积分不能玩了
playAble = false;
}
}

map.put("playAble",playAble);
return new ResultData(map);
}
@@ -280,7 +297,9 @@ public class WxGameServiceImpl implements WxGameService {
Long couponId = obj.getLong("couponId");
int weight = obj.getIntValue("weight");
try {
saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record);
if(couponId != null){
saveOrUpdateCouponChannel(couponId, wxCouponChannelsMap, record);
}
} catch (MallinkException e) {
logger.error(e.getMessage());
}


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java Vedi File

@@ -39,7 +39,7 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM
WxMsgConfigMapper wxMsgConfigMapper;

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void wxMsgValidationcodeModelInit(String tenantId, String signature, String emailBgImg) {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTimestr = format.format(new Date());


+ 23
- 15
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Vedi File

@@ -469,7 +469,6 @@ public class WxOrderServiceImpl implements WxOrderService {
statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_REFUND.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_REFUND_FAILD.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_CANCEL.getCode());
@@ -479,10 +478,10 @@ public class WxOrderServiceImpl implements WxOrderService {
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_BREAK.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_SCHEDU_REFUND.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE_REFUND.getCode());
orderQ.setStatusS(statusS);
return wxOrderMapper.countCouponConditionType1(orderQ);
} catch (Exception e) {
@@ -1566,13 +1565,18 @@ public class WxOrderServiceImpl implements WxOrderService {
creditHistory.setTenantId(wxMerchant.getFinalTenantId());
creditHistory.setFinalTenantId(wxMerchant.getFinalTenantId());
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setBusinessId(wxMerchant.getBusinessId());
creditHistory.setSpend(updateOrder.getPayment());
creditHistory.setMerchantId(wxMerchant.getId());
if (updateOrder.getCouponChannelId() != null) {
WxCouponChannel wxCouponChannel = wxCouponChannelMapper.selectById(updateOrder.getCouponChannelId(),updateOrder.getTenantId());
creditHistory.setCouponId(wxCouponChannel.getCouponId());

}
creditHistory.setBusinessId(wxMerchant.getBusinessId());
creditHistory.setSpend(updateOrder.getPayment());
creditHistory.setMerchantId(wxMerchant.getId());

creditHistory.setChangePurpose("付款码消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");


wxCreditHistoryService.saveOrUpdate(creditHistory);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
@@ -2012,7 +2016,7 @@ public class WxOrderServiceImpl implements WxOrderService {
}
// couponActionLog
try {
wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId());
wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId(),0L);
} catch (Exception e) {
// 库存恢复
stockBack(order);
@@ -2191,23 +2195,27 @@ public class WxOrderServiceImpl implements WxOrderService {
private void creditPay(WxCUserBasicInfo user, WxCoupon coupon) {
//-------此处为【积分支付】记录增加积分操作-------
WxCreditHistory creditHistory = new WxCreditHistory();
//记录操作人类型 操作人id
if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) {
creditHistory.setOperatorType(EnumUserType.MALLUSER.getCode());
creditHistory.setOperatorId(user.getOperatorId());
} else {
creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
creditHistory.setOperatorId(user.getId());
}
creditHistory.setCreditNum(coupon.getCreditPrice());
creditHistory.setCUserId(user.getId());
// creditHistory.updateTenantInfo(coupon);
creditHistory.setTenantId(coupon.getFinalTenantId());
creditHistory.setFinalTenantId(coupon.getFinalTenantId());
creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode());

creditHistory.setCouponId(coupon.getId());
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
setMerchantId(coupon, creditHistory);
//记录操作人类型 操作人id
if (user.getOperatorType() == EnumUserType.MALLUSER.getCode()) {
creditHistory.setOperatorType(EnumUserType.MALLUSER.getCode());
creditHistory.setOperatorId(user.getOperatorId());
creditHistory.setChangePurpose("管理端积分兑换"+"["+coupon.getTitle()+"]");
} else {
creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
creditHistory.setOperatorId(user.getId());
creditHistory.setChangePurpose("积分兑换"+"["+coupon.getTitle()+"]");
}

wxCreditHistoryService.saveOrUpdate(creditHistory);
}



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxParkServiceImpl.java Vedi File

@@ -69,7 +69,7 @@ public class WxParkServiceImpl implements WxParkService {
}

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void saveOrUpdate(WxPark record) {
Date now = new Date();
if (record.getId() == null) {


+ 5
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxProjectConfigServiceImpl.java Vedi File

@@ -69,7 +69,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
MallUserInfoService userInfoService;

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void initProjectConfig(Long id) {
// WxProjectConfig wxProjectConfig = wxProjectConfigMapper.selectById(id);
// if(wxProjectConfig!=null && wxProjectConfig.getDelType()<10000){
@@ -131,7 +131,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
}

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void initMall(WxMall wxMall) {
if(wxMall.getId() == null){
wxMall.setTenantId("-1");
@@ -157,7 +157,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
}

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void initBuilding(List<WxMallBuilding> wxMallBuildings) {
wxMallBuildingService.deleteByTenantId(wxMallBuildings.get(0).getTenantId());
wxMallFloorService.deleteByTenantId(wxMallBuildings.get(0).getTenantId());
@@ -185,7 +185,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {
}

@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void initPayAccount(WxPayAccount wxPayAccount) {
wxPayAccountService.saveOrUpdate(wxPayAccount);
WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantId(wxPayAccount.getTenantId());
@@ -218,7 +218,7 @@ public class WxProjectConfigServiceImpl implements WxProjectConfigService {


@Override
@Transactional
@Transactional(rollbackFor = {Exception.class})
public void initUserInfo(MallUserInfo userInfo) {
userInfoService.saveOrUpdate(userInfo);
//创建角色


+ 19
- 22
mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java Vedi File

@@ -66,10 +66,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
" {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}," +
" {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}," +
" {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 8, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]");
" {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]");
wxScoreRules.setCreateDate(new Date());
wxScoreRules.setUpdateDate(new Date());
wxScoreRules.setType(2);
@@ -93,7 +91,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
" {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"数码家电\", \"businessId\": 11}," +
" {\"desc\": \"线上交易1元\", \"step\": 1, \"limit\": 0, \"score\": 0, \"title\": \"其他\", \"businessId\": 6}]}," +
" {\"id\": 3, \"desc\": \"绑定车牌1个\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 5, \"desc\": \"授权个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 6, \"desc\": \"授权手机号\", \"step\": 1, \"limit\": 1, \"score\": 0}," +
" {\"id\": 7, \"desc\": \"编辑个人信息\", \"step\": 1, \"limit\": 1, \"score\": 0}]");
wxScoreRules.setCreateDate(new Date());
@@ -419,21 +416,21 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
return addScoreNumber;
}

private int personAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) {
int addScoreNumber = 0;
// 1. 获取score rules
WxScoreRules scoreRules = getScoreRules(tenantEntity);
// 2. 获取成长值
addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE);
// 3. 增长的成长值
updateScore(user.getId(),tenantEntity, addScoreNumber);
// 4. 记录历史
recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PERSION);
return addScoreNumber;
}
// private int personAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) {
// int addScoreNumber = 0;
// // 1. 获取score rules
// WxScoreRules scoreRules = getScoreRules(tenantEntity);
//
// // 2. 获取成长值
// addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE);
//
// // 3. 增长的成长值
// updateScore(user.getId(),tenantEntity, addScoreNumber);
//
// // 4. 记录历史
// recordScoreHistory(addScoreNumber, tenantEntity, user.getId(), EnumScoreType.WECHAT_PERSION);
// return addScoreNumber;
// }

private int phoneAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) {
int addScoreNumber = 0;
@@ -600,9 +597,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
case BIND_CAR:{
return bindCarAddScore(tenantEntity,wxCUserBasicInfo);
}
case WECHAT_PERSION:{
return personAddScore(tenantEntity,wxCUserBasicInfo);
}
// case WECHAT_PERSION:{
// return personAddScore(tenantEntity,wxCUserBasicInfo);
// }
case WECHAT_PHONE:{
return phoneAddScore(tenantEntity,wxCUserBasicInfo);
}


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/park/impl/util/ParkHelper.java Vedi File

@@ -85,6 +85,7 @@ public class ParkHelper {
wxCreditHistory.setFinalTenantId(park.getFinalTenantId());
// wxCreditHistory.setCreateDate(new Date());
wxCreditHistory.setCreditType(EnumScoreType.BIND_CAR.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.BIND_CAR.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode());
wxCreditHistory.setOperatorId(cuUserId);
wxCreditHistoryService.saveOrUpdate(wxCreditHistory);


+ 30
- 0
mallinkService/src/main/java/com/iformall/utils/DateUtils.java Vedi File

@@ -1258,4 +1258,34 @@ public class DateUtils {
System.out.println(next);
}
*/


/**
* 获取多少岁
* @param birthDay
* @return
* @throws Exception
*/
public static int getAge(Date birthDay){
Calendar cal = Calendar.getInstance();
if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
throw new IllegalArgumentException(
"The birthDay is before Now.It's unbelievable!");
}
int yearNow = cal.get(Calendar.YEAR); //当前年份
int monthNow = cal.get(Calendar.MONTH); //当前月份
int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); //当前日期
cal.setTime(birthDay);
int yearBirth = cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
int age = yearNow - yearBirth; //计算整岁数
if (monthNow <= monthBirth) {
if (monthNow == monthBirth) {
if (dayOfMonthNow < dayOfMonthBirth) age--;//当前日期在生日之前,年龄减一
}else{
age--;//当前月份在生日之前,年龄减一
}
} return age;
}
}

+ 40
- 1
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Vedi File

@@ -35,7 +35,7 @@
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`
,(select level from wx_level_config
where poins >= points and tenant_id=wcubi.final_tenant_id
order by points desc limit 1 ) level,wcubi.status
order by points desc limit 1 ) level,wcubi.score_date,wcubi.status
</sql>
<sql id="allSimpleColumns">
@@ -116,6 +116,12 @@
<if test=" null != status ">
and wcubi.`status` = #{status}
</if>

<if test=" null != carNumber and '' != carNumber">
and wcubi.id in (select c_user_id from wx_c_user_car
where (`tenant_id` = #{finalTenantId} or `parent_tenant_id` = #{finalTenantId})
and car_number like concat('%', #{carNumber},'%'))
</if>
<if test=" null != ids ">
and wcubi.id in
@@ -220,6 +226,18 @@
and wcubi.`status` = #{basicInfo.status}
</if>

<if test=" null != basicInfo.carNumber and '' != basicInfo.carNumber">
and wcubi.id in (select c_user_id from wx_c_user_car
where 1=1
<if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId">
and `tenant_id` = #{tenantInfo.tenantId}
</if>
<if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId">
and `parent_tenant_id` = #{tenantInfo.parentTenantId}
</if>
and car_number like concat('%', #{basicInfo.carNumber},'%'))
</if>

<if test=" null != basicInfo.ids ">
and wcubi.id in
<foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -617,6 +635,9 @@
<result column="credit" jdbcType="INTEGER" property="credit"/>
<result column="tags" jdbcType="VARCHAR" property="tags"/>
<result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/>

<result column="addCredit" jdbcType="INTEGER" property="addCredit"/>
<result column="lesCredit" jdbcType="INTEGER" property="lesCredit"/>
</resultMap>

<sql id="allVoColumns">
@@ -801,6 +822,24 @@
<select id="findVoList1" resultMap="VoBaseResultMap">
select
<include refid="allVoColumns"/>
,(select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit
where credit.`tenant_id` = #{tenantInfo.tenantId}
and credit.credit_num &gt; 0 and credit.c_user_id = cu.id
<if test=" null != basicInfo.creditStartTime ">
and credit.create_date &gt;= #{basicInfo.creditStartTime}
</if>
<if test=" null != basicInfo.creditEndTime">
and credit.create_date &lt; #{basicInfo.creditEndTime}
</if>) as addCredit,
(select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit
where credit.`tenant_id` = #{tenantInfo.tenantId}
and credit.credit_num &lt; 0 and credit.c_user_id = cu.id
<if test=" null != basicInfo.creditStartTime ">
and credit.create_date &gt;= #{basicInfo.creditStartTime}
</if>
<if test=" null != basicInfo.creditEndTime">
and credit.create_date &lt; #{basicInfo.creditEndTime}
</if>) as lesCredit
from wx_c_user_basic_info cu
left join wx_c_user_tags cut on cut.`id` = cu.`tag_id`
<include refid="dynamicVoWhereConditions1"/>


+ 40
- 34
mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml Vedi File

@@ -6,6 +6,9 @@
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />

<result column="phone" jdbcType="VARCHAR" property="userPhone" />

<result column="car_number" jdbcType="VARCHAR" property="carNumber" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
@@ -15,80 +18,83 @@
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`car_number`,`create_date`,`update_date`,`vendor_type`,`vendor_params`,`vendor_person_id`
wcuc.`id`,wcuc.`tenant_id`,wcuc.`parent_tenant_id`,wcuc.`c_user_id`,wcuc.`car_number`,wcuc.`create_date`,wcuc.`update_date`,wcuc.`vendor_type`,wcuc.`vendor_params`,wcuc.`vendor_person_id`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
and wcuc.`id` = #{id}
</if>

<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
and wcuc.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
and wcuc.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != cUserId ">
and `c_user_id` = #{cUserId}
and wcuc.`c_user_id` = #{cUserId}
</if>
<if test=" null != carNumber ">
and `car_number` = #{carNumber}
and wcuc.`car_number` like concat('%', #{carNumber},'%')
</if>
<!-- <if test=" null != carNumber ">
and `car_number` like concat('%', #{carNumber},'%')
and `car_number` like concat('%', #{carNumber},'%')
</if> -->
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
and wcuc.`create_date` = #{createDate}
</if>
<if test=" null != vendorType ">
and `vendor_type` = #{vendorType}
and wcuc.`vendor_type` = #{vendorType}
</if>
<if test=" null != vendorParams ">
and `vendor_params` like concat('%', #{vendorParams},'%')
</if>
<!--<if test=" null != vendorParams ">
and `vendor_params` like concat('%', #{vendorParams},'%')
</if>-->
<if test=" null != vendorPersonId ">
and `vendor_person_id` = #{vendorPersonId}
and wcuc.`vendor_person_id` = #{vendorPersonId}
</if>
<if test=" null != ids ">
and id in
and wcuc.id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<!-- <if test=" null != sortColumns"> order by ${sortColumns} </if>-->
order by wcuc.create_date
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
<select id="findList1" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_c_user_car
<include refid="allColumns"/>,wcubi.`phone`
from wx_c_user_car wcuc
left join wx_c_user_basic_info wcubi on wcubi.id = wcuc.c_user_id
where 1 = 1
<if test=" null != userPhone">
and wcubi.`phone` like concat('%', #{userPhone},'%')
</if>
<include refid="dynamicWhereConditions" />

</select>

<select id="findList" parameterType="com.iformall.domain.po.WxCUserCar" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_c_user_car wcuc
where 1 = 1
<include refid="dynamicWhereConditions" />
</select>

<select id="countList" parameterType="com.iformall.domain.po.WxCUserCar" resultType="java.lang.Integer">
select count(1) from wx_c_user_car
select count(1) from wx_c_user_car wcuc
where 1 = 1
<include refid="dynamicWhereConditions" />
</select>



+ 2
- 1
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml Vedi File

@@ -346,7 +346,8 @@
LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id
LEFT JOIN wx_coupon c ON cal.coupon_id = c.id
LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id
LEFT JOIN wx_merchant_b_user mbu ON concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id')
LEFT JOIN wx_merchant_b_user mbu ON mbu.id = cal.operator_id
<!-- and concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') -->
WHERE cal.channel_type = #{channelType}
AND cs.conditions -> '$.id' = concat(#{merchantId},'')
<if test=" null != beginDate ">


+ 31
- 0
mallinkService/src/main/resources/mapper/WxCreditHistoryMapper.xml Vedi File

@@ -247,6 +247,33 @@
<include refid="customWhereConditions"/>
and credit.credit_num &lt; 0
</select>

<select id="getAddCreditSummary" parameterType="com.iformall.domain.po.WxCreditHistory"
resultType="java.lang.Integer">
select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit
where credit.`tenant_id` = #{tenantId}
and credit.credit_num &gt; 0 and credit.c_user_id = #{cUserId}
<if test=" null != startTime ">
and credit.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and credit.create_date &lt; #{endTime}
</if>

</select>

<select id="getLesCreditSummary" parameterType="com.iformall.domain.po.WxCreditHistory"
resultType="java.lang.Integer">
select ifnull(sum(credit.credit_num),0) amount from wx_credit_history credit
where credit.`tenant_id` = #{tenantId}
and credit.credit_num &lt; 0 and credit.c_user_id = #{cUserId}
<if test=" null != startTime ">
and credit.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and credit.create_date &lt; #{endTime}
</if>
</select>
<select id="getPeopleCount" parameterType="com.iformall.domain.po.WxCreditHistory" resultType="java.lang.Long">
select count(1) people from (
@@ -262,4 +289,8 @@
delete from wx_credit_history where id = #{id} and tenant_id = #{tenantId}
</delete>

<update id="userCreditClear" statementType="CALLABLE" >
{call user_credit_clear(#{cutOffDate},#{finalTableIndex})}
</update>

</mapper>

+ 19
- 1
mallinkService/src/main/resources/mapper/WxGameActionLogMapper.xml Vedi File

@@ -9,10 +9,12 @@
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />

<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`,`type`
</sql>

<sql id="dynamicWhereConditions">
@@ -60,6 +62,11 @@

</if>

<if test=" null != type ">
and `type` = #{type}

</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -121,6 +128,10 @@
and `end_time` &lt;= #{endTime}

</if>
<if test=" null != type ">
and `type` = #{type}

</if>


</sql>
@@ -128,6 +139,13 @@
<select id="getPlayCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">
select COUNT(*) FROM wx_game_action_log a
<include refid="dynamicCountWhereConditions" />
and `type` = 0
</select>

<select id="getPlayCreditCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">
select COUNT(*) FROM wx_game_action_log a
<include refid="dynamicCountWhereConditions" />
and `type` = 1
</select>

<select id="getAwardCount" resultType="java.lang.Integer" parameterType="com.iformall.domain.po.WxGameActionLog">


+ 4
- 1
mallinkService/src/main/resources/mapper/WxGameMapper.xml Vedi File

@@ -13,10 +13,13 @@
<result column="triggle_action" jdbcType="INTEGER" property="triggleAction" />
<result column="play_limit" jdbcType="INTEGER" property="playLimit" />
<result column="award_limit" jdbcType="INTEGER" property="awardLimit" />

<result column="play_credit_limit" jdbcType="INTEGER" property="playCreditLimit" />
<result column="play_credit" jdbcType="INTEGER" property="playCredit" />
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`game_id`,`status`,`coupon_ids`,`valid_start_date`,`valid_end_date`,`triggle_action`,`play_limit`,`award_limit`
`id`,`tenant_id`,`parent_tenant_id`,`game_id`,`status`,`coupon_ids`,`valid_start_date`,`valid_end_date`,`triggle_action`,`play_limit`,`award_limit`,`play_credit_limit`,`play_credit`
</sql>

<sql id="dynamicWhereConditions">


+ 1
- 1
mallinkService/src/main/resources/mapper/WxMallMapper.xml Vedi File

@@ -205,7 +205,7 @@


<select id="getTenantEntitys" parameterType="com.iformall.domain.po.base.TenantEntity" resultType="com.iformall.domain.po.base.TenantEntity">
select `tenant_id`,`parent_tenant_id` from wx_mall where id &gt; 1
select `tenant_id`,`parent_tenant_id` from wx_mall where 1=1
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>


+ 1
- 1
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Vedi File

@@ -149,7 +149,7 @@
select count(*) from wx_order o,wx_coupon c
where o.product_id = c.id
and c.conditions is not null
and JSON_EXTRACT(c.conditions, '$.type') = 1
/*and JSON_EXTRACT(c.conditions, '$.type') = 1*/
<if test=" null != cUserId ">
and o.c_user_id = #{cUserId}
</if>


+ 68
- 0
mallinkService/src/main/resources/mapper/wxCUserBasicChildMapper.xml Vedi File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxCUserBasicChildMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserBasicChild">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="sex" jdbcType="INTEGER" property="sex" />
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remark" jdbcType="VARCHAR" property="remark" />

</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`c_user_id`,`name`,`nick_name`,`birthdate`,`sex`,`remark`,`create_date`,`update_date`
</sql>

<sql id="dynamicWhereConditions">
where del_status = 0
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != cUserId ">
and `c_user_id` = #{cUserId}
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')
</if>
<if test=" null != nickName ">
and `nick_name` like concat('%', #{nickName},'%')
</if>
<if test=" null != sex ">
and `sex` = #{sex}
</if>

<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
<select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicChild" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_c_user_basic_child
<include refid="dynamicWhereConditions" />
</select>

<update id="updDelById" parameterType="com.iformall.domain.po.WxCUserBasicChild">
update wx_c_user_basic_child set del_status = 0 where id = #{id} and tenant_id = #{tenantId}
</update>

</mapper>

+ 5
- 0
mallinkSysAdmin/src/main/java/com/iformall/controller/datafix/DataInitController.java Vedi File

@@ -58,6 +58,9 @@ public class DataInitController extends BaseController {
@Resource
private WxMerchantBUserMapper merchantBUserMapper;

@Resource
private WxMerchantService merchantService;

@Autowired
private WxOrderService wxOrderService;

@@ -211,6 +214,8 @@ public class DataInitController extends BaseController {
creditHistory.setSpend(co.getCouponPrice());
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(buUser.getMerchantId());
WxMerchant wxMerchant = merchantService.getById(buUser.getMerchantId());
creditHistory.setChangePurpose("核销积分数据修复:消费商户["+wxMerchant.getName()+"] 卷名称["+coupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
creditHistoryService.saveOrUpdate(creditHistory);
});
}


+ 6
- 1
mybatis-multi-tenancy/src/main/java/com/iformall/plugin/shard/plugin/ShardingSpherePlugin.java Vedi File

@@ -14,6 +14,7 @@ import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.logging.LogFactory;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.StatementType;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.SystemMetaObject;
@@ -86,7 +87,11 @@ public class ShardingSpherePlugin implements MyBatisPlus {
MetaObject metaStatementHandler = SystemMetaObject.forObject(statementHandler);
MappedStatement ms = (MappedStatement) metaStatementHandler.getValue("delegate.mappedStatement");
//String id = ms.getId();
if(ms.getStatementType().equals(StatementType.CALLABLE)){
return chainMap;
}

//String id = ms.getId();
//String className = id.substring(0, id.lastIndexOf("."));
//String methodName = id.substring(id.lastIndexOf(".") + 1);
//Class<?> clazz = Class.forName(className);


Caricamento…
Annulla
Salva