浏览代码

新增项目回款导出

wucl 2 年之前
父节点
当前提交
e131c27bfb

+ 15 - 0
biz-base/src/main/java/com/dayou/controller/PaymentCollectionController.java

@@ -2,6 +2,8 @@ package com.dayou.controller;
 
 import com.dayou.annotation.DataPermission;
 import com.dayou.annotation.OperLog;
+import com.dayou.dto.CustomerDTO;
+import com.dayou.dto.PaymentExportDTO;
 import com.dayou.vo.ItemPaymentVO;
 import com.dayou.vo.PaymentCollectionVO;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -20,12 +22,15 @@ import com.dayou.common.PullDownModel;
 import com.dayou.utils.ConvertUtil;
 import com.dayou.utils.HttpKit;
 import com.dayou.exception.ErrorCode;
+
+import java.io.IOException;
 import java.util.Date;
 import java.util.List;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.http.MediaType;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.xml.crypto.dsig.keyinfo.RetrievalMethod;
 
 import static com.dayou.common.Constants.MANAGER_OFFICE;
@@ -116,5 +121,15 @@ public class PaymentCollectionController extends BaseController {
         IPage<ItemPaymentVO> result = paymentCollectionService.getItemPayment(page,paymentCollectionVO);
         return RestResponse.data(result);
     }
+
+    /**
+     * 项目回款导出
+     */
+    @DataPermission(teamData = true,postChild = false,ignoreDepartment = {MANAGER_OFFICE})
+    @GetMapping("/item/export")
+    public void exportData(PaymentCollectionVO paymentCollectionVO, HttpServletResponse response ) throws IOException {
+        List<PaymentExportDTO> list = paymentCollectionService.getList(paymentCollectionVO);
+        exportPlus(response,"项目回款",list,PaymentExportDTO.class);
+    }
 }
 

+ 3 - 0
dao/src/main/java/com/dayou/mapper/PaymentCollectionMapper.java

@@ -3,6 +3,7 @@ package com.dayou.mapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.dayou.dto.PaymentDetailDTO;
+import com.dayou.dto.PaymentExportDTO;
 import com.dayou.entity.PaymentCollection;
 import com.dayou.dao.CustomBaseMapper;
 import com.dayou.vo.ItemPaymentVO;
@@ -29,4 +30,6 @@ public interface PaymentCollectionMapper extends CustomBaseMapper<PaymentCollect
     PaymentCollection getDeleted(@Param("id") Long id);
 
     List<PaymentDetailDTO> getPaymentDetailListByItemId(@Param("itemId") Long itemId ,@Param("userId") Long userId);
+
+    List<PaymentExportDTO> getList(@Param("dto") PaymentCollectionVO paymentCollectionVO);
 }

+ 23 - 16
dao/src/main/resources/mapper/PaymentCollectionMapper.xml

@@ -58,24 +58,24 @@
         </if>
         order by pc.payment_date DESC
     </select>
-    <select id="getItemPayment" parameterType="com.dayou.vo.PaymentCollectionVO" resultType="com.dayou.vo.ItemPaymentVO">
+    <sql id="itemPaymentList">
         SELECT
-            i.id,
-            i.business_no,
-            i.oa_no,
-            i.NAME,
-            i.client_unit,
-            u.name as client_manager,
-            i.sign_date,
-            i.amount,
-            ifnull(( SELECT sum( amount ) FROM payment_collection WHERE item_id = i.id AND deleted = 0 ), 0 ) AS payedAmount,
-            (
-                    i.amount -(
-                    ifnull(( SELECT sum( amount ) FROM payment_collection WHERE item_id = i.id AND deleted = 0 ), 0 ))) AS NotPayedAmount
+        i.id,
+        i.business_no,
+        i.oa_no,
+        i.NAME,
+        i.client_unit,
+        u.name as client_manager,
+        i.sign_date,
+        i.amount,
+        ifnull(( SELECT sum( amount ) FROM payment_collection WHERE item_id = i.id AND deleted = 0 ), 0 ) AS payedAmount,
+        (
+        i.amount -(
+        ifnull(( SELECT sum( amount ) FROM payment_collection WHERE item_id = i.id AND deleted = 0 ), 0 ))) AS NotPayedAmount
         FROM
-            item i left join user u on u.id = i.user_id
+        item i left join user u on u.id = i.user_id
         WHERE
-            i.deleted =0
+        i.deleted =0
         <if test="dto!=null and dto.itemName!=null and dto.itemName!=''">
             and i.name like concat ('%',#{dto.itemName},'%')
         </if>
@@ -85,7 +85,10 @@
                 #{userId}
             </foreach>
         </if>
-order by i.id DESC
+        order by i.id DESC
+    </sql>
+    <select id="getItemPayment" parameterType="com.dayou.vo.PaymentCollectionVO" resultType="com.dayou.vo.ItemPaymentVO">
+        <include refid="itemPaymentList"/>
     </select>
 
     <select id="getDeleted" parameterType="java.lang.Long" resultType="com.dayou.entity.PaymentCollection">
@@ -110,4 +113,8 @@ order by i.id DESC
         AND pc.deleted = 0
         AND i.deleted = 0
     </select>
+
+    <select id="getList" parameterType="com.dayou.vo.PaymentCollectionVO" resultType="com.dayou.dto.PaymentExportDTO">
+        <include refid="itemPaymentList"/>
+    </select>
 </mapper>

+ 72 - 0
domain/src/main/java/com/dayou/dto/PaymentExportDTO.java

@@ -0,0 +1,72 @@
+package com.dayou.dto;
+
+import com.dayou.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 类说明:
+ *
+ * @author: wucl
+ * @since: 2023/6/26
+ * created with IntelliJ IDEA.
+ */
+@Data
+public class PaymentExportDTO {
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称",width=40)
+    private String name;
+
+    /**
+     * 事业部流水号
+     */
+    @Excel(name = "事业部流水号")
+    private String businessNo;
+
+    /**
+     * 公司OA流水号(项目编号)
+     */
+    @Excel(name = "项目编号")
+    private String oaNo;
+
+    /**
+     * 客户经理
+     */
+    @Excel(name = "客户经理")
+    private String clientManager;
+
+    /**
+     * 委托单位
+     */
+    @Excel(name = "委托单位")
+    private String clientUnit;
+
+    /**
+     * 合同签订时间
+     */
+    @Excel(name = "签订时间")
+    private LocalDate signDate;
+
+    /**
+     * 合同金额
+     */
+    @Excel(name = "合同金额")
+    private BigDecimal amount;
+
+    /**
+     * 已回款
+     */
+    @Excel( name="已收款金额(元)")
+    private BigDecimal payedAmount;
+
+    /**
+     * 未回款
+     */
+    @Excel( name="未收款金额(元)")
+    private BigDecimal NotPayedAmount;
+}

+ 1 - 0
domain/src/main/java/com/dayou/vo/ItemPaymentVO.java

@@ -1,5 +1,6 @@
 package com.dayou.vo;
 
+import com.dayou.annotation.Excel;
 import com.dayou.entity.Item;
 import lombok.Data;
 

+ 7 - 10
service/src/main/java/com/dayou/brokerage/config/BrokerageSettleSchedule.java

@@ -30,8 +30,8 @@ public class BrokerageSettleSchedule {
     @Autowired
     private IItemBrokerageSequenceService itemBrokerageSequenceService;
 
+    //    @Scheduled(cron = "0 0/2 * * * ?")
     @Scheduled(cron = "59 59 23 23 * ?")
-//    @Scheduled(cron = "0 0/2 * * * ?")
     public void doBrokerageSettle(){
         AsyncManager.me().execute(new AsyncManager.BizHandler() {
             @Override
@@ -50,15 +50,12 @@ public class BrokerageSettleSchedule {
 
             @Override
             public Object doCustom() {
-                log.info("每月提成结算定时任务开始执行...");
-                log.info("非市场人员固定预提结算程序开始执行...");
-                if (itemBrokerageSequenceService.doNonMarketerAheadSettle()){
-                    log.info("非市场人员固定预提结算程序开始执行完成");
-                    log.info("立即执行市场人员结算程序...");
-                    if (itemBrokerageSequenceService.doAbleItemBrokerageSettle()){
-                        log.info("市场人员结算程序执行完成");
-                    }
-                }
+                log.info("市场人员结算程序开始执行...");
+                itemBrokerageSequenceService.doAbleItemBrokerageSettle();
+                log.info("市场人员结算程序执行完成");
+                log.info("技术人员默认预提结算程序开始执行...");
+                itemBrokerageSequenceService.doNonMarketerAheadSettle();
+                log.info("技术人员默认预提结算程序开始执行完成");
                 return null;
             }
         }, AsyncManager.AsyncLockStrategy.LOCK_BIZ, AsyncManager.AsyncBiz.BROKERAGE_SETTLE);

+ 3 - 0
service/src/main/java/com/dayou/service/IPaymentCollectionService.java

@@ -1,5 +1,6 @@
 package com.dayou.service;
 import com.dayou.dto.PaymentDetailDTO;
+import com.dayou.dto.PaymentExportDTO;
 import com.dayou.entity.PaymentCollection;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -35,4 +36,6 @@ public interface IPaymentCollectionService extends IService<PaymentCollection> {
     IPage<ItemPaymentVO> getItemPayment(Page page,PaymentCollectionVO paymentCollectionVO);
 
     List<PaymentDetailDTO> getPaymentDetailListByItemId(Long id,Long userId);
+
+    List<PaymentExportDTO> getList(PaymentCollectionVO paymentCollectionVO);
 }

+ 3 - 1
service/src/main/java/com/dayou/service/impl/ItemBrokerageGeneralServiceImpl.java

@@ -267,10 +267,12 @@ public class ItemBrokerageGeneralServiceImpl extends ServiceImpl<ItemBrokerageGe
     @Override
     public void changeManagerBrokerage(ItemDTO itemDTO) {
         ItemBrokerageGeneral general = brokerageGeneralMapper.getByItemId(itemDTO.getId());
-        iItemBrokerageDetailService.update(new LambdaUpdateWrapper<ItemBrokerageDetail>()
+        if (general!=null){
+            iItemBrokerageDetailService.update(new LambdaUpdateWrapper<ItemBrokerageDetail>()
                 .eq(ItemBrokerageDetail::getGeneralId, general.getId())
                 .eq(ItemBrokerageDetail::getBrokerageMode,BrokerageMode.PERSONAL.getCode())
                 .set(ItemBrokerageDetail::getUserId,itemDTO.getUserId()));
+        }
     }
 
     @Transactional

+ 0 - 1
service/src/main/java/com/dayou/service/impl/ItemBrokerageSequenceServiceImpl.java

@@ -145,7 +145,6 @@ public class ItemBrokerageSequenceServiceImpl extends ServiceImpl<ItemBrokerageS
     @Transactional
     @Override
     public synchronized Boolean doNonMarketerAheadSettle() {
-        //todo 一次性结算的项目生成 项目结算记录
         ConcurrentMap<Long, BigDecimal> nonMarketerAheadAmounts = baseAmountsCache.asMap();
         Date now = new Date();
         int year = DateUtils.getYear(now);

+ 0 - 1
service/src/main/java/com/dayou/service/impl/ItemServiceImpl.java

@@ -150,7 +150,6 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
         return list;
     }
 
-    @Transactional
     @DoBrokerage(operation = CHANGE,rule = BrokerageRule.LAND_MARKETER_RULE)
     @Override
     public Boolean changManager(ItemDTO itemDTO) {

+ 6 - 0
service/src/main/java/com/dayou/service/impl/PaymentCollectionServiceImpl.java

@@ -7,6 +7,7 @@ import com.dayou.brokerage.constants.BrokerageBusiness;
 import com.dayou.brokerage.constants.BrokerageRule;
 import com.dayou.common.BaseEntity;
 import com.dayou.dto.PaymentDetailDTO;
+import com.dayou.dto.PaymentExportDTO;
 import com.dayou.entity.PaymentCollection;
 import com.dayou.entity.UserTarget;
 import com.dayou.enums.OperationTypeEnum;
@@ -127,4 +128,9 @@ public class PaymentCollectionServiceImpl extends ServiceImpl<PaymentCollectionM
         return list;
     }
 
+    @Override
+    public List<PaymentExportDTO> getList(PaymentCollectionVO paymentCollectionVO) {
+        List<PaymentExportDTO> list = paymentCollectionMapper.getList(paymentCollectionVO);
+        return list;
+    }
 }