初始化项目
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.jeesite.modules.apps.Module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ScreenTop implements Serializable {
|
||||
|
||||
private String module;
|
||||
private String title;
|
||||
private String label;
|
||||
private BigDecimal value;
|
||||
private String iconImg;
|
||||
private Integer sort;
|
||||
|
||||
|
||||
public ScreenTop() {
|
||||
|
||||
}
|
||||
|
||||
public ScreenTop(String module, String title, String label, BigDecimal value, String iconImg, Integer sort) {
|
||||
this.module = module;
|
||||
this.title = title;
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.iconImg = iconImg;
|
||||
this.sort = sort;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.jeesite.modules.apps.web;
|
||||
|
||||
import com.jeesite.modules.apps.Module.ChartDataItem;
|
||||
import com.jeesite.modules.apps.Module.ScreenTop;
|
||||
import com.jeesite.modules.erp.entity.ErpTransactionFlow;
|
||||
import com.jeesite.modules.erp.service.ErpTransactionFlowService;
|
||||
import com.jeesite.modules.utils.BigDecimalUtils;
|
||||
import com.jeesite.modules.utils.DateUtils;
|
||||
import com.jeesite.modules.utils.KeyUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -23,6 +26,32 @@ public class ErpScreenController {
|
||||
this.erpTransactionFlowService = erpTransactionFlowService;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getErpChartTop")
|
||||
@ResponseBody
|
||||
public List<ScreenTop> getErpChartTop(ErpTransactionFlow erpTransactionFlow) {
|
||||
List<ScreenTop> screenTops = new ArrayList<>();
|
||||
erpTransactionFlow.setMonthDate(DateUtils.getCurrentMonth());
|
||||
List<ErpTransactionFlow> flowList = erpTransactionFlowService.findList(erpTransactionFlow);
|
||||
Map<String, BigDecimal> sumMap = flowList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
ErpTransactionFlow::getFlowType,
|
||||
Collectors.reducing(BigDecimal.ZERO, ErpTransactionFlow::getAmount, BigDecimal::add)
|
||||
));
|
||||
BigDecimal totalIncome = sumMap.getOrDefault("2", BigDecimal.ZERO); //收入
|
||||
BigDecimal totalExpense = sumMap.getOrDefault("1", BigDecimal.ZERO); //支出
|
||||
BigDecimal netProfit = BigDecimalUtils.subtract(totalIncome, totalExpense); //净利润
|
||||
BigDecimal profitRate = BigDecimalUtils.percent(netProfit, totalIncome); //利润率
|
||||
BigDecimal expenseRate = BigDecimalUtils.percent(totalExpense, totalIncome); //支出率
|
||||
BigDecimal profitLossRate = BigDecimalUtils.percent(netProfit, totalExpense); //盈亏率
|
||||
|
||||
screenTops.add(new ScreenTop("总收入", "", "金额(元)", totalIncome, "icons/erp-shouru.svg", 1));
|
||||
screenTops.add(new ScreenTop("总支出", "", "金额(元)", totalExpense, "icons/erp-zhichu.svg", 2));
|
||||
screenTops.add(new ScreenTop("净利润", "", "金额(元)", netProfit, "icons/erp-jiaoyizhichu.svg", 3));
|
||||
screenTops.add(new ScreenTop("利润率", "", "占比(%)", profitRate, "icons/erp-fencheng.svg", 4));
|
||||
screenTops.add(new ScreenTop("支出率", "", "占比(%)", expenseRate, "icons/erp-lirunfenxi.svg", 5));
|
||||
screenTops.add(new ScreenTop("盈亏率", "", "占比(%)", profitLossRate, "icons/erp-zongshouru.svg", 6));
|
||||
return screenTops;
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号收支
|
||||
@@ -368,7 +397,7 @@ public class ErpScreenController {
|
||||
/**
|
||||
* 分类收支
|
||||
*/
|
||||
@RequestMapping(value = "getCategoryChart")
|
||||
@RequestMapping(value = "getErpCategoryChart")
|
||||
@ResponseBody
|
||||
public List<ChartDataItem> getCategoryChart(ErpTransactionFlow erpTransactionFlow) {
|
||||
List<ChartDataItem> chartDataItems = new ArrayList<>();
|
||||
|
||||
@@ -4,18 +4,26 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.system.oshi.CpuInfo;
|
||||
import cn.hutool.system.oshi.OshiUtil;
|
||||
import com.jeesite.modules.apps.Module.ChartInfo;
|
||||
import com.jeesite.modules.biz.entity.MyMunicipalities;
|
||||
import com.jeesite.modules.biz.service.MyMunicipalitiesService;
|
||||
import com.jeesite.modules.utils.KeyUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/desktop/analysis")
|
||||
public class SysAnalysisController {
|
||||
|
||||
@Resource
|
||||
private MyMunicipalitiesService municipalitiesService;
|
||||
|
||||
@RequestMapping(value = "getHostInfo")
|
||||
@ResponseBody
|
||||
public List<ChartInfo> getHostInfo() {
|
||||
@@ -36,4 +44,33 @@ public class SysAnalysisController {
|
||||
chartInfoList.add(new ChartInfo("time", "服务器运行时长", 0, KeyUtil.getColor(), runTime));
|
||||
return chartInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取社区数量
|
||||
*/
|
||||
@RequestMapping(value = "getProvinceChart")
|
||||
@ResponseBody
|
||||
public List<ChartInfo> getProvinceChart(MyMunicipalities myMunicipalities) {
|
||||
List<ChartInfo> chartInfos = new ArrayList<>();
|
||||
myMunicipalities.setUstatus("1");
|
||||
List<MyMunicipalities> municipalitiesList = municipalitiesService.findList(myMunicipalities);
|
||||
Map<String, Long> provinceCountMap = municipalitiesList.stream()
|
||||
.sorted((a, b) -> {
|
||||
if (a.getSorting() == null) return 1;
|
||||
if (b.getSorting() == null) return -1;
|
||||
return a.getSorting().compareTo(b.getSorting());
|
||||
})
|
||||
.collect(Collectors.groupingBy(
|
||||
MyMunicipalities::getProvinceName,
|
||||
java.util.LinkedHashMap::new, // 关键:保证顺序不变
|
||||
Collectors.counting()
|
||||
));
|
||||
for (Map.Entry<String, Long> entry : provinceCountMap.entrySet()) {
|
||||
ChartInfo chartInfo = new ChartInfo();
|
||||
chartInfo.setLabel(entry.getKey());
|
||||
chartInfo.setValue(entry.getValue());
|
||||
chartInfos.add(chartInfo);
|
||||
}
|
||||
return chartInfos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.jeesite.modules.apps.Module.NoteInfo;
|
||||
import com.jeesite.modules.biz.entity.MyNotes;
|
||||
import com.jeesite.modules.biz.service.MyNotesService;
|
||||
import com.jeesite.modules.sys.entity.DictData;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.DictUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import com.jeesite.modules.utils.DateUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -25,6 +27,8 @@ public class SysWorkbenchController {
|
||||
@RequestMapping(value = "getNoteInfo")
|
||||
@ResponseBody
|
||||
public List<NoteInfo> getNoteInfo(MyNotes myNotes) {
|
||||
User user = UserUtils.getUser();
|
||||
myNotes.setCreateUser(user.getLoginCode());
|
||||
List<NoteInfo> noteInfos = new ArrayList<>();
|
||||
myNotes.setCreateTime_gte(DateUtils.getFirstDayOfCurrentYear());
|
||||
List<DictData> dictDataList = DictUtils.getDictList("note_type");
|
||||
@@ -47,6 +51,8 @@ public class SysWorkbenchController {
|
||||
@RequestMapping(value = "getNoteChart")
|
||||
@ResponseBody
|
||||
public List<ChartDataItem> getNoteChart(MyNotes myNotes) {
|
||||
User user = UserUtils.getUser();
|
||||
myNotes.setCreateUser(user.getLoginCode());
|
||||
myNotes.setCreateTime_gte(DateUtils.getFirstDayOfCurrentYear());
|
||||
List<MyNotes> myNotesList = myNotesService.findList(myNotes);
|
||||
Map<String, ChartDataItem> chartDataMap = myNotesList.stream()
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.MyMunicipalities;
|
||||
|
||||
/**
|
||||
* 社区信息 DAO 接口
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface MyMunicipalitiesDao extends CrudDao<MyMunicipalities> {
|
||||
|
||||
}
|
||||
@@ -2,14 +2,14 @@ package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.MyPageIndex;
|
||||
import com.jeesite.modules.biz.entity.MyQuickLogin;
|
||||
|
||||
/**
|
||||
* 指标数据表 DAO 接口
|
||||
* 快捷登录 DAO 接口
|
||||
* @author gaoxq
|
||||
* @version 2026-03-23
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface MyPageIndexDao extends CrudDao<MyPageIndex> {
|
||||
public interface MyQuickLoginDao extends CrudDao<MyQuickLogin> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 社区信息 Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@Table(name = "my_municipalities", alias = "a", label = "社区信息", columns = {
|
||||
@Column(name = "municipality_id", attrName = "municipalityId", label = "唯一主键", isPK = true),
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdateForce = true),
|
||||
@Column(name = "county_name", attrName = "countyName", label = "县区名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "province_code", attrName = "provinceCode", label = "省份编码"),
|
||||
@Column(name = "city_code", attrName = "cityCode", label = "市区编码"),
|
||||
@Column(name = "county_code", attrName = "countyCode", label = "县区编码"),
|
||||
@Column(name = "town_name", attrName = "townName", label = "街道名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "town_code", attrName = "townCode", label = "街道编号"),
|
||||
@Column(name = "village_name", attrName = "villageName", label = "社区名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "village_code", attrName = "villageCode", label = "社区编号"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isUpdateForce = true),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = MyProvince.class, alias = "b",
|
||||
on = "a.province_code = b.province_code", attrName = "this",
|
||||
columns = {
|
||||
@Column(name = "province_name", attrName = "provinceName", label = "省份名称"),
|
||||
@Column(name = "sorting", attrName = "sorting", label = "省份序号"),
|
||||
}),
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = MyCities.class, alias = "c",
|
||||
on = "a.province_code = c.province_code AND a.city_code = c.city_code", attrName = "this",
|
||||
columns = {
|
||||
@Column(name = "city_name", attrName = "cityName", label = "市区名称"),
|
||||
@Column(name = "area_code", attrName = "areaCode", label = "市区区号"),
|
||||
@Column(name = "area_type", attrName = "areaType", label = "市区级别"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyMunicipalities extends DataEntity<MyMunicipalities> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String municipalityId; // 唯一主键
|
||||
private Date createTime; // 记录时间
|
||||
private String countyName; // 县区名称
|
||||
private String provinceCode; // 省份编码
|
||||
private String cityCode; // 市区编码
|
||||
private String countyCode; // 县区编码
|
||||
private String townName; // 街道名称
|
||||
private String townCode; // 街道编号
|
||||
private String villageName; // 社区名称
|
||||
private String villageCode; // 社区编号
|
||||
private Date updateTime; // 更新时间
|
||||
private String ustatus; // 状态
|
||||
|
||||
private String provinceName;
|
||||
private String cityName;
|
||||
private String areaCode;
|
||||
private String areaType;
|
||||
private Integer sorting; // 省份序号
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "唯一主键", attrName = "municipalityId", align = Align.CENTER, sort = 10),
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 20, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "省份编码", attrName = "provinceCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "省份名称", attrName = "provinceName", align = Align.CENTER, sort = 45),
|
||||
@ExcelField(title = "市区编码", attrName = "cityCode", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "市区编码", attrName = "cityName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "市区级别", attrName = "areaType", dictType = "area_level", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "县区编码", attrName = "countyCode", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "县区名称", attrName = "countyName", align = Align.CENTER, sort = 65),
|
||||
@ExcelField(title = "街道编号", attrName = "townCode", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "街道名称", attrName = "townName", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "社区编号", attrName = "villageCode", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "社区名称", attrName = "villageName", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 110, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "状态", attrName = "ustatus", dictType = "biz_status", align = Align.CENTER, sort = 120),
|
||||
})
|
||||
public MyMunicipalities() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyMunicipalities(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 指标数据表 Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-23
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "my_page_index", alias = "a", label = "指标信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "index_id", attrName = "indexId", label = "唯一标识", isPK = true),
|
||||
@Column(name = "module", attrName = "module", label = "模块名称"),
|
||||
@Column(name = "module_code", attrName = "moduleCode", label = "模块编码"),
|
||||
@Column(name = "title", attrName = "title", label = "说明描述", queryType = QueryType.LIKE),
|
||||
@Column(name = "value", attrName = "value", label = "数值", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "label", attrName = "label", label = "名称"),
|
||||
@Column(name = "icon_img", attrName = "iconImg", label = "图片路径", isQuery = false),
|
||||
@Column(name = "icon_filter", attrName = "iconFilter", label = "图标颜色", isQuery = false),
|
||||
@Column(name = "sort", attrName = "sort", label = "序号", isQuery = false),
|
||||
@Column(name = "index_code", attrName = "indexCode", label = "指标编号"),
|
||||
}, orderBy = "a.create_time DESC,index_code,sort "
|
||||
)
|
||||
@Data
|
||||
public class MyPageIndex extends DataEntity<MyPageIndex> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String indexId; // 唯一标识
|
||||
private String module; // 模块名称
|
||||
private String moduleCode; // 模块编码
|
||||
private String title; // 说明描述
|
||||
private Double value; // 数值
|
||||
private String label; // 名称
|
||||
private String iconImg; // 图片路径
|
||||
private String iconFilter; // 图标颜色
|
||||
private Integer sort; // 序号
|
||||
private String indexCode; // 指标编号
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "唯一标识", attrName = "indexId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "模块名称", attrName = "module", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "模块编码", attrName = "moduleCode", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "说明描述", attrName = "title", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "数值", attrName = "value", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "名称", attrName = "label", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "图片路径", attrName = "iconImg", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "图标颜色", attrName = "iconFilter", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "序号", attrName = "sort", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "指标编号", attrName = "indexCode", align = Align.CENTER, sort = 110),
|
||||
})
|
||||
public MyPageIndex() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyPageIndex(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 快捷登录 Entity
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="my_quick_login", alias="a", label="快捷登录信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录时间", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
@Column(name="quick_id", attrName="quickId", label="自增主键", isPK=true),
|
||||
@Column(name="system_name", attrName="systemName", label="系统名称", queryType=QueryType.LIKE),
|
||||
@Column(name="system_type", attrName="systemType", label="系统类型"),
|
||||
@Column(name="system_url", attrName="systemUrl", label="首页地址", isQuery=false),
|
||||
@Column(name="system_icon", attrName="systemIcon", label="系统图标", isQuery=false),
|
||||
@Column(name="bg_color", attrName="bgColor", label="图标背景色", isQuery=false),
|
||||
@Column(name="ustatus", attrName="ustatus", label="状态"),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyQuickLogin extends DataEntity<MyQuickLogin> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String quickId; // 自增主键
|
||||
private String systemName; // 系统名称
|
||||
private String systemType; // 系统类型
|
||||
private String systemUrl; // 首页地址
|
||||
private String systemIcon; // 系统图标
|
||||
private String bgColor; // 图标背景色
|
||||
private String ustatus; // 状态
|
||||
private Date updateTime; // 更新时间
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="自增主键", attrName="quickId", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="系统名称", attrName="systemName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="系统类型", attrName="systemType", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="首页地址", attrName="systemUrl", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="系统图标", attrName="systemIcon", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="图标背景色", attrName="bgColor", align=Align.CENTER, sort=70),
|
||||
@ExcelField(title="状态", attrName="ustatus", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=90, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public MyQuickLogin() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MyQuickLogin(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.MyMunicipalities;
|
||||
import com.jeesite.modules.biz.dao.MyMunicipalitiesDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 社区信息 Service
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@Service
|
||||
public class MyMunicipalitiesService extends CrudService<MyMunicipalitiesDao, MyMunicipalities> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param myMunicipalities 主键
|
||||
*/
|
||||
@Override
|
||||
public MyMunicipalities get(MyMunicipalities myMunicipalities) {
|
||||
return super.get(myMunicipalities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param myMunicipalities 查询条件
|
||||
* @param myMunicipalities page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<MyMunicipalities> findPage(MyMunicipalities myMunicipalities) {
|
||||
return super.findPage(myMunicipalities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param myMunicipalities 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<MyMunicipalities> findList(MyMunicipalities myMunicipalities) {
|
||||
return super.findList(myMunicipalities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param myMunicipalities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(MyMunicipalities myMunicipalities) {
|
||||
super.save(myMunicipalities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<MyMunicipalities> list = ei.getDataList(MyMunicipalities.class);
|
||||
for (MyMunicipalities myMunicipalities : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(myMunicipalities);
|
||||
this.save(myMunicipalities);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + myMunicipalities.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + myMunicipalities.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param myMunicipalities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(MyMunicipalities myMunicipalities) {
|
||||
super.updateStatus(myMunicipalities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param myMunicipalities 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(MyMunicipalities myMunicipalities) {
|
||||
super.delete(myMunicipalities);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.MyPageIndex;
|
||||
import com.jeesite.modules.biz.dao.MyPageIndexDao;
|
||||
import com.jeesite.modules.biz.entity.MyQuickLogin;
|
||||
import com.jeesite.modules.biz.dao.MyQuickLoginDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
@@ -17,49 +17,49 @@ import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 指标数据表 Service
|
||||
* 快捷登录 Service
|
||||
* @author gaoxq
|
||||
* @version 2026-03-23
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@Service
|
||||
public class MyPageIndexService extends CrudService<MyPageIndexDao, MyPageIndex> {
|
||||
public class MyQuickLoginService extends CrudService<MyQuickLoginDao, MyQuickLogin> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param myPageIndex 主键
|
||||
* @param myQuickLogin 主键
|
||||
*/
|
||||
@Override
|
||||
public MyPageIndex get(MyPageIndex myPageIndex) {
|
||||
return super.get(myPageIndex);
|
||||
public MyQuickLogin get(MyQuickLogin myQuickLogin) {
|
||||
return super.get(myQuickLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param myPageIndex 查询条件
|
||||
* @param myPageIndex page 分页对象
|
||||
* @param myQuickLogin 查询条件
|
||||
* @param myQuickLogin page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<MyPageIndex> findPage(MyPageIndex myPageIndex) {
|
||||
return super.findPage(myPageIndex);
|
||||
public Page<MyQuickLogin> findPage(MyQuickLogin myQuickLogin) {
|
||||
return super.findPage(myQuickLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param myPageIndex 查询条件
|
||||
* @param myQuickLogin 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<MyPageIndex> findList(MyPageIndex myPageIndex) {
|
||||
return super.findList(myPageIndex);
|
||||
public List<MyQuickLogin> findList(MyQuickLogin myQuickLogin) {
|
||||
return super.findList(myQuickLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param myPageIndex 数据对象
|
||||
* @param myQuickLogin 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(MyPageIndex myPageIndex) {
|
||||
super.save(myPageIndex);
|
||||
public void save(MyQuickLogin myQuickLogin) {
|
||||
super.save(myQuickLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,16 +75,16 @@ public class MyPageIndexService extends CrudService<MyPageIndexDao, MyPageIndex>
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<MyPageIndex> list = ei.getDataList(MyPageIndex.class);
|
||||
for (MyPageIndex myPageIndex : list) {
|
||||
List<MyQuickLogin> list = ei.getDataList(MyQuickLogin.class);
|
||||
for (MyQuickLogin myQuickLogin : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(myPageIndex);
|
||||
this.save(myPageIndex);
|
||||
ValidatorUtils.validateWithException(myQuickLogin);
|
||||
this.save(myQuickLogin);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + myPageIndex.getId() + " 导入成功");
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + myQuickLogin.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + myPageIndex.getId() + " 导入失败:";
|
||||
String msg = "<br/>" + failureNum + "、编号 " + myQuickLogin.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
@@ -113,22 +113,22 @@ public class MyPageIndexService extends CrudService<MyPageIndexDao, MyPageIndex>
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param myPageIndex 数据对象
|
||||
* @param myQuickLogin 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(MyPageIndex myPageIndex) {
|
||||
super.updateStatus(myPageIndex);
|
||||
public void updateStatus(MyQuickLogin myQuickLogin) {
|
||||
super.updateStatus(myQuickLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param myPageIndex 数据对象
|
||||
* @param myQuickLogin 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(MyPageIndex myPageIndex) {
|
||||
super.delete(myPageIndex);
|
||||
public void delete(MyQuickLogin myQuickLogin) {
|
||||
super.delete(myQuickLogin);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -26,6 +27,7 @@ import com.jeesite.modules.biz.service.MyCitiesService;
|
||||
|
||||
/**
|
||||
* 城市信息 Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-21
|
||||
*/
|
||||
@@ -33,114 +35,123 @@ import com.jeesite.modules.biz.service.MyCitiesService;
|
||||
@RequestMapping(value = "${adminPath}/biz/myCities")
|
||||
public class MyCitiesController extends BaseController {
|
||||
|
||||
private final MyCitiesService myCitiesService;
|
||||
private final MyCitiesService myCitiesService;
|
||||
|
||||
public MyCitiesController(MyCitiesService myCitiesService) {
|
||||
this.myCitiesService = myCitiesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyCities get(String cityId, boolean isNewRecord) {
|
||||
return myCitiesService.get(cityId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyCities> listData(MyCities myCities, HttpServletRequest request, HttpServletResponse response) {
|
||||
myCities.setPage(new Page<>(request, response));
|
||||
Page<MyCities> page = myCitiesService.findPage(myCities);
|
||||
return page;
|
||||
}
|
||||
public MyCitiesController(MyCitiesService myCitiesService) {
|
||||
this.myCitiesService = myCitiesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesForm";
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyCities get(String cityId, boolean isNewRecord) {
|
||||
return myCitiesService.get(cityId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyCities myCities) {
|
||||
myCitiesService.save(myCities);
|
||||
return renderResult(Global.TRUE, text("保存城市成功!"));
|
||||
}
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyCities myCities, HttpServletResponse response) {
|
||||
List<MyCities> list = myCitiesService.findList(myCities);
|
||||
String fileName = "城市" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("城市", MyCities.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyCities> listData(MyCities myCities, HttpServletRequest request, HttpServletResponse response) {
|
||||
myCities.setPage(new Page<>(request, response));
|
||||
Page<MyCities> page = myCitiesService.findPage(myCities);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyCities myCities = new MyCities();
|
||||
List<MyCities> list = ListUtils.newArrayList(myCities);
|
||||
String fileName = "城市模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("城市", MyCities.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyCities myCities, Model model) {
|
||||
model.addAttribute("myCities", myCities);
|
||||
return "modules/biz/myCitiesForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyCities myCities) {
|
||||
myCitiesService.save(myCities);
|
||||
return renderResult(Global.TRUE, text("保存城市成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyCities myCities, HttpServletResponse response) {
|
||||
List<MyCities> list = myCitiesService.findList(myCities);
|
||||
String fileName = "城市" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("城市", MyCities.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyCities myCities = new MyCities();
|
||||
List<MyCities> list = ListUtils.newArrayList(myCities);
|
||||
String fileName = "城市模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("城市", MyCities.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myCitiesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyCities myCities) {
|
||||
myCitiesService.delete(myCities);
|
||||
return renderResult(Global.TRUE, text("删除城市成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyCities> listAll(MyCities myCities) {
|
||||
return myCitiesService.findList(myCities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myCitiesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myCities:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyCities myCities) {
|
||||
myCitiesService.delete(myCities);
|
||||
return renderResult(Global.TRUE, text("删除城市成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyMunicipalities;
|
||||
import com.jeesite.modules.biz.service.MyMunicipalitiesService;
|
||||
|
||||
/**
|
||||
* 社区信息 Controller
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myMunicipalities")
|
||||
public class MyMunicipalitiesController extends BaseController {
|
||||
|
||||
private final MyMunicipalitiesService myMunicipalitiesService;
|
||||
|
||||
public MyMunicipalitiesController(MyMunicipalitiesService myMunicipalitiesService) {
|
||||
this.myMunicipalitiesService = myMunicipalitiesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyMunicipalities get(String municipalityId, boolean isNewRecord) {
|
||||
return myMunicipalitiesService.get(municipalityId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyMunicipalities myMunicipalities, Model model) {
|
||||
model.addAttribute("myMunicipalities", myMunicipalities);
|
||||
return "modules/biz/myMunicipalitiesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyMunicipalities> listData(MyMunicipalities myMunicipalities, HttpServletRequest request, HttpServletResponse response) {
|
||||
myMunicipalities.setPage(new Page<>(request, response));
|
||||
Page<MyMunicipalities> page = myMunicipalitiesService.findPage(myMunicipalities);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyMunicipalities myMunicipalities, Model model) {
|
||||
model.addAttribute("myMunicipalities", myMunicipalities);
|
||||
return "modules/biz/myMunicipalitiesForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyMunicipalities myMunicipalities) {
|
||||
myMunicipalitiesService.save(myMunicipalities);
|
||||
return renderResult(Global.TRUE, text("保存社区成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyMunicipalities myMunicipalities, HttpServletResponse response) {
|
||||
List<MyMunicipalities> list = myMunicipalitiesService.findList(myMunicipalities);
|
||||
String fileName = "社区" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("社区", MyMunicipalities.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyMunicipalities myMunicipalities = new MyMunicipalities();
|
||||
List<MyMunicipalities> list = ListUtils.newArrayList(myMunicipalities);
|
||||
String fileName = "社区模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("社区", MyMunicipalities.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myMunicipalities:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myMunicipalitiesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myMunicipalities:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyMunicipalities myMunicipalities) {
|
||||
myMunicipalitiesService.delete(myMunicipalities);
|
||||
return renderResult(Global.TRUE, text("删除社区成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,6 +99,7 @@ public class MyNoticeTodoController extends BaseController {
|
||||
@ResponseBody
|
||||
public String save(@Validated MyNoticeTodo myNoticeTodo) {
|
||||
User user = UserUtils.getUser();
|
||||
myNoticeTodo.setUstatus("0");
|
||||
myNoticeTodo.setAvatar(user.getAvatar());
|
||||
myNoticeTodo.setCreateUser(user.getLoginCode());
|
||||
myNoticeTodoService.save(myNoticeTodo);
|
||||
@@ -158,6 +159,18 @@ public class MyNoticeTodoController extends BaseController {
|
||||
return renderResult(Global.TRUE, text("删除消息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布数据
|
||||
*/
|
||||
@RequestMapping(value = "publish")
|
||||
@ResponseBody
|
||||
public String publish(MyNoticeTodo myNoticeTodo) {
|
||||
MyNoticeTodo noticeTodo = myNoticeTodoService.get(myNoticeTodo);
|
||||
noticeTodo.setUstatus("1");
|
||||
myNoticeTodoService.save(noticeTodo);
|
||||
return renderResult(Global.TRUE, text("发布消息成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyNoticeTodo> listAll(MyNoticeTodo myNoticeTodo) {
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyPageIndex;
|
||||
import com.jeesite.modules.biz.service.MyPageIndexService;
|
||||
|
||||
/**
|
||||
* 指标数据表 Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2026-03-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myPageIndex")
|
||||
public class MyPageIndexController extends BaseController {
|
||||
|
||||
private final MyPageIndexService myPageIndexService;
|
||||
|
||||
public MyPageIndexController(MyPageIndexService myPageIndexService) {
|
||||
this.myPageIndexService = myPageIndexService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyPageIndex get(String indexId, boolean isNewRecord) {
|
||||
return myPageIndexService.get(indexId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyPageIndex myPageIndex, Model model) {
|
||||
model.addAttribute("myPageIndex", myPageIndex);
|
||||
return "modules/biz/myPageIndexList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyPageIndex> listData(MyPageIndex myPageIndex, HttpServletRequest request, HttpServletResponse response) {
|
||||
myPageIndex.setPage(new Page<>(request, response));
|
||||
Page<MyPageIndex> page = myPageIndexService.findPage(myPageIndex);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyPageIndex myPageIndex, Model model) {
|
||||
model.addAttribute("myPageIndex", myPageIndex);
|
||||
return "modules/biz/myPageIndexForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyPageIndex myPageIndex) {
|
||||
myPageIndexService.save(myPageIndex);
|
||||
return renderResult(Global.TRUE, text("保存指标成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyPageIndex myPageIndex, HttpServletResponse response) {
|
||||
List<MyPageIndex> list = myPageIndexService.findList(myPageIndex);
|
||||
String fileName = "指标" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("指标", MyPageIndex.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyPageIndex myPageIndex = new MyPageIndex();
|
||||
List<MyPageIndex> list = ListUtils.newArrayList(myPageIndex);
|
||||
String fileName = "指标模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("指标", MyPageIndex.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myPageIndex:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myPageIndexService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myPageIndex:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyPageIndex myPageIndex) {
|
||||
myPageIndexService.delete(myPageIndex);
|
||||
return renderResult(Global.TRUE, text("删除指标成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyPageIndex> listAll(MyPageIndex myPageIndex) {
|
||||
return myPageIndexService.findList(myPageIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.MyQuickLogin;
|
||||
import com.jeesite.modules.biz.service.MyQuickLoginService;
|
||||
|
||||
/**
|
||||
* 快捷登录 Controller
|
||||
* @author gaoxq
|
||||
* @version 2026-03-27
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myQuickLogin")
|
||||
public class MyQuickLoginController extends BaseController {
|
||||
|
||||
private final MyQuickLoginService myQuickLoginService;
|
||||
|
||||
public MyQuickLoginController(MyQuickLoginService myQuickLoginService) {
|
||||
this.myQuickLoginService = myQuickLoginService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public MyQuickLogin get(String quickId, boolean isNewRecord) {
|
||||
return myQuickLoginService.get(quickId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(MyQuickLogin myQuickLogin, Model model) {
|
||||
model.addAttribute("myQuickLogin", myQuickLogin);
|
||||
return "modules/biz/myQuickLoginList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<MyQuickLogin> listData(MyQuickLogin myQuickLogin, HttpServletRequest request, HttpServletResponse response) {
|
||||
myQuickLogin.setPage(new Page<>(request, response));
|
||||
Page<MyQuickLogin> page = myQuickLoginService.findPage(myQuickLogin);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(MyQuickLogin myQuickLogin, Model model) {
|
||||
model.addAttribute("myQuickLogin", myQuickLogin);
|
||||
return "modules/biz/myQuickLoginForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyQuickLogin myQuickLogin) {
|
||||
myQuickLoginService.save(myQuickLogin);
|
||||
return renderResult(Global.TRUE, text("保存快捷登录成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(MyQuickLogin myQuickLogin, HttpServletResponse response) {
|
||||
List<MyQuickLogin> list = myQuickLoginService.findList(myQuickLogin);
|
||||
String fileName = "快捷登录" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("快捷登录", MyQuickLogin.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
MyQuickLogin myQuickLogin = new MyQuickLogin();
|
||||
List<MyQuickLogin> list = ListUtils.newArrayList(myQuickLogin);
|
||||
String fileName = "快捷登录模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("快捷登录", MyQuickLogin.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:myQuickLogin:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = myQuickLoginService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:myQuickLogin:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(MyQuickLogin myQuickLogin) {
|
||||
myQuickLoginService.delete(myQuickLogin);
|
||||
return renderResult(Global.TRUE, text("删除快捷登录成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyQuickLogin> listAll(MyQuickLogin myQuickLogin){
|
||||
return myQuickLoginService.findList(myQuickLogin);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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.jeesite.modules.biz.dao.MyMunicipalitiesDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="MyMunicipalities">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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.jeesite.modules.biz.dao.MyQuickLoginDao">
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultType="MyQuickLogin">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
<where>
|
||||
${sqlMap.where.toSql()}
|
||||
</where>
|
||||
ORDER BY ${sqlMap.order.toSql()}
|
||||
</select> -->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user