208 lines
5.9 KiB
Java
208 lines
5.9 KiB
Java
package com.zcloud.service.xgf.impl;
|
||
|
||
import com.zcloud.entity.Page;
|
||
import com.zcloud.entity.PageData;
|
||
import com.zcloud.mapper.datasource.system.UsersMapper;
|
||
import com.zcloud.mapper.datasource.xgf.*;
|
||
import com.zcloud.service.xgf.TrainUsersService;
|
||
import com.zcloud.util.DateUtil;
|
||
import com.zcloud.util.Tools;
|
||
import com.zcloud.util.Warden;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.stereotype.Service;
|
||
import org.springframework.transaction.annotation.Transactional;
|
||
|
||
import javax.annotation.Resource;
|
||
import java.util.Date;
|
||
import java.util.List;
|
||
|
||
/**
|
||
* 说明:培训学员
|
||
* 作者:luoxiaobao
|
||
* 时间:2023-05-08
|
||
* 官网:www.zcloudchina.com
|
||
*/
|
||
@Service
|
||
@Transactional //开启事物
|
||
public class TrainUsersServiceImpl implements TrainUsersService {
|
||
|
||
@Resource
|
||
private TrainUsersMapper trainusersMapper;
|
||
|
||
@Resource
|
||
private TrainingBatchMapper trainingBatchMapper;
|
||
@Resource
|
||
private XgfUserMapper xgfUserMapper;
|
||
|
||
@Resource
|
||
private FlowDetailMapper flowDetailMapper;
|
||
|
||
@Resource
|
||
private FlowMapper flowMapper;
|
||
|
||
/**
|
||
* 新增
|
||
*
|
||
* @param pd
|
||
* @throws Exception
|
||
*/
|
||
public void save(PageData pd) throws Exception {
|
||
trainusersMapper.save(pd);
|
||
}
|
||
|
||
/**
|
||
* 删除
|
||
*
|
||
* @param pd
|
||
* @throws Exception
|
||
*/
|
||
public void delete(PageData pd) throws Exception {
|
||
trainusersMapper.delete(pd);
|
||
}
|
||
|
||
/**
|
||
* 修改
|
||
*
|
||
* @param pd
|
||
* @throws Exception
|
||
*/
|
||
public void edit(PageData pd) throws Exception {
|
||
trainusersMapper.edit(pd);
|
||
}
|
||
|
||
/**
|
||
* 列表
|
||
*
|
||
* @param page
|
||
* @throws Exception
|
||
*/
|
||
public List<PageData> list(Page page) throws Exception {
|
||
return trainusersMapper.datalistPage(page);
|
||
}
|
||
|
||
/**
|
||
* 列表(全部)
|
||
*
|
||
* @param pd
|
||
* @throws Exception
|
||
*/
|
||
public List<PageData> listAll(PageData pd) throws Exception {
|
||
return trainusersMapper.listAll(pd);
|
||
}
|
||
|
||
/**
|
||
* 通过id获取数据
|
||
*
|
||
* @param pd
|
||
* @throws Exception
|
||
*/
|
||
public PageData findById(PageData pd) throws Exception {
|
||
return trainusersMapper.findById(pd);
|
||
}
|
||
|
||
/**
|
||
* 批量删除
|
||
*
|
||
* @param ArrayDATA_IDS
|
||
* @throws Exception
|
||
*/
|
||
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
|
||
trainusersMapper.deleteAll(ArrayDATA_IDS);
|
||
}
|
||
|
||
/**
|
||
* 固定服务人员培训管理查看
|
||
*
|
||
* @param pd
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
@Override
|
||
public PageData trainView(PageData pd) throws Exception {
|
||
return trainusersMapper.trainView(pd);
|
||
}
|
||
|
||
@Override
|
||
public List<PageData> trainApplicationRecordList(Page page) {
|
||
return trainusersMapper.trainApplicationRecordList(page);
|
||
}
|
||
|
||
|
||
public List<PageData> unflowlist(Page page) throws Exception {
|
||
return trainusersMapper.unflowlistPage(page);
|
||
}
|
||
|
||
public void audit(PageData pd) throws Exception {
|
||
if (Integer.parseInt(pd.getString("AUDIT_STATUS")) == -1) {
|
||
|
||
} else if (Integer.parseInt(pd.getString("AUDIT_STATUS")) == 1) {
|
||
pd.put("STATUS", 2);
|
||
pd.put("END_DATE", DateUtil.date2Str(new Date()));
|
||
xgfUserMapper.updateStatusByUnflowTrain(pd);
|
||
trainusersMapper.updateStatus(pd);
|
||
}
|
||
}
|
||
|
||
@Override
|
||
public void approveUser(PageData pd) throws Exception {
|
||
PageData condition = new PageData();
|
||
condition.put("TRAIN_USERS_ID", pd.get("TRAIN_USERS_ID"));
|
||
PageData userEntity = trainusersMapper.findById(condition);
|
||
switch (userEntity.getString("STEP_STATUS")){
|
||
case "0":
|
||
userEntity.put("TERRITORIALITY_STATE", pd.getString("IS_STATE"));
|
||
userEntity.put("TERRITORIALITY_OPINION", pd.getString("OPINION"));
|
||
userEntity.put("TERRITORIALITY_TIME", DateUtil.getTime());
|
||
break;
|
||
case "1":
|
||
userEntity.put("MANAGER_STATE", pd.getString("IS_STATE"));
|
||
userEntity.put("MANAGER_OPINION", pd.getString("OPINION"));
|
||
userEntity.put("MANAGER_TIME", DateUtil.getTime());
|
||
break;
|
||
case "3":
|
||
userEntity.put("SUPERVISION_STATE", pd.getString("IS_STATE"));
|
||
userEntity.put("SUPERVISION_OPINION", pd.getString("OPINION"));
|
||
userEntity.put("SUPERVISION_TIME", DateUtil.getTime());
|
||
break;
|
||
}
|
||
if ("0".equals(pd.getString("IS_STATE"))) {
|
||
userEntity.put("STEP_STATUS", '-' + userEntity.getString("STEP_STATUS"));
|
||
userEntity.put("RESULT_STATUS","3");
|
||
} else {
|
||
int stepNumber = Integer.parseInt(userEntity.getString("STEP_STATUS")) + 1;
|
||
if (stepNumber == 3){
|
||
userEntity.put("RESULT_STATUS","2");
|
||
}
|
||
userEntity.put("STEP_STATUS", Integer.toString(stepNumber));
|
||
}
|
||
trainusersMapper.edit(userEntity);
|
||
}
|
||
|
||
@Override
|
||
public List<PageData> findinfoByCondition(PageData condition) throws Exception {
|
||
return trainusersMapper.findinfoByCondition(condition);
|
||
}
|
||
|
||
@Override
|
||
public void endApproval(PageData pd) throws Exception {
|
||
PageData condition = new PageData();
|
||
condition.put("TRAINING_BATCH_ID",pd.getString("TRAINING_BATCH_ID"));
|
||
PageData entity = trainingBatchMapper.findById(condition);
|
||
int stepNumber = Integer.parseInt(entity.getString("STEP_STATUS"));
|
||
switch (stepNumber){
|
||
case 0:
|
||
entity.put("TERRITORIALITY_TIME",DateUtil.getTime());
|
||
break;
|
||
case 1:
|
||
entity.put("MANAGER_TIME",DateUtil.getTime());
|
||
break;
|
||
case 2:
|
||
entity.put("SUPERVISION_TIME",DateUtil.getTime());
|
||
break;
|
||
}
|
||
entity.put("STEP_STATUS",++stepNumber);
|
||
trainingBatchMapper.edit(entity);
|
||
}
|
||
}
|
||
|