Commit da012d88 authored by mengmeng's avatar mengmeng

Merge branch 'lings' into 'master'

Lings

See merge request !15
parents 2abe9abb 0f892a08
......@@ -71,6 +71,7 @@ public class ShiroConfig {
filterMap.put("/modeler.html", "anon");
filterMap.put("/captcha", "anon");
filterMap.put("/favicon.ico", "anon");
// filterMap.put("/**", "anon");
filterMap.put("/**", "oauth2");
shiroFilter.setFilterChainDefinitionMap(filterMap);
......@@ -89,4 +90,4 @@ public class ShiroConfig {
advisor.setSecurityManager(securityManager);
return advisor;
}
}
\ No newline at end of file
}
......@@ -52,7 +52,8 @@ public class NewsController {
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "status", value = "状态,0未审核,1审核通过,2审核不通过", paramType = "query", dataType="String")
})
@RequiresPermissions("serviceOrder:news:page")
public Result<PageData<NewsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
......
......@@ -10,9 +10,12 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.security.user.SecurityUser;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import io.hmit.modules.serviceOrder.excel.PensionOrderExcel;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.modules.serviceOrder.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -23,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.security.Security;
import java.util.List;
import java.util.Map;
......@@ -39,6 +43,8 @@ import java.util.Map;
public class PensionOrderController {
@Autowired
private PensionOrderService pensionOrderService;
@Autowired
private UserService userService;
@GetMapping("page")
@ApiOperation("分页")
......@@ -65,6 +71,24 @@ public class PensionOrderController {
return new Result<PensionOrderDTO>().ok(data);
}
/**
* 机构订单接口
*/
@GetMapping("organization")
@ApiOperation(value = "根据状态返回订单列表(机构)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "status", value = "订单状态: 0未接单 1已派发 2已完成 3已取消 5已接单未派发", paramType = "query", dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionOrderDTO>> organization(@ApiIgnore @RequestParam Map<String, Object> params){
//登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List)
PageData<PensionOrderDTO> page = pensionOrderService.getOrganizationOrder(params, SecurityUser.getUserId());
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
......@@ -114,4 +138,41 @@ public class PensionOrderController {
ExcelUtils.exportExcelToTarget(response, null, list, PensionOrderExcel.class);
}
/**
* 机构处理
*/
@GetMapping("organizationHandle")
@ApiOperation(value = "机构处理(机构)", notes = "传参为1(派单)时,recipient_id必传")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "订单ID", paramType = "query", required = true, dataType="long") ,
@ApiImplicitParam(name = "status", value = "处理状态: 5接单 1派单 3取消", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "recipient_id", value = "接单服务人员ID", paramType = "query", dataType="long")
})
public Result organizationHandle(@ApiIgnore @RequestParam Map<String, Object> params){
// Boolean result = pensionOrderService.organizationHandle(params, SecurityUser.getUserId());
Boolean result = pensionOrderService.organizationHandle(params, 1L);
if (!result) {
return new Result().error();
}
return new Result();
}
/**
* 本机构全部人员
*/
@GetMapping("organizationStaff")
@ApiOperation(value = "本机构全部人员(机构)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<UserEntity>> organizationStaff(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<UserEntity> page = userService.getOrganizationAllUsers(params, SecurityUser.getUserId());
return new Result<PageData<UserEntity>>().ok(page);
}
}
package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 订单表
*
......@@ -12,5 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
}
\ No newline at end of file
List<PensionOrderDTO> getAllOrderByServiceId(Long serviceId, Integer status);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationServiceEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 机构服务关系
*
......@@ -12,5 +14,11 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PensionOrganizationServiceDao extends BaseDao<PensionOrganizationServiceEntity> {
}
\ No newline at end of file
/**
* 根据用户Id查询出机构的全部服务ID
* @param userId
* @return
*/
List<Long> findServiceIdListByServiceUserId(Long userId);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户
*
......@@ -12,5 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserDao extends BaseDao<UserEntity> {
}
\ No newline at end of file
UserEntity getUserByUserId(Long userId);
List<Long> getAllOrganizationStaff(Long userId);
}
......@@ -47,6 +47,8 @@ public class NewsDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "状态")
private Integer status;
// 附件
@TableField(exist = false)
......
......@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -39,8 +40,11 @@ public class NewsEntity extends BaseEntity {
* 更新者
*/
private Long updater;
private Integer status;
/**
* 更新时间
*/
private Date updateDate;
}
\ No newline at end of file
}
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import java.util.Map;
/**
* 订单表
*
......@@ -12,4 +15,8 @@ import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
*/
public interface PensionOrderService extends CrudService<PensionOrderEntity, PensionOrderDTO> {
}
\ No newline at end of file
//查询机构订单
PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);
Boolean organizationHandle(Map<String, Object> params, Long userId);
}
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
import java.util.List;
/**
* 机构表
*
......@@ -12,4 +14,5 @@ import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
*/
public interface PensionOrganizationService extends CrudService<PensionOrganizationEntity, PensionOrganizationDTO> {
}
\ No newline at end of file
List<Long> findServiceIdListByServiceUserId(Long userId);
}
package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.UserDTO;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import java.util.List;
import java.util.Map;
/**
* 用户
......@@ -16,4 +18,7 @@ public interface UserService extends CrudService<UserEntity, UserDTO> {
void saveOrUpdateUserRole(Long userId, List<Long> roleIdList);
UserEntity getUserByUserId(Long userId);
PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId);
}
......@@ -23,12 +23,14 @@ public class NewsServiceImpl extends CrudServiceImpl<NewsDao, NewsEntity, NewsDT
@Override
public QueryWrapper<NewsEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String status = (String)params.get("status");
QueryWrapper<NewsEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(status), "status", status);
return wrapper;
}
}
\ No newline at end of file
}
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.entity.UserEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import io.hmit.modules.serviceOrder.service.PensionOrderServiceService;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import io.hmit.modules.serviceOrder.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
......@@ -20,6 +32,19 @@ import java.util.Map;
@Service
public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, PensionOrderEntity, PensionOrderDTO> implements PensionOrderService {
@Autowired
private PensionOrderDao pensionOrderDao;
@Autowired
private PensionOrderServiceService pensionOrderServiceService;
@Autowired
private PensionOrganizationService pensionOrganizationService;
@Autowired
private UserService userService;
@Override
public QueryWrapper<PensionOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -33,4 +58,72 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
}
@Override
public PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId) {
//登录->查询登录人员所属机构ID->机构ID查询服务ID(List)->服务ID + 状态查询订单(List)
// IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = pensionOrganizationService.findServiceIdListByServiceUserId(userId);
Integer status = null;
if ( null != params.get("status") && !"".equals(params.get("status"))) {
status = Integer.parseInt(params.get("status").toString());
}
List<PensionOrderDTO> result = new ArrayList<>();
for (Long id : serviceIds) {
List<PensionOrderDTO> list = pensionOrderDao.getAllOrderByServiceId(id, status);
result.addAll(list);
}
// page.setTotal(result.size());
Integer pageNum = Integer.parseInt(params.get("page").toString());
Integer pageSize = Integer.parseInt(params.get("limit").toString());
Integer count = result.size();
Integer pageNo = (pageNum - 1) * pageSize;
List<PensionOrderDTO> list2 ;
if (pageNo+pageSize > count) {
list2 = result.subList(pageNo,count );
}else {
list2 = result.subList(pageNo,pageNo+pageSize);
}
return getPageData(list2, result.size(), PensionOrderDTO.class);
}
@Override
public Boolean organizationHandle(Map<String, Object> params, Long userId) {
//userId 可用于校验是否属于本机构的订单,暂未使用
Long orderId = Long.parseLong(params.get("id").toString());
PensionOrderEntity pensionOrderEntity = pensionOrderDao.selectById(orderId);
Integer status = Integer.parseInt(params.get("status").toString());
if (status == 5) {//接单
if (pensionOrderEntity.getStatus() == 0) {
pensionOrderEntity.setStatus(5);
pensionOrderEntity.setStatusName(Constant.OrderStatus.HAND_OUT.getMessage());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 1){ //派单
Long recipient_id = Long.parseLong(params.get("recipient_id").toString());
if (pensionOrderEntity.getStatus() == 5) {
pensionOrderEntity.setStatus(1);
pensionOrderEntity.setStatusName(Constant.OrderStatus.ORDER.getMessage());
UserEntity recipient = userService.getUserByUserId(recipient_id);
pensionOrderEntity.setOrderRecipientId(recipient_id);
pensionOrderEntity.setOrderRecipientName(recipient.getUsername());
pensionOrderEntity.setOrderRecipientPhone(recipient.getMobile());
pensionOrderEntity.setOrderRecipientTime(new Date());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
}else {
return false;
}
}else if (status == 3) {
if (pensionOrderEntity.getStatus() != 2 && pensionOrderEntity.getStatus() != 4) {
pensionOrderEntity.setStatus(3);
pensionOrderEntity.setStatusName(Constant.OrderStatus.CANCEL.getMessage());
pensionOrderEntity.setCancelReason(params.get("cancel_reason").toString());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
} else {
return false;
}
}
return true;
}
}
......@@ -3,12 +3,15 @@ package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.PensionOrganizationDao;
import io.hmit.modules.serviceOrder.dao.PensionOrganizationServiceDao;
import io.hmit.modules.serviceOrder.dto.PensionOrganizationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrganizationEntity;
import io.hmit.modules.serviceOrder.service.PensionOrganizationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -20,6 +23,9 @@ import java.util.Map;
@Service
public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrganizationDao, PensionOrganizationEntity, PensionOrganizationDTO> implements PensionOrganizationService {
@Autowired
private PensionOrganizationServiceDao pensionOrganizationServiceDao;
@Override
public QueryWrapper<PensionOrganizationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -31,4 +37,8 @@ public class PensionOrganizationServiceImpl extends CrudServiceImpl<PensionOrgan
}
}
\ No newline at end of file
@Override
public List<Long> findServiceIdListByServiceUserId(Long userId) {
return pensionOrganizationServiceDao.findServiceIdListByServiceUserId(userId);
}
}
package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.modules.serviceOrder.dao.UserDao;
import io.hmit.modules.serviceOrder.dto.UserDTO;
......@@ -11,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -40,4 +44,23 @@ public class UserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDT
public void saveOrUpdateUserRole(Long userId, List<Long> roleIdList) {
roleUserService.saveOrUpdate(userId,roleIdList);
}
@Override
public UserEntity getUserByUserId(Long userId) {
return baseDao.getUserByUserId(userId);
}
@Override
public PageData<UserEntity> getOrganizationAllUsers(Map<String, Object> params, Long userId) {
IPage<UserEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<Long> serviceIds = baseDao.getAllOrganizationStaff(userId);
List<UserEntity> list = new ArrayList<>();
for (Long id : serviceIds) {
UserEntity userEntity = baseDao.selectById(id);
list.add(userEntity);
}
page.setTotal(list.size());
return getPageData(list, page.getTotal(), UserEntity.class);
}
}
......@@ -13,7 +13,8 @@
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="status" column="status"/>
</resultMap>
</mapper>
\ No newline at end of file
</mapper>
......@@ -28,5 +28,17 @@
<result property="updateDate" column="update_date"/>
</resultMap>
<select id="getAllOrderByServiceId" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
SELECT po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark,
po.order_recipient_id, po.order_recipient_name, po.order_recipient_time, po.order_recipient_phone,
po.act_price, po.community_name, po.community_id, po.dept_id,
po.creator, po.creator_name, po.creator_tel, po.create_date,
ps.icon
FROM pension_order po, pension_service ps
WHERE po.service_id = ps.id AND po.service_id = #{serviceId}
<if test="status != null">
AND po.status = #{status}
</if>
</select>
</mapper>
......@@ -11,5 +11,10 @@
<result property="createDate" column="create_date"/>
</resultMap>
<select id="findServiceIdListByServiceUserId" resultType="Long">
SELECT pos.service_id FROM pension_organization_user pou, pension_organization_service pos,tb_user tu
WHERE pou.organization_id = pos.organization_id and tu.id= pou.user_id and tu.user_id= #{userId}
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -17,5 +17,15 @@
<result property="address" column="address"/>
</resultMap>
<select id="getUserByUserId" resultType="io.hmit.modules.serviceOrder.entity.UserEntity">
select * from tb_user where id = #{value}
</select>
<select id="getAllOrganizationStaff" resultType="Long">
SELECT user_id FROM pension_organization_user
WHERE organization_id = (SELECT pou.organization_id FROM pension_organization_user pou,tb_user tu
WHERE pou.user_id = tu.id and tu.user_id = #{userId});
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment