2023-12-18 18:54:50 +08:00
|
|
|
package com.zcloud.service.xgf.impl;
|
|
|
|
|
|
|
|
import com.zcloud.entity.Page;
|
|
|
|
import com.zcloud.entity.PageData;
|
|
|
|
import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper;
|
|
|
|
import com.zcloud.mapper.datasource.xgf.XgfUserMapper;
|
|
|
|
import com.zcloud.service.xgf.XgfUserService;
|
2023-12-18 19:58:52 +08:00
|
|
|
import com.zcloud.util.DateUtil;
|
2023-12-18 18:54:50 +08:00
|
|
|
import com.zcloud.util.Warden;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
2023-12-18 19:58:52 +08:00
|
|
|
import java.util.Arrays;
|
2023-12-18 18:54:50 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
|
|
public class XgfUserServiceImpl implements XgfUserService {
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private XgfUserMapper xgfUserMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private XgfUserDetailsMapper xgfUserDetailsMapper;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void save(PageData pd) throws Exception {
|
|
|
|
xgfUserMapper.save(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void saveDetail(PageData pd) throws Exception {
|
|
|
|
xgfUserDetailsMapper.save(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<PageData> list(Page page) throws Exception {
|
|
|
|
return xgfUserDetailsMapper.listPage(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
public void init(PageData request) {
|
|
|
|
List<PageData> list = Warden.getList(request.getString("infoList"));
|
|
|
|
for (PageData x : list) {
|
|
|
|
try {
|
|
|
|
PageData condition = new PageData();
|
|
|
|
if (StringUtils.isNotBlank(x.getString("USER_ID"))) {
|
2023-12-18 19:58:52 +08:00
|
|
|
condition.put("XGF_USER_ID", x.getString("USER_ID"));
|
2023-12-18 18:54:50 +08:00
|
|
|
PageData entity = xgfUserMapper.findById(condition);
|
|
|
|
if (entity == null || entity.size() <= 0) {
|
|
|
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
2023-12-18 19:58:52 +08:00
|
|
|
x.put("XGF_USER_DETAILS_ID", x.get("USER_ID"));
|
2023-12-18 18:54:50 +08:00
|
|
|
x.put("ISDELETE","0");
|
2023-12-18 19:58:52 +08:00
|
|
|
x.put("VALID_FLAG","1");
|
|
|
|
x.put("STATUS","2");
|
|
|
|
x.put("CREATED_TIME", DateUtil.getTime());
|
|
|
|
x.put("OPERATOR_TIME",DateUtil.getTime());
|
2023-12-18 18:54:50 +08:00
|
|
|
xgfUserMapper.save(x);
|
|
|
|
xgfUserDetailsMapper.save(x);
|
|
|
|
} else {
|
|
|
|
x.put("XGF_USER_ID", x.get("USER_ID"));
|
2023-12-18 19:58:52 +08:00
|
|
|
x.put("XFG_USER_DETAILS_ID", x.get("USER_ID"));
|
2023-12-18 18:54:50 +08:00
|
|
|
x.put("ISDELETE","0");
|
2023-12-18 19:58:52 +08:00
|
|
|
x.put("OPERATOR_TIME",DateUtil.getTime());
|
2023-12-18 18:54:50 +08:00
|
|
|
xgfUserMapper.edit(x);
|
|
|
|
xgfUserDetailsMapper.edit(x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
throw new RuntimeException("保存数据失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-18 19:58:52 +08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void approvalApplication(PageData request) throws Exception {
|
|
|
|
List<String> list = Arrays.asList(request.getString("xgf_user_ids").split(",")) ;
|
|
|
|
|
|
|
|
PageData condition = new PageData();
|
|
|
|
condition.put("XGF_USER_IDS", list);
|
|
|
|
List<PageData> entities = xgfUserMapper.listByIds(condition);
|
|
|
|
for (PageData x : entities) {
|
|
|
|
x.put("VALID_FLAG","0");
|
|
|
|
x.put("STATUS","1");
|
|
|
|
xgfUserMapper.edit(x);
|
|
|
|
}
|
|
|
|
PageData pd = new PageData();
|
|
|
|
pd.put("XGF_USER_ID", request.getString("XGF_USER_ID"));
|
|
|
|
pd.put("ISDELETE", "1");
|
|
|
|
xgfUserMapper.edit(pd);
|
|
|
|
xgfUserDetailsMapper.edit(pd);
|
|
|
|
}
|
2023-12-18 18:54:50 +08:00
|
|
|
}
|