包头bug修改

This commit is contained in:
guoshengxiong 2025-03-12 19:52:47 +08:00
parent c6b5c073eb
commit b4e545e2f5
14 changed files with 175 additions and 57 deletions

View File

@ -73,6 +73,9 @@ public class PlanMilestone2Left implements Serializable {
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private java.lang.Integer sort; private java.lang.Integer sort;
@ApiModelProperty(value = "1非关键路径@2关键路径")
@Deprecated
private java.lang.Integer keyType;
@TableField(exist = false) @TableField(exist = false)
private List<PlanMilestone2Left> children; private List<PlanMilestone2Left> children;
@TableField(exist = false) @TableField(exist = false)

View File

@ -91,10 +91,10 @@ public class PlanMilestone2Right implements Serializable {
@ApiModelProperty(value = "1使用开始时间2使用结束时间") @ApiModelProperty(value = "1使用开始时间2使用结束时间")
private Integer useTimeType; private Integer useTimeType;
@TableField(exist = false)
/** /**
* 1项目2装置 * 1项目2装置
*/ */
@TableField(exist = false)
@ApiModelProperty(value = "1项目2装置") @ApiModelProperty(value = "1项目2装置")
private Integer type; private Integer type;
} }

View File

@ -1,41 +1,33 @@
package com.zhgd.xmgl.modules.baotou.plan.controller; package com.zhgd.xmgl.modules.baotou.plan.controller;
import java.util.Date; import java.util.Date;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.plan.entity.*; import com.zhgd.xmgl.modules.baotou.plan.entity.*;
import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanRecordMapper; import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanRecordMapper;
import com.zhgd.xmgl.modules.baotou.plan.service.*; import com.zhgd.xmgl.modules.baotou.plan.service.*;
import com.zhgd.xmgl.modules.exam.entity.ExamCourse;
import com.zhgd.xmgl.modules.stuff.entity.StuffType;
import com.zhgd.xmgl.util.ListUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.jetbrains.annotations.NotNull;
import org.simpleframework.xml.core.Validate; import org.simpleframework.xml.core.Validate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.sound.midi.VoiceStatus;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -424,5 +416,67 @@ public class PlanRecordController {
// return Result.ok(); // return Result.ok();
// } // }
// /**
// * 插入wbs
// * @param param
// * @return
// */
// @GetMapping(value = "/insertRecord")
// public Result insertRecord(@ApiIgnore @RequestParam HashMap<String, Object> param) {
// List<Long> pbsIds = Arrays.asList(
// 1899402098676719618L,
// 1899714771542614017L,
// 1899715227954192386L,
// 1899715302071738370L,
// 1899715375648219138L,
// 1899715445105893377L,
// 1899715580598689794L
// );
// List<Long> cids = planPbsService.list(new LambdaQueryWrapper<PlanPbs>()
// .in(PlanPbs::getParentId, pbsIds)).stream().map(PlanPbs::getId).collect(Collectors.toList());
// for (Long cid : cids) {
// List<PlanRecord> records = planRecordService.list(new LambdaQueryWrapper<PlanRecord>()
// .eq(PlanRecord::getPbsId, cid));
// if (CollUtil.isNotEmpty(records)) {
// continue;
// }
// planRecordService.add(getPlanRecord("详细设计", new BigDecimal("10"), 0L, cid, 0));
// PlanRecord 采购 = getPlanRecord("采购", new BigDecimal("35"), 0L, cid, 1);
// planRecordService.add(采购);
// planRecordService.add(getPlanRecord("设备", null, 采购.getId(), cid, 2));
// planRecordService.add(getPlanRecord("材料", null, 采购.getId(), cid, 3));
// PlanRecord 施工 = getPlanRecord("施工", new BigDecimal("50"), 0L, cid, 4);
// planRecordService.add(施工);
// planRecordService.add(getPlanRecord("土建", null, 施工.getId(), cid, 5));
// planRecordService.add(getPlanRecord("安装", null, 施工.getId(), cid, 6));
// planRecordService.add(getPlanRecord("试车", new BigDecimal("5"), 0L, cid, 7));
//
// }
// return Result.ok();
// }
//
// @NotNull
// private PlanRecord getPlanRecord(String jobName, BigDecimal weightRate, long parentId, long pbsId, int sort) {
// PlanRecord record = new PlanRecord();
// record.setProjectSn("5B8B3DB047214AE188F2C7916DD08203");
// record.setCode(jobName);
// record.setJobName(jobName);
// record.setPlannedStart(new Date());
// record.setPlannedFinish(new Date());
// record.setActualStart(new Date());
// record.setActualFinish(new Date());
// record.setExpectedFinish(new Date());
// record.setWeightRate(weightRate);
// record.setCtlLevel(1);
// record.setCreateTime(new Date());
// record.setUpdateTime(new Date());
// record.setWorkType(2);
// record.setParentId(parentId);
// record.setAncestors("0");
// record.setPbsId(pbsId);
// record.setSort(sort);
// return record;
// }
} }

View File

@ -48,8 +48,12 @@ public class PlanJoinPerson implements Serializable {
*/ */
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private java.lang.Long userId; private java.lang.Long userId;
@ApiModelProperty(value = "psbId") @ApiModelProperty(value = "psbId有psbId可以看到pbs和wbs的内容但是wbs不能修改他")
private java.lang.Long pbsId; private java.lang.Long pbsId;
@ApiModelProperty(value = "wbsId")
private java.lang.Long wbsId;
@ApiModelProperty(value = "1psb2wbs")
private java.lang.Integer type;
/** /**
* 1仅查看 * 1仅查看
*/ */

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.baotou.plan.entity; package com.zhgd.xmgl.modules.baotou.plan.entity;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -70,11 +71,11 @@ public class PlanPbs implements Serializable {
@ApiModelProperty(value = "实际完成") @ApiModelProperty(value = "实际完成")
private java.util.Date actualFinish; private java.util.Date actualFinish;
/** /**
* 权重 * 权重百分比
*/ */
@Excel(name = "权重", width = 15) @Excel(name = "权重百分比", width = 15)
@ApiModelProperty(value = "权重") @ApiModelProperty(value = "权重百分比")
private java.lang.Integer weightValue; private BigDecimal weightValue;
/** /**
* 创建日期 * 创建日期
*/ */

View File

@ -87,7 +87,7 @@ public class PlanRecord implements Serializable {
* 权重 * 权重
*/ */
@ApiModelProperty(value = "权重") @ApiModelProperty(value = "权重")
private java.math.BigDecimal weight; private java.math.BigDecimal weightRate;
/** /**
* 管控层级:1一2二3三级 * 管控层级:1一2二3三级
@ -195,12 +195,6 @@ public class PlanRecord implements Serializable {
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "计划完成百分比") @ApiModelProperty(value = "计划完成百分比")
private java.math.BigDecimal planCompleteRate; private java.math.BigDecimal planCompleteRate;
/**
* 权重百分比
*/
@TableField(exist = false)
@ApiModelProperty(value = "权重百分比")
private java.math.BigDecimal weightRate;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "审批通过的最新的feedBackId") @ApiModelProperty(value = "审批通过的最新的feedBackId")

View File

@ -1,28 +1,27 @@
package com.zhgd.xmgl.modules.baotou.plan.mapper; package com.zhgd.xmgl.modules.baotou.plan.mapper;
import java.util.List;
import java.util.HashMap;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanJoinPerson;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanJoinPerson;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanJoinPerson;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.HashMap;
import java.util.List;
/** /**
* @Description: 进度参与人员 * @Description: 进度参与人员
* @author pds * @author pds
* @date 2024-11-28 * @date 2024-11-28
* @version V1.0 * @version V1.0
*/ */
@Mapper @Mapper
public interface PlanJoinPersonMapper extends BaseMapper<PlanJoinPerson> { public interface PlanJoinPersonMapper extends BaseMapper<PlanJoinPerson> {
/** /**
* 分页列表查询进度参与人员信息 * 分页列表查询进度参与人员信息
* *
* @param page * @param page
@ -49,4 +48,12 @@ public interface PlanJoinPersonMapper extends BaseMapper<PlanJoinPerson> {
* @return * @return
*/ */
PlanJoinPerson queryById(String id); PlanJoinPerson queryById(String id);
/**
* 通过wbsId查询pbsId的所有数据
*
* @param wbsId
* @return
*/
List<String> queryIdsByWbsId(String wbsId);
} }

View File

@ -8,7 +8,7 @@
,if(d.person_type=1,wt.type_name,di.department_name) as post_work_type_name ,if(d.person_type=1,wt.type_name,di.department_name) as post_work_type_name
,pp.name as pbs_name ,pp.name as pbs_name
from plan_join_person t from plan_join_person t
left join system_user su on su.user_id=t.user_id join system_user su on su.user_id=t.user_id
LEFT JOIN worker_info d ON su.worker_id = d.id LEFT JOIN worker_info d ON su.worker_id = d.id
LEFT JOIN team_info ti ON d.team_id = ti.id and d.person_type=1 LEFT JOIN team_info ti ON d.team_id = ti.id and d.person_type=1
LEFT JOIN department_info di ON d.department_id = di.id and d.person_type=2 LEFT JOIN department_info di ON d.department_id = di.id and d.person_type=2
@ -24,7 +24,7 @@
,if(d.person_type=1,wt.type_name,di.department_name) as post_work_type_name ,if(d.person_type=1,wt.type_name,di.department_name) as post_work_type_name
,pp.name as pbs_name ,pp.name as pbs_name
from plan_join_person t from plan_join_person t
left join system_user su on su.user_id=t.user_id join system_user su on su.user_id=t.user_id
LEFT JOIN worker_info d ON su.worker_id = d.id LEFT JOIN worker_info d ON su.worker_id = d.id
LEFT JOIN team_info ti ON d.team_id = ti.id and d.person_type=1 LEFT JOIN team_info ti ON d.team_id = ti.id and d.person_type=1
LEFT JOIN department_info di ON d.department_id = di.id and d.person_type=2 LEFT JOIN department_info di ON d.department_id = di.id and d.person_type=2
@ -33,4 +33,11 @@
)t )t
where t.id = #{id} where t.id = #{id}
</select> </select>
<select id="queryIdsByWbsId" resultType="java.lang.String">
select t.id
from plan_join_person t
join plan_record p2 on p2.pbs_id = t.pbs_id
where p2.id=#{wbsId}
</select>
</mapper> </mapper>

View File

@ -6,7 +6,6 @@
select * from ( select * from (
select t.* select t.*
,su.real_name as charger_name ,su.real_name as charger_name
,ifnull(round(t.weight*100,2),0) weight_rate
from plan_record t from plan_record t
left join system_user su on su.user_id=t.charger_id left join system_user su on su.user_id=t.charger_id
where 1=1 where 1=1

View File

@ -1,9 +1,11 @@
package com.zhgd.xmgl.modules.baotou.plan.service.impl; package com.zhgd.xmgl.modules.baotou.plan.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanJoinPerson; import com.zhgd.xmgl.modules.baotou.plan.entity.PlanJoinPerson;
import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanJoinPersonMapper; import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanJoinPersonMapper;
import com.zhgd.xmgl.modules.baotou.plan.service.IPlanJoinPersonService; import com.zhgd.xmgl.modules.baotou.plan.service.IPlanJoinPersonService;
import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -11,8 +13,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.zhgd.xmgl.util.RefUtil; import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +49,14 @@ public class PlanJoinPersonServiceImpl extends ServiceImpl<PlanJoinPersonMapper,
private QueryWrapper<PlanJoinPerson> getQueryWrapper(HashMap<String, Object> param) { private QueryWrapper<PlanJoinPerson> getQueryWrapper(HashMap<String, Object> param) {
QueryWrapper<PlanJoinPerson> queryWrapper = QueryGenerator.initPageQueryWrapper(PlanJoinPerson.class, param, true); QueryWrapper<PlanJoinPerson> queryWrapper = QueryGenerator.initPageQueryWrapper(PlanJoinPerson.class, param, true);
String type = MapUtils.getString(param, "type");
if (Objects.equals(type, "2")) {
//wps也查询pbs分配了的
// List<String> ids = baseMapper.queryIdsByWbsId(MapUtils.getString(param,"wbsId"));
// if (CollUtil.isNotEmpty(ids)) {
// queryWrapper.lambda().or(eq -> eq.in(PlanJoinPerson::getId, ids));
// }
}
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(PlanJoinPerson::getId)); queryWrapper.orderByDesc(RefUtil.fieldNameUlc(PlanJoinPerson::getId));
return queryWrapper; return queryWrapper;
} }

View File

@ -131,7 +131,6 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
} else { } else {
record.setStatus(2); record.setStatus(2);
} }
record.setWeightRate(record.getWeight() != null ? NumberUtil.mul(record.getWeight(), new BigDecimal("100")) : null);
} }
} }
return list; return list;
@ -178,7 +177,6 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
if (oldPlanRecord == null) { if (oldPlanRecord == null) {
throw new OpenAlertException("未找到计划编制数据"); throw new OpenAlertException("未找到计划编制数据");
} }
planRecord.setWeight(NumberUtil.div(planRecord.getWeightRate(), new BigDecimal("100")));
if (DateUtil.compare(planRecord.getPlannedStart(), oldPlanRecord.getPlannedStart()) != 0 || DateUtil.compare(planRecord.getPlannedFinish(), oldPlanRecord.getPlannedFinish()) != 0) { if (DateUtil.compare(planRecord.getPlannedStart(), oldPlanRecord.getPlannedStart()) != 0 || DateUtil.compare(planRecord.getPlannedFinish(), oldPlanRecord.getPlannedFinish()) != 0) {
int count = planFeedbackService.count(new LambdaQueryWrapper<PlanFeedback>() int count = planFeedbackService.count(new LambdaQueryWrapper<PlanFeedback>()
.eq(PlanFeedback::getRecordId, planRecord.getId())); .eq(PlanFeedback::getRecordId, planRecord.getId()));
@ -252,7 +250,6 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
} }
PlanCalendarTemplate calendar = planCalendarTemplateService.getDefaultCalendar(entity.getProjectSn()); PlanCalendarTemplate calendar = planCalendarTemplateService.getDefaultCalendar(entity.getProjectSn());
entity.setPlannedDuration(planCalendarTemplateService.calDuration(calendar, entity.getPlannedStart(), entity.getPlannedFinish())); entity.setPlannedDuration(planCalendarTemplateService.calDuration(calendar, entity.getPlannedStart(), entity.getPlannedFinish()));
entity.setWeightRate(entity.getWeight() != null ? NumberUtil.mul(entity.getWeight(), new BigDecimal("100")) : null);
return entity; return entity;
} }
@ -537,8 +534,8 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
//按权重求和 //按权重求和
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue(); PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeight()); BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), NumberUtil.div(record.getWeightRate(), new BigDecimal("100")));
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeight()); BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), NumberUtil.div(record.getWeightRate(), new BigDecimal("100")));
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart()); PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) { if (p == null) {
p = ObjectUtil.cloneByStream(fp); p = ObjectUtil.cloneByStream(fp);
@ -555,8 +552,8 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
startMap1 = this.addActualCompleteRate(child, ridRateMap, milestones, planPeriod, planRecords, recordIdMap, fbPeriods, allVals); startMap1 = this.addActualCompleteRate(child, ridRateMap, milestones, planPeriod, planRecords, recordIdMap, fbPeriods, allVals);
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue(); PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeight()); BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), NumberUtil.div(record.getWeightRate(), new BigDecimal("100")));
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeight()); BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), NumberUtil.div(record.getWeightRate(), new BigDecimal("100")));
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart()); PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) { if (p == null) {
p = ObjectUtil.cloneByStream(fp); p = ObjectUtil.cloneByStream(fp);
@ -572,13 +569,13 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
//计算百分比 //计算百分比
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) {
PlanFeedbackPeriod period = entry.getValue(); PlanFeedbackPeriod period = entry.getValue();
if (child.getWeight() != null && BigDecimal.ZERO.compareTo(child.getWeight()) != 0) { if (child.getWeightRate() != null && BigDecimal.ZERO.compareTo(child.getWeightRate()) != 0) {
if (record.getWeight() == null || record.getWeight().compareTo(BigDecimal.ZERO) == 0) { if (record.getWeightRate() == null || record.getWeightRate().compareTo(BigDecimal.ZERO) == 0) {
period.setPlanPer(BigDecimal.ZERO); period.setPlanPer(BigDecimal.ZERO);
period.setActualPer(BigDecimal.ZERO); period.setActualPer(BigDecimal.ZERO);
} else { } else {
period.setPlanPer(NumberUtil.mul(NumberUtil.div(period.getPlanYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setPlanPer(NumberUtil.div(period.getPlanYdz(), record.getWeightRate(), 2));
period.setActualPer(NumberUtil.mul(NumberUtil.div(period.getActualYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setActualPer(NumberUtil.div(period.getActualYdz(), record.getWeightRate(), 2));
} }
} }
} }
@ -732,10 +729,10 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
pp = NumberUtil.add(pp, NumberUtil.mul(val.getPlanVal(), weight)); pp = NumberUtil.add(pp, NumberUtil.mul(val.getPlanVal(), weight));
ap = NumberUtil.add(ap, NumberUtil.mul(val.getActualVal(), weight)); ap = NumberUtil.add(ap, NumberUtil.mul(val.getActualVal(), weight));
} }
period.setPlanYdz(NumberUtil.mul(pp, record.getWeight(), new BigDecimal("0.01"))); period.setPlanYdz(record.getWeightRate());
period.setActualYdz(NumberUtil.mul(ap, record.getWeight(), new BigDecimal("0.01"))); period.setActualYdz(record.getWeightRate());
period.setPlanPer((record.getWeight() == null || NumberUtil.equals(record.getWeight(), BigDecimal.ZERO)) ? BigDecimal.ZERO : NumberUtil.mul(NumberUtil.div(period.getPlanYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setPlanPer((record.getWeightRate() == null || NumberUtil.equals(record.getWeightRate(), BigDecimal.ZERO)) ? BigDecimal.ZERO : NumberUtil.div(period.getPlanYdz(), record.getWeightRate(), 2));
period.setActualPer((record.getWeight() == null || NumberUtil.equals(record.getWeight(), BigDecimal.ZERO)) ? BigDecimal.ZERO : NumberUtil.mul(NumberUtil.div(period.getActualYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setActualPer((record.getWeightRate() == null || NumberUtil.equals(record.getWeightRate(), BigDecimal.ZERO)) ? BigDecimal.ZERO : NumberUtil.div(period.getActualYdz(), record.getWeightRate(), 2));
} }
/** /**
@ -826,8 +823,8 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
//按权重求和 //按权重求和
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue(); PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeight()); BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeightRate());
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeight()); BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeightRate());
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart()); PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) { if (p == null) {
p = ObjectUtil.cloneByStream(fp); p = ObjectUtil.cloneByStream(fp);
@ -843,8 +840,8 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
startMap1 = this.getChildFeedbackPeriodMap(child, planRecords, milestones, planPeriod, recordIdMap, fbPeriods, allVals); startMap1 = this.getChildFeedbackPeriodMap(child, planRecords, milestones, planPeriod, recordIdMap, fbPeriods, allVals);
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap1.entrySet()) {
PlanFeedbackPeriod fp = entry.getValue(); PlanFeedbackPeriod fp = entry.getValue();
BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeight()); BigDecimal pydz = NumberUtil.mul(fp.getPlanYdz(), record.getWeightRate());
BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeight()); BigDecimal aydz = NumberUtil.mul(fp.getActualYdz(), record.getWeightRate());
PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart()); PlanFeedbackPeriod p = startMap.get(fp.getPeriodStart());
if (p == null) { if (p == null) {
p = ObjectUtil.cloneByStream(fp); p = ObjectUtil.cloneByStream(fp);
@ -860,9 +857,9 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
//计算百分比 //计算百分比
for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) { for (Map.Entry<Date, PlanFeedbackPeriod> entry : startMap.entrySet()) {
PlanFeedbackPeriod period = entry.getValue(); PlanFeedbackPeriod period = entry.getValue();
if (record.getWeight() != null && BigDecimal.ZERO.compareTo(record.getWeight()) != 0) { if (record.getWeightRate() != null && BigDecimal.ZERO.compareTo(record.getWeightRate()) != 0) {
period.setPlanPer(NumberUtil.mul(NumberUtil.div(period.getPlanYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setPlanPer(NumberUtil.div(period.getPlanYdz(), record.getWeightRate(), 2));
period.setActualPer(NumberUtil.mul(NumberUtil.div(period.getActualYdz(), record.getWeight(), 2), new BigDecimal("100"))); period.setActualPer(NumberUtil.div(period.getActualYdz(), record.getWeightRate(), 2));
} }
} }
} }

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gexin.fastjson.TypeReference; import com.gexin.fastjson.TypeReference;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.entity.UserDevGroup; import com.zhgd.xmgl.modules.baotou.entity.UserDevGroup;
import com.zhgd.xmgl.modules.baotou.service.IProjectGroupService; import com.zhgd.xmgl.modules.baotou.service.IProjectGroupService;
import com.zhgd.xmgl.modules.baotou.service.IUserDevGroupService; import com.zhgd.xmgl.modules.baotou.service.IUserDevGroupService;
@ -32,9 +33,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -67,6 +70,9 @@ public class SystemUserController {
@Lazy @Lazy
@Autowired @Autowired
private UserDevAuthorityServiceImpl userDevAuthorityService; private UserDevAuthorityServiceImpl userDevAuthorityService;
@Lazy
@Autowired
private PasswordEncoder passwordEncoder;
/** /**
* 添加 * 添加
@ -99,7 +105,7 @@ public class SystemUserController {
@OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息") @OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息")
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST") @ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<SystemUser> edit(@RequestBody SystemUser systemUser) { public Result edit(@RequestBody SystemUser systemUser) {
systemUserService.editSystemUser(systemUser); systemUserService.editSystemUser(systemUser);
return Result.ok(); return Result.ok();
} }
@ -113,7 +119,7 @@ public class SystemUserController {
@OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息") @OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息")
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST") @ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST")
@PostMapping(value = "/editProjectUser") @PostMapping(value = "/editProjectUser")
public Result<SystemUser> editProjectUser(@RequestBody SystemUser systemUser) { public Result editProjectUser(@RequestBody SystemUser systemUser) {
systemUserService.editProjectUser(systemUser); systemUserService.editProjectUser(systemUser);
return Result.ok(); return Result.ok();
} }
@ -449,4 +455,31 @@ public class SystemUserController {
return Result.ok(); return Result.ok();
} }
@OperLog(operModul = "账号管理", operType = "第一次修改用户密码", operDesc = "第一次修改用户密码")
@ApiOperation(value = "第一次修改用户密码", notes = "第一次修改用户密码", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "passWord", required = true, value = "新密码", paramType = "body"),
@ApiImplicitParam(name = "oldPassWord", required = true, value = "旧密码", paramType = "body"),
@ApiImplicitParam(name = "account", required = true, value = "账号", paramType = "body"),
})
@PostMapping(value = "/updateUserPassWordFirst")
public Result updateUserPassWordFirst(@RequestBody Map<String, Object> map) {
String oldPassWord = MapUtils.getString(map, "oldPassWord");
String account = MapUtils.getString(map, "account");
String passWord = MapUtils.getString(map, "passWord");
SystemUser user = systemUserService.getOne(new LambdaQueryWrapper<SystemUser>()
.eq(SystemUser::getAccount, account));
if (!user.getShowPassword().equals(oldPassWord)) {
throw new OpenAlertException("原密码错误");
}
SystemUser systemUser = new SystemUser();
systemUser.setUserId(SecurityUtils.getUser().getUserId());
systemUser.setPassword(passwordEncoder.encode(passWord));
systemUser.setShowPassword(passWord);
systemUser.setPwUpdateTime(new Date());
systemUser.setIsFirstLogin(0);
systemUserService.updateById(systemUser);
return Result.ok();
}
} }

View File

@ -162,6 +162,8 @@ public class SystemUser implements Serializable {
*/ */
@ApiModelProperty(value = "创建用户ancestor") @ApiModelProperty(value = "创建用户ancestor")
private java.lang.String createUserAncestor; private java.lang.String createUserAncestor;
@ApiModelProperty(value = "1是第一次登录0不是第一次登录")
private java.lang.Integer isFirstLogin;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "角色ID多个分割") @ApiModelProperty(value = "角色ID多个分割")

View File

@ -342,6 +342,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
result.put("addProjectType", null); result.put("addProjectType", null);
result.put("enterProjectBackType", null); result.put("enterProjectBackType", null);
result.put("companyBigScreen", null); result.put("companyBigScreen", null);
result.put("isFirstLogin", systemUser.getIsFirstLogin());
result.put("userType", systemUser.getUserType()); result.put("userType", systemUser.getUserType());
String projectSn = MapUtils.getString(map, "projectSn"); String projectSn = MapUtils.getString(map, "projectSn");
if (StrUtil.isNotBlank(projectSn)) { if (StrUtil.isNotBlank(projectSn)) {
@ -514,6 +515,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
result.put("projectKanban", companyConfig.getProjectKanban()); result.put("projectKanban", companyConfig.getProjectKanban());
result.put("addProjectType", companyConfig.getAddProjectType()); result.put("addProjectType", companyConfig.getAddProjectType());
result.put("enterProjectBackType", companyConfig.getEnterProjectBackType()); result.put("enterProjectBackType", companyConfig.getEnterProjectBackType());
result.put("isFirstLogin", systemUser.getIsFirstLogin());
result.put("companyBigScreen", companyConfig.getCompanyBigScreen()); result.put("companyBigScreen", companyConfig.getCompanyBigScreen());
result.put("userType", systemUser.getUserType()); result.put("userType", systemUser.getUserType());
Map<String, Object> menuAuthority = getUserAuthority(systemUser.getUserId(), systemUser.getAccountType(), systemUser.getSn(), companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), isApp); Map<String, Object> menuAuthority = getUserAuthority(systemUser.getUserId(), systemUser.getAccountType(), systemUser.getSn(), companyConfig.getHeadquartersSn(), companyConfig.getStyleType(), isApp);
@ -839,6 +841,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
systemUser.setPassword(passwordEncoder.encode(MapUtils.getString(map, "passWord"))); systemUser.setPassword(passwordEncoder.encode(MapUtils.getString(map, "passWord")));
systemUser.setShowPassword(MapUtils.getString(map, "passWord")); systemUser.setShowPassword(MapUtils.getString(map, "passWord"));
systemUser.setPwUpdateTime(new Date()); systemUser.setPwUpdateTime(new Date());
systemUser.setIsFirstLogin(0);
systemUserMapper.updateById(systemUser); systemUserMapper.updateById(systemUser);
} }
@ -1693,6 +1696,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
systemUser.setPwUpdateTime(new Date()); systemUser.setPwUpdateTime(new Date());
systemUser.setPassword(passwordEncoder.encode(showPassword)); systemUser.setPassword(passwordEncoder.encode(showPassword));
} }
systemUser.setIsFirstLogin(0);
systemUserMapper.updateById(systemUser); systemUserMapper.updateById(systemUser);
} }