From c3a37601a4867103447b6a2a57ae0227d1512109 Mon Sep 17 00:00:00 2001 From: zhangnaisong <2434969829@qq.com> Date: 星期三, 24 一月 2024 11:08:50 +0800 Subject: [PATCH] 位置共享修改提交 --- ard-work/src/main/java/com/ruoyi/app/application/domain/ArdAppApplication.java | 122 ++++++++++ ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java | 147 ++++++++++++ ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java | 70 +++++ ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java | 169 ++++++++++++++ ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java | 69 +++++ ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml | 107 ++++++++ 6 files changed, 684 insertions(+), 0 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java new file mode 100644 index 0000000..f4b7176 --- /dev/null +++ b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java @@ -0,0 +1,147 @@ +package com.ruoyi.app.application.controller; + +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.utils.SecurityUtils; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.app.application.domain.ArdAppApplication; +import com.ruoyi.app.application.service.IArdAppApplicationService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆Controller + * + * @author ard + * @date 2024-01-23 + */ +@RestController +@RequestMapping("/app/application") +public class ArdAppApplicationController extends BaseController +{ + @Autowired + private IArdAppApplicationService ardAppApplicationService; + + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('app:application:list')") + @GetMapping("/list") + public TableDataInfo list(ArdAppApplication ardAppApplication) + { + startPage(); + List<ArdAppApplication> list = ardAppApplicationService.selectArdAppApplicationList(ardAppApplication); + return getDataTable(list); + } + + /** + * 瀵煎嚭鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('app:application:export')") + @Log(title = "鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ArdAppApplication ardAppApplication) + { + List<ArdAppApplication> list = ardAppApplicationService.selectArdAppApplicationList(ardAppApplication); + ExcelUtil<ArdAppApplication> util = new ExcelUtil<ArdAppApplication>(ArdAppApplication.class); + util.exportExcel(response, list, "鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鏁版嵁"); + } + + /** + * 鑾峰彇鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('app:application:query')") + @GetMapping(value = "/{applicationId}") + public AjaxResult getInfo(@PathVariable("applicationId") String applicationId) + { + return success(ardAppApplicationService.selectArdAppApplicationByApplicationId(applicationId)); + } + + /** + * 鏂板鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + @PreAuthorize("@ss.hasPermi('app:application:add')") + @Log(title = "鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ArdAppApplication ardAppApplication) + { + return toAjax(ardAppApplicationService.insertArdAppApplication(ardAppApplication)); + } + + /** + * 淇敼鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + @PreAuthorize("@ss.hasPermi('app:application:edit')") + @Log(title = "鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ArdAppApplication ardAppApplication) + { + return toAjax(ardAppApplicationService.updateArdAppApplication(ardAppApplication)); + } + + /** + * 鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + @PreAuthorize("@ss.hasPermi('app:application:remove')") + @Log(title = "鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆", businessType = BusinessType.DELETE) + @DeleteMapping("/{applicationIds}") + public AjaxResult remove(@PathVariable String[] applicationIds) + { + return toAjax(ardAppApplicationService.deleteArdAppApplicationByApplicationIds(applicationIds)); + } + + @PostMapping("/sendCheckCommandersPosition") + @ApiOperation("鍙戣捣鏌ョ湅鎸囨尌绔綅缃�") + public AjaxResult sendCheckCommandersPosition(@RequestBody Map<String,Object> para) { + String usersId = SecurityUtils.getUserId(); + try{ + int result = ardAppApplicationService.sendCheckCommandersPosition(usersId,para); + return result > 0 ? AjaxResult.success() : AjaxResult.error(); + }catch(Exception e){ + e.printStackTrace(); + return AjaxResult.error(); + } + } + + @PostMapping("/sendCheckSYCarsPosition") + @ApiOperation("鍙戣捣鏌ョ湅杞﹁締浣嶇疆") + public AjaxResult sendCheckSYCarsPosition(@RequestBody Map<String,Object> para) { + String usersId = SecurityUtils.getUserId(); + try{ + int result = ardAppApplicationService.sendCheckSYCarsPosition(usersId,para); + return result > 0 ? AjaxResult.success() : AjaxResult.error(); + }catch(Exception e){ + e.printStackTrace(); + return AjaxResult.error(); + } + } + + @GetMapping("/getCheckPosition") + @ApiOperation("鎸囨尌绔煡鐪嬩綅缃敵璇�") + public AjaxResult getCheckPosition() { + String usersId = SecurityUtils.getUserId(); + try{ + Map<String,List<Map<String,Object>>> result = ardAppApplicationService.getCheckPosition(usersId); + return AjaxResult.success(result); + }catch(Exception e){ + e.printStackTrace(); + return AjaxResult.error(); + } + } +} diff --git a/ard-work/src/main/java/com/ruoyi/app/application/domain/ArdAppApplication.java b/ard-work/src/main/java/com/ruoyi/app/application/domain/ArdAppApplication.java new file mode 100644 index 0000000..42ed3d2 --- /dev/null +++ b/ard-work/src/main/java/com/ruoyi/app/application/domain/ArdAppApplication.java @@ -0,0 +1,122 @@ +package com.ruoyi.app.application.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆瀵硅薄 ard_app_application + * + * @author ard + * @date 2024-01-23 + */ +public class ArdAppApplication extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 鐢宠涓婚敭 */ + @Excel(name = "鐢宠涓婚敭") + private String applicationId; + + /** 鎸囨尌绔垨PC绔富閿� */ + @Excel(name = "鎸囨尌绔垨PC绔富閿�") + private String commanderId; + + /** 鍗曞叺绔富閿� */ + @Excel(name = "鍗曞叺绔富閿�") + private String soilderId; + + /** 鐢宠鍘熷洜 */ + @Excel(name = "鐢宠鍘熷洜") + private String reason; + + /** 鐢宠绫诲瀷 */ + @Excel(name = "鐢宠绫诲瀷") + private String applicationType; + + /** 瀹℃壒鍚屾剰鏃堕棿鎴� */ + @Excel(name = "瀹℃壒鍚屾剰鏃堕棿鎴�") + private String begin; + + /** 瀹℃壒鐘舵�� */ + @Excel(name = "瀹℃壒鐘舵��") + private String state; + + public void setApplicationId(String applicationId) + { + this.applicationId = applicationId; + } + + public String getApplicationId() + { + return applicationId; + } + public void setCommanderId(String commanderId) + { + this.commanderId = commanderId; + } + + public String getCommanderId() + { + return commanderId; + } + public void setSoilderId(String soilderId) + { + this.soilderId = soilderId; + } + + public String getSoilderId() + { + return soilderId; + } + public void setReason(String reason) + { + this.reason = reason; + } + + public String getReason() + { + return reason; + } + public void setApplicationType(String applicationType) + { + this.applicationType = applicationType; + } + + public String getApplicationType() + { + return applicationType; + } + public void setBegin(String begin) + { + this.begin = begin; + } + + public String getBegin() + { + return begin; + } + public void setState(String state) + { + this.state = state; + } + + public String getState() + { + return state; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("applicationId", getApplicationId()) + .append("commanderId", getCommanderId()) + .append("soilderId", getSoilderId()) + .append("reason", getReason()) + .append("applicationType", getApplicationType()) + .append("begin", getBegin()) + .append("state", getState()) + .toString(); + } +} diff --git a/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java new file mode 100644 index 0000000..91cf3fd --- /dev/null +++ b/ard-work/src/main/java/com/ruoyi/app/application/mapper/ArdAppApplicationMapper.java @@ -0,0 +1,70 @@ +package com.ruoyi.app.application.mapper; + +import java.util.List; +import java.util.Map; + +import com.ruoyi.app.application.domain.ArdAppApplication; +import org.apache.ibatis.annotations.Param; + +/** + * 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆Mapper鎺ュ彛 + * + * @author ard + * @date 2024-01-23 + */ +public interface ArdAppApplicationMapper +{ + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + public ArdAppApplication selectArdAppApplicationByApplicationId(String applicationId); + + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鍒楄〃 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆闆嗗悎 + */ + public List<ArdAppApplication> selectArdAppApplicationList(ArdAppApplication ardAppApplication); + + /** + * 鏂板鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + public int insertArdAppApplication(ArdAppApplication ardAppApplication); + + /** + * 淇敼鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + public int updateArdAppApplication(ArdAppApplication ardAppApplication); + + /** + * 鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 缁撴灉 + */ + public int deleteArdAppApplicationByApplicationId(String applicationId); + + /** + * 鎵归噺鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationIds 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteArdAppApplicationByApplicationIds(String[] applicationIds); + + public int insertArdAppApplicationList(@Param("ardAppApplicationList")List<ArdAppApplication> ardAppApplicationList); + + public int updateArdAppApplicationByCommanderIdAndSoilderIdAndType(ArdAppApplication ardAppApplication); + + public List<Map<String,Object>> selectArdAppApplicationByCommanderId(String usersId); +} diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java new file mode 100644 index 0000000..6de1315 --- /dev/null +++ b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java @@ -0,0 +1,69 @@ +package com.ruoyi.app.application.service; + +import java.util.List; +import java.util.Map; + +import com.ruoyi.app.application.domain.ArdAppApplication; + +/** + * 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆Service鎺ュ彛 + * + * @author ard + * @date 2024-01-23 + */ +public interface IArdAppApplicationService +{ + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + public ArdAppApplication selectArdAppApplicationByApplicationId(String applicationId); + + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鍒楄〃 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆闆嗗悎 + */ + public List<ArdAppApplication> selectArdAppApplicationList(ArdAppApplication ardAppApplication); + + /** + * 鏂板鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + public int insertArdAppApplication(ArdAppApplication ardAppApplication); + + /** + * 淇敼鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + public int updateArdAppApplication(ArdAppApplication ardAppApplication); + + /** + * 鎵归噺鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationIds 闇�瑕佸垹闄ょ殑鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteArdAppApplicationByApplicationIds(String[] applicationIds); + + /** + * 鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆淇℃伅 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 缁撴灉 + */ + public int deleteArdAppApplicationByApplicationId(String applicationId); + + public int sendCheckCommandersPosition(String usersId, Map<String,Object> para); + + public int sendCheckSYCarsPosition(String usersId, Map<String,Object> para); + + public Map<String,List<Map<String,Object>>> getCheckPosition(String usersId); +} diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java new file mode 100644 index 0000000..85ecd11 --- /dev/null +++ b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java @@ -0,0 +1,169 @@ +package com.ruoyi.app.application.service.impl; + +import java.util.HashMap; +import java.util.List; + +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.uuid.IdUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.Map; + +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.app.application.mapper.ArdAppApplicationMapper; +import com.ruoyi.app.application.domain.ArdAppApplication; +import com.ruoyi.app.application.service.IArdAppApplicationService; + +import javax.annotation.Resource; + +/** + * 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆Service涓氬姟灞傚鐞� + * + * @author ard + * @date 2024-01-23 + */ +@Service +public class ArdAppApplicationServiceImpl implements IArdAppApplicationService { + @Resource + private ArdAppApplicationMapper ardAppApplicationMapper; + + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + @Override + public ArdAppApplication selectArdAppApplicationByApplicationId(String applicationId) { + return ardAppApplicationMapper.selectArdAppApplicationByApplicationId(applicationId); + } + + /** + * 鏌ヨ鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆鍒楄〃 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + */ + @Override + public List<ArdAppApplication> selectArdAppApplicationList(ArdAppApplication ardAppApplication) { + return ardAppApplicationMapper.selectArdAppApplicationList(ardAppApplication); + } + + /** + * 鏂板鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + @Override + public int insertArdAppApplication(ArdAppApplication ardAppApplication) { + return ardAppApplicationMapper.insertArdAppApplication(ardAppApplication); + } + + /** + * 淇敼鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param ardAppApplication 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * @return 缁撴灉 + */ + @Override + public int updateArdAppApplication(ArdAppApplication ardAppApplication) { + return ardAppApplicationMapper.updateArdAppApplication(ardAppApplication); + } + + /** + * 鎵归噺鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆 + * + * @param applicationIds 闇�瑕佸垹闄ょ殑鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteArdAppApplicationByApplicationIds(String[] applicationIds) { + return ardAppApplicationMapper.deleteArdAppApplicationByApplicationIds(applicationIds); + } + + /** + * 鍒犻櫎鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆淇℃伅 + * + * @param applicationId 鍗曞叺绔敵璇锋煡鐪嬫寚鎸ョ浣嶇疆鎴栦笁涓�杞﹁締浣嶇疆涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteArdAppApplicationByApplicationId(String applicationId) { + return ardAppApplicationMapper.deleteArdAppApplicationByApplicationId(applicationId); + } + + @Override + public int sendCheckCommandersPosition(String usersId, Map<String, Object> para) { + String reason = (String) para.get("reason"); + List<String> usersIdList = (List<String>) para.get("usersIdList"); + int result = 0; + for(String commanderId : usersIdList){ + ArdAppApplication ardAppApplication = new ArdAppApplication(); + ardAppApplication.setCommanderId(commanderId); + ardAppApplication.setSoilderId(usersId); + ardAppApplication.setReason(reason); + ardAppApplication.setApplicationType("Commander"); + ardAppApplication.setBegin(""); + ardAppApplication.setState("0"); + int resultSingle = ardAppApplicationMapper.updateArdAppApplicationByCommanderIdAndSoilderIdAndType(ardAppApplication); + result = result + resultSingle; + if(resultSingle == 0){ + ardAppApplication.setApplicationId(IdUtils.simpleUUID()); + resultSingle = ardAppApplicationMapper.insertArdAppApplication(ardAppApplication); + result = result + resultSingle; + } + } + return result; + } + + @Override + public int sendCheckSYCarsPosition(String usersId, Map<String, Object> para) { + String reason = (String) para.get("reason"); + List<String> usersIdList = (List<String>) para.get("usersIdList"); + int result = 0; + for(String commanderId : usersIdList){ + ArdAppApplication ardAppApplication = new ArdAppApplication(); + ardAppApplication.setCommanderId(commanderId); + ardAppApplication.setSoilderId(usersId); + ardAppApplication.setReason(reason); + ardAppApplication.setApplicationType("SYCar"); + ardAppApplication.setBegin(""); + ardAppApplication.setState("0"); + int resultSingle = ardAppApplicationMapper.updateArdAppApplicationByCommanderIdAndSoilderIdAndType(ardAppApplication); + result = result + resultSingle; + if(resultSingle == 0){ + ardAppApplication.setApplicationId(IdUtils.simpleUUID()); + resultSingle = ardAppApplicationMapper.insertArdAppApplication(ardAppApplication); + result = result + resultSingle; + } + } + return result; + } + + @Override + public Map<String, List<Map<String, Object>>> getCheckPosition(String usersId) { + Map<String, List<Map<String, Object>>> result = new HashMap(); + //鏌ョ湅鎸囨尌绔綅缃敵璇� + List<Map<String,Object>> ardAppApplicationList = ardAppApplicationMapper.selectArdAppApplicationByCommanderId(usersId); + List<Map<String, Object>> resultCommanderPosition = new ArrayList(); + for(Map<String, Object> map : ardAppApplicationList){ + if(((String)map.get("applicationType")).equals("Commander")){ + resultCommanderPosition.add(map); + } + } + //鏌ョ湅杞﹁締浣嶇疆鐢宠 + List<Map<String, Object>> resultSYCarsPosition = new ArrayList(); + for(Map<String, Object> map : ardAppApplicationList){ + if(((String)map.get("applicationType")).equals("SYCar")){ + resultSYCarsPosition.add(map); + } + } + result.put("commander",resultCommanderPosition); + result.put("SYCars",resultSYCarsPosition); + return result; + } +} diff --git a/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml new file mode 100644 index 0000000..61d99d9 --- /dev/null +++ b/ard-work/src/main/resources/mapper/app/ArdAppApplicationMapper.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.ruoyi.app.application.mapper.ArdAppApplicationMapper"> + + <resultMap type="ArdAppApplication" id="ArdAppApplicationResult"> + <result property="applicationId" column="application_id" /> + <result property="commanderId" column="commander_id" /> + <result property="soilderId" column="soilder_id" /> + <result property="reason" column="reason" /> + <result property="applicationType" column="application_type" /> + <result property="begin" column="begin" /> + <result property="state" column="state" /> + </resultMap> + + <sql id="selectArdAppApplicationVo"> + select application_id, commander_id, soilder_id, reason, application_type, begin, state from ard_app_application + </sql> + + <select id="selectArdAppApplicationList" parameterType="ArdAppApplication" resultMap="ArdAppApplicationResult"> + <include refid="selectArdAppApplicationVo"/> + <where> + <if test="applicationId != null and applicationId != ''"> and application_id = #{applicationId}</if> + <if test="commanderId != null and commanderId != ''"> and commander_id = #{commanderId}</if> + <if test="soilderId != null and soilderId != ''"> and soilder_id = #{soilderId}</if> + <if test="reason != null and reason != ''"> and reason = #{reason}</if> + <if test="applicationType != null and applicationType != ''"> and application_type = #{applicationType}</if> + <if test="begin != null and begin != ''"> and begin = #{begin}</if> + <if test="state != null and state != ''"> and state = #{state}</if> + </where> + </select> + + <select id="selectArdAppApplicationByApplicationId" parameterType="String" resultMap="ArdAppApplicationResult"> + <include refid="selectArdAppApplicationVo"/> + where application_id = #{applicationId} + </select> + + <insert id="insertArdAppApplication" parameterType="ArdAppApplication"> + insert into ard_app_application + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="applicationId != null">application_id,</if> + <if test="commanderId != null">commander_id,</if> + <if test="soilderId != null">soilder_id,</if> + <if test="reason != null">reason,</if> + <if test="applicationType != null">application_type,</if> + <if test="begin != null">begin,</if> + <if test="state != null">state,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="applicationId != null">#{applicationId},</if> + <if test="commanderId != null">#{commanderId},</if> + <if test="soilderId != null">#{soilderId},</if> + <if test="reason != null">#{reason},</if> + <if test="applicationType != null">#{applicationType},</if> + <if test="begin != null">#{begin},</if> + <if test="state != null">#{state},</if> + </trim> + </insert> + + <update id="updateArdAppApplication" parameterType="ArdAppApplication"> + update ard_app_application + <trim prefix="SET" suffixOverrides=","> + <if test="commanderId != null">commander_id = #{commanderId},</if> + <if test="soilderId != null">soilder_id = #{soilderId},</if> + <if test="reason != null">reason = #{reason},</if> + <if test="applicationType != null">application_type = #{applicationType},</if> + <if test="begin != null">begin = #{begin},</if> + <if test="state != null">state = #{state},</if> + </trim> + where application_id = #{applicationId} + </update> + + <delete id="deleteArdAppApplicationByApplicationId" parameterType="String"> + delete from ard_app_application where application_id = #{applicationId} + </delete> + + <delete id="deleteArdAppApplicationByApplicationIds" parameterType="String"> + delete from ard_app_application where application_id in + <foreach item="applicationId" collection="array" open="(" separator="," close=")"> + #{applicationId} + </foreach> + </delete> + + <insert id="insertArdAppApplicationList" parameterType="com.ruoyi.app.application.domain.ArdAppApplication" > + insert into ard_app_application (application_id,commander_id,soilder_id, + reason,application_type,begin,state) + values + <foreach collection ="ardAppApplicationList" item="ardAppApplication" separator =","> + (#{ardAppApplication.application_id},#{ardAppApplication.commander_id},#{ardAppApplication.soilder_id}, + #{ardAppApplication.reason},#{ardAppApplication.application_type},#{ardAppApplication.begin},#{ardAppApplication.state}) + </foreach > + </insert> + + <update id="updateArdAppApplicationByCommanderIdAndSoilderIdAndType" parameterType="com.ruoyi.app.application.domain.ArdAppApplication"> + update ard_app_application set reason = #{reason},begin = #{begin},state = #{state} + where commander_id = #{commanderId} and soilder_id = #{soilderId} and application_type = #{applicationType} + </update> + + <select id="selectArdAppApplicationByCommanderId" parameterType="java.lang.String" resultType="java.util.Map"> + select aaa.soilder_id as "soilderId",aaa.commander_id as "commanderId", + aaa.reason,aaa.begin,aaa.state,aaa.application_type as "applicationType", + su.user_name as "userName",su.nick_name as "nickName" from ard_app_application aaa + inner join sys_user su on aaa.soilder_id = su.user_id + where commander_id = #{usersId} and state = '0' + </select> +</mapper> \ No newline at end of file -- Gitblit v1.9.3