汇总接口开发

danikor
dxfeng 3 years ago
parent 1cf8d42e75
commit 41218ebed0

@ -143,7 +143,7 @@ public class DepartmentBO {
tree.setPid(null == item.getSupDepId() ? "0" : item.getSupDepId().toString());
tree.setSelected(false);
tree.setType("2");
tree.setParentComp(item.getSubCompanyId1().toString());
tree.setParentComp(null == item.getSubCompanyId1() ? "" : item.getSubCompanyId1().toString());
tree.setOrderNum(null == item.getShowOrder() ? 0 : item.getShowOrder().intValue());
return tree;
}).collect(Collectors.toList());

@ -27,5 +27,30 @@ public interface DanikorResourceMapper {
*/
List<TableColumnPO> getHrmColumnByTableName(@Param("tableName") String tableName);
Integer summaryData(@Param("tableName") String tableName, @Param("syncDate") String syncDate);
/**
*
*
* @param tableName
* @param syncDate
* @return
*/
Integer summaryResourceData(@Param("tableName") String tableName, @Param("syncDate") String syncDate);
/**
*
*
* @param tableName
* @param syncDate
* @return
*/
Integer summaryCompanyData(@Param("tableName") String tableName, @Param("syncDate") String syncDate);
/**
*
*
* @param tableName
* @param syncDate
* @return
*/
Integer summaryDepartmentData(@Param("tableName") String tableName, @Param("syncDate") String syncDate);
}

@ -41,8 +41,32 @@
and status &lt; 4
</if>
<if test="tableName != 'hrmresource'">
isnull(canceled, '0') = '0'
</if>
<if test="syncDate != null and syncDate !=''">
and sync_date = #{syncDate}
</if>
</select>
<select id="summaryResourceData" resultType="java.lang.Integer">
select count(id)
from ${tableName}
where status &lt; 4
<if test="syncDate != null and syncDate !=''">
and sync_date = #{syncDate}
</if>
</select>
<select id="summaryCompanyData" resultType="java.lang.Integer">
select count(id)
from ${tableName}
where isnull(canceled, '0') = '0'
<if test="syncDate != null and syncDate !=''">
and sync_date = #{syncDate}
</if>
</select>
<select id="summaryDepartmentData" resultType="java.lang.Integer">
select count(id)
from ${tableName}
where isnull(canceled, '0') = '0'
<if test="syncDate != null and syncDate !=''">
and sync_date = #{syncDate}
</if>

@ -134,13 +134,20 @@ public class DanikorResourceBackServiceImpl extends Service implements DanikorRe
@Override
public Map<String, Object> getSummaryData(Map<String, Object> params) {
HashMap<String, Object> returnMap = new HashMap<>();
String companyTable = "hrmsubcompany";
String departmentTable = "hrmdepartment";
String resourceTable = "hrmresource";
String syncDate = Util.null2String(params.get("syncDate"));
if (DateUtil.getDate(new Date()).equals(syncDate)) {
if (StringUtils.isNotBlank(syncDate) && !DateUtil.getDate(new Date()).equals(syncDate)) {
companyTable += "_back";
departmentTable += "_back";
resourceTable += "_back";
} else {
syncDate = null;
}
returnMap.put("subcompany", getDanikorResourceMapper().summaryData("hrmsubcompany", syncDate));
returnMap.put("department", getDanikorResourceMapper().summaryData("hrmdepartment", syncDate));
returnMap.put("person", getDanikorResourceMapper().summaryData("hrmresource", syncDate));
returnMap.put("subcompany", getDanikorResourceMapper().summaryCompanyData(companyTable, syncDate));
returnMap.put("department", getDanikorResourceMapper().summaryDepartmentData(departmentTable, syncDate));
returnMap.put("person", getDanikorResourceMapper().summaryResourceData(resourceTable, syncDate));
return returnMap;
}
}

Loading…
Cancel
Save