|
@@ -19,198 +19,236 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
* Controller: tb_people -- 边民
|
|
|
- * @author qzy
|
|
|
+ *
|
|
|
+ * @author qzy
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/TbPeople/")
|
|
|
public class TbPeopleController {
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- TbPeopleService tbPeopleService;
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("add")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE_ADD)
|
|
|
- public AjaxJson add(TbPeople t){
|
|
|
- tbPeopleService.add(t);
|
|
|
- t = tbPeopleService.getById(SP.publicMapper.getPrimarykey());
|
|
|
- return AjaxJson.getSuccessData(t);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("delete")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE_DEL)
|
|
|
- public AjaxJson delete(Long id){
|
|
|
- tbPeopleService.delete(id);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("deleteByIds")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE_DEL)
|
|
|
- public AjaxJson deleteByIds(){
|
|
|
- List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
- int line = SP.publicMapper.deleteByIds(TbPeople.TABLE_NAME, ids);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("update")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE_EDIT)
|
|
|
- public AjaxJson update(TbPeople t){
|
|
|
- tbPeopleService.update(t);
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("getById")
|
|
|
+
|
|
|
+ * 底层 Service 对象
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ TbPeopleService tbPeopleService;
|
|
|
+
|
|
|
+
|
|
|
+ * 增
|
|
|
+ */
|
|
|
+ @RequestMapping("add")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE_ADD)
|
|
|
+ public AjaxJson add(TbPeople t) {
|
|
|
+ tbPeopleService.add(t);
|
|
|
+ t = tbPeopleService.getById(SP.publicMapper.getPrimarykey());
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 删
|
|
|
+ */
|
|
|
+ @RequestMapping("delete")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE_DEL)
|
|
|
+ public AjaxJson delete(Long id) {
|
|
|
+ tbPeopleService.delete(id);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 删 - 根据id列表
|
|
|
+ */
|
|
|
+ @RequestMapping("deleteByIds")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE_DEL)
|
|
|
+ public AjaxJson deleteByIds() {
|
|
|
+ List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
+ int line = SP.publicMapper.deleteByIds(TbPeople.TABLE_NAME, ids);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 改
|
|
|
+ */
|
|
|
+ @RequestMapping("update")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE_EDIT)
|
|
|
+ public AjaxJson update(TbPeople t) {
|
|
|
+ tbPeopleService.update(t);
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查 - 根据id
|
|
|
+ */
|
|
|
+ @RequestMapping("getById")
|
|
|
|
|
|
- public AjaxJson getById(String id){
|
|
|
- TbPeople t = tbPeopleService.getById(id);
|
|
|
- return AjaxJson.getSuccessData(t);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("getList")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE)
|
|
|
- public AjaxJson getList() {
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- List<TbPeople> list = tbPeopleService.getList(so.startPage());
|
|
|
- return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("updateDeleteStatus")
|
|
|
- @SaCheckPermission(TbPeople.PERMISSION_CODE_EDIT)
|
|
|
- public AjaxJson updateDeleteStatus(String id, Integer value){
|
|
|
- int line = SP.publicMapper.updateColumnById(TbPeople.TABLE_NAME, "delete_status", value, id);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("judge")
|
|
|
- public AjaxJson judge(@RequestBody TbPeople tbPeople){
|
|
|
- boolean judge = tbPeopleService.judge(tbPeople);
|
|
|
- if(judge){
|
|
|
- return AjaxJson.getSuccess("审核成功!");
|
|
|
- }
|
|
|
- return AjaxJson.getError("审核失败!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("isLock")
|
|
|
- public AjaxJson isLock(@Validated @RequestBody StartStopDto startStopDto){
|
|
|
- boolean lock = tbPeopleService.isLock(startStopDto);
|
|
|
- return AjaxJson.getSuccess(lock + "");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping("identification")
|
|
|
-
|
|
|
- public AjaxJson identification(){
|
|
|
- tbPeopleService.identification();
|
|
|
- return AjaxJson.getSuccess();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- *边民申请加入互助组
|
|
|
- *
|
|
|
- * @author loovi
|
|
|
- * @date
|
|
|
- */
|
|
|
- @RequestMapping("applyAddGroup")
|
|
|
- public AjaxJson addAppleGroup(@RequestParam("peopleId") Long peopleId, @RequestParam("groupId") Long groupId){
|
|
|
- int i = tbPeopleService.applyAddGroup(peopleId, groupId);
|
|
|
- return AjaxJson.getSuccess("申请成功等待组长批准",i);
|
|
|
- }
|
|
|
-
|
|
|
- *获取申请互助组的申请人列表
|
|
|
- *
|
|
|
- * @author loovi
|
|
|
- * @date
|
|
|
- */
|
|
|
- @RequestMapping("getApplyList")
|
|
|
- public AjaxJson getApplyList(@RequestParam("leaderId") Long leaderId){
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- so.set("leader_id",leaderId);
|
|
|
- AjaxJson ajaxJson = tbPeopleService.getApplyList(so);
|
|
|
- return ajaxJson;
|
|
|
- }
|
|
|
-
|
|
|
- *组长是否同意申请
|
|
|
- *
|
|
|
- * @author loovi
|
|
|
- * @date
|
|
|
- */
|
|
|
- @RequestMapping("passApply")
|
|
|
- public AjaxJson passApply(@RequestParam("leaderId") Long leaderId,@RequestParam("peopleId") Long peopleId,@RequestParam("approve")int approve){
|
|
|
- int line = tbPeopleService.passApply(leaderId, peopleId, approve);
|
|
|
- return AjaxJson.getByLine(line);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * 数据导入接口
|
|
|
- * @param file
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("peopleImport")
|
|
|
- @ResponseBody
|
|
|
- public AjaxJson dataImport(@RequestParam("file") MultipartFile file){
|
|
|
- try {
|
|
|
- String importData = tbPeopleService.importData(file);
|
|
|
- AjaxJson.getSuccess(importData);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- return AjaxJson.getError();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- * 导出
|
|
|
- * @param keyword
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("peopleOutport")
|
|
|
- @ResponseBody
|
|
|
- public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
|
|
|
- try {
|
|
|
- String importData = tbPeopleService.outportExcel(keyword,filepath);
|
|
|
- AjaxJson.getSuccess(importData);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
- return AjaxJson.getError();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("rpc/peopleDto")
|
|
|
- public boolean peopleDto(@RequestBody PeopleDto peopleDto){
|
|
|
- boolean dto = tbPeopleService.peopleDto(peopleDto);
|
|
|
- return dto;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("rpc/getRpcById")
|
|
|
- public PeopleDto getRpcById(@RequestParam("id")Long peopleId){
|
|
|
- PeopleDto rpcById = tbPeopleService.getRpcById(peopleId);
|
|
|
- return rpcById;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping("rpc/getPeopleList")
|
|
|
- public List<PeopleDto> getPeopleList(@RequestParam("groupId")Long groupId) {
|
|
|
- SoMap so = SoMap.getRequestSoMap();
|
|
|
- List<PeopleDto> list = tbPeopleService.getPeopleList(so.startPage(),groupId);
|
|
|
- return list;
|
|
|
- }
|
|
|
+ public AjaxJson getById(String id) {
|
|
|
+ TbPeople t = tbPeopleService.getById(id);
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ @RequestMapping("getList")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE)
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<TbPeople> list = tbPeopleService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 改 - 删除状态(0=禁用,1=启用)
|
|
|
+ */
|
|
|
+ @RequestMapping("updateDeleteStatus")
|
|
|
+ @SaCheckPermission(TbPeople.PERMISSION_CODE_EDIT)
|
|
|
+ public AjaxJson updateDeleteStatus(String id, Integer value) {
|
|
|
+ int line = SP.publicMapper.updateColumnById(TbPeople.TABLE_NAME, "delete_status", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 审核
|
|
|
+ */
|
|
|
+ @PostMapping("judge")
|
|
|
+ public AjaxJson judge(@RequestBody TbPeople tbPeople) {
|
|
|
+ boolean judge = tbPeopleService.judge(tbPeople);
|
|
|
+ if (judge) {
|
|
|
+ return AjaxJson.getSuccess("审核成功!");
|
|
|
+ }
|
|
|
+ return AjaxJson.getError("审核失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 启/停
|
|
|
+ */
|
|
|
+ @PostMapping("isLock")
|
|
|
+ public AjaxJson isLock(@Validated @RequestBody StartStopDto startStopDto) {
|
|
|
+ boolean lock = tbPeopleService.isLock(startStopDto);
|
|
|
+ return AjaxJson.getSuccess(lock + "");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 身份识别
|
|
|
+ */
|
|
|
+ @PostMapping("identification")
|
|
|
+
|
|
|
+ public AjaxJson identification() {
|
|
|
+ tbPeopleService.identification();
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 边民申请加入互助组
|
|
|
+ *
|
|
|
+ * @author loovi
|
|
|
+ * @date
|
|
|
+ */
|
|
|
+ @RequestMapping("applyAddGroup")
|
|
|
+ public AjaxJson addAppleGroup(@RequestParam("peopleId") Long peopleId, @RequestParam("groupId") Long groupId) {
|
|
|
+ int i = tbPeopleService.applyAddGroup(peopleId, groupId);
|
|
|
+ return AjaxJson.getSuccess("申请成功等待组长批准", i);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 获取申请互助组的申请人列表
|
|
|
+ *
|
|
|
+ * @author loovi
|
|
|
+ * @date
|
|
|
+ */
|
|
|
+ @RequestMapping("getApplyList")
|
|
|
+ public AjaxJson getApplyList(@RequestParam("leaderId") Long leaderId) {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ so.set("leader_id", leaderId);
|
|
|
+ AjaxJson ajaxJson = tbPeopleService.getApplyList(so);
|
|
|
+ return ajaxJson;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 组长是否同意申请
|
|
|
+ *
|
|
|
+ * @author loovi
|
|
|
+ * @date
|
|
|
+ */
|
|
|
+ @RequestMapping("passApply")
|
|
|
+ public AjaxJson passApply(@RequestParam("leaderId") Long leaderId, @RequestParam("peopleId") Long peopleId, @RequestParam("approve") int approve) {
|
|
|
+ int line = tbPeopleService.passApply(leaderId, peopleId, approve);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 数据导入接口
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("peopleImport")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxJson dataImport(@RequestParam("file") MultipartFile file) {
|
|
|
+ try {
|
|
|
+ String importData = tbPeopleService.importData(file);
|
|
|
+ AjaxJson.getSuccess(importData);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return AjaxJson.getError();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 导出
|
|
|
+ *
|
|
|
+ * @param keyword
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("peopleOutport")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxJson dataOutport(@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "filepath", required = false) String filepath) {
|
|
|
+ try {
|
|
|
+ String importData = tbPeopleService.outportExcel(keyword, filepath);
|
|
|
+ AjaxJson.getSuccess(importData);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return AjaxJson.getError();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("getPeopleForGroup")
|
|
|
+ @SaCheckPermission(TbPeople.TABLE_NAME)
|
|
|
+ public AjaxJson getPeopleForGroup(@RequestParam Long tradeAreaId) {
|
|
|
+ return AjaxJson.getSuccessData(tbPeopleService.getPeopleForGroup(tradeAreaId,1));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 注册身份时对应的表添加数据
|
|
|
+ */
|
|
|
+ @RequestMapping("rpc/peopleDto")
|
|
|
+ public boolean peopleDto(@RequestBody PeopleDto peopleDto) {
|
|
|
+ boolean dto = tbPeopleService.peopleDto(peopleDto);
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 根据ID获取边民信息
|
|
|
+ */
|
|
|
+ @RequestMapping("rpc/getRpcById")
|
|
|
+ public PeopleDto getRpcById(@RequestParam("id") Long peopleId) {
|
|
|
+ PeopleDto rpcById = tbPeopleService.getRpcById(peopleId);
|
|
|
+ return rpcById;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 查集合 - 根据条件(参数为空时代表忽略指定条件)
|
|
|
+ */
|
|
|
+ @RequestMapping("rpc/getPeopleList")
|
|
|
+ public List<PeopleDto> getPeopleList(@RequestParam("groupId") Long groupId) {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<PeopleDto> list = tbPeopleService.getPeopleList(so.startPage(), groupId);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|