|
@@ -147,8 +147,62 @@ public class CareNurseClocksServiceImpl implements ICareNurseClocksService
|
|
@Override
|
|
@Override
|
|
public int updateCareNurseClocks(CareNurseClocks careNurseClocks)
|
|
public int updateCareNurseClocks(CareNurseClocks careNurseClocks)
|
|
{
|
|
{
|
|
|
|
+ String psths[]=careNurseClocks.getImgPaths().split(",");
|
|
|
|
+ int result=0;
|
|
|
|
+
|
|
careNurseClocks.setUpdateTime(DateUtils.getNowDate());
|
|
careNurseClocks.setUpdateTime(DateUtils.getNowDate());
|
|
- return careNurseClocksMapper.updateCareNurseClocks(careNurseClocks);
|
|
|
|
|
|
+ careNurseClocks.setImgPaths(careNurseClocks.getImgPaths().replaceAll("/temp/","/upload/"));
|
|
|
|
+ // 判断当天任务是否一开始
|
|
|
|
+ String date=careNurseClocks.getNursingTime().substring(0,10);
|
|
|
|
+ CareNurseRecords careNurseRecords= new CareNurseRecords();
|
|
|
|
+ careNurseRecords.setNursingTime(date);
|
|
|
|
+ careNurseRecords.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
|
|
|
|
+ List<CareNurseRecords> lst=careNurseRecordsMapper.selectCareNurseRecordsList(careNurseRecords);
|
|
|
|
+ if(lst.size()>0){
|
|
|
|
+ //已经开始了直接新增打卡记录
|
|
|
|
+ result= careNurseClocksMapper.updateCareNurseClocks(careNurseClocks);
|
|
|
|
+ }else{
|
|
|
|
+ //修改申请状态为正在进行,并添加护理记录及打卡记录
|
|
|
|
+ CareApplications careApplications=careApplicationsMapper.selectCareApplicationsByApplyId(Long.parseLong(careNurseClocks.getApplyId()));
|
|
|
|
+ careApplications.setDealStatus("in_progress");
|
|
|
|
+ careApplicationsMapper.updateCareApplications(careApplications);
|
|
|
|
+
|
|
|
|
+ careNurseRecords=new CareNurseRecords();
|
|
|
|
+ careNurseRecords.setNursingTime(careNurseClocks.getNursingTime().substring(0,10));
|
|
|
|
+ careNurseRecords.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
|
|
|
|
+ careNurseRecordsMapper.insertCareNurseRecords(careNurseRecords);
|
|
|
|
+
|
|
|
|
+ //获取打卡次数
|
|
|
|
+ CareNurseRecords recordCount=new CareNurseRecords();
|
|
|
|
+ recordCount.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
|
|
|
|
+ CareRecords curr=new CareRecords();
|
|
|
|
+ curr.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
|
|
|
|
+ curr.setState("0");
|
|
|
|
+ List<CareRecords> list=careRecordsMapper.selectCareRecordsList(curr);
|
|
|
|
+ if(list.size()>0){
|
|
|
|
+ curr=list.get(0);
|
|
|
|
+ curr.setRemark("已打卡"+careNurseRecordsMapper.selectCareNurseRecordsList(recordCount).size()+"次");
|
|
|
|
+ careRecordsMapper.updateCareRecords(curr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result=careNurseClocksMapper.updateCareNurseClocks(careNurseClocks);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //保存成功后 将文件转移到正式路径
|
|
|
|
+
|
|
|
|
+ for(int i=0;i<psths.length;i++){
|
|
|
|
+ if(psths[i].indexOf("/temp")>-1){
|
|
|
|
+ String path= RuoYiConfig.getProfile()+psths[i].replace("profile","");
|
|
|
|
+ String finalFilePath=RuoYiConfig.getUploadPath()+psths[i].replace("/profile/temp","");
|
|
|
|
+ try {
|
|
|
|
+ moveFileToFinalPath(path,finalFilePath);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|