liusheng
2023-05-17 dd07c6da3fdb6c4adb9d167d015afc955ad412e1
数据插入分享表
已修改2个文件
197 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java 195 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -14,9 +14,11 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.HttpClientKit;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.*;
import com.ruoyi.project.mapper.ServiceFunddetailMapper;
import com.ruoyi.project.service.*;
import freemarker.template.Configuration;
import freemarker.template.Template;
@@ -43,13 +45,18 @@
@Api("费用申请主")
@RestController
@RequestMapping("/project/fund")
public class ServiceFundController extends BaseController
{
public class ServiceFundController extends BaseController {
    private static Configuration configuration = null;
    @Autowired
    private IServiceFundService serviceFundService;
    @Autowired
    private IServiceFundSharedService fundSharedService;
    @Autowired
    private ServiceFunddetailMapper serviceFunddetailMapper;
    @Autowired
    private IServiceFunddetailService serviceFunddetailService;
    @Autowired
    private IServiceFunddetailSharedService funddetailSharedService;
    @Autowired
    private IServiceFundflowruleService serviceFundflowruleService;
    @Autowired
@@ -78,8 +85,7 @@
    @ApiOperation("查询费用申请主列表")
    //@PreAuthorize("@ss.hasPermi('project:fund:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceFund serviceFund)
    {
    public TableDataInfo list(ServiceFund serviceFund) {
        startPage();
        //List<ServiceFund> list = serviceFundService.queryList(serviceFund);
        List<ServiceFund> list = serviceFundService.selectServiceFundList(serviceFund);
@@ -99,8 +105,7 @@
    @ApiOperation("根据权限显示审核列表")
    @Log(title = "根据权限显示审核列表", businessType = BusinessType.OTHER)
    @GetMapping("/listbypower")
    public TableDataInfo getListBypower(SpFinancialExpensesIn spFinancialExpensesIn)
    {
    public TableDataInfo getListBypower(SpFinancialExpensesIn spFinancialExpensesIn) {
        LoginUser loginUser = getLoginUser();
        String APPLICANT=spFinancialExpensesIn.getAPPLICANT();
@@ -111,28 +116,23 @@
        Integer pageNum=spFinancialExpensesIn.getPageNum();
        Integer pageSize=spFinancialExpensesIn.getPageSize();
        if(pageNum==null)
        {
        if (pageNum == null) {
            pageNum=1;
        }
        if(pageSize==null)
        {
        if (pageSize == null) {
            pageSize=10;
        }
        if(APPLICANT==null)
        {
        if (APPLICANT == null) {
            APPLICANT="";
        }
        if(APPLICATIONBEGTIME==null)
        {
        if (APPLICATIONBEGTIME == null) {
            APPLICATIONBEGTIME="";
        }
        if(APPLICATIONENDTIME==null)
        {
        if (APPLICATIONENDTIME == null) {
            APPLICATIONENDTIME="";
        }
@@ -145,8 +145,7 @@
    @ApiOperation("查询费用申请主列表")
    //@PreAuthorize("@ss.hasPermi('project:fund:list')")
    @GetMapping(value = "/getInfo/{infoid}")
    public AjaxResult getInfoByInfoId(@PathVariable("infoid") Long infoid)
    {
    public AjaxResult getInfoByInfoId(@PathVariable("infoid") Long infoid) {
        return AjaxResult.success(serviceFundService.getInfoByInfoId(infoid));
    }
@@ -173,13 +172,11 @@
    //@PreAuthorize("@ss.hasPermi('project:fund:export')")
    @Log(title = "费用申请主", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceFund serviceFund)
    {
    public AjaxResult export(ServiceFund serviceFund) {
        List<ServiceFund> list = serviceFundService.queryList(serviceFund);
        ExcelUtil<ServiceFund> util = new ExcelUtil<ServiceFund>(ServiceFund.class);
        return util.exportExcel(list, "费用申请主数据");
    }
    /**
@@ -188,8 +185,7 @@
    @ApiOperation("获取费用申请主详细信息")
    //@PreAuthorize("@ss.hasPermi('project:fund:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceFundService.getById(id));
    }
@@ -202,32 +198,26 @@
    @PostMapping
    @RepeatSubmit
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public AjaxResult add(@RequestBody ServiceFund serviceFund)
    {
    public AjaxResult add(@RequestBody ServiceFund serviceFund) {
        boolean b = serviceFundService.save(serviceFund);
        Long id = serviceFund.getId();
        if(b)
        {
        if (b) {
            addReiSharedDatd(serviceFund,1);
        }
        return AjaxResult.success(id);
    }
    public  int addReiSharedDatd(ServiceFund serviceFund,int nType)
    {
    public int addReiSharedDatd(ServiceFund serviceFund, int nType) {
        //remShare = ;
        ServiceFundShared remShare = null;
        if(nType == 1)
        {
        if (nType == 1) {
            remShare = new ServiceFundShared();
            remShare.setSerfunid(serviceFund.getId());
        }
        else //modify
        } else //modify
        {
            List<ServiceFundShared> remlist = fundServiceShare.getFundShareInfoById(serviceFund.getId());
            if(remlist!=null)
                remShare =remlist.get(0);
            if (remlist != null) remShare = remlist.get(0);
        }
        remShare.setDonorno(serviceFund.getDonorno());
@@ -310,12 +300,9 @@
        //remShare.setDonorno(serviceReimbursement.getDonorno());
        boolean bRet = false;
        if(nType==1)
        {
        if (nType == 1) {
            bRet = fundServiceShare.save(remShare);
        }
        else
        {
        } else {
            //remShare.setId(serviceReimbursement.);
            bRet = fundServiceShare.updateById(remShare);
        }
@@ -326,12 +313,9 @@
        if(strMutfileUrl == null) return 0;
        if(strMutfileUrl.isEmpty()) return 0;
        try
        {
        try {
            uploadOAFileAndUpdateDb(remShare);
        }
        catch (Exception e)
        {
        } catch (Exception e) {
            logger.error("调用第三方接口出错!");
            e.printStackTrace();
        }
@@ -342,8 +326,7 @@
    }
    int uploadOAFileAndUpdateDb(ServiceFundShared remShare)
    {
    int uploadOAFileAndUpdateDb(ServiceFundShared remShare) {
        //上传OA文件
        //String strUrl = "http://129.88.242.39:8899/seeyon/rest/token?userName=opo&password=127814f8-84e8-4304-84a5-a71573567efd&loginName=demo3";
        String strUrl = "http://129.88.242.39:8899/seeyon/rest/token";
@@ -390,20 +373,16 @@
        String fileid = "";
        String[] urlArray = strMutfileUrl.split(",");
        for (int i = 0; i < urlArray.length; i++)
        {
        for (int i = 0; i < urlArray.length; i++) {
            String strOneFileName = urlArray[i];
            String strTemp = strOneFileName.substring(15);
            String strFile = filePath  + strTemp ;
            //FileUploadUtils.getAbsoluteFile(filePath,strOneFileName);
            String struploadResult = "";
            File filetest = new File(strFile);
            try
            {
            try {
                struploadResult = HttpClientKit.sendPostWithFile(filetest,strFUrl);
            }
            catch (Exception e)
            {
            } catch (Exception e) {
                e.printStackTrace();
            }
@@ -415,15 +394,13 @@
            JSONObject jsonR = JSONObject.parseObject(struploadResult);
            JSONArray jsonArr = jsonR.getJSONArray("atts");
            for(int j=0;j<jsonArr.size();j++)
            {
            for (int j = 0; j < jsonArr.size(); j++) {
                JSONObject jsonRet = jsonArr.getJSONObject(j);
                String name1= jsonRet.get("filename").toString();
                String id1 = jsonRet.get("fileUrl").toString();
                filename+=name1;
                fileid+=id1;
                if(i!=urlArray.length-1)
                {
                if (i != urlArray.length - 1) {
                    filename+=",";
                    fileid+=",";
                }
@@ -449,12 +426,10 @@
    @PostMapping("/addnew")
    @RepeatSubmit
    @Options(useGeneratedKeys = true, keyProperty = "id")
    public AjaxResult addnew(@RequestBody ServiceFundVO serviceFundVO)
    {
    public AjaxResult addnew(@RequestBody ServiceFundVO serviceFundVO) {
        boolean b = serviceFundService.save(serviceFundVO);
        Long id = serviceFundVO.getId();
        if(b)
        {
        if (b) {
            addReiSharedDatd(serviceFundVO,1);
        }
        List<ServiceFunddetail> serviceFunddetails=serviceFundVO.getServiceFunddetails();
@@ -469,11 +444,9 @@
    @ApiOperation("审核费用")
    @Log(title = "审核费用", businessType = BusinessType.OTHER)
    @PostMapping("/checkfund")
    public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO)
        {
    public AjaxResult checkFund(@RequestBody CheckFundVO checkFundVO) {
            ServiceFund serviceFund= serviceFundService.getById(checkFundVO.getFundid());
            if(serviceFund!=null)
            {
        if (serviceFund != null) {
                Integer TotalLevel=0;
                LoginUser loginUser = getLoginUser();
                ServiceFundflowrule serviceFundflowrule=new ServiceFundflowrule();
@@ -482,18 +455,15 @@
                serviceFundflowrule.setCheckuserno(loginUser.getUsername());
                List<ServiceFundflowrule> serviceFundflowrules= serviceFundflowruleService.queryList(serviceFundflowrule);
                if(serviceFundflowrules==null || serviceFundflowrules.stream().count()==0)
                {
            if (serviceFundflowrules == null || serviceFundflowrules.stream().count() == 0) {
                    return AjaxResult.error(HttpStatus.ERROR,"当前人员无此记录审核权限");
                }
                if(serviceFundflowrules.get(0).getFlowlevel()-1!=serviceFund.getFlowlevel())
                {
            if (serviceFundflowrules.get(0).getFlowlevel() - 1 != serviceFund.getFlowlevel()) {
                    return AjaxResult.error(HttpStatus.ERROR,"当前人员与此记录的审核级别不符");
                }
                if(serviceFundflowrules!=null && serviceFundflowrules.stream().count()>0)
                {
            if (serviceFundflowrules != null && serviceFundflowrules.stream().count() > 0) {
                    TotalLevel=serviceFundflowrules.get(0).getTotallevel();
                }
@@ -501,33 +471,23 @@
                Integer RecordStatus=serviceFund.getRecordstatus();
                Integer FlowLevel=serviceFund.getFlowlevel();
                Integer OriginalFlowLevel=FlowLevel;
                if(checkFundVO.getFlowconclusion()==1)
                {
            if (checkFundVO.getFlowconclusion() == 1) {
                    CheckFlag=1;
                    if(TotalLevel==0)
                    {
                if (TotalLevel == 0) {
                        RecordStatus=99;
                    }
                    else
                    {
                        if(TotalLevel==FlowLevel+1)
                        {
                } else {
                    if (TotalLevel == FlowLevel + 1) {
                            RecordStatus=99;
                        }
                        else
                        {
                    } else {
                            RecordStatus = (FlowLevel+1)*2;
                        }
                    }
                    FlowLevel=FlowLevel+1;
                }
                else
                {
            } else {
                    CheckFlag=2;
                    RecordStatus = (FlowLevel+1)*2 - 1;
                    FlowLevel=(FlowLevel-1);
                    if(FlowLevel<0)
                    {
                if (FlowLevel < 0) {
                        FlowLevel=0;
                    }
                }
@@ -559,23 +519,50 @@
                serviceSystemmessage.setMessagetype(1);
                serviceSystemmessage.setRelevantno(serviceFund.getId());
                if(CheckFlag==1)
                {
            if (CheckFlag == 1) {
                    //通过
                    serviceSystemmessage.setMessagetitle(""+(OriginalFlowLevel+1)+"级审核通过");
                    serviceSystemmessage.setMessagecontent("您"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime())+"提交的关于捐献案例【"+serviceFund.getDonorname()+"】的费用申请已通过"+(OriginalFlowLevel+1)+"级审核");
                if (TotalLevel == OriginalFlowLevel + 1) {
                    ServiceFundShared serviceFundShared = DtoConversionUtils.sourceToTarget(serviceFund, ServiceFundShared.class);
                    serviceFundShared.setId(null);
                    serviceFundShared.setAmountrequested(new BigDecimal(serviceFund.getAmountrequested()));
                    serviceFundShared.setPrepaidamount(new BigDecimal(serviceFund.getPrepaidamount()));
                    serviceFundShared.setTotalcost(new BigDecimal(serviceFund.getTotalcost()));
                    serviceFundShared.setProcurementcost(new BigDecimal(serviceFund.getProcurementcost()));
                    serviceFundShared.setExpertcost(new BigDecimal(serviceFund.getExpertcost()));
                    serviceFundShared.setEthicscost(new BigDecimal(serviceFund.getEthicscost()));
                    serviceFundShared.setMedicalcost(new BigDecimal(serviceFund.getMedicalcost()));
                    serviceFundShared.setFamilycost(new BigDecimal(serviceFund.getFamilycost()));
                    serviceFundShared.setAftercarecost(new BigDecimal(serviceFund.getAftercarecost()));
                    fundSharedService.save(serviceFundShared);
                    Map<String, Object> columnMap = new HashMap<>();
                    columnMap.put("fundID", checkFundVO.getFundid());
                    //获取详情数据
                    List<ServiceFunddetail> serviceFunddetails = serviceFunddetailMapper.selectByMap(columnMap);
                    List<ServiceFunddetailShared> serviceFunddetailShareds = DtoConversionUtils.sourceToTarget(serviceFunddetails, ServiceFunddetailShared.class);
                    for (int i = 0; i < serviceFunddetails.size(); i++) {
                        serviceFunddetailShareds.get(i).setFundid(serviceFunddetails.get(i).getFundid());
                        serviceFunddetailShareds.get(i).setAmount(new BigDecimal(serviceFunddetails.get(i).getAmount()));
                        serviceFunddetailShareds.get(i).setPrepaidamount(new BigDecimal(serviceFunddetails.get(i).getPrepaidamount()));
                        serviceFunddetailShareds.get(i).setTaxamount(new BigDecimal(serviceFunddetails.get(i).getTaxamount()));
                        serviceFunddetailShareds.get(i).setTaxedamount(new BigDecimal(serviceFunddetails.get(i).getTaxedamount()));
                        serviceFunddetailShareds.get(i).setQuantity(new BigDecimal(serviceFunddetails.get(i).getQuantity()));
                        serviceFunddetailShareds.get(i).setPrice(new BigDecimal(serviceFunddetails.get(i).getPrice()));
                }
                else
                {
                    funddetailSharedService.saveBatch(serviceFunddetailShareds);
                }
            } else {
                    //驳回
                    serviceSystemmessage.setMessagetitle(""+(OriginalFlowLevel+1)+"级审核驳回");
                    serviceSystemmessage.setMessagecontent("您"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceFund.getCreateTime())+"提交的关于捐献案例【"+serviceFund.getDonorname()+"】的费用申请已被"+(OriginalFlowLevel+1)+"级审核驳回,原因为"+checkFundVO.getFlowcontent()+"");
                }
                ServiceSystemmessage.save(serviceSystemmessage);
                return AjaxResult.success();
            }
            else
            {
        } else {
                return AjaxResult.error(HttpStatus.NO_CONTENT,"费用编号不正确");
            }
        }
@@ -589,11 +576,9 @@
    @Log(title = "费用申请主", businessType = BusinessType.UPDATE)
    @PutMapping
    @RepeatSubmit    
    public AjaxResult edit(@RequestBody ServiceFund serviceFund)
    {
    public AjaxResult edit(@RequestBody ServiceFund serviceFund) {
        boolean bret = serviceFundService.updateById(serviceFund);
        if(bret)
        {
        if (bret) {
            addReiSharedDatd(serviceFund,2);
        }
        return toAjax(bret);
@@ -606,8 +591,7 @@
    //@PreAuthorize("@ss.hasPermi('project:fund:remove')")
    @Log(title = "费用申请主", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceFundService.removeByIds(Arrays.asList(ids)));
    }
@@ -1478,11 +1462,9 @@
        }
        hj = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 + f18 + f19 + f20 + f21 + f22 + f23 + f24 + f25 + f26 + f27 + f28 + f29 + f30 + f31 + f32 + f33 + f34 + f35
                + f36 + f37 + f38 + f39 + f40 + f41 + f42 + f43 + f44 + f45 + f46 + f47 + f48 + f49 + f50 + f51 + f52;
        hj = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 + f18 + f19 + f20 + f21 + f22 + f23 + f24 + f25 + f26 + f27 + f28 + f29 + f30 + f31 + f32 + f33 + f34 + f35 + f36 + f37 + f38 + f39 + f40 + f41 + f42 + f43 + f44 + f45 + f46 + f47 + f48 + f49 + f50 + f51 + f52;
        shhj = sh1 + sh2 + sh3 + sh4 + sh5 + sh6 + sh7 + sh8 + sh9 + sh10 + sh11 + sh12 + sh13 + sh14 + sh15 + sh16 + sh17 + sh18 + sh19 + sh20 + sh21 + sh22 + sh23 + sh24 + sh25 + sh26 + sh27 + sh28 + sh29 + sh30 + sh31 + sh32 + sh33 + sh34 + sh35
                + sh36 + sh37 + sh38 + sh39 + sh40 + sh41 + sh42 + sh43 + sh44 + sh45 + sh46 + sh47 + sh48 + sh49 + sh50 + sh51 + sh52;
        shhj = sh1 + sh2 + sh3 + sh4 + sh5 + sh6 + sh7 + sh8 + sh9 + sh10 + sh11 + sh12 + sh13 + sh14 + sh15 + sh16 + sh17 + sh18 + sh19 + sh20 + sh21 + sh22 + sh23 + sh24 + sh25 + sh26 + sh27 + sh28 + sh29 + sh30 + sh31 + sh32 + sh33 + sh34 + sh35 + sh36 + sh37 + sh38 + sh39 + sh40 + sh41 + sh42 + sh43 + sh44 + sh45 + sh46 + sh47 + sh48 + sh49 + sh50 + sh51 + sh52;
        dataMap.put("FY1", f1 == 0 ? "" : f1);
        dataMap.put("FY2", f2 == 0 ? "" : f2);
@@ -1826,7 +1808,6 @@
        return AjaxResult.success(serviceFundService.countItem(infoid, itemid));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementController.java
@@ -595,7 +595,7 @@
                serviceSystemmessage.setMessagecontent("您" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serviceReimbursement.getCreateTime()) + "提交的关于捐献案例【" + serviceReimbursement.getDonorname() + "】的差旅费申请已通过" + (OriginalFlowLevel + 1) + "级审核");
                if (totalLevel == OriginalFlowLevel + 1) {
                    //所有数据新增到备份表
                    this.addSharedData(checkFundVO.getFundid());
                    serviceReimbursementService.addSharedData(checkFundVO.getFundid());
                }
            } else {
                //驳回