| @@ -57,6 +57,13 @@ public class WxBusinessController extends BaseController { | |||||
| final List<WxBusiness> busList = wxBusinessService.findList(bq); | final List<WxBusiness> busList = wxBusinessService.findList(bq); | ||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @ApiOperation("业态树接口") | |||||
| @GetMapping("treeList") | |||||
| public ResultData treeList() { | |||||
| final List<WxBusiness> busList = wxBusinessService.findTreeList(getTenantInfo()); | |||||
| return new ResultData(busList); | |||||
| } | |||||
| @ApiOperation("业态分析接口") | @ApiOperation("业态分析接口") | ||||
| @GetMapping("businessDataList") | @GetMapping("businessDataList") | ||||
| @@ -6,11 +6,13 @@ import com.iformall.annotation.RedisCache; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCouponOrderCVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.order.OrderFactory; | import com.iformall.service.order.OrderFactory; | ||||
| import com.iformall.service.order.entity.WxComposeOrder; | import com.iformall.service.order.entity.WxComposeOrder; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -335,6 +338,17 @@ public class WxMicroPayController extends BaseController { | |||||
| // 获取C用户 | // 获取C用户 | ||||
| WxCUserBasicInfo cUser = null; | WxCUserBasicInfo cUser = null; | ||||
| if (StringUtils.isNotBlank(cUserIdStr)) { | if (StringUtils.isNotBlank(cUserIdStr)) { | ||||
| String _memberId = WxCouponOrderCVo.getDecodeExpiredCouponOrderId(cUserIdStr); | |||||
| if (_memberId.contains(WxCouponOrderCVo.arg)) { | |||||
| String[] decodeids = _memberId.split(WxCouponOrderCVo.arg); | |||||
| cUserIdStr = decodeids[0]; | |||||
| String expiredtimeStr = decodeids[1]; | |||||
| Date expiredtime = DateUtils.string2Date(expiredtimeStr).getTime(); | |||||
| if (expiredtime.before(new Date())) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"码已失效,请更新二维码后重试"); | |||||
| } | |||||
| } | |||||
| Long cUserId = 0L; | Long cUserId = 0L; | ||||
| try { | try { | ||||
| cUserId = Long.valueOf(cUserIdStr); | cUserId = Long.valueOf(cUserIdStr); | ||||
| @@ -780,7 +780,7 @@ public class WxUserGrantController extends BaseController { | |||||
| SysConfig sysConfig = sysConfigService.getByKey(SysConfigConstant.member_seconds_key, getTenantInfo()); | SysConfig sysConfig = sysConfigService.getByKey(SysConfigConstant.member_seconds_key, getTenantInfo()); | ||||
| if (null == sysConfig || StringUtils.isBlank(sysConfig.getConfigItemValue())) { | if (null == sysConfig || StringUtils.isBlank(sysConfig.getConfigItemValue())) { | ||||
| return new ResultData(ErrorCode.SYS_CONFIG_VIERFY_SECODES_UNSET); | |||||
| return new ResultData(ErrorCode.SYS_CONFIG_MEMBER_SECODES_UNSET); | |||||
| } | } | ||||
| Map<String, Object> result = new HashMap(); | Map<String, Object> result = new HashMap(); | ||||
| @@ -37,7 +37,7 @@ public enum ErrorCode{ | |||||
| SYS_CONFIG_VIERFY_SECODES_UNSET(1030,"系统设置【券码刷新时间】未配置"), | SYS_CONFIG_VIERFY_SECODES_UNSET(1030,"系统设置【券码刷新时间】未配置"), | ||||
| SYS_CONFIG_CARD_VIERFY_SECODES_UNSET(1030,"系统设置【电子卡码刷新时间】未配置"), | SYS_CONFIG_CARD_VIERFY_SECODES_UNSET(1030,"系统设置【电子卡码刷新时间】未配置"), | ||||
| SYS_CONFIG_DEFAULT_MERCHANT_B_USER_UNSET(1031,"系统配置【外部设备核销默认商户员工编号】未配置"), | SYS_CONFIG_DEFAULT_MERCHANT_B_USER_UNSET(1031,"系统配置【外部设备核销默认商户员工编号】未配置"), | ||||
| SYS_CONFIG_MEMBER_SECODES_UNSET(1030,"系统设置【会员码刷新时间】未配置"), | |||||
| /** | /** | ||||
| * 菜单 | * 菜单 | ||||
| */ | */ | ||||
| @@ -8,6 +8,7 @@ import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | import lombok.EqualsAndHashCode; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| @TableName(value = "wx_business") | @TableName(value = "wx_business") | ||||
| @Data | @Data | ||||
| @@ -49,4 +50,7 @@ public class WxBusiness extends TenantEntityWithoutFinalTenantId { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Integer isRoot; | private Integer isRoot; | ||||
| @TableField(exist = false) | |||||
| private List<WxBusiness> children; | |||||
| } | } | ||||
| @@ -31,6 +31,7 @@ public interface WxBusinessService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<WxBusiness> findList(WxBusiness record); | List<WxBusiness> findList(WxBusiness record); | ||||
| List<WxBusiness> findTreeList(TenantEntity tenantEntity); | |||||
| /** | /** | ||||
| * 查询全部列表 | * 查询全部列表 | ||||
| @@ -228,4 +228,53 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| return map; | return map; | ||||
| } | } | ||||
| @Override | |||||
| public List<WxBusiness> findTreeList(TenantEntity tenantEntity) { | |||||
| WxBusiness bq = new WxBusiness(); | |||||
| bq.setFinalTenantId(tenantEntity.getFinalTenantId()); | |||||
| bq.setIsDel(EnumYesOrNo.NO.getCode()); | |||||
| List<WxBusiness> alls = wxBusinessMapper.findListAll(bq); | |||||
| if (null != alls && alls.size() > 0) { | |||||
| List<WxBusiness> roots = new ArrayList<WxBusiness>(); | |||||
| Map<Integer,List<WxBusiness>> childMap = new HashMap<Integer,List<WxBusiness>>(); | |||||
| for (int i = 0 ; i < alls.size() ; i ++) { | |||||
| WxBusiness business = alls.get(i); | |||||
| List<WxBusiness> childs = childMap.get(business.getId()); | |||||
| if (null == childs) { | |||||
| childMap.put(business.getId(), new ArrayList<WxBusiness>()); | |||||
| } | |||||
| if (null == business.getParentId() || business.getParentId() == 0) { | |||||
| roots.add(business); | |||||
| }else { | |||||
| childMap.get(business.getParentId()).add(business); | |||||
| } | |||||
| } | |||||
| if (roots.size() > 0 ) { | |||||
| for (int i = 0 ; i < roots.size() ; i ++) { | |||||
| buildChildTree(roots.get(i),childMap); | |||||
| } | |||||
| return roots; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private void buildChildTree(WxBusiness parent,Map<Integer,List<WxBusiness>> childMap) { | |||||
| if (null == childMap || childMap.size() <= 0 ) { | |||||
| return ; | |||||
| } | |||||
| List<WxBusiness> childs = childMap.get(parent.getId()); | |||||
| if (null == childs || childs.size() <= 0 ) { | |||||
| return ; | |||||
| } | |||||
| //子集 | |||||
| List<WxBusiness> treeList = new ArrayList<WxBusiness>(); | |||||
| for (WxBusiness business:childs) { | |||||
| buildChildTree(business,childMap); | |||||
| } | |||||
| if (treeList.size() > 0 ) { | |||||
| parent.setChildren(treeList); | |||||
| } | |||||
| } | |||||
| } | } | ||||