zm
2024-07-25 19be4121c6c958109a2cb63267bf2e6b0af4476f
回款报表
已添加2个文件
已修改8个文件
284 ■■■■■ 文件已修改
src/main/java/com/product/contract/config/CmnConst.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/config/SystemCode.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/controller/ContractPaymentController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/controller/ProjectCommissionController.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/controller/ProjectInfoController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ContractInfoService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ContractInvoiceService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ContractPaymentService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ProjectCommissionService.java 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ProjectInfoService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/config/CmnConst.java
@@ -3,7 +3,6 @@
public class CmnConst {
    //表名常量定义
    public static final String LX_PROJECT_INFO = "product_project_info";    //项目信息表
    public static final String LX_PROJECT_AWARDED = "product_project_awarded";    //中标项目任务表
    public static final String LX_PROJECT_PERFORMANCE_BOND = "product_project_performance_bond";    //履约保证金缴纳表
    public static final String LX_PROJECT_CONTRACT_INFO = "product_project_contract_info";    //合同信息表
@@ -16,7 +15,7 @@
    public static final String LX_PROJECT_CONTRACT_STAMP = "product_project_contract_stamp"; //合同盖章表
    public static final String LX_PROJECT_CONTRACT_TERMINATION = "product_project_contract_termination"; //合同终止表
    public static final String LX_PROJECT_CONTRACT_FILE = "product_project_contract_file"; //合同归档表
    public static final String PRODUCT_PROJECT_PERFORMANCE_COMMISSION="product_project_performance_commission";
    public static final String LX_PROJECT_TASK_ALLOCATION = "product_project_task_allocation"; //任务分配表
    public static final String LX_PROJECT_TASK_ALLOCATION_SUB = "product_project_task_allocation_sub"; //任务分配表
    public static final String LX_PROJECT_TASK_PROGRESS = "product_project_task_progress"; //任务进度表
@@ -35,5 +34,6 @@
    public static final String ORG_LEVEL_UUID="org_level_uuid";    //组织机构
    public static final String CPAGE = "cpage"; // é¡µæ•°
    public static final String PAGESIZE = "pagesize"; // æ¯é¡µæ¡æ•°
    public static final String PROJECT_UUID = "project_uuid";
}
src/main/java/com/product/contract/config/SystemCode.java
@@ -87,6 +87,7 @@
    SYSTEM_GET_TASK_PROGRESS_FAIL("获取任务进度详情失败", ModuleEnum.CONTRACT.getValue() + "045"),
    PROJECT_SCHEDULE_OPERATE_FAIL("项目进度信息操作失败:", ModuleEnum.CONTRACT.getValue() +"046"),
    PROJECT_SCHEDULE_SAVE_FAIL("项目进度保存失败", ModuleEnum.CONTRACT.getValue() +"047"),
    PROJECT_COMMOSSION_OPERATE_FAIL("项目提成操作失败:", ModuleEnum.CONTRACT.getValue() +"048"),
    ;
src/main/java/com/product/contract/controller/ContractPaymentController.java
@@ -220,6 +220,34 @@
        }
    }
    /**
     * å›žæ¬¾æŠ¥è¡¨
     * @param request
     * @return
     */
    @RequestMapping(value = "/report-forms/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String reportForms(HttpServletRequest request){
        try {
            // èŽ·å–å‚æ•°
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            DataTableEntity dt = contractPaymentService.paymentCollectionData();
            return OK_List(dt);
        } catch (BaseException e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_FIND_CONTRACT_PAYMENT_FAIL.getValue(),
                    SystemCode.SYSTEM_FIND_CONTRACT_PAYMENT_FAIL.getText());
        }
    }
}
src/main/java/com/product/contract/controller/ProjectCommissionController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.product.contract.controller;
import com.product.contract.config.CmnConst;
import com.product.contract.service.ProjectCommissionService;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
import com.product.module.sys.version.ApiVersion;
import com.product.contract.config.SystemCode;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * é¡¹ç›®ææˆ
 *
 */
@RequestMapping("/api/commission")
@RestController
public class ProjectCommissionController extends AbstractBaseController{
    @Autowired
    ProjectCommissionService projectCommissionService;
    /**
     *    é¡¹ç›®ææˆåˆ—表
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="/list-commission/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String listCommission(HttpServletRequest request, HttpServletResponse response) {
        try {
            //获取参数
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_PERFORMANCE_COMMISSION);
            return OK_List(projectCommissionService.listCommission(fse));
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return this.error(SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getValue(), SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getText()+e.getMessage());
        }
    }
    /**
     *    é¡¹ç›®ææˆè¯¦æƒ…
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="/find-commission/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String findCommission(HttpServletRequest request, HttpServletResponse response) {
        try {
            //获取参数
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_PERFORMANCE_COMMISSION);
            return OK_List(projectCommissionService.findCommission(fse.getUUID()));
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return this.error(SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getValue(), SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getText()+e.getMessage());
        }
    }
    /**
     *     èŽ·å–æœªææˆçš„é¡¹ç›®ä¿¡æ¯
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="/get-not-commission/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String findInvoiceInfo(HttpServletRequest request, HttpServletResponse response) {
        try {
            //获取参数
            FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, CmnConst.PRODUCT_PROJECT_PERFORMANCE_COMMISSION);
            return OK_List(projectCommissionService.getUnCommissionProject(fse.getString(CmnConst.PROJECT_UUID)));
        } catch (BaseException e) {
            e.printStackTrace();
            return error(e);
        } catch (Exception e) {
            e.printStackTrace();
            return this.error(SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getValue(), SystemCode.PROJECT_COMMOSSION_OPERATE_FAIL.getText()+e.getMessage());
        }
    }
}
src/main/java/com/product/contract/controller/ProjectInfoController.java
@@ -63,7 +63,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            // åˆ¤æ–­è¡¨åæ˜¯å¦æ­£å¸¸
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(),
                        SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
@@ -110,7 +110,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
@@ -152,7 +152,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //判断表名是否正常
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
@@ -200,7 +200,7 @@
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            // åˆ¤æ–­è¡¨åæ˜¯å¦æ­£å¸¸
            if (!CmnConst.LX_PROJECT_INFO.equals(fse.getTableName())) {
            if (!CmnConst.PRODUCT_PROJECT_BUSINESS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(),
                        SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
src/main/java/com/product/contract/service/ContractInfoService.java
@@ -139,7 +139,7 @@
     */
    public FieldSetEntity getContractInfoByName(FieldSetEntity fs) throws BaseException {
        FieldSetEntity fss = baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_INFO,fs.getUUID(),true);
        FieldSetEntity fsProject = baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_INFO,fss.getString("project_uuid"),false);
        FieldSetEntity fsProject = baseDao.getFieldSetEntity(CmnConst.PRODUCT_PROJECT_BUSINESS,fss.getString("project_uuid"),false);
        DataTableEntity dt = fss.getSubDataTable(CmnConst.LX_PROJECT_CONTRACT_INFO_SUB);
        FieldSetEntity fsub = null;
        int invoiced = 0;//已开票金额
@@ -188,7 +188,7 @@
        if(fss!=null){
            fsinvo = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_INVOICE,"contract_name=?",new Object[]{fss.getUUID()},true);
            fspaym = baseDao.getFieldSetEntityByFilter(CmnConst.LX_PROJECT_CONTRACT_PAYMENT,"contract_name=?",new Object[]{fss.getUUID()},true);
            dtproj = baseDao.listTable(CmnConst.LX_PROJECT_INFO," uuid=? ",new Object[]{fss.getString("project_uuid")});
            dtproj = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BUSINESS," uuid=? ",new Object[]{fss.getString("project_uuid")});
        }
        DataTableEntity dt = fss.getSubDataTable(CmnConst.LX_PROJECT_CONTRACT_INFO_SUB);
        FieldSetEntity fsub = null;
@@ -268,7 +268,7 @@
     */
    public String isAddContract(FieldSetEntity fs) throws BaseException {
        String uuid = fs.getUUID();
        DataTableEntity dataTableEntity = baseDao.listTable(" SELECT * FROM product_project_contract_info where flow_flag = 2 AND project_uuid = ? ", new String[]{uuid});
        DataTableEntity dataTableEntity = baseDao.listTable(" SELECT * FROM product_project_contract_info where   project_uuid = ? ", new String[]{uuid});
        if (BaseUtil.dataTableIsEmpty(dataTableEntity)) {
            return "0";
        } else {
src/main/java/com/product/contract/service/ContractInvoiceService.java
@@ -51,7 +51,7 @@
        if(fsinvo!=null){
            fcosub.setTableName(CmnConst.LX_PROJECT_CONTRACT_INFO_SUB);
            fcosub.setValue("uuid",fsinvo.getUUID());
            fcosub.setValue("invoiced",invoiced_amount);//已开票金额
            fcosub.setValue("invoice_amount",invoiced_amount);//已开票金额
            baseDao.update(fcosub);
        }
        if(StringUtils.isEmpty(fs.getString(CmnConst.UUID))){
src/main/java/com/product/contract/service/ContractPaymentService.java
@@ -110,5 +110,20 @@
        return baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_PAYMENT,fs.getUUID(),true);
    }
    /**
     * å›žæ¬¾æŠ¥è¡¨
     * @param fs
     * @return
     * @throws BaseException
     */
    public  DataTableEntity paymentCollectionData()throws BaseException{
       return baseDao.listTable("SELECT b.project_name,b.customer_name,a.contract_name,c.clause_content,d.invoice_num,e.apply_time,d.invoice_amount,f.collection_amount,f.collection_time FROM \n" +
                "product_project_contract_info a \n" +
                "LEFT JOIN product_project_business b on a.project_uuid=b.uuid\n" +
                "LEFT JOIN product_project_contract_info_sub c on a.uuid =c.contract_info_uuid\n" +
                "LEFT JOIN product_project_contract_invoice_info d  on c.uuid=d.contract_terms\n" +
                "LEFT JOIN product_project_contract_invoice e on e.uuid=d.contract_invoice_uuid\n" +
                "LEFT JOIN product_project_contract_payment_collection f on d.invoice_num=f.invoice_num");
    }
}
src/main/java/com/product/contract/service/ProjectCommissionService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,114 @@
package com.product.contract.service;
import com.product.contract.config.CmnConst;
import com.product.core.config.CoreConst;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.service.support.AbstractBaseService;
import com.product.core.service.support.QueryFilterService;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProjectCommissionService extends AbstractBaseService{
    @Autowired
    BaseDao baseDao;
    @Autowired
    QueryFilterService queryFilterService;
    /**
     *     é¡¹ç›®ææˆåˆ—表
     * @param fse
     * @return
     */
    public DataTableEntity listCommission(FieldSetEntity fse) {
        String filter = fse.getString("filter");
        String queryFilter = queryFilterService.getQueryFilter(fse);
        StringBuilder sb = new StringBuilder();
        sb.append("SELECT * FROM( \n");
        sb.append("SELECT A.*,B.project_number,B.project_name AS project_name_label,E.user_name AS apply_label \n");
        sb.append("FROM product_project_performance_commission A \n");
        sb.append("LEFT JOIN product_project_business B ON B.uuid = A.project_uuid \n");
        sb.append("LEFT JOIN product_sys_users E ON E.user_id = A.apply_user \n");
        sb.append("WHERE apply_user = ? \n");
        sb.append(" AND ").append(filter).append(" \n");
        sb.append(")A \n");
        if (!BaseUtil.strIsNull(queryFilter)) {
            sb.append("WHERE ").append(queryFilter).append(" \n");
        }
        sb.append("ORDER BY apply_time DESC");
        return baseDao.listTable(sb.toString(), new Object[] {SpringMVCContextHolder.getCurrentUserId()}, fse.getInteger(CoreConst.PAGESIZE), fse.getInteger(CoreConst.CPAGE));
    }
    /**
     *     é¡¹ç›®ææˆè¯¦æƒ…
     * @param uuid
     * @return
     */
    public FieldSetEntity findCommission(String uuid) {
        return baseDao.getFieldSetEntity(CmnConst.PRODUCT_PROJECT_PERFORMANCE_COMMISSION, uuid, true);
    }
    /**
     *
     * @return
     */
    public DataTableEntity getUnCommissionProject(String projectUUID) {
        StringBuilder sb = new StringBuilder();
        sb.append("SELECT * FROM ( \n");
        sb.append("  SELECT A.business_type,B.dict_label AS business_type_name,'1' AS project_role, project_leader AS project_user \n");
        sb.append("  FROM product_project_business_sub A \n");
        sb.append("  LEFT JOIN product_sys_dict B ON B.dict_value = A.business_type AND B.dict_name LIKE 'business_type_%' \n");
        sb.append("  WHERE project_uuid = ? \n");
        sb.append("  UNION ALL \n");
        sb.append("  SELECT A.business_type,B.dict_label AS business_type_name,'2' AS project_role, business_sponsor AS project_user \n");
        sb.append("  FROM product_project_business_sub A \n");
        sb.append("  LEFT JOIN product_sys_dict B ON B.dict_value = A.business_type AND B.dict_name LIKE 'business_type_%' \n");
        sb.append("  WHERE project_uuid = ? \n");
        sb.append(") A \n");
        sb.append("ORDER BY business_type");
        DataTableEntity dt = baseDao.listTable(sb.toString(), new Object[] {projectUUID, projectUUID});
        if (!BaseUtil.dataTableIsEmpty(dt)) {
            DataTableEntity dtNew = new DataTableEntity();
            for (int i = 0; i < dt.getRows(); i++) {
                FieldSetEntity fse = dt.getFieldSetEntity(i);
                String projectRole = fse.getString("project_role");
                String projectUser = fse.getString("project_user");
                if (BaseUtil.strIsNull(projectRole) || BaseUtil.strIsNull(projectUser)) {
                    continue;
                }
                if ("2".equals(projectRole)) {
                    if (projectUser.contains(",")) {
                        String [] userArray = projectUser.split(",");
                        for (int j = 0; j < userArray.length; j++) {
                            FieldSetEntity fseNew = fse.clones();
//                            FieldSetEntity fseStaff = OrganizationCacheService.getStaffCacheByUserIdStatic(userArray[j]);
//                            fseNew.setValue("project_user_name", fseStaff.getString("show_name"));
//                            fseNew.setValue("project_user", userArray[j]);
//                            fse.setValue("project_role_name", "项目组员");
                            dtNew.addFieldSetEntity(fseNew);
                        }
                    }else {
//                        FieldSetEntity fseStaff = OrganizationCacheService.getStaffCacheByUserIdStatic(projectUser);
//                        fse.setValue("project_user_name", fseStaff.getString("show_name"));
//                        fse.setValue("project_role_name", "项目组员");
//                        dtNew.addFieldSetEntity(fse);
                    }
                }else {
//                    FieldSetEntity fseStaff = OrganizationCacheService.getStaffCacheByUserIdStatic(projectUser);
//                    fse.setValue("project_user_name", fseStaff.getString("show_name"));
//                    fse.setValue("project_role_name", "项目组长");
//                    dtNew.addFieldSetEntity(fse);
                }
            }
            return dtNew;
        }
        return null;
    }
}
src/main/java/com/product/contract/service/ProjectInfoService.java
@@ -46,7 +46,7 @@
     * @throws BaseException
     */
    public FieldSetEntity getProjectInfo(FieldSetEntity fs) throws BaseException {
        return baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_INFO,fs.getUUID(),true);
        return baseDao.getFieldSetEntity(CmnConst.PRODUCT_PROJECT_BUSINESS,fs.getUUID(),true);
    }
    /** ä¿å­˜é¡¹ç›®ä¿¡æ¯
@@ -79,7 +79,7 @@
    public boolean deleteProjectInfo(FieldSetEntity fs) {
        String uuid = fs.getUUID();
        String[] uuids = uuid.split(",");
        return baseDao.delete(CmnConst.LX_PROJECT_INFO, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids);
        return baseDao.delete(CmnConst.PRODUCT_PROJECT_BUSINESS, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids);
    }
    /**
@@ -161,7 +161,7 @@
        }else {
            filter = filter  + " AND " + queryFilter;
        }
        DataTableEntity dt = baseDao.listTable(CmnConst.LX_PROJECT_INFO,filter,new Object[]{},null,null,fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE));
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_PROJECT_BUSINESS,filter,new Object[]{},null,null,fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE));
        baseDao.loadPromptData(dt);
        return dt;
    }