Commit 1be4d0ed by 董有沛

细节修改

parent 4b47d9e6
......@@ -18,9 +18,9 @@ import org.springframework.stereotype.Component;
@Component
public interface PartnerMapper extends BaseMapper<Partner> {
@Update("update sys_user set phone = #{phone} ,name = #{name} ,account = #{account} ,sex = #{sex}, password = #{password} where id=#{id}")
@Update("update sys_user set phone = #{phone} ,name = #{name} ,account = #{account} ,sex = #{sex}, password = #{password}, roleid= #{roleId} where id=#{id}")
int updateSysUser(@Param("phone") String phone,@Param("name") String name,@Param("account") String account,@Param("sex") String sex,
@Param("password") String password,@Param("id") String id);
@Param("password") String password,@Param("roleId") String roleId,@Param("id") String id);
@Update("update hhr_user set ysm = #{ysm} ,grade = #{grade} ,id_card = #{idCard},position = #{position} ,parent_id = #{parentId} ,parent_ids = #{parentIds} where id=#{id}")
int updateHhUser(@Param("ysm") String ysm,@Param("grade") String grade,@Param("idCard") String idCard,@Param("position") String position,@Param("parentId") String parentId,@Param("parentIds") String parentIds,@Param("id") String id);
......
......@@ -34,4 +34,5 @@ public interface SalesListMapper extends BaseMapper<SalesList> {
@Delete("delete from hhr_phone_school where order_phone = #{orderPhone} ")
int deletePhoneSchool(@Param("orderPhone") String orderPhone);
}
......@@ -74,7 +74,7 @@ public class PartnerController extends BaseController {
SysUser user = sysUserMapper.selectById(id);
password = StringUtils.isNotBlank(password) ? MD5Utils.md5(password, user.getSalt()) : user.getPassword();
int updateSysUse = partnerMapper.updateSysUser(phone, name, account, sex, password, id);
int updateSysUse = partnerMapper.updateSysUser(phone, name, account, sex, password,roleId, id);
int updateHhUser = partnerMapper.updateHhUser(ysm, grade, idCard,position,parentId,parentIds,id);
int updateSchoolRef = partnerMapper.updateSchoolRef(schoolId, id);
if (updateSysUse == 1 && updateHhUser == 1 && updateSchoolRef == 1) {
......@@ -98,7 +98,7 @@ public class PartnerController extends BaseController {
Wrapper<SysUser> wrapperSys = new EntityWrapper<SysUser>();
wrapperSys.like(StringUtils.isNotBlank(name), "name", name, SqlLike.DEFAULT);
wrapperSys.eq("status", "10");
wrapperSys.eq("status", "1");
List<SysUser> sysUserList = sysUserMapper.selectList(wrapperSys);
Wrapper<School> wrapperSchool = new EntityWrapper<School>();
......
......@@ -104,7 +104,6 @@ public class SalesListController extends BaseController{
@RequestParam("activateTimeStart") String activateTimeStart,@RequestParam("activateTimeEnd") String activateTimeEnd,
@RequestParam(name = "pageNo", required = false) int pageIndex,
@RequestParam(name = "pageSize", required = false) int pageSize){
System.out.println("");
Page<SalesList> page = new Page<>(pageIndex, pageSize);
Wrapper<SalesList> wrapperOrder = new EntityWrapper<SalesList>();
wrapperOrder.eq(StringUtils.isNotBlank(orderPhone), "order_phone", orderPhone);
......
package com.winsun.controller;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.util.ResponseEntity;
import com.winsun.bean.SalesList;
import com.winsun.mapper.SalesListMapper;
import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.MapUtil;
import cn.hutool.http.Method;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
/**
*
* @author dongyp
*
*/
@Slf4j
@RestController
@RequestMapping("/mobile/salesList")
public class SalesListMobileController extends BaseController {
// 登记验证码标识
private static String CODE = "registerCode";
//5分钟内有效
private static long CODETIME = 1000 * 60*5;
private SalesListMapper salesListMapper;
@Autowired
private StringRedisTemplate stringRedisTemplate;
public SalesListMobileController(SalesListMapper salesListMapper) {
this.salesListMapper = salesListMapper;
}
@RequestMapping(value="/registerPhone", method = RequestMethod.POST)
public Object registerPhone(@RequestParam("orderPhone") String orderPhone,@RequestParam("salesSubst") String salesSubst,
@RequestParam("salesSchool") String salesSchool,@RequestParam("phoneCode") String phoneCode) {
JSONObject jsonObject = new JSONObject();
// 处理放号清单号码的销售学校清单,用于重复判断
Map<String, Object> phoneSchoolMap = MapUtil.listToMap(salesListMapper.getPhoneSchool(), "order_phone", "school");
String desc = "";
boolean isRepeat = false;
String status = "1";
if(null != phoneSchoolMap.get(orderPhone)) {
String phoneSchool = (String)phoneSchoolMap.get(orderPhone);
if(phoneSchool.indexOf(salesSchool) > -1) {
desc = "该放号号码已经在该销售学校登记";
jsonObject.put("code", "200");
jsonObject.put("desc", desc);
return jsonObject;
}else {
desc = "该放号号码与其它学校有重复登记,请后期进行核对;";
isRepeat = true;
status = "0";
}
}
SalesList order = new SalesList();
order.setOrderPhone(orderPhone);
order.setUserId("22");
order.setCreateTime(new Date());
order.setSalesSubst(salesSubst);
order.setSalesSchool(salesSchool);
order.setOrderType("1");
order.setName("22");
order.setAccount("22");
int num = salesListMapper.insert(order);
if(isRepeat) {
salesListMapper.updateRepealOrder(status, desc, orderPhone);
}
return jsonObject;
}
@RequestMapping(value = "/getPhoneCode",method = RequestMethod.POST)
public Object phoneLoginCodeY(@RequestParam("phone") String phone){
//5分钟内有效
String verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
String code = phone + CODE;
Long expire = stringRedisTemplate.getExpire(code);
//验证码 有效时间是五分钟倒计时
if (expire>(60*4)){
return ResponseEntity.newJSON("code", 400, "message", "请勿频繁发送手机验证码操作!");
}
stringRedisTemplate.opsForValue().set(code, verificationCode, CODETIME, TimeUnit.MILLISECONDS);
Map<String, Object> sent=new HashMap<>();
sent.put("code",400);
try {
if (phone.length() == 11){
SendSmsAndMail.sendSms(phone, verificationCode, "7");
sent.put("message", "发送成功");
sent.put("code", 200);
}else {
sent.put("message","当前用户手机号码不合法!");
}
}catch (Exception e){
log.info("错误信息:{}",e.getMessage());
sent.put("message","手机短信发送失败");
}
return sent;
}
}
......@@ -165,9 +165,6 @@ public class YxtOrderController extends BaseController {
@RequestParam(name = "orderNum", required = false) String orderNum,
@RequestParam(name = "pageNo") int pageNo, @RequestParam(name = "pageSize") int pageSize) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
return ResponseData.error("无数据权限");
}
String month1 = "";
String month2 = "";
if (StringUtils.isNotBlank(month)) {
......
......@@ -41,7 +41,7 @@ public class DataAuthUtil {
if(user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
resultList = targetList;
}else if(user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "县分"))) {
}else if(user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "县分管理员"))) {
resultList = authData(targetList,"substName",sysUser.getSubstName());
}else if(user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "督导"))) {
Set<Integer> schoolIdSet = authSchool(sysUser.getId());
......@@ -115,7 +115,7 @@ public class DataAuthUtil {
String schoolId = schoolRefMaps.get(sysUser.getId()).toString();
Map<String, Object> schoolMap = schoolMaps.get(schoolId);
sysUser.setSubstName(schoolMap.get("sub_name").toString());
sysUser.setSubstName(schoolMap.get("subName").toString());
}
return sysUser;
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.Order;
import com.winsun.bean.SysUser;
import com.winsun.mapper.*;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.XbkUtil;
......
package com.winsun.TimingTask;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.SysUser;
import com.winsun.mapper.SysUserMapper;
import com.winsun.utils.MD5Utils;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@Configuration
@EnableScheduling
public class UserTask {
@Autowired
private SysUserMapper sysUserMapper;
//@Scheduled(cron = "0 */1 * * * ? ")
@PostMapping("/userTask")
public void updateUser() {
Wrapper<SysUser> wrapper = new EntityWrapper<SysUser>();
wrapper.isNull("salt");
List<SysUser> list = sysUserMapper.selectList(wrapper);
for(SysUser user : list) {
String salt = MD5Utils.getRandomString(5);
String password = user.getAccount();
password = MD5Utils.md5(password, salt);
user.setPassword(password);
user.setSalt(salt);
sysUserMapper.updateById(user);
}
}
}
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