|
@@ -2,6 +2,7 @@ package com.pj.tb_people;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.extra.cglib.CglibUtil;
|
|
import cn.hutool.extra.cglib.CglibUtil;
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -24,6 +25,7 @@ import com.pj.tb_people.dto.LeaveGroupDto;
|
|
import com.pj.tb_people.dto.StartStopDto;
|
|
import com.pj.tb_people.dto.StartStopDto;
|
|
import com.pj.tb_people.vo.ApplyPeopleVo;
|
|
import com.pj.tb_people.vo.ApplyPeopleVo;
|
|
import com.pj.tb_people.vo.BindShopVO;
|
|
import com.pj.tb_people.vo.BindShopVO;
|
|
|
|
+import com.pj.tb_people.vo.EditPhoneVO;
|
|
import com.pj.tb_shop.TbShop;
|
|
import com.pj.tb_shop.TbShop;
|
|
import com.pj.tb_shop.TbShopMapper;
|
|
import com.pj.tb_shop.TbShopMapper;
|
|
import com.pj.tb_shop.TbShopService;
|
|
import com.pj.tb_shop.TbShopService;
|
|
@@ -33,6 +35,7 @@ import com.pj.utils.sg.AjaxError;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.tencentcloudapi.live.v20180801.models.PublishTime;
|
|
import com.tencentcloudapi.live.v20180801.models.PublishTime;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
@@ -58,6 +61,7 @@ import java.util.*;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
+@Slf4j
|
|
public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> implements IService<TbPeople> {
|
|
public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> implements IService<TbPeople> {
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -573,11 +577,11 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
|
|
tbPeople.setTradeAreaName(tbTradeArea.getName());
|
|
tbPeople.setTradeAreaName(tbTradeArea.getName());
|
|
/**备案编号,如果为新增备案,传空值;如果为变更备案,必须传值;*/
|
|
/**备案编号,如果为新增备案,传空值;如果为变更备案,必须传值;*/
|
|
|
|
|
|
- if (isNew){
|
|
|
|
|
|
+ if (isNew) {
|
|
tbPeople.setCreateTime(new Date()); // 创建时间
|
|
tbPeople.setCreateTime(new Date()); // 创建时间
|
|
tbPeople.setCreateName("航通"); // 创建人
|
|
tbPeople.setCreateName("航通"); // 创建人
|
|
this.save(tbPeople);
|
|
this.save(tbPeople);
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
tbPeople.setUpdateTime(new Date()); // 修改时间
|
|
tbPeople.setUpdateTime(new Date()); // 修改时间
|
|
tbPeople.setUpdateName("航通"); // 修改人
|
|
tbPeople.setUpdateName("航通"); // 修改人
|
|
this.updateById(tbPeople);
|
|
this.updateById(tbPeople);
|
|
@@ -597,7 +601,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
AppUserDto appUserDto = adminInterface.getByFkId(tbPeople.getId());
|
|
AppUserDto appUserDto = adminInterface.getByFkId(tbPeople.getId());
|
|
- if(appUserDto == null) {
|
|
|
|
|
|
+ if (appUserDto == null) {
|
|
//给边民生成账号
|
|
//给边民生成账号
|
|
AppUserCreateDTO createDTO = new AppUserCreateDTO();
|
|
AppUserCreateDTO createDTO = new AppUserCreateDTO();
|
|
createDTO.setAuth("1");
|
|
createDTO.setAuth("1");
|
|
@@ -745,7 +749,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.updateBatchById(list);
|
|
this.updateBatchById(list);
|
|
- BindShopDTO bindShopDTO=new BindShopDTO();
|
|
|
|
|
|
+ BindShopDTO bindShopDTO = new BindShopDTO();
|
|
bindShopDTO.setBindShop(2);
|
|
bindShopDTO.setBindShop(2);
|
|
bindShopDTO.setIds(t.getIds());
|
|
bindShopDTO.setIds(t.getIds());
|
|
FeignFactory.adminInterface.changeBindShopStatus(bindShopDTO);
|
|
FeignFactory.adminInterface.changeBindShopStatus(bindShopDTO);
|
|
@@ -757,9 +761,45 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
|
|
wrapper.set(TbPeople::getShopName, null);
|
|
wrapper.set(TbPeople::getShopName, null);
|
|
wrapper.eq(TbPeople::getId, id);
|
|
wrapper.eq(TbPeople::getId, id);
|
|
this.update(wrapper);
|
|
this.update(wrapper);
|
|
- BindShopDTO bindShopDTO=new BindShopDTO();
|
|
|
|
|
|
+ BindShopDTO bindShopDTO = new BindShopDTO();
|
|
bindShopDTO.setBindShop(1);
|
|
bindShopDTO.setBindShop(1);
|
|
bindShopDTO.setIds(id);
|
|
bindShopDTO.setIds(id);
|
|
FeignFactory.adminInterface.changeBindShopStatus(bindShopDTO);
|
|
FeignFactory.adminInterface.changeBindShopStatus(bindShopDTO);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void editPhone(EditPhoneVO editPhoneVO) {
|
|
|
|
+ String phone=editPhoneVO.getPhone();
|
|
|
|
+ TbPeople tbPeople = getById(editPhoneVO.getId());
|
|
|
|
+ if (tbPeople == null) {
|
|
|
|
+ throw new ServiceException("该边民不存在");
|
|
|
|
+ }
|
|
|
|
+ AppUserDto oldUser = FeignFactory.adminInterface.findUserByPhone(tbPeople.getPhone());
|
|
|
|
+ //账号不存在或者存在但不是自己的,则新增
|
|
|
|
+ if (oldUser == null||!StrUtil.equals(oldUser.getName(),tbPeople.getName())) {
|
|
|
|
+ AppUserCreateDTO appUserCreateDTO = new AppUserCreateDTO();
|
|
|
|
+ appUserCreateDTO.setAuth("1");
|
|
|
|
+ appUserCreateDTO.setPhone(phone);
|
|
|
|
+ appUserCreateDTO.setName(tbPeople.getName());
|
|
|
|
+ appUserCreateDTO.setFkId(tbPeople.getId());
|
|
|
|
+ appUserCreateDTO.setUserType(UserType.USER_TYPE_PEOPLE.getCode() + "");
|
|
|
|
+ log.info("create user :{}", JSONUtil.toJsonStr(appUserCreateDTO));
|
|
|
|
+ FeignFactory.adminInterface.createAccount(appUserCreateDTO);
|
|
|
|
+ }else{
|
|
|
|
+ //存在,检查下是否冲突
|
|
|
|
+ AppUserDto checkUser = FeignFactory.adminInterface.findUserByPhone(editPhoneVO.getPhone());
|
|
|
|
+ if (checkUser!= null&&!Objects.equals(checkUser.getFkId(),tbPeople.getId()) ){
|
|
|
|
+ throw new AjaxError("手机已被【"+checkUser.getName()+"】占用");
|
|
|
|
+ }
|
|
|
|
+ UpdateAccountDTO updateAccountDTO = new UpdateAccountDTO();
|
|
|
|
+ updateAccountDTO.setPhone(phone);
|
|
|
|
+ updateAccountDTO.setId(oldUser.getId());
|
|
|
|
+ FeignFactory.adminInterface.updateAccount(updateAccountDTO);
|
|
|
|
+ }
|
|
|
|
+ tbPeople.setPhone(phone);
|
|
|
|
+ this.updateById(tbPeople);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|