zhangyuewww 2 년 전
부모
커밋
e456f13a8c

+ 9 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/IdentityAuthenticationInfoController.java

@@ -203,7 +203,15 @@ public class IdentityAuthenticationInfoController {
     public List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomer(IdentityAuthenticationInfo identityAuthenticationInfo) {
         return iIdentityAuthenticationInfoService.identityAuthenticationInfoCustomer(identityAuthenticationInfo);
     }
-
+    /**
+     * 自采客户下拉列表new
+     * @param identityAuthenticationInfo
+     * @return
+     */
+    @GetMapping("/identityAuthenticationInfoCustomerNew")
+    public List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomerNew(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        return iIdentityAuthenticationInfoService.identityAuthenticationInfoCustomerNew(identityAuthenticationInfo);
+    }
     /**
      * 送粮登记货主下拉列表
      * @param identityAuthenticationInfo

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/IdentityAuthenticationInfo.java

@@ -181,6 +181,11 @@ public class IdentityAuthenticationInfo extends BaseModel<IdentityAuthentication
      */
     @TableField(exist = false)
     private String inviteCompany;
+    /**
+     * 收购合同买方
+     */
+    @TableField(exist = false)
+    private String buyer;
 
     @Override
     protected Serializable pkVal() {

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/IdentityAuthenticationInfoMapper.java

@@ -39,4 +39,5 @@ public interface IdentityAuthenticationInfoMapper extends BaseMapper<IdentityAut
      */
     List<IdentityAuthenticationInfo> getIdentityInfoNotLimit(Map<String, Object> pageView);
 
+    List<IdentityAuthenticationInfo> getIdentityInfoNotLimitNew(Map<String, Object> pageView);
 }

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IIdentityAuthenticationInfoService.java

@@ -122,4 +122,5 @@ public interface IIdentityAuthenticationInfoService extends IService<IdentityAut
      */
     IdentityAuthenticationInfo getPayeeInfo(IdentityAuthenticationInfo identityAuthenticationInfo);
 
+    List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomerNew(IdentityAuthenticationInfo identityAuthenticationInfo);
 }

+ 34 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/IdentityAuthenticationInfoServiceImpl.java

@@ -692,5 +692,39 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
                 .eq("comp_id",identityAuthenticationInfo.getCompId()));
         return identityAuthenticationInfo1;
     }
+
+    @Override
+    public List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomerNew(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
+            identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
+        }
+        PurchasePrice purchasePrice=purchasePriceService.selectOne(new EntityWrapper<PurchasePrice>()
+                .eq("warehouse_id",identityAuthenticationInfo.getWarehouseId())
+                .eq("goods_name",identityAuthenticationInfo.getGoodsName())
+                .eq("status","已通过"));
+        if (purchasePrice==null){
+            throw new YException(YExceptionEnum.PURCHASE_PRICE_GOODSNAME_ERROR);
+        }
+        if (identityAuthenticationInfo.getGoodsName().contains("玉米")) {
+            identityAuthenticationInfo.setGoodsName("玉米");
+        }
+        Calendar cal = Calendar.getInstance();
+        int yearNum = cal.get(Calendar.YEAR);
+        int monthNum = cal.get(Calendar.MONTH) + 1;
+        int dayNum = cal.get(Calendar.DAY_OF_MONTH);
+        yearNum --;
+        String year = yearNum +"-"+monthNum+"-"+dayNum+" 00:00:00";
+        //公司id
+        pageView.put("compId", identityAuthenticationInfo.getCompId());
+        pageView.put("authenticationStatusKey", "7");
+        pageView.put("year", year);
+        pageView.put("buyer", identityAuthenticationInfo.getBuyer());
+        pageView.put("goodsName",identityAuthenticationInfo.getGoodsName());
+        pageView.put("saleLimit", purchasePrice.getSaleLimit()*1000);
+        pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
+        List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoNotLimitNew(pageView);
+        return dataList;
+    }
 }
 

+ 69 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/IdentityAuthenticationInfoMapper.xml

@@ -141,4 +141,73 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+    <select id="getIdentityInfoNotLimitNew" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo">
+        SELECT * FROM (
+        SELECT
+        a.id as id,
+        a.customer_name as customerName,
+        a.customer_phone as customerPhone,
+        a.bank_card as bankCard,
+        a.bank_deposit as bankDeposit,
+        a.bank_deposit_branch as bankDepositBranch,
+        a.payee_name as payeeName,
+        a.village_committee_phone as villageCommitteePhone,
+        a.payee_number_card as payeeNumberCard,
+        a.authentication_status_key as authenticationStatusKey,
+        case when a.delete_flag = '1' then '已删除'
+        when a.cover = '1' then '已覆盖'
+        else a.authentication_status end as authenticationStatus,
+        a.cover ,
+        a.customer_number_card as customerNumberCard,
+        a.payee_address_url as payeeAddressUrl,
+        a.card_address_url as cardAddressUrl,
+        a.comp_id as compId,
+        a.supplier,
+        --         (SELECT IFNULL(sum(case when p.type ='潮粮' then p.pure_weight else p.net_weight end),0)
+        (SELECT IFNULL(sum(case when p.type ='潮粮' then p.net_weight else p.net_weight end),0)
+        FROM payment_management p
+        WHERE p.delete_flag = '0'
+        AND p.customer_number_card = a.customer_number_card
+        AND p.goods_name like CONCAT('%', #{goodsName},'%')
+        AND (DATE_FORMAT(p.create_date,"%Y%m%d") >=
+        DATE_FORMAT(#{year},"%Y%m%d"))
+        AND p.comp_id = b.com_id) as num
+        FROM identity_authentication_info a
+        left join
+        common_company_identity b
+        on
+        a.id = b.identity_id
+        and b.com_id=#{compId}
+        WHERE
+        a.customer_type_flag = '1'
+        and b.delete_flag = '0'
+        and a.cover=0
+        and a.delete_flag = '0'
+        and not exists (SELECT 1
+        FROM payment_management pm
+        LEFT JOIN contract_management_info cmi on cmi.contract_no=pm.contract_no and cmi.comp_id=pm.comp_id and cmi.delete_flag=0
+        WHERE pm.delete_flag = '0'
+        AND cmi.buyer != #{buyer}
+        AND (DATE_FORMAT(pm.create_date,"%Y%m%d") >=
+        DATE_FORMAT(#{year},"%Y%m%d"))
+        AND pm.comp_id = b.com_id
+        AND pm.customer_number_card = a.customer_number_card)
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(a.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.customer_phone) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.supplier) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        <if test="authenticationStatusKey != null and authenticationStatusKey != ''">
+            and a.authentication_status_key=#{authenticationStatusKey}
+        </if>
+        group by
+        a.id
+        ORDER BY a.update_date DESC
+        )
+        tt where tt.num + 50000 &lt; #{saleLimit}
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>