| | |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime()); |
| | | User byId1 = userMapper.selectById(byId.getStoreStaffId()); |
| | | model.addAttribute("city",byId1); |
| | | model.addAttribute("managerName", byId1 == null ? "" : byId1.getName()); |
| | | // 历史门店的手机号可能只保存在店长账号中,编辑页需与列表保持一致地回填可用手机号。 |
| | | model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1)); |
| | | model.addAttribute("managerName", byId.getManagerName()); |
| | | model.addAttribute("managerPhone", byId.getPhone()); |
| | | model.addAttribute("type",1); |
| | | // 如果当前登陆人是运营商 |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime()); |
| | | User byId1 = userMapper.selectById(byId.getStoreStaffId()); |
| | | model.addAttribute("city",byId1); |
| | | model.addAttribute("managerName", byId1 == null ? "" : byId1.getName()); |
| | | model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1)); |
| | | model.addAttribute("managerName", byId.getManagerName()); |
| | | model.addAttribute("managerPhone", byId.getPhone()); |
| | | model.addAttribute("type",0); |
| | | |
| | | return PREFIX + "TShop_edit.html"; |
| | |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listOne") |
| | | @ResponseBody |
| | | public Object listOne(Integer id) { |
| | |
| | | if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(tStore.getPhone())) { |
| | | return ERROR; |
| | | } |
| | | if (!userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getAccount, tStore.getPhone())).isEmpty()) { |
| | | return "5001"; |
| | | } |
| | | tStore.setManagerName(userName); |
| | | if(yyId==null || type==1){ |
| | | yyId=0; |
| | | } |
| | |
| | | String space_id = data.getString("space_id"); |
| | | Integer integer = Integer.valueOf(space_id); |
| | | tStore.setId(integer); |
| | | User storeManager = createStoreManager(userName, tStore.getPhone(), tStore.getId()); |
| | | userMapper.insert(storeManager); |
| | | tStore.setStoreStaffId(storeManager.getId()); |
| | | storeService.save(tStore); |
| | | ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); |
| | | for (int i = 1; i < 9; i++) { |
| | |
| | | if (ToolUtil.isEmpty(userName) || ToolUtil.isEmpty(tStore.getPhone())) { |
| | | return ERROR; |
| | | } |
| | | LambdaQueryWrapper<User> managerAccountQuery = new LambdaQueryWrapper<User>() |
| | | .eq(User::getAccount, tStore.getPhone()); |
| | | if (byIdc.getStoreStaffId() != null) { |
| | | managerAccountQuery.ne(User::getId, byIdc.getStoreStaffId()); |
| | | } |
| | | if (!userMapper.selectList(managerAccountQuery).isEmpty()) { |
| | | return "5001"; |
| | | } |
| | | tStore.setManagerName(userName); |
| | | |
| | | if(yyId==null){ |
| | | yyId=0; |
| | |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | tStore.setOperatorId(null); |
| | | } |
| | | User storeManager = byIdc.getStoreStaffId() == null ? null : userMapper.selectById(byIdc.getStoreStaffId()); |
| | | if (storeManager == null) { |
| | | storeManager = createStoreManager(userName, tStore.getPhone(), tStore.getId()); |
| | | userMapper.insert(storeManager); |
| | | tStore.setStoreStaffId(storeManager.getId()); |
| | | } else { |
| | | storeManager.setName(userName); |
| | | storeManager.setPhone(tStore.getPhone()); |
| | | storeManager.setAccount(tStore.getPhone()); |
| | | userMapper.updateById(storeManager); |
| | | } |
| | | storeService.updateById(tStore); |
| | | |
| | | return new SuccessTip<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | private User createStoreManager(String name, String phone, Integer storeId) { |
| | | User user = new User(); |
| | | user.setName(name); |
| | | user.setPhone(phone); |
| | | user.setAccount(phone); |
| | | user.setPassword(SecureUtil.md5("a123456")); |
| | | user.setRoleid("3"); |
| | | user.setObjectType(3); |
| | | user.setObjectId(storeId); |
| | | user.setStatus(1); |
| | | user.setCreatetime(new Date()); |
| | | return user; |
| | | } |
| | | |
| | | private String resolveStoreManagerPhone(TStore store, User storeManager) { |
| | | if (ToolUtil.isNotEmpty(store.getPhone())) { |
| | | return store.getPhone(); |
| | | } |
| | | return storeManager == null ? "" : storeManager.getPhone(); |
| | | } |
| | | @RequestMapping(value = "/onChange") |
| | | @ResponseBody |
| | | public Object onChange(Integer oneId) { |
| | |
| | | @ResponseBody |
| | | public Object freeze(Integer id) { |
| | | try { |
| | | // 查询门店 获取门店店长id |
| | | TStore store = storeService.getById(id); |
| | | // 冻结 |
| | | store.setState(2); |
| | | storeService.updateById(store); |
| | | Integer storeStaffId = store.getStoreStaffId(); |
| | | User user = userService.getById(storeStaffId); |
| | | user.setStatus(2); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ResponseBody |
| | | public Object unfreeze(Integer id) { |
| | | try { |
| | | // 查询门店 获取门店店长id |
| | | TStore store = storeService.getById(id); |
| | | // 解冻 |
| | | store.setState(1); |
| | | storeService.updateById(store); |
| | | Integer storeStaffId = store.getStoreStaffId(); |
| | | User user = userService.getById(storeStaffId); |
| | | user.setStatus(1); |
| | | userService.updateById(user); |
| | | return SUCCESS_TIP; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | public Object pwd(Integer id) { |
| | | try { |
| | | TStore byId = storeService.getById(id); |
| | | if (byId == null || byId.getStoreStaffId() == null) { |
| | | return ERROR; |
| | | } |
| | | User user = userMapper.selectById(byId.getStoreStaffId()); |
| | | if (user == null) { |
| | | return ERROR; |
| | | } |
| | | user.setPassword(SecureUtil.md5("a123456")); |
| | | userMapper.updateById(user); |
| | | return SUCCESS_TIP; |
| | |
| | | private String city; |
| | | @TableField("cityCode") |
| | | private String cityCode; |
| | | @TableField("managerName") |
| | | private String managerName; |
| | | private String phone; |
| | | private String address; |
| | | private String lat; |
| | |
| | | private BigDecimal score; |
| | | private Integer state; |
| | | |
| | | private String userName; |
| | | private String userPhone; |
| | | @TableField("managerName") |
| | | private String managerName; |
| | | |
| | | /** |
| | | * 兼容历史门店:历史数据可能只在店长账号中保存手机号。 |
| | | * 列表对外的 phone 统一返回可用的店长手机号。 |
| | | * 列表手机号仅来自 t_store.phone,避免店长账号关联变化影响门店信息展示。 |
| | | */ |
| | | public String getPhone() { |
| | | return hasText(phone) ? phone : defaultString(userPhone); |
| | | } |
| | | |
| | | /** |
| | | * 兼容历史门店:当店长资料中未维护 phone 时,列表仍返回可用的门店手机号。 |
| | | * 返回空字符串而非 null,避免不同环境的 JSON 忽略 null 配置导致字段消失。 |
| | | */ |
| | | public String getUserPhone() { |
| | | return hasText(userPhone) ? userPhone : defaultString(phone); |
| | | } |
| | | |
| | | private boolean hasText(String value) { |
| | | return value != null && !value.trim().isEmpty(); |
| | | } |
| | | |
| | | private String defaultString(String value) { |
| | | return value == null ? "" : value; |
| | | return phone == null ? "" : phone; |
| | | } |
| | | |
| | | private String account; |
| | |
| | | delete from t_store_other_config where id =#{id} |
| | | </delete> |
| | | |
| | | <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | <!-- |
| | | phone 明确映射为 t_store.phone。不要同时返回两个名为 phone 的列, |
| | | 否则 MyBatis 自动映射可能按 JDBC 列顺序覆盖该字段。 |
| | | --> |
| | | <resultMap id="storeListResultMap" type="com.dsh.guns.modular.system.model.TStoreListVo" autoMapping="true"> |
| | | <result property="phone" column="storePhone"/> |
| | | </resultMap> |
| | | |
| | | <select id="listAll" resultMap="storeListResultMap"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where 1=1 |
| | | <if test="provinceCode !=null and provinceCode !=''"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and t1.managerName like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and t1.phone like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | |
| | | |
| | | |
| | | </select> |
| | | <select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | <select id="listAllStore" resultMap="storeListResultMap"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where t1.id =#{id} |
| | | <if test="provinceCode !=null and provinceCode !=''"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and t1.managerName like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and t1.phone like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | | </if> |
| | | order by t1.id desc |
| | | </select> |
| | | <select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | <select id="listAllStoresByIds" resultMap="storeListResultMap"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where t1.id in |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and t1.managerName like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and t1.phone like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | |
| | | <#button name="冻结" icon="fa-remove" clickFun="TCompetition.freeze()" space="true"/> |
| | | <#button name="解冻" icon="fa-remove" clickFun="TCompetition.unfreeze()" space="true"/> |
| | | <#button name="查看详情" icon="fa-remove" clickFun="TCompetition.info()" space="true"/> |
| | | <#button name="重置密码" icon="fa-remove" clickFun="TCompetition.reload()" space="true"/> |
| | | @} |
| | | <#button name="免费福利" icon="fa-remove" clickFun="TCompetition.gift()" space="true"/> |
| | | <#button name="首页设置" icon="fa-remove" clickFun="TCompetition.indexSet()" space="true"/> |
| | |
| | | }, |
| | | {title: '门店地址', field: 'address', visible: true, align: 'center', valign: 'middle' |
| | | }, |
| | | {title: '店长姓名', field: 'userName', visible: true, align: 'center', valign: 'middle' |
| | | {title: '店长姓名', field: 'managerName', visible: true, align: 'center', valign: 'middle' |
| | | }, |
| | | {title: '店长手机号', field: 'userPhone', visible: true, align: 'center', valign: 'middle' |
| | | {title: '店长手机号', field: 'phone', visible: true, align: 'center', valign: 'middle' |
| | | }, |
| | | {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle' |
| | | ,formatter:function (data) { |
| | |
| | | }else { |
| | | Feng.confirm("Apakah Anda pasti akan mengekspor informasi kendaraan?", operation); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | -- 门店资料独立保存店长姓名;员工账号与门店的归属由 sys_user_store 维护。 |
| | | ALTER TABLE `t_store` |
| | | ADD COLUMN `managerName` varchar(64) NULL DEFAULT NULL COMMENT '店长姓名' AFTER `cityCode`; |