提交修改

This commit is contained in:
quyixiao 2020-08-25 18:39:54 +08:00
parent 8bfc81ede9
commit 333f92eb2c
12 changed files with 136 additions and 110 deletions

View File

@ -14,11 +14,13 @@ import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.FlowRecord; import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.flow.entity.RecordAuth; import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.entity.RecordFile; import com.lz.modules.flow.entity.RecordFile;
import com.lz.modules.flow.entity.StaffRole;
import com.lz.modules.flow.model.Auth; import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.req.ResultDetailReq; import com.lz.modules.flow.req.ResultDetailReq;
import com.lz.modules.flow.service.FlowRecordService; import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.RecordAuthService; import com.lz.modules.flow.service.RecordAuthService;
import com.lz.modules.flow.service.RecordFileService; import com.lz.modules.flow.service.RecordFileService;
import com.lz.modules.flow.service.StaffRoleService;
import com.lz.modules.job.business.DingtalkBusiness; import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.SysUserEntity;
@ -78,8 +80,8 @@ public class ResultRecordController extends AbstractController {
@Autowired @Autowired
private RecordFileService recordFileService; private RecordFileService recordFileService;
@Autowired
DingtalkBusiness dingtalkBusiness; private DingtalkBusiness dingtalkBusiness;
@Value("${dingtalk.appid}") @Value("${dingtalk.appid}")
private String appid; private String appid;
@ -87,6 +89,9 @@ public class ResultRecordController extends AbstractController {
@Value("${domain.main}") @Value("${domain.main}")
private String domain; private String domain;
@Autowired
private StaffRoleService staffRoleService;
/** /**
* 列表 * 列表
*/ */
@ -102,31 +107,33 @@ public class ResultRecordController extends AbstractController {
SysUserEntity user = getUser(); SysUserEntity user = getUser();
if (req.getIsSelf() == 1) { if (req.getIsSelf() == 1) {
req.setStaffId(user.getUserId()); req.setStaffId(user.getUserId());
}else{ } else {
DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(getUserId()); StaffRole staffRole = staffRoleService.selectByStaffId(getUserId());
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(relateEntity.getDepartmentId()); if (staffRole == null) {
int i = 0; DepartmentsStaffRelateEntity relateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(getUserId());
for (Map.Entry<String, String> entry : map.entrySet()) { Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(relateEntity.getDepartmentId());
i++; int i = 0;
for (Map.Entry<String, String> entry : map.entrySet()) {
i++;
}
i = i / 2;
if (i == 3) { // 表示有三级部门
departmentList2 = departmentsService.selectByParentDepartmentId(map.get("dd3"));
departmentList3 = departmentsService.selectByParentDepartmentId(map.get("dd2"));
department1 = map.get("dd3");
department2 = map.get("dd2");
department3 = map.get("dd1");
req.setDepartment3(map.get("dd1"));
} else if (i == 2) {
departmentList2 = departmentsService.selectByParentDepartmentId(map.get("dd2"));
department2 = map.get("dd1");
department1 = map.get("dd2");
req.setDepartment2(map.get("dd1"));
} else if (i == 1) {
department1 = map.get("dd1");
req.setDepartment1(map.get("dd1"));
}
} }
i = i / 2;
if (i == 3) { // 表示有三级部门
departmentList2 = departmentsService.selectByParentDepartmentId(map.get("dd3"));
departmentList3 = departmentsService.selectByParentDepartmentId(map.get("dd2"));
department1 = map.get("dd3");
department2 = map.get("dd2");
department3 = map.get("dd1");
req.setDepartment3(map.get("dd1"));
} else if (i == 2) {
departmentList2 = departmentsService.selectByParentDepartmentId(map.get("dd2"));
department2 = map.get("dd1");
department1 = map.get("dd2");
req.setDepartment2(map.get("dd1"));
} else if (i == 1) {
department1 = map.get("dd1");
req.setDepartment1(map.get("dd1"));
}
} }
PageUtils page = lzResultRecordService.queryPage(req, user); PageUtils page = lzResultRecordService.queryPage(req, user);
return R.ok().put("page", page) return R.ok().put("page", page)
@ -146,10 +153,6 @@ public class ResultRecordController extends AbstractController {
.put("departmentList", departmentList1); .put("departmentList", departmentList1);
} }
@RequestMapping("/getStaffResultDetail") @RequestMapping("/getStaffResultDetail")
public R getStaffResultDetail(ResultRecordReq req) { public R getStaffResultDetail(ResultRecordReq req) {
int yeJiCheckNum = 0; int yeJiCheckNum = 0;
@ -184,7 +187,6 @@ public class ResultRecordController extends AbstractController {
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId())); listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
auth = recordAuthService.getAuth(listAuth); auth = recordAuthService.getAuth(listAuth);
} }
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(resultRecord.getId()); List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(resultRecord.getId());
BigDecimal sumWenHuaJiaZhiGuan = BigDecimal.ZERO; BigDecimal sumWenHuaJiaZhiGuan = BigDecimal.ZERO;
BigDecimal sumYeJi = BigDecimal.ZERO; BigDecimal sumYeJi = BigDecimal.ZERO;
@ -264,7 +266,9 @@ public class ResultRecordController extends AbstractController {
list.add(comment); list.add(comment);
} }
} }
String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId()); String superStaff = recordAuthService.selectByStaffId(resultRecord.getStaffId());
int fileCount = recordFileService.selectRecordFileCountByRecordId(resultRecord.getId());
return R.ok() return R.ok()
.put("staffName", staffEntity.getName()) .put("staffName", staffEntity.getName())
.put("department1", departmentDto.getDepartment1()) .put("department1", departmentDto.getDepartment1())
@ -279,7 +283,9 @@ public class ResultRecordController extends AbstractController {
.put("wenHuaJiaZhiGuanNum", wenHuaJiaZhiGuanNum) .put("wenHuaJiaZhiGuanNum", wenHuaJiaZhiGuanNum)
.put("lastResultNum", lastResultNum) .put("lastResultNum", lastResultNum)
.put("commentNum", commentNum) .put("commentNum", commentNum)
.put("superStaff", superStaff); .put("superStaff", superStaff)
.put("fileCount",fileCount)
;
} }
@RequestMapping("/commitApproval") @RequestMapping("/commitApproval")
@ -316,20 +322,19 @@ public class ResultRecordController extends AbstractController {
} }
} }
resultCommentService.addOrUpdateComment(req, getUserId(), status); resultCommentService.addOrUpdateComment(req, getUserId(), status);
if(r != null && (int)r.get("code") == 0){//下面推送消息 try {
StaffEntity mySelf = (StaffEntity)r.get("from"); if(r != null && (int)r.get("code") == 0){//下面推送消息
StaffEntity toSelf = (StaffEntity)r.get("to"); StaffEntity mySelf = (StaffEntity)r.get("from");
WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type"); StaffEntity toSelf = (StaffEntity)r.get("to");
String url = domain + "/management/dingtalklogin?url=";//免登接口 WorkMsgTypeEnum workMsgTypeEnum = (WorkMsgTypeEnum)r.get("type");
String jump = domain + "/management/recorddetail?id=" + req.getRecordResultId() String url = domain + "/management/dingtalklogin?url=";//免登接口
+ "&recordType=3" ;//跳转接口 String jump = domain + "/management/recorddetail?id=" + req.getRecordResultId()
jump = URLEncoder.encode(jump); + "&recordType=3" ;//跳转接口
String msg = dingtalkBusiness.sendWorkMSGByEntity(appid, mySelf, toSelf, workMsgTypeEnum, url + jump); jump = URLEncoder.encode(jump);
if(msg.equals("OK")){ String msg = dingtalkBusiness.sendWorkMSGByEntity(appid, mySelf, toSelf, workMsgTypeEnum, url + jump);
return r;
}else{
return R.error(msg);
} }
} catch (Exception e) {
} }
return R.ok("成功"); return R.ok("成功");
//return r != null ? r : R.ok("成功"); //return r != null ? r : R.ok("成功");
@ -520,14 +525,23 @@ public class ResultRecordController extends AbstractController {
/** /**
* 删除 * 删除
*/ */
@RequestMapping("/delete") @RequestMapping("/deleteRecord")
@RequiresPermissions("user:lzresultrecord:delete") @RequiresPermissions("user:lzresultrecord:delete")
public R delete(@RequestBody Long[] ids) { public R deleteRecord(String ids) {
lzResultRecordService.deleteBatchIds(Arrays.asList(ids)); if(StringUtil.isBlank(ids)){
return R.error("请选择 ids");
}
String is[] = ids.split(",");
for(String i : is ){
ResultRecord resultRecord = resultRecordService.selectResultRecordById(NumberUtil.objToLongDefault(i,0l));
if(resultRecord !=null){
resultRecord.setIsDelete(1);
resultRecordService.updateResultRecordById(resultRecord);
}
}
return R.ok(); return R.ok();
} }
/** /**
* 删除 * 删除
*/ */
@ -549,25 +563,5 @@ public class ResultRecordController extends AbstractController {
return R.ok(); return R.ok();
} }
public static void main(String[] args) {
List<DepartmentsDto> departmentList1 = new ArrayList<>();
DepartmentsDto departmentsDto1 = new DepartmentsDto();
departmentsDto1.setDepartmentId("1");
DepartmentsDto departmentsDto2 = new DepartmentsDto();
departmentsDto2.setDepartmentId("2");
DepartmentsDto departmentsDto3 = new DepartmentsDto();
departmentsDto3.setDepartmentId("3");
departmentList1.add(departmentsDto1);
departmentList1.add(departmentsDto2);
departmentList1.add(departmentsDto3);
String compare = "3";
departmentList1 = departmentList1.stream().sorted((p1, p2) -> p1.getDepartmentId().equals(compare) ? 1 : p2.getDepartmentId().equals(compare) ? 1 : 0).collect(Collectors.toList());
for (DepartmentsDto departmentsDto : departmentList1) {
System.out.println(departmentsDto.getDepartmentId());
}
}
} }

View File

@ -35,4 +35,6 @@ public class ResultRecordReq {
private String resultComment; private String resultComment;
private Long resultCommitId; private Long resultCommitId;
private Long rollbackFlowId; private Long rollbackFlowId;
private List<Long > statusList ;
private String statusStr;
} }

View File

@ -17,7 +17,7 @@ public class ResultRecordResp {
private Date gmtModified; private Date gmtModified;
//月份 //月份
private Date monthTime; private Date monthTime;
//0.新建1 提交审批中2 拒绝,3 审批完成 //0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回
private Integer status; private Integer status;
//最后得分 //最后得分
private BigDecimal lastScore; private BigDecimal lastScore;

View File

@ -36,4 +36,6 @@ public interface RecordFileMapper extends BaseMapper<RecordFile> {
List<RecordFile> selectByCondition(@Param("page") IPage page , @Param("req") ResultDetailReq req); List<RecordFile> selectByCondition(@Param("page") IPage page , @Param("req") ResultDetailReq req);
int selectRecordFileCountByRecordId(@Param("recordId") Long recordId);
} }

View File

@ -22,5 +22,6 @@ public class Auth {
private int wenHuaEdit; private int wenHuaEdit;
private int waitCommit; private int waitCommit;
private int approvelCommit; private int approvelCommit;
private int uploadFile;
private int downFile;
} }

View File

@ -17,7 +17,6 @@ import com.lz.modules.sys.entity.SysUserEntity;
public interface RecordFileService extends IService<RecordFile> { public interface RecordFileService extends IService<RecordFile> {
RecordFile selectRecordFileById(Long id); RecordFile selectRecordFileById(Long id);
@ -34,4 +33,6 @@ public interface RecordFileService extends IService<RecordFile> {
PageUtils queryPage(ResultDetailReq req, SysUserEntity user); PageUtils queryPage(ResultDetailReq req, SysUserEntity user);
int selectRecordFileCountByRecordId(Long recordId);
} }

View File

@ -122,7 +122,8 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
auth.setWenHuaEdit(NumberUtil.objToIntDefault(map.get("wenHuaEdit"), 0)); auth.setWenHuaEdit(NumberUtil.objToIntDefault(map.get("wenHuaEdit"), 0));
auth.setWaitCommit(NumberUtil.objToIntDefault(map.get("waitCommit"), 0)); auth.setWaitCommit(NumberUtil.objToIntDefault(map.get("waitCommit"), 0));
auth.setApprovelCommit(NumberUtil.objToIntDefault(map.get("approvelCommit"), 0)); auth.setApprovelCommit(NumberUtil.objToIntDefault(map.get("approvelCommit"), 0));
auth.setUploadFile(NumberUtil.objToIntDefault(map.get("uploadFile"), 0));
auth.setUploadFile(NumberUtil.objToIntDefault(map.get("uploadFile"), 0));
return auth; return auth;
} }

View File

@ -75,5 +75,10 @@ public class RecordFileServiceImpl extends ServiceImpl<RecordFileMapper, RecordF
}); });
} }
@Override
public int selectRecordFileCountByRecordId(Long recordId) {
return recordFileMapper.selectRecordFileCountByRecordId(recordId);
}
} }

View File

@ -28,7 +28,7 @@ public class ResultRecord implements java.io.Serializable {
private Date gmtModified; private Date gmtModified;
//月份 //月份
private Date monthTime; private Date monthTime;
//0.新建1 审批中2 己审批 , 3 侍提交 4 审批通过,5 驳回 //0.新建1 提交审批中2 拒绝, 3 侍提交 4 审批通过,5 驳回
private Integer status; private Integer status;
//最后得分 //最后得分
private BigDecimal lastScore; private BigDecimal lastScore;

View File

@ -158,8 +158,19 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
getChildIds(departmentIds, params.getDepartment1(), departmentMap); getChildIds(departmentIds, params.getDepartment1(), departmentMap);
} }
} }
params.setDepartmentIds(departmentIds);
if(StringUtil.isNotBlank(params.getStatusStr())){
String status [] = params.getStatusStr().split(",");
List<Long> listx = new ArrayList<>();
if(status !=null){
for(String l : status){
listx.add(NumberUtil.objToLongDefault(l,-1));
}
params.setStatusList(listx);
}
}
params.setDepartmentIds(departmentIds);
String departmentLevel = Constant.ME; String departmentLevel = Constant.ME;
if (params.getIsSelf() != 1) { // 表示点击我们审批 if (params.getIsSelf() != 1) { // 表示点击我们审批
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId()); FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
@ -178,7 +189,6 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
); );
List<ResultRecord> resultRecords = pageUtils.getList(); List<ResultRecord> resultRecords = pageUtils.getList();
if (CollectionUtils.isNotEmpty(resultRecords)) { if (CollectionUtils.isNotEmpty(resultRecords)) {
List<ResultRecordResp> list = new ArrayList<>(); List<ResultRecordResp> list = new ArrayList<>();
for (ResultRecord resultRecord : resultRecords) { for (ResultRecord resultRecord : resultRecords) {
@ -187,6 +197,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
if (resp.getStatus().equals(1) && staffRoleMap.get(user.getUserId()) == null) { if (resp.getStatus().equals(1) && staffRoleMap.get(user.getUserId()) == null) {
resp.setStatus(2); // 如果不是自己审批说明自己己经审批完成 resp.setStatus(2); // 如果不是自己审批说明自己己经审批完成
} else if (resp.getStatus().equals(5) && staffRoleMap.get(user.getUserId()) == null) {
resp.setStatus(1); // 如果不是自己审批说明自己己经审批完成
} }
list.add(resp); list.add(resp);
} }

View File

@ -171,36 +171,46 @@
<select id="selectByConditionByLeader" resultType="com.lz.modules.flow.model.ResultRecordDto"> <select id="selectByConditionByLeader" resultType="com.lz.modules.flow.model.ResultRecordDto">
select * from ( select * from (
select rd.*,department_level,approval_staff_id,approval_staff_name,flow_name,flow_id,flow_index select rd.*,department_level,approval_staff_id,approval_staff_name,flow_name,flow_id,flow_index
from lz_flow_record fr left join lz_result_record rd on fr.record_id= rd.id from lz_flow_record fr left join lz_result_record rd on fr.record_id= rd.id
where department_level = #{req.departmentLevel} and fr.status = 0 where department_level = #{req.departmentLevel} and fr.status = 0 and rd.is_delete = 0 and fr.is_delete = 0
<if test="req.monthBeginDate != null and req.monthBeginDate != '' "> <if test="req.monthBeginDate != null and req.monthBeginDate != '' ">
AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.monthBeginDate}, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.monthBeginDate},
</if> '%Y-%m-%d %H:%i:%S')
<if test="req.monthEndDate != null and req.monthEndDate != '' "> </if>
AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.monthEndDate}, '%Y-%m-%d %H:%i:%S') <if test="req.monthEndDate != null and req.monthEndDate != '' ">
</if> AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ <= ]]> DATE_FORMAT(#{req.monthEndDate},
<if test="req.status != null"> '%Y-%m-%d %H:%i:%S')
and rd.status = #{req.status} </if>
</if> <if test="req.status != null">
<if test="req.remark != null and req.remark !='' "> and rd.status = #{req.status}
AND rd.remark LIKE CONCAT('%',#{req.remark},'%') </if>
</if> <if test="req.remark != null and req.remark !='' ">
AND rd.remark LIKE CONCAT('%',#{req.remark},'%')
</if>
<if test="req.name != null and req.name !='' "> <if test="req.name != null and req.name !='' ">
AND rd.staff_name LIKE CONCAT('%',#{req.name},'%') AND rd.staff_name LIKE CONCAT('%',#{req.name},'%')
</if> </if>
<if test="req.departmentIds != null and req.departmentIds.size() > 0 "> <if test="req.departmentIds != null and req.departmentIds.size() > 0 ">
and rd.department_id in and rd.department_id in
<foreach collection="req.departmentIds" item="item" index="index" separator="," open="(" close=")"> <foreach collection="req.departmentIds" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="req.staffId != null and req.staffId !='' ">
and rd.staff_id = #{req.staffId} <if test="req.statusList != null and req.statusList.size() > 0 ">
</if> and rd.status in
order by fr.id desc ) <foreach collection="req.statusList" item="item" index="index" separator="," open="(" close=")">
a GROUP by id order by department_id desc #{item}
</foreach>
</if>
<if test="req.staffId != null and req.staffId !='' ">
and rd.staff_id = #{req.staffId}
</if>
order by fr.id desc )
a GROUP by id order by department_id desc
</select> </select>
<update id="updateFlowStaffIdRoleToNull"> <update id="updateFlowStaffIdRoleToNull">

View File

@ -90,14 +90,12 @@
update lz_record_file set is_delete = 1 where id=#{id} limit 1 update lz_record_file set is_delete = 1 where id=#{id} limit 1
</update> </update>
<select id="selectByCondition" resultType="com.lz.modules.flow.entity.RecordFile"> <select id="selectByCondition" resultType="com.lz.modules.flow.entity.RecordFile">
select * from lz_record_file where record_id = #{req.recordId} and is_delete = 0 order by id desc select * from lz_record_file where record_id = #{req.recordId} and is_delete = 0 order by id desc
</select> </select>
<select id="selectRecordFileCountByRecordId" resultType="java.lang.Integer">
select ifnull(count(*),0) from lz_record_file where record_id = #{recordId} and is_delete = 0
</select>
</mapper> </mapper>