1.api增加获取当前部门主任、季度页面路由
2.季度考核指标增加获取季度列表方法(并获得平均分) 3.季度审核指标查询增条件userId 4.步骤3.xml文件修改 5.项目立项时给考核指标表增加默认执行人(项目负责人)及状态 6.项目立项结束监控器给季度审核表增加所有步骤的委托人(流程权限由代办项目改为第二页面季度时使用权限) 7.季度审核表查询去掉流程结束条件
This commit is contained in:
parent
42ae88438e
commit
bafa02396c
@ -384,10 +384,11 @@ public class Api {
|
||||
*/
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION=PROJECT_PREFIX+"/quarterExamine";
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_LIST=PROJECT_QUARTERLY_EVALUATION+"/list";
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_QUARTER_LIST=PROJECT_QUARTERLY_EVALUATION+"/quarterList";
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_UPDATE=PROJECT_QUARTERLY_EVALUATION+"/update";
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_EXAMINE=PROJECT_QUARTERLY_EVALUATION+"/examine";
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_GETOFFICE=PROJECT_QUARTERLY_EVALUATION+"/getOffice/{id}";
|
||||
|
||||
public static final String PROJECT_QUARTERLY_EVALUATION_GETBUSINESS=PROJECT_QUARTERLY_EVALUATION+"/getBusiness/{id}";
|
||||
public static final String PROJECT_INFO_GET_ACCEPT_PROJECTS = PROJECT_INFO + "/accept";
|
||||
|
||||
public static final String PROJECT_INFO_MODEL = PROJECT_INFO + "/model";
|
||||
|
@ -9,6 +9,8 @@ import com.xqopen.kehui.common.service.ISystemOrgService;
|
||||
import com.xqopen.kehui.common.service.ISystemUserLoginService;
|
||||
import com.xqopen.kehui.exception.ErrorCode;
|
||||
import com.xqopen.kehui.exception.XQException;
|
||||
import com.xqopen.kehui.flows.entity.FlowsConfiguration;
|
||||
import com.xqopen.kehui.flows.service.IFlowsConfigurationService;
|
||||
import com.xqopen.kehui.flows.service.IFlowsService;
|
||||
import com.xqopen.kehui.personal.entity.PersonalMember;
|
||||
import com.xqopen.kehui.personal.service.IPersonalMemberService;
|
||||
@ -31,6 +33,8 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component("weekly")
|
||||
@Slf4j
|
||||
@ -51,6 +55,10 @@ public class ProjectInitListener implements ExecutionListener {
|
||||
ISystemOrgService orgService;
|
||||
@Autowired
|
||||
IPersonalMemberService personalMemberService;
|
||||
@Autowired
|
||||
IFlowsConfigurationService flowsConfigurationService;
|
||||
@Autowired
|
||||
ISystemUserLoginService userLoginService;
|
||||
@Override
|
||||
@Transactional
|
||||
public void notify(DelegateExecution execution) throws Exception {
|
||||
@ -118,7 +126,15 @@ public class ProjectInitListener implements ExecutionListener {
|
||||
jsonObject.put("projectAdmin",getSystemUserLogin(String.valueOf(projectAdmin.get(1))).getId());
|
||||
jsonObject.put("branchLeaders",getSystemUserLogin(String.valueOf(branchLeaders.get(1))).getId());
|
||||
jsonObject.put("MainLeader",getSystemUserLogin(String.valueOf(MainLeader.get(1))).getId());
|
||||
jsonObject.put("executor",getSystemUserLogin(projectManager).getId());
|
||||
// jsonObject.put("executor",getSystemUserLogin(projectManager).getId());
|
||||
String executor = getExecutor();
|
||||
StringBuffer stringBuffer = new StringBuffer(executor);
|
||||
stringBuffer.append(",").append(jsonObject.get("projectManager"));
|
||||
stringBuffer.append(",").append(jsonObject.get("projectAdmin"));
|
||||
stringBuffer.append(",").append(jsonObject.get("branchLeaders"));
|
||||
stringBuffer.append(",").append(jsonObject.get("MainLeader"));
|
||||
executor=new String(stringBuffer);
|
||||
jsonObject.put("executor",executor);
|
||||
jsonObject.put("taskName","季度审核填报");
|
||||
quarterlyEvaluation.setExt(jsonObject);
|
||||
quarterlyEvaluation.setCreatedAt(new Timestamp(System.currentTimeMillis()));
|
||||
@ -127,7 +143,8 @@ public class ProjectInitListener implements ExecutionListener {
|
||||
//添加季度审核的状态
|
||||
JSONObject infoExt = projectInfo.getExt();
|
||||
infoExt.put("taskName","季度审核填报");//任务节点
|
||||
infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人
|
||||
infoExt.put("executor",executor);
|
||||
// infoExt.put("executor",getSystemUserLogin(projectManager).getId());//当前委托人
|
||||
//判断项目负责人是否是办公室部门的
|
||||
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
|
||||
orgEntityWrapper.eq("is_deleted",false);
|
||||
@ -166,4 +183,40 @@ public class ProjectInitListener implements ExecutionListener {
|
||||
}
|
||||
return systemUserLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取委托人
|
||||
* @return
|
||||
*/
|
||||
private String getExecutor(){
|
||||
EntityWrapper<SystemOrg> orgEntityWrapper = new EntityWrapper<>();
|
||||
orgEntityWrapper.andNew().eq("is_deleted", false);
|
||||
orgEntityWrapper.andNew().eq("org_name", "战略规划部").or()
|
||||
.eq("org_name", "平台建设部").or()
|
||||
.eq("org_name", "市场发展部").or()
|
||||
.eq("org_name", "服务产品部");
|
||||
orgEntityWrapper.setSqlSelect("id_");
|
||||
List<Object> objectList = orgService.selectObjs(orgEntityWrapper);//先拿到部门集合ids
|
||||
if (!StringUtils.isEmpty(objectList)) {
|
||||
// 使用Streams将Object集合转换为Long集合
|
||||
List<Long> longs = objectList.stream()
|
||||
.map(obj -> (Long) obj) // 强制类型转换
|
||||
.collect(Collectors.toList());
|
||||
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
|
||||
flowsConfigurationEntityWrapper.eq("approved_role", "business");
|
||||
flowsConfigurationEntityWrapper.eq("is_deleted", false);
|
||||
flowsConfigurationEntityWrapper.in("org_id", longs);
|
||||
flowsConfigurationEntityWrapper.setSqlSelect("approver_id");
|
||||
List<Object> objectList1 = flowsConfigurationService.selectObjs(flowsConfigurationEntityWrapper);//拿到人事集合ids
|
||||
longs = objectList1.stream()
|
||||
.map(obj -> (Long) obj) // 强制类型转换
|
||||
.collect(Collectors.toList());
|
||||
EntityWrapper<SystemUserLogin> userLoginEntityWrapper = new EntityWrapper<>();
|
||||
userLoginEntityWrapper.eq("is_deleted", false);
|
||||
userLoginEntityWrapper.in("userinfo_id", longs);
|
||||
userLoginEntityWrapper.setSqlSelect("string_agg(id_::text,',')");
|
||||
return String.valueOf(userLoginService.selectObj(userLoginEntityWrapper));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,11 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProjectAssessmentIndicatorsDao extends BaseMapper<ProjectAssessmentIndicators> {
|
||||
@Update("update project_assessment_indicators set is_deleted='1' where project_id =#{id}")
|
||||
void updateByProjectId(Long id);
|
||||
List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page, @Param("indicators") ProjectAssessmentIndicators indicators);
|
||||
List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page, @Param("indicators") ProjectAssessmentIndicators indicators,@Param("userId") String userId);
|
||||
List<Map<String,Object>> getQuarterList(@Param("map") Map<String,Object> map);
|
||||
}
|
||||
|
@ -33,12 +33,27 @@
|
||||
number
|
||||
</sql>
|
||||
<select id="getList" resultType="com.xqopen.kehui.project.entity.ProjectAssessmentIndicators">
|
||||
select * from project_assessment_indicators where 1=1
|
||||
select * from project_assessment_indicators
|
||||
<where>
|
||||
is_deleted='0' and ext_->> 'executor' like CONCAT('%', #{userId}, '%')
|
||||
<if test="indicators.projectId!=null">
|
||||
and project_id =#{indicators.projectId}
|
||||
</if>
|
||||
<if test="indicators.id!=null">
|
||||
and id_=#{indicators.id}
|
||||
</if>
|
||||
<if test="indicators.quarter!=null">
|
||||
and quarter=#{indicators.quarter}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getQuarterList" resultType="java.util.Map">
|
||||
SELECT DISTINCT b.quarter,b.project_id as "projectId",b.avg, a.ext_ ->> 'taskName' as "taskName"
|
||||
from project_assessment_indicators a
|
||||
right join(SELECT quarter, AVG((ext_ ->> 'sum')::FLOAT), project_id
|
||||
from project_assessment_indicators
|
||||
WHERE project_id = #{map.projectId}
|
||||
and ext_ ->> 'executor' like CONCAT('%', #{map.userId}, '%')
|
||||
GROUP BY quarter, project_id) b on a.project_id = b.project_id and a.quarter = b.quarter
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -33,6 +33,8 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -56,12 +58,46 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
|
||||
@Autowired
|
||||
IFlowsConfigurationService flowsConfigurationService;
|
||||
|
||||
/**
|
||||
* 季度审核第二个页面,查看有多少个季度
|
||||
* @param userId
|
||||
* @param map
|
||||
* @return
|
||||
* @throws XQException
|
||||
*/
|
||||
@Override
|
||||
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_QUARTER_LIST)
|
||||
public String quarterList(@RequestHeader Long userId,@RequestBody Map<String,Object> map) throws XQException {
|
||||
try {
|
||||
// ProjectAssessmentIndicators indicators = pageNoUtil.getT();
|
||||
// EntityWrapper<ProjectAssessmentIndicators> wrapper = new EntityWrapper<>();
|
||||
// wrapper.eq("is_deleted","0");
|
||||
// Long projectId = indicators.getProjectId();
|
||||
// if(!ObjectUtils.isEmpty(projectId)){
|
||||
// wrapper.eq("project_id",projectId);
|
||||
// }
|
||||
// wrapper.and("ext_->> 'executor' like " + "'%" + userId + "%'");
|
||||
// wrapper.groupBy("quarter");
|
||||
// wrapper.groupBy("project_id");
|
||||
// wrapper.groupBy("ext_->>'taskName'");
|
||||
// wrapper.setSqlSelect("quarter,AVG((ext_->>'sum')::FLOAT),project_id,ext_->>'taskName' ");
|
||||
// List<Map<String, Object>> maps = indicatorsService.selectMaps(wrapper);
|
||||
map.put("userId",userId);
|
||||
map.put("projectId",Long.parseLong(String.valueOf(map.get("projectId"))));
|
||||
List<Map<String, Object>> maps = indicatorsService.getQuarterList(map);
|
||||
return ApiResponse.fillSuccess(new ResultListReqUtil<Map<String, Object>>(maps,maps.size(),0));
|
||||
}catch (Exception e){
|
||||
log.error("ProjectAssessmentIndicatorsController.quarterList", e);
|
||||
throw new XQException(ErrorCode.PROJECTINFO_EXCEPTION_ERROR, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@PostMapping(Api.PROJECT_QUARTERLY_EVALUATION_LIST)
|
||||
public String list(@RequestHeader Long userId, @RequestBody PageNoUtil<ProjectAssessmentIndicators> pageNoUtil) throws XQException {
|
||||
try {
|
||||
Page<ProjectAssessmentIndicators> page = new Page<>(pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
|
||||
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT());
|
||||
List<ProjectAssessmentIndicators> indicatorsServiceList = indicatorsService.getList(page, pageNoUtil.getT(),String.valueOf(userId));
|
||||
ResultListReqUtil<ProjectAssessmentIndicators> listReqUtil = new ResultListReqUtil<>(indicatorsServiceList, pageNoUtil.getPageNo(), pageNoUtil.getPageSize());
|
||||
return ApiResponse.fillSuccess(listReqUtil);
|
||||
} catch (Exception e) {
|
||||
@ -92,6 +128,34 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
|
||||
indicatorsService.updateById(indicators);
|
||||
}
|
||||
}
|
||||
//算出每个指标的平均数
|
||||
boolean isOffice= (boolean) ext.get("isOffice");
|
||||
if(isOffice){
|
||||
double sum=0;
|
||||
if(!StringUtils.isEmpty(sum)){
|
||||
double strategyScoring = ext.get("strategyScoring")==null?0:Double.valueOf((String) ext.get("strategyScoring")) ;
|
||||
double marketScoring = ext.get("marketScoring")==null?0:Double.valueOf((String) ext.get("marketScoring")) ;
|
||||
double platformScoring = ext.get("platformScoring")==null?0:Double.valueOf((String) ext.get("platformScoring")) ;
|
||||
double serviceScoring = ext.get("serviceScoring")==null?0:Double.valueOf((String) ext.get("serviceScoring")) ;
|
||||
ArrayList<Double> arrayList = new ArrayList<>();
|
||||
arrayList.add(serviceScoring);arrayList.add(strategyScoring);arrayList.add(marketScoring);arrayList.add(platformScoring);
|
||||
int index=0;
|
||||
for (int i = 0; i < arrayList.size(); i++) {
|
||||
if(arrayList.get(i)>0){
|
||||
index+=1;
|
||||
sum+=arrayList.get(i);
|
||||
}
|
||||
}
|
||||
if(sum>0){
|
||||
// sum=arrayList.stream().collect(Collectors.averagingDouble(x -> x));
|
||||
sum=sum/index;
|
||||
DecimalFormat df = new DecimalFormat("#.0");
|
||||
String result = df.format(sum);
|
||||
sum = Double.parseDouble(result);
|
||||
}
|
||||
ext.put("sum",sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (indicatorsService.updateById(indicators)) return ApiResponse.fillSuccess("操作成功!");
|
||||
}
|
||||
@ -207,7 +271,14 @@ public class ProjectAssessmentIndicatorsController implements ProjectAssessmentI
|
||||
return ApiResponse.fillFail("获取当前负责人失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据人事id返回是四个业务部那个部门的主任
|
||||
* @param id
|
||||
* @return
|
||||
* @throws XQException
|
||||
*/
|
||||
@Override
|
||||
@GetMapping(Api.PROJECT_QUARTERLY_EVALUATION_GETBUSINESS)
|
||||
public String getBusinessByUserInfoId(@PathVariable String id) throws XQException{
|
||||
try {
|
||||
EntityWrapper<FlowsConfiguration> flowsConfigurationEntityWrapper = new EntityWrapper<>();
|
||||
|
@ -143,10 +143,12 @@ public class ProjectInitComtroller implements ProjectInitApi {
|
||||
String projectAdmin= String.valueOf(((ArrayList) ext.get("projectAdmin")).get(1));
|
||||
String branchLeaders= String.valueOf(((ArrayList) ext.get("branchLeaders")).get(1));
|
||||
String MainLeader= String.valueOf(((ArrayList) ext.get("MainLeader")).get(1));
|
||||
|
||||
String projectManagerData = String.valueOf(((ArrayList) ext.get("projectManagerData")).get(1));
|
||||
List<ProjectAssessmentIndicators> membersList = initDto.getMembersList();
|
||||
if (!membersList.isEmpty()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("executor",getSystemUserLogin(projectManagerData).getId());//第一个节点执行人一定是项目负责人
|
||||
jsonObject.put("taskName","季度审核填报");
|
||||
jsonObject.put("projectAdmin",getSystemUserLogin(projectAdmin).getId());
|
||||
jsonObject.put("branchLeaders",getSystemUserLogin(branchLeaders).getId());
|
||||
jsonObject.put("MainLeader",getSystemUserLogin(MainLeader).getId());
|
||||
|
@ -49,7 +49,6 @@ public class ProjectQuarterlyEvaluationController implements ProjectQuarterlyEva
|
||||
evaluationEntityWrapper.eq("is_deleted", "0");
|
||||
// evaluationEntityWrapper.and("ext_->> 'executor'= " + "'" + userId + "'");
|
||||
evaluationEntityWrapper.and("ext_->> 'executor' like " + "'%" + userId + "%'");
|
||||
evaluationEntityWrapper.and("ext_->> 'taskName'!='流程结束'");
|
||||
//根据当前执行人查询
|
||||
// evaluationEntityWrapper.andNew()
|
||||
// .eq("created_by", String.valueOf(systemUserLogin.getUserinfoId()))
|
||||
|
@ -14,6 +14,12 @@ import java.util.Map;
|
||||
|
||||
@Api(value = "季度考核指标管理", tags = Constants.MODULE_PROJECT, description = "项目模块")
|
||||
public interface ProjectAssessmentIndicatorsApi {
|
||||
@ApiOperation(value = "根据项目获取季度列表", notes = "根据项目获取季度列表", response = ProjectAchievementResp.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "header", dataType = "Long"),
|
||||
})
|
||||
String quarterList(Long userId,Map<String,Object> map) throws XQException;
|
||||
@ApiOperation(value = "获取季度考核指标列表", notes = "获取季度考核指标列表", response = ProjectAchievementResp.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "登录标识符", required = true, paramType = "header", dataType = "String"),
|
||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.service.IService;
|
||||
import com.xqopen.kehui.project.entity.ProjectAssessmentIndicators;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IProjectAssessmentIndicatorsService extends IService<ProjectAssessmentIndicators> {
|
||||
/**
|
||||
@ -12,5 +13,12 @@ public interface IProjectAssessmentIndicatorsService extends IService<ProjectAss
|
||||
* @param id
|
||||
*/
|
||||
void updateByProjectId(Long id);
|
||||
List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page,ProjectAssessmentIndicators indicators);
|
||||
List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page,ProjectAssessmentIndicators indicators,String userId);
|
||||
|
||||
/**
|
||||
* 通过项目id、当前执行人拿到项目季度指标并进行平均分
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getQuarterList(Map<String,Object> map);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class IProjectInitServiceImpl extends ServiceImpl<ProjectAssessmentIndicatorsDao, ProjectAssessmentIndicators> implements IProjectAssessmentIndicatorsService {
|
||||
@ -20,7 +21,12 @@ public class IProjectInitServiceImpl extends ServiceImpl<ProjectAssessmentIndica
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page, ProjectAssessmentIndicators indicators) {
|
||||
return indicatorsDao.getList(page,indicators);
|
||||
public List<ProjectAssessmentIndicators> getList(Page<ProjectAssessmentIndicators> page, ProjectAssessmentIndicators indicators,String userId) {
|
||||
return indicatorsDao.getList(page,indicators,userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getQuarterList(Map<String, Object> map) {
|
||||
return indicatorsDao.getQuarterList(map);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user