Browse Source

Merge remote-tracking branch 'origin/master'

sangwenwei 1 year ago
parent
commit
ac9411843b

+ 3 - 1
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/controller/CwFinanceInvoiceController.java

@@ -349,7 +349,9 @@ public class CwFinanceInvoiceController {
             page.setCurrent (0);
             result = cwFinanceInvoiceService.findList (page,cwFinanceInvoiceDTO,"export").getRecords();
         }
-        EasyPoiUtil.exportExcel ( result, sheetName,  sheetName, CwFinanceInvoiceDTO.class, fileName, response );
+        //对导出数据进行处理
+        List<CwFinanceInvoiceDTO> resultList = cwFinanceInvoiceService.disposeExportList(result);
+        EasyPoiUtil.exportExcel ( resultList, sheetName,  sheetName, CwFinanceInvoiceDTO.class, fileName, response );
 
     }
 

+ 41 - 2
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/mapper/xml/CwFinanceInvoiceMapper.xml

@@ -176,7 +176,7 @@
         fi.name,
         fi.receivables_type,
         fi.billing_content,
-        fi.account,
+        ifnull(fi.account,"0") as "account",
         fi.billing_content_terms,
         fi.billing_people,
         fi.billing_date,
@@ -293,6 +293,25 @@
                  when a.type = '2' then (select rpr.report_type from cw_project_records rpr where id = (select project_id from cw_project_report where id = a.program_id))
             else '' end
         ) as reportType,
+        (
+        case
+            when a.type = '0' then ("")
+            when a.type = '1' then (select rpr.project_classification from cw_project_records rpr where id = a.program_id)
+            when a.type = '2' then (select rpr.project_classification from cw_project_records rpr where id = (select project_id from cw_project_report where id = a.program_id))
+            else '' end
+        ) as projectClassification,
+        (
+        CASE WHEN a.type = '0' THEN ( "")
+        WHEN a.type = '1' THEN ( select GROUP_CONCAT(cprnlz.report_no) from cw_project_report cprz
+        left join cw_project_report_new_line cprnlz on cprz.id = cprnlz.report_id
+        left join cw_project_records cprsz on cprz.project_id= cprsz.id
+        where cprsz.id = a.program_id )
+        WHEN a.type = '2' THEN (
+        select cprnlz.report_no from cw_project_report cprz
+        left join cw_project_report_new_line cprnlz on cprz.id = cprnlz.report_id
+        where cprz.id = a.program_id) ELSE ''
+        END
+        ) AS reportNos,
         cfid.number as "number",
         cfid.account as "accountDetail",
         a.program_id,
@@ -312,6 +331,7 @@
 
 <select id="findExportList" resultMap="BaseExportResultMap">
         select DISTINCT a.id as 'baseId',
+    ifnull(a.account,"0") as "baseAccount",
         <include refid="Base_Column_List"></include>,
         su.name as operator,
         so.name as operator_office,
@@ -331,8 +351,27 @@
                  when a.type = '2' then (select rpr.report_type from cw_project_records rpr where id = (select project_id from cw_project_report where id = a.program_id))
             else '' end
         ) as reportType,
+    (
+    case
+    when a.type = '0' then ("")
+    when a.type = '1' then (select rpr.project_classification from cw_project_records rpr where id = a.program_id)
+    when a.type = '2' then (select rpr.project_classification from cw_project_records rpr where id = (select project_id from cw_project_report where id = a.program_id))
+    else '' end
+    ) as projectClassification,
+    (
+    CASE WHEN a.type = '0' THEN ( "")
+    WHEN a.type = '1' THEN ( select GROUP_CONCAT(cprnlz.report_no) from cw_project_report cprz
+    left join cw_project_report_new_line cprnlz on cprz.id = cprnlz.report_id
+    left join cw_project_records cprsz on cprz.project_id= cprsz.id
+    where cprsz.id = a.program_id )
+    WHEN a.type = '2' THEN (
+    select cprnlz.report_no from cw_project_report cprz
+    left join cw_project_report_new_line cprnlz on cprz.id = cprnlz.report_id
+    where cprz.id = a.program_id) ELSE ''
+    END
+    ) AS reportNos,
         cfid.number as "number",
-        cfid.account as "accountDetail",
+        ifnull(cfid.account,"0") as "accountDetail",
         a.program_id,
         a.type as 'recordType'
         from cw_finance_invoice_base a

+ 82 - 0
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/CwFinanceInvoiceService.java

@@ -37,6 +37,7 @@ import com.jeeplus.sys.feign.IWorkAttachmentApi;
 //import com.jeeplus.sys.service.UserService;
 import com.jeeplus.sys.service.dto.RoleDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
@@ -44,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -688,4 +690,84 @@ public class CwFinanceInvoiceService extends ServiceImpl<CwFinanceInvoiceMapper,
         }
         return new ArrayList<>();
     }
+
+    /**
+     * 对到处数据进行处理
+     * @param list
+     * @return
+     */
+    public List<CwFinanceInvoiceDTO> disposeExportList(List<CwFinanceInvoiceDTO> list){
+        List<CwFinanceInvoiceDTO> resultList = Lists.newArrayList();
+        //对数据进行分组
+        Map<String, List<CwFinanceInvoiceDTO>> temporaryListMap = dataMessageDispose(list);
+
+
+        for (String key : temporaryListMap.keySet()) {
+            List<CwFinanceInvoiceDTO> mapList = temporaryListMap.get(key);
+            if (mapList.size() <= 1) {
+                if (mapList.size() == 1 && (StringUtils.isBlank(mapList.get(0).getBaseAccount()) || "0".equals(mapList.get(0).getBaseAccount()))) {
+                    mapList.get(0).setBaseAccount(mapList.get(0).getAccount());
+                }
+                resultList.addAll(mapList);
+            }else{
+                Boolean flag = false;
+
+                for (CwFinanceInvoiceDTO invoiceDTO : mapList) {
+                    flag = true;
+                    if (!StringUtils.isBlank(invoiceDTO.getBaseAccount()) && !"0".equals(invoiceDTO.getBaseAccount())) {
+                        flag = false;
+                        break;
+                    }
+                }
+
+                if (flag) {
+                    mapList.get(0).setBaseAccount(mapList.get(0).getAccount());
+                } else {
+                    for (CwFinanceInvoiceDTO invoiceDTO : mapList) {
+                        BigDecimal accountB = new BigDecimal(invoiceDTO.getAccount());
+                        BigDecimal accountDetailB = new BigDecimal(invoiceDTO.getAccountDetail());
+                        BigDecimal baseAccountB = new BigDecimal(invoiceDTO.getBaseAccount());
+
+                        if((baseAccountB.compareTo(accountB) < 0 && baseAccountB.compareTo(accountDetailB) < 0)) {
+
+                        } else if (accountB.compareTo(accountDetailB) < 0) {
+                            invoiceDTO.setBaseAccount(invoiceDTO.getAccount());
+                        } else if(accountDetailB.compareTo(accountB) < 0){
+                            invoiceDTO.setBaseAccount(invoiceDTO.getAccountDetail());
+                        }
+                    }
+                }
+                resultList.addAll(mapList);
+            }
+        }
+
+        return resultList;
+    }
+
+    /**
+     * 分组
+     * @param list
+     * @return
+     */
+    private Map<String, List<CwFinanceInvoiceDTO>> dataMessageDispose(List<CwFinanceInvoiceDTO> list) {
+        Map<String, List<CwFinanceInvoiceDTO>> infoMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (CwFinanceInvoiceDTO vo : list) {
+                List<CwFinanceInvoiceDTO> tempList = infoMap.get(vo.getNo());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    infoMap.put(vo.getNo(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return infoMap;
+    }
+
 }

+ 12 - 4
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/invoice/service/dto/CwFinanceInvoiceDTO.java

@@ -35,6 +35,9 @@ public class CwFinanceInvoiceDTO extends BaseDTO {
     @Excel(name = "项目名称",width = 25)
     private String programName;
 
+    @Excel(name = "报告号",width = 25)
+    private String reportNos;
+
     /**
      * 实际开票单位
      */
@@ -65,12 +68,21 @@ public class CwFinanceInvoiceDTO extends BaseDTO {
     @Excel(name = "开票金额(元)",width = 16,type = 10)
     private String account;
 
+    @Excel(name = "项目开票金额(元)",width = 16,type = 10 )
+    private String baseAccount;
+
     /**
      * 发票金额(元)
      */
     @Excel(name = "发票金额(元)",width = 16,type = 10)
     private String accountDetail;
 
+    @Excel(name = "报备类型",width = 20,dict = "cw_work_client_report_type")
+    private String reportType;
+
+    @Excel(name = "项目分类", width = 20, dict = "project_classification")
+    private String projectClassification;
+
     /**
      * 开票内容
      */
@@ -316,10 +328,6 @@ public class CwFinanceInvoiceDTO extends BaseDTO {
      * 实际开票单位的开票信息id
      */
     private String billingId;
-    /**
-     * 报备类型(其他)
-     */
-    private String reportType;
 
 
     /**

+ 7 - 1
jeeplus-modules/jeeplus-finance/src/main/java/com/jeeplus/finance/projectReport/service/CwProjectReportService.java

@@ -634,7 +634,7 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
 
 
         long l1 = System.currentTimeMillis();
-        IPage<CwProjectReportData> list = reportMapper.findList(page,isBmzr, officeIds.toString(), queryWrapper);
+        IPage<CwProjectReportData> list = null;
         long l2 = System.currentTimeMillis();
         System.out.println("报告列表查询service方法消耗时间:" + (l2-l1));
 
@@ -645,9 +645,15 @@ public class CwProjectReportService extends ServiceImpl<CwProjectReportMapper, C
                 RoleDTO dtoById = SpringUtil.getBean(IRoleApi.class).getRoleDTOById(roleDTO.getId());
                 if ("szbgqzgzdb".equals(dtoById.getEnName())){
                     list = reportMapper.findList2(page,isBmzr, officeIds.toString(), queryWrapper);
+                    break;
                 }
             }
         }
+
+        if(null == list){
+            list = reportMapper.findList(page,isBmzr, officeIds.toString(), queryWrapper);
+        }
+
         List<UserDTO> allUserInfo = (List<UserDTO>) RedisUtils.getInstance().get(CacheNames.USER_CACHE_USER_ALL_INFO);
         if (null == allUserInfo || allUserInfo.size() == 0) {
             allUserInfo = SpringUtil.getBean(IUserApi.class).getAllUserInfo();

+ 1 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -1048,7 +1048,7 @@ public class UserController {
         UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
         for (RoleDTO roleDTO : currentUserDTO.getRoleDTOList()) {
             if (ObjectUtils.isNotEmpty(roleDTO)){
-                if ("zjbry".equals(roleDTO.getEnName())){
+                if ("zjbry".equals(roleDTO.getEnName()) || "zjbbx".equals(roleDTO.getEnName())){
                     return true;
                 }
             }

+ 1 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/UserMapper.java

@@ -262,6 +262,7 @@ public interface UserMapper extends BaseMapper <User> {
     @InterceptorIgnore(tenantLine = "true")
     String getMobileById(String id);
 
+    @InterceptorIgnore(tenantLine = "true")
     UserDTO getByLoginNameNoTen(@Param("loginName") String loginName);
 
     List<UserManageOffice> getManageOffices(@Param("id") String id);