| | |
| | | import com.dg.core.ResultData; |
| | | import com.dg.core.db.gen.entity.*; |
| | | import com.dg.core.db.gen.mapper.*; |
| | | import com.dg.core.db.manual.mapper.util.ConstantPropertiesUtil; |
| | | import com.dg.core.service.IGuideRepairOrderService; |
| | | import com.dg.core.service.ISysSettingsService; |
| | | import com.dg.core.util.SmsUtil; |
| | |
| | | import com.dg.core.util.TestDate; |
| | | import com.dg.core.util.WxUtil; |
| | | import com.iceyyy.workday.WorkUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | @Resource |
| | | private AutomessageSysSettingsMapper iSysSettingsMapper; |
| | | |
| | | |
| | | @Resource |
| | | SmsUtil smsUtil; |
| | | |
| | | @Resource(name = "stringRedisTemplate") |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | private static WxUtil wxUtil; |
| | | |
| | | |
| | | @Override |
| | | public int addOrder(GuideRepairOrder guideRepairOrder) { |
| | |
| | | departmentIds = this.getDepartmentIds(organizationChartEntitiesUser, departmentIds); |
| | | } |
| | | sysUsers = sysUserMapper.selectListByDepartmentId(departmentIds, "," + transactionEvent.getClassifyId(), transactionEvent.getClassifyId() + ",");//获取导半人员 |
| | | if (sysUsers.size() == 0) {//如果其下级部门仍没有该分类的导半人员则查询所以该所属地区的导办人员 |
| | | if (sysUsers.size() == 0) {//如果该所属地区没有导办人员则为获取其上級地区有没有相关分类导办人员 |
| | | List<String> departmentIdsParent = new ArrayList<>(); |
| | | departmentIdsParent.addAll(departmentIds); |
| | | for (String departmentId : departmentIdsParent) { |
| | | OrganizationChartEntity organizationChart = organizationChartMapper.selectOne(new QueryWrapper<OrganizationChartEntity>().lambda().eq(OrganizationChartEntity::getId, departmentId)); |
| | | OrganizationChartEntity organizationChartParent = organizationChartMapper.selectOne(new QueryWrapper<OrganizationChartEntity>().lambda().eq(OrganizationChartEntity::getId, organizationChart.getParentId())); |
| | | departmentIds.add(organizationChartParent.getId().toString()); |
| | | } |
| | | sysUsers = sysUserMapper.selectListByDepartmentId(departmentIds, "," + transactionEvent.getClassifyId(), transactionEvent.getClassifyId() + ",");//获取导半人员 |
| | | if (sysUsers.size() == 0) { |
| | | sysUsers = sysUserMapper.selectListByDepartmentId(departmentIds, null, null);//获取导半人员 |
| | | if (sysUsers.size() == 0)//如果该所属地区没有导办人员则为特殊单据需要手动分配 |
| | | if (sysUsers.size() == 0) { |
| | | //如果该所属地区没有导办人员则为特殊单据需要手动分配 |
| | | guideRepairOrder.setState("1"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (sysUsers.size() > 0) {//系统分配导办人员 |
| | | SysUser sysUser = sysUsers.get(0);//因为sql用了升序排序所以第一条就是待办结最少的人员之一 |
| | |
| | | WxUtil wxUtil = new WxUtil(); |
| | | String accessToken = "0"; |
| | | try { |
| | | accessToken = wxUtil.getBatteryCarAccessToken(); |
| | | accessToken = stringRedisTemplate.boundValueOps("access_token:access_token:" + ConstantPropertiesUtil.WX_OPEN_APP_ID).get().toString(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | WxUtil wxUtil = new WxUtil(); |
| | | String accessToken = "0"; |
| | | try { |
| | | accessToken = wxUtil.getBatteryCarAccessToken(); |
| | | accessToken = stringRedisTemplate.boundValueOps("access_token:access_token:" + ConstantPropertiesUtil.WX_OPEN_APP_ID).get().toString(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | for (GuideRepairOrder guideRepairOrder:guideRepairOrders) { |
| | | SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getUserId, guideRepairOrder.getGuideUserId())); |
| | | if (sysUser!=null) |
| | | { |
| | | if (sysUser != null) { |
| | | smsUtil.sendSmsOvertime(sysUser.getPhonenumber(), sysUser.getUserName()); |
| | | wxUtil.sendGuideRepairOrderOvertime(sysUser.getOpenid(),accessToken,"86JgWHhR8b1XxD72WYqMnndyfkiMtSSoCk9NFMwLEZ8",sysUser); |
| | | guideRepairOrder.setIsPush(1); |