| @@ -79,9 +79,6 @@ public class MallUserInfo extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "邮箱", name = "email") | |||
| private String email; | |||
| @io.swagger.annotations.ApiModelProperty(value = "作者Id", name = "merchantId") | |||
| private Long merchantId; | |||
| public Integer getWithWechatNotFormat() { | |||
| return this.withWechat; | |||
| } | |||
| @@ -1,11 +1,13 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.alibaba.fastjson.annotation.JSONField; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @@ -158,6 +160,29 @@ public class WxMall extends TenantEntity { | |||
| } | |||
| } | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员Id",name="adminId") | |||
| @TableField(exist = false) | |||
| private Long adminId; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员姓名",name="adminName") | |||
| @TableField(exist = false) | |||
| private String adminName; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员电话",name="adminPhone") | |||
| @TableField(exist = false) | |||
| private String adminPhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆帐号",name="adminUsername") | |||
| @TableField(exist = false) | |||
| private String adminUsername; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆密码",name="adminPassword") | |||
| @TableField(exist = false) | |||
| private String adminPassword; | |||
| @io.swagger.annotations.ApiModelProperty(value="1:有效,0:禁止登录",name="adminStatus") | |||
| @TableField(exist = false) | |||
| private Integer adminStatus; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startTime") | |||
| @@ -1,43 +0,0 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| */ | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class TtMallVo extends WxMall { | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员Id",name="adminId") | |||
| @TableField(exist = false) | |||
| private Long adminId; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员姓名",name="adminName") | |||
| @TableField(exist = false) | |||
| private String adminName; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员电话",name="adminPhone") | |||
| @TableField(exist = false) | |||
| private String adminPhone; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆帐号",name="adminUsername") | |||
| @TableField(exist = false) | |||
| private String adminUsername; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆密码",name="adminPassword") | |||
| @TableField(exist = false) | |||
| private String adminPassword; | |||
| @io.swagger.annotations.ApiModelProperty(value="1:有效,0:禁止登录",name="adminStatus") | |||
| @TableField(exist = false) | |||
| private Integer adminStatus; | |||
| } | |||
| @@ -1,40 +0,0 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| /** | |||
| * Created by syf on 2018/8/30. | |||
| */ | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class TtMerchantVo extends WxMerchant { | |||
| @io.swagger.annotations.ApiModelProperty(value="帐号Id",name="accountLoginId") | |||
| @TableField(exist = false) | |||
| private Long accountLoginId; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆帐号",name="adminUsername") | |||
| @TableField(exist = false) | |||
| private String accountUsername; | |||
| @io.swagger.annotations.ApiModelProperty(value="管理员登陆密码",name="adminPassword") | |||
| @TableField(exist = false) | |||
| private String accountPassword; | |||
| @io.swagger.annotations.ApiModelProperty(value="启用开始时间",name="validStart") | |||
| @TableField(exist = false) | |||
| private Date validStart; | |||
| @io.swagger.annotations.ApiModelProperty(value = "启用结束时间", name = "validEnd") | |||
| @TableField(exist = false) | |||
| private Date validEnd; | |||
| } | |||
| @@ -1,39 +0,0 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2019/09/21 | |||
| */ | |||
| public enum EnumTtSaleType { | |||
| ZHUZHI(102, "组织"), | |||
| UPZHU(103, "UP主"), | |||
| ZUOZHE(104, "作者"), | |||
| YUNYING(101, "运营"), | |||
| ; | |||
| public static EnumTtSaleType getEnum(Integer code) { | |||
| for (EnumTtSaleType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumTtSaleType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -3,7 +3,6 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.vo.TtMerchantVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| @@ -58,6 +57,4 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| List<WxMerchant> findFollowList(WxMerchant record); | |||
| int recordedAmount(WxMerchant record); | |||
| List<TtMerchantVo> findTtList(TtMerchantVo wxMerchant); | |||
| } | |||
| @@ -7,7 +7,6 @@ import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxProjectConfig; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import java.io.Serializable; | |||
| import java.util.Collection; | |||
| @@ -204,6 +203,4 @@ public interface MallUserInfoService { | |||
| * @return | |||
| */ | |||
| Set<String> getUserPermissions(MallUserInfo record, boolean boolNav); | |||
| int ttMerchantDisable(Long merchantId, EnumYesOrNo yes); | |||
| } | |||
| @@ -5,7 +5,6 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxProjectConfig; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.vo.TtMallVo; | |||
| import java.util.List; | |||
| @@ -89,5 +88,5 @@ public interface WxMallService { | |||
| PageInfo<WxMall> listAadminAsPage(WxMall wxMall, Integer pageNum, Integer pageSize); | |||
| ResultData addAadmin(TtMallVo ttMallVo); | |||
| ResultData addAadmin(WxMall wxMall); | |||
| } | |||
| @@ -6,7 +6,10 @@ import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.domain.vo.WxMerchantSimpleVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| @@ -168,11 +171,9 @@ public interface WxMerchantService { | |||
| ResultData markup(WxMerchant wxMerchant); | |||
| ResultData addttMerchant(TtMerchantVo ttMerchantVo); | |||
| ResultData addttMerchant(WxMerchant wxMerchant, Long userId); | |||
| ResultData ttdisable(Long id); | |||
| ResultData ttstartusing(Long id); | |||
| PageInfo<TtMerchantVo> ttlistAsPage(TtMerchantVo wxMerchant, Integer pageNum, Integer pageSize); | |||
| } | |||
| @@ -12,7 +12,6 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.MallRoleService; | |||
| @@ -336,13 +335,4 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| return permsSet; | |||
| } | |||
| @Override | |||
| public int ttMerchantDisable(Long merchantId, EnumYesOrNo yesOrNo) { | |||
| MallUserInfo userInfoQ = new MallUserInfo(); | |||
| userInfoQ.setMerchantId(merchantId); | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setStatus(yesOrNo.getCode()); | |||
| return mallUserInfoMapper.update(userInfo,new QueryWrapper<>(userInfoQ)); | |||
| } | |||
| } | |||
| @@ -7,8 +7,6 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtMallVo; | |||
| import com.iformall.enums.EnumGroupSupport; | |||
| import com.iformall.enums.EnumInvestUserType; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| @@ -276,40 +274,39 @@ public class WxMallServiceImpl implements WxMallService { | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData addAadmin(TtMallVo ttMallVo) { | |||
| public ResultData addAadmin(WxMall wxMall) { | |||
| if(ttMallVo.getId() == null){ | |||
| // ttMallVo.setValidStart(new Date()); | |||
| if(StringUtils.isBlank(ttMallVo.getBusinessHours())){ | |||
| ttMallVo.setBusinessHours("[]"); | |||
| if(wxMall.getId() == null){ | |||
| wxMall.setValidStart(new Date()); | |||
| if(StringUtils.isBlank(wxMall.getBusinessHours())){ | |||
| wxMall.setBusinessHours("[]"); | |||
| } | |||
| if(StringUtils.isBlank(ttMallVo.getIntroduction())){ | |||
| ttMallVo.setIntroduction(""); | |||
| if(StringUtils.isBlank(wxMall.getIntroduction())){ | |||
| wxMall.setIntroduction(""); | |||
| } | |||
| if(StringUtils.isBlank(ttMallVo.getImg())){ | |||
| ttMallVo.setImg(""); | |||
| if(StringUtils.isBlank(wxMall.getImg())){ | |||
| wxMall.setImg(""); | |||
| } | |||
| ttMallVo.setTenantId("-1"); | |||
| ttMallVo.setGroupSupport(EnumGroupSupport.SUPPORT.getCode()); | |||
| this.save(ttMallVo); | |||
| ttMallVo.setTenantId(ttMallVo.getId().toString()); | |||
| wxMall.setTenantId("-1"); | |||
| this.save(wxMall); | |||
| wxMall.setTenantId(wxMall.getId().toString()); | |||
| }else{ | |||
| WxMall byId = this.getById(ttMallVo.getId()); | |||
| WxMall byId = this.getById(wxMall.getId()); | |||
| if(byId == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"找不到组织"); | |||
| } | |||
| ttMallVo.updateTenantInfo(byId.getTenantInfo()); | |||
| wxMall.updateTenantInfo(byId.getTenantInfo()); | |||
| } | |||
| this.update(ttMallVo); | |||
| this.update(wxMall); | |||
| boolean bChangedPhone = false; | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setId(ttMallVo.getAdminId()); | |||
| userInfo.updateTenantInfo(ttMallVo.getTenantInfo()); | |||
| userInfo.setName(ttMallVo.getAdminName()); | |||
| userInfo.setUsername(ttMallVo.getAdminUsername()); | |||
| userInfo.setPhone(ttMallVo.getAdminPhone()); | |||
| userInfo.setPassword(ttMallVo.getAdminPassword()); | |||
| userInfo.setId(wxMall.getAdminId()); | |||
| userInfo.updateTenantInfo(wxMall.getTenantInfo()); | |||
| userInfo.setName(wxMall.getAdminName()); | |||
| userInfo.setUsername(wxMall.getAdminUsername()); | |||
| userInfo.setPhone(wxMall.getAdminPhone()); | |||
| userInfo.setPassword(wxMall.getAdminPassword()); | |||
| if(userInfo.getId() == null){ | |||
| if(userInfoService.cntByUserName(userInfo.getUsername()) > 0){ | |||
| @@ -20,7 +20,6 @@ import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.PasswordHelper; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -30,7 +29,6 @@ import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Isolation; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.util.Assert; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| @@ -108,9 +106,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Autowired | |||
| WxMallService wxMallService; | |||
| @Autowired | |||
| MallUserInfoService userInfoService; | |||
| @Autowired | |||
| TtCouponMapper ttCouponMapper; | |||
| @@ -1045,158 +1040,49 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData addttMerchant(TtMerchantVo ttMerchantVo) { | |||
| public ResultData addttMerchant(WxMerchant wxMerchant, Long userId) { | |||
| try { | |||
| if(StringUtils.isBlank(ttMerchantVo.getParentTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,"数据异常"); | |||
| } | |||
| WxMall parentMall = wxMallService.getByTenantId(ttMerchantVo.getParentTenantId()); | |||
| if(parentMall == null){ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,"数据异常"); | |||
| } | |||
| if(StringUtils.isBlank(ttMerchantVo.getTenantId())){ | |||
| WxMall wxMall = new WxMall(); | |||
| wxMall.setName(ttMerchantVo.getName()); | |||
| wxMall.setServicePhone(ttMerchantVo.getLinkPhone()); | |||
| wxMall.setImgUrlH(parentMall.getImgUrlH()); | |||
| wxMall.setSaleType(EnumTtSaleType.UPZHU.getCode()); | |||
| wxMall.setValidStart(ttMerchantVo.getValidStart()); | |||
| wxMall.setValidEnd(ttMerchantVo.getValidEnd()); | |||
| wxMall.setIntroduction(ttMerchantVo.getIntroduction()); | |||
| wxMall.setBusinessHours("[]"); | |||
| wxMall.setIntroduction(""); | |||
| wxMall.setImg(""); | |||
| wxMall.setTenantId("-1"); | |||
| wxMall.setGroupSupport(EnumGroupSupport.NOT_SUPPORT.getCode()); | |||
| wxMallService.save(wxMall); | |||
| wxMall.setTenantId(wxMall.getId().toString()); | |||
| wxMallService.update(wxMall); | |||
| ttMerchantVo.setTenantId(wxMall.getTenantId()); | |||
| ttMerchantVo.setIsAdmin(EnumYesOrNo.YES.getCode()); | |||
| }else{ | |||
| WxMall mall = wxMallService.getByTenantId(ttMerchantVo.getTenantId()); | |||
| if(mall == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到组织"); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(wxMerchant.getTenantId()); | |||
| if(mall == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"找不到组织"); | |||
| } | |||
| wxMerchant.updateTenantInfo(mall.getTenantInfo()); | |||
| if (hasMerchant(ttMerchantVo)) { | |||
| if (hasMerchant(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_NAME_IS_FOUND,"名称已存在"); | |||
| } | |||
| if (hasMerchantEncode(ttMerchantVo)) { | |||
| if (hasMerchantEncode(wxMerchant)) { | |||
| return new ResultData(ErrorCode.MERCHANT_CODE_IS_FOUND,"编码已存在"); | |||
| } | |||
| if (StringUtils.isNotBlank(ttMerchantVo.getCoverPicture())) { | |||
| List<String> coverPicture = JSONArray.parseArray(ttMerchantVo.getCoverPicture(), String.class); | |||
| if (StringUtils.isNotBlank(wxMerchant.getCoverPicture())) { | |||
| List<String> coverPicture = JSONArray.parseArray(wxMerchant.getCoverPicture(), String.class); | |||
| if (!coverPicture.isEmpty()) { | |||
| ttMerchantVo.setImgUrl(coverPicture.get(0)); | |||
| wxMerchant.setImgUrl(coverPicture.get(0)); | |||
| } | |||
| } else { | |||
| if (StringUtils.isNotBlank(ttMerchantVo.getImgUrl())) { | |||
| if (StringUtils.isNotBlank(wxMerchant.getImgUrl())) { | |||
| List<String> strList = new ArrayList<String>(); | |||
| strList.add(ttMerchantVo.getImgUrl()); | |||
| ttMerchantVo.setCoverPicture(JSONArray.toJSONString(strList)); | |||
| strList.add(wxMerchant.getImgUrl()); | |||
| wxMerchant.setCoverPicture(JSONArray.toJSONString(strList)); | |||
| } | |||
| } | |||
| Date date = new Date(); | |||
| if(ttMerchantVo.getId() == null){ | |||
| if(wxMerchant.getId() == null){ | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| ttMerchantVo.setId(idWorker.nextId()); | |||
| if(ttMerchantVo.getStatus() == null){ | |||
| ttMerchantVo.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| } | |||
| if(ttMerchantVo.getIsAdmin() == null) { | |||
| ttMerchantVo.setIsAdmin(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| ttMerchantVo.setUpdateDate(date); | |||
| ttMerchantVo.setCreateDate(date); | |||
| wxMerchantMapper.insert(ttMerchantVo); | |||
| }else{ | |||
| WxMerchant merchant = wxMerchantMapper.selectById(ttMerchantVo.getId()); | |||
| if(merchant == null){ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,"找不到数据"); | |||
| } | |||
| if(merchant.getIsAdmin().equals(EnumYesOrNo.YES.getCode())){ | |||
| if(!merchant.getTenantId().equals(ttMerchantVo.getTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR,"UP主组织不能改变"); | |||
| } | |||
| WxMall wxMallU = new WxMall(); | |||
| wxMallU.setId(Long.parseLong(merchant.getTenantId())); | |||
| wxMallU.setName(ttMerchantVo.getName()); | |||
| wxMallU.setServicePhone(ttMerchantVo.getLinkPhone()); | |||
| wxMallU.setValidStart(ttMerchantVo.getValidStart()); | |||
| wxMallU.setValidEnd(ttMerchantVo.getValidEnd()); | |||
| wxMallU.setIntroduction(ttMerchantVo.getIntroduction()); | |||
| wxMallService.update(wxMallU); | |||
| wxMerchant.setId(idWorker.nextId()); | |||
| if(wxMerchant.getStatus() == null){ | |||
| wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| } | |||
| ttMerchantVo.setUpdateDate(date); | |||
| wxMerchantMapper.updateById(ttMerchantVo); | |||
| } | |||
| boolean bChangedPhone = false; | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setId(ttMerchantVo.getAccountLoginId()); | |||
| userInfo.updateTenantInfo(ttMerchantVo); | |||
| userInfo.setName(ttMerchantVo.getLinkPerson()); | |||
| userInfo.setUsername(ttMerchantVo.getAccountUsername()); | |||
| userInfo.setPhone(ttMerchantVo.getLinkPhone()); | |||
| userInfo.setPassword(ttMerchantVo.getAccountPassword()); | |||
| userInfo.setMerchantId(ttMerchantVo.getId()); | |||
| if(ttMerchantVo.getIsAdmin().equals(EnumYesOrNo.YES.getCode())){ | |||
| userInfo.setIsAdmin(EnumUserAdmin.ADMIN.getCode()); | |||
| }else{ | |||
| userInfo.setIsAdmin(EnumUserAdmin.Normal.getCode()); | |||
| } | |||
| if(userInfo.getId() == null){ | |||
| if(userInfoService.cntByUserName(userInfo.getUsername()) > 0){ | |||
| return new ResultData(ErrorCode.USER_NAME_IS_FOUND.getCode(),"用户名已存在"); | |||
| // wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode()); | |||
| if(wxMerchant.getIsAdmin() == null) { | |||
| wxMerchant.setIsAdmin(EnumYesOrNo.NO.getCode()); | |||
| } | |||
| if(userInfoService.cntByUserPhone(userInfo.getPhone()) > 0){ | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||
| } | |||
| if(StringUtils.isBlank(userInfo.getPassword())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"密码不能为空"); | |||
| } | |||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||
| passwordHelper.encryptPassword(userInfo); | |||
| userInfo.setInvestRule(EnumInvestUserType.ALL.getCode()); | |||
| userInfo.setStatus(EnumMallUserStatus.VALID.getCode()); | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchant.setCreateDate(date); | |||
| wxMerchantMapper.insert(wxMerchant); | |||
| }else{ | |||
| MallUserInfo oldUser = userInfoService.getById(userInfo.getId()); | |||
| if(oldUser == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"找不到管理员"); | |||
| } | |||
| userInfo.setUsername(oldUser.getUsername()); | |||
| if(!oldUser.getTenantId().equals(userInfo.getTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"tenant_id不匹配"); | |||
| } | |||
| // if (!oldUser.getUsername().equals(userInfo.getUsername())) { | |||
| // if(userInfoService.cntByUserName(userInfo.getUsername()) > 0){ | |||
| // return new ResultData(ErrorCode.USER_NAME_IS_FOUND.getCode(),"用户名已存在"); | |||
| // } | |||
| // } | |||
| if (!oldUser.getPhone().equals(userInfo.getPhone())) { | |||
| if(userInfoService.cntByUserPhone(userInfo.getPhone()) > 0){ | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(),"手机号已存在"); | |||
| } | |||
| bChangedPhone = true; | |||
| } | |||
| if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | |||
| PasswordHelper passwordHelper = new PasswordHelper(); | |||
| passwordHelper.encryptPassword(userInfo); | |||
| }else{ | |||
| userInfo.setPassword(null); | |||
| } | |||
| } | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| if(bChangedPhone) { | |||
| // 手机号修改,清除bopen_id, 清除web_open_id | |||
| userInfoService.cleanAllOpenId(userInfo); | |||
| wxMerchant.setUpdateDate(date); | |||
| wxMerchantMapper.updateById(wxMerchant); | |||
| } | |||
| return new ResultData(); | |||
| } catch (Exception e) { | |||
| @@ -1220,8 +1106,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| disableMerchant.setMark(EnumYesOrNo.NO.getCode()); | |||
| disableMerchant.setUpdateDate(new Date()); | |||
| wxMerchantMapper.updateById(disableMerchant); | |||
| //停用作者帐号 | |||
| userInfoService.ttMerchantDisable(id,EnumYesOrNo.NO); | |||
| //下架作者所有作品 | |||
| TtCoupon couponq = new TtCoupon(); | |||
| couponq.setMerchantId(id); | |||
| @@ -1242,27 +1126,18 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData ttstartusing(Long id) { | |||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(id); | |||
| if (wxMerchant == null || wxMerchant.getStatus().equals(EnumYesOrNo.YES.getCode())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"作者信息未找到或者已启用"); | |||
| } | |||
| //启用作者 | |||
| WxMerchant disableMerchant = new WxMerchant(); | |||
| disableMerchant.setId(id); | |||
| disableMerchant.setStatus(EnumYesOrNo.YES.getCode()); | |||
| disableMerchant.setUpdateDate(new Date()); | |||
| wxMerchantMapper.updateById(disableMerchant); | |||
| //启用作者帐号 | |||
| userInfoService.ttMerchantDisable(id,EnumYesOrNo.YES); | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public PageInfo<TtMerchantVo> ttlistAsPage(TtMerchantVo wxMerchant, Integer pageNum, Integer pageSize) { | |||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findTtList(wxMerchant)); | |||
| } | |||
| } | |||
| @@ -18,7 +18,6 @@ | |||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | |||
| <result column="web_open_id" jdbcType="VARCHAR" property="webOpenId"/> | |||
| <result column="email" jdbcType="VARCHAR" property="email"/> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| </resultMap> | |||
| <sql id="allSafeColumns"> | |||
| @@ -41,6 +41,13 @@ | |||
| <result column="alipay_app_auth_token" jdbcType="VARCHAR" property="alipayAppAuthToken"/> | |||
| <result column="alipay_member_template_id" jdbcType="VARCHAR" property="alipayMemberTemplateId"/> | |||
| <result column="admin_id" jdbcType="BIGINT" property="adminId"/> | |||
| <result column="admin_name" jdbcType="VARCHAR" property="adminName"/> | |||
| <result column="admin_phone" jdbcType="VARCHAR" property="adminPhone"/> | |||
| <result column="admin_username" jdbcType="VARCHAR" property="adminUsername"/> | |||
| <result column="admin_status" jdbcType="INTEGER" property="adminStatus"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -223,12 +230,11 @@ | |||
| </if> | |||
| </select> | |||
| <select id="findListAadmin" parameterType="com.iformall.domain.vo.TtMallVo" resultType="com.iformall.domain.vo.TtMallVo"> | |||
| <select id="findListAadmin" parameterType="com.iformall.domain.po.WxMall" resultMap="BaseResultMap"> | |||
| select | |||
| m.`id` id,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,m.`name` name, | |||
| m.`group` `group`,m.`country` `country`,m.`province` `province`,m.`city` `city`,m.`addr` `addr`, | |||
| m.`service_phone` servicePhone,m.`valid_start` validStart, m.`valid_end` validEnd, | |||
| mui.`id` adminId,mui.`username` adminUsername,mui.`name` adminName,mui.`phone` adminPhone,mui.status adminStatus | |||
| m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`name`,m.`group`,m.`country`,m.`province`,m.`city`,m.`addr`, | |||
| m.`service_phone`,m.`valid_start`, m.`valid_end`, | |||
| mui.`id` admin_id,mui.`username` admin_username,mui.`name` admin_name,mui.`phone` admin_phone,mui.status admin_status | |||
| from wx_mall m | |||
| left join mall_user_info mui on m.tenant_id = mui.tenant_id and mui.is_admin = 1 | |||
| where 1=1 | |||
| @@ -263,8 +269,6 @@ | |||
| and mui.`status` = #{adminStatus} | |||
| </if> | |||
| order by m.id desc | |||
| </select> | |||
| </mapper> | |||
| @@ -707,75 +707,4 @@ | |||
| where id = #{id} | |||
| </update> | |||
| <select id="findTtList" parameterType="com.iformall.domain.vo.TtMerchantVo" resultType="com.iformall.domain.vo.TtMerchantVo"> | |||
| select | |||
| m.`id`,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,m.`img_url` imgUrl,m.`name` name, | |||
| m.`encode` encode,m.`link_phone` linkPhone,m.`create_date` createDate,m.`update_date` updateDate,m.`status` status,m.`link_person` linkPerson, | |||
| m.`business_types businessTypes`,m.`is_public` isPublic,m.email email,m.`title` title,m.`cover_picture` coverPicture,m.`is_admin` isAdmin,m.`qr_code` qrCode, | |||
| m.`introduction` introduction,m.`mark` mark,m.mark_time markTime,m.link_line_phone linkLinePhone,m.credit_locked creditLocked,m.entry_amount entryAmount,m.cash_out_number cashOutNumber, | |||
| mall.valid_start validStart,mall.valid_end validEnd | |||
| from wx_merchant m | |||
| LEFT JOIN wx_mall mall on m.tenant_id = mall.tenant_id | |||
| where m.is_del = 0 | |||
| <if test=" null != id "> | |||
| and m.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and m.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and m.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != encode and ''!=encode "> | |||
| and m.`encode` like concat('%', #{encode},'%') | |||
| </if> | |||
| <if test=" null != name and ''!=name "> | |||
| and m.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != linkPhone and ''!=linkPhone "> | |||
| and m.`link_phone` like concat('%', #{linkPhone},'%') | |||
| </if> | |||
| <if test=" null != linkPerson and ''!=linkPerson "> | |||
| and m.`link_person` like concat('%', #{linkPerson},'%') | |||
| </if> | |||
| <if test="starttime != null"> | |||
| and m.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and m.create_date <= #{endtime} | |||
| </if> | |||
| <if test=" null != businessTypes "> | |||
| and JSON_CONTAINS(m.business_types,JSON_OBJECT('id', #{businessTypes})) | |||
| </if> | |||
| <if test=" null != status "> | |||
| and m.`status` = #{status} | |||
| </if> | |||
| <if test=" null != isPublic "> | |||
| and m.`is_public` = #{isPublic} | |||
| </if> | |||
| <if test=" null != isAdmin "> | |||
| and m.`is_admin` = #{isAdmin} | |||
| </if> | |||
| <if test=" null != mark "> | |||
| <if test="mark == 0" > | |||
| and (m.`mark` is null or m.`mark` <> 1) | |||
| </if> | |||
| <if test="mark == 1" > | |||
| and m.`mark` = 1 | |||
| </if> | |||
| </if> | |||
| <if test=" null != creditLocked "> | |||
| and m.`credit_locked` = #{creditLocked} | |||
| </if> | |||
| order by m.create_date desc | |||
| </select> | |||
| </mapper> | |||
| @@ -8,8 +8,6 @@ import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtMallVo; | |||
| import com.iformall.enums.EnumTtSaleType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.WxMallService; | |||
| @@ -34,7 +32,7 @@ public class WxMallController extends BaseController { | |||
| @Autowired | |||
| MallUserInfoService userInfoService; | |||
| @ApiOperation("查询组织列表") | |||
| @ApiOperation("查询商场集团列表") | |||
| @GetMapping(value = "/listAadmin") | |||
| @SystemControllerLog(description = "商场基础数据") | |||
| public ResultData getlistAadmin(@ModelAttribute WxMall wxMall, Integer pageNum, Integer pageSize) { | |||
| @@ -44,7 +42,6 @@ public class WxMallController extends BaseController { | |||
| wxMall = new WxMall(); | |||
| } | |||
| wxMall.setTenantInfo(getTenantInfo()); | |||
| wxMall.setGroupSupport(EnumYesOrNo.YES.getCode()); | |||
| PageInfo<WxMall> page = wxMallService.listAadminAsPage(wxMall, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| }catch (Exception e){ | |||
| @@ -53,53 +50,53 @@ public class WxMallController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("添加组织") | |||
| @ApiOperation("查询商场集团列表") | |||
| @PostMapping("addAadmin") | |||
| @SystemControllerLog(description = "商场基础数据") | |||
| public ResultData addAadmin(@RequestBody TtMallVo ttMallVo) { | |||
| public ResultData addAadmin(@RequestBody WxMall wxMall) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::addAadmin"); | |||
| try { | |||
| if(ttMallVo == null){ | |||
| if(wxMall == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode()); | |||
| } | |||
| TenantEntity tenantEntity = ifParentTenantInfoAlone(); | |||
| WxMall parentTenantId = wxMallService.getByTenantId(tenantEntity.getTenantId()); | |||
| ttMallVo.setParentTenantId(tenantEntity.getTenantId()); | |||
| ttMallVo.setImgUrlH(parentTenantId.getImgUrlH()); | |||
| wxMall.setParentTenantId(tenantEntity.getTenantId()); | |||
| wxMall.setImgUrlH(parentTenantId.getImgUrlH()); | |||
| if(StringUtils.isBlank(ttMallVo.getName())){ | |||
| if(StringUtils.isBlank(wxMall.getName())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"名称不能为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMallVo.getAdminName())){ | |||
| if(StringUtils.isBlank(wxMall.getAdminName())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"管理员不能为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMallVo.getAdminPhone())){ | |||
| if(StringUtils.isBlank(wxMall.getAdminPhone())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"管理员手机号不能为空"); | |||
| } | |||
| ttMallVo.setServicePhone(ttMallVo.getAdminPhone()); | |||
| if(ttMallVo.getSaleType() == null){ | |||
| ttMallVo.setSaleType(EnumTtSaleType.ZHUZHI.getCode());//组织 | |||
| wxMall.setServicePhone(wxMall.getAdminPhone()); | |||
| if(wxMall.getSaleType() == null){ | |||
| wxMall.setSaleType(1); | |||
| } | |||
| if(ttMallVo.getAdminStatus() == null){ | |||
| ttMallVo.setAdminStatus(EnumYesOrNo.YES.getCode()); | |||
| if(wxMall.getAdminStatus() == null){ | |||
| wxMall.setAdminStatus(EnumYesOrNo.YES.getCode()); | |||
| } | |||
| if(ttMallVo.getId() == null){ | |||
| if(StringUtils.isBlank(ttMallVo.getAdminUsername())){ | |||
| if(wxMall.getId() == null){ | |||
| if(StringUtils.isBlank(wxMall.getAdminUsername())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"管理员帐号不能为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMallVo.getAdminPassword())){ | |||
| if(StringUtils.isBlank(wxMall.getAdminPassword())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"管理员密码不能为空"); | |||
| } | |||
| }else{ | |||
| if(ttMallVo.getAdminId() == null){ | |||
| if(wxMall.getAdminId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"admin_id不能为空"); | |||
| } | |||
| // wxMall.setAdminUsername(null); | |||
| } | |||
| return wxMallService.addAadmin(ttMallVo); | |||
| return wxMallService.addAadmin(wxMall); | |||
| }catch (Exception e){ | |||
| logger.error(e.getMessage(),e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| @@ -8,21 +8,15 @@ 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.WxMall; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtMerchantVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | |||
| import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumPayWay; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.QrCodeService; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -36,7 +30,6 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -50,13 +43,6 @@ public class WxMerchantController extends BaseController { | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @Autowired | |||
| MallUserInfoService userInfoService; | |||
| @Autowired | |||
| private QrCodeService qrCodeService; | |||
| @@ -384,53 +370,15 @@ public class WxMerchantController extends BaseController { | |||
| return wxMerchantService.markup(wxMerchant); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("ttlist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| @SystemControllerLog(description = "商户-列表") | |||
| public ResultData ttlist(@ModelAttribute TtMerchantVo wxMerchant, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::ttlist"); | |||
| if (null == wxMerchant) wxMerchant = new TtMerchantVo(); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| // if(StringUtils.isBlank(wxMerchant.getSortColumn())){ | |||
| // wxMerchant.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| // } | |||
| final PageInfo<TtMerchantVo> page = wxMerchantService.ttlistAsPage(wxMerchant, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增作者") | |||
| @PostMapping("addttMerchant") | |||
| @SystemControllerLog(description = "商户-新增") | |||
| public ResultData addttMerchant(@RequestBody TtMerchantVo ttMerchantVo) { | |||
| public ResultData addttMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | |||
| ttMerchantVo.setParentTenantId(ifParentTenantInfoAlone().getTenantId()); | |||
| if(StringUtils.isBlank(ttMerchantVo.getImgUrl())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"作者头像为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMerchantVo.getLinkPerson())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"作者姓名为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMerchantVo.getLinkPhone())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"作者电话为空"); | |||
| if(StringUtils.isBlank(wxMerchant.getTenantId())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"未选择组织"); | |||
| } | |||
| if(StringUtils.isBlank(ttMerchantVo.getName())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"平台昵称为空"); | |||
| } | |||
| if(ttMerchantVo.getId() == null){ | |||
| ttMerchantVo.setAccountLoginId(null); | |||
| if(StringUtils.isBlank(ttMerchantVo.getAccountUsername())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"帐号为空"); | |||
| } | |||
| if(StringUtils.isBlank(ttMerchantVo.getAccountPassword())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"密码为空"); | |||
| } | |||
| } | |||
| ResultData resultData = wxMerchantService.addttMerchant(ttMerchantVo); | |||
| ResultData resultData = wxMerchantService.addttMerchant(wxMerchant, getUserId()); | |||
| return resultData; | |||
| } | |||
| @@ -461,24 +409,8 @@ public class WxMerchantController extends BaseController { | |||
| if(id == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| Map<String,Object> map = new HashMap<>(); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(id); | |||
| if(wxMerchant != null){ | |||
| map.put("merchant",wxMerchant); | |||
| WxMall mall = wxMallService.getByTenantId(wxMerchant.getTenantId()); | |||
| map.put("mall",mall); | |||
| MallUserInfo mallUserInfo = new MallUserInfo(); | |||
| mallUserInfo.setTenantId(mall.getTenantId()); | |||
| mallUserInfo. setMerchantId(wxMerchant.getId()); | |||
| List<MallUserInfo> mallUserInfoList = userInfoService.findList(mallUserInfo); | |||
| map.put("accountUser",mallUserInfoList); | |||
| return new ResultData(wxMerchant); | |||
| }else{ | |||
| return new ResultData(); | |||
| } | |||
| return new ResultData(wxMerchant); | |||
| } | |||
| } | |||