update code

dev_xds
haha 2023-09-07 23:50:10 +08:00
parent c135996e8d
commit 5db1b3227b
10 changed files with 1477 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询项目跟进计划列表
export function listProjectPlan(query) {
return request({
url: '/project/projectPlan/list',
method: 'get',
params: query
})
}
// 查询项目跟进计划详细
export function getProjectPlan(id) {
return request({
url: '/project/projectPlan/' + id,
method: 'get'
})
}
// 新增项目跟进计划
export function addProjectPlan(data) {
return request({
url: '/project/projectPlan',
method: 'post',
data: data
})
}
// 修改项目跟进计划
export function updateProjectPlan(data) {
return request({
url: '/project/projectPlan',
method: 'put',
data: data
})
}
// 删除项目跟进计划
export function delProjectPlan(id) {
return request({
url: '/project/projectPlan/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,360 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="包抓部门" prop="dept">
<el-input
v-model="queryParams.dept"
placeholder="请输入包抓部门"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="开工日期" prop="startDate">
<el-date-picker clearable
v-model="queryParams.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择开工日期">
</el-date-picker>
</el-form-item>
<el-form-item label="完工日期" prop="endDate">
<el-date-picker clearable
v-model="queryParams.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择完工日期">
</el-date-picker>
</el-form-item>
<el-form-item label="总投资" prop="totalInvestment">
<el-input
v-model="queryParams.totalInvestment"
placeholder="请输入总投资"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年度投资" prop="yearInvestment">
<el-input
v-model="queryParams.yearInvestment"
placeholder="请输入年度投资"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-input
v-model="queryParams.isDel"
placeholder="请输入是否删除"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['project:projectPlan:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['project:projectPlan:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['project:projectPlan:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['project:projectPlan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="projectPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="建设规模及主要建设内容" align="center" prop="content" />
<el-table-column label="建设性质" align="center" prop="buildType" />
<el-table-column label="包抓部门" align="center" prop="dept" />
<el-table-column label="开工日期" align="center" prop="startDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="完工日期" align="center" prop="endDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="总投资" align="center" prop="totalInvestment" />
<el-table-column label="年度投资" align="center" prop="yearInvestment" />
<el-table-column label="0-城建项目计划,1-重点项目计划" align="center" prop="planType" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="是否删除" align="center" prop="isDel" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['project:projectPlan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['project:projectPlan:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改项目跟进计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="form.projectName" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="建设规模及主要建设内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="包抓部门" prop="dept">
<el-input v-model="form.dept" placeholder="请输入包抓部门" />
</el-form-item>
<el-form-item label="开工日期" prop="startDate">
<el-date-picker clearable
v-model="form.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择开工日期">
</el-date-picker>
</el-form-item>
<el-form-item label="完工日期" prop="endDate">
<el-date-picker clearable
v-model="form.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择完工日期">
</el-date-picker>
</el-form-item>
<el-form-item label="总投资" prop="totalInvestment">
<el-input v-model="form.totalInvestment" placeholder="请输入总投资" />
</el-form-item>
<el-form-item label="年度投资" prop="yearInvestment">
<el-input v-model="form.yearInvestment" placeholder="请输入年度投资" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-input v-model="form.isDel" placeholder="请输入是否删除" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProjectPlan, getProjectPlan, delProjectPlan, addProjectPlan, updateProjectPlan } from "@/api/project/projectPlan";
export default {
name: "ProjectPlan",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
projectPlanList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
projectName: null,
content: null,
buildType: null,
dept: null,
startDate: null,
endDate: null,
totalInvestment: null,
yearInvestment: null,
planType: null,
isDel: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询项目跟进计划列表 */
getList() {
this.loading = true;
listProjectPlan(this.queryParams).then(response => {
this.projectPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
projectName: null,
content: null,
buildType: null,
dept: null,
startDate: null,
endDate: null,
totalInvestment: null,
yearInvestment: null,
planType: null,
remark: null,
isDel: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加项目跟进计划";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getProjectPlan(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改项目跟进计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateProjectPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProjectPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除项目跟进计划编号为"' + ids + '"的数据项?').then(function() {
return delProjectPlan(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('project/projectPlan/export', {
...this.queryParams
}, `projectPlan_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,162 @@
package com.yanzhu.jh.project.controller;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.yanzhu.jh.project.domain.vo.MajorPlanExport;
import com.yanzhu.jh.project.domain.vo.SurProjectBuildNodeDataExport;
import com.yanzhu.jh.project.domain.vo.UrbanPlanExport;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.yanzhu.jh.project.domain.SurProjectPlan;
import com.yanzhu.jh.project.service.ISurProjectPlanService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author ruoyi
* @date 2023-09-07
*/
@RestController
@RequestMapping("/project/projectPlan")
public class SurProjectPlanController extends BaseController
{
@Autowired
private ISurProjectPlanService surProjectPlanService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:list')")
@GetMapping("/list")
public TableDataInfo list(SurProjectPlan surProjectPlan)
{
startPage();
List<SurProjectPlan> list = surProjectPlanService.selectSurProjectPlanList(surProjectPlan);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('project:projectPlan:list')")
@GetMapping("/listAll/{type}")
public AjaxResult listAll(@PathVariable("type") Long type){
SurProjectPlan where=new SurProjectPlan();
where.setPlanType(type);
where.setIsDel(0l);
List<SurProjectPlan> list = surProjectPlanService.selectSurProjectPlanList(where);
return AjaxResult.success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:export')")
@Log(title = "项目跟进计划", businessType = BusinessType.EXPORT)
@GetMapping("/export/{type}")
public void export(HttpServletResponse response,@PathVariable("type") Long type)
{
SurProjectPlan where=new SurProjectPlan();
where.setPlanType(type);
List<SurProjectPlan> list = surProjectPlanService.selectSurProjectPlanList(where);
if(list.size()==0){
list.add(new SurProjectPlan());
}
if(type==0){
List<UrbanPlanExport> list1=new ArrayList<>();
for(SurProjectPlan it :list){
list1.add(UrbanPlanExport.convert(it));
}
ExcelUtil<UrbanPlanExport> util=new ExcelUtil<>(UrbanPlanExport.class);
util.exportExcel(response, list1, "城建项目计划");
}else{
List<MajorPlanExport> list1=new ArrayList<>();
for(SurProjectPlan it :list){
list1.add(MajorPlanExport.convert(it));
}
ExcelUtil<MajorPlanExport> util=new ExcelUtil<>(MajorPlanExport.class);
util.exportExcel(response, list1, "重点项目计划");
}
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(surProjectPlanService.selectSurProjectPlanById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:add')")
@Log(title = "项目跟进计划", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SurProjectPlan surProjectPlan)
{
return toAjax(surProjectPlanService.insertSurProjectPlan(surProjectPlan));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:edit')")
@Log(title = "项目跟进计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SurProjectPlan surProjectPlan)
{
return toAjax(surProjectPlanService.updateSurProjectPlan(surProjectPlan));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('project:projectPlan:remove')")
@Log(title = "项目跟进计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(surProjectPlanService.deleteSurProjectPlanByIds(ids));
}
@PreAuthorize("@ss.hasPermi('project:projectPlan:import')")
@PostMapping("/importUrbanPlan")
public AjaxResult importUrbanPlan(MultipartFile file, boolean updateSupport) throws Exception{
ExcelUtil<UrbanPlanExport> util=new ExcelUtil<UrbanPlanExport>(UrbanPlanExport.class);
InputStream is=file.getInputStream();
List<UrbanPlanExport> list = util.importExcel(is);
is.close();
int n=surProjectPlanService.importUrbanPlan(list);
return success("成功导入"+n+"条数据!");
}
@PreAuthorize("@ss.hasPermi('project:projectPlan:import')")
@PostMapping("/importMajorPlan")
public AjaxResult importMajorPlan(MultipartFile file, boolean updateSupport) throws Exception{
ExcelUtil<MajorPlanExport> util=new ExcelUtil<MajorPlanExport>(MajorPlanExport.class);
InputStream is=file.getInputStream();
List<MajorPlanExport> list = util.importExcel(is);
is.close();
int n=surProjectPlanService.importMajorPlan(list);
return success("成功导入"+n+"条数据!");
}
}

View File

@ -0,0 +1,186 @@
package com.yanzhu.jh.project.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* sur_project_plan
*
* @author ruoyi
* @date 2023-09-07
*/
public class SurProjectPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 建设规模及主要建设内容 */
@Excel(name = "建设规模及主要建设内容")
private String content;
/** 建设性质 */
@Excel(name = "建设性质")
private String buildType;
/** 包抓部门 */
@Excel(name = "包抓部门")
private String dept;
/** 开工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开工日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 完工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "完工日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
/** 总投资(万元) */
@Excel(name = "总投资", readConverterExp = "万=元")
private Long totalInvestment;
/** 年度投资(万元) */
@Excel(name = "年度投资", readConverterExp = "万=元")
private Long yearInvestment;
/** 0-城建项目计划,1-重点项目计划 */
@Excel(name = "0-城建项目计划,1-重点项目计划")
private Long planType;
/** 是否删除 */
@Excel(name = "是否删除")
private Long isDel;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setProjectName(String projectName)
{
this.projectName = projectName;
}
public String getProjectName()
{
return projectName;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setBuildType(String buildType)
{
this.buildType = buildType;
}
public String getBuildType()
{
return buildType;
}
public void setDept(String dept)
{
this.dept = dept;
}
public String getDept()
{
return dept;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public Date getEndDate()
{
return endDate;
}
public void setTotalInvestment(Long totalInvestment)
{
this.totalInvestment = totalInvestment;
}
public Long getTotalInvestment()
{
return totalInvestment;
}
public void setYearInvestment(Long yearInvestment)
{
this.yearInvestment = yearInvestment;
}
public Long getYearInvestment()
{
return yearInvestment;
}
public void setPlanType(Long planType)
{
this.planType = planType;
}
public Long getPlanType()
{
return planType;
}
public void setIsDel(Long isDel)
{
this.isDel = isDel;
}
public Long getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("projectName", getProjectName())
.append("content", getContent())
.append("buildType", getBuildType())
.append("dept", getDept())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.append("totalInvestment", getTotalInvestment())
.append("yearInvestment", getYearInvestment())
.append("planType", getPlanType())
.append("remark", getRemark())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,164 @@
package com.yanzhu.jh.project.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.yanzhu.jh.project.domain.SurProjectPlan;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.util.Date;
/**
*
*/
public class MajorPlanExport
{
@Excel(name = "编号(不要修改)", width = 20,prompt = "不要修改修改此列")
private Long id;
public static MajorPlanExport convert(SurProjectPlan it) {
MajorPlanExport p=new MajorPlanExport();
p.id=it.getId();
p.buildType=it.getBuildType();
p.content=it.getContent();
p.dept=it.getDept();
p.endDate=it.getEndDate();
p.startDate=it.getStartDate();
p.projectName=it.getProjectName();
p.totalInvestment=it.getTotalInvestment();
p.yearInvestment=it.getYearInvestment();
return p;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getBuildType() {
return buildType;
}
public void setBuildType(String buildType) {
this.buildType = buildType;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getTotalInvestment() {
return totalInvestment;
}
public void setTotalInvestment(Long totalInvestment) {
this.totalInvestment = totalInvestment;
}
public Long getYearInvestment() {
return yearInvestment;
}
public void setYearInvestment(Long yearInvestment) {
this.yearInvestment = yearInvestment;
}
/** 项目名称 */
@Excel(name = "项目名称", width = 30,align = HorizontalAlignment.LEFT)
private String projectName;
/** 建设规模及主要建设内容 */
@Excel(name = "建设规模及主要建设内容", width = 40,align = HorizontalAlignment.LEFT)
private String content;
/** 建设性质 */
@Excel(name = "建设性质(新建/续建/前期)")
private String buildType;
/** 包抓部门 */
@Excel(name = "包抓部门")
private String dept;
/** 开工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开工日期", dateFormat = "yyyy.MM")
private Date startDate;
/** 完工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "完工日期", dateFormat = "yyyy.MM")
private Date endDate;
/** 总投资(万元) */
@Excel(name = "总投资(万元)")
private Long totalInvestment;
/** 年度投资(万元) */
@Excel(name = "年度计划投资(万元)")
private Long yearInvestment;
public void setValue(SurProjectPlan it) {
it.setContent(this.content);
it.setDept(this.dept);
it.setProjectName(this.projectName);
it.setBuildType(this.buildType);
it.setStartDate(this.startDate);
it.setEndDate(this.endDate);
it.setTotalInvestment(this.totalInvestment);
it.setYearInvestment(this.yearInvestment);
}
public SurProjectPlan toPlan() {
SurProjectPlan p=new SurProjectPlan();
p.setPlanType(0l);
p.setYearInvestment(this.yearInvestment);
p.setDept(this.dept);
p.setTotalInvestment(this.totalInvestment);
p.setEndDate(this.endDate);
p.setStartDate(this.startDate);
p.setBuildType(this.buildType);
p.setProjectName(this.projectName);
p.setContent(this.content);
p.setIsDel(0l);
return p;
}
}

View File

@ -0,0 +1,162 @@
package com.yanzhu.jh.project.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.yanzhu.jh.project.domain.SurProjectPlan;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.util.Date;
/**
*
*/
public class UrbanPlanExport {
@Excel(name = "编号(不要修改)", width = 20,prompt = "不要修改修改此列")
private Long id;
/** 项目名称 */
@Excel(name = "项目名称", width = 30,align = HorizontalAlignment.LEFT)
private String projectName;
/** 建设规模及主要建设内容 */
@Excel(name = "建设规模及主要工程内容", width = 40,align = HorizontalAlignment.LEFT)
private String content;
/** 建设性质 */
@Excel(name = "建设性质(新建/续建/前期)")
private String buildType;
/** 包抓部门 */
@Excel(name = "包抓部门")
private String dept;
/** 开工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开工时限", dateFormat = "yyyy.MM")
private Date startDate;
/** 完工日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "建成时限", dateFormat = "yyyy.MM")
private Date endDate;
/** 总投资(万元) */
@Excel(name = "总投资(万元)")
private Long totalInvestment;
/** 年度投资(万元) */
@Excel(name = "年度投资(万元)")
private Long yearInvestment;
public static UrbanPlanExport convert(SurProjectPlan it) {
UrbanPlanExport p=new UrbanPlanExport();
p.id=it.getId();
p.buildType=it.getBuildType();
p.content=it.getContent();
p.dept=it.getDept();
p.endDate=it.getEndDate();
p.startDate=it.getStartDate();
p.projectName=it.getProjectName();
p.totalInvestment=it.getTotalInvestment();
p.yearInvestment=it.getYearInvestment();
return p;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getBuildType() {
return buildType;
}
public void setBuildType(String buildType) {
this.buildType = buildType;
}
public String getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getTotalInvestment() {
return totalInvestment;
}
public void setTotalInvestment(Long totalInvestment) {
this.totalInvestment = totalInvestment;
}
public Long getYearInvestment() {
return yearInvestment;
}
public void setYearInvestment(Long yearInvestment) {
this.yearInvestment = yearInvestment;
}
public void setValue(SurProjectPlan it) {
it.setContent(this.content);
it.setDept(this.dept);
it.setProjectName(this.projectName);
it.setBuildType(this.buildType);
it.setStartDate(this.startDate);
it.setEndDate(this.endDate);
it.setTotalInvestment(this.totalInvestment);
it.setYearInvestment(this.yearInvestment);
}
public SurProjectPlan toPlan() {
SurProjectPlan p=new SurProjectPlan();
p.setPlanType(0l);
p.setYearInvestment(this.yearInvestment);
p.setDept(this.dept);
p.setTotalInvestment(this.totalInvestment);
p.setEndDate(this.endDate);
p.setStartDate(this.startDate);
p.setBuildType(this.buildType);
p.setProjectName(this.projectName);
p.setContent(this.content);
p.setIsDel(0l);
return p;
}
}

View File

@ -0,0 +1,61 @@
package com.yanzhu.jh.project.mapper;
import java.util.List;
import com.yanzhu.jh.project.domain.SurProjectPlan;
/**
* Mapper
*
* @author ruoyi
* @date 2023-09-07
*/
public interface SurProjectPlanMapper
{
/**
*
*
* @param id
* @return
*/
public SurProjectPlan selectSurProjectPlanById(Long id);
/**
*
*
* @param surProjectPlan
* @return
*/
public List<SurProjectPlan> selectSurProjectPlanList(SurProjectPlan surProjectPlan);
/**
*
*
* @param surProjectPlan
* @return
*/
public int insertSurProjectPlan(SurProjectPlan surProjectPlan);
/**
*
*
* @param surProjectPlan
* @return
*/
public int updateSurProjectPlan(SurProjectPlan surProjectPlan);
/**
*
*
* @param id
* @return
*/
public int deleteSurProjectPlanById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteSurProjectPlanByIds(Long[] ids);
}

View File

@ -0,0 +1,67 @@
package com.yanzhu.jh.project.service;
import java.util.List;
import com.yanzhu.jh.project.domain.SurProjectPlan;
import com.yanzhu.jh.project.domain.vo.MajorPlanExport;
import com.yanzhu.jh.project.domain.vo.UrbanPlanExport;
/**
* Service
*
* @author ruoyi
* @date 2023-09-07
*/
public interface ISurProjectPlanService
{
/**
*
*
* @param id
* @return
*/
public SurProjectPlan selectSurProjectPlanById(Long id);
/**
*
*
* @param surProjectPlan
* @return
*/
public List<SurProjectPlan> selectSurProjectPlanList(SurProjectPlan surProjectPlan);
/**
*
*
* @param surProjectPlan
* @return
*/
public int insertSurProjectPlan(SurProjectPlan surProjectPlan);
/**
*
*
* @param surProjectPlan
* @return
*/
public int updateSurProjectPlan(SurProjectPlan surProjectPlan);
/**
*
*
* @param ids
* @return
*/
public int deleteSurProjectPlanByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteSurProjectPlanById(Long id);
public int importUrbanPlan(List<UrbanPlanExport> list);
public int importMajorPlan(List<MajorPlanExport> list);
}

View File

@ -0,0 +1,150 @@
package com.yanzhu.jh.project.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.yanzhu.jh.project.domain.vo.MajorPlanExport;
import com.yanzhu.jh.project.domain.vo.UrbanPlanExport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.jh.project.mapper.SurProjectPlanMapper;
import com.yanzhu.jh.project.domain.SurProjectPlan;
import com.yanzhu.jh.project.service.ISurProjectPlanService;
import com.ruoyi.common.utils.SecurityUtils;
/**
* Service
*
* @author ruoyi
* @date 2023-09-07
*/
@Service
public class SurProjectPlanServiceImpl implements ISurProjectPlanService
{
@Autowired
private SurProjectPlanMapper surProjectPlanMapper;
/**
*
*
* @param id
* @return
*/
@Override
public SurProjectPlan selectSurProjectPlanById(Long id)
{
return surProjectPlanMapper.selectSurProjectPlanById(id);
}
/**
*
*
* @param surProjectPlan
* @return
*/
@Override
public List<SurProjectPlan> selectSurProjectPlanList(SurProjectPlan surProjectPlan)
{
return surProjectPlanMapper.selectSurProjectPlanList(surProjectPlan);
}
/**
*
*
* @param surProjectPlan
* @return
*/
@Override
public int insertSurProjectPlan(SurProjectPlan surProjectPlan)
{
surProjectPlan.setCreateBy(SecurityUtils.getUsername());
surProjectPlan.setCreateTime(DateUtils.getNowDate());
return surProjectPlanMapper.insertSurProjectPlan(surProjectPlan);
}
/**
*
*
* @param surProjectPlan
* @return
*/
@Override
public int updateSurProjectPlan(SurProjectPlan surProjectPlan)
{
surProjectPlan.setUpdateBy(SecurityUtils.getUsername());
surProjectPlan.setUpdateTime(DateUtils.getNowDate());
return surProjectPlanMapper.updateSurProjectPlan(surProjectPlan);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteSurProjectPlanByIds(Long[] ids)
{
return surProjectPlanMapper.deleteSurProjectPlanByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteSurProjectPlanById(Long id)
{
return surProjectPlanMapper.deleteSurProjectPlanById(id);
}
@Override
public int importUrbanPlan(List<UrbanPlanExport> list) {
SurProjectPlan where=new SurProjectPlan();
where.setPlanType(0l);
List<SurProjectPlan> oldList=selectSurProjectPlanList(where);
int i=0;
for(;i<list.size();i++){
UrbanPlanExport item=list.get(i);
if(i<oldList.size()){
SurProjectPlan it=oldList.get(i);
item.setValue(it);
this.updateSurProjectPlan(it);
}else{
SurProjectPlan it=item.toPlan();
this.insertSurProjectPlan(it);
}
}
for(;i<oldList.size();i++){
SurProjectPlan it=oldList.get(i);
it.setIsDel(1l);
this.updateSurProjectPlan(it);
}
return list.size();
}
@Override
public int importMajorPlan(List<MajorPlanExport> list) {
SurProjectPlan where=new SurProjectPlan();
where.setPlanType(1l);
List<SurProjectPlan> oldList=selectSurProjectPlanList(where);
int i=0;
for(;i<list.size();i++){
MajorPlanExport item=list.get(i);
if(i<oldList.size()){
SurProjectPlan it=oldList.get(i);
item.setValue(it);
this.updateSurProjectPlan(it);
}else{
SurProjectPlan it=item.toPlan();
this.insertSurProjectPlan(it);
}
}
for(;i<oldList.size();i++){
SurProjectPlan it=oldList.get(i);
it.setIsDel(1l);
this.updateSurProjectPlan(it);
}
return 0;
}
}

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.jh.project.mapper.SurProjectPlanMapper">
<resultMap type="SurProjectPlan" id="SurProjectPlanResult">
<result property="id" column="id" />
<result property="projectName" column="project_name" />
<result property="content" column="content" />
<result property="buildType" column="build_type" />
<result property="dept" column="dept" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="totalInvestment" column="total_investment" />
<result property="yearInvestment" column="year_investment" />
<result property="planType" column="plan_type" />
<result property="remark" column="remark" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSurProjectPlanVo">
select id, project_name, content, build_type, dept, start_date, end_date, total_investment, year_investment, plan_type, remark, is_del, create_by, create_time, update_by, update_time from sur_project_plan
</sql>
<select id="selectSurProjectPlanList" parameterType="SurProjectPlan" resultMap="SurProjectPlanResult">
<include refid="selectSurProjectPlanVo"/>
<where>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="buildType != null and buildType != ''"> and build_type = #{buildType}</if>
<if test="dept != null and dept != ''"> and dept = #{dept}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="totalInvestment != null "> and total_investment = #{totalInvestment}</if>
<if test="yearInvestment != null "> and year_investment = #{yearInvestment}</if>
<if test="planType != null "> and plan_type = #{planType}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectSurProjectPlanById" parameterType="Long" resultMap="SurProjectPlanResult">
<include refid="selectSurProjectPlanVo"/>
where id = #{id}
</select>
<insert id="insertSurProjectPlan" parameterType="SurProjectPlan" useGeneratedKeys="true" keyProperty="id">
insert into sur_project_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectName != null">project_name,</if>
<if test="content != null">content,</if>
<if test="buildType != null">build_type,</if>
<if test="dept != null">dept,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="totalInvestment != null">total_investment,</if>
<if test="yearInvestment != null">year_investment,</if>
<if test="planType != null">plan_type,</if>
<if test="remark != null">remark,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectName != null">#{projectName},</if>
<if test="content != null">#{content},</if>
<if test="buildType != null">#{buildType},</if>
<if test="dept != null">#{dept},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="totalInvestment != null">#{totalInvestment},</if>
<if test="yearInvestment != null">#{yearInvestment},</if>
<if test="planType != null">#{planType},</if>
<if test="remark != null">#{remark},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSurProjectPlan" parameterType="SurProjectPlan">
update sur_project_plan
<trim prefix="SET" suffixOverrides=",">
<if test="projectName != null">project_name = #{projectName},</if>
<if test="content != null">content = #{content},</if>
<if test="buildType != null">build_type = #{buildType},</if>
<if test="dept != null">dept = #{dept},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="totalInvestment != null">total_investment = #{totalInvestment},</if>
<if test="yearInvestment != null">year_investment = #{yearInvestment},</if>
<if test="planType != null">plan_type = #{planType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectPlanById" parameterType="Long">
delete from sur_project_plan where id = #{id}
</delete>
<delete id="deleteSurProjectPlanByIds" parameterType="String">
delete from sur_project_plan where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>