|
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.jms.core.JmsMessagingTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -170,4 +171,25 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|
|
.workReplaceRegionCharger(areaName, oldUser, newUser)
|
|
|
.sendTokenOnPlatform(jmsMessagingTemplate, userInfos);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改区域时,检测新老区域主管,有修改时发送推送消息,修改project_user表内的区域主管信息
|
|
|
+ *
|
|
|
+ * @param region 区域信息
|
|
|
+ * @return 操作结果
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public RestResponse<?> updateByRegionId(Region region) {
|
|
|
+ Region byId = this.getById(region);
|
|
|
+ //如果区域主管更改了,发推送消息,修改project_user表内的区域主管信息
|
|
|
+ if (!byId.getUserId().equals(region.getUserId())) {
|
|
|
+ List<Long> projects = baseMapper.selectProjectIdByRegionDirectorId(byId.getUserId(), byId.getMtCompanyId());
|
|
|
+ baseMapper.updateRegionDirector(projects, region.getUserId(), byId.getMtCompanyId());
|
|
|
+ String oldUser = baseMapper.selectNameByUserId(byId.getUserId());
|
|
|
+ String newUser = baseMapper.selectNameByUserId(region.getUserId());
|
|
|
+ String areaName = byId.getAreaName();
|
|
|
+ this.push(areaName, oldUser, newUser, byId, region);
|
|
|
+ }
|
|
|
+ return RestResponse.success(this.updateById(region));
|
|
|
+ }
|
|
|
}
|