| | |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.core.util.WoUtil; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.TBalanceModifyRecord; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | |
| | | @Controller |
| | | @RequestMapping("/tUser") |
| | | public class TUserController extends BaseController { |
| | | |
| | | |
| | | private String PREFIX = "/system/tUser/"; |
| | | |
| | | |
| | | @Autowired |
| | | private ITUserService tUserService; |
| | | |
| | | @Resource |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | /** |
| | | * 跳转到用户管理首页 |
| | | */ |
| | |
| | | public String index() { |
| | | return PREFIX + "tUser.html"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 跳转到修改用户管理 |
| | | */ |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tUserService.getUserList(page, beginTime, endTime, ShiroExtUtil.getUser().getRoleType(), ShiroExtUtil.getUser().getObjectId(), isAuth, state, id, nickName, phone, companyName)); |
| | | page.setRecords(tUserService.getUserList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), isAuth, state, id, nickName, phone, companyName)); |
| | | return super.packForBT(page); |
| | | } |
| | | /** |
| | |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tUserService.getUserListCoupon(page, beginTime, endTime, ShiroExtUtil.getUser().getRoleType(), ShiroExtUtil.getUser().getObjectId(), isAuth, state, id, nickName, phone, companyName)); |
| | | page.setRecords(tUserService.getUserListCoupon(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), isAuth, state, id, nickName, phone, companyName)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | |
| | | public Object updateBalance(@RequestParam Integer tUserId, |
| | | @RequestParam Integer updateType, |
| | | @RequestParam BigDecimal money) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | Integer objectId = ShiroExtUtil.getUser().getObjectId(); |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | Integer objectId = shiroExtUtil.getUser().getObjectId(); |
| | | |
| | | List<TEnterpriseWithdrawal> companyId = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", objectId)); |
| | | if(companyId.size()==0){ |
| | | return "5000"; |
| | | } |
| | | |
| | | List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | if(userWithdrawals.size()==0){ |
| | | return "5001"; |
| | | } |
| | | |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | if (1 == updateType.intValue()){ //增加 |
| | | // List<TEnterpriseWithdrawal> companyId = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", objectId)); |
| | | // if (companyId.size() == 0) { |
| | | // return "5000"; |
| | | // } |
| | | // |
| | | // List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); |
| | | // if (userWithdrawals.size() == 0) { |
| | | // return "5001"; |
| | | // } |
| | | |
| | | if (SinataUtil.isNotEmpty(tUser)) { |
| | | if (1 == updateType.intValue()) { //增加 |
| | | tUser.setBalance(tUser.getBalance().add(money)); |
| | | |
| | | }else if (2 == updateType.intValue()){ //减少 |
| | | if((tUser.getBalance().subtract(money)).compareTo(new BigDecimal(0)) == -1){ |
| | | |
| | | } else if (2 == updateType.intValue()) { //减少 |
| | | if ((tUser.getBalance().subtract(money)).compareTo(new BigDecimal(0)) == -1) { |
| | | tUser.setBalance(new BigDecimal(0)); |
| | | }else{ |
| | | } else { |
| | | tUser.setBalance(tUser.getBalance().subtract(money)); |
| | | } |
| | | } |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | |
| | | |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | |
| | | |
| | | /// 插入余额修改记录 |
| | | TBalanceModifyRecord tBalanceModifyRecord = new TBalanceModifyRecord(); |
| | | tBalanceModifyRecord.setCreateTime(DateUtil.parseTime(DateUtil.getTime())); |
| | | tBalanceModifyRecord.setMoney(money); |
| | | tBalanceModifyRecord.setType(updateType); |
| | | |
| | | |
| | | Random random = new Random(); |
| | | String result=""; |
| | | for (int i=0;i<8;i++) |
| | | { |
| | | String result = ""; |
| | | for (int i = 0; i < 8; i++) { |
| | | result+=random.nextInt(10); |
| | | } |
| | | tBalanceModifyRecord.setRecordID(result); |
| | |
| | | public Object updatePassword(@RequestParam Integer tUserId, |
| | | @RequestParam String password) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | if (SinataUtil.isNotEmpty(tUser)) { |
| | | tUser.setPassWord(ShiroKit.md5(password, "&a.s")); |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | public Object optUser(@RequestParam Integer tUserId,@RequestParam Integer optType,@RequestParam String remark) { |
| | | TUser tUser = tUserService.selectById(tUserId); |
| | | if (SinataUtil.isNotEmpty(tUser)){ |
| | | if (1 == optType.intValue()){ //冻结 |
| | | if (1 == optType.intValue()) { //冻结 |
| | | tUser.setState(2); |
| | | tUser.setRemark(remark); |
| | | |
| | | |
| | | //增加推送 |
| | | Map<String,String> map = new HashMap<>(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("uid", tUser.getId().toString()); |
| | | String result = HttpRequestUtil.postRequest(PushURL.freeze_user_url, map); |
| | | System.out.println("冻结用户:【userId="+tUser.getId().toString()+"】,调用接口:"+result); |
| | | |
| | | }else if (2 == optType.intValue()){ //解冻 |
| | | System.out.println("冻结用户:【userId=" + tUser.getId().toString() + "】,调用接口:" + result); |
| | | |
| | | } else if (2 == optType.intValue()) { //解冻 |
| | | tUser.setState(1); |
| | | tUser.setRemark(remark); |
| | | } |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(ShiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | tUser.setUpdateTime(new Date()); |
| | | tUser.setUpdateUser(shiroExtUtil.getUser().getId()); |
| | | tUserService.updateById(tUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | } |
| | | user.setEmergencyContact(emergencyContact); |
| | | user.setEmergencyContactNumber(emergencyContactNumber); |
| | | if ("是".equals(isAuth)){ |
| | | if ("是".equals(isAuth)) { |
| | | user.setIsAuth(2); |
| | | }else if ("否".equals(isAuth)){ |
| | | } else if ("否".equals(isAuth)) { |
| | | user.setIsAuth(1); |
| | | } |
| | | user.setName(name); |
| | |
| | | user.setPassWord(ShiroKit.md5(passWord, "&a.s")); |
| | | user.setState(1); |
| | | user.setFlag("1"); |
| | | user.setInsertTime(new Date()); |
| | | user.setInsertUser(ShiroExtUtil.getUser().getId()); |
| | | tUserService.insert(user); |
| | | user.setInsertTime(new Date()); |
| | | user.setInsertUser(shiroExtUtil.getUser().getId()); |
| | | tUserService.insert(user); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | */ |
| | | @RequestMapping(value = "/outUser") |
| | | public void outUser(HttpServletRequest request, HttpServletResponse response) { |
| | | List<Map<String, Object>> listMap = tUserService.getUserListNoPage(ShiroExtUtil.getUser().getRoleType(), ShiroExtUtil.getUser().getObjectId()); |
| | | List<Map<String, Object>> listMap = tUserService.getUserListNoPage(shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId()); |
| | | |
| | | // 表格数据【封装】 |
| | | List<List<String>> dataList = new ArrayList<>(); |