Commit 74a4a493 authored by nie'hong's avatar nie'hong

优化

parent 82c188ac
......@@ -58,7 +58,9 @@ public enum BASE_RESP_CODE_ENUM {
TIME_NOT_IS_NULL("636","工时不能为0"),
WORKDAY_NOT_NULL("637","工时日期不能为空"),
PROJECT_NOT_NULL("638","项目类型不能为空"),
NOT_MANAGER_TYPE("642","没有可以管理的类型项目"),
NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD("639","新密码不能与旧密码相同"),
PASSWORD_FORMAT_ERROR("640","密码由6到16位数字和字母组成"),
NOT_MANAGER_TYPE("642","没有可以管理的类型项目");
......
......@@ -57,7 +57,7 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
*/
Integer getCountByCondition(Map<String, Object> map);
List<WorkTimeAndCostCollect> getWorkTimeAndCostCollect(@Param("projectIds") List<Integer> projectIds, @Param("firstDayOfMonth") Date firstDayOfMonth);
List<WorkTimeAndCostCollect> getWorkTimeAndCostCollect(@Param("projectIds") List<Integer> projectIds, @Param("firstDayOfMonth") String firstDayOfMonth);
/**
* 获取上班日期集合
......
......@@ -32,16 +32,16 @@
<if test="id != null">and id = #{id}</if>
<if test="oaProjectId != null">and oa_project_id = #{oaProjectId}</if>
<if test="projectName != null">and project_name = #{projectName}</if>
<if test="type != null">and type =#{type}</if>
<if test="type != null">and `type` =#{type}</if>
<if test="managerId != null">and manager_id = #{managerId}</if>
<if test="dept_id != null">and dept_id = #{dept_id}</if>
<if test="deptId != null">and dept_id = #{deptId}</if>
<if test="workTime != null">and work_time =#{workTime}</if>
<if test="costBudget != null">and cost_budget = #{costBudget}</if>
<if test="isConclusion != null">and is_onclusion =#{isConclusion},</if>
<if test="startTime != null">and start_time =#{startTime},</if>
<if test="endTime != null">and end_time =#{endTime},</if>
<if test="isConclusion != null">and is_onclusion =#{isConclusion}</if>
<if test="startTime != null">and start_time =#{startTime}</if>
<if test="endTime != null">and end_time =#{endTime}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="modifyTime != null">and #{modifyTime} &gt;= modify_time</if>
<if test="modifyTime != null">and modify_time &gt;= modifyTime</if>
</sql>
<select id="getProjectsByCriteria" resultMap="BaseResultMap" parameterType="map">
......
......@@ -186,9 +186,9 @@
#{projectId}
</foreach>
<if test="firstDayOfMonth != null">
AND work_day >= date(#{firstDayOfMonth})
AND work_day >= #{firstDayOfMonth}
</if>
group by `type`,dept_id, project_id
group by case when `type`= 1 then '商机' when `type`= 0 then '项目' end,dept_id, project_id
</select>
<select id="getDaysByDateAndStatus" resultType="date" >
......
......@@ -8,8 +8,6 @@ public enum ProjectTypeEnum {
EXTERNAL_BUSINESS(5, "外部商务与技术交流", 3),
INTERNAL_TRAINING(6, "内部培训、技术准备、管理", 3),
OTHER_NON_PROJECTS(7, "其他非项目/商机工作", 3),
;
private Integer type;
......
......@@ -4,7 +4,6 @@ import cn.wisenergy.model.dto.GetMonthlyCollectParam;
import cn.wisenergy.model.dto.WorkTimeAndCostCollect;
import com.github.pagehelper.PageInfo;
import java.util.Date;
import java.util.List;
public interface StatisticsService {
......@@ -27,5 +26,5 @@ public interface StatisticsService {
* 获取负责项目在本月的工时汇总:花费工时,工时成本
* @param userId
*/
List<WorkTimeAndCostCollect> getCurrentMonthWorkTimeCollect(Integer userId, Date startTime);
List<WorkTimeAndCostCollect> getCurrentMonthWorkTimeCollect(Integer userId, String startTime);
}
......@@ -184,14 +184,14 @@ public class StatisticsServiceImpl implements StatisticsService {
Integer countByCondition = workTimeOrderMapper.getCountByCondition(map);
String currentDayOfMonth = DateUtil.convertDateToYMDStr(firstDayOfMonth);
//统计项目类型工单填报次数、总工时
MonthlyWorkingHoursStatistics statistics1 = workTimeOrderMapper.statisticsByProjectType(userId, ProjectTypeEnum.PROJECT.getCode(), currentDayOfMonth);
statistics1.setProjectType(ProjectTypeEnum.PROJECT.getMsg());
MonthlyWorkingHoursStatistics statistics1 = workTimeOrderMapper.statisticsByProjectType(userId, ProjectTypeEnum.PROJECT.getType(), currentDayOfMonth);
statistics1.setProjectType(ProjectTypeEnum.PROJECT.getTypeName());
statistics1.setNotFilledCount(notFilledCount);
statistics1.setRejectCount(countByCondition);
statisticsArrayList.add(statistics1);
//统计商机类型工单填报次数、总工时
MonthlyWorkingHoursStatistics statistics2 = workTimeOrderMapper.statisticsByProjectType(userId, ProjectTypeEnum.BUSINESS_OPPORTUNITY.getCode(), currentDayOfMonth);
statistics2.setProjectType(ProjectTypeEnum.BUSINESS_OPPORTUNITY.getMsg());
MonthlyWorkingHoursStatistics statistics2 = workTimeOrderMapper.statisticsByProjectType(userId, ProjectTypeEnum.BUSINESS_OPPORTUNITY.getType(), currentDayOfMonth);
statistics2.setProjectType(ProjectTypeEnum.BUSINESS_OPPORTUNITY.getTypeName());
statistics2.setNotFilledCount(notFilledCount);
statistics2.setRejectCount(countByCondition);
statisticsArrayList.add(statistics2);
......@@ -201,7 +201,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
@Override
public List<WorkTimeAndCostCollect> getCurrentMonthWorkTimeCollect(Integer userId, Date startTime) {
public List<WorkTimeAndCostCollect> getCurrentMonthWorkTimeCollect(Integer userId, String startTime) {
log.info("StatisticsServiceImpl[]getCurrentMonthWorkTimeCollect[]input.param" + userId + startTime);
if (userId == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
......@@ -212,11 +212,12 @@ public class StatisticsServiceImpl implements StatisticsService {
}
//查询用户管理的项目
List<WorkProject> userManageProjects = workProjectService.getUserManageProjects(userId);
//获取项目集合中所有项目的项目主键
List<Integer> projectIds = userManageProjects.stream().map(WorkProject::getId).collect(Collectors.toList());
if (CollectionUtil.isEmpty(projectIds)) {
if (CollectionUtil.isEmpty(userManageProjects)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.MANAGER_NOT_PROJECT);
}
//获取项目集合中所有项目的项目主键
List<Integer> projectIds = userManageProjects.stream().map(WorkProject::getId).collect(Collectors.toList());
List<WorkTimeAndCostCollect> collect = workTimeOrderMapper.getWorkTimeAndCostCollect(projectIds, startTime);
for (WorkTimeAndCostCollect timeAndCostCollect : collect) {
//部门名称
......
......@@ -72,6 +72,15 @@ public class WorkUserServiceImpl implements WorkUserService {
if (userId == null || StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
//校验新密码类型
String regex = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$";
if (!newPassword.matches(regex)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.PASSWORD_FORMAT_ERROR);
}
//新密码与旧密码相同
if (oldPassword.equals(newPassword)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD);
}
//根据主键和密码查找
Map<String, Object> map = new HashMap<>();
map.put("id", userId);
......
......@@ -15,12 +15,10 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
/**
......@@ -58,7 +56,7 @@ public class StatisticsController extends BaseController {
@ApiOperation(value = "获取负责项目工时汇总", notes = "获取负责项目工时汇总")
@GetMapping("/getCurrentMonthWorkTimeCollect")
public List<WorkTimeAndCostCollect> getWorkTimeCollect(Integer userId,@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime) {
public List<WorkTimeAndCostCollect> getWorkTimeCollect(Integer userId,String startTime) {
log.info("WorkUserController[]getCurrentMonthWorkTimeCollect[]input.param" + userId,startTime);
if (userId == null) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
......
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