Browse Source

代码修正

quyx@nextosd.com 4 months ago
parent
commit
2144c6b47d

+ 5 - 0
yamada-fcbi/src/main/java/jp/yamada/fcbi/constants/Constants.java

@@ -86,6 +86,11 @@ public class Constants {
     /**
      * 数字(1024)
      */
+    public static final int NUMBER_500 = 500;
+
+    /**
+     * 数字(1024)
+     */
     public static final int NUMBER_50 = 50;
 
     /**

+ 2 - 2
yamada-fcbi/src/main/java/jp/yamada/fcbi/controller/YmdfSurveyController.java

@@ -183,7 +183,7 @@ public class YmdfSurveyController extends BaseController
     public void exportCustomerCsv(HttpServletResponse response, YmdfSurveyCustomerCsvParam param) {
         List<YmdfSurveyCustomerCsvParam> list = ymdfSurveyService.selectYmdfCustomerCsvList(param);
         ExcelUtil<YmdfSurveyCustomerCsvParam> util = new ExcelUtil<>(YmdfSurveyCustomerCsvParam.class);
-        util.exportCsv(response, list, "店铺列表数据");
+        ExcelUtil.exportCsv(response, list, "店铺列表数据");
     }
 
     /**
@@ -195,7 +195,7 @@ public class YmdfSurveyController extends BaseController
     public void exportCustomerDm(HttpServletResponse response, YmdfSurveyCustomerDmParam param) {
         List<YmdfSurveyCustomerDmParam> list = ymdfSurveyService.selectYmdfCustomerDmList(param);
         ExcelUtil<YmdfSurveyCustomerDmParam> util = new ExcelUtil<>(YmdfSurveyCustomerDmParam.class);
-        util.exportCsv(response, list, "地域名列表数据");
+        ExcelUtil.exportCsv(response, list, "地域名列表数据");
     }
 
     /**

+ 2 - 0
yamada-fcbi/src/main/java/jp/yamada/fcbi/domain/YmdfSurvey.java

@@ -201,4 +201,6 @@ public class YmdfSurvey extends BaseEntity
     private String startYear;
 
     private Integer salesFlag;
+
+    private Integer minSpendingAmount;
 }

+ 1 - 1
yamada-fcbi/src/main/java/jp/yamada/fcbi/param/YmdfSurveyCustomerCsvParam.java

@@ -60,5 +60,5 @@ public class YmdfSurveyCustomerCsvParam implements Serializable {
 
     private List<String> businessTypeCodes;
 
-    private List<RegionInfoVo> regions;
+    private List<String> regionCodes;
 }

+ 1 - 1
yamada-fcbi/src/main/java/jp/yamada/fcbi/param/YmdfSurveyCustomerDmParam.java

@@ -61,5 +61,5 @@ public class YmdfSurveyCustomerDmParam implements Serializable {
 
     private List<String> businessTypeCodes;
 
-    private List<RegionInfoVo> regions;
+    private List<String> regionCodes;
 }

+ 1 - 0
yamada-fcbi/src/main/java/jp/yamada/fcbi/service/impl/YmdfSurveyServiceImpl.java

@@ -224,6 +224,7 @@ public class YmdfSurveyServiceImpl implements IYmdfSurveyService
     public List<YmdfSurveyCustomerDmParam> selectYmdfCustomerDmList(YmdfSurveyCustomerDmParam param) {
         YmdfSurvey ymdfSurvey = new YmdfSurvey();
         BeanUtils.copyProperties(param, ymdfSurvey);
+        ymdfSurvey.setMinSpendingAmount(Constants.NUMBER_500);
         List<YmdfSurvey> surveyList = ymdfSurveyMapper.selectYmdfCustomerDmList(ymdfSurvey);
 
         return surveyList.stream()

+ 51 - 16
yamada-fcbi/src/main/resources/mapper/fcbi/YmdfCustomerMapper.xml

@@ -75,14 +75,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN ymdf_basic_region parent_region
                           ON region.parent_id = parent_region.region_id
         WHERE
-          -- 複数選択条件(ブランド、業種、地域は複数の値ををサポート)
-            s.brand_code IN ('010', '020')  -- 複数選択ブランドコード
-          AND s.business_type_code IN ('010', '020')  -- 複数選択業種コード
-          AND s.region_code IN ('KYUSHU_KAGOSHIMA', 'KINKI_KEIHAN', 'SHIKOKU') -- 複数選択地域コード
-          -- 店舗名のあいまい検索(例:「東京」を含む店舗)
-          AND s.store_name LIKE '%L%'  -- 店舗名に「東京」を含む
-          -- 基本フィルタ
-          AND c.del_flag = 0  -- 削除済み顧客を除外
+        c.del_flag = 0  -- 削除済み顧客を除外
+
+        <if test="brandCodes != null and brandCodes != ''">
+            AND s.brand_code IN
+            <foreach collection="brandCodes" item="brandCode" open="(" separator="," close=")">
+                #{brandCode}
+            </foreach>
+        </if>
+
+        <if test="businessTypeCodes != null and businessTypeCodes != ''">
+            AND s.business_type_code IN
+            <foreach collection="businessTypeCodes" item="businessTypeCode" open="(" separator="," close=")">
+                #{businessTypeCode}
+            </foreach>
+        </if>
+
+        <if test="regionCodes != null and regionCodes != ''">
+            AND s.region_code IN
+            <foreach collection="regionCodes" item="regionCode" open="(" separator="," close=")">
+                #{regionCode}
+            </foreach>
+        </if>
+
+        <if test="storeName != null and storeName != ''">
+            AND s.store_name LIKE CONCAT('%', #{storeName}, '%')
+        </if>
     </select>
 
     <select id="selectYmdfCustomerDmList" parameterType="YmdfSurvey" resultMap="YmdfCustomerResult">
@@ -141,15 +159,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND c.last_purchase_month >=
               CAST(DATE_FORMAT(DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH), '%Y%m') AS UNSIGNED)
 --   -- 累計金額基準(例:10,000円以上)
-          AND c.total_valid_spending >= 500
+        AND c.total_valid_spending >= #{minSpendingAmount}
           -- ブランド複数選択
-          AND s.brand_code IN ('010', '020')
-          -- 業種複数選択
-          AND s.business_type_code IN ('010', '020')
-          -- 地域複数選択
-          AND s.region_code IN ('KYUSHU_KAGOSHIMA', 'KINKI_KEIHAN', 'SHIKOKU')
-          -- 店舗名あいまい検索
-          AND s.store_name LIKE '%L%'  -- 店舗名に「東京」を含む
+        <if test="brandCodes != null and brandCodes != ''">
+            AND s.brand_code IN
+            <foreach collection="brandCodes" item="brandCode" open="(" separator="," close=")">
+                #{brandCode}
+            </foreach>
+        </if>
+
+        <if test="businessTypeCodes != null and businessTypeCodes != ''">
+            AND s.business_type_code IN
+            <foreach collection="businessTypeCodes" item="businessTypeCode" open="(" separator="," close=")">
+                #{businessTypeCode}
+            </foreach>
+        </if>
+
+        <if test="regionCodes != null and regionCodes != ''">
+            AND s.region_code IN
+            <foreach collection="regionCodes" item="regionCode" open="(" separator="," close=")">
+                #{regionCode}
+            </foreach>
+        </if>
+
+        <if test="storeName != null and storeName != ''">
+            AND s.store_name LIKE CONCAT('%', #{storeName}, '%')
+        </if>
         ORDER BY
             c.total_valid_spending DESC,
             c.last_purchase_month DESC

+ 1 - 1
yamada-fcbi/src/main/resources/mapper/fcbi/YmdfSurveyMapper.xml

@@ -231,7 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                AND a.survey_id = s.survey_id  -- 対象アンケートの回答を結合
                                AND a.del_flag = 0
         WHERE
-            s.survey_id = 'S1142081669432750080'  -- 対象アンケートID
+            s.survey_id = #{surveyId}  -- 対象アンケートID
           AND s.del_flag = 0  -- 削除済みのアンケートを除外
         GROUP BY
             -- グループ化フィールドにアンケート情報を追加