|
|
@@ -12,11 +12,14 @@ import com.lc.ibps.cloud.entity.APIResult;
|
|
|
import com.lc.ibps.cloud.redis.utils.RedisUtil;
|
|
|
import com.lc.ibps.config.JcjdConfig;
|
|
|
import com.lc.ibps.org.party.persistence.entity.PartyEmployeePo;
|
|
|
+import com.lc.ibps.sysdata.dao.UpdateDataTableDao;
|
|
|
+import com.lc.ibps.wx.dao.FileAttachmentMapper;
|
|
|
import com.lc.ibps.wx.dao.HyqdDao;
|
|
|
+import com.lc.ibps.wx.dao.UserRole;
|
|
|
import com.lc.ibps.wx.dao.WxyhDao;
|
|
|
-import com.lc.ibps.wx.entity.HyqdEntity;
|
|
|
-import com.lc.ibps.wx.entity.Token;
|
|
|
-import com.lc.ibps.wx.entity.WxUserEntity;
|
|
|
+import com.lc.ibps.wx.entity.*;
|
|
|
+import com.lc.ibps.wx.services.UserRoleService;
|
|
|
+import com.lc.ibps.wx.services.UserSituationService;
|
|
|
import com.lc.ibps.wx.services.wxServices;
|
|
|
|
|
|
|
|
|
@@ -52,6 +55,14 @@ public class wxServicesImpl implements wxServices {
|
|
|
HyqdDao hyqdDao;
|
|
|
@Autowired
|
|
|
WxyhDao wxyhDao;
|
|
|
+ @Autowired
|
|
|
+ UpdateDataTableDao updateDataTableDao;
|
|
|
+ @Autowired
|
|
|
+ UserRoleService userRoleService;
|
|
|
+ @Autowired
|
|
|
+ UserSituationService userSituationService;
|
|
|
+ @Autowired
|
|
|
+ FileAttachmentMapper fileAttachmentMapper;
|
|
|
|
|
|
public APIResult<Void> openId(@RequestParam String code, @RequestParam String state) {
|
|
|
APIResult<Void> apiResult = new APIResult<>();
|
|
|
@@ -177,44 +188,34 @@ public class wxServicesImpl implements wxServices {
|
|
|
}
|
|
|
else { //查询到系统用户 ,保存微信用户 并签到
|
|
|
//查询该系统用户是否已被其它人注册
|
|
|
-
|
|
|
-
|
|
|
PartyEmployeePo employeePo = result.get(0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
WxUserEntity wxUser = new WxUserEntity();
|
|
|
wxUser.setId(IdUtil.simpleUUID());
|
|
|
wxUser.setOpenid(map.get("openid").toString());
|
|
|
wxUser.setXingMing(employeePo.getName());
|
|
|
wxUser.setShouJi(employeePo.getMobile());
|
|
|
-
|
|
|
//查询该系统用户是否已被其它人注册
|
|
|
List<WxUserEntity> entities = wxyhDao.selects(wxUser);
|
|
|
-
|
|
|
if (entities==null || entities.size()>1){
|
|
|
apiResult.setState(JcjdConfig.error);
|
|
|
apiResult.setMessage("该用户已被注册:"+employeePo.getName()+" "+employeePo.getMobile());
|
|
|
return apiResult;
|
|
|
}
|
|
|
-
|
|
|
- System.out.println(JSON.toJSONString(wxUser));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
wxyhDao.add(wxUser); //保存用户
|
|
|
-
|
|
|
HyqdEntity hyqd = new HyqdEntity();
|
|
|
hyqd.setId(IdUtil.simpleUUID());
|
|
|
- hyqd.setShouJi(employeePo.getMobile());
|
|
|
- hyqd.setHuiYiChangJing(map.get("state").toString());
|
|
|
- hyqd.setQianDaoRenYuan(employeePo.getName());
|
|
|
+ hyqd.setShouJi(employeePo.getMobile()); //手机号
|
|
|
+ hyqd.setHuiYiChangJing(map.get("state").toString()); //场景id
|
|
|
+ hyqd.setQianDaoRenYuan(employeePo.getName()); //用户名
|
|
|
hyqd.setQianDaoShiJian(DateUtil.now()); //存放签到时间
|
|
|
-
|
|
|
+ hyqd.setBuMen(employeePo.getPositions());//部门
|
|
|
+ String role = userRoleService.findUserRole(employeePo.getId());
|
|
|
+ hyqd.setGangWeiJiaoSe(!role.isEmpty() ? role:""); //角色
|
|
|
+ UserSituation user = userSituationService.findByUserId(hyqd.getId());
|
|
|
+ FileAttachment file = fileAttachmentMapper.findByid(user.getQianZiTuWen());
|
|
|
+ hyqd.setQianZiTuWen(!file.getId().isEmpty()?file.getId():"");//签字图文
|
|
|
+ hyqd.setTuWenMingCheng(!file.fileName.isEmpty()?file.fileName:"");//图文名称
|
|
|
hyqdDao.add(hyqd);
|
|
|
-
|
|
|
apiResult.setMessage("签到成功!");
|
|
|
apiResult.setState(JcjdConfig.successful);
|
|
|
}
|