数据查看权限修改

This commit is contained in:
bonus 2025-03-12 09:50:43 +08:00
parent 9c2a5ab361
commit cf63ffa3a5
5 changed files with 84 additions and 9 deletions

View File

@ -156,4 +156,6 @@ public interface TmTaskMapper {
String getCtParentName(LeaseApplyDetails applyDetails); String getCtParentName(LeaseApplyDetails applyDetails);
List<PreNumInUse> getPreNumInUse(PreNumInUse typeId); List<PreNumInUse> getPreNumInUse(PreNumInUse typeId);
List<TmTask> getLeaseOutList(TmTask task);
} }

View File

@ -449,8 +449,8 @@ public class TmTaskServiceImpl implements TmTaskService {
if (roles.contains(STRING_ADMIN)) { if (roles.contains(STRING_ADMIN)) {
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record); tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
} else { } else {
String username = SecurityUtils.getLoginUser().getUsername(); long username = SecurityUtils.getLoginUser().getUserid();
record.setCreateBy(username); record.setCreateBy(username+"");
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record); tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record);
} }
for (TmTask tmTask : tmTaskList) { for (TmTask tmTask : tmTaskList) {
@ -587,7 +587,16 @@ public class TmTaskServiceImpl implements TmTaskService {
@Override @Override
public List<TmTask> getLeaseOutListByUser(TmTask task) { public List<TmTask> getLeaseOutListByUser(TmTask task) {
return tmTaskMapper.getLeaseOutListByUser(task); Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<TmTask> tmTaskList;
if (roles.contains(STRING_ADMIN)) {
tmTaskList = tmTaskMapper.getLeaseOutList(task);
}else{
tmTaskList = tmTaskMapper.getLeaseOutListByUser(task);
}
return tmTaskList;
} }
@Override @Override

View File

@ -33,6 +33,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author c liu * @author c liu
@ -67,13 +68,23 @@ public class RepairServiceImpl implements RepairService {
BigDecimal cost = partPrice.multiply(new BigDecimal(bean.getPartNum())).setScale(2, RoundingMode.HALF_UP); BigDecimal cost = partPrice.multiply(new BigDecimal(bean.getPartNum())).setScale(2, RoundingMode.HALF_UP);
return cost; return cost;
} }
private final static String STRING_ADMIN = "admin";
@Override @Override
public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) { public List<RepairTaskDetails> getRepairMaTypeList(RepairTaskDetails bean) {
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
bean.setCompanyId(companyId);
bean.setUserId(SecurityUtils.getLoginUser().getUserid()); Set<String> roles = SecurityUtils.getLoginUser().getRoles();
List<RepairTaskDetails> repairMaTypeList = mapper.getRepairMaTypeList(bean); List<RepairTaskDetails> repairMaTypeList = new ArrayList<>();
if (roles.contains(STRING_ADMIN)) {
repairMaTypeList = mapper.getRepairMaTypeList(bean);
}else{
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
bean.setCompanyId(companyId);
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
repairMaTypeList = mapper.getRepairMaTypeList(bean);
}
if (!CollectionUtils.isEmpty(repairMaTypeList)) { if (!CollectionUtils.isEmpty(repairMaTypeList)) {
for (RepairTaskDetails repairTaskDetails : repairMaTypeList) { for (RepairTaskDetails repairTaskDetails : repairMaTypeList) {
// 根据合格数量和报废数量对数据状态status重新定值完成状态,考虑维修查看页面的展示 // 根据合格数量和报废数量对数据状态status重新定值完成状态,考虑维修查看页面的展示

View File

@ -1278,4 +1278,53 @@
tt.code tt.code
</select> </select>
<select id="getLeaseOutList" resultMap="BaseResultMap">
SELECT
tt.*,
lai.id AS id,
bpl.lot_id AS proId,
bpl.lot_name AS proName,
bui.unit_id AS unitId,
bui.unit_name AS unitName,
lai.lease_person AS leasePerson,
lai.phone AS leasePhone,
tt.create_by AS applyFor,
d.`name` AS taskName,
lai.lease_type AS leaseType,
d.id AS examineStatusId,
bai.agreement_code AS agreementCode,
tt.create_time AS createTimes,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum,
tt.update_time AS updateTimes
from
lease_apply_info lai
LEFT JOIN tm_task tt on lai.task_id = tt.task_id
LEFT JOIN sys_dic d ON d.id = tt.task_status
LEFT JOIN tm_task_agreement tta ON lai.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN lease_apply_details lad on lai.id = lad.parennt_id
LEFT JOIN ma_type_keeper mtk on lad.type_id = mtk.type_id
WHERE tt.task_status in(33,34,35)
<if test="userId != 1">
and mtk.user_id = #{userId}
</if>
<if test="code != null and code != ''">
and tt.code like concat('%', #{code}, '%')
</if>
<if test="unitId != null">
and bui.unit_id = #{unitId}
</if>
<if test="proId != null">
and bpl.lot_id = #{proId}
</if>
<if test="taskStatus != null">
and tt.task_status = #{taskStatus}
</if>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
</select>
</mapper> </mapper>

View File

@ -307,7 +307,11 @@
left join sys_user su on rad.repairer = su.user_id left join sys_user su on rad.repairer = su.user_id
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
LEFT JOIN ma_type_repair mtr on mtr.type_id = rad.type_id LEFT JOIN ma_type_repair mtr on mtr.type_id = rad.type_id
where rad.task_id = #{taskId} and mtr.user_id = #{userId} where rad.task_id = #{taskId}
<if test="userId != null and userId != ''">
and mtr.user_id = #{userId}
</if>
<if test="companyId != null and companyId != ''"> <if test="companyId != null and companyId != ''">
and rad.company_id = #{companyId} and rad.company_id = #{companyId}
</if> </if>