This commit is contained in:
Paidax
2025-04-28 08:40:55 +08:00
parent 9b9e53056f
commit d046c3be5d
144 changed files with 2559 additions and 1222 deletions
@@ -13,11 +13,14 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.wizzer.framework.base.Result;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.dao.CndPlus;
import io.v.nutz.base.query.PageForm;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.base.utils.ViTool;
import io.v.nutz.sys.models.User;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.welfare.feature.WelfareFeature;
@@ -42,6 +45,7 @@ import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.random.R;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
@@ -71,15 +75,15 @@ import java.util.stream.Collectors;
@At("/platform/welfare/list/mange")
public class WelfareListController {
@Inject
private Dao dao;
@Inject
private MsgApi msgApi;
@Inject
private WelfareListService welfareListService;
@Inject
private WelfareProjectService projectService;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/welfare/list/ListMange.html")
@RequiresPermissions("welfare.list.mange")
@@ -116,7 +120,7 @@ public class WelfareListController {
wus.userSign,
wus.courierNumber,
wus.receiveAddress,
GROUP_CONCAT( DISTINCT wuso.optionName, '', wus.selectNum, '份)' ) AS gist_list
GROUP_CONCAT( DISTINCT wuso.optionName, IF(wus.selectSpecs is not null, (CONCAT('—规格:', wus.selectSpecs)), ''), '', wus.selectNum, '份)' ) AS gist_list
FROM
view_welfare_list wl
LEFT JOIN welfare_project_user_selection wus ON wus.welfareId = wl.projectId
@@ -276,8 +280,9 @@ public class WelfareListController {
selection.setSubjectId(v.getString("subjectId"));
selection.setSelectNum(v.getInt("selectNum"));
selection.setUserSign(finalSign);
selection.setSelectSpecs(v.getString("selectSpecs"));
return selection;
}).collect(Collectors.toList());
}).toList();
List<WelfareUserSelection> userSelections1 = userSelections.stream().filter(v -> v.getSelectNum() > 0).collect(Collectors.toList());
dao.insert(userSelections1);
@@ -394,8 +399,7 @@ public class WelfareListController {
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
public Object importCourierNumber(@Param("file") TempFile file,
@Param("projectId") String projectId,
@Param("optionId") String optionId
) {
@Param("optionId") String optionId) {
if (Lang.isEmpty(file)) {
return Result.error("上传的文件不能为空");
}
@@ -668,4 +672,80 @@ public class WelfareListController {
}
}
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object queryNotWelfareListUsers(@Param("projectId") String projectId, @Param("query") String query){
if (StrUtil.isBlank(query)) {
return null;
}
Sql sql = Sqls.create("""
SELECT
id,
loginname,
username,
unitid,
unitname
FROM
`user`
$condition
AND id not in (select userId from welfare_list where projectId = @projectId)
""").setParam("projectId", projectId);
Cnd cnd = Cnd.NEW();
SqlExpressionGroup seg = new SqlExpressionGroup();
seg.orLike("loginname", query);
seg.orLike("username", query);
cnd.and(seg);
sql.setCondition(cnd);
Pagination pagination = welfareListService.listPageMap(1, 10, sql);
return pagination;
}
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object addWelfareList(@Param("projectId") String projectId, @Param("userIds") String[] userIds) {
List<String> userIdList = Arrays.stream(userIds).toList();
Sql sql = Sqls.create("select id,loginname,username,unionid,unitid,userState,personType from `user` where id in (@userIdList)")
.setParam("userIdList", userIdList);
sql.setCallback(Sqls.callback.maps());
dao.execute(sql);
List<NutMap> userInfoList = (List<NutMap>) sql.getResult();
List<WelfareList> welfareLists = userInfoList.stream().map(v -> {
WelfareList welfareList = new WelfareList();
welfareList.setId(R.UU32());
welfareList.setProjectId(projectId);
welfareList.setUserId(v.getString("id"));
welfareList.setWelfareUnitId(v.getString("unionid"));
welfareList.setWelfareSecondLevelUnitId(v.getString("unitid"));
welfareList.setIsReceive(null);
welfareList.setIsAutoSelect(null);
welfareList.setUserState(v.getString("userState"));
welfareList.setPersonType(v.getString("personType"));
return welfareList;
}).toList();
dao.fastInsert(welfareLists);
return null;
}
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object sendMsg(@Param("projectId") String projectId, @Param("title") String title,
@Param("content") String content, @Param("loginname") String loginname){
if (StrUtil.isNotBlank(loginname)) {
String link = Globals.AppDomain + "/mobile/welfare/list/receive?projectId=%s".formatted(projectId);
msgApi.sendMsg(List.of("DingTalk"), loginname, 2, title, content, "", link);
}
return null;
}
}
@@ -71,7 +71,7 @@ public class WelfareMineController {
WHEN wus.selectUserId IS NOT NULL THEN 1
ELSE 0
END AS isChoose,
GROUP_CONCAT(DISTINCT wuso.optionName,wus.selectNum) AS gist_list,
GROUP_CONCAT( DISTINCT wuso.optionName, IF(wus.selectSpecs is not null, (CONCAT('—规格:', wus.selectSpecs)), ''), '', wus.selectNum, '份)' ) AS gist_list,
wus.receiveAddress,
wcn.courierNumber,
wl.userId
@@ -121,7 +121,7 @@ public class WelfareMineController {
@At
@ViReturn
@RequiresPermissions("welfare.mine")
public Object getUserSelection(String projectId, String userId) {
public Object getUserSelection(String projectId, @Param(value = "userId", required = false) String userId) {
Sql sql = Sqls.create("""
SELECT
wpus.id AS selectId,
@@ -133,6 +133,7 @@ public class WelfareMineController {
wpus.userSign,
wpus.courierNumber,
wpus.selectTime,
wpus.selectSpecs,
wpso.imgUrl,
wpso.simpleDesc,
wpso.simpleDesc,
@@ -22,6 +22,7 @@ import io.v.nutz.zhgh.welfare.model.WelfareProjectSubjectOption;
import io.v.nutz.zhgh.welfare.model.WelfareUserSelection;
import io.v.nutz.zhgh.welfare.service.WelfareListService;
import io.v.nutz.zhgh.welfare.service.WelfareProjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
@@ -53,6 +54,7 @@ import java.util.stream.Collectors;
* @date: 2021/2/3
* @since 1.0
*/
@Slf4j
@IocBean
@Ok("json")
@At("/platform/welfare/project/mange")
@@ -120,6 +122,7 @@ public class WelfareProjectMangeController {
@RequiresPermissions("welfare.project.mange")
public Object save(WelfareProject project) {
System.out.println(project);
Trans.exec(() -> {
project.setYear(DateUtil.thisYear());
@@ -202,6 +205,7 @@ public class WelfareProjectMangeController {
optionChain.add("shoppingName", o.getShoppingName());
optionChain.add("supplier", o.getSupplier());
optionChain.add("simpleDesc", o.getSimpleDesc());
optionChain.add("specs", o.getSpecs());
dao.insert(WelfareProjectSubjectOption.class, optionChain);
});
});
@@ -296,7 +300,7 @@ public class WelfareProjectMangeController {
@At
@ViReturn
@RequiresPermissions("welfare.list.mange")
public Object sendMsgToNotWelfareUsers(String projectId, String sendMsgValue) {
public Object sendMsgToNotWelfareUsers(String projectId, String title, String sendMsgValue) {
Sql sql = Sqls.create("""
SELECT
u.loginname
@@ -326,7 +330,7 @@ public class WelfareProjectMangeController {
if ("51e3449b5f234dd58757de63142d6b48".equals(projectId)) {
msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, "答题纪念品!点开有惊喜!", sendMsgValue, "", link);
} else {
msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, "职工福利", sendMsgValue, "", link);
msgApi.sendMsg(List.of("DingTalk"), loginNames, 2, title, sendMsgValue, "", link);
}
return null;
}
@@ -65,7 +65,7 @@ public class WelfareUserChooseController {
ELSE 0
END AS isChoose,
wus.selectTime,
GROUP_CONCAT(DISTINCT wuso.optionName ,'',wus.selectNum,'份)') AS gist_list,
GROUP_CONCAT( DISTINCT wuso.optionName, IF(wus.selectSpecs is not null, (CONCAT('—规格:', wus.selectSpecs)), ''), '', wus.selectNum, '份)' ) AS gist_list,
wus.receiveAddress
FROM
welfare_project wp
@@ -99,8 +99,7 @@ public class WelfareSingleController {
@Param(value = "month", required = false) String month,
@Param(value = "welfareUnitCode", required = false) String welfareUnitCode,
@Param(value = "unionGroupId", required = false) String unionGroupId,
@Param(value = "personType", required = false) String personType
) {
@Param(value = "personType", required = false) String personType) {
return welfareSingleService.pageData(projectId, month, welfareUnitCode, unionGroupId, personType);
}
@@ -389,7 +388,7 @@ public class WelfareSingleController {
u.idcard AS idCard,
u.mobile,
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
GROUP_CONCAT(DISTINCT wpso.optionName ,'',wpus.selectNum,'份)') optionName,
GROUP_CONCAT(DISTINCT wpso.optionName, IF(wpus.selectSpecs is not null, (CONCAT('—规格:', wpus.selectSpecs)), ''), '',wpus.selectNum,'份)') optionName,
wpus.courierNumber
FROM
welfare_project_user_selection wpus
@@ -1,5 +1,6 @@
package io.v.nutz.zhgh.welfare.model;
import cn.hutool.json.JSONObject;
import io.v.nutz.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -7,6 +8,8 @@ import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @author zxy
* @Description TODO
@@ -90,6 +93,12 @@ public class WelfareProjectSubjectOption extends BaseModel {
@ColDefine(type = ColType.VARCHAR,width = 100)
private String simpleDesc;
@Column
@Comment("商品规格")
@ColDefine(type = ColType.MYSQL_JSON)
private List<JSONObject> specs;
private Integer rank;
private Long selectCount;
}
@@ -86,6 +86,11 @@ public class WelfareUserSelection {
@ColDefine(type = ColType.DATETIME)
private Date selectExpressDate;
@Column
@Comment("选择规格参数")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String selectSpecs;
@Data
public static class LogisticsTrace {
//运单号物流流转当前最新变更时间
@@ -470,7 +470,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
u.mobile,
IF(LOCATE('undefined',wpus.receiveAddress)>0,NULL,wpus.receiveAddress) as receiveAddress,
wpus.userSign,
GROUP_CONCAT(DISTINCT wpso.optionName ,'',wpus.selectNum,'份)') optionName,
GROUP_CONCAT(DISTINCT wpso.optionName, IF(wpus.selectSpecs is not null, (CONCAT('—规格:', wpus.selectSpecs)), ''), '',wpus.selectNum,'份)') optionName,
wpus.courierNumber
FROM
welfare_project_user_selection wpus