Parcourir la source

Merge remote-tracking branch 'origin/ScrmStores' into ScrmStores

zhangqin il y a 1 semaine
Parent
commit
84b01e43b8

+ 10 - 0
fs-service/src/main/java/com/fs/his/domain/FsDoctor.java

@@ -210,4 +210,14 @@ public class FsDoctor extends BaseEntity
     private String storeIds;
 
     private Long gptRoleId;
+
+    /**
+     * 店铺ID
+     * **/
+    private Long storeId;
+
+    /**
+     * 店铺名称
+     * **/
+    private String storeName;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -202,6 +202,10 @@ public interface FsStoreProductScrmMapper
             "<if test = 'maps.storeId != null and maps.storeId != \"\"' > " +
             "and p.store_id = #{maps.storeId}" +
             "</if>" +
+            "<if test = 'maps.isGood != null and maps.isGood != \"\"' > " +
+            "and p.is_good = #{maps.isGood}" +
+            "</if>" +
+
             "<if test = 'maps.defaultOrder != null and maps.defaultOrder==\"desc\"  '> " +
             "order by p.sort desc,product_id desc" +
             "</if>" +

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreProductQueryParam.java

@@ -35,4 +35,6 @@ public class FsStoreProductQueryParam extends BaseQueryParam implements Serializ
 
     //是否多店铺 1是
     private Integer isStores;
+
+    private Integer isGood;
 }

+ 2 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreAfterSalesScrmServiceImpl.java

@@ -54,6 +54,7 @@ import com.fs.tzBankPay.TzBankService.TzBankService;
 import com.fs.tzBankPay.doman.RefundParam;
 import com.fs.tzBankPay.doman.RefundResult;
 import com.fs.tzBankPay.doman.TzBankResult;
+import com.fs.utils.TwelveDigitSnowflake;
 import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
 import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
 import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
@@ -753,7 +754,7 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
                         request.setHuifuId(fsPayConfig.getHuifuId());
                         request.setOrdAmt(df.format(refundAmount));
                         request.setOrgReqDate(new SimpleDateFormat("yyyyMMdd").format(payment.getCreateTime()));
-                        request.setReqSeqId("refund-"+payment.getPayCode());
+                        request.setReqSeqId("refund-"+new TwelveDigitSnowflake(1).nextId());
                         Map<String, Object> extendInfoMap = new HashMap<>();
                         extendInfoMap.put("org_party_order_id", payment.getBankSerialNo());
                         request.setExtendInfo(extendInfoMap);

+ 1 - 1
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreScrmServiceImpl.java

@@ -287,7 +287,7 @@ public class FsStoreScrmServiceImpl implements IFsStoreScrmService
             fsStoreProductScrm.setStoreId(store.getStoreId());
             fsStoreProductScrm.setIsAudit("1");//审核通过
             fsStoreProductScrm.setIsBest(1);//推荐
-            fsStoreProductScrm.setIsShow(1);//上架
+            fsStoreProductScrm.setIsGood(1);//上架
             fsStoreProductScrm.setIsDel(0);
             List<FsStoreProductScrm> fsStoreProductScrms = fsStoreProduct.selectFsStoreProductList(fsStoreProductScrm);
             return FsStoreRecommendListVO.builder().store(store).recommendProductList(fsStoreProductScrms).build();

+ 89 - 0
fs-service/src/main/java/com/fs/utils/TwelveDigitSnowflake.java

@@ -0,0 +1,89 @@
+package com.fs.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TwelveDigitSnowflake {
+    private final long START_TIMESTAMP = 1672502400000L;
+    private final long MACHINE_BIT = 5;
+    private final long SEQUENCE_BIT = 7;
+    private final long TIMESTAMP_BIT = 30;
+    private final long MAX_MACHINE_NUM = ~(-1L << MACHINE_BIT);
+    private final long MAX_SEQUENCE = ~(-1L << SEQUENCE_BIT);
+
+    private final long MACHINE_LEFT = SEQUENCE_BIT;
+    private final long TIMESTAMP_LEFT = SEQUENCE_BIT + MACHINE_BIT;
+
+    private long machineId;
+    private long sequence = 0L;
+    private long lastTimeStamp = -1L;
+
+    // 构造函数,传入机器ID
+    public TwelveDigitSnowflake(long machineId) {
+        if (machineId > MAX_MACHINE_NUM || machineId < 0) {
+            throw new IllegalArgumentException("机器ID超出范围");
+        }
+        this.machineId = machineId;
+    }
+
+    // 生成下一个ID
+    public synchronized long nextId() {
+        long currentTimeStamp = getCurrentTimeStamp();
+
+        // 处理时钟回拨
+        if (currentTimeStamp < lastTimeStamp) {
+            long offset = lastTimeStamp - currentTimeStamp;
+            if (offset <= 5) {
+                try {
+                    wait(offset);
+                    currentTimeStamp = getCurrentTimeStamp();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            } else { // 超过5毫秒回拨,抛出异常
+                throw new RuntimeException("时钟回拨异常,无法生成ID");
+            }
+        }
+
+        if (currentTimeStamp == lastTimeStamp) {
+            sequence = (sequence + 1) & MAX_SEQUENCE;
+            if (sequence == 0) {
+                currentTimeStamp = getNextMill();
+            }
+        } else {
+            sequence = 0L;
+        }
+
+        lastTimeStamp = currentTimeStamp;
+
+        // 组合ID:时间戳 + 机器ID + 序列号
+        long id = ((currentTimeStamp - START_TIMESTAMP) << TIMESTAMP_LEFT)
+                | (machineId << MACHINE_LEFT)
+                | sequence;
+        return id;
+    }
+
+    private long getNextMill() {
+        long mill = getCurrentTimeStamp();
+        while (mill <= lastTimeStamp) {
+            mill = getCurrentTimeStamp();
+        }
+        return mill;
+    }
+
+    private long getCurrentTimeStamp() {
+        return System.currentTimeMillis();
+    }
+
+    public static void main(String[] args) {
+        TwelveDigitSnowflake snowflake = new TwelveDigitSnowflake(1);
+        Map<String,Long> check=new HashMap<>();
+        for (int i = 0; i < 10000000; i++) {
+            long id = snowflake.nextId();
+            if(check.containsKey(String.valueOf(id))){
+                throw new RuntimeException("雪花ID重复啦!!!!!!!");
+            }
+            check.put(String.valueOf(id),0L);
+        }
+    }
+}

+ 6 - 0
fs-service/src/main/resources/mapper/his/FsDoctorMapper.xml

@@ -241,6 +241,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isFollow != null">is_follow,</if>
             <if test="storeIds != null">store_ids,</if>
             <if test="gptRoleId != null">gpt_role_id,</if>
+            <if test="storeId != null">store_id,</if>
+            <if test="storeName != null">store_name,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="doctorName != null">#{doctorName},</if>
@@ -299,6 +301,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isFollow != null">#{isFollow},</if>
             <if test="storeIds != null">#{storeIds},</if>
             <if test="gptRoleId != null">#{gptRoleId},</if>
+            <if test="storeId != null">#{storeId},</if>
+            <if test="storeName != null">#{storeName},</if>
          </trim>
     </insert>
 
@@ -361,6 +365,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isFollow != null">is_follow = #{isFollow},</if>
             <if test="storeIds != null">store_ids = #{storeIds},</if>
             <if test="gptRoleId != null">gpt_role_id = #{gptRoleId},</if>
+            <if test="storeId != null">store_id=#{storeId},</if>
+            <if test="storeName != null">store_name=#{storeName},</if>
         </trim>
         where doctor_id = #{doctorId}
     </update>

+ 26 - 1
fs-user-app/src/main/java/com/fs/app/controller/UserController.java

@@ -30,6 +30,8 @@ import com.fs.his.vo.FsDoctorListUVO;
 import com.fs.his.vo.FsUserCouponCountUVO;
 import com.fs.his.vo.FsUserCouponListUVO;
 import com.fs.his.vo.UserVo;
+import com.fs.hisStore.domain.FsStoreScrm;
+import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.qw.service.IQwAppContactWayService;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
@@ -85,7 +87,8 @@ public class UserController extends  AppBaseController {
     @Autowired
     private IFsUserCourseVideoService courseVideoService;
 
-
+    @Autowired
+    private IFsStoreScrmService fsStoreService;
     @Autowired
     private IFsUserService fsUserService;
     @Login
@@ -225,6 +228,28 @@ public class UserController extends  AppBaseController {
                 return R.error(String.format("您已提交过申请 提交信息: %s",doctor.getDoctorName()));
             }
         }
+
+        if(param.getDoctorType().equals(1)){//医生
+            if(param.getHospitalId() == null){
+                return R.error("请选择,所属医院");
+            }else if(param.getDeptId() == null){
+                return R.error("请选择,所属科室");
+            }
+        }else {//药剂师
+            if(param.getStoreId() == null){
+                return R.error("请选择,药剂师所属店铺");
+            }
+            //验证店铺
+            FsStoreScrm fsStoreScrm = fsStoreService.selectFsStoreByStoreId(param.getStoreId());
+            if(fsStoreScrm == null){
+                return R.error("药剂师,绑定店铺不存在!");
+            }else if(!fsStoreScrm.getIsAudit().equals(1)){
+                return R.error("药剂师,绑定店铺审核状态还未通过");
+            }else if(!fsStoreScrm.getStatus().equals(1)){
+                return R.error("药剂师,绑定店铺状态未启用!");
+            }
+            param.setStoreName(fsStoreScrm.getStoreName());
+        }
         doctor=new FsDoctor();
         BeanUtils.copyProperties(param,doctor);
         doctor.setUserId(Long.parseLong(getUserId()));

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/ProductScrmController.java

@@ -276,7 +276,7 @@ public class ProductScrmController extends AppBaseController {
     public R getTuiProducts(BaseQueryParam param, HttpServletRequest request){
         PageHelper.startPage(param.getPage(), param.getPageSize());
         List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductTuiListQuery();
-        PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list);
+        PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list.size() < 4?list.subList(0,list.size()):list.subList(0,4));
         return R.ok().put("data",listPageInfo);
     }
     @ApiOperation("获取喜欢商品数据")

+ 23 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/StoreScrmController.java

@@ -15,10 +15,12 @@ import com.fs.hisStore.domain.FsStoreScrm;
 import com.fs.hisStore.service.IFsStoreScrmService;
 import com.fs.hisStore.utils.StoreAuditLogUtil;
 import com.fs.hisStore.vo.FsStoreRecommendListVO;
+import com.fs.hisStore.vo.FsStoreScrmVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -123,4 +125,25 @@ public class StoreScrmController extends BaseController
         List<FsStoreRecommendListVO> fsStoreRecommendListVO = fsStoreService.storeRecommendList();
         return getDataTable(fsStoreRecommendListVO);
     }
+
+
+    /**
+     * 查询店铺管理列表
+     */
+    @GetMapping("/getStoreList")
+    public R getStoreList(FsStoreScrm fsStore)
+    {
+        fsStore.setIsAudit(1);
+        fsStore.setStatus(1);
+        List<FsStoreScrm> list = fsStoreService.selectFsStoreList(fsStore);
+        if(!list.isEmpty()){
+            return R.ok().put("data",list.stream().map(m->{
+                FsStoreScrmVO fsStoreScrmVO=new FsStoreScrmVO();
+                fsStoreScrmVO.setStoreId(m.getStoreId().toString());
+                fsStoreScrmVO.setStoreName(m.getStoreName());
+                return fsStoreScrmVO;
+            }));
+        }
+        return R.ok().put("data",new ArrayList<>());
+    }
 }

+ 9 - 2
fs-user-app/src/main/java/com/fs/app/param/FsDoctorRegisterParam.java

@@ -40,11 +40,9 @@ public class FsDoctorRegisterParam implements Serializable {
 
 
     /** 所属医院 */
-    @NotNull(message = "所属医院不能为空")
     private Long hospitalId;
 
     /** 科室ID */
-    @NotNull(message = "所属科室不能为空")
     private Long deptId;
 
 
@@ -96,4 +94,13 @@ public class FsDoctorRegisterParam implements Serializable {
 //    @Pattern(regexp="^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,}$",message="密码长度最少8位,由数字、大写字母、小写字母、特殊字符中的至少三种组成")
     private String password;
 
+    /**
+     * 店铺ID
+     * **/
+    private Long storeId;
+
+    /**
+     * 店铺名称
+     * **/
+    private String storeName;
 }