Commit de764c19 by zhengxj

finish 商户端/服务商端 新增订单入口 on 20191128 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@25210 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 98ee91a5
......@@ -89,10 +89,10 @@ public interface Constants {
*/
public static final String SYS_DEFAULT_MERCHANT_ROLE_CHAR = "sys_default_merchant";
public static final byte ORDER_TYPE_INSTALL = 1;
public static final int ORDER_TYPE_INSTALL = 1;
public static final byte ORDER_TYPE_BIDDING = 4;
public static final int ORDER_TYPE_BIDDING = 4;
public static final byte CREATE_ORDER_OFF = 0;
public static final int CREATE_ORDER_OFF = 0;
}
......@@ -1005,6 +1005,7 @@ public class UserController extends BaseController {
subject.login(token);
session.setAttribute(com.glsx.common.constants.Constants.SESSION_USERNAME_KEY, username);
session.setAttribute(com.glsx.common.constants.Constants.SESSION_USERID_KEY, user.getId());
session.setAttribute(com.glsx.common.constants.Constants.CREATE_ORDER_TYPE, user.getCreateOrderType());
map.put("JSESSIONID", subject.getSession().getId());
if (StringUtils.isEmpty(miniOpenId)) {
map.put("isMiniAuth", false);
......
......@@ -18,7 +18,7 @@ public interface SysUserOrderTypeMapper {
int deleteByUserId(@Param(value = "userId") int userId);
List<SysUserOrderType> selectByUserId(@Param(value = "userId") Integer userId,
@Param(value = "createOrderType") Byte createOrderType);
List<SysUserOrderType> selectUserCreateOrderTypeByUserId(@Param(value = "userId") Integer userId,
@Param(value = "createOrderType") Integer createOrderType);
}
\ No newline at end of file
......@@ -171,13 +171,13 @@ public class SysUser extends BaseModel implements Serializable {
* 用户可以创建的订单类型
*/
private byte createOrderType;
private int createOrderType;
public byte getCreateOrderType() {
public int getCreateOrderType() {
return createOrderType;
}
public void setCreateOrderType(byte createOrderType) {
public void setCreateOrderType(int createOrderType) {
this.createOrderType = createOrderType;
}
public Integer getUserId() {
......
......@@ -216,17 +216,18 @@ public class SysProviderServiceImpl implements ISysProviderService {
//默认角色 add by jin v1.4.0.5 19/9/3 END
// 用户可以创建的订单类型 v1.5.1
// 用户可以创建的订单类型 v1.5.1,服务商只能创建安装单
if (com.glsx.usercenter.constants.Constants.ORDER_TYPE_INSTALL == sysManager.getCreateOrderType()) {
List<SysUserOrderType> list = userOrderTypeMapper.selectByUserId(id,
List<SysUserOrderType> list = userOrderTypeMapper.selectUserCreateOrderTypeByUserId(id,
com.glsx.usercenter.constants.Constants.ORDER_TYPE_INSTALL);
if (list.isEmpty()) {
SysUserOrderType record = new SysUserOrderType();
record.setUserId(id);
record.setCreateOrderType((int) com.glsx.usercenter.constants.Constants.ORDER_TYPE_INSTALL);
record.setCreateOrderType(com.glsx.usercenter.constants.Constants.ORDER_TYPE_INSTALL);
userOrderTypeMapper.insertSelective(record);
}
} else if (com.glsx.usercenter.constants.Constants.CREATE_ORDER_OFF == sysManager.getCreateOrderType()) {
// 关闭状态
userOrderTypeMapper.deleteByUserId(id);
}
......
......@@ -298,7 +298,17 @@ public class SysUserServiceImpl implements SysUserService {
SysUserExample sysUserExample = new SysUserExample();
SysUserExample.Criteria criteria = sysUserExample.createCriteria();
criteria.andUsernameEqualTo(userName);
return sysUserMapper.selectByExample(sysUserExample);
List<SysUser> list = sysUserMapper.selectByExample(sysUserExample);
if (!list.isEmpty()) {
list.get(0).setCreateOrderType(0);
List<SysUserOrderType> types = userOrderTypeMapper.selectUserCreateOrderTypeByUserId(list.get(0).getId(),
null);
if (!types.isEmpty()) {
list.get(0).setCreateOrderType(types.get(0).getCreateOrderType());
}
}
return list;
}
@Override
......@@ -453,7 +463,7 @@ public class SysUserServiceImpl implements SysUserService {
// 商户可以创建的订单类型 v1.5.1
if (com.glsx.usercenter.constants.Constants.ORDER_TYPE_INSTALL == sysMerchant.getCreateOrderType()
|| com.glsx.usercenter.constants.Constants.ORDER_TYPE_BIDDING == sysMerchant.getCreateOrderType()) {
List<SysUserOrderType> list = userOrderTypeMapper.selectByUserId(sysMerchant.getId(),
List<SysUserOrderType> list = userOrderTypeMapper.selectUserCreateOrderTypeByUserId(sysMerchant.getId(),
sysMerchant.getCreateOrderType());
if (list.isEmpty()) {
SysUserOrderType record = new SysUserOrderType();
......
......@@ -62,13 +62,20 @@
WHERE user_id = #{userId,jdbcType=INTEGER}
</delete>
<select id="selectByUserId" resultType="com.glsx.usercenter.pojo.user.SysUserOrderType">
SELECT
id ,
user_id userId,
create_order_type createOrderType
FROM sys_user_order_type
WHERE user_id = #{userId,jdbcType=INTEGER} and create_order_type = #{createOrderType,jdbcType=INTEGER}
</select>
<select id="selectUserCreateOrderTypeByUserId" resultType="com.glsx.usercenter.pojo.user.SysUserOrderType">
SELECT
id ,
user_id userId,
create_order_type createOrderType
FROM sys_user_order_type
<where>
<if test="userId != null">
and user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="createOrderType != null">
and create_order_type = #{createOrderType,jdbcType=INTEGER}
</if>
</where>
</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!