Explorar el Código

Merge branch 'master' of http://47.108.172.52:3000/dayou/item-management-1phase

GouGengquan hace 1 mes
padre
commit
f2eb559b1d

+ 9 - 0
biz-base/src/main/java/com/dayou/controller/FinanceFineController.java

@@ -80,6 +80,15 @@ public class FinanceFineController extends BaseController {
     }
 
     /**
+     * 确认罚款金额
+     * @return Boolean
+     */
+    @PutMapping("/confirm/{id}")
+    public RestResponse<Boolean> confirmFineAmount(@PathVariable Long id) {
+        return RestResponse.data(financeFineService.confirmFineAmount(id));
+    }
+
+    /**
      * 批量取消确认罚款金额
      * @return Boolean
      */

+ 6 - 0
dao/src/main/java/com/dayou/mapper/FinanceFineMapper.java

@@ -85,4 +85,10 @@ public interface FinanceFineMapper extends CustomBaseMapper<FinanceFine> {
      */
     FinanceFine getFineByFundInfo(@Param("orderFundId") Long orderFundId, @Param("productionFundId") Long productionFundId);
 
+    /**
+     * 确认罚款
+     * @param id
+     * @return
+     */
+    Boolean confirmFineAmount(@Param("id") Long id);
 }

+ 2 - 0
dao/src/main/java/com/dayou/mapper/FinanceInvoiceMapper.java

@@ -40,4 +40,6 @@ public interface FinanceInvoiceMapper extends CustomBaseMapper<FinanceInvoice> {
      * @return String
      */
     String getInvoiceNoByFundId(@Param("orderFundId") Long orderFundId, @Param("productionFundId") Long productionFundId);
+
+    List<FinanceInvoice> getList(@Param("orderFundId") Long id, @Param("productionFundId") Long productionFundId);
 }

+ 18 - 5
dao/src/main/resources/mapper/FinanceFineMapper.xml

@@ -67,7 +67,7 @@
         fine.fine_amount AS fineAmount,
         fine.real_fine_amount AS realFineAmount,
         fine.status AS status,
-        fine.created AS punishDate,
+        fine.confirm_date AS punishDate,
         fine.`explain` AS `explain`,
         refund.id AS refundId
         FROM finance_fine AS fine
@@ -126,6 +126,7 @@
         <if test="dto != null and dto.startPunishDate != null and dto.endPunishDate!= null">
             AND fine.created BETWEEN #{dto.startPunishDate} AND #{dto.endPunishDate}
         </if>
+        order by fine.status DESC, fine.created DESC
     </sql>
 
     <!--分页查询超期罚款-->
@@ -141,8 +142,9 @@
     <!--确认罚款金额-->
     <update id="cancelFineAmount">
         UPDATE finance_fine
-        SET real_fine_amount = fine_amount,
-            status = 0
+        SET
+            status = 0,
+            confirm_date = null
         WHERE deleted = 0
         AND id = #{id}
     </update>
@@ -150,8 +152,9 @@
     <!--根据id批量确认罚款金额-->
     <update id="batchCancelFineAmount">
         UPDATE finance_fine
-        SET real_fine_amount = fine_amount,
-            status = 0
+        SET
+            status = 0,
+            confirm_date = null
         WHERE deleted = 0
         AND id IN
         <foreach collection="ids" open="(" close=")" separator="," item="id">
@@ -286,4 +289,14 @@
         </if>
     </select>
 
+    <update id="confirmFineAmount">
+        UPDATE finance_fine
+        SET
+            real_fine_amount = fine_amount,
+            status = 1,
+            confirm_date = now()
+        WHERE deleted = 0
+          AND id = #{id}
+    </update>
+
 </mapper>

+ 11 - 0
dao/src/main/resources/mapper/FinanceInvoiceMapper.xml

@@ -235,4 +235,15 @@
               AND finance_invoice.production_fund_id = #{productionFundId}
           </if>
     </select>
+
+    <select id="getList" resultType="com.dayou.entity.FinanceInvoice">
+        select * from finance_invoice where deleted = 0 and order_fund_id = #{orderFundId}
+        <if test="productionFundId!=null">
+            and production_fund_id = #{productionFundId}
+        </if>
+        <if test="productionFundId == null">
+            and production_fund_id is null
+        </if>
+        order by created DESC
+    </select>
 </mapper>

+ 1 - 3
dao/src/main/resources/mapper/MajorProductionMapper.xml

@@ -373,7 +373,7 @@
             pf.id as productionFundId,
             pf.real_amount,
             pf.production_should_amount as shouldAmount,
-            fi.invoiceAmount,
+            (select sum(real_amount) from finance_invoice where state = '已开票' and deleted =0 and  order_fund_id = orf.id and if(production_fund_id is null,1=1,production_fund_id = pf.id)) as invoiceAmount,
             mp.delivery,
             mp.delivery_date,
             (case mp.repertory_state when 0 then '已入库' when 1 then '已出库' else '未入库' end ) repertoryState,
@@ -389,8 +389,6 @@
                 left join customer_linkman cl on  cl.id = m.clientele_contact_id
                 left join (select * from order_fund where business_type ='MAJOR_BUSINESS' and deleted = 0) orf on orf.business_id = m.id
                 left join (select * from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) pf on (pf.business_id = m.id and pf.production_no = mp.report_no and mp.production = pf.production_type)
-                left join (select sum(real_amount) as invoiceAmount,order_fund_id,production_fund_id from finance_invoice where state='已开票' and deleted = 0 group by production_fund_id) fi on (fi.order_fund_id = orf.id and fi.production_fund_id = pf.id)
-
     </sql>
 
     <sql id="myOrderSql">

+ 1 - 0
dao/src/main/resources/mapper/PaymentCollectionMapper.xml

@@ -188,6 +188,7 @@
     <sql id="itemPaymentList">
         SELECT
         i.id,
+        i.belong_to,
         i.business_no,
         i.oa_no,
         i.NAME,

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

@@ -117,7 +117,7 @@ public class FinanceFineVO {
     /**
      * 是否确认
      */
-    @Excel(name = "是否确认", readConverterExp ="true=已确认,false=未确认")
+    @Excel(name = "是否确认", readConverterExp ="true=已确认,false=已取消")
     private Boolean status;
 
     /**

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

@@ -70,4 +70,10 @@ public interface IFinanceFineService extends IService<FinanceFine> {
      */
     FinanceFine getFineByFundInfo(Long orderFundId, Long productionFundId);
 
+    /**
+     * 确认罚款
+     * @param id
+     * @return
+     */
+    Boolean confirmFineAmount(Long id);
 }

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

@@ -322,7 +322,7 @@ public class FinanceClaimServiceImpl extends ServiceImpl<FinanceClaimMapper, Fin
                     .eq(BaseEntity::getDeleted, Boolean.FALSE)
                     .eq(OrderFund::getBusinessType,PERSONAL_BUSINESS.name()));
             if (orderFund==null){
-                Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().select(BaseEntity::getId, Personal::getLocation).eq(Personal::getOrderId, x.getOrderId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
+                Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().select(BaseEntity::getId, Personal::getLocation,Personal::getClientManagerId).eq(Personal::getOrderId, x.getOrderId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
                 if (personal!=null){
                     orderFund = new OrderFund();
                     orderFund.setOrderId(x.getOrderId());

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

@@ -265,4 +265,10 @@ public class FinanceFineServiceImpl extends ServiceImpl<FinanceFineMapper, Finan
         return financeFineMapper.getFineByFundInfo(orderFundId, productionFundId);
     }
 
+    @Override
+    public Boolean confirmFineAmount(Long id) {
+        return financeFineMapper.confirmFineAmount(id);
+    }
+
+
 }

+ 5 - 6
service/src/main/java/com/dayou/service/impl/FinanceInvoiceServiceImpl.java

@@ -123,11 +123,14 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
             orderFund.setOrderName(item.getName());
             String oaNo = item.getOaNo();
             if (StrUtil.isBlank(oaNo)){
-                ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"项目编号(大友OA编号不能为空)");
+                //ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"项目编号(大友OA编号不能为空)");
+                //如果没有大友OA流水号就用事业部流水号
+                oaNo = item.getBusinessNo();
             }
             orderFund.setOrderId(oaNo);
             orderFund.setBusinessId(item.getId());
             orderFund.setBusinessType(ITEM_BUSINESS.name());
+            orderFund.setClientManagerId(item.getUserId());
             orderFundService.add(orderFund);
             dto.setOrderFundId(orderFund.getId());
         }
@@ -163,11 +166,7 @@ public class FinanceInvoiceServiceImpl extends ServiceImpl<FinanceInvoiceMapper,
 
     @Override
     public List<FinanceInvoice> getList(Long id, Long productionFundId) {
-        List<FinanceInvoice> list = this.list(new LambdaQueryWrapper<FinanceInvoice>()
-                .eq(FinanceInvoice::getOrderFundId, id)
-                .eq(productionFundId!=null,FinanceInvoice::getProductionFundId, productionFundId)
-                .orderByDesc(BaseEntity::getCreated));
-        return list;
+        return financeInvoiceMapper.getList(id,productionFundId);
     }
 
     @Override

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

@@ -103,6 +103,7 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements II
         orderFund.setOrderId(itemDTO.getOaNo());
         orderFund.setBusinessId(itemDTO.getId());
         orderFund.setBusinessType(ITEM_BUSINESS.name());
+        orderFund.setClientManagerId(itemDTO.getUserId());
         orderFundService.add(orderFund);
         Set<Long> userIds = itemDTO.getUserIds();
         if (CollectionUtils.isNotEmpty(userIds)){

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

@@ -118,7 +118,7 @@ public class PaymentCollectionServiceImpl extends ServiceImpl<PaymentCollectionM
             OrderFund orderFund = new OrderFund();
             orderFund.setShouldAmount(item.getAmount());
             orderFund.setOrderName(item.getName());
-            orderFund.setOrderId(item.getOaNo());
+            orderFund.setOrderId(item.getOaNo()==null?item.getBusinessNo():item.getOaNo());
             orderFund.setBusinessId(item.getId());
             orderFund.setBusinessType(ITEM_BUSINESS.name());
             orderFundService.add(orderFund);

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

@@ -98,7 +98,7 @@ public class ProductionOutWarehouseServiceImpl extends ServiceImpl<ProductionOut
             Long businessId = productionOutWarehouse.getBusinessId();
             BigDecimal shouldAmount = productionOutWarehouse.getShouldAmount();
             OrderFund xOrderFund = orderFundService.getOne(new LambdaQueryWrapper<OrderFund>().eq(OrderFund::getBusinessType, PERSONAL_BUSINESS.name()).eq(OrderFund::getBusinessId, businessId).eq(BaseEntity::getDeleted, Boolean.FALSE));
-            Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().select(Personal::getOrderId, Personal::getLocation).eq(BaseEntity::getId, businessId).eq(BaseEntity::getDeleted, Boolean.FALSE));
+            Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().select(Personal::getOrderId, Personal::getLocation,Personal::getClientManagerId).eq(BaseEntity::getId, businessId).eq(BaseEntity::getDeleted, Boolean.FALSE));
             if (xOrderFund==null){
                 OrderFund orderFund = new OrderFund();
                 orderFund.setBusinessType(PERSONAL_BUSINESS.name());