yexianchao 1 miesiąc temu
rodzic
commit
bb31ca638b
27 zmienionych plików z 317 dodań i 51 usunięć
  1. 0 1
      crm-custom/src/main/java/com/crm/custom/controller/CustomController.java
  2. 31 0
      crm-custom/src/main/java/com/crm/custom/controller/GoldenCustomBalanceRecordController.java
  3. 1 1
      crm-custom/src/main/java/com/crm/custom/controller/GoldenRewardQuestionController.java
  4. 14 0
      crm-custom/src/main/java/com/crm/custom/dao/mapper/GoldenCustomBalanceRecordMapper.java
  5. 13 0
      crm-custom/src/main/java/com/crm/custom/dao/repository/GoldenCustomBalanceRecordRepository.java
  6. 12 0
      crm-custom/src/main/java/com/crm/custom/service/GoldenCustomBalanceRecordService.java
  7. 4 12
      crm-custom/src/main/java/com/crm/custom/service/impl/CustomInfoServiceImpl.java
  8. 57 0
      crm-custom/src/main/java/com/crm/custom/service/impl/GoldenCustomBalanceRecordServiceImpl.java
  9. 1 0
      crm-custom/src/main/java/com/crm/custom/service/impl/GoldenOrderServiceImpl.java
  10. 30 19
      crm-custom/src/main/java/com/crm/custom/service/impl/GoldenRewardQuestionServiceImpl.java
  11. 34 0
      crm-custom/src/main/resources/mapper/GoldenCustomBalanceRecordMapper.xml
  12. 8 2
      crm-custom/src/main/resources/mapper/GoldenOrder.xml
  13. 1 2
      crm-custom/src/main/resources/mapper/GoldenQuestionCustomMapper.xml
  14. 21 0
      crm-model/src/main/java/com/crm/rely/backend/model/dto/golden/goods/GoldenCustomBalanceRecordListDto.java
  15. 2 0
      crm-model/src/main/java/com/crm/rely/backend/model/dto/golden/order/GoldenOrderListDto.java
  16. 4 4
      crm-model/src/main/java/com/crm/rely/backend/model/entity/custom/info/CustomInfoRegisterEntity.java
  17. 2 0
      crm-model/src/main/java/com/crm/rely/backend/model/entity/custom/info/CustomInfoUpdateEntity.java
  18. 15 0
      crm-model/src/main/java/com/crm/rely/backend/model/entity/golden/order/GoldenBalanceSearchEntity.java
  19. 2 0
      crm-model/src/main/java/com/crm/rely/backend/model/entity/golden/order/GoldenOrderSearchEntity.java
  20. 27 0
      crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenCustomBalanceRecordTable.java
  21. 2 0
      crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenOrderTable.java
  22. 4 0
      crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenQuestionCustomTable.java
  23. 1 1
      crm-pay/src/main/java/com/crm/pay/controller/FinanceWithdrawController.java
  24. 10 0
      crm-pay/src/main/java/com/crm/pay/dao/repository/GoldenCustomBalanceRecordRepository.java
  25. 2 2
      crm-pay/src/main/java/com/crm/pay/entity/telegraphic/TelegraphicAddEntity.java
  26. 7 3
      crm-pay/src/main/java/com/crm/pay/service/impl/FinanceDepositServiceImpl.java
  27. 12 4
      crm-pay/src/main/java/com/crm/pay/service/impl/FinanceWithdrawServiceImpl.java

+ 0 - 1
crm-custom/src/main/java/com/crm/custom/controller/CustomController.java

@@ -257,7 +257,6 @@ public class CustomController extends BaseLoginController {
         entity.setModifyIp(sysCountryService.getAdderByIp(req));
         entity.setModifyTime(new Date());
         entity.setValid(1);
-        entity.setSno(null);
         customInfoService.update(entity);
 
         infoEntity.setValid(entity.getValid());

+ 31 - 0
crm-custom/src/main/java/com/crm/custom/controller/GoldenCustomBalanceRecordController.java

@@ -0,0 +1,31 @@
+package com.crm.custom.controller;
+
+import com.crm.custom.service.GoldenCustomBalanceRecordService;
+import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
+import com.crm.rely.backend.model.dto.golden.goods.GoldenCustomBalanceRecordListDto;
+import com.crm.rely.backend.model.entity.custom.info.CustomInfoEntity;
+import com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/custom/balance/recoed")
+public class GoldenCustomBalanceRecordController {
+
+    @Autowired
+    private GoldenCustomBalanceRecordService commonQuestionService;
+
+    @PostMapping("/search/list")
+    public ResultWithPagerDto<GoldenCustomBalanceRecordListDto> customPageList(@RequestBody GoldenBalanceSearchEntity entity, CustomInfoEntity infoEntity) throws Exception {
+        if (infoEntity == null || infoEntity.getId() == null) {
+            entity.setCustomId(-1l);
+        }else {
+            entity.setCustomId(infoEntity.getId());
+        }
+        return commonQuestionService.searchPageList(entity);
+    }
+
+}

+ 1 - 1
crm-custom/src/main/java/com/crm/custom/controller/GoldenRewardQuestionController.java

@@ -76,7 +76,7 @@ public class GoldenRewardQuestionController {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    @Scheduled(cron = "0 20 0 * * ?")
+    @Scheduled(cron = "0 36 17 * * ?")
     public void rewardQuestionTask() throws Exception {
         try {
             log.info("有奖问答统计任务开始 ---------------");

+ 14 - 0
crm-custom/src/main/java/com/crm/custom/dao/mapper/GoldenCustomBalanceRecordMapper.java

@@ -0,0 +1,14 @@
+package com.crm.custom.dao.mapper;
+
+import com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity;
+import com.crm.rely.backend.model.pojo.table.GoldenCustomBalanceRecordTable;
+
+import java.util.List;
+
+public interface GoldenCustomBalanceRecordMapper {
+
+    Integer countList(GoldenBalanceSearchEntity entity);
+
+    List<GoldenCustomBalanceRecordTable> pageList(GoldenBalanceSearchEntity entity);
+
+}

+ 13 - 0
crm-custom/src/main/java/com/crm/custom/dao/repository/GoldenCustomBalanceRecordRepository.java

@@ -0,0 +1,13 @@
+package com.crm.custom.dao.repository;
+
+import com.crm.rely.backend.dao.repository.BaseRepository;
+import com.crm.rely.backend.model.pojo.table.GoldenCustomBalanceRecordTable;
+import com.crm.rely.backend.model.pojo.table.GoldenCustomRewardRecordTable;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface GoldenCustomBalanceRecordRepository extends BaseRepository<GoldenCustomBalanceRecordTable> {
+
+}

+ 12 - 0
crm-custom/src/main/java/com/crm/custom/service/GoldenCustomBalanceRecordService.java

@@ -0,0 +1,12 @@
+package com.crm.custom.service;
+
+import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
+import com.crm.rely.backend.core.exception.ServiceException;
+import com.crm.rely.backend.model.dto.golden.goods.GoldenCustomBalanceRecordListDto;
+import com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity;
+
+public interface GoldenCustomBalanceRecordService {
+
+    ResultWithPagerDto<GoldenCustomBalanceRecordListDto> searchPageList(GoldenBalanceSearchEntity entity) throws ServiceException;
+
+}

+ 4 - 12
crm-custom/src/main/java/com/crm/custom/service/impl/CustomInfoServiceImpl.java

@@ -303,14 +303,6 @@ public class CustomInfoServiceImpl extends BaseUploadServiceImpl implements Cust
     public void update(CustomInfoUpdateEntity entity) throws ServiceException {
 
         CustomInfoTable customInfoTable = findFirstById(entity.getId());
-        if (Strings.isNullOrEmpty(entity.getSno())) {
-            entity.setSno(customInfoTable.getSno());
-        } else {
-            if (!entity.getSno().equals(customInfoTable.getSno())) {
-                existBySno(entity.getSno());
-            }
-        }
-
         if (!Strings.isNullOrEmpty(entity.getIdentity()) && !entity.getIdentity().equals(customInfoTable.getIdentity())) {
             existByIdentity(entity.getIdentity());
         }
@@ -318,7 +310,7 @@ public class CustomInfoServiceImpl extends BaseUploadServiceImpl implements Cust
         BeanUtils.copyProperties(entity, customInfoTable);
 
         //获取国家信息
-        SysCountryTable sysCountryTable = sysCountryService.getByCode(entity.getCountry());
+      /*  SysCountryTable sysCountryTable = sysCountryService.getByCode(entity.getCountry());
         //设置国家信息
         customInfoTable.setCountryEnName(sysCountryTable.getEnName());
         customInfoTable.setCountryName(sysCountryTable.getName());
@@ -326,14 +318,14 @@ public class CustomInfoServiceImpl extends BaseUploadServiceImpl implements Cust
             customInfoTable.setAddressLine(String.join("@#", entity.getAddressLines()));
         } else {
             customInfoTable.setAddressLine(null);
-        }
+        }*/
 
         customInfoRepository.save(customInfoTable);
 
-        CustomBankAddEntity customBankAddEntity = new CustomBankAddEntity();
+        /*CustomBankAddEntity customBankAddEntity = new CustomBankAddEntity();
         BeanUtils.copyProperties(entity, customBankAddEntity);
         customBankAddEntity.setCustomId(entity.getId());
-        customBankService.add(customBankAddEntity);
+        customBankService.add(customBankAddEntity);*/
     }
 
     @Override

+ 57 - 0
crm-custom/src/main/java/com/crm/custom/service/impl/GoldenCustomBalanceRecordServiceImpl.java

@@ -0,0 +1,57 @@
+package com.crm.custom.service.impl;
+
+import com.crm.custom.dao.mapper.GoldenCustomBalanceRecordMapper;
+import com.crm.custom.dao.repository.GoldenCustomBalanceRecordRepository;
+import com.crm.custom.service.GoldenCustomBalanceRecordService;
+import com.crm.rely.backend.core.constant.Constants;
+import com.crm.rely.backend.core.dto.base.PageDto;
+import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
+import com.crm.rely.backend.core.exception.ServiceException;
+import com.crm.rely.backend.model.dto.golden.goods.GoldenCustomBalanceRecordListDto;
+import com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity;
+import com.crm.rely.backend.model.pojo.table.GoldenCustomBalanceRecordTable;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class GoldenCustomBalanceRecordServiceImpl implements GoldenCustomBalanceRecordService {
+
+    @Autowired
+    private GoldenCustomBalanceRecordRepository repository;
+    @Autowired
+    private GoldenCustomBalanceRecordMapper mapper;
+
+   
+    @Override
+    public ResultWithPagerDto<GoldenCustomBalanceRecordListDto> searchPageList(GoldenBalanceSearchEntity entity) throws ServiceException {
+        Integer count = mapper.countList(entity);
+        PageDto pageDto = PageDto.format(entity, count);
+        if (count == null || count <= 0) {
+            return ResultWithPagerDto.success(pageDto);
+        }
+        List<GoldenCustomBalanceRecordTable> tables = mapper.pageList(entity);
+        if (tables == null || tables.size() <= 0) {
+            throw new ServiceException(Constants.SYSTEM_ERROR);
+        }
+        List<GoldenCustomBalanceRecordListDto> dtos = new ArrayList<>(tables.size());
+
+        for (GoldenCustomBalanceRecordTable table : tables) {
+            GoldenCustomBalanceRecordListDto dto = transformSearchListDto(table);
+            dtos.add(dto);
+        }
+
+        return ResultWithPagerDto.success(pageDto, dtos);
+    }
+
+    private GoldenCustomBalanceRecordListDto transformSearchListDto(GoldenCustomBalanceRecordTable table) {
+        GoldenCustomBalanceRecordListDto dto = new GoldenCustomBalanceRecordListDto();
+        BeanUtils.copyProperties(table, dto);
+        return dto;
+    }
+
+
+}

+ 1 - 0
crm-custom/src/main/java/com/crm/custom/service/impl/GoldenOrderServiceImpl.java

@@ -175,6 +175,7 @@ public class GoldenOrderServiceImpl implements GoldenOrderService {
         table.setSerial(orderNo);
         table.setCId(infoEntity.getCId());
         table.setCustomId(infoEntity.getId());
+        table.setEmail(infoEntity.getEmail());
         table.setStatus(PayConstants.ORDER_PAY_STATUS);
         table.setAmount(BigDecimal.ZERO);
         table.setCurrency("USD");

+ 30 - 19
crm-custom/src/main/java/com/crm/custom/service/impl/GoldenRewardQuestionServiceImpl.java

@@ -2,10 +2,7 @@ package com.crm.custom.service.impl;
 
 import com.crm.custom.dao.mapper.GoldenQuestionCustomMapper;
 import com.crm.custom.dao.mapper.GoldenRewardQuestionMapper;
-import com.crm.custom.dao.repository.CustomInfoRepository;
-import com.crm.custom.dao.repository.GoldenCustomRewardRecordRepository;
-import com.crm.custom.dao.repository.GoldenQuestionCustomRepository;
-import com.crm.custom.dao.repository.GoldenRewardQuestionRepository;
+import com.crm.custom.dao.repository.*;
 import com.crm.custom.service.GoldenRewardQuestionService;
 import com.crm.custom.service.SysConfigService;
 import com.crm.rely.backend.core.constant.Constants;
@@ -50,6 +47,8 @@ public class GoldenRewardQuestionServiceImpl implements GoldenRewardQuestionServ
     @Autowired
     private GoldenCustomRewardRecordRepository goldenCustomRewardRecordRepository;
     @Autowired
+    private GoldenCustomBalanceRecordRepository customBalanceRecordRepository;
+    @Autowired
     private SysConfigService sysConfigService;
 
     @Override
@@ -64,9 +63,11 @@ public class GoldenRewardQuestionServiceImpl implements GoldenRewardQuestionServ
             Integer count = goldenQuestionCustomMapper.getCountQuestionByDate(customId,startDate,endDate);
             if (count == null || count <= 0) {
                 GoldenRewardQuestionTable table =  mapper.getRandQuestion();
-                dto.setQuestionId(table.getId());
-                dto.setQuestion(table.getQuestion());
-                dto.setType(1);
+                if (table != null) {
+                    dto.setQuestionId(table.getId());
+                    dto.setQuestion(table.getQuestion());
+                    dto.setType(1);
+                }
             }
         }
 
@@ -91,6 +92,7 @@ public class GoldenRewardQuestionServiceImpl implements GoldenRewardQuestionServ
         BeanUtils.copyProperties(entity, table);
         table.setQuestion(questionTable.getQuestion());
         table.setAnswer(questionTable.getAnswer());
+        table.setCustomRight(questionTable.getAnswer() == table.getCustomAnswer() ? 1 : 0 );
         goldenQuestionCustomRepository.save(table);
     }
 
@@ -184,6 +186,15 @@ public class GoldenRewardQuestionServiceImpl implements GoldenRewardQuestionServ
                     BigDecimal balance = custom.getBalance() == null ? BigDecimal.ZERO : custom.getBalance();
                     custom.setBalance(balance.add(giveAmount));
                     customInfoRepository.save(custom);
+
+                    GoldenCustomBalanceRecordTable record = new GoldenCustomBalanceRecordTable();
+                    record.setCustomId(custom.getId());
+                    record.setCId(custom.getCId());
+                    record.setAmount(giveAmount);
+                    record.setType(2);
+                    record.setAddTime(new Date());
+                    customBalanceRecordRepository.save(record);
+
                 }else{
                     table.setStatus(3);
                 }
@@ -195,27 +206,27 @@ public class GoldenRewardQuestionServiceImpl implements GoldenRewardQuestionServ
 
     }
 
-    public static void main(String[] args) throws Exception {
-        System.out.println(DateUtil.formatDate(DateUtil.addDate(new Date(),-180)));
-    }
-
     @JmsListener(destination = ConfigConstants.CUSTOM_REWARD_RECORD)
     @Transactional(rollbackFor = Exception.class)
     public void addCustomRewardRecord(String content) throws ServiceException {
-        log.info(String.format("CUSTOM_REWARD_RECORD,content:%s", content));
+        log.info(String.format("CUSTOM_REWARD_RECORD,content-customId:%s", content));
 
         if (Strings.isNullOrEmpty(content)) {
             log.error("CUSTOM_REWARD_RECORD,content is null");
             return;
         }
 
-        GoldenCustomRewardRecordTable table = new GoldenCustomRewardRecordTable();
-        table.setCustomId(Long.valueOf(content));
-        table.setStartDate(new Date());
-        table.setStatus(1);
-        table.setGrantStatus(1);
-        table.setAddTime(new Date());
-        goldenCustomRewardRecordRepository.save(table);
+        GoldenCustomRewardRecordTable recodeTable = goldenCustomRewardRecordRepository.findFirstByCustomId(Long.valueOf(content));
+        if(recodeTable == null){
+            GoldenCustomRewardRecordTable table = new GoldenCustomRewardRecordTable();
+            table.setCustomId(Long.valueOf(content));
+            table.setStartDate(new Date());
+            table.setStatus(1);
+            table.setGrantStatus(1);
+            table.setAddTime(new Date());
+            goldenCustomRewardRecordRepository.save(table);
+        }
+
     }
 
 }

+ 34 - 0
crm-custom/src/main/resources/mapper/GoldenCustomBalanceRecordMapper.xml

@@ -0,0 +1,34 @@
+<?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.crm.custom.dao.mapper.GoldenCustomBalanceRecordMapper">
+
+    <select id="countList" resultType="integer"
+            parameterType="com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity">
+        select count(*) from golden_custom_balance_record
+        <where>
+            <if test="customId!=null">
+                and custom_id= #{customId}
+            </if>
+            <if test="cId!=null">
+                and c_id= #{cId}
+            </if>
+        </where>
+    </select>
+
+    <select id="pageList" resultType="com.crm.rely.backend.model.pojo.table.GoldenCustomBalanceRecordTable"
+            parameterType="com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity">
+        select * from golden_custom_balance_record
+        <where>
+            <if test="customId!=null">
+                and custom_id= #{customId}
+            </if>
+        </where>
+        order by id desc
+        <if test="page != null">
+            limit #{page.offset},#{page.row}
+        </if>
+    </select>
+
+</mapper>

+ 8 - 2
crm-custom/src/main/resources/mapper/GoldenOrder.xml

@@ -15,7 +15,10 @@
                 and der.`c_id` = #{cId}
             </if>
             <if test="status!=null">
-                and der.`c_id` = #{status}
+                and der.`status` = #{status}
+            </if>
+            <if test="email!=null and email!=''">
+                and der.email like concat(#{email},'%')
             </if>
             <if test="serial!=null and serial!=''">
                 and der.serial = #{serial}
@@ -46,7 +49,10 @@
                 and der.`c_id` = #{cId}
             </if>
             <if test="status!=null">
-                and der.`c_id` = #{status}
+                and der.`status` = #{status}
+            </if>
+            <if test="email!=null and email!=''">
+                and der.email like concat(#{email},'%')
             </if>
             <if test="serial!=null and serial!=''">
                 and der.serial = #{serial}

+ 1 - 2
crm-custom/src/main/resources/mapper/GoldenQuestionCustomMapper.xml

@@ -29,9 +29,8 @@
     </select>
 
     <select id="getCountQuestionByDate" resultType="integer">
-        select * from golden_question_custom
+        select count(1) from golden_question_custom
         where custom_id = #{customId} and add_time <![CDATA[ >= ]]> #{startDate} and add_time <![CDATA[ < ]]> #{endDate}
-        limit 1
     </select>
 
 </mapper>

+ 21 - 0
crm-model/src/main/java/com/crm/rely/backend/model/dto/golden/goods/GoldenCustomBalanceRecordListDto.java

@@ -0,0 +1,21 @@
+package com.crm.rely.backend.model.dto.golden.goods;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class GoldenCustomBalanceRecordListDto {
+
+    private Long cId;
+
+    private BigDecimal amount;
+
+    /**
+     * 1:取款 2:奖励
+     */
+    private Integer type;
+
+    private Date createTime;
+}

+ 2 - 0
crm-model/src/main/java/com/crm/rely/backend/model/dto/golden/order/GoldenOrderListDto.java

@@ -13,6 +13,8 @@ public class GoldenOrderListDto {
 
     private Long cId;
 
+    private String email;
+
     /**
      * 流水号
      */

+ 4 - 4
crm-model/src/main/java/com/crm/rely/backend/model/entity/custom/info/CustomInfoRegisterEntity.java

@@ -19,8 +19,8 @@ import javax.validation.constraints.Pattern;
 @Data
 public class CustomInfoRegisterEntity extends BaseAddEntity {
 
-    @NotNull(message = CustomConstant.COUNTRY_NOT_NULL)
-    @NotBlank(message = CustomConstant.COUNTRY_NOT_NULL)
+    /*@NotNull(message = CustomConstant.COUNTRY_NOT_NULL)
+    @NotBlank(message = CustomConstant.COUNTRY_NOT_NULL)*/
     private String country;
 
     @Pattern(regexp = RegexpConstants.REGEXP_PWD, message = Constants.PASSWORD_FORMAT_ERROR)
@@ -37,8 +37,8 @@ public class CustomInfoRegisterEntity extends BaseAddEntity {
     @NotBlank(message = Constants.EMAIL_CODE_NOT_NULL_ERROR)
     private String emailCode;
 
-    @NotNull(message = Constants.NAME_NOT_NULL)
-    @NotBlank(message = Constants.NAME_NOT_NULL)
+    /*@NotNull(message = Constants.NAME_NOT_NULL)
+    @NotBlank(message = Constants.NAME_NOT_NULL)*/
     private String name;
 
     /**

+ 2 - 0
crm-model/src/main/java/com/crm/rely/backend/model/entity/custom/info/CustomInfoUpdateEntity.java

@@ -16,6 +16,8 @@ public class CustomInfoUpdateEntity {
 
     private Long id;
 
+    private String name;
+
     private String firstName;
 
     private String middle;

+ 15 - 0
crm-model/src/main/java/com/crm/rely/backend/model/entity/golden/order/GoldenBalanceSearchEntity.java

@@ -0,0 +1,15 @@
+package com.crm.rely.backend.model.entity.golden.order;
+
+import com.crm.rely.backend.core.entity.base.BaseSearchPageEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class GoldenBalanceSearchEntity extends BaseSearchPageEntity {
+
+    private Long cId;
+
+    private Long customId;
+
+}

+ 2 - 0
crm-model/src/main/java/com/crm/rely/backend/model/entity/golden/order/GoldenOrderSearchEntity.java

@@ -14,6 +14,8 @@ public class GoldenOrderSearchEntity extends BaseSearchPageEntity {
 
     private Long cId;
 
+    private String email;
+
     /**
      * 1:未支付 2:已支付 3:支付失败 4:已过期 5:已取消
      */

+ 27 - 0
crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenCustomBalanceRecordTable.java

@@ -0,0 +1,27 @@
+package com.crm.rely.backend.model.pojo.table;
+
+import com.crm.rely.backend.core.pojo.BaseTable;
+import lombok.Data;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@Entity
+@Table(name = "golden_custom_balance_record")
+public class GoldenCustomBalanceRecordTable extends BaseTable {
+
+    private Long customId;
+
+    private Long cId;
+
+    private BigDecimal amount;
+
+    /**
+     * 1:取款 2:奖励
+     */
+    private Integer type;
+
+}

+ 2 - 0
crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenOrderTable.java

@@ -22,6 +22,8 @@ public class GoldenOrderTable extends BaseTable {
 
     private Long cId;
 
+    private String email;
+
     private BigDecimal amount;
 
     private String currency;

+ 4 - 0
crm-model/src/main/java/com/crm/rely/backend/model/pojo/table/GoldenQuestionCustomTable.java

@@ -30,4 +30,8 @@ public class GoldenQuestionCustomTable extends BaseTable {
      */
     private Integer customAnswer;
 
+    /**
+     * 是否正确 0:否 1:是
+     */
+    private Integer customRight;
 }

+ 1 - 1
crm-pay/src/main/java/com/crm/pay/controller/FinanceWithdrawController.java

@@ -125,7 +125,7 @@ public class FinanceWithdrawController {
 
         entity.setEmail(infoEntity.getEmail());
 
-        financeWithdrawService.applyDigitalWithdrawValidateCode(entity);
+        //financeWithdrawService.applyDigitalWithdrawValidateCode(entity);
 
         entity.setCId(infoEntity.getCId());
         entity.setCustomId(infoEntity.getId());

+ 10 - 0
crm-pay/src/main/java/com/crm/pay/dao/repository/GoldenCustomBalanceRecordRepository.java

@@ -0,0 +1,10 @@
+package com.crm.pay.dao.repository;
+
+import com.crm.rely.backend.dao.repository.BaseRepository;
+import com.crm.rely.backend.model.pojo.table.GoldenCustomBalanceRecordTable;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface GoldenCustomBalanceRecordRepository extends BaseRepository<GoldenCustomBalanceRecordTable> {
+
+}

+ 2 - 2
crm-pay/src/main/java/com/crm/pay/entity/telegraphic/TelegraphicAddEntity.java

@@ -16,8 +16,8 @@ import java.math.BigDecimal;
 @Data
 public class TelegraphicAddEntity extends FinanceDepositParameterEntity {
 
-    @NotNull(message = Constants.PARAMETER_ERROR)
-    @NotBlank(message = Constants.PARAMETER_ERROR)
+    /*@NotNull(message = Constants.PARAMETER_ERROR)
+    @NotBlank(message = Constants.PARAMETER_ERROR)*/
     private String voucherUrl;
 
     private Long login;

+ 7 - 3
crm-pay/src/main/java/com/crm/pay/service/impl/FinanceDepositServiceImpl.java

@@ -327,19 +327,23 @@ public class FinanceDepositServiceImpl implements FinanceDepositService {
         //保存订单信息
         financeDepositRepository.save(financeDepositTable);
 
-        GoldenOrderTable order = saveGoldenOrder(balanceSaveEntity, goodsTables, financeDepositTable);
+        GoldenOrderTable order = saveGoldenOrder(balanceSaveEntity, goodsTables, financeDepositTable, customInfoTable);
 
-        mqSendService.send(PayConstants.ORDER_DEPOSIT_EXPIRE, order, channel.getExpire() * 1000);
+        if(channel.getExpire() != null){
+            mqSendService.send(PayConstants.ORDER_DEPOSIT_EXPIRE, order, channel.getExpire() * 1000);
+        }
 
         return financeDepositTable;
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public GoldenOrderTable saveGoldenOrder(FinanceDepositAddEntity balanceSaveEntity, List<GoldenGoodsTable> goodsTables,FinanceDepositTable financeDepositTable){
+    public GoldenOrderTable saveGoldenOrder(FinanceDepositAddEntity balanceSaveEntity, List<GoldenGoodsTable> goodsTables
+            ,FinanceDepositTable financeDepositTable, CustomInfoTable customInfoTable){
         GoldenOrderTable order = new GoldenOrderTable();
         order.setSerial(financeDepositTable.getSerial());
         order.setCustomId(financeDepositTable.getCustomId());
         order.setCId(financeDepositTable.getCId());
+        order.setEmail(customInfoTable.getEmail());
         order.setAmount(financeDepositTable.getAmount());
         order.setCurrency(financeDepositTable.getCurrency());
         order.setTransformAmount(financeDepositTable.getTransformAmount());

+ 12 - 4
crm-pay/src/main/java/com/crm/pay/service/impl/FinanceWithdrawServiceImpl.java

@@ -19,10 +19,7 @@ import com.crm.rely.backend.model.constant.EmailTemplateConstants;
 import com.crm.rely.backend.model.constant.PayConstants;
 import com.crm.rely.backend.model.dto.finance.withdraw.FinanceWithdrawDto;
 import com.crm.rely.backend.model.entity.finance.withdraw.*;
-import com.crm.rely.backend.model.pojo.table.CustomInfoTable;
-import com.crm.rely.backend.model.pojo.table.FinanceWithdrawTable;
-import com.crm.rely.backend.model.pojo.table.SysChannelBankTable;
-import com.crm.rely.backend.model.pojo.table.SysRemitChannelTable;
+import com.crm.rely.backend.model.pojo.table.*;
 import com.crm.rely.backend.model.pojo.view.FinanceWithdrawView;
 import com.crm.rely.backend.service.EmailService;
 import com.crm.rely.backend.service.MqSendService;
@@ -96,6 +93,8 @@ public class FinanceWithdrawServiceImpl implements FinanceWithdrawService {
     private FlashPayService flashPayService;
     @Autowired
     private PartnerPayService partnerPayService;
+    @Autowired
+    private GoldenCustomBalanceRecordRepository customBalanceRecordRepository;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -433,6 +432,15 @@ public class FinanceWithdrawServiceImpl implements FinanceWithdrawService {
             financeWithdrawTable.setStatus(PayConstants.REJECTED_STATUS);
         } else if (PayConstants.CALLBACE_SUCCESS_STATUS.equals(entity.getCallbackStatus())) {
             financeWithdrawTable.setStatus(PayConstants.MANAGER_COMPLETED_STATUS);
+
+            GoldenCustomBalanceRecordTable record = new GoldenCustomBalanceRecordTable();
+            record.setCustomId(financeWithdrawTable.getId());
+            record.setCId(financeWithdrawTable.getCId());
+            record.setAmount(financeWithdrawTable.getAmount());
+            record.setType(1);
+            record.setAddTime(new Date());
+            customBalanceRecordRepository.save(record);
+
         }
         financeWithdrawTable.setCallbackTime(new Date());
         financeWithdrawRepository.save(financeWithdrawTable);