Преглед на файлове

1.7.11-首页banner上传

kaick преди 2 години
родител
ревизия
1ca220cc86

+ 96 - 0
src/main/java/com/caimei/controller/wechat/WxAuthApi.java

@@ -2,6 +2,7 @@ package com.caimei.controller.wechat;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.annotation.CurrentUser;
+import com.caimei.annotation.Idempotent;
 import com.caimei.aop.IpSave;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
@@ -256,6 +258,100 @@ public class WxAuthApi {
         // 机构用户编辑授权
         return authService.saveAuth(auth, bannerList, false, 2);
     }
+    /**
+     * 添加/编辑授权
+     */
+    @ApiOperation("添加/编辑授权")
+    @ApiImplicitParam(name = "params", value = "authId:授权id;authParty:授权机构;provinceId;cityId;" +
+            "townId;address;lngAndLat;mobile;userMobile:对应机构用户手机号;" +
+            "firstClubType:一级分类为医美=1,生美=2,项目公司=3,个人=4,其他=5;" +
+            "secondClubType:医美的二级分类为诊所=1、门诊=2、医院=3,其他=4。生美二级分类,美容院=5,养生馆=6,其他=7;" +
+            "medicalLicenseImage:医疗许可证图;empNum:员工人数;" +
+            "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id;source:1供应商保存,2机构保存" +
+            "linkMan:运营联系人;linkMobile:运营联系人手机号", required = true)
+    @PostMapping("/save1")
+    @Idempotent(prefix = "idempotent_auth_save", keys = {"#params"}, expire = 5)
+    public ResponseJson saveAuth1( @RequestBody String params) throws ParseException {
+
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer authId = paramsMap.getInteger("authId");
+        Integer authUserId = paramsMap.getInteger("authUserId");
+        Integer createBy = paramsMap.getInteger("createBy");
+        Integer provinceId = paramsMap.getInteger("provinceId");
+        Integer cityId = paramsMap.getInteger("cityId");
+        Integer townId = paramsMap.getInteger("townId");
+        String address = paramsMap.getString("address");
+        String lngAndLat = paramsMap.getString("lngAndLat");
+        String mobile = paramsMap.getString("mobile");
+        String userMobile = paramsMap.getString("userMobile");
+        String linkMan = paramsMap.getString("linkMan");
+        String linkMobile = paramsMap.getString("linkMobile");
+        Integer firstClubType = paramsMap.getInteger("firstClubType");
+        Integer secondClubType = paramsMap.getInteger("secondClubType");
+        String medicalLicenseImage = paramsMap.getString("medicalLicenseImage");
+        Integer empNum = paramsMap.getInteger("empNum");
+        String logo = paramsMap.getString("logo");
+        String authCode = paramsMap.getString("authCode");
+        String authDateStr = paramsMap.getString("authDate");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
+        Date authDate = null;
+        if (StringUtils.isNotEmpty(authDateStr)) {
+            authDate = format.parse(authDateStr);
+        }
+        Integer authImageType = paramsMap.getInteger("authImageType");
+        String authImageLogo = paramsMap.getString("authImageLogo");
+        String authImage = paramsMap.getString("authImage");
+        Integer customFlag = paramsMap.getInteger("customFlag");
+        String remarks = paramsMap.getString("remarks");
+        List<String> bannerList = (List<String>) paramsMap.get("bannerList");
+        String authParty = paramsMap.getString("authParty");
+        Integer source = paramsMap.getInteger("source");
+        String relationId = paramsMap.getString("relationId");
+        String relationName = paramsMap.getString("relationName");
+        if (null == source) {
+            // 默认供应商保存
+            source = 1;
+        }
+        /*
+            组装授权数据
+         */
+        CmBrandAuthPo auth = new CmBrandAuthPo();
+        auth.setId(authId);
+        auth.setAuthUserId(authUserId);
+        auth.setAuthParty(authParty);
+        auth.setProvinceId(provinceId);
+        auth.setCityId(cityId);
+        auth.setTownId(townId);
+        auth.setAddress(address);
+        auth.setCustomFlag(customFlag);
+        auth.setRemarks(remarks);
+        if (StringUtils.isEmpty(lngAndLat)) {
+            return ResponseJson.error("参数异常,经纬度不能为空");
+        }
+        String[] split = lngAndLat.split(",");
+        auth.setLng(new BigDecimal(split[0]));
+        auth.setLat(new BigDecimal(split[1]));
+        auth.setMobile(mobile);
+        auth.setUserMobile(userMobile);
+        auth.setLinkMan(linkMan);
+        auth.setLinkMobile(linkMobile);
+        auth.setFirstClubType(firstClubType);
+        auth.setSecondClubType(secondClubType);
+        auth.setMedicalLicenseImage(medicalLicenseImage);
+        auth.setEmpNum(empNum);
+        auth.setLogo(logo);
+        auth.setAuthCode(authCode);
+        auth.setAuthDate(authDate);
+        auth.setAuthImageLogo(authImageLogo);
+        auth.setAuthImage(authImage);
+        auth.setAuthImageType(authImageType);
+        auth.setCreateBy(createBy);
+        auth.setCreateSource(2);
+        auth.setRelationId(relationId);
+        auth.setRelationName(relationName);
+
+        return authService.saveAuth(auth, bannerList, false, source);
+    }
 
     @ApiOperation("设备分类下拉框列表")
     @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")

+ 82 - 0
src/main/java/com/caimei/controller/wechat/WxBannerApi.java

@@ -0,0 +1,82 @@
+package com.caimei.controller.wechat;
+
+
+import com.caimei.annotation.CurrentUser;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.CmBrandBannerPo;
+import com.caimei.model.po.SysUser;
+import com.caimei.model.vo.DoctorFormVo;
+import com.caimei.service.auth.BannerService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 首页BannerAPIApi
+ *
+ * @author : Kaick
+ * @date : 2023/3/23
+ */
+@Api(tags = "首页BannerAPI")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/wx/banner")
+public class WxBannerApi {
+    private static final Logger logger = LoggerFactory.getLogger(WxBannerApi.class);
+    private final BannerService bannerService;
+
+
+    /**
+     * 首页Banner回显数据
+     */
+    @ApiOperation("首页Banner回显数据")
+    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商id")
+    @GetMapping("/form/data")
+    public ResponseJson<DoctorFormVo> getBannerFormData(Integer authUserId) {
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        return bannerService.getBanner(authUserId);
+    }
+
+    /**
+     * 添加/编辑首页Banner
+     */
+    @ApiOperation("添加/编辑首页Banner")
+    @PostMapping("/save")
+    public ResponseJson saveBanner(Integer authUserId,@RequestBody CmBrandBannerPo bannerPo)  {
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        if (null != bannerPo) {
+            if (null != bannerPo.getHeadPcBanner() && null != bannerPo.getHeadAppBanner()) {
+                if (null == bannerPo.getJumpStatus() || 2 < bannerPo.getJumpStatus()) {
+                    return ResponseJson.error("首页Banner跳转方式状态参数不正确", null);
+                } else {
+                    if (1 == bannerPo.getJumpStatus()) {
+                        if (null == bannerPo.getJumpPcPicture() && null == bannerPo.getJumpAppPicture()) {
+                            return ResponseJson.error("首页Banner跳转图片 Pc端,移动端都必须添加", null);
+                        }
+                    }
+                }
+            } else {
+                return ResponseJson.error("首页Banner Pc端,移动端都必须添加", null);
+            }
+        } else {
+            logger.info("【图片上传】>>>>>>>>>>>>>>>>图片上传失败:");
+            return ResponseJson.error("首页Banner上传失败");
+        }
+        /*
+            组装首页Banner数据
+         */
+        bannerPo.setAuthUserId(authUserId);
+        return bannerService.saveBanner(bannerPo);
+    }
+
+
+}

+ 3 - 2
src/main/java/com/caimei/service/auth/impl/AuthProductServiceImpl.java

@@ -273,14 +273,15 @@ public class AuthProductServiceImpl implements AuthProductService {
         product.setCertificateImage(certificateImage);
         product.setCertificateImageType(certificateImageType);
         product.setAuthImageLogo(authImageLogo);
-        product.setAuthDate(productSaveDto.getAuthDate());
+        String authDate = productSaveDto.getAuthDate();
+        product.setAuthDate(null!=authDate&&""!=authDate?authDate:null);
         // 购买渠道
         product.setPurchaseWay(purchaseWay);
         // 发票图片
         product.setInvoiceImage(invoiceImage);
         // 供应商保存,直接上线;机构保存,需要供应商审核通过后才上线
         if (1 == authType) {
-            product.setShopAuditStatus(1 == source ? 1 : 2);
+            product.setShopAuditStatus(1 ==   source ? 1 : 2);
             if (null != dbProduct && 1 != dbProduct.getAuditStatus()) {
                 // 被驳回的数据,编辑变为待审核状态
                 product.setStatus(2);