소스 검색

查询城市id,更新用户关注,同步物流信息

yuhongqi 1 주 전
부모
커밋
4c01ebafad

+ 8 - 0
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -273,4 +273,12 @@ public class FsUser extends BaseEntity
     public void setNickname(String nickname) {
         this.nickname = nickname;
     }
+
+    public Integer getIsOfficialAccountAuth() {
+        return isOfficialAccountAuth;
+    }
+
+    public void setIsOfficialAccountAuth(Integer isOfficialAccountAuth) {
+        this.isOfficialAccountAuth = isOfficialAccountAuth;
+    }
 }

+ 2 - 1
fs-service/src/main/java/com/fs/his/enums/ShipperCodeEnum.java

@@ -6,7 +6,8 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum ShipperCodeEnum {
-    SF("SF","顺丰速运");
+    SF("SF","顺丰速运"),
+    ZTO("ZTO","中通");
 
     private String value;
     private String desc;

+ 15 - 0
fs-service/src/main/java/com/fs/his/mapper/FsCityMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.fs.his.domain.FsCity;
 import com.fs.his.vo.CitysAreaVO;
 import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -75,4 +76,18 @@ public interface FsCityMapper
 
     @Select("select * from fs_city where is_show=1")
     List<FsCity> selectFsCitys();
+
+    @Select({"<script> " +
+            "select city_id from fs_city"+
+            "<where>  \n" +
+            "            <if test=\"cityName != null  and cityName != ''\"> and city_name like concat('%', #{cityName}, '%')</if>\n" +
+            "            <if test=\"citySname != null  and citySname != ''\"> and city_sname like concat('%', #{citySname}, '%')</if>\n" +
+            "            <if test=\"level != null \"> and 'level' = #{citySname}</if>\n" +
+            "        </where>"+
+            " limit 1"+
+            "</script>"})
+    String selectByFsCity(FsCity city);
+
+    @Select("SELECT city_id FROM fs_city WHERE city_sname LIKE CONCAT('%', #{city}, '%', #{district}, '%')")
+    String likeByCityDistrict(@Param("city") String city, @Param("district") String district);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/his/service/IFsCityService.java

@@ -68,4 +68,8 @@ public interface IFsCityService
     List<CitysAreaVO> getCitysArea();
 
     List<FsCity> selectFsCitys();
+
+    String selectByFsCity(FsCity fsCity);
+
+    String likeByCityDistrict(String city, String district);
 }

+ 10 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsCityServiceImpl.java

@@ -129,5 +129,15 @@ public class FsCityServiceImpl implements IFsCityService
         return list;
     }
 
+    @Override
+    public String selectByFsCity(FsCity fsCity) {
+        return fsCityMapper.selectByFsCity(fsCity);
+    }
+
+    @Override
+    public String likeByCityDistrict(String city, String district) {
+        return fsCityMapper.likeByCityDistrict(city,district);
+    }
+
 
 }

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

@@ -2352,7 +2352,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
 
         FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderByOrderId(id);
         String lastFourNumber = "";
-        if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
+        if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue()) || order.getDeliveryCode().equals(ShipperCodeEnum.ZTO.getValue())) {
             lastFourNumber = order.getUserPhone();
             if (lastFourNumber.length() == 11) {
                 lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);

+ 6 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java

@@ -243,10 +243,12 @@ public class FsUserServiceImpl implements IFsUserService {
     @Override
     public int updateFsUser(FsUser fsUser) {
         fsUser.setUpdateTime(DateUtils.getNowDate());
-        if (fsUser.getPhone() != null && fsUser.getPhone().length() == 11 && fsUser.getPhone().matches("\\d+")) {
-            fsUser.setPhone(encryptPhone(fsUser.getPhone()));
-        } else {
-            fsUser.setPhone(null);
+        if (fsUser.getPhone() != null) {
+            if (fsUser.getPhone().length() == 11 && fsUser.getPhone().matches("\\d+")) {
+                fsUser.setPhone(encryptPhone(fsUser.getPhone()));
+            } else if (fsUser.getPhone().length() <= 11) {
+                fsUser.setPhone(null);
+            }
         }
         if (ObjectUtils.isNotEmpty(fsUser.getLevel())&&fsUser.getLevel().equals(1)){
             fsUser.setIsShow(1);

+ 7 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsCityScrmMapper.java

@@ -2,6 +2,7 @@ package com.fs.hisStore.mapper;
 
 import com.fs.his.vo.CitysAreaVO;
 import com.fs.hisStore.domain.FsCityScrm;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -66,4 +67,10 @@ public interface FsCityScrmMapper
 
     @Select("SELECT city_id,city_name as city_name FROM fs_city where parent_id=0 ")
     List<CitysAreaVO> getCitysArea();
+
+    @Select("select city_id from fs_city where city_name = #{name} and level = #{level} limit 1")
+    String selectCityIdByNameAndLevel(@Param("name") String name, @Param("level") Integer level);
+
+    @Select("select city_id from fs_city where city_name = #{name} limit 1")
+    String selectCityIdByName(@Param("name") String name);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsUserAddressScrmMapper.java

@@ -105,4 +105,10 @@ public interface FsUserAddressScrmMapper
             "ORDER BY o.create_time DESC, o.id DESC LIMIT 1")
     @DataSource(DataSourceType.SLAVE)
     FsUserAddressScrm selectFsUserAddressScrmByLastPaidOrder(long userId);
+
+    @Select("select * from fs_user_address where city_ids is null")
+    List<FsUserAddressScrm> selectFsUserAddressListByCityIdsIsNull();
+
+    @Select("select * from fs_user_address where city_ids is null and address_id = #{addressId}")
+    FsUserAddressScrm selectFsUserAddressByCityIdsIsNullAndAddressId(Long addressId);
 }

+ 1 - 0
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -710,6 +710,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="appOpenId != null">app_open_id = #{appOpenId},</if>
             <if test="appleKey != null">apple_key = #{appleKey},</if>
             <if test="historyApp != null">history_app = #{historyApp},</if>
+            <if test="isOfficialAccountAuth != null">is_official_account_auth = #{isOfficialAccountAuth},</if>
         </trim>
         where user_id = #{userId}
     </update>

+ 69 - 0
fs-user-app/src/main/java/com/fs/app/controller/FsCityController.java

@@ -0,0 +1,69 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.StringUtils;
+import com.fs.his.domain.FsCity;
+import com.fs.his.service.IFsCityService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 城市Controller
+ *
+ * @author fs
+ * @date 2023-06-02
+ */
+@RestController
+@RequestMapping("/app/city")
+public class FsCityController extends AppBaseController
+{
+    @Autowired
+    private IFsCityService fsCityService;
+
+
+    /**
+     * 获取城市详细信息
+     */
+    @GetMapping(value = "/cityId")
+    public R getInfo(@RequestParam("cityName") String cityName)
+    {
+        String key = "city:citySName:" + cityName;
+        String cityId = redisCache.getCacheObject(key);
+        if (StringUtils.isEmpty(cityId)) {
+            FsCity fsCity = new FsCity();
+            fsCity.setCitySname(cityName);
+            cityId = fsCityService.selectByFsCity(fsCity);
+            redisCache.setCacheObject(key, cityId);
+        }
+        return R.ok().put("cityId",cityId);
+    }
+
+    /**
+     * 获取城市详细信息
+     */
+    @GetMapping(value = "/process")
+    public R getInfo(@RequestParam("province") String province,@RequestParam("city") String city,@RequestParam("district") String district)
+    {
+        String sName = province + city + district;
+        String key = "city:citySName:" + province + ":" + city + ":" + district;
+        String cityId = redisCache.getCacheObject(key);
+        if (StringUtils.isEmpty(cityId)) {
+            FsCity fsCity = new FsCity();
+            fsCity.setCitySname(sName);
+            cityId = fsCityService.selectByFsCity(fsCity);
+            if (StringUtils.isEmpty(cityId)) {
+                cityId = fsCityService.likeByCityDistrict(city, district);
+            }
+            if (StringUtils.isEmpty(cityId)) {
+                return R.error("获取城市信息失败!");
+            }
+            redisCache.setCacheObject(key, cityId);
+        }
+        return R.ok().put("cityId",cityId);
+    }
+
+
+}

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

@@ -18,6 +18,9 @@ import com.fs.his.param.*;
 import com.fs.his.service.*;
 import com.fs.his.vo.FsStoreOrderItemListUVO;
 import com.fs.his.vo.FsStoreOrderListUVO;
+import com.fs.hisStore.domain.FsStoreOrderScrm;
+import com.fs.hisStore.param.FsStoreOrderExpressEditParam;
+import com.fs.hisStore.service.IFsStoreOrderScrmService;
 import com.fs.ybPay.service.IPayService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -47,6 +50,9 @@ public class StoreOrderController extends  AppBaseController {
     @Autowired
     private IFsStoreOrderService orderService;
 
+    @Autowired
+    private IFsStoreOrderScrmService orderScrmService;
+
     @Autowired
     private IFsStoreOrderItemService orderItemService;
 
@@ -202,6 +208,23 @@ public class StoreOrderController extends  AppBaseController {
         }
     }
 
+    @Login
+    @ApiOperation("同步快递信息")
+    @PostMapping("/syncExpress")
+    public void syncExpress(@Validated @RequestBody FsStoreOrderExpressParam param, HttpServletRequest request){
+        FsStoreOrderScrm order=orderScrmService.selectFsStoreOrderByOrderId(param.getOrderId());
+        if (order == null || order.getDeliverySn() == null || !order.getDeliverySn().equals("") || order.getDeliveryId() == null || !order.getDeliveryId().equals("")) {
+            return;
+        }
+        FsStoreOrderExpressEditParam editParam = new FsStoreOrderExpressEditParam();
+        editParam.setOrderId(param.getOrderId());
+        try {
+            orderScrmService.syncExpress(editParam);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+    }
+
     @Login
     @ApiOperation("完成订单")
     @PostMapping("/finishOrder")