xhxu 3 лет назад
Родитель
Сommit
649a788bc9
10 измененных файлов: 123 добавлений и 63 удалений
  1. +2
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java
  2. +12
    -8
      mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  3. +29
    -14
      mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java
  4. +1
    -0
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  5. +5
    -1
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  6. +37
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumMerchantAdmin.java
  7. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  8. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  9. +34
    -32
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  10. +1
    -1
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml

+ 2
- 5
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java Просмотреть файл

@@ -17,10 +17,7 @@ import com.iformall.domain.vo.WxMerchantTradeDetailVo;
import com.iformall.domain.vo.WxMerchantTradeVo;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.enums.*;
import com.iformall.service.*;
import com.iformall.utils.Constant;
import io.swagger.annotations.ApiImplicitParam;
@@ -115,7 +112,7 @@ public class WxMerchantController extends BaseController {
WxMerchant wxMerchant = new WxMerchant();
wxMerchant.updateTenantInfo(getTenantInfo());
wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode());
wxMerchant.setIsAdmin(EnumYesOrNo.YES.getCode());
wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode());
wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC);
List<WxMerchant> list = wxMerchantService.findList(wxMerchant);
if(list == null || list.isEmpty()){


+ 12
- 8
mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Просмотреть файл

@@ -11,10 +11,7 @@ import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMerchantBUser;
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.enums.EnumYesOrNo;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCUserTagsService;
@@ -64,7 +61,8 @@ public class WxCreditHistoryController extends BaseController {
wxMerchant.setId(getLoginBUser().getMerchantId());
wxMerchant = wxMerchantService.findOne(wxMerchant);
//普通商户只允许查询自己的消费金额所增加的积分
if (wxMerchant.getIsAdmin() != EnumYesOrNo.YES.getCode() && merchantId.longValue() != getLoginBUser().getMerchantId().longValue()) {
if (EnumMerchantAdmin.PUBLIC_COMMON.getCode().equals(wxMerchant.getIsAdmin())
&& merchantId.longValue() != getLoginBUser().getMerchantId().longValue()) {
return new ResultData(ErrorCode.USER_NO_PERMISSION);
}
if(Objects.isNull(merchantId)|| StringUtils.isEmpty(spendStr)||Objects.isNull(userId)) {
@@ -108,6 +106,9 @@ public class WxCreditHistoryController extends BaseController {
wxMerchant.setId(getLoginBUser().getMerchantId());
wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode());
WxMerchant merchant = wxMerchantService.findOne(wxMerchant);
if(merchant == null){
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND);
}
//消费积分:取当前人的商户ID
if (wxCreditHistory.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) {
wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId());
@@ -115,11 +116,11 @@ public class WxCreditHistoryController extends BaseController {
} else {
//新增积分:
//如果为商管商户 则消费商户按前端传入的进行记录
if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) {
if (EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(merchant.getIsAdmin())) {
wxCreditHistory.setMerchantId(wxCreditHistory.getMerchantId());
WxMerchant byId = wxMerchantService.getById(wxCreditHistory.getMerchantId());
wxCreditHistory.setChangePurpose("商户端手动积分:消费商户["+byId.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]");
} else {
} else{
wxCreditHistory.setMerchantId(getLoginBUser().getMerchantId());
wxCreditHistory.setChangePurpose("商户端手动积分:消费商户["+merchant.getName()+"] 消费金额["+wxCreditHistory.getSpendStr()+"元]");
}
@@ -155,7 +156,10 @@ public class WxCreditHistoryController extends BaseController {
wxCreditHistory.updateTenantInfo(getTenantInfo());
WxMerchantBUser bUser = getLoginBUser();
WxMerchant merchant = wxMerchantService.getById(wxCreditHistory.getMerchantId());
if (merchant != null && merchant.getIsAdmin() != null && merchant.getIsAdmin() == 1) {
if(merchant == null){
return new ResultData(ErrorCode.SHOP_IS_NOT_FOUND);
}
if(EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(merchant.getIsAdmin())){
wxCreditHistory.setOperatorId(bUser.getId());
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode());
wxCreditHistory.setMerchantId(null);


+ 29
- 14
mallinkBApi/src/main/java/com/iformall/controller/WxProfitSharingReceiverApplyController.java Просмотреть файл

@@ -18,6 +18,7 @@ import com.iformall.utils.ImgYwsqhUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

@@ -251,7 +253,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController {

@PostMapping(value = "/getYwsqh_v2")
@ApiOperation("获取图片")
public void getYwsqh_v2(@RequestBody Map<String, String> param, HttpServletResponse response) {
public ResultData getYwsqh_v2(@RequestBody Map<String, String> param, HttpServletResponse response) {
logger.info("[" + getIpAddr() + "] WxMerchantMediaUploadController::getYwsqh_v2");

logger.info("getYwsqh---"+JSON.toJSONString(param));
@@ -270,20 +272,33 @@ public class WxProfitSharingReceiverApplyController extends BaseController {

byte[] bytes = ImgYwsqhUtil.imgCeate(contact_name, contact_id_number, contact_department, contact_job,
legal_person, id_card_number, card_period_begin, card_period_end, isSeal, merchant_name);
try{
if(bytes == null){
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
ResultData resultData = new ResultData(ResultData.UNLOGIN,"用户未登录");
response.getWriter().write(JSON.toJSONString(resultData));
}else{
response.setContentType("image/jpeg");
OutputStream os=response.getOutputStream();
os.write(bytes);
}
}catch(Exception e){
logger.error("返回授权函异常"+e.getMessage());
if(bytes == null){
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常");
}
try {
String encode = new String(Base64.encodeBase64(bytes), "UTF-8");
return new ResultData(encode);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常");
}


// try{
// if(bytes == null){
// response.setCharacterEncoding("UTF-8");
// response.setContentType("application/json");
// ResultData resultData = new ResultData(ResultData.UNLOGIN,"用户未登录");
// response.getWriter().write(JSON.toJSONString(resultData));
// }else{
// response.setContentType("image/jpeg");
// OutputStream os=response.getOutputStream();
// os.write(bytes);
// }
// }catch(Exception e){
// logger.error("返回授权函异常"+e.getMessage());
// return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR);
// }

}



+ 1
- 0
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Просмотреть файл

@@ -498,6 +498,7 @@ public enum ErrorCode{
SHOP_BAN_DELETED(22003, "已出租的商铺无法删除"),
SHOP_DELETED_BY_ADMIN(22004, "仅系统管理员能删除该商铺"),
SHOP_CONTRACT_HAS_CONNECT(22005, "有合同签约此商铺,请先解除相应的合同再删除"),
SHOP_IS_NOT_PUBLIC(22006,"商铺类型不支持"),

/**
* 迈外迪


+ 5
- 1
mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java Просмотреть файл

@@ -113,6 +113,9 @@ public class WxMerchant extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic")
private Integer isPublic;

@io.swagger.annotations.ApiModelProperty(value = "是否显示在广场", name = "isPrivate")
private Integer isPrivate;

@Excel(name = "待缴提醒", width = 20, orderNum = "10")
@io.swagger.annotations.ApiModelProperty(value = "待缴提醒", name = "billSetting")
private Integer billSetting;
@@ -242,7 +245,7 @@ public class WxMerchant extends TenantEntity {
private String title;
@io.swagger.annotations.ApiModelProperty(value = "封面图", name = "coverPicture")
private String coverPicture;
@io.swagger.annotations.ApiModelProperty(value="是否为商管商户 1是 0否",name="status")
@io.swagger.annotations.ApiModelProperty(value="EnumMerchantAdmin",name="isAdmin")
private Integer isAdmin;
@io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime")
private Date topTime;
@@ -361,4 +364,5 @@ public class WxMerchant extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude")
@TableField(exist = false)
private BigDecimal latitude;

}

+ 37
- 0
mallinkService/src/main/java/com/iformall/enums/EnumMerchantAdmin.java Просмотреть файл

@@ -0,0 +1,37 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumMerchantAdmin {

PUBLIC_COMMON(0, "普通商户"),
PUBLIC_ADMIN(1, "商管商户"),
PRIVATE_SYSTEM(2, "系统抽成商户"),
PRIVATE_SELL(3, "销售抽成商户"),;

public static EnumMerchantAdmin getEnum(Integer code) {
for (EnumMerchantAdmin value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumMerchantAdmin(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -844,7 +844,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
WxMerchant merchantQ = new WxMerchant();
merchantQ.setTenantId(tenantId);
merchantQ.setIds(merchantIds);
merchantQ.setIsAdmin(EnumYesOrNo.YES.getCode());
merchantQ.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode());
merchantQ.setStatus(EnumMerchantStatus.VALID.getCode());
List<Long> list = wxMerchantMapper.findIdList(merchantQ);
if(list != null && list.size() == 1){


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -694,7 +694,7 @@ public class WxCouponServiceImpl implements WxCouponService {
WxMerchant merchantQ2 = new WxMerchant();
merchantQ2.updateTenantInfo(record);
merchantQ2.setIds(merchantIds);
merchantQ2.setIsAdmin(EnumYesOrNo.YES.getCode());
merchantQ2.setIsAdmin(EnumMerchantAdmin.PUBLIC_ADMIN.getCode());
merchantQ2.setStatus(EnumMerchantStatus.VALID.getCode());
List<Long> list = wxMerchantMapper.findIdList(merchantQ2);
if(list == null || list.isEmpty()){


+ 34
- 32
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -336,7 +336,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
List<WxMerchantBUser> userList = wxMerchantBUserMapper.findList(wxMerchantBUser);
wxMerchant.setUsers(userList);

if(EnumYesOrNo.YES.getCode().equals(wxMerchant.getIsAdmin())){
if(EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(wxMerchant.getIsAdmin())){
WxMerchantBUser otherQ = new WxMerchantBUser();
otherQ.setOtherMerchantId(wxMerchant.getId().toString());
otherQ.setStatus(EnumMerchantBUserStatus.VALID.getCode());
@@ -508,42 +508,44 @@ public class WxMerchantServiceImpl implements WxMerchantService {
//保存商户商铺的关联
List<Long> shopidlist = wxMerchant.getShopids();
if (shopidlist.isEmpty()) {
return new ResultData(ErrorCode.SHOP_NOT_SELECTED);
}

//更新商铺
for (long shopid : shopidlist) {
WxShop shop = wxShopMapper.selectById(shopid);
if (shop.getStatus().equals(EnumShopStatus.RENT.getCode())) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租");
if(!EnumYesOrNo.YES.getCode().equals(wxMerchant.getIsPrivate())){
return new ResultData(ErrorCode.SHOP_NOT_SELECTED);
}
WxMerchantShop wxMerchantShop = new WxMerchantShop();
wxMerchantShop.setShopId(shopid);
wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode());
int count = wxMerchantShopMapper.selectCount(new QueryWrapper(wxMerchantShop));
if (count > 0) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租");
}else{
//更新商铺
for (long shopid : shopidlist) {
WxShop shop = wxShopMapper.selectById(shopid);
if (shop.getStatus().equals(EnumShopStatus.RENT.getCode())) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租");
}
WxMerchantShop wxMerchantShop = new WxMerchantShop();
wxMerchantShop.setShopId(shopid);
wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode());
int count = wxMerchantShopMapper.selectCount(new QueryWrapper(wxMerchantShop));
if (count > 0) {
return new ResultData(ErrorCode.SHOP_IS_RENT.getCode(), "店铺 " + shop.getShopNumber() + " 已出租");
}
//更新商铺状态
shop.setStatus(EnumShopStatus.RENT.getCode());
wxShopMapper.updateById(shop);
//关联表插入
wxMerchantShop.setId(idWorker.nextId());
wxMerchantShop.setMerchantId(merchantId);
wxMerchantShop.updateTenantInfo(wxMerchant);
wxMerchantShop.setShopId(shopid);
wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode());
Date shopdate = new Date();
wxMerchantShop.setUpdateDate(shopdate);
wxMerchantShop.setCreateDate(shopdate);
wxMerchantShopMapper.insert(wxMerchantShop);
}
//更新商铺状态
shop.setStatus(EnumShopStatus.RENT.getCode());
wxShopMapper.updateById(shop);
//关联表插入
wxMerchantShop.setId(idWorker.nextId());
wxMerchantShop.setMerchantId(merchantId);
wxMerchantShop.updateTenantInfo(wxMerchant);
wxMerchantShop.setShopId(shopid);
wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode());
Date shopdate = new Date();
wxMerchantShop.setUpdateDate(shopdate);
wxMerchantShop.setCreateDate(shopdate);
wxMerchantShopMapper.insert(wxMerchantShop);
}

wxMerchant.setId(merchantId);
Date date = new Date();
wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode());
if(wxMerchant.getIsAdmin() == null) {
wxMerchant.setIsAdmin(EnumYesOrNo.NO.getCode());
wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_COMMON.getCode());
}
wxMerchant.setUpdateDate(date);
wxMerchant.setCreateDate(date);
@@ -870,7 +872,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
wxMerchantBUserMapper.updateById(user);
}
}
if(EnumYesOrNo.YES.getCode().equals(wxMerchant.getIsAdmin())){
if(EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(wxMerchant.getIsAdmin())){
List<WxMerchantBUser> otherMerchantUsers = wxMerchant.getOtherMerchantUsers();
if(otherMerchantUsers != null && !otherMerchantUsers.isEmpty()){
List<Long> ids = otherMerchantUsers.stream().map(u -> u.getId()).collect(Collectors.toList());
@@ -890,7 +892,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
if (wxMerchant.getId() == null) {
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}
if(EnumYesOrNo.NO.getCode().equals(wxMerchant.getIsAdmin())){
if(!EnumMerchantAdmin.PUBLIC_ADMIN.getCode().equals(wxMerchant.getIsAdmin())){
//删除关联的其他门店用户
wxMerchantBUserMapper.deleteOtherMerchant(wxMerchant.getTenantId(),wxMerchant.getId().toString());
}
@@ -1640,7 +1642,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}
// wxMerchant.setStatus(EnumMerchantStatus.VALID.getCode());
if(wxMerchant.getIsAdmin() == null) {
wxMerchant.setIsAdmin(EnumYesOrNo.NO.getCode());
wxMerchant.setIsAdmin(EnumMerchantAdmin.PUBLIC_COMMON.getCode());
}
wxMerchant.setUpdateDate(date);
wxMerchant.setCreateDate(date);


+ 1
- 1
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -295,7 +295,7 @@
</select>
<select id="hasMerchant" parameterType="com.iformall.domain.po.WxMerchant" resultType="int">
select count(1) from wx_merchant where `name`=#{name} and status=#{status}
select count(1) from wx_merchant where `name`=#{name}
<if test=" null != id">
and `id` != #{id}
</if>


Загрузка…
Отмена
Сохранить