Browse Source

Merge branch 'master' of http://git.zthymaoyi.com/gongdc/wchy

# Conflicts:
#	unimall-data/src/main/java/com/iotechn/unimall/data/domain/SalesSlip.java
achao 1 năm trước cách đây
mục cha
commit
f40eefa652

+ 4 - 1
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/huiyuan/IMemberManagementService.java

@@ -51,9 +51,12 @@ public interface IMemberManagementService{
 	@HttpMethod(description = "删除", permission = "admin:unimall:memberManagement:delete",permissionParentName = "宠物管理", permissionName = "会员管理管理")
 	public Boolean delete(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")String id)throws ServiceException;
 
-	@HttpMethod(description = "修改", permission = "admin:unimall:memberManagement:update",permissionParentName = "宠物管理", permissionName = "会员管理管理")
+	@HttpMethod(description = "修改")
 	public Boolean update(@NotNull @HttpParam(name = "memberManagement", type = HttpParamType.COMMON, description = "会员管理") MemberManagement memberManagement,
 						  @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "adminId") Long adminId)throws ServiceException;
+	@HttpMethod(description = "修改")
+	public Boolean chongzhi(@NotNull @HttpParam(name = "memberManagement", type = HttpParamType.COMMON, description = "会员管理") MemberManagement memberManagement,
+						  @HttpParam(name = "adminId", type = HttpParamType.ADMIN_ID, description = "adminId") Long adminId)throws ServiceException;
 
 	@HttpMethod(description = "查询", permission = "admin:unimall:memberManagement:get",permissionParentName = "宠物管理", permissionName = "会员管理管理")
 	public MemberManagement get(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")Long id)throws ServiceException;

+ 12 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/huiyuan/impl/MemberManagementServiceImpl.java

@@ -125,6 +125,18 @@ public class MemberManagementServiceImpl implements IMemberManagementService {
         return memberManagementMapper.updateById(memberManagement) > 0;
     }
 
+
+    @Override
+    public Boolean chongzhi(MemberManagement memberManagement, Long adminId) throws ServiceException {
+        MemberManagement memberManagement1 = memberManagementMapper.selectById(memberManagement.getId());
+        Date now = new Date();
+        memberManagement1.setMoney(memberManagement1.getMoney()+memberManagement.getMoney());
+        memberManagement1.setLeiChong(memberManagement1.getLeiChong()+memberManagement.getMoney());
+        memberManagement1.setGmtUpdate(now);
+        memberManagement1.setAdminId(adminId);
+        return memberManagementMapper.updateById(memberManagement1) > 0;
+    }
+
     @Override
     public MemberManagement get(Long id) throws ServiceException {
         return memberManagementMapper.selectById(id);

+ 1 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/huiyuan/impl/MoneyHisServiceImpl.java

@@ -83,6 +83,7 @@ public class MoneyHisServiceImpl implements IMoneyHisService {
             wrapper.eq("admin_id", adminId);
         }
         wrapper.eq("delete_flag", 0);
+        wrapper.orderBy("gmt_create",false);
         List<MoneyHis> list = moneyHisMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
         Integer count = moneyHisMapper.selectCount(wrapper);
         return new Page<MoneyHis>(list, page, limit, count);

+ 15 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/huiyuan/impl/SalesSlipServiceImpl.java

@@ -3,11 +3,14 @@ package com.iotechn.unimall.admin.api.huiyuan.impl;
 import java.util.List;
 
 import com.iotechn.unimall.admin.api.huiyuan.ISalesSlipService;
+import com.iotechn.unimall.data.domain.MemberManagement;
 import com.iotechn.unimall.data.domain.SalesSlip;
+import com.iotechn.unimall.data.mapper.MemberManagementMapper;
 import com.iotechn.unimall.data.mapper.SalesSlipMapper;
 import org.apache.ibatis.session.RowBounds;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -30,6 +33,8 @@ import org.springframework.transaction.annotation.Transactional;
 public class SalesSlipServiceImpl implements ISalesSlipService {
     @Autowired
     private SalesSlipMapper salesSlipMapper;
+    @Autowired
+    private MemberManagementMapper memberManagementMapper;
 
     @Override
     public Boolean add(SalesSlip salesSlip, Long adminId) throws ServiceException {
@@ -37,6 +42,16 @@ public class SalesSlipServiceImpl implements ISalesSlipService {
         salesSlip.setGmtCreate(now);
         salesSlip.setGmtUpdate(now);
         salesSlip.setAdminId(adminId);
+
+        List<MemberManagement> memberManagement =memberManagementMapper.selectList(new EntityWrapper<MemberManagement>().eq("phone",salesSlip.getRemark2())
+        .eq("user_name",salesSlip.getRemark1()));
+
+        if(!CollectionUtils.isEmpty(memberManagement)){
+            memberManagement.get(0).setLeiXiao(memberManagement.get(0).getLeiXiao()+salesSlip.getMoney());
+            memberManagement.get(0).setMoney(memberManagement.get(0).getMoney()-salesSlip.getMoney());
+            memberManagementMapper.updateById(memberManagement.get(0));
+        }
+
         return salesSlipMapper.insert(salesSlip) > 0;
     }
 

+ 12 - 0
unimall-data/pom.xml

@@ -122,6 +122,18 @@
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
 		</dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+        </dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-annotations</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-annotations</artifactId>
+		</dependency>
 	</dependencies>
 
 </project>

+ 3 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/MemberManagement.java

@@ -1,5 +1,6 @@
 package com.iotechn.unimall.data.domain;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.iotechn.unimall.core.framework.aspectj.lang.annotaion.Excel;
@@ -55,6 +56,7 @@ public class MemberManagement extends SuperDO{
     /** 卡到期时间 */
     @Excel(name = "卡到期时间", width = 30, dateFormat = "yyyy-MM-dd")
     @TableField("cart_end_time")
+    @JSONField(format = "yyyy-MM-dd")
     private Date cartEndTime;
 
     /** 金额(元) */
@@ -105,6 +107,7 @@ public class MemberManagement extends SuperDO{
     /**  */
     @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
     @TableField("gmt_create")
+    @JSONField(format = "yyyy-MM-dd")
     private Date gmtCreate;
 
     /**  */

+ 5 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/MoneyHis.java

@@ -1,5 +1,6 @@
 package com.iotechn.unimall.data.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.iotechn.unimall.core.framework.aspectj.lang.annotaion.Excel;
@@ -10,6 +11,8 @@ import lombok.Data;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.enums.FieldFill;
 import com.iotechn.unimall.core.util.StringUtils;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.util.Date;
 
 /**
@@ -75,6 +78,8 @@ public class MoneyHis extends SuperDO{
     /**  */
     @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")
     @TableField("gmt_create")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date gmtCreate;
 
     /**  */