Commit 33a5a0e6 authored by “yiyousong”'s avatar “yiyousong”
parents 677810e3 4d07e3b6
......@@ -6,3 +6,6 @@ ALTER TABLE mortals_sys_window ADD COLUMN `duty` tinyint (1) default 0 COMMEN
ALTER TABLE mortals_sys_window ADD COLUMN `dutyContent` varchar (256) default "" COMMENT '显示内容' AFTER duty;
ALTER TABLE mortals_sys_window ADD COLUMN `dutyEnglish` varchar (256) default "" COMMENT '显示英文' AFTER dutyContent;
ALTER TABLE mortals_sys_dept ADD COLUMN `total` int(9) DEFAULT '0' COMMENT '关联事项数量' AFTER updateTime;
INSERT INTO `mortals_xhx_task` VALUES (null, '统计站点部门事项数', 'StatSiteDeptMatterTask', 0, 'StatSiteDeptMatterTask', NULL, NULL, 1, 0, '23:21', NULL, '172.17.0.1', '2023-03-05 23:21:01', 0, NULL, NULL, NULL);
......@@ -212,6 +212,7 @@ CREATE TABLE mortals_sys_dept
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间',
`total` int(9) DEFAULT '0' COMMENT '关联事项数量',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门';
......
package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 统计站点部门事项
*/
@Slf4j
@Service("StatSiteDeptMatterTask")
public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
@Autowired
private DeptService deptService;
@Autowired
private SiteMatterService siteMatterService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("开始同步事项列表!");
List<DeptEntity> deptEntities = deptService.find(new DeptQuery());
for (DeptEntity deptEntity : deptEntities) {
int total = siteMatterService.count(new SiteMatterQuery().deptId(deptEntity.getId()), null);
if (total > 0) {
deptEntity.setTotal(total);
deptEntity.setUpdateTime(new Date());
deptService.update(deptEntity, null);
}
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
......@@ -15,6 +15,7 @@ import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.dept.service.DeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.dept.model.vo.DeptVo;
* 部门实体对象
*
* @author zxfei
* @date 2022-11-23
* @date 2023-03-06
*/
public class DeptEntity extends DeptVo {
......@@ -84,6 +84,10 @@ public class DeptEntity extends DeptVo {
* 部门来源
*/
private Integer source;
/**
* 关联事项数量
*/
private Integer total;
......@@ -326,6 +330,20 @@ public class DeptEntity extends DeptVo {
public void setSource(Integer source){
this.source = source;
}
/**
* 获取 关联事项数量
* @return Integer
*/
public Integer getTotal(){
return total;
}
/**
* 设置 关联事项数量
* @param total
*/
public void setTotal(Integer total){
this.total = total;
}
......@@ -365,6 +383,7 @@ public class DeptEntity extends DeptVo {
sb.append(",isEnglish:").append(getIsEnglish());
sb.append(",sort:").append(getSort());
sb.append(",source:").append(getSource());
sb.append(",total:").append(getTotal());
return sb.toString();
}
......@@ -403,5 +422,7 @@ public class DeptEntity extends DeptVo {
this.sort = 0;
this.source = 0;
this.total = 0;
}
}
\ No newline at end of file
......@@ -43,5 +43,12 @@ public class DeptVo extends BaseEntityLong {
/** 部门ID列表 */
private List <Long> idList;
/**
* 是否过滤不存在事项的部门(0.不过滤,1.过滤,默认不过滤)
*/
private Integer filter;
/** 开始 关联事项数量 */
private Integer totalStart;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
......@@ -69,6 +70,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return data.getDeptNumber();
}
/**
* @param entity
* @param context
......
......@@ -9,6 +9,7 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
......@@ -59,6 +60,11 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
add(new OrderCol("a.createTime", OrderCol.ASCENDING));
}
});
if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
//过滤部门事项数据为0的部门
query.setTotalStart(0);
}
super.doListBefore(query, model, context);
}
......
......@@ -116,7 +116,7 @@
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>yibin</package.environment>
<skipUi>true</skipUi>
<skipUi>false</skipUi>
</properties>
</profile>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment