| | |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.AttResManagePerson; |
| | | import cn.gistack.sm.sjztmd.service.IAttResManagePersonService; |
| | | import cn.gistack.sm.sjztmd.vo.ChargePersonVO; |
| | | import cn.gistack.system.user.entity.User; |
| | | import cn.gistack.system.user.feign.IUserClient; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName AttResManagePersonController |
| | |
| | | public class AttResManagePersonController extends BladeController { |
| | | private final IAttResManagePersonService attResManagePersonService; |
| | | |
| | | private final IUserClient userClient; |
| | | |
| | | @ApiOperation(value = "中台责任人水库列表-分页列表查询", notes = "中台责任人水库列表-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public R queryPageList(AttResManagePerson attResManagePerson, Query query) { |
| | | IPage<AttResManagePerson> pageList = attResManagePersonService.page(Condition.getPage(query), Condition.getQueryWrapper(attResManagePerson)); |
| | | return R.data(pageList); |
| | | } |
| | | @ApiOperation(value = "根据手机号码获取中台责任人水库列表", notes = "根据手机号码获取中台责任人水库列表") |
| | | |
| | | @ApiOperation(value = "根据水库id获取中台责任人列表", notes = "根据水库id获取中台责任人列表") |
| | | @GetMapping(value = "/findResManagePersonByResId") |
| | | public R findResManagePersonByResId(AttResManagePerson attResManagePerson) { |
| | | |
| | | if (StringUtil.isEmpty(attResManagePerson.getResGuid())) |
| | | return R.fail("resGuid不能为空"); |
| | | |
| | | List<AttResManagePerson> list = attResManagePersonService.list(Condition.getQueryWrapper(attResManagePerson)); |
| | | return R.data(list); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据水库id获取中台责任人数据返回系统存在的用户列表", notes = "根据水库id获取中台责任人列表") |
| | | @GetMapping(value = "/findResManagePersonByResIdReturnSys") |
| | | public R findResManagePersonByResIdReturnSys(AttResManagePerson attResManagePerson) { |
| | | |
| | | if (StringUtil.isEmpty(attResManagePerson.getResGuid())) |
| | | return R.fail("resGuid不能为空"); |
| | | |
| | | List<AttResManagePerson> list = attResManagePersonService.list(Condition.getQueryWrapper(attResManagePerson)); |
| | | List<Object> resList = new ArrayList<>(); |
| | | for (AttResManagePerson person : list) { |
| | | List<User> userList = userClient.userInfoByPhone("000000", person.getUserPhone()).getData(); |
| | | if (userList.size() > 0) { |
| | | Map<Object, Object> map = new HashMap<>(); |
| | | map.put("value", userList.get(0).getId().toString()); |
| | | map.put("name", userList.get(0).getName()); |
| | | map.put("type",person.getType()); |
| | | resList.add(map); |
| | | } |
| | | } |
| | | return R.data(resList); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据水库id获取中台责任人列表", notes = "根据水库id获取中台责任人列表") |
| | | @GetMapping(value = "/findResManagePersonByResIds") |
| | | public R findResManagePersonByResId(String resIds) { |
| | | |
| | | if (StringUtil.isEmpty(resIds)) |
| | | return R.fail("resGuid不能为空"); |
| | | |
| | | List<AttResManagePerson> list = attResManagePersonService.attResManagePersonListByResIds(resIds); |
| | | return R.data(list); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据手机号码获取中台责任人水库id组合字符串", notes = "根据手机号码获取中台责任人水库id组合字符串") |
| | | @GetMapping(value = "/queryListByPhone") |
| | | public R queryListByPhone(AttResManagePerson attResManagePerson) { |
| | | List<AttResManagePerson> list = attResManagePersonService.list(Condition.getQueryWrapper(attResManagePerson)); |
| | | final List<AttResManagePerson> list = attResManagePersonService.list(Condition.getQueryWrapper(attResManagePerson)); |
| | | List<String> reslist = new ArrayList<>(); |
| | | list.forEach(item->{ |
| | | list.forEach(item -> { |
| | | reslist.add(item.getResGuid()); |
| | | }); |
| | | return R.data(StringUtil.join(reslist,",")); |
| | | return R.data(StringUtil.join(reslist, ",")); |
| | | } |
| | | |
| | | @ApiOperation(value="责任人-添加/修改", notes="责任人-添加/修改") |
| | | @PostMapping(value = "/editZrr") |
| | | public R editZrr(@RequestBody AttResManagePerson attResManagePerson) { |
| | | if (StringUtil.isEmpty(attResManagePerson.getResGuid())) |
| | | return R.fail("resGuid不能为空"); |
| | | if (StringUtil.isEmpty(attResManagePerson.getType())) |
| | | return R.fail("type不能为空"); |
| | | if (StringUtil.isEmpty(attResManagePerson.getSysResource())) |
| | | return R.fail("sysResource不能为空"); |
| | | if (StringUtil.isEmpty(attResManagePerson.getUserPhone())) |
| | | return R.fail("userPhone不能为空"); |
| | | if (StringUtil.isEmpty(attResManagePerson.getUserName())) |
| | | return R.fail("userName不能为空"); |
| | | return R.data(attResManagePersonService.saveOrUpdateResManagePerson(attResManagePerson)); |
| | | } |
| | | |
| | | @ApiOperation(value="多个责任人-添加/修改", notes="多个责任人-添加/修改") |
| | | @PostMapping(value = "/editListZrr") |
| | | public R editListZrr(@RequestBody List<AttResManagePerson> attResManagePersons) { |
| | | return attResManagePersonService.saveOrUpdateResManagePerson(attResManagePersons); |
| | | } |
| | | |
| | | @ApiOperation(value="同步责任人用户", notes="同步责任人用户") |
| | | @GetMapping(value = "/synchronizationUser") |
| | | public R synchronizationUser() { |
| | | return R.data(attResManagePersonService.synchronizationAddUser()); |
| | | } |
| | | |
| | | /** |
| | | * 查询巡查、技术、主管、行政、水行政部门责任人 |
| | | * @param resId 水库id |
| | | * @param findType 指定查询的责任人类型 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getManagePersonList") |
| | | public R getManagePersonList(String resId,String findType){ |
| | | |
| | | List<ChargePersonVO> list = attResManagePersonService.getManagePersonList(resId,findType); |
| | | return R.data(list); |
| | | |
| | | } |
| | | |
| | | } |