commit
This commit is contained in:
+13
@@ -11,6 +11,10 @@ import io.v.nutz.base.utils.WxHttpUtil;
|
||||
import io.v.nutz.fitnessWalk.utils.WeAppCloudUtil;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
@@ -36,6 +40,9 @@ public class FitnessWalkActivityBindingRecordController {
|
||||
@Inject
|
||||
private WxHttpUtil wxHttpUtil;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/fitnessWalk/bindingRecord.html")
|
||||
@RequiresPermissions("fitnessWalk.bindingRecord")
|
||||
@@ -68,6 +75,12 @@ public class FitnessWalkActivityBindingRecordController {
|
||||
} else {
|
||||
if (Strings.isNotBlank(unionId)) sql.append(".where({'data.unionid':'").append(unionId).append("'})");
|
||||
}
|
||||
if (io.v.nutz.util.ShiroUtil.getUserId().equals("2fdl0vr4c8j5ho38cv1r8atubl")){
|
||||
List<NutMap> query = (List<NutMap>) Daos.query(dao, Sqls.create("select id from sys_user where retired = 1").toString(), Sqls.callback.maps());
|
||||
List<String> useridList = query.stream().map(v -> v.getString("id")).collect(Collectors.toList());
|
||||
sql.append(".where({'data.userid':db.command.in(").append(Json.toJson(useridList)).append(")})");
|
||||
}
|
||||
|
||||
sql.append(".field({ data: false })");
|
||||
sql.append(".skip(").append(skip).append(")");
|
||||
sql.append(".limit(").append(pageSize).append(")");
|
||||
|
||||
+21
-7
@@ -353,13 +353,27 @@ public class FitnessWalkStepManageController {
|
||||
@Ok("json:full")
|
||||
public Result qualifiedProgress(String activityId, String userId) {
|
||||
FitnessWalkActivity activity = fitnessWalkCommonService.getActivity(activityId);
|
||||
int count = baseService.dao().
|
||||
count(FitnessWalkStep.class, Cnd.where("userId", "=", userId)
|
||||
.and("activityId", "=", activityId)
|
||||
.and("DATE(applyDate)", ">=", DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"))
|
||||
.and("DATE(applyDate)", "<=", DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"))
|
||||
.and("step", ">=", 6000)
|
||||
);
|
||||
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("userId", "=", userId);
|
||||
cnd.and("activityId", "=", activityId);
|
||||
cnd.and("DATE(applyDate)", ">=", DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"));
|
||||
cnd.and("DATE(applyDate)", "<=", DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"));
|
||||
if ("2b13da7f661dd9ea07708f1044d26dcc".equals(activityId)){
|
||||
cnd.and("step", ">=", 6000);
|
||||
} else if ("0af7fd756630931a000bd070422ce0ac".equals(activityId)){
|
||||
cnd.and("step", ">=", 3000);
|
||||
}
|
||||
|
||||
int count = baseService.dao().count(FitnessWalkStep.class, cnd);
|
||||
|
||||
// int count = baseService.dao().
|
||||
// count(FitnessWalkStep.class, Cnd.where("userId", "=", userId)
|
||||
// .and("activityId", "=", activityId)
|
||||
// .and("DATE(applyDate)", ">=", DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"))
|
||||
// .and("DATE(applyDate)", "<=", DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"))
|
||||
// .and("step", ">=", 6000)
|
||||
// );
|
||||
|
||||
Long startTime = activity.getStartTime();
|
||||
Long endTime = activity.getEndTime();
|
||||
|
||||
@@ -204,6 +204,7 @@ public class FitnessWalkStepRankingController {
|
||||
entityList.add(new ExcelExportEntity("分工会", "unionname", 20));
|
||||
entityList.add(new ExcelExportEntity("单位", "unitname", 20));
|
||||
entityList.add(new ExcelExportEntity("today".equals(mode) ? "今日步数" :"活动期间总步数", "step", 20));
|
||||
entityList.add(new ExcelExportEntity("达标天数(天)","standardsDays",20));
|
||||
try {
|
||||
ViTool.excelResponse(response, ( "today".equals(mode) ? DateUtil.format(new Date(),"yyyy年MM月dd日") : "活动期间总") + "步数榜.xlsx");
|
||||
ExportParams exportParams = new ExportParams();
|
||||
|
||||
+52
-13
@@ -25,6 +25,7 @@ import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
@@ -380,27 +381,65 @@ public class FitnessWalkCommonServiceImpl extends ViServiceImpl implements Fitne
|
||||
private Sql rankingListSql(String searchName, String searchKeyword, String activityId, String unionId, String unitId, String mode) {
|
||||
FitnessWalkActivity activity = getActivity(activityId);
|
||||
CndPlus cnd = CndPlus.create();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
userId,
|
||||
sum(step) as step,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unionname,
|
||||
u.unitname
|
||||
s.userId,
|
||||
SUM(s.step) AS step,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
over3k.standardsDays
|
||||
FROM
|
||||
`fitness_walk_step` step
|
||||
LEFT JOIN user u ON step.userId = u.id
|
||||
`user` u
|
||||
LEFT JOIN `fitness_walk_step` s ON u.id = s.userId
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
userId,
|
||||
COUNT(DISTINCT DATE(applyDate)) AS standardsDays
|
||||
FROM
|
||||
`fitness_walk_step`
|
||||
WHERE
|
||||
step > 3000
|
||||
AND activityId=@activityId and $dateSql
|
||||
GROUP BY
|
||||
userId
|
||||
) AS over3k ON u.id = over3k.userId
|
||||
$condition
|
||||
""");
|
||||
//true 查询今日
|
||||
""").setParam("activityId",activityId);
|
||||
|
||||
if ("today".equals(mode)) {
|
||||
sql.setVar("dateSql",new Static("DATE(applyDate) = '"+DateUtil.today()+"'"));
|
||||
cnd.and("DATE( applyDate )", "=", DateUtil.today());
|
||||
} else {
|
||||
sql.setVar("dateSql",new Static("DATE(applyDate) >= '"
|
||||
+DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd")+"' and DATE(applyDate) <= '"
|
||||
+DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd")+"'"));
|
||||
cnd.and("DATE( applyDate )", ">=", DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"));
|
||||
cnd.and("DATE( applyDate )", "<=", DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"));
|
||||
}
|
||||
cnd.and("step.activityId", "=", activityId);
|
||||
|
||||
// Sql sqlq = Sqls.create("""
|
||||
// SELECT
|
||||
// userId,
|
||||
// sum(step) as step,
|
||||
// u.username,
|
||||
// u.loginname,
|
||||
// u.unionname,
|
||||
// u.unitname
|
||||
// FROM
|
||||
// `fitness_walk_step` step
|
||||
// LEFT JOIN user u ON step.userId = u.id
|
||||
// $condition
|
||||
// """);
|
||||
// if ("today".equals(mode)) {
|
||||
// cnd.and("DATE( applyDate )", "=", DateUtil.today());
|
||||
// } else {
|
||||
// cnd.and("DATE( applyDate )", ">=", DateUtil.format(DateUtil.date(activity.getStartTime()), "yyyy-MM-dd"));
|
||||
// cnd.and("DATE( applyDate )", "<=", DateUtil.format(DateUtil.date(activity.getEndTime()), "yyyy-MM-dd"));
|
||||
// }
|
||||
cnd.and("s.activityId", "=", activityId);
|
||||
if (Strings.isNotBlank(unitId)) {
|
||||
cnd.and("u.unitId", "=", unitId);
|
||||
}
|
||||
@@ -411,8 +450,8 @@ public class FitnessWalkCommonServiceImpl extends ViServiceImpl implements Fitne
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "LIKE", "%" + searchKeyword + "%");
|
||||
}
|
||||
cnd.groupBy("step.userId");
|
||||
cnd.desc("step");
|
||||
cnd.groupBy("s.userId");
|
||||
cnd.desc("s.step");
|
||||
sql.setCondition(cnd);
|
||||
return sql;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ public class loginController {
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.retirePhone,
|
||||
u.birthday,
|
||||
unit.`name` unitname,
|
||||
u.unitid,
|
||||
@@ -56,7 +55,7 @@ public class loginController {
|
||||
sql.setVar("schoolCode", Globals.schoolCode);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
// cnd.and("LOWER(u.loginname)", "=", loginname.trim().toLowerCase());
|
||||
cnd.and(Cnd.exps("LOWER(u.loginname)", "=", loginname.trim().toLowerCase()).or("LOWER(u.retirePhone)", "=", loginname.trim().toLowerCase()));
|
||||
cnd.and(Cnd.exps("LOWER(u.loginname)", "=", loginname.trim().toLowerCase()).or("LOWER(u.mobile)", "=", loginname.trim().toLowerCase()));
|
||||
cnd.and("LOWER(u.username)", "=", username.trim().toLowerCase());
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
|
||||
@@ -415,7 +415,7 @@ public class RetiredUserListController {
|
||||
user.setOriginalDepartment(template.getOriginalDepartment());
|
||||
user.setFamilyName(template.getFamilyName());
|
||||
user.setHomeAddress(template.getHomeAddress());
|
||||
user.setRetirePhone(template.getRetirePhone());
|
||||
user.setMobile(template.getRetirePhone());
|
||||
user.setRetireNotes(template.getRetireNotes());
|
||||
user.setBasicDiseaseInfo(template.getBasicDiseaseInfo());
|
||||
|
||||
@@ -471,5 +471,34 @@ public class RetiredUserListController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("retired.user.list")
|
||||
public Object doImport1(TempFile file) {
|
||||
List<RetiredUserTemplate> retiredUserImportList = ExcelImportUtil.importExcel(file.getFile(), RetiredUserTemplate.class, new ImportParams());
|
||||
|
||||
List<Sys_user> retiredUserList = dao.query(Sys_user.class,
|
||||
Cnd.where("retired", "=", 1).and("username","not in",List.of("雍炳华","凤孟贤","王伟")));
|
||||
|
||||
Map<String, Sys_user> map = retiredUserList.stream().collect(Collectors.toMap(Sys_user::getUsername, v -> v));
|
||||
List<Sys_user> needUpdateList = new ArrayList<>();
|
||||
|
||||
retiredUserImportList.forEach(v->{
|
||||
Sys_user sysUser = map.get(v.getUsername());
|
||||
if (Lang.isNotEmpty(sysUser)){
|
||||
if (!v.getRetirePhone().equals(sysUser.getMobile())){
|
||||
sysUser.setMobile(v.getRetirePhone());
|
||||
needUpdateList.add(sysUser);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
dao.updateIgnoreNull(needUpdateList);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +142,8 @@
|
||||
<tr>
|
||||
<th>联系方式</th>
|
||||
<td>
|
||||
<el-form-item prop="retirePhone">
|
||||
<el-input v-model="formData.retirePhone" clearable></el-input>
|
||||
<el-form-item prop="mobile">
|
||||
<el-input v-model="formData.mobile" clearable></el-input>
|
||||
</el-form-item>
|
||||
</td>
|
||||
<th>退休性质</th>
|
||||
@@ -158,8 +158,8 @@
|
||||
|
||||
<th>是否去世</th>
|
||||
<td :colspan="3">
|
||||
<el-form-item prop="isDead"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<!-- :rules="[{required:true,message:'必填',trigger:['change','blur']}]" -->
|
||||
<el-form-item prop="isDead">
|
||||
<el-radio-group v-model="formData.isDead" size="mini">
|
||||
<el-radio label="true" border>是</el-radio>
|
||||
<el-radio label="false" border>否</el-radio>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<tr>
|
||||
<th>联系方式</th>
|
||||
<td :colspan="2">
|
||||
{{ formData.retirePhone }}
|
||||
{{ formData.mobile }}
|
||||
</td>
|
||||
<th>退休性质</th>
|
||||
<td :colspan="1">
|
||||
|
||||
@@ -142,6 +142,7 @@ layout("/layouts/platform.html"){
|
||||
{label: '分工会', prop: 'unionname', sortable: true},
|
||||
{label: '单位', prop: 'unitname'},
|
||||
{label: '步数', prop: 'step', sortable: true},
|
||||
{label: '达标天数', prop: 'standardsDays', sortable: true},
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user