|
@@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxApiDao;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
@@ -27,6 +28,10 @@ import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import com.rongwei.rwcommonentity.commonservers.domain.SysConfigDo;
|
|
|
import lombok.extern.java.Log;
|
|
|
+import org.dom4j.Document;
|
|
|
+import org.dom4j.DocumentException;
|
|
|
+import org.dom4j.DocumentHelper;
|
|
|
+import org.dom4j.Element;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -434,6 +439,86 @@ public class ZhcxApiServiceImpl implements ZhcxApiService {
|
|
|
return rectifyDtoList;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void initPwd() {
|
|
|
+ List<SysUserDo> list = sysUserService.list(
|
|
|
+ Wrappers.<SysUserDo>lambdaQuery()
|
|
|
+ .isNull(SysUserDo::getPassword)
|
|
|
+ );
|
|
|
+ list.forEach(item -> {
|
|
|
+ String id = item.getId();
|
|
|
+ item.setPassword(SecurityUtil.getSaltMd5AndSha("R@1j8k#9P6sA",id));
|
|
|
+ });
|
|
|
+ sysUserService.updateBatchById(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String syncUserData(String data) {
|
|
|
+ Document document = null;
|
|
|
+ try {
|
|
|
+ document = DocumentHelper.parseText(data);
|
|
|
+ Element root = document.getRootElement();
|
|
|
+ List<Element> list = root.elements();
|
|
|
+ String operationType = "add";
|
|
|
+ String dataType = "";
|
|
|
+ SysUserDo sysUserDo = new SysUserDo();
|
|
|
+ for(Element element : list){
|
|
|
+ String name = element.getName();
|
|
|
+ if("dataOperateType".equals(name)){
|
|
|
+ String stringValue = element.getStringValue();
|
|
|
+ operationType = stringValue;
|
|
|
+ }
|
|
|
+ if("dataType".equals(name)){
|
|
|
+ String stringValue = element.getStringValue();
|
|
|
+ dataType = stringValue;
|
|
|
+ }
|
|
|
+ if("data".equals(name)){
|
|
|
+ System.out.println(element.getStringValue());
|
|
|
+ String stringValue = element.getStringValue();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(stringValue);
|
|
|
+ if(jsonObject != null){
|
|
|
+ String userName = jsonObject.getString("userName");
|
|
|
+ String sex = jsonObject.getString("sex");
|
|
|
+ String mobile = jsonObject.getString("mobile");
|
|
|
+ String status = jsonObject.getString("status");
|
|
|
+ String email = jsonObject.getString("email");
|
|
|
+ String logName = jsonObject.getString("logName");
|
|
|
+ if("1".equals(sex)){
|
|
|
+ sysUserDo.setGender("男");
|
|
|
+ }else if("2".equals(sex)){
|
|
|
+ sysUserDo.setGender("女");
|
|
|
+ }
|
|
|
+ sysUserDo.setCode(logName);
|
|
|
+ sysUserDo.setMobile(mobile);
|
|
|
+ sysUserDo.setName(userName);
|
|
|
+ sysUserDo.setAccount(mobile);
|
|
|
+ sysUserDo.setEmail(email);
|
|
|
+ if("1".equals(status)){
|
|
|
+ sysUserDo.setEnabled("0");
|
|
|
+ }else{
|
|
|
+ sysUserDo.setEnabled("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("user".equals(dataType)) {
|
|
|
+ if ("add".equals(operationType)) {
|
|
|
+ sysUserDo.setId(SecurityUtil.getUUID());
|
|
|
+ sysUserDo.setPassword(
|
|
|
+ SecurityUtil.getSaltMd5AndSha("Zpmc@0415",sysUserDo.getId()));
|
|
|
+ sysUserService.save(sysUserDo);
|
|
|
+ }else{
|
|
|
+ UpdateWrapper<SysUserDo> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("CODE", sysUserDo.getCode());
|
|
|
+ sysUserService.update(sysUserDo,updateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (DocumentException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
private List<RectifyApiDataDto> processFirstDeptData(List<ZhcxProjectRectifyMachineVo> list, ZhcxProjectManageDo projectManageDo) {
|
|
|
Map<String, List<ZhcxProjectRectifyMachineVo>> groupFirstDeptList = list.stream()
|
|
|
.filter(e -> Objects.nonNull(e.getFirstdeptid()))
|