新增了连续字符串截断方法和组织部门编码统计
This commit is contained in:
parent
dbf66cdb22
commit
c7b98e87e7
@ -179,4 +179,20 @@ public interface IDepartmentBaseService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DepartmentPO> listPOByAreaCodeAndType(String departmentAreaCode, Integer departmentType);
|
List<DepartmentPO> listPOByAreaCodeAndType(String departmentAreaCode, Integer departmentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计地区全部组织
|
||||||
|
*
|
||||||
|
* @param areaCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer countByAreaCode(String areaCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计地区全部组织
|
||||||
|
*
|
||||||
|
* @param areaCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer countAllByAreaCode(String areaCode);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
|||||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||||
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
|
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
|
||||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -369,8 +370,8 @@ public class WStringUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(String str : strings) {
|
for (String str : strings) {
|
||||||
if(sb.length() > 0) {
|
if (sb.length() > 0) {
|
||||||
sb.append(separator);
|
sb.append(separator);
|
||||||
}
|
}
|
||||||
sb.append(str);
|
sb.append(str);
|
||||||
@ -378,4 +379,23 @@ public class WStringUtil {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 倒序截断重复字符
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String cutContinuityRepeatCharDesc(String str, char repeatChar) {
|
||||||
|
if (StringUtils.isBlank(str)) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
int unRepeatCharIndex = 0;
|
||||||
|
for (int i = str.length() - 1; i >= 0; i--) {
|
||||||
|
if (str.charAt(i) != repeatChar) {
|
||||||
|
unRepeatCharIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str.substring(0, unRepeatCharIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import ink.wgink.pojo.result.SuccessResultData;
|
|||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.pojo.vos.IdsVO;
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import ink.wgink.properties.ApiPathProperties;
|
import ink.wgink.properties.ApiPathProperties;
|
||||||
|
import ink.wgink.util.string.WStringUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -172,4 +173,18 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
|||||||
public List<DepartmentPO> listPOByAreaCodeAndType(String departmentAreaCode, Integer departmentType) {
|
public List<DepartmentPO> listPOByAreaCodeAndType(String departmentAreaCode, Integer departmentType) {
|
||||||
return departmentRemoteService.listPOByAreaCodeAndType(apiPathProperties.getUserCenter(), departmentAreaCode, departmentType, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
return departmentRemoteService.listPOByAreaCodeAndType(apiPathProperties.getUserCenter(), departmentAreaCode, departmentType, OAuth2ClientTokenManager.getInstance().getToken().getAccessToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countByAreaCode(String areaCode) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("departmentAreaCode", areaCode);
|
||||||
|
return count(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countAllByAreaCode(String areaCode) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
|
||||||
|
return count(params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,111 @@
|
|||||||
|
package ink.wgink.module.map.controller.app.api.grid;
|
||||||
|
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import ink.wgink.module.map.pojo.dtos.grid.GridDTO;
|
||||||
|
import ink.wgink.module.map.service.grid.IGridService;
|
||||||
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: GridControler
|
||||||
|
* @Description: 网格管理
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/10/19 10:21 下午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "网格接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.APP_PREFIX + "/grid")
|
||||||
|
public class GridAppController extends DefaultBaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGridService gridService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格详情", notes = "网格详情接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "gridIdId", value = "网格ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get/{gridId}")
|
||||||
|
public GridDTO get(@RequestHeader("token") String token, @PathVariable("gridId") String gridId) {
|
||||||
|
return gridService.get(gridId, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格列表", notes = "网格列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list")
|
||||||
|
public List<GridDTO> list(@RequestHeader("token") String token) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return gridService.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格列表", notes = "网格列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list/area-code/{areaCode}")
|
||||||
|
public List<GridDTO> listByAreaCode(@PathVariable("areaCode") String areaCode) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return gridService.listByAreaCode(areaCode, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格(排除查询网格)列表", notes = "网格(排除查询网格)列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list/except/{gridId}")
|
||||||
|
public List<GridDTO> listExcept(@RequestHeader("token") String token,
|
||||||
|
@PathVariable("gridId") String gridId) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return gridService.listExcept(gridId, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格分页列表", notes = "网格分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage")
|
||||||
|
public SuccessResultList<List<GridDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return gridService.listPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "网格分页列表", notes = "网格分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage/area-code/{areaCode}")
|
||||||
|
public SuccessResultList<List<GridDTO>> listPageByAreaCode(@RequestHeader("token") String token, @PathVariable("areaCode") String areaCode, ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return gridService.listPageByAreaCode(areaCode, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -30,6 +30,7 @@ import ink.wgink.service.department.service.IDepartmentService;
|
|||||||
import ink.wgink.service.department.service.IDepartmentUserService;
|
import ink.wgink.service.department.service.IDepartmentUserService;
|
||||||
import ink.wgink.util.UUIDUtil;
|
import ink.wgink.util.UUIDUtil;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
|
import ink.wgink.util.string.WStringUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -367,6 +368,20 @@ public class DepartmentServiceImpl extends DefaultBaseService implements IDepart
|
|||||||
return listPO(params);
|
return listPO(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countByAreaCode(String areaCode) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("departmentAreaCode", areaCode);
|
||||||
|
return count(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer countAllByAreaCode(String areaCode) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("departmentAreaCodeLike", WStringUtil.cutContinuityRepeatCharDesc(areaCode, '0'));
|
||||||
|
return count(params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过上级ID和新增或修改日期获取组织列表(简单模式)
|
* 通过上级ID和新增或修改日期获取组织列表(简单模式)
|
||||||
*
|
*
|
||||||
|
@ -711,6 +711,14 @@
|
|||||||
AND
|
AND
|
||||||
department_state = #{departmentState}
|
department_state = #{departmentState}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="departmentAreaCode != null and departmentAreaCode != ''">
|
||||||
|
AND
|
||||||
|
department_area_code = #{departmentAreaCode}
|
||||||
|
</if>
|
||||||
|
<if test="departmentAreaCodeLike != null and departmentAreaCodeLike != ''">
|
||||||
|
AND
|
||||||
|
department_area_code LIKE CONCAT(#{departmentAreaCodeLike}, '%')
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 部门ID列表 -->
|
<!-- 部门ID列表 -->
|
||||||
|
Loading…
Reference in New Issue
Block a user