Browse Source

messagerConten实体类修改

kaick 2 years ago
parent
commit
4ca57502e9

+ 4 - 0
pom.xml

@@ -30,6 +30,10 @@
     </dependencyManagement>
 
     <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>

+ 8 - 1
src/main/java/com/caimei365/user/mapper/MessageCenterMapper.java

@@ -85,6 +85,13 @@ public interface MessageCenterMapper {
 
     Integer deleteMessage(String id);
 
-    Integer updateRead(Integer userType,String Id);
+    Integer updateRead(Integer userType, String Id);
+
+    Integer updateMessageCenter(MessageCenter messageCenter);
+
+    Integer insertMessageCenter(MessageCenter messageCenter);
+
+    List<Integer> getMessageCenterListDay(Integer day);
+
 
 }

+ 4 - 0
src/main/java/com/caimei365/user/model/vo/MessageCenter.java

@@ -107,4 +107,8 @@ public class MessageCenter implements Serializable {
      * 供应商公司名称
      */
     private String shopName;
+    /**
+     * 失败原因
+     */
+    private String reasonContent;
 }

+ 15 - 0
src/main/java/com/caimei365/user/service/LoginService.java

@@ -11,6 +11,7 @@ import com.github.pagehelper.PageInfo;
 import org.springframework.http.HttpHeaders;
 
 import java.text.ParseException;
+import java.util.List;
 import java.util.Map;
 
 
@@ -165,4 +166,18 @@ public interface LoginService {
      * @return
      */
     ResponseJson<String> operateVerification(LoginCodeDto loginCodeDto);
+    /**
+     * 修改消息
+     * @param messageCenter
+     * @return
+     */
+    Integer updateMessageCenter(MessageCenter messageCenter);
+    /**
+     * 新增消息
+     * @param messageCenter
+     * @return
+     */
+    Integer insertMessageCenter(MessageCenter messageCenter);
+
+    List<Integer> getMessageCenterListDay(Integer day);
 }

+ 15 - 0
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -1151,6 +1151,21 @@ public class LoginServiceImpl implements LoginService {
         }
     }
 
+    @Override
+    public Integer updateMessageCenter(MessageCenter messageCenter) {
+        return messageCenterMapper.updateMessageCenter(messageCenter);
+    }
+
+    @Override
+    public Integer insertMessageCenter(MessageCenter messageCenter) {
+        return messageCenterMapper.insertMessageCenter(messageCenter);
+    }
+
+    @Override
+    public List<Integer> getMessageCenterListDay(Integer day) {
+        return  messageCenterMapper.getMessageCenterListDay(day);
+    }
+
     /**
      * 根据userId查是否过期,返回dto对象,flag=0未买过,-1过期,1有效,endTime过期时间
      */

+ 109 - 0
src/main/resources/mapper/MessageCenter.xml

@@ -1,6 +1,36 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.MessageCenterMapper">
+
+    <resultMap id="MessageCenterResult" type="com.caimei365.user.model.vo.MessageCenter">
+        <id     property="id"    column="id"     />
+        <result property="shopId"  column="shopID"   />
+        <result property="clubId"  column="clubId"   />
+        <result property="orderId" column="orderId"   />
+        <result property="userType"  column="userType"   />
+        <result property="messageType"    column="messageType"      />
+        <result property="content"    column="content" />
+        <result property="time"    column="time" />
+        <result property="accountType"    column="accountType" />
+        <result property="couponType"    column="couponType" />
+        <result property="couponFee"    column="couponFee" />
+        <result property="mainImage"    column="mainImage" />
+        <result property="onlinePayFlag"    column="onlinePayFlag" />
+        <result property="productName"    column="productName" />
+        <result property="shopMessType"    column="shopMessType" />
+        <result property="shopTieredType"    column="shopTieredType" />
+        <result property="orderMessageType"    column="orderMessageType" />
+        <result property="saved"    column="saved" />
+        <result property="couponMessageType"    column="couponMessageType" />
+        <result property="productCount"    column="productCount" />
+        <result property="refundType"    column="refundType" />
+        <result property="status"    column="status" />
+        <result property="productId"    column="productId" />
+        <result property="shopName"    column="shopName" />
+    </resultMap>
+
+
+
     <insert id="addMessageCenter">
         INSERT INTO message_center (shopID, clubID, userType, messageType, content,time,accountType,couponType,couponFee,couponMessageType,ShopMessType)
         VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content},#{time},#{accountType},#{couponType},#{couponFee},#{couponMessageType},#{shopMessType})
@@ -238,5 +268,84 @@
     <select id="shopName" resultType="java.lang.String">
         SELECT name FROM `shop` WHERE shopID=#{shopID}
     </select>
+    <select id="getMessageCenterListDay" resultType="java.lang.Integer">
+        select distinct  d.shopID as shopID from  cm_receipt as r
+        LEFT JOIN  cm_discern_receipt as d on r.receiptID=d.id
+        LEFT JOIN  shop as s on d.shopID=s.shopID
+        WHERE receStatct=0 and DATEDIFF(r.dateStrings,NOW())=#{day}
+    </select>
+
+    <update id="updateMessageCenter" parameterType="com.caimei365.user.model.vo.MessageCenter">
+
+        update message_center
+        <set>
+<!--            <if test="id != null and id != 0">id = #{id},</if>-->
+<!--            <if test="shopID != null and shopID != ''">shopID = #{shopID},</if>-->
+<!--            <if test="clubID != null and clubID != ''">clubID = #{clubID},</if>-->
+            <if test="orderId != null and orderId != '' ">orderID = #{orderId},</if>
+            <if test="userType != null and userType != ''">userType = #{userType},</if>
+            <if test="messageType != null and messageType != ''">messageType = #{messageType},</if>
+            <if test="accountType != null and accountType != ''">accountType = #{accountType},</if>
+            <if test="orderMessageType != null and orderMessageType != ''">orderMessageType = #{orderMessageType},</if>
+            <if test="couponMessageType != null and couponMessageType != ''">couponMessageType = #{couponMessageType},</if>
+            <if test="couponFee != null and couponFee != ''">couponFee = #{couponFee},</if>
+            <if test="content != null and content != ''">content = #{content},</if>
+            <if test="time != null and time != ''">`time` = #{time},</if>
+            <if test="saved != null and saved != ''">saved = #{saved},</if>
+            <if test="shopMessType != null and shopMessType != ''">shopMessType = #{shopMessType},</if>
+            <if test="shopTieredType != null and sex != ''">shopTieredType = #{shopTieredType},</if>
+            <if test="shopTieredType != null and shopTieredType != ''">couponType = #{couponType},</if>
+            <if test="productId != null and productId != ''">productID = #{productId},</if>
+        </set>
+        <where>
+            <if test="userType == 1">
+                and  shopID=#{shopId}
+            </if>
+            <if test="userType == 2">
+                and  clubID=#{clubId}
+            </if>
+        </where>
+    </update>
 
+    <insert id="insertMessageCenter" parameterType="com.caimei365.user.model.vo.MessageCenter">
+
+        insert into message_center
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="shopId != null and shopId != ''">shopID,</if>
+        <if test="clubId != null and clubId != ''">clubID,</if>
+        <if test="orderId != null and orderId != '' ">orderID,</if>
+        <if test="userType != null and userType != ''">userType ,</if>
+        <if test="messageType != null and messageType != ''">messageType,</if>
+        <if test="accountType != null and accountType != ''">accountType,</if>
+        <if test="orderMessageType != null and orderMessageType != ''">orderMessageType,</if>
+        <if test="couponMessageType != null and couponMessageType != ''">couponMessageTyp,</if>
+        <if test="couponFee != null and couponFee != ''">couponFee,</if>
+        <if test="content != null and content != ''">content,</if>
+        <if test="time != null and time != ''">`time`,</if>
+        <if test="saved != null and saved != ''">saved ,</if>
+        <if test="shopMessType != null and shopMessType != ''">shopMessType,</if>
+        <if test="shopTieredType != null and shopTieredType != ''">shopTieredType,</if>
+        <if test="shopTieredType != null and shopTieredType != ''">couponType,</if>
+        <if test="productId != null and productId != ''">productID,</if>
+        </trim >
+            values
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="shopId != null and shopId != ''"> #{shopId},</if>
+        <if test="clubId != null and clubId != ''"> #{clubId},</if>
+        <if test="orderId != null and orderId != '' "> #{orderId},</if>
+        <if test="userType != null and userType != ''">  #{userType},</if>
+        <if test="messageType != null and messageType != ''">  #{messageType},</if>
+        <if test="accountType != null and accountType != ''">  #{accountType},</if>
+        <if test="orderMessageType != null and orderMessageType != ''">  #{orderMessageType},</if>
+        <if test="couponMessageType != null and couponMessageType != ''"> #{couponMessageType},</if>
+        <if test="couponFee != null and couponFee != ''">  #{couponFee},</if>
+        <if test="content != null and content != ''"> #{content},</if>
+        <if test="time != null and time != ''">  #{time},</if>
+        <if test="saved != null and saved != ''">  #{saved},</if>
+        <if test="shopMessType != null and shopMessType != ''"> #{shopMessType},</if>
+        <if test="shopTieredType != null and sex != ''"> #{shopTieredType},</if>
+        <if test="shopTieredType != null and shopTieredType != ''"> #{couponType},</if>
+        <if test="productId != null and productId != ''">  #{productId},</if>
+        </trim>
+    </insert>
 </mapper>

+ 9 - 5
src/test/java/com/caimei365/user/UserApplicationTests.java

@@ -4,6 +4,7 @@ import com.caimei365.user.feign.ToolsFeign;
 import com.caimei365.user.mapper.SuperVipMapper;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.po.VipPayHistoryPo;
+import com.caimei365.user.service.LoginService;
 import com.caimei365.user.utils.AliyunSmsUtil;
 import com.caimei365.user.utils.CodeUtil;
 import com.caimei365.user.utils.ValidateUtil;
@@ -20,12 +21,15 @@ import java.util.List;
 
 @SpringBootTest
 class UserApplicationTests {
-
-    /*@Test
+    @Resource
+    LoginService loginService;
+    @Test
     void contextLoads() {
-        boolean b = ValidateUtil.validateEmail("182126@qq.com");
-        System.out.println(b);
-    }*/
+        List<Integer> listShopId = loginService.getMessageCenterListDay(1);
+        System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");
+//        boolean b = ValidateUtil.validateEmail("182126@qq.com");
+//        System.out.println(b);
+    }
 //    @Resource
 //    private ToolsFeign feign;
 //