|
@@ -1,11 +1,15 @@
|
|
|
package com.pj.tb_cooperative;
|
|
|
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.pj.api.consts.FeignFactory;
|
|
|
+import com.pj.api.dto.AdminCreateDto;
|
|
|
import com.pj.api.dto.CooperativeDto;
|
|
|
import com.pj.api.dto.HtCooperativeDto;
|
|
|
+import com.pj.current.config.SystemObject;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.tb_trade_area.TbTradeArea;
|
|
@@ -103,6 +107,19 @@ public class TbCooperativeService extends ServiceImpl<TbCooperativeMapper, TbCoo
|
|
|
tbCooperative.setCreateTime(new Date());
|
|
|
//新增
|
|
|
boolean save = this.save(tbCooperative);
|
|
|
+ //新增的同时给合作社代表创建一个登陆后台的管理账号
|
|
|
+ if(save){
|
|
|
+ //随机生成6位密码
|
|
|
+ String code = RandomUtil.randomNumbers(6);
|
|
|
+ SystemObject.smsFactory.handler().sendSMS(cooperativeDto.getCorrepTel(), "您的密码是" + code + "。请及时修改密码");
|
|
|
+ AdminCreateDto dto=new AdminCreateDto();
|
|
|
+ dto.setTradeAreaId(Long.parseLong(cooperativeDto.getFieldCode()));
|
|
|
+ dto.setPassword(code);
|
|
|
+ dto.setName(cooperativeDto.getCorrepTel());
|
|
|
+ dto.setRoleId(99); //所属角色ID,当前是99
|
|
|
+ dto.setType("01");//类型(00=运营管理者,01=合作社)
|
|
|
+ FeignFactory.adminInterface.createAdmin(dto);
|
|
|
+ }
|
|
|
return save;
|
|
|
}
|
|
|
tbCooperative.setName(cooperativeDto.getCorrepName());
|