Quellcode durchsuchen

1、调整adv配置问题
2、调整发放优惠卷问题
3、调整新增fsstoreorder错误问题

yys vor 1 Monat
Ursprung
Commit
0f744bd893

+ 1 - 13
fs-service/src/main/java/com/fs/his/mapper/FsAdvMapper.java

@@ -3,7 +3,6 @@ package com.fs.his.mapper;
 import java.util.List;
 import com.fs.his.domain.FsAdv;
 import com.fs.his.param.FsAdvUParam;
-import org.apache.ibatis.annotations.Select;
 
 /**
  * 广告Mapper接口
@@ -63,17 +62,6 @@ public interface FsAdvMapper
     public int deleteFsAdvByAdvIds(String[] advIds);
 
     List<FsAdv> selectFsAppAdvList();
-    @Select({"<script> " +
-            "select * from fs_adv "+
-            "where status = 1" +
-            "            <if test=\"advTitle != null  and advTitle != ''\"> adv_title like concat('%', #{advTitle}, '%')</if>\n" +
-            "            <if test=\"imageUrl != null  and imageUrl != ''\"> and image_url = #{imageUrl}</if>\n" +
-            "            <if test=\"advUrl != null  and advUrl != ''\"> and adv_url = #{advUrl}</if>\n" +
-            "            <if test=\"content != null  and content != ''\"> and content = #{content}</if>\n" +
-            "            <if test=\"sort != null  and sort != ''\"> and sort = #{sort}</if>\n" +
-            "            <if test=\"advType != null \"> and adv_type = #{advType}</if>\n" +
-            "            <if test=\"showType != null \"> and show_type = #{showType}</if>\n" +
-            "    order by status desc,sort,adv_id desc "+
-            "</script>"})
+
     List<FsAdv> selectFsAdvListUVO(FsAdvUParam map);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -1150,7 +1150,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             try {
                 storeSubOrderService.insertFsStoreSubOrderByStoreOrder(order.getOrderId());
             } catch (Exception e) {
-                log.info("拆分订单错误:{}", order.getOrderId());
+                log.error("拆分订单错误,orderId={}", order.getOrderId(), e);
             }
         }
 

+ 43 - 25
fs-service/src/main/java/com/fs/his/service/impl/FsStoreSubOrderServiceImpl.java

@@ -186,7 +186,7 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                     //没有病人信息不生成
                     return;
                 }
-                if (!fsPatient.getPatientName().matches("[\\u4E00-\\u9FA5]+")){
+                if (StringUtils.isBlank(fsPatient.getPatientName()) || !fsPatient.getPatientName().matches("[\\u4E00-\\u9FA5]+")){
                     return;
                 }
 
@@ -217,16 +217,20 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                     sub.setDiagnosis(fsPrescribe.getDiagnose());
                     sub.setIsPush(0);
 
-                    if (fsPrescribe.getPrescribeType()==2){
+                    if (Integer.valueOf(2).equals(fsPrescribe.getPrescribeType())){
                         sub.setDetailsUsage("口服");
                         if (fsPrescribe.getRecipeType()!=null&&fsPrescribe.getRecipeType()==1){
                             sub.setDetailsUsage("外敷");
                         }
 
-                        FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
-                        sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
-                        sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
-                        sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                        if (StringUtils.isNotBlank(fsPrescribe.getUsageJson())) {
+                            FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
+                            if (fsPrescribeUsageDTO != null) {
+                                sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
+                                sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
+                                sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                            }
+                        }
 
                     }
                     String prescribeJson = JSON.toJSONString(fsPrescribe);
@@ -244,7 +248,7 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
 
                             if (drug.getProductId()!=null){
                                 FsStoreProductAttrVO value = fsStoreProductMapper.selectFsStoreProductAttrVOByProdId(drug.getProductId());
-                                if (value!=null&&!value.getBarCode().equals("106013")&&!value.getBarCode().equals("SPZ00004288")&&!value.getBarCode().equals("109066")){
+                                if (value!=null&&!"106013".equals(value.getBarCode())&&!"SPZ00004288".equals(value.getBarCode())&&!"109066".equals(value.getBarCode())){
                                     gl=false;
                                 }else {
                                     continue;
@@ -265,9 +269,11 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                                 d.add(copy);
                             }
 
-                            if(fsPrescribe.getPrescribeType().equals(2)){
+                            if(Integer.valueOf(2).equals(fsPrescribe.getPrescribeType()) && StringUtils.isNotBlank(fsPrescribe.getUsageJson())){
                                 FsPrescribeUsageDTO dto= JSONUtil.toBean(fsPrescribe.getUsageJson(),FsPrescribeUsageDTO.class);
-                                prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                if (dto != null && dto.getCounts() != null) {
+                                    prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                }
                             }
 
                         }
@@ -325,7 +331,7 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                                 if (fsPrescribeDrug.getProductId()!=null){
 
                                     FsStoreProductAttrVO value = fsStoreProductMapper.selectFsStoreProductAttrVOByProdId(fsPrescribeDrug.getProductId());
-                                    if (value!=null&&!value.getBarCode().equals("106013")&&!value.getBarCode().equals("SPZ00004288")&&!value.getBarCode().equals("109066")){
+                                    if (value!=null&&!"106013".equals(value.getBarCode())&&!"SPZ00004288".equals(value.getBarCode())&&!"109066".equals(value.getBarCode())){
                                         gl=false;
                                     }else {
                                         continue;
@@ -339,9 +345,11 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                                         prodCostPrice=prodCostPrice.add(value.getCostPrice().multiply(BigDecimal.valueOf(fsPrescribeDrug.getDrugNum())));
                                     }
                                 }
-                                if(fsPrescribe.getPrescribeType().equals(2)){
+                                if(Integer.valueOf(2).equals(fsPrescribe.getPrescribeType()) && StringUtils.isNotBlank(fsPrescribe.getUsageJson())){
                                     FsPrescribeUsageDTO dto= JSONUtil.toBean(fsPrescribe.getUsageJson(),FsPrescribeUsageDTO.class);
-                                    prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                    if (dto != null && dto.getCounts() != null) {
+                                        prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                    }
                                 }
                             }
                         }
@@ -376,15 +384,19 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                         }
 
                         sub.setIsPush(0);
-                        if (fsPrescribe.getPrescribeType()==2){
+                        if (Integer.valueOf(2).equals(fsPrescribe.getPrescribeType())){
                             sub.setDetailsUsage("口服");
                             if (fsPrescribe.getRecipeType()!=null&&fsPrescribe.getRecipeType()==1){
                                 sub.setDetailsUsage("外敷");
                             }
-                            FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
-                            sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
-                            sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
-                            sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                            if (StringUtils.isNotBlank(fsPrescribe.getUsageJson())) {
+                                FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
+                                if (fsPrescribeUsageDTO != null) {
+                                    sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
+                                    sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
+                                    sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                                }
+                            }
                         }
                         sub.setPatientId(fsPatient.getPatientId());
                         sub.setDiagnosis(fsPrescribe.getDiagnose());
@@ -419,7 +431,7 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                             if (fsPrescribeDrug.getProductId()!=null){
 
                               FsStoreProductAttrVO value = fsStoreProductMapper.selectFsStoreProductAttrVOByProdId(fsPrescribeDrug.getProductId());
-                                if (value!=null&&!value.getBarCode().equals("106013")&&!value.getBarCode().equals("SPZ00004288")&&!value.getBarCode().equals("109066")){
+                                if (value!=null&&!"106013".equals(value.getBarCode())&&!"SPZ00004288".equals(value.getBarCode())&&!"109066".equals(value.getBarCode())){
                                     gl=false;
                                 }else {
                                     continue;
@@ -434,9 +446,11 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                                     prodCostPrice=prodCostPrice.add(value.getCostPrice().multiply(BigDecimal.valueOf(fsPrescribeDrug.getDrugNum())));
                                 }
                             }
-                            if(fsPrescribe.getPrescribeType().equals(2)){
+                            if(Integer.valueOf(2).equals(fsPrescribe.getPrescribeType()) && StringUtils.isNotBlank(fsPrescribe.getUsageJson())){
                                 FsPrescribeUsageDTO dto= JSONUtil.toBean(fsPrescribe.getUsageJson(),FsPrescribeUsageDTO.class);
-                                prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                if (dto != null && dto.getCounts() != null) {
+                                    prodCostPrice=prodCostPrice.multiply(BigDecimal.valueOf(dto.getCounts()));
+                                }
                             }
                             d.add(copy);
                         }
@@ -484,15 +498,19 @@ public class FsStoreSubOrderServiceImpl implements IFsStoreSubOrderService
                     }
 
                     sub.setIsPush(0);
-                    if (fsPrescribe.getPrescribeType()==2){
+                    if (Integer.valueOf(2).equals(fsPrescribe.getPrescribeType())){
                         sub.setDetailsUsage("口服");
                         if (fsPrescribe.getRecipeType()!=null&&fsPrescribe.getRecipeType()==1){
                             sub.setDetailsUsage("外敷");
                         }
-                        FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
-                        sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
-                        sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
-                        sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                        if (StringUtils.isNotBlank(fsPrescribe.getUsageJson())) {
+                            FsPrescribeUsageDTO fsPrescribeUsageDTO = JSON.parseObject(fsPrescribe.getUsageJson(), FsPrescribeUsageDTO.class);
+                            if (fsPrescribeUsageDTO != null) {
+                                sub.setPrescriptionNum(fsPrescribeUsageDTO.getCounts());
+                                sub.setPrescriptionTaking(fsPrescribeUsageDTO.getUsageMethod());
+                                sub.setPrescriptionRequirements(fsPrescribeUsageDTO.getUsageFrequencyUnit());
+                            }
+                        }
                     }
                     sub.setPatientId(fsPatient.getPatientId());
                     sub.setDiagnosis(fsPrescribe.getDiagnose());

+ 9 - 3
fs-service/src/main/java/com/fs/his/service/impl/FsUserCouponServiceImpl.java

@@ -133,10 +133,13 @@ public class FsUserCouponServiceImpl implements IFsUserCouponService
             throw new CustomException("用户不能为空");
         }
         FsCoupon coupon = fsCouponMapper.selectFsCouponByCouponId(param.getCouponId());
-        if (coupon.getRemainNumber()<1){
+        if (coupon == null) {
+            throw new CustomException("优惠券不存在");
+        }
+        if (coupon.getRemainNumber() == null || coupon.getRemainNumber() < 1){
             throw new CustomException("优惠劵剩余数量不足");
         }
-        if (coupon.getCouponType()==2){
+        if (Integer.valueOf(2).equals(coupon.getCouponType())){
             Integer integer = fsUserCouponMapper.selectFsUserCouponByUserIdCount(param.getUserId(), coupon.getCouponType());
             if (integer>0){
                 throw new CustomException("已经发送过同类型的优惠劵");
@@ -165,7 +168,10 @@ public class FsUserCouponServiceImpl implements IFsUserCouponService
             System.out.println("销售发送人id:"+ fsUserCoupon.getCompanyUserId());
         }
 
-        if (coupon.getLimitType() == 2){
+        if (Integer.valueOf(2).equals(coupon.getLimitType())){
+            if (coupon.getLimitDay() == null) {
+                throw new CustomException("优惠券领取后有效期天数未配置");
+            }
             long limitDay = coupon.getLimitDay().longValue() * 24 * 60 * 60 * 1000;
             long time = new Date().getTime();
             fsUserCoupon.setLimitTime(new Date(limitDay+time));

+ 16 - 0
fs-service/src/main/resources/mapper/his/FsAdvMapper.xml

@@ -50,6 +50,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select * from fs_adv where status = 1 and adv_type = 11 and show_type = 4 order by sort asc
     </select>
 
+    <select id="selectFsAdvListUVO" parameterType="com.fs.his.param.FsAdvUParam" resultMap="FsAdvResult">
+        <include refid="selectFsAdvVo"/>
+        <where>
+            <if test="status != null and status != ''"> and status = #{status}</if>
+            <if test="status == null or status == ''"> and status = 1</if>
+            <if test="advTitle != null and advTitle != ''"> and adv_title like concat('%', #{advTitle}, '%')</if>
+            <if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
+            <if test="advUrl != null and advUrl != ''"> and adv_url = #{advUrl}</if>
+            <if test="content != null and content != ''"> and content = #{content}</if>
+            <if test="sort != null and sort != ''"> and sort = #{sort}</if>
+            <if test="advType != null"> and adv_type = #{advType}</if>
+            <if test="showType != null"> and show_type = #{showType}</if>
+        </where>
+        order by status desc, sort, adv_id desc
+    </select>
+
     <insert id="insertFsAdv" parameterType="FsAdv" useGeneratedKeys="true" keyProperty="advId">
         insert into fs_adv
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 2 - 2
fs-user-app/src/main/java/com/fs/app/controller/AdvController.java

@@ -41,7 +41,7 @@ public class AdvController {
 			if(StringUtils.isNotBlank(sourceType)){
 				list = list.stream().filter(item->(item.getShowType() == 4)).collect(Collectors.toList());
 			} else {
-				list = list.stream().filter(item->(item.getShowType() != 4)).collect(Collectors.toList());
+				list = list.stream().filter(item -> !Integer.valueOf(4).equals(item.getShowType())).collect(Collectors.toList());
 			}
 		} catch (Exception e) {
 			log.error("获取首页广告位,获取header报错:{}",e.getMessage());
@@ -49,7 +49,7 @@ public class AdvController {
 		return R.ok().put("data",list);
 	}
 
-	@Cacheable(value = "getAppAdvList" )
+//	@Cacheable(value = "getAppAdvList" )
 	@ApiOperation("获取App首页中部广告位")
 	@GetMapping("/getAppAdvList")
 	public R getAppAdvList(){