提交修改
This commit is contained in:
parent
2a61ea0781
commit
d21a33863e
@ -2,6 +2,7 @@ package com.lz.modules.app.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dingtalk.api.response.OapiCrmAuthGroupMemberListResponse;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
@ -20,6 +21,7 @@ import com.lz.modules.flow.service.RecordAuthService;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.sys.dao.SysUserDao;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.SysUserService;
|
||||
import com.lz.modules.sys.service.app.ResultDetailService;
|
||||
@ -27,11 +29,13 @@ import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.reactive.RxJava2CrudRepository;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -197,4 +201,60 @@ public class TestController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// http://localhost:8080/lz_management/test/restore
|
||||
@RequestMapping("/test/restore")
|
||||
public void restore() throws Exception{
|
||||
List<StaffEntity> staffEntities = staffService.selectAll();
|
||||
for(StaffEntity staffEntity:staffEntities){
|
||||
//doRestore(staffEntity.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// http://localhost:8080/lz_management/test/doRestore?staffId=273
|
||||
@RequestMapping("/test/doRestore")
|
||||
public void doRestore(Long staffId) throws Exception {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
StaffEntity staff = staffService.selectStaffById(staffId);
|
||||
List<ResultRecord> resultRecords = resultRecordService.selectResultRecordAllByStaffId(staffId);
|
||||
Date node = sdf.parse("2020-09-29 19:08:07");
|
||||
if(resultRecords== null || resultRecords.size() == 0){
|
||||
log.info("staffid = " + staffId + " ,没有数据");
|
||||
return;
|
||||
}
|
||||
boolean flag = true;
|
||||
for(ResultRecord resultRecord:resultRecords){
|
||||
if(resultRecord.getGmtCreate().getTime() > node.getTime()){
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordIdAndType(resultRecord.getId(),1);
|
||||
if(resultDetails !=null && resultDetails.size() > 0){
|
||||
flag = false;
|
||||
log.info("staff_id " + staff.getId() + ",name = " + staff.getName() + " ,己经正常");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(flag){
|
||||
for(ResultRecord resultRecord:resultRecords){
|
||||
if(resultRecord.getGmtCreate().getTime() > node.getTime()){
|
||||
resultRecord.setIsDelete(1);
|
||||
log.info("staff_id " + staff.getId() + ",name = " + staff.getName() + " ,删除不要数据");
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
}
|
||||
}
|
||||
for(int i = resultRecords.size() - 1 ;i >= 0 ; i --){
|
||||
ResultRecord resultRecord = resultRecords.get(i);
|
||||
if(resultRecord.getGmtCreate().getTime() < node.getTime()){
|
||||
List<ResultDetail> resultDetails = resultDetailService.selectByRecordIdAndType(resultRecord.getId(),1);
|
||||
if(resultDetails !=null && resultDetails.size() > 0){
|
||||
resultRecord.setIsDelete(0);
|
||||
log.info("staff_id " + staff.getId() + ",name = " + staff.getName() + " ,数据恢复");
|
||||
resultRecordService.updateResultRecordById(resultRecord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -67,4 +67,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
ResultRecord selectLastResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
|
||||
|
||||
ResultRecord selectCurrentMonthResultRecordByStaffIdType(@Param("staffId") Long staffId, @Param("type") int type);
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(@Param("staffId") Long staffId);
|
||||
}
|
||||
@ -63,4 +63,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
|
||||
List<Step> getStepList(ResultRecord resultRecord);
|
||||
|
||||
String getScoreLevel(double doubleValue);
|
||||
|
||||
List<ResultDetail> selectByRecordIdAndType(Long id, int i);
|
||||
}
|
||||
@ -98,4 +98,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
ResultRecord selectLastResultRecordByStaffIdType(Long staffId, int type);
|
||||
|
||||
ResultRecord selectCurrentMonthResultRecordByStaffIdType(Long staffId, int type);
|
||||
|
||||
List<ResultRecord> selectResultRecordAllByStaffId(Long staffId);
|
||||
}
|
||||
@ -301,4 +301,9 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultDetail> selectByRecordIdAndType(Long id, int type) {
|
||||
return resultDetailMapper.selectByRecordIdType(id,type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -334,6 +334,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return resultRecordMapper.selectCurrentMonthResultRecordByStaffIdType(staffId,type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResultRecord> selectResultRecordAllByStaffId(Long staffId) {
|
||||
|
||||
return resultRecordMapper.selectResultRecordAllByStaffId(staffId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultRecord createResultRecord(Long staffId, int type, Long roleId) {
|
||||
|
||||
@ -334,6 +334,9 @@
|
||||
<select id="selectCurrentMonthResultRecordByStaffIdType" resultType="com.lz.modules.sys.entity.app.ResultRecord">
|
||||
select * from lz_result_record where is_delete = 0 and staff_id = #{staffId} and type = #{type} and DATE_FORMAT(month_time,'%Y-%m') = DATE_FORMAT(now(),'%Y-%m') order by id desc limit 1
|
||||
</select>
|
||||
<select id="selectResultRecordAllByStaffId" resultType="com.lz.modules.sys.entity.app.ResultRecord">
|
||||
select * from lz_result_record where staff_id = #{staffId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user