Commit 8192b4da by zhanghj

V1.2.0--提交小程序端获取订货单列表接口

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@21849 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 6bc017ca
......@@ -24,7 +24,6 @@ import com.glsx.common.constants.ResultObject;
import com.glsx.common.feign.client.CommonClient;
import com.glsx.common.feign.client.UserClient;
import com.glsx.common.utils.Page;
import com.glsx.common.utils.StringUtils;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.pojo.GroupA;
......@@ -210,4 +209,31 @@ public class IndentController extends BaseController{
ResultObject result = indentService.cancel(request, id);
return result;
}
@AuthCheck
@RequestMapping(value="/getIndentListByTerminalType", method=RequestMethod.GET)
public ResultObject getIndentListByTerminalType(HttpServletRequest request, @RequestParam(defaultValue = "1") int pageIndex, @RequestParam(defaultValue = "10") int pageSize, SysIndent indent) {
Map<String, Object> result = new HashMap<String, Object>();
if(indent!=null){
logger.info("小程序端订货单列表搜索传递的参数:"+JSONObject.toJSONString(indent));
}
Integer indentStatus = indent.getIndentStatus();
/**
* 50定义为取消
*/
if (indentStatus != null && 50 == indentStatus) {
indent.setIsCanceled((byte) 1);
indent.setIndentStatus(null);
}
Page page = new Page(pageIndex, pageSize);
List<SysIndent> list = indentService.getIndentListByTerminalType(request, page, indent);
com.github.pagehelper.Page<SysIndent> pages = (com.github.pagehelper.Page<SysIndent>) list;
page.setTotalCount((int) pages.getTotal());
result.put("page", page);
result.put("items", list);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
}
}
......@@ -60,4 +60,28 @@ public interface SysIndentMapper {
*
*/
SysIndent getByUserIdAndDeviceNo(@Param("userId")int userId, @Param("deviceNo")String deviceNo);
/**
*
* @author zhanghj
* @Title: getMechanicIndentList
* @Description: TODO 获取技工端订货单列表
* @param indent
* @return
* List<SysIndent>
*
*/
List<SysIndent> getMechanicIndentList(SysIndent indent);
/**
*
* @author zhanghj
* @Title: getSPIndentList
* @Description: TODO 获取服务商端订货单列表
* @param indent
* @return
* List<SysIndent>
*
*/
List<SysIndent> getSPIndentList(SysIndent indent);
}
\ No newline at end of file
......@@ -68,9 +68,13 @@ public class SysIndent extends BaseModel{
private SysArea sysArea;
/**
* 登录终端 0:后台管理系统,3:技工端
* 登录终端 0:系统管理员,1:服务商,2:门店,3:技工
*/
private Integer terminalType;
/**
* 搜索内容
*/
private String queryContent;
public Integer getId() {
return id;
......@@ -232,6 +236,14 @@ public class SysIndent extends BaseModel{
this.terminalType = terminalType;
}
public String getQueryContent() {
return queryContent;
}
public void setQueryContent(String queryContent) {
this.queryContent = queryContent;
}
@Override
public String toString() {
return "SysIndent [id=" + id + ", indentNo=" + indentNo + ", sendType="
......
......@@ -120,4 +120,18 @@ public interface IndentService {
*
*/
ResultObject cancel(HttpServletRequest request, Integer id);
/**
*
* @author zhanghj
* @param request
* @Title: getIndentListByTerminalType
* @Description: TODO 小程序端获取订货单列表
* @param page
* @param indent
* @return
* List<SysIndent>
*
*/
List<SysIndent> getIndentListByTerminalType(HttpServletRequest request, Page page, SysIndent indent);
}
package com.glsx.ordercenter.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -19,7 +20,6 @@ import com.glsx.common.utils.Page;
import com.glsx.common.utils.UserUtils;
import com.glsx.ordercenter.constants.BizConstants;
import com.glsx.ordercenter.constants.IndentStatusEnum;
import com.glsx.ordercenter.constants.OrderActiveStatusEnum;
import com.glsx.ordercenter.constants.ResultCodeEnum;
import com.glsx.ordercenter.exception.BusinessException;
import com.glsx.ordercenter.mapper.SysIndentLogMapper;
......@@ -30,6 +30,7 @@ import com.glsx.ordercenter.pojo.SysIndentLog;
import com.glsx.ordercenter.pojo.SysIndentLogModel;
import com.glsx.ordercenter.pojo.SysIndentLogistics;
import com.glsx.ordercenter.pojo.SysReceiveAddress;
import com.glsx.ordercenter.pojo.user.SysUser;
import com.glsx.ordercenter.service.DeviceRepertoryService;
import com.glsx.ordercenter.service.IAreaService;
import com.glsx.ordercenter.service.IndentService;
......@@ -320,4 +321,57 @@ public class IndentServiceImpl implements IndentService {
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg());
}
@Override
public List<SysIndent> getIndentListByTerminalType(HttpServletRequest request, Page page,
SysIndent indent) {
// TODO Auto-generated method stub
int pageIndex = page.getPageIndex();
int pageSize = page.getPageSize();
PageHelper.startPage(pageIndex, pageSize, true);
List<SysIndent> list = new ArrayList<SysIndent>();
Integer currentUserId = UserUtils.getUserId(request);
JSONObject obj = userClient.getUserById(currentUserId);
if (obj != null && obj.getIntValue("code") == ResultCodeEnum.SUCCESS.getCode()) {
JSONObject data = obj.getJSONObject("data");
Byte userType = data.getByte("userType");
if (Constants.USER_TYPE_MECHANIC == userType) {
indent.setUserId(currentUserId);
list = getMechanicIndentList(indent);
} else if (Constants.USER_TYPE_SP == userType) {
indent.setUserId(currentUserId);
list = getSPIndentList(indent);
}
}
return list;
}
/**
*
* @author zhanghj
* @Title: getSPIndentList
* @Description: TODO 获取服务商订货单列表
* @param indent
* @return
* List<SysIndent>
*
*/
private List<SysIndent> getSPIndentList(SysIndent indent) {
// TODO Auto-generated method stub
return indentDao.getSPIndentList(indent);
}
/**
*
* @author zhanghj
* @Title: getMechanicIndentList
* @Description: TODO 获取技工端的订货单列表
* @return
* List<SysIndent>
*
*/
private List<SysIndent> getMechanicIndentList(SysIndent indent) {
// TODO Auto-generated method stub
return indentDao.getMechanicIndentList(indent);
}
}
......@@ -298,6 +298,7 @@
and su.username like #{username}
</if>
</where>
ORDER BY si.create_time desc, si.id DESC
</select>
<select id="getByIndentNo" resultMap="BaseResultMap">
SELECT * from sys_indent WHERE indent_no=#{indentNo}
......@@ -363,4 +364,114 @@
LEFT JOIN sys_device sd ON s.indent_no = sd.indent_no
where sd.user_id = #{userId} AND sd.device_no = #{deviceNo}
</select>
<select id="getMechanicIndentList" parameterType="com.glsx.ordercenter.pojo.SysIndent" resultMap="BaseResultMap">
<if test="queryContent != null and queryContent != ''">
<bind name="queryContent" value="'%' + queryContent + '%'"/>
</if>
select
si.id, si.indent_no, si.send_type, si.user_id, si.device_type,
si.device_amount, si.indent_status, si.is_canceled, si.phone,
si.receiver_name, si.district_code, si.address, si.remark,
si.create_by, si.create_time, si.update_by, si.update_time,
su.username,
sdd.data_value as deviceName
FROM
sys_indent si
LEFT JOIN sys_user su ON si.user_id = su.id
LEFT JOIN sys_dict_data sdd ON si.device_type = sdd.data_key
<where>
<if test="userId != null">
and si.user_id = #{userId}
</if>
<if test="indentStatus != null">
and si.indent_status = #{indentStatus}
</if>
<if test="isCanceled != null">
and si.is_canceled = #{isCanceled}
</if>
<if test="beginDate != null and beginDate != ''">
and date_format(si.create_time, '%Y-%m') = #{beginDate}
</if>
<if test="queryContent != null">
and si.indent_no like #{queryContent}
</if>
</where>
ORDER BY si.create_time desc, si.id DESC
</select>
<select id="getSPIndentList" parameterType="com.glsx.ordercenter.pojo.SysIndent" resultMap="BaseResultMap">
<if test="queryContent != null and queryContent != ''">
<bind name="queryContent" value="'%' + queryContent + '%'"/>
</if>
SELECT
*
FROM
(
select
si.id, si.indent_no, si.send_type, si.user_id, si.device_type,
si.device_amount, si.indent_status, si.is_canceled, si.phone,
si.receiver_name, si.district_code, si.address, si.remark,
si.create_by, si.create_time, si.update_by, si.update_time,
su.username,
sdd.data_value as deviceName
FROM
sys_indent si
LEFT JOIN sys_user su ON si.user_id = su.id
LEFT JOIN sys_dict_data sdd ON si.device_type = sdd.data_key
<where>
<if test="userId != null">
and si.user_id = #{userId}
</if>
<if test="indentStatus != null">
and si.indent_status = #{indentStatus}
</if>
<if test="isCanceled != null">
and si.is_canceled = #{isCanceled}
</if>
<if test="beginDate != null and beginDate != ''">
and date_format(si.create_time, '%Y-%m') = #{beginDate}
</if>
<if test="queryContent != null">
and si.indent_no like #{queryContent}
</if>
</where>
UNION
select
si.id, si.indent_no, si.send_type, si.user_id, si.device_type,
si.device_amount, si.indent_status, si.is_canceled, si.phone,
si.receiver_name, si.district_code, si.address, si.remark,
si.create_by, si.create_time, si.update_by, si.update_time,
su.username,
sdd.data_value as deviceName
FROM
sys_indent si
LEFT JOIN sys_user su ON si.user_id = su.id
LEFT JOIN sys_dict_data sdd ON si.device_type = sdd.data_key
LEFT JOIN sys_service_mechanic ssm ON si.user_id = ssm.mechanic_id
<where>
si.send_type = 1
<if test="userId != null">
and ssm.service_id = #{userId}
</if>
<if test="indentStatus != null">
and si.indent_status = #{indentStatus}
</if>
<if test="isCanceled != null">
and si.is_canceled = #{isCanceled}
</if>
<if test="beginDate != null and beginDate != ''">
and date_format(si.create_time, '%Y-%m') = #{beginDate}
</if>
<if test="queryContent != null">
and si.indent_no like #{queryContent}
</if>
</where>
) t
ORDER BY t.create_time DESC, t.id DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!