Browse Source

Merge remote-tracking branch 'origin/dev' into dev

Mechrevo 1 year ago
parent
commit
313805af74

+ 25 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java

@@ -7,6 +7,7 @@ import java.util.List;
 import java.util.Objects;
 
 import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.pj.tb_enterprise.TbEnterprise;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleService;
@@ -185,7 +186,29 @@ public class TbGroupController {
 		return AjaxJson.getByLine(line);
 	}
 
+	/**
+	 *根据互助组id查看组内成员列表
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	@RequestMapping("getMemberListByGroupId")
+//	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
+	public AjaxJson getMemberListByGroupId(Long id){
+		AjaxJson ajaxJson =  tbGroupService.getMemberListByGroupId(id);
+		return ajaxJson;
+	}
 
-
-
+	/**
+	 *根据组长id查看互助组内成员列表
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	@RequestMapping("getMemberListByLeaderId")
+//	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
+	public AjaxJson getMemberListByLeaderId(Long id){
+		AjaxJson ajaxJson =  tbGroupService.getMemberListByLeaderId(id);
+		return ajaxJson;
+	}
 }

+ 100 - 54
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java

@@ -9,6 +9,7 @@ import java.util.List;
 import java.util.Objects;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.tb_goods_transit.TbGoodsTransit;
 import com.pj.tb_people.TbPeople;
@@ -35,9 +36,11 @@ import javax.swing.filechooser.FileSystemView;
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implements IService<TbGroup>{
+public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implements IService<TbGroup> {
 
-	/** 底层 Mapper 对象 */
+	/**
+	 * 底层 Mapper 对象
+	 */
 	@Autowired
 	TbGroupMapper tbGroupMapper;
 	@Autowired
@@ -45,32 +48,44 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 
 	@Autowired
 	private MethodGroupService methodGroupService;
-	/** 增 */
-	void add(TbGroup t){
+
+	/**
+	 * 增
+	 */
+	void add(TbGroup t) {
 		save(t);
 	}
 
-	/** 删 */
-	void delete(Long id){
+	/**
+	 * 删
+	 */
+	void delete(Long id) {
 		removeById(id);
 	}
 
-	/** 改 */
-	void update(TbGroup t){
+	/**
+	 * 改
+	 */
+	void update(TbGroup t) {
 		updateById(t);
 
 	}
 
-	/** 查 */
-	TbGroup getById(String id){
+	/**
+	 * 查
+	 */
+	TbGroup getById(String id) {
 		return super.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbGroup> getList(SoMap so) { 
-		return tbGroupMapper.getList(so);	
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 */
+	List<TbGroup> getList(SoMap so) {
+		return tbGroupMapper.getList(so);
 	}
-	public int setLeader(Long groupId,Long leaderId){
+
+	public int setLeader(Long groupId, Long leaderId) {
 		// 获取当前登录用户id
 		Long loginId = StpUserUtil.getLoginIdAsLong();
 		// 获取互助组信息
@@ -78,19 +93,19 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		// 获取边民信息
 		TbPeople tbPeople = tbPeopleMapper.selectById(leaderId);
 		// 如果互助组不存在则抛异常
-		if (Objects.isNull(tbGroup)){
+		if (Objects.isNull(tbGroup)) {
 			throw new RuntimeException("该互助组不存在");
 		}
 		// 如果边民不存在
-		if (Objects.isNull(tbPeople)){
+		if (Objects.isNull(tbPeople)) {
 			throw new RuntimeException("该用户不存在");
 		}
 		// 如果互助组被锁定则抛异常
-		if(tbGroup.getIsLock()==1){
+		if (tbGroup.getIsLock() == 1) {
 			throw new RuntimeException("该互助组已被锁定");
 		}
 		// 如果边民不存在则抛异常
-		if (tbPeople.getIsLock()==1){
+		if (tbPeople.getIsLock() == 1) {
 			throw new RuntimeException("该用户已被锁定");
 		}
 		// 设置互助组组长
@@ -103,22 +118,23 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		int line = tbGroupMapper.updateById(tbGroup);
 		return line;
 	}
-	public int AddGroupPeople(Long groupId,Long [] peopleIds){
+
+	public int AddGroupPeople(Long groupId, Long[] peopleIds) {
 		// 获取当前登录用户id
 //		Long loginId = StpUserUtil.getLoginIdAsLong();
-		int line=0;
+		int line = 0;
 		// 获取互助组信息
 		TbGroup tbGroup = tbGroupMapper.selectById(groupId);
 		// 如果互助组不存在则抛异常
-		if (Objects.isNull(tbGroup)){
+		if (Objects.isNull(tbGroup)) {
 			throw new RuntimeException("该互助组不存在");
 		}
 		// 如果互助组被锁定则抛异常
-		if(tbGroup.getIsLock()==1){
+		if (tbGroup.getIsLock() == 1) {
 			throw new RuntimeException("该互助组已被锁定");
 		}
 		// 如果互助组被删除则抛异常
-		if(tbGroup.getDeleteStatus()==1){
+		if (tbGroup.getDeleteStatus() == 1) {
 			throw new RuntimeException("该互助组已被删除");
 		}
 		List<Long> list = Arrays.asList(peopleIds);
@@ -130,28 +146,29 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 			// 写入更新者id
 //			tbPeople.setUpdateBy(String.valueOf(loginId));
 			int i = tbPeopleMapper.updateById(tbPeople);
-			line= i + 1;
+			line = i + 1;
 		}
 		return line;
 
 	}
-	public int DelGroupPeople(Long groupId,Long [] peopleIds){
+
+	public int DelGroupPeople(Long groupId, Long[] peopleIds) {
 
 		// 获取当前登录用户id
 		Long loginId = StpUserUtil.getLoginIdAsLong();
-		int line=0;
+		int line = 0;
 		// 获取互助组信息
 		TbGroup tbGroup = tbGroupMapper.selectById(groupId);
 		// 如果互助组不存在则抛异常
-		if (Objects.isNull(tbGroup)){
+		if (Objects.isNull(tbGroup)) {
 			throw new RuntimeException("该互助组不存在");
 		}
 		// 如果互助组被锁定则抛异常
-		if(tbGroup.getIsLock()==1){
+		if (tbGroup.getIsLock() == 1) {
 			throw new RuntimeException("该互助组已被锁定");
 		}
 		// 如果互助组被删除则抛异常
-		if(tbGroup.getDeleteStatus()==1){
+		if (tbGroup.getDeleteStatus() == 1) {
 			throw new RuntimeException("该互助组已被删除");
 		}
 		List<Long> list = Arrays.asList(peopleIds);
@@ -163,10 +180,11 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 			// 写入更新者id
 			tbPeople.setUpdateBy(String.valueOf(loginId));
 			int i = tbPeopleMapper.updateById(tbPeople);
-			line= i + 1;
+			line = i + 1;
 		}
 		return line;
 	}
+
 	public int isLock(TbGroupDto tbGroupDto) {
 		// 获取当前登录用户id
 		Long loginId = StpUserUtil.getLoginIdAsLong();
@@ -177,18 +195,45 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 			throw new RuntimeException("该互助组不存在");
 		}
 		// 如果互助组被删除则抛异常
-		if (tbGroup.getDeleteStatus()==1) {
+		if (tbGroup.getDeleteStatus() == 1) {
 			throw new RuntimeException("该互助组已被删除");
 		}
-		BeanUtils.copyProperties(tbGroupDto,tbGroup);
+		BeanUtils.copyProperties(tbGroupDto, tbGroup);
 		// 写入更新者id
 		tbGroup.setUpdateBy(String.valueOf(loginId));
 		// 更新互助组信息
 		int line = tbGroupMapper.updateById(tbGroup);
 		return line;
 	}
+
+	/**
+	 * 根据互助组id查看组内成员
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	public AjaxJson getMemberListByGroupId(Long id) {
+		SoMap so = SoMap.getRequestSoMap();
+		so.set("groupId",id);
+		List<TbPeople> list = tbPeopleMapper.getMemberListByGroupId(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	/**
+	 *组长查看互助组内成员
+	 *
+	 * @author loovi
+	 * @date
+	 */
+	public AjaxJson getMemberListByLeaderId(Long id){
+		SoMap so = SoMap.getRequestSoMap();
+		so.set("leaderId",id);
+		List<TbPeople> list = tbPeopleMapper.getMemberListByLeaderId(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+
 	/**
 	 * 导入
+	 *
 	 * @param file excel文件
 	 * @return
 	 * @throws IOException
@@ -197,7 +242,7 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		System.out.println("\n开始执行文件上传....\n");
 
 		//判空
-		if(file.isEmpty()) return "文件为空,无法执行上传...";
+		if (file.isEmpty()) return "文件为空,无法执行上传...";
 		//获取文件上传数据
 		HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream());
 		//获取第一页sheet
@@ -210,18 +255,19 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		count = methodGroupService.importMethod(row, sheet, count);
 		wb.close();
 		System.out.println("\n文件上传完成,共上传 " + count + "条 " + "数据...\n");
-		return "上传完成,共上传"  + count + "条"  + "数据。";
+		return "上传完成,共上传" + count + "条" + "数据。";
 	}
 
 	/**
 	 * 导出 excel文件
+	 *
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword,String filepath) throws IOException {
+	public String outportExcel(String keyword, String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
 		//导出的文件的路径
-		if(filepath == null || filepath.trim().equals("")){
+		if (filepath == null || filepath.trim().equals("")) {
 			// 获取当前用户的桌面路径
 			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
 			filepath = fileSystemView.getHomeDirectory().getPath();
@@ -229,7 +275,7 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		filepath = filepath + "\\互助组数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbGroup> selectedList = tbGroupMapper.selectList(new LambdaQueryWrapper<TbGroup>().eq(StringUtils.isNoneBlank(keyword), TbGroup::getName, keyword));
-		if(selectedList.size() == 0)return "没有可导出的数据。";
+		if (selectedList.size() == 0) return "没有可导出的数据。";
 		//建立excel对象封装数据
 		HSSFWorkbook workbook = new HSSFWorkbook();
 		//创建excel表格右下角的sheet页名称
@@ -261,24 +307,24 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
 			sheetRow.createCell(0).setCellValue(i + 1);
-			sheetRow.createCell(1).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null")? "": selectedList.get(i).getAddressIds() + "");
-			sheetRow.createCell(2).setCellValue((selectedList.get(i).getAddress() + "").equals("null")? "": selectedList.get(i).getAddress() + "");
-			sheetRow.createCell(3).setCellValue((selectedList.get(i).getDetailAddress() + "").equals("null")? "": selectedList.get(i).getDetailAddress() + "");
-			sheetRow.createCell(4).setCellValue((selectedList.get(i).getName() + "").equals("null")? "": selectedList.get(i).getName() + "");
-			sheetRow.createCell(5).setCellValue((selectedList.get(i).getLeaderId() + "").equals("null")? "": selectedList.get(i).getLeaderId() + "");
-			sheetRow.createCell(6).setCellValue((selectedList.get(i).getLeaderName() + "").equals("null")? "": selectedList.get(i).getLeaderName() + "");
-			sheetRow.createCell(7).setCellValue((selectedList.get(i).getLeaderPhone() + "").equals("null")? "": selectedList.get(i).getLeaderPhone() + "");
-			sheetRow.createCell(8).setCellValue((selectedList.get(i).getCode() + "" ).equals("null")? "": selectedList.get(i).getCode() + "");
-			sheetRow.createCell(9).setCellValue((selectedList.get(i).getLeftPrice() + "").equals("null")? "": selectedList.get(i).getLeftPrice() + "");
+			sheetRow.createCell(1).setCellValue((selectedList.get(i).getAddressIds() + "").equals("null") ? "" : selectedList.get(i).getAddressIds() + "");
+			sheetRow.createCell(2).setCellValue((selectedList.get(i).getAddress() + "").equals("null") ? "" : selectedList.get(i).getAddress() + "");
+			sheetRow.createCell(3).setCellValue((selectedList.get(i).getDetailAddress() + "").equals("null") ? "" : selectedList.get(i).getDetailAddress() + "");
+			sheetRow.createCell(4).setCellValue((selectedList.get(i).getName() + "").equals("null") ? "" : selectedList.get(i).getName() + "");
+			sheetRow.createCell(5).setCellValue((selectedList.get(i).getLeaderId() + "").equals("null") ? "" : selectedList.get(i).getLeaderId() + "");
+			sheetRow.createCell(6).setCellValue((selectedList.get(i).getLeaderName() + "").equals("null") ? "" : selectedList.get(i).getLeaderName() + "");
+			sheetRow.createCell(7).setCellValue((selectedList.get(i).getLeaderPhone() + "").equals("null") ? "" : selectedList.get(i).getLeaderPhone() + "");
+			sheetRow.createCell(8).setCellValue((selectedList.get(i).getCode() + "").equals("null") ? "" : selectedList.get(i).getCode() + "");
+			sheetRow.createCell(9).setCellValue((selectedList.get(i).getLeftPrice() + "").equals("null") ? "" : selectedList.get(i).getLeftPrice() + "");
 
 			//公共字段
-			sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null")? "": selectedList.get(i).getCreateTime() + "");
-			sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null")? "": selectedList.get(i).getCreateBy() + "");
-			sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null")? "": selectedList.get(i).getCreateName() + "");
-			sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null")? "": selectedList.get(i).getUpdateTime() + "");
-			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
-			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
-			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			sheetRow.createCell(22).setCellValue((selectedList.get(i).getCreateTime() + "").equals("null") ? "" : selectedList.get(i).getCreateTime() + "");
+			sheetRow.createCell(23).setCellValue((selectedList.get(i).getCreateBy() + "").equals("null") ? "" : selectedList.get(i).getCreateBy() + "");
+			sheetRow.createCell(24).setCellValue((selectedList.get(i).getCreateName() + "").equals("null") ? "" : selectedList.get(i).getCreateName() + "");
+			sheetRow.createCell(25).setCellValue((selectedList.get(i).getUpdateTime() + "").equals("null") ? "" : selectedList.get(i).getUpdateTime() + "");
+			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null") ? "" : selectedList.get(i).getUpdateBy() + "");
+			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null") ? "" : selectedList.get(i).getUpdateName() + "");
+			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null") ? "" : selectedList.get(i).getDeleteStatus() + "");
 			count += 1;
 		}
 		//建立输出流,输出文件
@@ -293,5 +339,5 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
-
 }
+

+ 0 - 18
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -154,24 +154,6 @@ public class TbPeopleController {
 
 	}
 
-	/**
-	 *查看互助组内成员列表
-	 *
-	 * @author loovi
-	 * @date
-	 */
-	@RequestMapping("getMemberList")
-//	@SaCheckPermission(TbGroup.PERMISSION_CODE_EDIT)
-	public AjaxJson getMemberList(@RequestParam("leaderId") Long leaderId){
-		SoMap so = SoMap.getRequestSoMap();
-		so.set("leader_id",leaderId);
-		AjaxJson ajaxJson =  tbPeopleService.getMemberList(so);
-		return ajaxJson;
-	}
-
-
-
-
 
 
 	/**

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleMapper.java

@@ -29,7 +29,8 @@ public interface TbPeopleMapper extends BaseMapper <TbPeople> {
 	int checkApplyExist(@Param("peopleId") Long peopleId);
 	int addApply(@Param("peopleId") Long peopleId, @Param("groupId") Long groupId);
 	List <TbPeople>getApplyList(SoMap so);
-	List <TbPeople>getMemberList(SoMap so);
+	List <TbPeople>getMemberListByGroupId(SoMap so);
+	List <TbPeople>getMemberListByLeaderId(SoMap so);
 	int updateApplyStatus(@Param("status") int status,@Param("peopleId") Long peopleId);
 
 

+ 15 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleMapper.xml

@@ -60,10 +60,22 @@
 		where ap.group_id = (select id from tb_group g where g.leader_id =#{leaderId})and ap.status=0
 	</select>
 
-	<select id="getMemberList" resultType="com.pj.tb_people.TbPeople">
-		<include refid="select_tbPeople"></include>
-		where group_id = (select id from tb_group where leader_id =#{leaderId})
+	<select id="getMemberListByGroupId" resultType="com.pj.tb_people.TbPeople">
+		<include refid="select_sql" ></include>
+				<where>
+					<if test="groupId != null and groupId != ''">group_id =#{groupId}</if>
+				</where>
+	</select>
+
+	<select id="getMemberListByLeaderId" resultType="com.pj.tb_people.TbPeople">
+		<include refid="select_sql" ></include>
+		<where>
+			<if test="leaderId != null and leaderId != ''">
+				group_id = (SELECT id FROM tb_group WHERE leader_id = #{leaderId})
+			</if>
+		</where>
 	</select>
+
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
 		<include refid="select_sql"></include>

+ 1 - 10
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -208,16 +208,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	   List<ApplyPeopleVo> resList = CglibUtil.copyList(list, ApplyPeopleVo::new);
 	   return AjaxJson.getPageData(so.getDataCount(), resList);
    }
-	/**
-	 *查看互助组内成员
-	 *
-	 * @author loovi
-	 * @date
-	 */
-	public AjaxJson getMemberList(SoMap so){
-		List<TbPeople> list = tbPeopleMapper.getMemberList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
+
 	/**
 	 *组长批准是否同意加入申请
 	 *

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNews.java

@@ -89,7 +89,7 @@ public class TbPortNews extends Model<TbPortNews> implements Serializable {
 	 * 发布时间
 	 *
 	 */
-	@JsonFormat(pattern = "yyyy-MM-dd")
+//	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date releaseTime;	
 
 	/**