Compare commits

..

2 Commits

Author SHA1 Message Date
liuwu 09a1d68bd4 Merge remote-tracking branch 'origin/master' 2023-09-19 09:52:19 +08:00
liuwu 8ea7d365f9 修改页面和接口 2023-09-19 09:52:09 +08:00
2 changed files with 87 additions and 38 deletions

View File

@ -1,9 +1,11 @@
package com.cyx.web.base.controller; package com.cyx.web.base.controller;
import com.alibaba.fastjson.JSONArray;
import com.cyx.common.core.controller.BaseController; import com.cyx.common.core.controller.BaseController;
import com.cyx.common.core.domain.AjaxResult; import com.cyx.common.core.domain.AjaxResult;
import com.cyx.common.core.domain.entity.SysUser; import com.cyx.common.core.domain.entity.SysUser;
import com.cyx.common.json.JSONObject; import com.cyx.common.json.JSONObject;
import com.cyx.common.utils.DateUtils;
import com.cyx.web.base.domain.TAmentAdvancedDept; import com.cyx.web.base.domain.TAmentAdvancedDept;
import com.cyx.web.base.domain.TAmentAdvancedParty; import com.cyx.web.base.domain.TAmentAdvancedParty;
import com.cyx.web.base.domain.TAmentPartyAffairs; import com.cyx.web.base.domain.TAmentPartyAffairs;
@ -18,8 +20,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@Controller @Controller
@RequestMapping("/base/index") @RequestMapping("/base/index")
@ -34,91 +40,91 @@ public class BigScreenController extends BaseController {
/** /**
* 所有统计 * 所有统计
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/groupAll") @PostMapping("/groupAll")
@ResponseBody @ResponseBody
public AjaxResult groupAll(TAmentPartyAffairs am) public AjaxResult groupAll(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.groupAll(am); List<Map<String, Object>> list = partyAffairsService.groupAll(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 党务及意识形态 * 党务及意识形态
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/dwysxt") @PostMapping("/dwysxt")
@ResponseBody @ResponseBody
public AjaxResult dwysxt(TAmentPartyAffairs am) public AjaxResult dwysxt(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.dwysxt(am); List<Map<String, Object>> list = partyAffairsService.dwysxt(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 党风廉政建设 * 党风廉政建设
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/dflzjs") @PostMapping("/dflzjs")
@ResponseBody @ResponseBody
public AjaxResult dflzjs(TAmentPartyAffairs am) public AjaxResult dflzjs(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.dflzjs(am); List<Map<String, Object>> list = partyAffairsService.dflzjs(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 日常考核指标 * 日常考核指标
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/rckhzb") @PostMapping("/rckhzb")
@ResponseBody @ResponseBody
public AjaxResult rckhzb(TAmentPartyAffairs am) public AjaxResult rckhzb(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.rckhzb(am); List<Map<String, Object>> list = partyAffairsService.rckhzb(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 季度考核指标 * 季度考核指标
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/ndkhbz") @PostMapping("/ndkhbz")
@ResponseBody @ResponseBody
public AjaxResult ndkhbz(TAmentPartyAffairs am) public AjaxResult ndkhbz(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.ndkhbz(am); List<Map<String, Object>> list = partyAffairsService.ndkhbz(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 部门完成情况 * 部门完成情况
*
* @param am * @param am
* @return * @return
*/ */
@PostMapping("/bmwcqk") @PostMapping("/bmwcqk")
@ResponseBody @ResponseBody
public AjaxResult bmwcqk(TAmentPartyAffairs am) public AjaxResult bmwcqk(TAmentPartyAffairs am) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
am.setDeptId(u.getDeptId()); am.setDeptId(u.getDeptId());
List<Map<String,Object>> list = partyAffairsService.bmwcqk(am); List<Map<String, Object>> list = partyAffairsService.bmwcqk(am);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -127,47 +133,86 @@ public class BigScreenController extends BaseController {
@PostMapping("/tradeEcharts") @PostMapping("/tradeEcharts")
@ResponseBody @ResponseBody
public AjaxResult tradeEcharts(TAmentTrade tAmentTrade) public AjaxResult tradeEcharts(TAmentTrade tAmentTrade) {
{ AtomicInteger yearCount = new AtomicInteger();
int yearCount = 0; AtomicReference<Double> yearMoney = new AtomicReference<>(0.0000);
double yearMoney = 0.0000; int monthCount = 0;
double monthMoney = 0.0000;
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
List<Map<String,Object>> list = tAmentTradeService.tradeEcharts(tAmentTrade); List<Map<String, Object>> list = tAmentTradeService.tradeEcharts(tAmentTrade);
for (int i=0;i<list.size();i++){ Map<String, String> tradeMap = new TreeMap<>();
yearCount+=Integer.parseInt(list.get(i).get("count").toString()); JSONArray typeArray = new JSONArray();
yearMoney+=Double.parseDouble(list.get(i).get("trade").toString()); JSONArray dataArray = new JSONArray();
String month = DateUtils.parseDateToStr("YYYY-MM", new Date());
list.forEach(l -> {
typeArray.add(l.get("type"));
JSONArray array = JSONArray.parseArray("[" + l.get("json").toString() + "]");
array.forEach(a -> {
Map<String, Object> m = (Map<String, Object>) a;
tradeMap.put(m.get("label").toString(), m.get("label").toString());
yearCount.addAndGet(Integer.parseInt(m.get("count").toString()));
yearMoney.updateAndGet(v -> new Double((double) (v + Double.parseDouble(m.get("trade").toString()))));
});
});
// 所有小分类
for (Map.Entry<String, String> entry : tradeMap.entrySet()) {
JSONObject object1 = new JSONObject();
object1.put("name", entry.getKey());
JSONArray array1 = new JSONArray();
// 三个大分类
for (int i = 0; i < list.size(); i++) {
String month1 = list.get(i).get("month").toString();
JSONArray array = JSONArray.parseArray("[" + list.get(i).get("json").toString() + "]");
AtomicInteger count = new AtomicInteger();
AtomicReference<Double> trade = new AtomicReference<>(0.0);
array.forEach(a -> {
Map<String, Object> m = (Map<String, Object>) a;
if (entry.getKey().equals(m.get("label").toString()) && month1.equals(month)) {
count.set(Integer.parseInt(m.get("count").toString()));
trade.set(Double.parseDouble(m.get("trade").toString()));
} }
object.put("list",list); });
object.put("yearCount",yearCount); monthCount += count.get();
object.put("yearMoney",yearMoney); monthMoney += trade.get();
array1.add(trade.get());
}
object1.put("array", array1);
dataArray.add(object1);
}
object.put("monthCount", monthCount);
object.put("monthMoney", monthMoney);
object.put("yearCount", yearCount);
object.put("yearMoney", yearMoney);
object.put("type", typeArray);
object.put("data", dataArray);
return AjaxResult.success(object); return AjaxResult.success(object);
} }
/** /**
* 先进成员 * 先进成员
*
* @param pa * @param pa
* @return * @return
*/ */
@PostMapping("/advanceParity") @PostMapping("/advanceParity")
@ResponseBody @ResponseBody
public AjaxResult advanceParity(TAmentAdvancedParty pa) public AjaxResult advanceParity(TAmentAdvancedParty pa) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
List<Map<String,Object>> list = advancedPartyService.advanceParity(pa); List<Map<String, Object>> list = advancedPartyService.advanceParity(pa);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* 先进部门 * 先进部门
*
* @param dept * @param dept
* @return * @return
*/ */
@PostMapping("/advanceDept") @PostMapping("/advanceDept")
@ResponseBody @ResponseBody
public AjaxResult advanceDept(TAmentAdvancedDept dept) public AjaxResult advanceDept(TAmentAdvancedDept dept) {
{
SysUser u = getSysUser(); SysUser u = getSysUser();
List<Map<String,Object>> list = advancedDeptService.advanceDept(dept); List<Map<String, Object>> list = advancedDeptService.advanceDept(dept);
return AjaxResult.success(list); return AjaxResult.success(list);
} }

View File

@ -34,15 +34,19 @@
<select id="tradeEcharts" resultType="map"> <select id="tradeEcharts" resultType="map">
SELECT SELECT
month_of 'month', month_of 'month',
type,
ROUND( sum( trade_mony ), 4 ) trade, ROUND( sum( trade_mony ), 4 ) trade,
SUM( trade_count ) count SUM( trade_count ) count,
GROUP_CONCAT( '{"label":"', trade_type, '","trade":', trade_mony, ',"count":', trade_count, '}' ) json
FROM FROM
t_ament_trade t_ament_trade
WHERE WHERE
month_of LIKE CONCAT( '%', DATE_FORMAT( NOW(), '%Y' ), '%' ) month_of LIKE CONCAT( '%', DATE_FORMAT( NOW(), '%Y' ), '%' )
GROUP BY GROUP BY
month_of month_of,
ORDER BY month_of desc type
ORDER BY
month_of DESC
</select> </select>
<insert id="insertTAmentTrade" parameterType="TAmentTrade" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTAmentTrade" parameterType="TAmentTrade" useGeneratedKeys="true" keyProperty="id">